示例#1
0
void OptionBox::select(int p_at) {
	
	if (!popup) {
		
		DeferredAdd *dfl = deferred_add_list;
		
		while (dfl) {
		
			if (dfl->id==p_at) {
			
				selected=p_at;
				set_icon( dfl->bitmap );
				set_text( dfl->text );
				return;
			}
			
			dfl=dfl->next;
		}
		
	} else if (popup->has_ID(p_at)) {
			
		selected=p_at;
		set_text( popup->get_item_text( p_at ) );
		set_icon( popup->get_item_icon( p_at ) );
	}
		
}
示例#2
0
void consoleicons::setFarIcons()
{
	if(Global->Opt->SetIcon)
	{
		if(!Loaded)
		{
			const int IconId = (Global->Opt->SetAdminIcon && os::security::is_admin())? FAR_ICON_A : FAR_ICON;
			const auto load_icon = [IconId](icon_mode Mode) { return static_cast<HICON>(LoadImage(GetModuleHandle(nullptr), MAKEINTRESOURCE(IconId), IMAGE_ICON, GetSystemMetrics(Mode == icon_big? SM_CXICON : SM_CXSMICON), GetSystemMetrics(Mode == icon_big? SM_CXICON : SM_CXSMICON), 0)); };
			LargeIcon = load_icon(icon_big);
			SmallIcon = load_icon(icon_small);
			Loaded = true;
		}

		if (const auto hWnd = Console().GetWindow())
		{
			if(LargeIcon)
			{
				PreviousLargeIcon = set_icon(hWnd, icon_big, LargeIcon);
				LargeChanged = true;
			}
			if(SmallIcon)
			{
				PreviousSmallIcon = set_icon(hWnd, icon_small, SmallIcon);
				SmallChanged = true;
			}
		}
	}
}
示例#3
0
/*
 * Set the on-screen status text
 */
void set_smart_status() {
  static char status_text[15];
  snprintf(status_text, sizeof(status_text), "%d:%02d - %d:%02d", twenty_four_to_twelve(get_config_data()->fromhr), get_config_data()->frommin, twenty_four_to_twelve(get_config_data()->tohr), get_config_data()->tomin);
  set_icon(get_config_data()->smart && get_config_data()->weekend_until != 0, IS_WEEKEND);
  set_smart_status_on_screen(get_config_data()->smart, status_text);
  analogue_set_smart_times();
}
示例#4
0
/** \brief
 *
 * Constructor. Sets up a modeless window and adds the HUD component to a
 * ScrolledWindow component.
 *
 */
