当前位置: 首页>>代码示例>>C++>>正文


C++ GTK_TOOLBAR函数代码示例

本文整理汇总了C++中GTK_TOOLBAR函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_TOOLBAR函数的具体用法?C++ GTK_TOOLBAR怎么用?C++ GTK_TOOLBAR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GTK_TOOLBAR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ZLApplicationWindow

ZLGtkApplicationWindow::ZLGtkApplicationWindow(ZLApplication *application) :
	ZLApplicationWindow(application),
	KeyActionOnReleaseNotOnPressOption(ZLCategoryKey::CONFIG, "KeyAction", "OnRelease", false),
	myFullScreen(false) {
	myProgram = HILDON_PROGRAM(hildon_program_get_instance());
	g_set_application_name("");

	myWindow = HILDON_WINDOW(hildon_window_new());

	((ZLMaemoCommunicationManager&)ZLCommunicationManager::Instance()).init();

	myToolbar = GTK_TOOLBAR(gtk_toolbar_new());
	gtk_toolbar_set_show_arrow(myToolbar, false);
	gtk_toolbar_set_orientation(myToolbar, GTK_ORIENTATION_HORIZONTAL);
	gtk_toolbar_set_style(myToolbar, GTK_TOOLBAR_ICONS);

	myMenu = GTK_MENU(gtk_menu_new());
	hildon_window_set_menu(myWindow, myMenu);
	gtk_widget_show_all(GTK_WIDGET(myMenu));

	hildon_window_add_toolbar(myWindow, myToolbar);
	hildon_program_add_window(myProgram, myWindow);
	gtk_widget_show_all(GTK_WIDGET(myWindow));

	myViewWidget = 0;

	ZLGtkSignalUtil::connectSignal(GTK_OBJECT(myWindow), "delete_event", GTK_SIGNAL_FUNC(applicationQuit), this);
	ZLGtkSignalUtil::connectSignal(GTK_OBJECT(myWindow), "key_press_event", GTK_SIGNAL_FUNC(handleKeyPress), this);
	ZLGtkSignalUtil::connectSignal(GTK_OBJECT(myWindow), "key_release_event", GTK_SIGNAL_FUNC(handleKeyRelease), this);
}
开发者ID:euroelessar,项目名称:FBReader,代码行数:30,代码来源:ZLGtkApplicationWindow.cpp

示例2: plugin_add_toolbar_item

/** Inserts a toolbar item before the Quit button, or after the previous plugin toolbar item.
 * A separator is added on the first call to this function, and will be shown when @a item is
 * shown; hidden when @a item is hidden.
 * @note You should still destroy @a item yourself, usually in @ref plugin_cleanup().
 * @param plugin Must be @ref geany_plugin.
 * @param item The item to add. */
void plugin_add_toolbar_item(GeanyPlugin *plugin, GtkToolItem *item)
{
	GtkToolbar *toolbar = GTK_TOOLBAR(main_widgets.toolbar);
	gint pos;
	GeanyAutoSeparator *autosep;

	g_return_if_fail(plugin);
	autosep = &plugin->priv->toolbar_separator;

	if (!autosep->widget)
	{
		GtkToolItem *sep;

		pos = toolbar_get_insert_position();

		sep = gtk_separator_tool_item_new();
		gtk_toolbar_insert(toolbar, sep, pos);
		autosep->widget = GTK_WIDGET(sep);

		toolbar_item_ref(sep);
	}
	else
	{
		pos = gtk_toolbar_get_item_index(toolbar, GTK_TOOL_ITEM(autosep->widget));
		g_return_if_fail(pos >= 0);
	}

	gtk_toolbar_insert(toolbar, item, pos + autosep->item_count + 1);
	toolbar_item_ref(item);

	/* hide the separator widget if there are no toolbar items showing for the plugin */
	ui_auto_separator_add_ref(autosep, GTK_WIDGET(item));
}
开发者ID:AR-H,项目名称:geany,代码行数:39,代码来源:pluginutils.c

示例3: gboolean

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;
}
开发者ID:bert,项目名称:fped,代码行数:31,代码来源:gui_util.c

示例4: ui_common_toolbar_append_separator

void ui_common_toolbar_append_separator(GtkWidget * toolbar) {
  GtkToolItem * toolbar_item;
  toolbar_item =  gtk_separator_tool_item_new();
  gtk_tool_item_set_homogeneous(toolbar_item, FALSE);
  gtk_toolbar_insert(GTK_TOOLBAR(toolbar), toolbar_item, -1);
  return;
}
开发者ID:neuroradiology,项目名称:amide,代码行数:7,代码来源:ui_common.c

示例5: tm_populate

