本文整理汇总了C++中GTK_TOOL_ITEM函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_TOOL_ITEM函数的具体用法?C++ GTK_TOOL_ITEM怎么用?C++ GTK_TOOL_ITEM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_TOOL_ITEM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_section_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);
}
示例2: gtk_tool_item_update
static void
gtk_tool_item_update (GtkActivatable *activatable,
GtkAction *action,
const gchar *property_name)
{
if (strcmp (property_name, "visible") == 0)
{
if (gtk_action_is_visible (action))
gtk_widget_show (GTK_WIDGET (activatable));
else
gtk_widget_hide (GTK_WIDGET (activatable));
}
else if (strcmp (property_name, "sensitive") == 0)
gtk_widget_set_sensitive (GTK_WIDGET (activatable), gtk_action_is_sensitive (action));
else if (strcmp (property_name, "tooltip") == 0)
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (activatable),
gtk_action_get_tooltip (action));
else if (strcmp (property_name, "visible-horizontal") == 0)
gtk_tool_item_set_visible_horizontal (GTK_TOOL_ITEM (activatable),
gtk_action_get_visible_horizontal (action));
else if (strcmp (property_name, "visible-vertical") == 0)
gtk_tool_item_set_visible_vertical (GTK_TOOL_ITEM (activatable),
gtk_action_get_visible_vertical (action));
else if (strcmp (property_name, "is-important") == 0)
gtk_tool_item_set_is_important (GTK_TOOL_ITEM (activatable),
gtk_action_get_is_important (action));
}
示例3: nsgtk_toolbar_add_store_widget
/**
* physically add widgets to store window
*/
bool nsgtk_toolbar_add_store_widget(GtkWidget *widget)
{
if (window->numberh >= NSGTK_STORE_WIDTH) {
window->currentbar = gtk_toolbar_new();
if (window->currentbar == NULL) {
warn_user("NoMemory", 0);
return false;
}
gtk_toolbar_set_style(GTK_TOOLBAR(window->currentbar),
GTK_TOOLBAR_BOTH);
gtk_toolbar_set_icon_size(GTK_TOOLBAR(window->currentbar),
GTK_ICON_SIZE_LARGE_TOOLBAR);
gtk_box_pack_start(GTK_BOX(window->widgetvbox),
window->currentbar, FALSE, FALSE, 0);
window->numberh = 0;
}
gtk_widget_set_size_request(widget, NSGTK_BUTTON_WIDTH,
NSGTK_BUTTON_HEIGHT);
gtk_toolbar_insert(GTK_TOOLBAR(window->currentbar), GTK_TOOL_ITEM(
widget), window->numberh++);
gtk_tool_item_set_use_drag_window(GTK_TOOL_ITEM(widget), TRUE);
gtk_drag_source_set(widget, GDK_BUTTON1_MASK, &entry, 1,
GDK_ACTION_COPY);
gtk_widget_show_all(window->window);
return true;
}
示例4: updatePopupData
void ZLGtkApplicationWindow::updatePopupData(GtkMenuToolButton *button, shared_ptr<ZLPopupData> data) {
if (data.isNull()) {
return;
}
const size_t id = data->id();
if (id == myPopupIdMap[GTK_TOOL_ITEM(button)]) {
return;
}
myPopupIdMap[GTK_TOOL_ITEM(button)] = id;
GtkMenu *menu = GTK_MENU(gtk_menu_tool_button_get_menu(button));
GList *children = gtk_container_get_children(GTK_CONTAINER(menu));
if (children != 0) {
for (GList *ptr = g_list_last(children); ; ptr = g_list_previous(ptr)) {
gtk_container_remove(GTK_CONTAINER(menu), GTK_WIDGET(ptr->data));
if (ptr == children) {
break;
}
}
}
const size_t count = data->count();
for (size_t i = 0; i < count; ++i) {
GtkWidget *item = gtk_menu_item_new_with_label(data->text(i).c_str());
gtk_widget_show_all(item);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
ZLGtkSignalUtil::connectSignal(GTK_OBJECT(item), "activate", GTK_SIGNAL_FUNC(itemActivated), &*data);
}
}
示例5: ui_callback_on_filters_enabled
gboolean ui_callback_on_filters_enabled(GtkToolButton *button, gpointer data)
{
gboolean enabled;
gboolean changed;
enabled = gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON(button));
g_info("Filters enabled event occurred %d", enabled);
changed = ui_filters_enable (enabled);
if (changed)
{
/* Set the tool tip text */
if (enabled)
{
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM(button), "Disable messages filtering");
}
else
{
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM(button), "Enable messages filtering");
}
ui_tree_view_refilter ();
}
return TRUE;
}
示例6: load_stock_items
static void
load_stock_items (GtkToolPalette *palette)
{
GtkWidget *group_af = gtk_tool_item_group_new ("Stock Icons (A-F)");
GtkWidget *group_gn = gtk_tool_item_group_new ("Stock Icons (G-N)");
GtkWidget *group_or = gtk_tool_item_group_new ("Stock Icons (O-R)");
GtkWidget *group_sz = gtk_tool_item_group_new ("Stock Icons (S-Z)");
GtkWidget *group = NULL;
GtkToolItem *item;
GSList *stock_ids;
GSList *iter;
stock_ids = gtk_stock_list_ids ();
stock_ids = g_slist_sort (stock_ids, (GCompareFunc) strcmp);
gtk_container_add (GTK_CONTAINER (palette), group_af);
gtk_container_add (GTK_CONTAINER (palette), group_gn);
gtk_container_add (GTK_CONTAINER (palette), group_or);
gtk_container_add (GTK_CONTAINER (palette), group_sz);
for (iter = stock_ids; iter; iter = g_slist_next (iter))
{
GtkStockItem stock_item;
gchar *id = iter->data;
switch (id[4])
{
case 'a':
group = group_af;
break;
case 'g':
group = group_gn;
break;
case 'o':
group = group_or;
break;
case 's':
group = group_sz;
break;
}
item = gtk_tool_button_new_from_stock (id);
gtk_tool_item_set_tooltip_text (GTK_TOOL_ITEM (item), id);
gtk_tool_item_set_is_important (GTK_TOOL_ITEM (item), TRUE);
gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
if (!gtk_stock_lookup (id, &stock_item) || !stock_item.label)
gtk_tool_button_set_label (GTK_TOOL_BUTTON (item), id);
g_free (id);
}
g_slist_free (stock_ids);
}
示例7: show_icon
static void show_icon(void)
{
mailbutton = GTK_WIDGET(gtk_tool_button_new_from_stock(GEANYSENDMAIL_STOCK_MAIL));
plugin_add_toolbar_item(geany_plugin, GTK_TOOL_ITEM(mailbutton));
ui_add_document_sensitive(mailbutton);
#if GTK_CHECK_VERSION(2, 12, 0)
gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM(mailbutton), _("Send by mail"));
#endif
g_signal_connect (G_OBJECT(mailbutton), "clicked", G_CALLBACK(send_as_attachment), NULL);
gtk_widget_show_all (mailbutton);
icon_in_toolbar = TRUE;
}
示例8: set_homogeneous
static void
set_homogeneous (GtkWidget *widget, gpointer data)
{
gboolean *is_hom_p = data;
gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (widget), *is_hom_p);
}
示例9: gtk_tool_item_set_homogeneous
// helper to create a dropdown menu item
void wxToolBarTool::CreateDropDown()
{
gtk_tool_item_set_homogeneous(m_item, false);
GtkOrientation orient = GTK_ORIENTATION_HORIZONTAL;
GtkArrowType arrowType = GTK_ARROW_DOWN;
if (GetToolBar()->HasFlag(wxTB_LEFT | wxTB_RIGHT))
{
orient = GTK_ORIENTATION_VERTICAL;
arrowType = GTK_ARROW_RIGHT;
}
GtkWidget* box = gtk_box_new(orient, 0);
GtkWidget* arrow = gtk_arrow_new(arrowType, GTK_SHADOW_NONE);
GtkWidget* tool_button = gtk_bin_get_child(GTK_BIN(m_item));
g_object_ref(tool_button);
gtk_container_remove(GTK_CONTAINER(m_item), tool_button);
gtk_container_add(GTK_CONTAINER(box), tool_button);
g_object_unref(tool_button);
GtkWidget* arrow_button = gtk_toggle_button_new();
gtk_button_set_relief(GTK_BUTTON(arrow_button),
gtk_tool_item_get_relief_style(GTK_TOOL_ITEM(m_item)));
gtk_container_add(GTK_CONTAINER(arrow_button), arrow);
gtk_container_add(GTK_CONTAINER(box), arrow_button);
gtk_widget_show_all(box);
gtk_container_add(GTK_CONTAINER(m_item), box);
g_signal_connect(arrow_button, "toggled", G_CALLBACK(arrow_toggled), this);
g_signal_connect(arrow_button, "button_press_event",
G_CALLBACK(arrow_button_press_event), this);
}
示例10: button_toggled
static void
button_toggled (GtkWidget *widget,
GtkToggleToolButton *toggle_tool_button)
{
gboolean toggle_active;
toggle_active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
if (toggle_tool_button->priv->active != toggle_active)
{
GtkWidget *menu_item;
toggle_tool_button->priv->active = toggle_active;
if ((menu_item =
gtk_tool_item_get_proxy_menu_item (GTK_TOOL_ITEM (toggle_tool_button), MENU_ID)))
{
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item),
toggle_tool_button->priv->active);
}
g_object_notify (G_OBJECT (toggle_tool_button), "active");
g_signal_emit (toggle_tool_button, toggle_signals[TOGGLED], 0);
}
}
示例11: 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);
}
示例12: gimp_throbber_set_image
void
gimp_throbber_set_image (GimpThrobber *button,
GtkWidget *image)
{
g_return_if_fail (GIMP_IS_THROBBER (button));
g_return_if_fail (image == NULL || GTK_IS_IMAGE (image));
if (image != button->priv->image)
{
if (button->priv->image)
{
if (gtk_widget_get_parent (button->priv->image))
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (button->priv->image)),
button->priv->image);
g_object_unref (button->priv->image);
}
if (image)
g_object_ref_sink (image);
button->priv->image = image;
gimp_throbber_construct_contents (GTK_TOOL_ITEM (button));
g_object_notify (G_OBJECT (button), "image");
}
}
示例13: score_widget_new
static GtkToolItem*
score_widget_new()
{
g_assert(score_widget == NULL);
score_widget = sugar_toolkit_tool_text_new();
return GTK_TOOL_ITEM(score_widget);
}
示例14: gb_tool_item_write_source
/*
* Writes the source code needed to create this widget.
* You have to output everything necessary to create the widget here, though
* there are some convenience functions to help.
*/
static void
gb_tool_item_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
{
if (data->create_widget)
{
source_add (data,
" %s = (GtkWidget*) gtk_tool_item_new ();\n",
data->wname);
}
gb_widget_write_standard_source (widget, data);
if (gtk_object_get_data (GTK_OBJECT (widget), VisibleHorz) != NULL)
{
source_add (data,
" gtk_tool_item_set_visible_horizontal (GTK_TOOL_ITEM (%s), FALSE);\n",
data->wname);
}
if (gtk_object_get_data (GTK_OBJECT (widget), VisibleVert) != NULL)
{
source_add (data,
" gtk_tool_item_set_visible_vertical (GTK_TOOL_ITEM (%s), FALSE);\n",
data->wname);
}
if (gtk_tool_item_get_is_important (GTK_TOOL_ITEM (widget)))
{
source_add (data,
" gtk_tool_item_set_is_important (GTK_TOOL_ITEM (%s), TRUE);\n",
data->wname);
}
}
示例15: connect_proxy
static void
connect_proxy (GtkAction *action,
GtkWidget *proxy)
{
if (GTK_IS_TOOL_ITEM (proxy)) {
GtkToolItem *item = GTK_TOOL_ITEM (proxy);
NautilusZoomAction *zaction = NAUTILUS_ZOOM_ACTION (action);
NautilusNavigationWindow *window = zaction->priv->window;
GtkWidget *zoom_control;
zoom_control = nautilus_zoom_control_new ();
gtk_container_set_border_width (GTK_CONTAINER (item), 4);
gtk_container_add (GTK_CONTAINER (item), zoom_control);
gtk_widget_show (zoom_control);
g_signal_connect_object (zoom_control, "zoom_in",
G_CALLBACK (nautilus_window_zoom_in),
window, G_CONNECT_SWAPPED);
g_signal_connect_object (zoom_control, "zoom_out",
G_CALLBACK (nautilus_window_zoom_out),
window, G_CONNECT_SWAPPED);
g_signal_connect_object (zoom_control, "zoom_to_level",
G_CALLBACK (nautilus_window_zoom_to_level),
window, G_CONNECT_SWAPPED);
g_signal_connect_object (zoom_control, "zoom_to_default",
G_CALLBACK (nautilus_window_zoom_to_default),
window, G_CONNECT_SWAPPED);
g_signal_connect (window, "zoom-changed",
G_CALLBACK (zoom_changed_callback),
zoom_control);
}
(* GTK_ACTION_CLASS (parent_class)->connect_proxy) (action, proxy);
}