HUDWindow::HUDWindow()
{
	set_type_hint(Gdk::WINDOW_TYPE_HINT_NORMAL);
	set_title(gettext("Player HUD Window"));
	set_resizable(true);
	set_decorated(true);
	set_position(Gtk::WIN_POS_CENTER);
	set_modal(false);
	set_icon( Gdk::Pixbuf::create_from_xpm_data( Helmet_xpm ) );

	PositionWindow();

    f_charView.AddHUDColumns();
    f_charView.set_border_width( 1 );
    //f_charView.update();
	//
    f_scrolledWindow.add( f_charView );
	f_scrolledWindow.set_policy( Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC );
	f_scrolledWindow.set_shadow_type( Gtk::SHADOW_IN  );
	f_scrolledWindow.set_border_width( 1 );
	//
	f_mainBox.pack_start( f_scrolledWindow, Gtk::PACK_EXPAND_WIDGET );
	f_mainBox.pack_start( f_statusBox, Gtk::PACK_SHRINK );
	//
	add( f_mainBox );

	f_statusBox.Update();
	
	show_all_children();
}
示例#5
0
void PlatformApiStub::update_application_list(const ApplicationListUpdate &update) {
    protobuf::bridge::EventSequence seq;
    auto event = seq.mutable_application_list_update();

    for (const auto &a : update.applications) {
        auto app = event->add_applications();
        app->set_name(a.name);
        app->set_package(a.package);

        auto launch_intent = app->mutable_launch_intent();
        launch_intent->set_action(a.launch_intent.action);
        launch_intent->set_uri(a.launch_intent.uri);
        launch_intent->set_type(a.launch_intent.type);
        launch_intent->set_package(a.launch_intent.package);
        launch_intent->set_component(a.launch_intent.component);
        for (const auto &category : a.launch_intent.categories) {
            auto c = launch_intent->add_categories();
            *c = category;
        }

        app->set_icon(a.icon.data(), a.icon.size());
    }

    for (const auto &package : update.removed_applications) {
      auto app = event->add_removed_applications();
      app->set_name("unknown");
      app->set_package(package);
    }

    rpc_channel_->send_event(seq);
}
示例#6
0
int BatteryMonitor::update_icon_and_tooltip(void) {
	/* in case connection failed somehow */
	if(!con.connected()) {
		label("0");
		return 0;
	}

	E_RETURN_VAL_IF_FAIL(batts.size() > 0, 0);
	double p = 0, ret = 0;

	if(batts.size() == 1) {
		E_RETURN_VAL_IF_FAIL(get_percentage(con, batts.front().path(), &ret), 0);
		p = ret;
		tooltip_printf(_("Battery %s: %i%%"), get_state_str(con, batts.front().path()), (int)ret);
	} else {
		for(BatteryListIt it = batts.begin(), ite = batts.end(); it != ite; ++it) {
			if(!get_percentage(con, it->path(), &ret)) continue;
			p += ret;
		}
	
		p /= batts.size();
		tooltip_printf(_("%i batteries: %i%%"), batts.size(), (int)p);
	}

	set_icon(p);
	/* returning state is mainly for signal_cb() */
	return 1;
}
示例#7
0
LRESULT CALLBACK step1_proc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
	switch(msg){
	case WM_INITDIALOG:
		set_icon(hwnd,IDI_ICON1);
		SendDlgItemMessage(hwnd,IDC_PASSWORD,EM_SETLIMITTEXT,255,0);
		EnableWindow(GetDlgItem(hwnd,IDC_NEXT),FALSE);
		SetFocus(GetDlgItem(hwnd,IDC_PASSWORD));
		break;
	case WM_COMMAND:
		switch(LOWORD(wparam)){
		case IDCANCEL:
			EndDialog(hwnd,IDCANCEL);
			break;
		case IDOK:
		case IDC_NEXT:
			if(verify_passord(hwnd,IDC_PASSWORD))
				EndDialog(hwnd,IDC_NEXT);
			break;
		case IDC_PASSWORD:
			if(verify_passord(hwnd,IDC_PASSWORD))
				EnableWindow(GetDlgItem(hwnd,IDC_NEXT),TRUE);
			else
				EnableWindow(GetDlgItem(hwnd,IDC_NEXT),FALSE);
			break;
		}
		break;
	case WM_CLOSE:
		EndDialog(hwnd,IDC_NEXT);
		break;
	}
	return 0;
}
示例#8
0
LRESULT CALLBACK step2_proc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
{
	switch(msg){
	case WM_INITDIALOG:
		set_icon(hwnd,IDI_ICON1);
		SetFocus(GetDlgItem(hwnd,IDC_NEXT));
		CheckRadioButton(hwnd,IDC_RADIO1,IDC_RADIO3,IDC_RADIO1);
		break;
	case WM_COMMAND:
		switch(LOWORD(wparam)){
		case IDCANCEL:
			EndDialog(hwnd,IDCANCEL);
			break;
		case IDOK:
		case IDC_NEXT:
			EndDialog(hwnd,IDC_NEXT);
			break;
		}
		break;
	case WM_CLOSE:
		EndDialog(hwnd,IDC_NEXT);
		break;
	}
	return 0;
}
示例#9
0
static gboolean
icon_size_changed_cb (GtkStatusIcon * icon, gint size, gpointer data)
{
  icon_size = size;
  set_icon ();
  return TRUE;
}
rcon_settings_form::rcon_settings_form(QWidget* parent, Qt::WindowFlags f)
    : preferences_widget(parent, "Rcon")
    , p_( new Pimpl )
{
    p_->ui.setupUi(this);

    set_icon( QIcon("icons:utilities-terminal.png") );
    set_header( tr("Remote console configuration") );

    boost::assign::insert( p_->examples )
    ( p_->ui.info_but,  p_->ui.info_ex    )
    ( p_->ui.inc_but,   p_->ui.inc_ex     )
    ( p_->ui.out_but,   p_->ui.out_ex     )
    ( p_->ui.error_but, p_->ui.err_ex     )
    ( p_->ui.back_but,  p_->ui.background );

    boost::assign::insert( p_->types )
    ( p_->ui.info_but,  rcon_settings::Info       )
    ( p_->ui.inc_but,   rcon_settings::Text       )
    ( p_->ui.out_but,   rcon_settings::Command    )
    ( p_->ui.error_but, rcon_settings::Error      )
    ( p_->ui.back_but,  rcon_settings::Background );

    connect( p_->ui.custom_colors, SIGNAL( clicked(bool) ), SLOT( custom_checked(bool) ) );

    BOOST_FOREACH( const Examples::value_type& p, p_->examples )
    connect( p.first, SIGNAL( clicked(bool) ), SLOT( color_clicked() ) );
}
示例#11
0
文件: icons.c 项目: orlp/glfw
int main(int argc, char** argv)
{
    GLFWwindow* window;

    if (!glfwInit())
    {
        fprintf(stderr, "Failed to initialize GLFW\n");
        exit(EXIT_FAILURE);
    }

    window = glfwCreateWindow(800, 600, "Icons", NULL, NULL);
    if (!window)
    {
        glfwTerminate();

        fprintf(stderr, "Failed to open GLFW window\n");
        exit(EXIT_FAILURE);
    }

    glfwSetKeyCallback(window, key_callback);
    set_icon(window, cur_icon_color);

    while (!glfwGetWindowParam(window, GLFW_SHOULD_CLOSE))
    {
        glfwSwapBuffers(window);
        glfwPollEvents();
    }

    glfwTerminate();
    
    return EXIT_SUCCESS;
}
示例#12
0
SplashScreen::SplashScreen(Gtk::Window *parent) :
	Gtk::Window(Gtk::WINDOW_POPUP),
	f_parent( parent )
{
    molib::moWCString splash_path( Common::GetFullPathnameForImage( SPLASH_IMAGE ) );

	if( splash_path != "" )
	{
		splash_path = molib::moFile::FullPath(splash_path);
		f_splash.set( splash_path.c_str() );
	}

	set_type_hint(Gdk::WINDOW_TYPE_HINT_SPLASHSCREEN);
	set_title(gettext("Turn Watcher Splashscreen"));
	set_resizable(false);
	set_decorated(false);
	set_has_frame(false);
	set_position(Gtk::WIN_POS_CENTER);
	set_transient_for(*f_parent);	// avoid having an icon in toolbar
	set_modal(true);		// the first click closes the splash no matter where
	set_keep_above();		// keep splashscreen on top of everything
	set_icon( Gdk::Pixbuf::create_from_xpm_data( Helmet_xpm ) );

	add(f_box);

	f_box.add(f_splash);

	f_box.set_events(Gdk::BUTTON_PRESS_MASK);
	f_box.signal_button_press_event().connect(
			sigc::mem_fun(*this, &SplashScreen::on_button_press_event));

	show_all_children();
}
示例#13
0
文件: theme.cpp 项目: nitpum/godot
bool Theme::_set(const StringName& p_name, const Variant& p_value) {

    String sname=p_name;

    if (sname.find("/")!=-1) {

        String type=sname.get_slicec('/',1);
        String node_type=sname.get_slicec('/',0);
        String name=sname.get_slicec('/',2);

        if (type=="icons") {

            set_icon(name,node_type,p_value);
        } else if (type=="styles") {

            set_stylebox(name,node_type,p_value);
        } else if (type=="fonts") {

            set_font(name,node_type,p_value);
        } else if (type=="colors") {

            set_color(name,node_type,p_value);
        } else if (type=="constants") {

            set_constant(name,node_type,p_value);
        } else
            return false;

        return true;
    }

    return false;

}
void OptionButton::clear() {
	
	popup->clear();
	selected=-1;
	count=0;
	set_text("");
	set_icon(-1);
}
示例#15
0
static void
update_icon_visibility (void)
{
	if (num_adapters_powered == 0)
		set_icon (FALSE);
	else
		set_icon (TRUE);

	if (show_icon_pref != FALSE) {
		if (num_adapters_present > 0 ||
		    bluetooth_killswitch_has_killswitches (killswitch) != FALSE) {
			show_icon ();
			return;
		}
	}
	hide_icon ();
}
示例#16
0
bool MessageBox::set_theme_icon(const char* name) {
	E_RETURN_VAL_IF_FAIL(IconLoader::inited(), false);

	String p = IconLoader::get_path(name, ICON_SIZE_MEDIUM);
	if(p.empty())
		return false;

	return set_icon(p.c_str());
}
示例#17
0
void VModePatch::update(int mode)
{
	set_icon(patch->patchbay->mode_to_icon(mode));
	for(int i = 0; i < total_items(); i++)
	{
		VModePatchItem *item = (VModePatchItem*)get_item(i);
		item->set_checked(item->mode == mode);
	}
}
void OptionButton::select(int p_at) {
	
	if (!popup->has_ID(p_at))
		return;
	
	selected=p_at;
	set_text( popup->get_item_text( p_at ) );
	set_icon( popup->get_item_icon( p_at ) );
}
示例#19
0
static void
update_icon_visibility (void)
{
	gboolean state = bluetooth_applet_get_killswitch_state (applet);
	if (state != BLUETOOTH_KILLSWITCH_STATE_UNBLOCKED)
		set_icon (FALSE);
	else
		set_icon (TRUE);

	if (state == BLUETOOTH_KILLSWITCH_STATE_NO_ADAPTER)
		hide_icon ();
#ifdef HAVE_APP_INDICATOR
	else if (!g_settings_get_boolean (gsettings, GSETTINGS_VISIBLE_KEY))
		hide_icon ();
#endif
	else
		show_icon ();
}
示例#20
0
gint
yad_notification_run ()
{
  GIOChannel *channel = NULL;

  status_icon = gtk_status_icon_new ();
  g_signal_connect (status_icon, "size-changed", G_CALLBACK (icon_size_changed_cb), NULL);

  if (options.data.dialog_text)
    {
      if (!options.data.no_markup)
        gtk_status_icon_set_tooltip_markup (status_icon, options.data.dialog_text);
      else
        gtk_status_icon_set_tooltip_text (status_icon, options.data.dialog_text);
    }
  else
    gtk_status_icon_set_tooltip_text (status_icon, _("Yad notification"));

  if (options.data.dialog_image)
    icon = g_strdup (options.data.dialog_image);
  if (options.common_data.command)
    action = g_strdup (options.common_data.command);

  set_icon ();

  g_signal_connect (status_icon, "activate", G_CALLBACK (activate_cb), NULL);
  g_signal_connect (status_icon, "popup_menu", G_CALLBACK (popup_menu_cb), NULL);

  if (options.notification_data.menu)
    parse_menu_str (options.notification_data.menu);

  /* quit on middle click (like press Esc) */
  if (options.notification_data.middle)
    g_signal_connect (status_icon, "button-press-event", G_CALLBACK (middle_quit_cb), NULL);

  if (options.common_data.listen)
    {
      channel = g_io_channel_unix_new (0);
      if (channel)
        {
          g_io_channel_set_encoding (channel, NULL, NULL);
          g_io_channel_set_flags (channel, G_IO_FLAG_NONBLOCK, NULL);
          g_io_add_watch (channel, G_IO_IN | G_IO_HUP, handle_stdin, NULL);
        }
    }

  /* Show icon and wait */
  gtk_status_icon_set_visible (status_icon, !options.notification_data.hidden);

  if (options.data.timeout > 0)
    g_timeout_add_seconds (options.data.timeout, (GSourceFunc) timeout_cb, NULL);

  gtk_main ();

  return exit_code;
}
示例#21
0
  void ToolButton::SetAction (const RefPtr<AbstractIcon>& icon,
                              const String& text)
  {
    RefPtr<Action> action(new Action(icon, text));

    action_ = action;

    set_icon(icon);
    set_text(text);
  }