static void
tm_populate(GtkWidget * toolbar, BalsaToolbarModel * model)
{
    gboolean style_is_both;
    gboolean make_two_line;
    GArray *current;
    guint j;
    GActionMap *action_map =
        g_object_get_data(G_OBJECT(toolbar), BALSA_TOOLBAR_ACTION_MAP);

    style_is_both = (model->style == GTK_TOOLBAR_BOTH
                     || (model->style == (GtkToolbarStyle) - 1
                         && tm_default_style() == GTK_TOOLBAR_BOTH));
    make_two_line = style_is_both && tm_has_second_line(model);

    current = balsa_toolbar_model_get_current(model);
    for (j = 0; j < current->len; j++) {
        BalsaToolbarEntry *entry;
        GtkToolItem *item;

        entry = &g_array_index(current, BalsaToolbarEntry, j);

        if (!*entry->action) {
            item = gtk_separator_tool_item_new();
        } else {
            GtkWidget *icon;
            GAction *action;
            const GVariantType *type;
            gchar *prefixed_action;

            icon = gtk_image_new_from_icon_name
                (balsa_icon_id(entry->icon), GTK_ICON_SIZE_SMALL_TOOLBAR);
            action = g_action_map_lookup_action(action_map, entry->action);
            if (action &&
                (type = g_action_get_state_type(action)) &&
                g_variant_type_equal(type, G_VARIANT_TYPE_BOOLEAN)) {
                item = gtk_toggle_tool_button_new();
                g_object_set(G_OBJECT(item), "icon-widget", icon,
                             "label", entry->action, NULL);
            } else {
                item = gtk_tool_button_new(icon, entry->action);
            }
            tm_set_tool_item_label(GTK_TOOL_ITEM(item), entry->icon,
                                   make_two_line);

            prefixed_action =
                g_strconcat(action ? "win." : "app.", entry->action, NULL);
            gtk_actionable_set_action_name(GTK_ACTIONABLE(item),
                                           prefixed_action);
            g_free(prefixed_action);
        }
        gtk_toolbar_insert((GtkToolbar *) toolbar, item, -1);
    }

    gtk_toolbar_set_style(GTK_TOOLBAR(toolbar),
                          model->style != (GtkToolbarStyle) (-1) ?
                          model->style : tm_default_style());

    gtk_widget_show_all(toolbar);
}
开发者ID:GNOME,项目名称:balsa,代码行数:60,代码来源:toolbar-factory.c

示例6: g_object_new

GtkWidget *XttMethodToolbarGtk::build()
{
  pwr_tFileName fname;

  // Toolbar
  m_toolbar_w = (GtkWidget *) g_object_new(GTK_TYPE_TOOLBAR, NULL);

  for ( int i = 0; i < m_size; i++) {
    if ( m_method_mask & (1 << i)) {
      char tooltip[200];

      strcpy( tooltip, m_data[i].tooltip);
      strcat( tooltip, m_tooltip_suffix);

      m_button_w[i] = gtk_button_new();
      dcli_translate_filename( fname, m_data[i].image);
      gtk_container_add( GTK_CONTAINER(m_button_w[i]), 
			 gtk_image_new_from_file( fname));
      g_signal_connect( m_button_w[i], "clicked", G_CALLBACK(activate_button), &m_cb[i]);
      g_object_set( m_button_w[i], "can-focus", FALSE, NULL);
      gtk_toolbar_append_widget( GTK_TOOLBAR(m_toolbar_w), m_button_w[i], CoWowGtk::translate_utf8( tooltip), "");
    }
  }
  return m_toolbar_w;
}
开发者ID:Strongc,项目名称:proview,代码行数:25,代码来源:xtt_methodtoolbar_gtk.cpp

示例7: XOJ_INIT_TYPE

SidebarToolbar::SidebarToolbar(Control* control)
{
	XOJ_INIT_TYPE(SidebarToolbar);

	this->control = control;
	this->toolbar = GTK_TOOLBAR(gtk_toolbar_new());

	gtk_toolbar_set_icon_size(this->toolbar, GTK_ICON_SIZE_SMALL_TOOLBAR);

	g_object_ref(this->toolbar);

	this->btUp = gtk_tool_button_new_from_stock(GTK_STOCK_GO_UP);
	gtk_toolbar_insert(this->toolbar, this->btUp, -1);
	g_signal_connect(this->btUp, "clicked", G_CALLBACK(&btUpClicked), this);

	this->btDown = gtk_tool_button_new_from_stock(GTK_STOCK_GO_DOWN);
	gtk_toolbar_insert(this->toolbar, this->btDown, -1);
	g_signal_connect(this->btDown, "clicked", G_CALLBACK(&btDownClicked), this);

	this->btCopy = gtk_tool_button_new_from_stock(GTK_STOCK_COPY);
	gtk_toolbar_insert(this->toolbar, this->btCopy, -1);
	g_signal_connect(this->btCopy, "clicked", G_CALLBACK(&btCopyClicked), this);

	this->btDelete = gtk_tool_button_new_from_stock(GTK_STOCK_DELETE);
	gtk_toolbar_insert(this->toolbar, this->btDelete, -1);
	g_signal_connect(this->btDelete, "clicked", G_CALLBACK(&btDeleteClicked), this);

	gtk_widget_show_all(GTK_WIDGET(this->toolbar));
}
开发者ID:project-renard-survey,项目名称:xournalpp,代码行数:29,代码来源:SidebarToolbar.cpp

