void nautilus_navigation_window_activate_spinner (NautilusNavigationWindow *window) { GtkToolItem *item; GtkWidget *spinner; if (window->details->spinner != NULL) { return; } item = gtk_tool_item_new (); gtk_widget_show (GTK_WIDGET (item)); gtk_tool_item_set_expand (item, TRUE); gtk_toolbar_insert (GTK_TOOLBAR (window->details->toolbar), item, -1); spinner = gtk_spinner_new (); gtk_widget_show (GTK_WIDGET (spinner)); item = gtk_tool_item_new (); gtk_container_add (GTK_CONTAINER (item), spinner); gtk_widget_show (GTK_WIDGET (item)); gtk_toolbar_insert (GTK_TOOLBAR (window->details->toolbar), item, -1); window->details->spinner = spinner; }
GtkWidget *toolbar_init(GtkWindow *parent) { GtkWidget *vbox = gtk_vbox_new(FALSE, 0); GtkToolbar *toolbar; GtkActionGroup *ag = gtk_action_group_new("Actions"); gtk_action_group_add_actions(ag, action_items, G_N_ELEMENTS(action_items), parent); gtk_action_group_add_toggle_actions(ag, toggle_items, G_N_ELEMENTS(toggle_items), parent); GtkUIManager *ui = gtk_ui_manager_new(); g_object_set_data(G_OBJECT(parent), "ui_manager", ui); gtk_ui_manager_insert_action_group(ui, ag, 0); GtkAccelGroup *accel = gtk_ui_manager_get_accel_group(ui); gtk_window_add_accel_group(parent, accel); GError *error = NULL; if (!gtk_ui_manager_add_ui_from_string (ui, ui_xml, -1, &error)) { g_message ("building menus failed: %s", error->message); g_error_free (error); exit (-1); } GtkWidget *menubar = gtk_ui_manager_get_widget(ui, "/menubar"); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(menubar), FALSE, TRUE, 0); toolbar = GTK_TOOLBAR(gtk_ui_manager_get_widget(ui, "/toolbar")); gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(toolbar), FALSE, TRUE, 0); /* Device selection GtkComboBox */ GtkToolItem *toolitem = gtk_tool_item_new(); GtkWidget *dev = dev_select_combo_box_new(parent); gtk_container_add(GTK_CONTAINER(toolitem), dev); gtk_toolbar_insert(toolbar, toolitem, 0); /* Time/Samples entry */ toolitem = gtk_tool_item_new(); GtkWidget *timesamples = gtk_entry_new(); gtk_entry_set_text(GTK_ENTRY(timesamples), "100"); gtk_entry_set_alignment(GTK_ENTRY(timesamples), 1.0); gtk_widget_set_size_request(timesamples, 100, -1); gtk_container_add(GTK_CONTAINER(toolitem), timesamples); gtk_toolbar_insert(toolbar, toolitem, 7); /* Time unit combo box */ toolitem = gtk_tool_item_new(); GtkWidget *timeunit = gtk_combo_box_new_text(); gtk_combo_box_append_text(GTK_COMBO_BOX(timeunit), "samples"); gtk_combo_box_append_text(GTK_COMBO_BOX(timeunit), "ms"); gtk_combo_box_append_text(GTK_COMBO_BOX(timeunit), "s"); gtk_combo_box_set_active(GTK_COMBO_BOX(timeunit), 0); gtk_container_add(GTK_CONTAINER(toolitem), timeunit); gtk_toolbar_insert(toolbar, toolitem, 8); g_object_set_data(G_OBJECT(parent), "timesamples", timesamples); g_object_set_data(G_OBJECT(parent), "timeunit", timeunit); return GTK_WIDGET(vbox); }
static void gcal_toolbar_constructed (GObject *object) { GcalToolbarPrivate *priv; GtkStyleContext *context; GtkToolItem *spacer; GtkWidget *bin; priv = GCAL_TOOLBAR (object)->priv; if (G_OBJECT_CLASS (gcal_toolbar_parent_class)->constructed != NULL) G_OBJECT_CLASS (gcal_toolbar_parent_class)->constructed (object); priv->widget = gtk_toolbar_new (); gtk_widget_set_hexpand (priv->widget, TRUE); gtk_widget_set_vexpand (priv->widget, TRUE); gtk_toolbar_set_icon_size (GTK_TOOLBAR (priv->widget), GTK_ICON_SIZE_BUTTON); context = gtk_widget_get_style_context (priv->widget); gtk_style_context_add_class (context, "main-toolbar"); /* adding toolbar */ bin = gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (object)); gtk_container_add (GTK_CONTAINER (bin), priv->widget); /* adding sections */ /* left */ priv->left_item = gtk_tool_item_new (); gtk_toolbar_insert (GTK_TOOLBAR (priv->widget), priv->left_item, 0); /* spacer */ spacer = gtk_tool_item_new (); gtk_tool_item_set_expand (spacer, TRUE); gtk_toolbar_insert (GTK_TOOLBAR (priv->widget), spacer, -1); /* central */ priv->central_item = gtk_tool_item_new (); gtk_toolbar_insert (GTK_TOOLBAR (priv->widget), priv->central_item, -1); /* spacer */ spacer = gtk_tool_item_new (); gtk_tool_item_set_expand (spacer, TRUE); gtk_toolbar_insert (GTK_TOOLBAR (priv->widget), spacer, -1); /* right */ priv->right_item = gtk_tool_item_new (); gtk_toolbar_insert (GTK_TOOLBAR (priv->widget), priv->right_item, -1); gcal_toolbar_set_overview_mode (GCAL_TOOLBAR (object)); gtk_widget_show_all (bin); }
static GtkWidget *create_toolbar(void) { GtkWidget *toolbar, *item; GtkToolItem *tool_item; toolbar = gtk_toolbar_new(); gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar), GTK_ICON_SIZE_MENU); gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); tool_item = gtk_menu_tool_button_new(NULL, NULL); gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(tool_item), GTK_STOCK_JUMP_TO); item = (GtkWidget*)tool_item; gtk_widget_set_tooltip_text(item, _("Show the current document")); gtk_container_add(GTK_CONTAINER(toolbar), item); g_signal_connect(item, "clicked", G_CALLBACK(on_refresh), NULL); item = gtk_menu_new(); gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(tool_item), item); g_signal_connect(item, "show", G_CALLBACK(on_doc_menu_show), NULL); tool_item = gtk_tool_item_new(); gtk_tool_item_set_expand(tool_item, TRUE); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(tool_item)); item = gtk_label_new(NULL); gtk_label_set_ellipsize(GTK_LABEL(item), PANGO_ELLIPSIZE_START); gtk_container_add(GTK_CONTAINER(tool_item), item); edit_window.name_label = item; item = ui_tool_button_new(GTK_STOCK_CLOSE, _("_Unsplit"), NULL); gtk_container_add(GTK_CONTAINER(toolbar), item); g_signal_connect(item, "clicked", G_CALLBACK(on_unsplit), NULL); return toolbar; }
static GtkWidget* create_toolbar() { GtkWidget* toolbar=gtk_toolbar_new(); gtk_toolbar_set_orientation(GTK_TOOLBAR (toolbar), GTK_ORIENTATION_HORIZONTAL); gtk_toolbar_set_style(GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ); GtkToolItem* item; // botao para voltar item = gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK); g_signal_connect(G_OBJECT (item), "clicked", G_CALLBACK (go_back_box), NULL); gtk_toolbar_insert(GTK_TOOLBAR (toolbar), item, -1); // botao para ir para url que esta antes item = gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD); g_signal_connect(G_OBJECT (item), "clicked", G_CALLBACK (go_forward_box), NULL); gtk_toolbar_insert(GTK_TOOLBAR (toolbar), item, -1); // form de entrada de url item = gtk_tool_item_new(); gtk_tool_item_set_expand(item, TRUE); uri_entry = gtk_entry_new(); gtk_container_add(GTK_CONTAINER (item), uri_entry); g_signal_connect(G_OBJECT (uri_entry), "activate", G_CALLBACK (activate_uri_entry_box), NULL); gtk_toolbar_insert(GTK_TOOLBAR (toolbar), item, -1); // botao bara ir e abrir item = gtk_tool_button_new_from_stock(GTK_STOCK_OK); g_signal_connect_swapped(G_OBJECT (item), "clicked", G_CALLBACK (activate_uri_entry_box), (gpointer)uri_entry); gtk_toolbar_insert(GTK_TOOLBAR (toolbar), item, -1); return toolbar; }
static void add_section_toolbar (CEPageIP6 *page, GtkWidget *section, GCallback add_cb) { GtkWidget *toolbar; GtkToolItem *item; GtkStyleContext *context; GtkWidget *box; GtkWidget *button; GtkWidget *image; toolbar = gtk_toolbar_new (); gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS); gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU); context = gtk_widget_get_style_context (toolbar); gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP); gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR); gtk_container_add (GTK_CONTAINER (section), toolbar); item = gtk_separator_tool_item_new (); gtk_tool_item_set_expand (item, TRUE); gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (item), FALSE); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (item), 0); box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); item = gtk_tool_item_new (); gtk_container_add (GTK_CONTAINER (item), box); button = gtk_button_new (); g_signal_connect_swapped (button, "clicked", G_CALLBACK (add_cb), page); image = gtk_image_new_from_icon_name ("list-add-symbolic", GTK_ICON_SIZE_MENU); atk_object_set_name (gtk_widget_get_accessible (button), _("Add")); gtk_button_set_image (GTK_BUTTON (button), image); gtk_container_add (GTK_CONTAINER (box), button); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (item), 1); }
int main (int argc, char **args) { gtk_init (&argc, &args); HildonProgram *program = hildon_program_get_instance (); GtkWidget *window = hildon_window_new (); hildon_program_add_window (program, HILDON_WINDOW (window)); gtk_init (&argc, &args); HildonSeekbar *bar = HILDON_SEEKBAR (hildon_seekbar_new ()); gtk_widget_set_size_request (GTK_WIDGET (bar), 400, -1); hildon_seekbar_set_total_time (bar, 100); hildon_seekbar_set_position (bar, 50); GtkToolbar *toolbar = gtk_toolbar_new (); GtkToolItem *item = gtk_tool_item_new (); gtk_container_add (GTK_CONTAINER (item), GTK_WIDGET (bar)); gtk_toolbar_insert (toolbar, item , 0); hildon_window_add_toolbar (window, toolbar); g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL); gtk_widget_show_all (GTK_WIDGET (window)); gtk_main (); return 0; }
GtkWidget *tool_button(GtkWidget *bar, GdkDrawable *drawable, char **xpm, const char *tooltip, gboolean (*cb)(GtkWidget *widget, GdkEventButton *event, gpointer data), gpointer data) { GtkWidget *image, *evbox; GtkToolItem *item; /* * gtk_radio_tool_button_new_from_widget is *huge*. We try to do things * in a * more compact way. */ evbox = gtk_event_box_new(); if (xpm) { image = make_image(drawable, xpm, tooltip); gtk_container_add(GTK_CONTAINER(evbox), image); } g_signal_connect(G_OBJECT(evbox), "button_press_event", G_CALLBACK(cb), data); item = gtk_tool_item_new(); gtk_container_add(GTK_CONTAINER(item), evbox); gtk_container_set_border_width(GTK_CONTAINER(item), 0); gtk_toolbar_insert(GTK_TOOLBAR(bar), item, -1); return evbox; }
/********************************************************************************************************* * gui functions */ void create_filter() { GtkToolItem* toolitem; GtkWidget* label; GtkWidget* hbox; hbox = gtk_hbox_new(FALSE, 0); toolitem = gtk_tool_item_new(); /* This is how gtk does more complex toolbar items. */ gtk_tool_item_set_expand(toolitem, TRUE); g_MainWindow.filterBar = gtk_toolbar_new(); gtk_toolbar_set_orientation(GTK_TOOLBAR(g_MainWindow.filterBar), GTK_ORIENTATION_HORIZONTAL); label = gtk_label_new_with_mnemonic(tr("F_ilter:")); g_MainWindow.filter = gtk_entry_new(); gtk_label_set_mnemonic_widget(GTK_LABEL(label), g_MainWindow.filter); gtk_entry_set_text(GTK_ENTRY(g_MainWindow.filter), ""); g_signal_connect(g_MainWindow.filter, "changed", G_CALLBACK(callback_apply_filter), NULL); g_signal_connect(g_MainWindow.filter, "activate", G_CALLBACK(callback_apply_filter), NULL); g_signal_connect(g_MainWindow.filter, "focus-in-event", G_CALLBACK(callback_filter_selected), NULL); g_signal_connect(g_MainWindow.filter, "focus-out-event", G_CALLBACK(callback_filter_unselected), NULL); g_signal_connect(g_MainWindow.filter, "grab-notify", G_CALLBACK(callback_filter_grab_unselected), NULL); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); gtk_box_pack_start(GTK_BOX(hbox), g_MainWindow.filter, TRUE, TRUE, 5); gtk_container_add(GTK_CONTAINER(toolitem), hbox); gtk_toolbar_insert(GTK_TOOLBAR(g_MainWindow.filterBar), toolitem, 0); gtk_box_pack_start(GTK_BOX(g_MainWindow.toplevelVBox), g_MainWindow.filterBar, FALSE, FALSE, 0); }
static void create_toolbar() { browser->toolbar = gtk_toolbar_new(); #ifndef GTK_ORIENTABLE gtk_toolbar_set_orientation(GTK_TOOLBAR (browser->toolbar), GTK_ORIENTATION_HORIZONTAL); #else gtk_orientable_set_orientation(GTK_ORIENTABLE (browser->toolbar), GTK_ORIENTATION_HORIZONTAL); #endif gtk_toolbar_set_style(GTK_TOOLBAR (browser->toolbar), GTK_TOOLBAR_BOTH_HORIZ); GtkToolItem* item; /* the back button */ item = gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK); g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_back_cb), (gpointer) browser); gtk_toolbar_insert(GTK_TOOLBAR (browser->toolbar), item, -1); /* The forward button */ item = gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD); g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_forward_cb), (gpointer) browser); gtk_toolbar_insert(GTK_TOOLBAR (browser->toolbar), item, -1); /* The URL entry */ item = gtk_tool_item_new(); gtk_tool_item_set_expand(item, TRUE); browser->uri_entry = gtk_entry_new(); gtk_container_add(GTK_CONTAINER (item), browser->uri_entry); g_signal_connect (G_OBJECT (browser->uri_entry), "activate", G_CALLBACK (activate_uri_entry_cb), (gpointer)browser); gtk_toolbar_insert(GTK_TOOLBAR (browser->toolbar), item, -1); /* The go button */ item = gtk_tool_button_new_from_stock(GTK_STOCK_OK); g_signal_connect_swapped (G_OBJECT (item), "clicked", G_CALLBACK (activate_uri_entry_cb), (gpointer)browser->uri_entry); gtk_toolbar_insert(GTK_TOOLBAR (browser->toolbar), item, -1); }
static void remmina_main_create_quick_search(RemminaMain *remminamain) { GtkWidget *widget; GValue val = { 0 }; remminamain->priv->quick_search_separator = gtk_separator_tool_item_new(); gtk_toolbar_insert(GTK_TOOLBAR(remminamain->priv->toolbar), remminamain->priv->quick_search_separator, -1); remminamain->priv->quick_search_item = gtk_tool_item_new(); gtk_toolbar_insert(GTK_TOOLBAR(remminamain->priv->toolbar), remminamain->priv->quick_search_item, -1); widget = gtk_entry_new(); gtk_widget_show(widget); gtk_entry_set_icon_from_stock(GTK_ENTRY(widget), GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_FIND); gtk_entry_set_icon_from_stock(GTK_ENTRY(widget), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR); gtk_entry_set_width_chars(GTK_ENTRY(widget), 25); gtk_container_add(GTK_CONTAINER(remminamain->priv->quick_search_item), widget); g_value_init(&val, G_TYPE_BOOLEAN); g_value_set_boolean(&val, FALSE); g_object_set_property(G_OBJECT(widget), "primary-icon-activatable", &val); g_value_unset(&val); g_signal_connect(G_OBJECT(widget), "icon-press", G_CALLBACK(remmina_main_quick_search_on_icon_press), remminamain); g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(remmina_main_quick_search_on_changed), remminamain); remminamain->priv->quick_search_entry = widget; }
static void nautilus_toolbar_constructed (GObject *obj) { NautilusToolbar *self = NAUTILUS_TOOLBAR (obj); GtkToolItem *item; GtkWidget *hbox, *toolbar, *search; GtkStyleContext *context; const gchar *ui; G_OBJECT_CLASS (nautilus_toolbar_parent_class)->constructed (obj); gtk_style_context_set_junction_sides (gtk_widget_get_style_context (GTK_WIDGET (self)), GTK_JUNCTION_BOTTOM); /* add the UI */ ui = nautilus_ui_string_get ("nautilus-toolbar-ui.xml"); self->priv->ui_manager = gtk_ui_manager_new (); gtk_ui_manager_add_ui_from_string (self->priv->ui_manager, ui, -1, NULL); gtk_ui_manager_insert_action_group (self->priv->ui_manager, self->priv->action_group, 0); toolbar = gtk_ui_manager_get_widget (self->priv->ui_manager, "/Toolbar"); self->priv->toolbar = toolbar; context = gtk_widget_get_style_context (toolbar); gtk_style_context_add_class (context, GTK_STYLE_CLASS_PRIMARY_TOOLBAR); search = gtk_ui_manager_get_widget (self->priv->ui_manager, "/Toolbar/Search"); gtk_style_context_add_class (gtk_widget_get_style_context (search), GTK_STYLE_CLASS_RAISED); gtk_box_pack_start (GTK_BOX (self), self->priv->toolbar, TRUE, TRUE, 0); gtk_widget_show_all (self->priv->toolbar); hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); gtk_widget_show (hbox); /* regular path bar */ self->priv->path_bar = g_object_new (NAUTILUS_TYPE_PATH_BAR, NULL); gtk_box_pack_start (GTK_BOX (hbox), self->priv->path_bar, TRUE, TRUE, 0); /* entry-like location bar */ self->priv->location_bar = nautilus_location_bar_new (); gtk_box_pack_start (GTK_BOX (hbox), self->priv->location_bar, TRUE, TRUE, 0); item = gtk_tool_item_new (); gtk_tool_item_set_expand (item, TRUE); gtk_container_add (GTK_CONTAINER (item), hbox); gtk_toolbar_insert (GTK_TOOLBAR (self->priv->toolbar), item, 0); gtk_widget_show (GTK_WIDGET (item)); /* search bar */ self->priv->search_bar = nautilus_search_bar_new (); gtk_box_pack_start (GTK_BOX (self), self->priv->search_bar, TRUE, TRUE, 0); g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_PREFERENCES_ALWAYS_USE_LOCATION_ENTRY, G_CALLBACK (toolbar_update_appearance), self); toolbar_update_appearance (self); }
void make_toolbar(Viewer *viewer, GtkWidget *parent) { GtkWidget *toolbar = gtk_toolbar_new(); gtk_box_pack_start(GTK_BOX(parent), toolbar, FALSE, FALSE, 0); // add a recording button to the toolbar viewer->record_button = GTK_WIDGET( gtk_toggle_tool_button_new_from_stock (GTK_STOCK_MEDIA_RECORD)); gtk_tool_item_set_is_important (GTK_TOOL_ITEM (viewer->record_button), TRUE); gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (viewer->record_button), viewer->tips, "Record an AVI of the viewport, saved in the current directory", NULL); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (viewer->record_button), 0); gtk_widget_show (viewer->record_button); g_signal_connect (G_OBJECT (viewer->record_button), "toggled", G_CALLBACK (on_record_toggled), viewer); // screenshot button GtkToolItem *ssbt = gtk_tool_button_new_from_stock (GTK_STOCK_FLOPPY); gtk_tool_button_set_label (GTK_TOOL_BUTTON (ssbt), "Screenshot"); gtk_tool_item_set_is_important (GTK_TOOL_ITEM (ssbt), TRUE); gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (ssbt), viewer->tips, "Save a PPM screenshot of the viewport to the current directory", NULL); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), ssbt, 1); gtk_widget_show (GTK_WIDGET (ssbt)); g_signal_connect (G_OBJECT (ssbt), "clicked", G_CALLBACK (on_screenshot_clicked), viewer); // quit button GtkToolItem *quitbt = gtk_tool_button_new_from_stock (GTK_STOCK_QUIT); gtk_tool_item_set_tooltip (GTK_TOOL_ITEM (quitbt), viewer->tips, "Quit", NULL); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), quitbt, 2); gtk_widget_show (GTK_WIDGET (quitbt)); g_signal_connect (G_OBJECT (quitbt), "clicked", gtk_main_quit, NULL); GtkToolItem * sep = gtk_separator_tool_item_new (); gtk_widget_show (GTK_WIDGET (sep)); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), sep, 3); GtkWidget * hbox = gtk_hbox_new (FALSE, 5); GtkWidget * label = gtk_label_new ("Record FPS"); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); viewer->fps_spin = gtk_spin_button_new_with_range (0.1, 120.0, 1.0); gtk_spin_button_set_digits (GTK_SPIN_BUTTON (viewer->fps_spin), 1); gtk_spin_button_set_value (GTK_SPIN_BUTTON (viewer->fps_spin), 30); gtk_box_pack_start (GTK_BOX (hbox), viewer->fps_spin, FALSE, FALSE, 0); GtkToolItem * toolitem = gtk_tool_item_new (); gtk_container_add (GTK_CONTAINER (toolitem), hbox); gtk_widget_show_all (GTK_WIDGET (toolitem)); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), toolitem, 4); viewer->toolbar = GTK_TOOLBAR (toolbar); }
void wxToolBar::AddChildGTK(wxWindowGTK* child) { GtkWidget* align = gtk_alignment_new(0.5, 0.5, 0, 0); gtk_widget_show(align); gtk_container_add(GTK_CONTAINER(align), child->m_widget); GtkToolItem* item = gtk_tool_item_new(); gtk_container_add(GTK_CONTAINER(item), align); // position will be corrected in DoInsertTool if necessary gtk_toolbar_insert(GTK_TOOLBAR(GTK_BIN(m_widget)->child), item, -1); }
void ui_common_toolbar_insert_widget(GtkWidget * toolbar, GtkWidget * widget, const gchar * tooltip, gint position) { GtkToolItem * toolbar_item; toolbar_item = gtk_tool_item_new(); gtk_container_add(GTK_CONTAINER(toolbar_item), widget); if (tooltip != NULL) gtk_tool_item_set_tooltip_text(toolbar_item,tooltip); gtk_tool_item_set_homogeneous(toolbar_item, FALSE); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolbar_item, position); return; }
static void gtk_tool_insert_generic_item(GtkToolbar *toolbar, GtkWidget *item) { GtkWidget *align_box; GtkToolItem *boxitem; boxitem = gtk_tool_item_new (); align_box = gtk_alignment_new(0, 0.5, 0, 0); gtk_container_add(GTK_CONTAINER(align_box), item); gtk_container_add (GTK_CONTAINER(boxitem), align_box); gtk_toolbar_insert (GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(boxitem), -1); }
/** * Adds a widget to the toolbar making sure that it doesn't take any excess space, and * vertically centers it. * @param toolbar The toolbar to add the widget to. * @param w The widget to add to the toolbar. */ static void integrated_ui_toolbar_add_custom_item (GtkToolbar *toolbar, GtkWidget *w) { GtkToolItem *tool_item; GtkWidget *c; /* container */ tool_item = gtk_tool_item_new (); c = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (tool_item), c); gtk_box_set_homogeneous (GTK_BOX (c), TRUE); /* Centers the button */ gtk_box_pack_start (GTK_BOX (c), w, FALSE, FALSE, 0); gtk_toolbar_insert (toolbar, tool_item, -1); gtk_widget_show (GTK_WIDGET (tool_item)); gtk_widget_show (c); gtk_widget_show (w); }
static GtkToolItem * create_entry_item (const char *text) { GtkToolItem *item; GtkWidget *entry; entry = gtk_entry_new (); gtk_entry_set_text (GTK_ENTRY (entry), text); gtk_entry_set_width_chars (GTK_ENTRY (entry), 5); item = gtk_tool_item_new (); gtk_container_add (GTK_CONTAINER (item), entry); return item; }
GtkToolItem* ToolPageLayer::newItem() { XOJ_CHECK_TYPE(ToolPageLayer); GtkToolItem* it = gtk_tool_item_new(); GtkWidget* hbox = gtk_hbox_new(false, 1); gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(_C("Layer")), false, false, 7); gtk_box_pack_start(GTK_BOX(hbox), this->layerComboBox, false, false, 0); gtk_container_add(GTK_CONTAINER(it), hbox); return it; }
SelectionSetToolmenu::SelectionSetToolmenu() : _toolItem(gtk_tool_item_new()), _listStore(gtk_list_store_new(1, G_TYPE_STRING)), _clearSetsButton(NULL), _entry(gtk_combo_box_entry_new_with_model(GTK_TREE_MODEL(_listStore), 0)) { // Hbox containing all our items GtkWidget* hbox = gtk_hbox_new(FALSE, 3); gtk_container_add(GTK_CONTAINER(_toolItem), hbox); // Pack Label gtk_box_pack_start(GTK_BOX(hbox), gtkutil::LeftAlignedLabel(_("Selection Set: ")), FALSE, FALSE, 0); // Pack Combo Box gtk_box_pack_start(GTK_BOX(hbox), _entry, TRUE, TRUE, 0); // Add tooltip gtk_widget_set_tooltip_markup(_entry, _(ENTRY_TOOLTIP)); // Add clear button { GtkWidget* image = gtk_image_new_from_pixbuf(GlobalUIManager().getLocalPixbufWithMask("delete.png")); gtk_widget_show(image); _clearSetsButton = gtk_tool_button_new(image, _("Clear Selection Sets")); // Set tooltip gtk_tool_item_set_tooltip_text(_clearSetsButton, _("Clear Selection Sets")); // Connect event g_signal_connect(G_OBJECT(_clearSetsButton), "clicked", G_CALLBACK(onDeleteAllSetsClicked), this); gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(_clearSetsButton), FALSE, FALSE, 0); } // Connect the signals GtkWidget* childEntry = gtk_bin_get_child(GTK_BIN(_entry)); g_signal_connect(G_OBJECT(childEntry), "activate", G_CALLBACK(onEntryActivated), this); g_signal_connect(G_OBJECT(_entry), "changed", G_CALLBACK(onSelectionChanged), this); // Populate the list update(); // Add self as observer GlobalSelectionSetManager().addObserver(*this); }
GtkToolItem * FontButton::createTmpItem(bool horizontal) { GtkWidget * fontButton = newFontButton(); GtkToolItem * it = gtk_tool_item_new(); gtk_container_add(GTK_CONTAINER(it), fontButton); gtk_tool_item_set_tooltip_text(it, this->description.c_str()); gtk_tool_item_set_homogeneous(GTK_TOOL_ITEM(it), false); if (!this->font.getName().isEmpty()) { setFontFontButton(fontButton, this->font); } gtk_widget_show_all(GTK_WIDGET(it)); return it; }
GtkToolItem * ToolPageSpinner::newItem() { XOJ_CHECK_TYPE(ToolPageSpinner); GtkToolItem * it = gtk_tool_item_new(); GtkWidget * hbox = gtk_hbox_new(false, 1); gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(_("Page")), false, false, 7); gtk_box_pack_start(GTK_BOX(hbox), this->pageSpinner->getWidget(), false, false, 0); this->lbPageNo = gtk_label_new(""); gtk_box_pack_start(GTK_BOX(hbox), this->lbPageNo, false, false, 0); gtk_container_add(GTK_CONTAINER(it), hbox); return it; }
static void photos_searchbar_constructed (GObject *object) { PhotosSearchbar *self = PHOTOS_SEARCHBAR (object); PhotosSearchbarPrivate *priv; GApplication *app; GtkToolItem *item; GVariant *state; priv = photos_searchbar_get_instance_private (self); G_OBJECT_CLASS (photos_searchbar_parent_class)->constructed (object); PHOTOS_SEARCHBAR_GET_CLASS (self)->create_search_widgets (self); item = gtk_tool_item_new (); gtk_tool_item_set_expand (item, TRUE); gtk_container_add (GTK_CONTAINER (item), priv->search_container); gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), item, 0); g_signal_connect_swapped (priv->search_entry, "search-changed", G_CALLBACK (photos_searchbar_search_changed), self); app = g_application_get_default (); priv->search = g_action_map_lookup_action (G_ACTION_MAP (app), "search"); /* g_signal_connect_object will not be able to disconnect the * handler in time because we change the state of the action during * dispose. */ priv->search_state_id = g_signal_connect_swapped (priv->search, "change-state", G_CALLBACK (photos_searchbar_change_state), self); state = g_action_get_state (priv->search); photos_searchbar_change_state (self, state); g_variant_unref (state); gtk_widget_show_all (GTK_WIDGET (self)); }
GtkToolItem * FontButton::newItem() { XOJ_CHECK_TYPE(FontButton); if (this->fontButton) { g_object_unref(this->fontButton); } GtkToolItem * it = gtk_tool_item_new(); this->fontButton = newFontButton(); gtk_container_add(GTK_CONTAINER(it), this->fontButton); gtk_tool_item_set_tooltip_text(it, this->description.c_str()); gtk_tool_item_set_homogeneous(GTK_TOOL_ITEM(it), false); if (!this->font.getName().isEmpty()) { setFont(this->font); } return it; }
create_statusbar ()void *GtkMain(void * argument) { printf("%s:%d\n", __func__, __LINE__); int argc = 0; char**argv = NULL; unsigned char haveUrl = 0; int argCount = 0; { g_main_statusbar = GTK_STATUSBAR (gtk_statusbar_new ()); gtk_widget_set_can_focus(GTK_WIDGET (g_main_statusbar), false); status_context_id = gtk_statusbar_get_context_id (g_main_statusbar, "Link Hover"); return (GtkWidget*)g_main_statusbar; } static GtkWidget* create_toolbar () { g_toolbar = gtk_toolbar_new (); gtk_widget_set_can_focus(GTK_WIDGET (g_toolbar), false); #if GTK_CHECK_VERSION(2,15,0) gtk_orientable_set_orientation (GTK_ORIENTABLE (g_toolbar), GTK_ORIENTATION_HORIZONTAL); #else gtk_toolbar_set_orientation (GTK_TOOLBAR (g_toolbar), GTK_ORIENTATION_HORIZONTAL); #endif gtk_toolbar_set_style (GTK_TOOLBAR (g_toolbar), GTK_TOOLBAR_BOTH_HORIZ); /* The URL entry */ itemUrl = gtk_tool_item_new (); gtk_widget_set_can_focus(GTK_WIDGET (itemUrl), false); gtk_tool_item_set_expand (itemUrl, TRUE); uri_entry = gtk_entry_new (); gtk_container_add (GTK_CONTAINER (itemUrl), uri_entry); g_signal_connect (G_OBJECT (uri_entry), "activate", G_CALLBACK (activate_uri_entry_cb), NULL); gtk_toolbar_insert (GTK_TOOLBAR (g_toolbar), itemUrl, -1); return g_toolbar; }
static void photos_searchbar_constructed (GObject *object) { PhotosSearchbar *self = PHOTOS_SEARCHBAR (object); PhotosSearchbarPrivate *priv = self->priv; GtkToolItem *item; GVariant *state; G_OBJECT_CLASS (photos_searchbar_parent_class)->constructed (object); PHOTOS_SEARCHBAR_GET_CLASS (self)->create_search_widgets (self); item = gtk_tool_item_new (); gtk_tool_item_set_expand (item, TRUE); gtk_container_add (GTK_CONTAINER (item), priv->search_container); gtk_toolbar_insert (GTK_TOOLBAR (priv->toolbar), item, 0); g_signal_connect_swapped (priv->search_entry, "key-press-event", G_CALLBACK (photos_searchbar_key_press_event), self); g_signal_connect_swapped (priv->search_entry, "search-changed", G_CALLBACK (photos_searchbar_search_changed), self); /* g_signal_connect_object will not be able to disconnect the * handler in time because we change the state of the action during * dispose. */ priv->search_state_id = g_signal_connect_swapped (priv->app, "action-state-changed::search", G_CALLBACK (photos_searchbar_action_state_changed), self); state = g_action_group_get_action_state (G_ACTION_GROUP (priv->app), "search"); photos_searchbar_action_state_changed (self, "search", state); g_variant_unref (state); gtk_widget_show_all (GTK_WIDGET (self)); }
static GtkWidget *create_toolbar(void) { GtkWidget *toolbar, *item; GtkToolItem *tool_item; toolbar = gtk_toolbar_new(); gtk_toolbar_set_icon_size(GTK_TOOLBAR(toolbar), GTK_ICON_SIZE_MENU); gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); tool_item = gtk_menu_tool_button_new(NULL, NULL); gtk_tool_button_set_stock_id(GTK_TOOL_BUTTON(tool_item), GTK_STOCK_JUMP_TO); item = (GtkWidget*)tool_item; gtk_widget_set_tooltip_text(item, _("Show the current document")); gtk_container_add(GTK_CONTAINER(toolbar), item); g_signal_connect(item, "clicked", G_CALLBACK(on_refresh), NULL); item = gtk_menu_new(); gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(tool_item), item); #if GTK_CHECK_VERSION (3, 0, 0) /* hack for https://bugzilla.gnome.org/show_bug.cgi?id=769287 */ if (! gtk_check_version(3, 15, 9) && gtk_check_version(3, 21, 4+1)) g_signal_connect(tool_item, "show-menu", G_CALLBACK(show_menu_gtk316_fix), NULL); #endif g_signal_connect(tool_item, "show-menu", G_CALLBACK(on_doc_show_menu), item); tool_item = gtk_tool_item_new(); gtk_tool_item_set_expand(tool_item, TRUE); gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(tool_item)); item = gtk_label_new(NULL); gtk_label_set_ellipsize(GTK_LABEL(item), PANGO_ELLIPSIZE_START); gtk_container_add(GTK_CONTAINER(tool_item), item); edit_window.name_label = item; item = ui_tool_button_new(GTK_STOCK_CLOSE, _("_Unsplit"), NULL); gtk_container_add(GTK_CONTAINER(toolbar), item); g_signal_connect(item, "clicked", G_CALLBACK(on_unsplit), NULL); return toolbar; }
GtkWidget* create_tool_item( GtkAction* action ) { GtkWidget* item = 0; if ( IS_EGE_OUTPUT_ACTION(action) ) { GValue value; GtkWidget* hb = gtk_hbox_new( FALSE, 5 ); GtkWidget* lbl = 0; memset( &value, 0, sizeof(value) ); g_value_init( &value, G_TYPE_STRING ); g_object_get_property( G_OBJECT(action), "short_label", &value ); const gchar* sss = g_value_get_string( &value ); item = GTK_WIDGET( gtk_tool_item_new() ); lbl = gtk_label_new( " " ); gtk_container_add( GTK_CONTAINER(hb), lbl ); if ( EGE_OUTPUT_ACTION(action)->private_data->useMarkup ) { lbl = gtk_label_new(NULL); gtk_label_set_markup( GTK_LABEL(lbl), sss ? sss : " " ); } else { lbl = gtk_label_new( sss ? sss : " " ); } gtk_container_add( GTK_CONTAINER(hb), lbl ); lbl = gtk_label_new( " " ); gtk_container_add( GTK_CONTAINER(hb), lbl ); gtk_container_add( GTK_CONTAINER(item), hb ); gtk_widget_show_all( item ); } else { item = gParentClass->create_tool_item( action ); } return item; }
static void gt_settings_dlg_init(GtSettingsDlg* self) { GtSettingsDlgPrivate* priv = gt_settings_dlg_get_instance_private(self); //So it's not optimised away volatile gpointer type = (gpointer) PEAS_GTK_TYPE_PLUGIN_MANAGER; gtk_widget_init_template(GTK_WIDGET(self)); gtk_widget_show_all(priv->players_view); GtkWidget* header_bar = gtk_dialog_get_header_bar(GTK_DIALOG(self)); gtk_header_bar_set_custom_title(GTK_HEADER_BAR(header_bar), priv->settings_switcher); /* NOTE: This is a hack to show a label at the bottom of the dialogue*/ GList* children = gtk_container_get_children(GTK_CONTAINER(priv->players_view)); GtkToolbar* toolbar = GTK_TOOLBAR(g_list_nth(children, 1)->data); GtkToolItem* item = gtk_tool_item_new(); gtk_container_add(GTK_CONTAINER(item), gtk_link_button_new_with_label( "https://github.com/vinszent/gnome-twitch/wiki/How-to-install-player-backends", _("How to install player backends"))); gtk_widget_show_all(GTK_WIDGET(item)); gtk_toolbar_insert(toolbar, item, 0); g_list_free(children); g_settings_bind(main_app->settings, "prefer-dark-theme", priv->prefer_dark_theme_button, "active", G_SETTINGS_BIND_DEFAULT); g_settings_bind(main_app->settings, "default-quality", priv->quality_combo, "active-id", G_SETTINGS_BIND_DEFAULT); g_settings_bind(main_app->settings, "language-filter", priv->language_filter_combo, "active-id", G_SETTINGS_BIND_DEFAULT); g_settings_bind(main_app->settings, "show-notifications", priv->notifications_switch, "active", G_SETTINGS_BIND_DEFAULT); }
static GtkWidget* create_toolbar () { GtkWidget* toolbar = gtk_toolbar_new (); #if GTK_CHECK_VERSION(2,15,0) gtk_orientable_set_orientation (GTK_ORIENTABLE (toolbar), GTK_ORIENTATION_HORIZONTAL); #else gtk_toolbar_set_orientation (GTK_TOOLBAR (toolbar), GTK_ORIENTATION_HORIZONTAL); #endif gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_BOTH_HORIZ); GtkToolItem* item; /* the back button */ item = gtk_tool_button_new_from_stock (GTK_STOCK_GO_BACK); g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_back_cb), NULL); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); /* The forward button */ item = gtk_tool_button_new_from_stock (GTK_STOCK_GO_FORWARD); g_signal_connect (G_OBJECT (item), "clicked", G_CALLBACK (go_forward_cb), NULL); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); /* The URL entry */ item = gtk_tool_item_new (); gtk_tool_item_set_expand (item, TRUE); uri_entry = gtk_entry_new (); gtk_container_add (GTK_CONTAINER (item), uri_entry); g_signal_connect (G_OBJECT (uri_entry), "activate", G_CALLBACK (activate_uri_entry_cb), NULL); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); /* The go button */ item = gtk_tool_button_new_from_stock (GTK_STOCK_OK); g_signal_connect_swapped (G_OBJECT (item), "clicked", G_CALLBACK (activate_uri_entry_cb), (gpointer)uri_entry); gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1); return toolbar; }