示例#22
0
void consoleicons::restorePreviousIcons()
{
	if(Global->Opt->SetIcon)
	{
		if (const auto hWnd = Console().GetWindow())
		{
			if(LargeChanged)
			{
				set_icon(hWnd, icon_big, PreviousLargeIcon);
				LargeChanged = false;
			}
			if(SmallChanged)
			{
				set_icon(hWnd, icon_small, PreviousSmallIcon);
				SmallChanged = false;
			}
		}
	}
}
示例#23
0
void Authorization::reset()
{
    if (file.remove()) {
        ui->input->clear();
        ui->input->setEchoMode(QLineEdit::Password);
        ui->input->setEnabled(true);
        isSet = false;

        set_icon(true);
    } else {
        ui->input->clear();
        ui->input->setEchoMode(QLineEdit::Normal);
        ui->input->setText("ERROR: CHECK PERMISSIONS ON "+*_PIG_PATH);
        ui->input->setPalette(ui->p_error);
        ui->input->setDisabled(true);

        set_icon(true, true);
    }
}
示例#24
0
int main(int argc, char *argv[])
{
	GtkStatusIcon *statusicon;
	DBusGConnection *conn;
	DBusGProxy *adapter, *device;
	GError *error = NULL;

	bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
	bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
	textdomain(GETTEXT_PACKAGE);

	gtk_init(&argc, &argv);

	gtk_window_set_default_icon_name("bluetooth");

	conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
	if (error != NULL) {
		g_printerr("Connecting to system bus failed: %s\n",
							error->message);
		g_error_free(error);
		return 1;
	}

	set_icon (TRUE);
	statusicon = init_notification();

	g_signal_connect(statusicon, "activate",
				G_CALLBACK(activate_callback), NULL);

	setup_agents();

	adapter = dbus_g_proxy_new_for_name(conn, "org.bluez",
						"/hci0", "org.bluez.Adapter");

	device = dbus_g_proxy_new_from_proxy(adapter,
			"/hci0/dev_11_22_33_44_55_66", "org.bluez.Device");

	//display_dialog(adapter, device, "Test (00:11:22:33:44:55)", "123456", 0, NULL);
	pin_dialog(adapter, device, "Test", "'Test' (00:11:22:33:44:55)", FALSE, NULL);
	confirm_dialog(adapter, device, "Test", "'Test' (00:11:22:33:44:55)", "123456", NULL);
	auth_dialog(adapter, device, "Test", "'Test' (00:11:22:33:44:55)", "UUID", NULL);

	gtk_main();

	g_object_unref(device);
	g_object_unref(adapter);

	cleanup_notification();

	cleanup_agents();

	dbus_g_connection_unref(conn);

	return 0;
}
示例#25
0
static void anaconda_disk_overview_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) {
    AnacondaDiskOverview *widget = ANACONDA_DISK_OVERVIEW(object);
    AnacondaDiskOverviewPrivate *priv = widget->priv;

    switch(prop_id) {
        case PROP_DESCRIPTION: {
            char *markup = g_markup_printf_escaped("<span weight='bold' size='large'>%s</span>", g_value_get_string(value));
            gtk_label_set_markup(GTK_LABEL(priv->description_label), markup);
            g_free(markup);
            break;
        }

        case PROP_KIND:
            if (widget->priv->kind)
                g_free(widget->priv->kind);

            widget->priv->kind = g_strdup(g_value_get_string(value));
            set_icon(widget, widget->priv->kind);
            gtk_grid_attach(GTK_GRID(widget->priv->grid), widget->priv->kind_icon, 0, 1, 3, 1);
            break;

        case PROP_FREE: {
            char *markup = g_markup_printf_escaped("<span size='large'>%s</span>", g_value_get_string(value));
            gtk_label_set_markup(GTK_LABEL(priv->free_label), markup);
            g_free(markup);
            break;
        }

        case PROP_CAPACITY: {
            char *markup = g_markup_printf_escaped("<span size='large'>%s</span>", g_value_get_string(value));
            gtk_label_set_markup(GTK_LABEL(priv->capacity_label), markup);
            g_free(markup);
            break;
        }

        case PROP_NAME: {
            char *markup = g_markup_printf_escaped("<span size='large'>%s</span>", g_value_get_string(value));
            gtk_label_set_markup(GTK_LABEL(priv->name_label), markup);
            g_free(markup);
            break;
        }

        case PROP_POPUP_INFO: {
            if (!strcmp(g_value_get_string(value), ""))
                gtk_widget_set_has_tooltip(GTK_WIDGET(widget), FALSE);
            else {
                gtk_widget_set_tooltip_text(GTK_WIDGET(widget), g_value_get_string(value));
                break;
            }
        }
    }
}
示例#26
0
static void Vid_SetMode()
{
	int n;
	int w, h;
	int flags = 0;

	printf("CGA Screen Emulation\n");
	printf("init screen: ");

	if (SDL_Init(SDL_INIT_VIDEO) < 0) {
		printf("failed\n");
		fprintf(stderr, "Unable to initialise video subsystem: %s\n",
				SDL_GetError());
		exit(-1);
	}

	srand(time(NULL));
	set_icon(symbol_plane[rand() % 2][rand() % 16]);

	w = SCR_WDTH;
	h = SCR_HGHT;

	if (vid_double_size) {
		w *= 2;
		h *= 2;
	}

	flags = SDL_HWPALETTE;
	if (vid_fullscreen)
		flags |= SDL_FULLSCREEN;

	screen = SDL_SetVideoMode(w, h, 8, flags);

	if (screen) {
		printf("initialised\n");
	} else {
		printf("failed to set mode\n");
		fprintf(stderr, "cant init SDL\n");
		exit(-1);
	}

	SDL_EnableUNICODE(1);

	for (n = 0; n < NUM_KEYS; ++n)
		keysdown[n] = 0;

	SDL_WM_SetCaption("SDL Sopwith", NULL);

	SDL_SetColors(screen, cga_pal, 0, sizeof(cga_pal)/sizeof(*cga_pal));
	SDL_SetColors(screenbuf, cga_pal, 0, sizeof(cga_pal)/sizeof(*cga_pal));
	SDL_ShowCursor(0);
}
示例#27
0
        std::unique_ptr<image_type> create_application_image()
        {
            auto p_image = tetengo2::stdalt::make_unique<image_type>(m_base);

            auto p_icon =
                tetengo2::stdalt::make_unique<icon_type>(
                    m_settings.image_directory_path() / string_type{ TETENGO2_TEXT("bobura_app.ico") },
                    dimension_type{ width_type{ 4 }, height_type{ 4 } }
                );
            p_image->set_icon(std::move(p_icon));

            return std::move(p_image);
        }