示例8: set_app_drawing_toolbar_style

/*---------------------------------------------------------------------------*/
static void
set_app_drawing_toolbar_style (GtkUIManager *ui)
{
	GtkWidget *toolbar;

	gl_debug (DEBUG_UI, "START");

	g_return_if_fail (ui && GTK_IS_UI_MANAGER (ui));
			
	/* Updated view menu */
	gl_ui_util_set_verb_state (ui, "/ui/MenuBar/ViewMenu/ViewDrawingToolBar",
				   gl_prefs_model_get_drawing_toolbar_visible (gl_prefs));

	toolbar = gtk_ui_manager_get_widget (ui, "/DrawingToolBar");

	gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);

	if (gl_prefs_model_get_drawing_toolbar_visible (gl_prefs)) {
		gtk_widget_show_all (toolbar);
	} else {
		gtk_widget_hide (toolbar);
	}
	
	gl_debug (DEBUG_UI, "END");
}
开发者ID:samlown,项目名称:glabels,代码行数:26,代码来源:ui.c

示例9: change_orientation

static void
change_orientation (GtkWidget *button, GtkWidget *toolbar)
{
  GtkWidget *table;
  GtkOrientation orientation;

  table = gtk_widget_get_parent (toolbar);
  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
    orientation = GTK_ORIENTATION_VERTICAL;
  else
    orientation = GTK_ORIENTATION_HORIZONTAL;

  g_object_ref (toolbar);
  gtk_container_remove (GTK_CONTAINER (table), toolbar);
  gtk_toolbar_set_orientation (GTK_TOOLBAR (toolbar), orientation);
  if (orientation == GTK_ORIENTATION_HORIZONTAL)
    {
      gtk_table_attach (GTK_TABLE (table), toolbar,
			0,2, 0,1, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0);
    }
  else
    {
      gtk_table_attach (GTK_TABLE (table), toolbar,
			0,1, 0,4, GTK_FILL, GTK_FILL|GTK_EXPAND, 0, 0);
    }
  g_object_unref (toolbar);
}
开发者ID:Aridna,项目名称:gtk2,代码行数:27,代码来源:testtoolbar.c

示例10: c_main_window_get_toolbar

GtkToolbar*
c_main_window_get_toolbar (CMainWindow * self)
{
  g_return_val_if_fail (C_IS_MAIN_WINDOW (self), NULL);

  return GTK_TOOLBAR (gtk_ui_manager_get_widget (main_window_get_ui_manager (self), "/ui/toolbar"));
}
开发者ID:herzi,项目名称:classify,代码行数:7,代码来源:main-window.c

示例11: create_find_toolbar

/* 
 * Create the find toolbar
*/
void create_find_toolbar(AppData * view)
{
#ifdef MAEMO4
    view->find_toolbar = HILDON_FIND_TOOLBAR
        (hildon_find_toolbar_new("Find String: "));

    /* Add signal listers to "Search" and "Close" buttons */
    g_signal_connect(G_OBJECT(view->find_toolbar), "search",
                     G_CALLBACK(find_tb_search), view);
    g_signal_connect(G_OBJECT(view->find_toolbar), "close",
                     G_CALLBACK(find_tb_close), view);
    hildon_window_add_toolbar(view->window, GTK_TOOLBAR(view->find_toolbar));

    /* Set variables to AppData */
    view->find_visible = FALSE;
#else
    view->find_toolbar = gtk_toolbar_new();
    view->entry = GTK_ENTRY(gtk_entry_new ());
  
    g_signal_connect(GTK_WIDGET(view->entry), "key-press-event",
                   G_CALLBACK(on_insert_text), (gpointer)view);

    gtk_widget_show ( GTK_WIDGET(view->entry) );
#endif

}
开发者ID:FauxFaux,项目名称:despotify,代码行数:29,代码来源:maemify.c

示例12: main