示例#28
0
VModePatch::VModePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y)
 : BC_PopupMenu(x, 
 	y,
	patch->patchbay->mode_icons[0]->get_w() + 20,
	"",
	1,
	mwindow->theme->get_image_set("mode_popup", 0),
	10)
{
	this->mwindow = mwindow;
	this->patch = patch;
	this->mode = get_keyframe(mwindow, patch)->value;
	set_icon(patch->patchbay->mode_to_icon(this->mode));
	set_tooltip(_("Overlay mode"));
}
示例#29
0
void Authorization::set(const QString &str)
{
    if (!str.isEmpty()) {
        if (file.open(QIODevice::WriteOnly)) {
            QTextStream stream(&file);
            stream << calculate(&str).simplified();
            file.close();

            ui->input->clear();
            ui->input->setDisabled(true);
            isSet = true;

            set_icon(false);
        } else {
            ui->input->clear();
            ui->input->setEchoMode(QLineEdit::Normal);
            ui->input->setText("ERROR: CHECK PERMISSIONS ON "+*_PIG_PATH);
            ui->input->setPalette(ui->p_error);
            ui->input->setDisabled(true);

            set_icon(false, true);
        }
    }
}
示例#30
0
文件: icons.c 项目: orlp/glfw
static void key_callback(GLFWwindow* window, int key, int action)
{

    if (action != GLFW_PRESS)
        return;

    switch (key)
    {
        case GLFW_KEY_ESCAPE:
            glfwDestroyWindow(window);
            break;
        case GLFW_KEY_SPACE:
            cur_icon_color = (cur_icon_color + 1) % 5;
            set_icon(window, cur_icon_color);
            break;
    }
}