int
main (int argc, char *argv[])
{
	GtkWidget *window;
	GtkToolbar *toolbar;
	GtkToolItem *item;

	gtk_init (&argc, &argv);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	g_signal_connect (window, "delete-event", G_CALLBACK (on_window_delete), NULL);

	toolbar = GTK_TOOLBAR (gtk_toolbar_new ());
	gtk_toolbar_set_style (toolbar, GTK_TOOLBAR_TEXT);
	item = gtk_tool_button_new (NULL, "Prompt");
	g_signal_connect (item, "clicked", G_CALLBACK (on_prompt_clicked), window);
	gtk_toolbar_insert (toolbar, item, 0);
	gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (toolbar));

	gtk_window_set_default_size (GTK_WINDOW (window), 400, 80);
	gtk_widget_show_all (window);

	gtk_main ();

	return 0;
}
开发者ID:SuspiciouSx,项目名称:gcr,代码行数:26,代码来源:frob-system-prompt.c

示例13: set_edit_mode

static void
set_edit_mode (EggEditableToolbar *etoolbar,
	       gboolean mode)
{
  EggEditableToolbarPrivate *priv = etoolbar->priv;
  int i, l, n_items;

  i = priv->edit_mode;
  if (mode)
    {
      priv->edit_mode++;
    }
  else
    {
      g_return_if_fail (priv->edit_mode > 0);
      priv->edit_mode--;
    }
  i *= priv->edit_mode;

  if (i == 0)
    {
      for (i = get_n_toolbars (etoolbar)-1; i >= 0; i--)
        {
          GtkWidget *toolbar;

          toolbar = get_toolbar_nth (etoolbar, i);
          n_items = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar));

          if (n_items == 0 && priv->edit_mode == 0)
            {
              egg_toolbars_model_remove_toolbar (priv->model, i);
            }
          else
            {
              for (l = 0; l < n_items; l++)
                {
                  GtkToolItem *item;

                  item = gtk_toolbar_get_nth_item (GTK_TOOLBAR (toolbar), l);

                  configure_item_cursor (item, etoolbar);
                  configure_item_sensitivity (item, etoolbar);
                }
            }
        }
    }
}
开发者ID:steev,项目名称:mate-image-viewer,代码行数:47,代码来源:egg-editable-toolbar.c

示例14: gb_gnome_app_setup_initial_app

static void
gb_gnome_app_setup_initial_app (GtkWidget *widget)
{
  GtkWidget *placeholder, *toolbar;

  /* We create a standard menubar and toolbar which the user can edit or
     simply delete anything they don't want. */
  glade_gnome_setup_initial_menus (widget);

  /* We need to get rid of the accelerators, since they aren't used, and
     they would override our default accelerators. */
  gtk_window_remove_accel_group (GTK_WINDOW (widget),
				 GNOME_APP (widget)->accel_group);

  /* FIXME: GnomeLibs bug workaround. It sets the initial border width
     to -2, which causes us lots of problems. */
#if 0
  gtk_container_set_border_width (GTK_CONTAINER (GNOME_APP (widget)->menubar),
				  0);
#endif
  gb_widget_create_from (GNOME_APP (widget)->menubar, "GtkMenubar");
  gb_widget_create_from (GNOME_APP (widget)->menubar->parent, "BonoboDockItem");

  /* Toolbar */
  toolbar = gtk_toolbar_new ();
  gnome_app_set_toolbar (GNOME_APP (widget), GTK_TOOLBAR (toolbar));
  gb_widget_create_from (toolbar, "GtkToolbar");
  gb_widget_create_from (toolbar->parent, "BonoboDockItem");

  gb_gnome_app_add_toolbar_button (GTK_TOOLBAR (toolbar), GTK_STOCK_NEW,
				   _("New File"));
  gb_gnome_app_add_toolbar_button (GTK_TOOLBAR (toolbar), GTK_STOCK_OPEN,
				   _("Open File"));
  gb_gnome_app_add_toolbar_button (GTK_TOOLBAR (toolbar), GTK_STOCK_SAVE,
				   _("Save File"));


  /* Statusbar */
  gnome_app_set_statusbar (GNOME_APP (widget),
			   gb_widget_new ("GnomeAppBar", widget));
  gb_widget_set_child_name (GNOME_APP (widget)->statusbar, GladeChildGnomeAppBar);

  /* We need to size the placeholders or the dialog is very small. */
  placeholder = editor_new_placeholder ();
  gtk_widget_set_usize (placeholder, 300, 200);
  gnome_app_set_contents (GNOME_APP (widget), placeholder);
}
开发者ID:AriaAsuka,项目名称:deadbeef,代码行数:47,代码来源:gnomeapp.c

示例15: gtk_vbox_new

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);
}
开发者ID:gsmcmullin,项目名称:sigrok,代码行数:59,代码来源:toolbar.c


注:本文中的GTK_TOOLBAR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。