本文整理汇总了C++中GTK_IS_MENU_ITEM函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_IS_MENU_ITEM函数的具体用法?C++ GTK_IS_MENU_ITEM怎么用?C++ GTK_IS_MENU_ITEM使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTK_IS_MENU_ITEM函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: serializer_visit
static void serializer_visit (Serializer* self, GtkWidget* widget) {
g_return_if_fail (self != NULL);
g_return_if_fail (widget != NULL);
if (GTK_IS_MENU_BAR (widget)) {
GtkWidget* _tmp0_;
serializer_visit_menubar (self, (_tmp0_ = widget, GTK_IS_MENU_BAR (_tmp0_) ? ((GtkMenuBar*) _tmp0_) : NULL));
} else {
if (GTK_IS_MENU (widget)) {
GtkWidget* _tmp1_;
serializer_visit_menu (self, (_tmp1_ = widget, GTK_IS_MENU (_tmp1_) ? ((GtkMenu*) _tmp1_) : NULL));
} else {
if (GTK_IS_MENU_ITEM (widget)) {
GtkWidget* _tmp2_;
serializer_visit_menuitem (self, (_tmp2_ = widget, GTK_IS_MENU_ITEM (_tmp2_) ? ((GtkMenuItem*) _tmp2_) : NULL));
} else {
if (GTK_IS_LABEL (widget)) {
GtkWidget* _tmp3_;
serializer_visit_label (self, (_tmp3_ = widget, GTK_IS_LABEL (_tmp3_) ? ((GtkLabel*) _tmp3_) : NULL));
} else {
if (GTK_IS_IMAGE (widget)) {
GtkWidget* _tmp4_;
serializer_visit_image (self, (_tmp4_ = widget, GTK_IS_IMAGE (_tmp4_) ? ((GtkImage*) _tmp4_) : NULL));
} else {
if (GTK_IS_CONTAINER (widget)) {
GtkWidget* _tmp5_;
serializer_visit_container (self, (_tmp5_ = widget, GTK_IS_CONTAINER (_tmp5_) ? ((GtkContainer*) _tmp5_) : NULL));
}
}
}
}
}
}
}
示例2: gb_view_source_lang_activate
static void
gb_view_source_lang_activate (GbViewSource *source,
GtkMenuItem *menu_item)
{
GbViewSourcePrivate *priv;
GtkSourceLanguageManager *lm;
GtkSourceLanguage *lang;
const gchar *lang_id;
ENTRY;
g_return_if_fail(GB_IS_VIEW_SOURCE(source));
g_return_if_fail(GTK_IS_MENU_ITEM(menu_item));
priv = source->priv;
if ((lang_id = g_object_get_data(G_OBJECT(menu_item), "language-id"))) {
lm = gtk_source_language_manager_get_default();
lang = gtk_source_language_manager_get_language(lm, lang_id);
gtk_source_buffer_set_language(priv->buffer, lang);
gb_menu_button_set_label(GB_MENU_BUTTON(priv->lang_combo),
gtk_source_language_get_name(lang));
}
EXIT;
}
示例3: account_item_activated_cb
static void account_item_activated_cb(GtkMenuItem *menuitem, gpointer user_data)
{
//IndicatorFitbit *self = INDICATOR_FITBIT(user_data);
g_return_if_fail(GTK_IS_MENU_ITEM(menuitem));
g_return_if_fail(IS_INDICATOR_FITBIT(user_data));
}
示例4: gail_menu_shell_add_selection
static gboolean
gail_menu_shell_add_selection (AtkSelection *selection,
gint i)
{
GtkMenuShell *shell;
GList *item;
guint length;
GtkWidget *widget;
widget = GTK_ACCESSIBLE (selection)->widget;
if (widget == NULL)
{
/* State is defunct */
return FALSE;
}
shell = GTK_MENU_SHELL (widget);
length = g_list_length (shell->children);
if (i < 0 || i > length)
return FALSE;
item = g_list_nth (shell->children, i);
g_return_val_if_fail (item != NULL, FALSE);
g_return_val_if_fail (GTK_IS_MENU_ITEM(item->data), FALSE);
gtk_menu_shell_select_item (shell, GTK_WIDGET (item->data));
return TRUE;
}
示例5: gb_view_source_tab_size_activate
static void
gb_view_source_tab_size_activate (GtkMenuItem *menu_item,
GbViewSource *source)
{
GbViewSourcePrivate *priv;
const gchar *label;
gint size;
ENTRY;
g_return_if_fail(GTK_IS_MENU_ITEM(menu_item));
g_return_if_fail(GB_IS_VIEW_SOURCE(source));
priv = source->priv;
label = gtk_menu_item_get_label(menu_item);
size = g_ascii_strtoll(label, NULL, 10);
if (size > 0) {
gtk_source_view_set_tab_width(GTK_SOURCE_VIEW(priv->source1), size);
if (priv->source2) {
gtk_source_view_set_tab_width(GTK_SOURCE_VIEW(priv->source2), size);
}
g_object_set(priv->size_combo,
"label", label,
NULL);
}
EXIT;
}
示例6: gtk_menu_item_accessible_ref_state_set
static AtkStateSet *
gtk_menu_item_accessible_ref_state_set (AtkObject *obj)
{
AtkObject *menu_item;
AtkStateSet *state_set, *parent_state_set;
state_set = ATK_OBJECT_CLASS (_gtk_menu_item_accessible_parent_class)->ref_state_set (obj);
menu_item = atk_object_get_parent (obj);
if (menu_item)
{
if (!GTK_IS_MENU_ITEM (gtk_accessible_get_widget (GTK_ACCESSIBLE (menu_item))))
return state_set;
parent_state_set = atk_object_ref_state_set (menu_item);
if (!atk_state_set_contains_state (parent_state_set, ATK_STATE_SELECTED))
{
atk_state_set_remove_state (state_set, ATK_STATE_FOCUSED);
atk_state_set_remove_state (state_set, ATK_STATE_SHOWING);
}
g_object_unref (parent_state_set);
}
return state_set;
}
示例7: gwy_sensitivity_group_debug
static void
gwy_sensitivity_group_debug(GwySensitivityGroup *sensgroup)
{
SensList *senslist;
GtkWidget *widget, *w;
GList *l, *ll;
const gchar *s;
gint nw = 0;
g_printerr("SENS GROUP %p\n", sensgroup);
for (ll = sensgroup->lists; ll; ll = g_list_next(ll)) {
g_printerr(" LIST: ");
senslist = (SensList*)ll->data;
g_printerr("mask=%04x, dirty=%d, parent=%p\n",
senslist->mask, senslist->dirty, senslist->parent);
for (l = senslist->widgets; l; l = g_list_next(l)) {
nw++;
g_printerr(" WIDGET: ");
widget = GTK_WIDGET(l->data);
g_printerr("%s ", g_type_name(G_TYPE_FROM_INSTANCE(widget)));
if (GTK_IS_BUTTON(widget)) {
s = gtk_button_get_label(GTK_BUTTON(widget));
if (s)
g_printerr("<%s> ", s);
else {
w = gtk_bin_get_child(GTK_BIN(widget));
if (w) {
g_printerr("%s ", g_type_name(G_TYPE_FROM_INSTANCE(w)));
if (GTK_IS_LABEL(w)) {
s = gtk_label_get_text(GTK_LABEL(w));
if (s)
g_printerr("<%s> ", s);
}
else if (GTK_IS_IMAGE(w)) {
s = NULL;
gtk_image_get_stock(GTK_IMAGE(w), (gchar**)&s,
NULL);
if (s)
g_printerr("<%s> ", s);
}
}
}
}
else if (GTK_IS_MENU_ITEM(widget)) {
w = gtk_bin_get_child(GTK_BIN(widget));
if (w) {
g_printerr("%s ", g_type_name(G_TYPE_FROM_INSTANCE(w)));
if (GTK_IS_LABEL(w)) {
s = gtk_label_get_text(GTK_LABEL(w));
if (s)
g_printerr("<%s> ", s);
}
}
}
g_printerr("\n");
}
}
g_printerr(" nwidgets=%d, ref_count=%d\n",
nw, G_OBJECT(sensgroup)->ref_count);
}
示例8: gtk_tool_item_set_proxy_menu_item
/**
* gtk_tool_item_set_proxy_menu_item:
* @tool_item: a #GtkToolItem
* @menu_item_id: a string used to identify @menu_item
* @menu_item: a #GtkMenuItem to be used in the overflow menu
*
* Sets the #GtkMenuItem used in the toolbar overflow menu. The
* @menu_item_id is used to identify the caller of this function and
* should also be used with gtk_tool_item_get_proxy_menu_item().
*
* Since: 2.4
**/
void
gtk_tool_item_set_proxy_menu_item (GtkToolItem *tool_item,
const gchar *menu_item_id,
GtkWidget *menu_item)
{
g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
g_return_if_fail (menu_item == NULL || GTK_IS_MENU_ITEM (menu_item));
g_return_if_fail (menu_item_id != NULL);
g_free (tool_item->priv->menu_item_id);
tool_item->priv->menu_item_id = g_strdup (menu_item_id);
if (tool_item->priv->menu_item != menu_item)
{
if (tool_item->priv->menu_item)
g_object_unref (tool_item->priv->menu_item);
if (menu_item)
{
g_object_ref_sink (menu_item);
gtk_widget_set_sensitive (menu_item,
gtk_widget_get_sensitive (GTK_WIDGET (tool_item)));
}
tool_item->priv->menu_item = menu_item;
}
}
示例9: mail_browser_connect_proxy_cb
static void
mail_browser_connect_proxy_cb (EMailBrowser *browser,
GtkAction *action,
GtkWidget *proxy)
{
GtkStatusbar *statusbar;
guint context_id;
if (!GTK_IS_MENU_ITEM (proxy))
return;
statusbar = GTK_STATUSBAR (browser->priv->statusbar);
context_id = gtk_statusbar_get_context_id (statusbar, G_STRFUNC);
g_object_set_data (
G_OBJECT (proxy), "context-id",
GUINT_TO_POINTER (context_id));
g_signal_connect_swapped (
proxy, "select",
G_CALLBACK (mail_browser_menu_item_select_cb), browser);
g_signal_connect_swapped (
proxy, "deselect",
G_CALLBACK (mail_browser_menu_item_deselect_cb), browser);
}
示例10: gtk_menu_item_accessible_add_selection
static gboolean
gtk_menu_item_accessible_add_selection (AtkSelection *selection,
gint i)
{
GtkMenuShell *shell;
GList *kids;
guint length;
GtkWidget *widget;
GtkWidget *menu;
GtkWidget *child;
widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (selection));
if (widget == NULL)
return FALSE;
menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
if (menu == NULL)
return FALSE;
shell = GTK_MENU_SHELL (menu);
kids = gtk_container_get_children (GTK_CONTAINER (shell));
length = g_list_length (kids);
if (i < 0 || i > length)
{
g_list_free (kids);
return FALSE;
}
child = g_list_nth_data (kids, i);
g_list_free (kids);
g_return_val_if_fail (GTK_IS_MENU_ITEM (child), FALSE);
gtk_menu_shell_select_item (shell, GTK_WIDGET (child));
return TRUE;
}
示例11: qtcMenuShellLeave
static gboolean
qtcMenuShellLeave(GtkWidget *widget, GdkEventCrossing *event, void *data)
{
QTC_UNUSED(data);
QTC_UNUSED(event);
if (GTK_IS_MENU_SHELL(widget) && GTK_IS_CONTAINER(widget)) {
GList *children = gtk_container_get_children(GTK_CONTAINER(widget));
for (GList *child = children;child;child = g_list_next(child)) {
if ((child->data) && GTK_IS_MENU_ITEM(child->data) &&
(gtk_widget_get_state(GTK_WIDGET(child->data)) !=
GTK_STATE_INSENSITIVE)) {
GtkWidget *submenu =
gtk_menu_item_get_submenu(GTK_MENU_ITEM(child->data));
GtkWidget *topLevel =
submenu ? gtk_widget_get_toplevel(submenu) : NULL;
if (submenu &&
((!GTK_IS_MENU(submenu)) ||
(!(gtk_widget_get_realized(submenu) &&
gtk_widget_get_visible(submenu) &&
gtk_widget_get_realized(topLevel) &&
gtk_widget_get_visible(topLevel))))) {
gtk_widget_set_state(GTK_WIDGET(child->data),
GTK_STATE_NORMAL);
}
}
}
if (children) {
g_list_free(children);
}
}
return false;
}
示例12: menu_choice_activate
static void
menu_choice_activate (GtkWidget *item,
gpointer data)
{
gpointer udata = gtk_object_get_user_data (GTK_OBJECT (item));
if (GTK_IS_MENU (current_popup_menu))
{
gtk_object_set_data (GTK_OBJECT (current_popup_menu), "BstChoice", udata);
if (modal_loop_quit_on_menu_item_activate)
modal_loop_running = FALSE;
}
else /* current_popup_menu is not set e.g. for option menus */
{
while (GTK_IS_MENU (item->parent))
{
GtkWidget *tmp;
item = item->parent;
tmp = gtk_menu_get_attach_widget (GTK_MENU (item));
if (GTK_IS_MENU_ITEM (tmp))
item = tmp;
}
g_assert (GTK_IS_MENU (item));
gtk_object_set_data (GTK_OBJECT (item), "BstChoice", udata);
}
}
示例13: disconnect_proxy_cb
static void
disconnect_proxy_cb (GtkUIManager *manager,
GtkAction *action,
GtkWidget *proxy,
CajaWindow *window)
{
GtkWidget *widget;
if (GTK_IS_MENU_ITEM (proxy))
{
g_signal_handlers_disconnect_by_func
(proxy, G_CALLBACK (menu_item_select_cb), window);
g_signal_handlers_disconnect_by_func
(proxy, G_CALLBACK (menu_item_deselect_cb), window);
}
widget = get_event_widget (proxy);
if (widget)
{
g_signal_handlers_disconnect_by_func (widget,
G_CALLBACK (proxy_button_press_event_cb),
action);
g_signal_handlers_disconnect_by_func (widget,
G_CALLBACK (proxy_button_release_event_cb),
action);
}
}
示例14: menu_get_panel
PanelWidget *
menu_get_panel (GtkWidget *menu)
{
PanelWidget *retval = NULL;
g_return_val_if_fail (menu != NULL, NULL);
if (GTK_IS_MENU_ITEM (menu))
menu = gtk_widget_get_parent (menu);
g_return_val_if_fail (GTK_IS_MENU (menu), NULL);
while (menu) {
retval = g_object_get_data (G_OBJECT (menu), "menu_panel");
if (retval)
break;
menu = gtk_widget_get_parent (gtk_menu_get_attach_widget (GTK_MENU (menu)));
if (!GTK_IS_MENU (menu))
break;
}
if (retval && !PANEL_IS_WIDGET (retval)) {
g_warning ("Invalid PanelWidget associated with menu");
retval = NULL;
}
if (!retval) {
g_warning ("Cannot find the PanelWidget associated with menu");
retval = panels->data;
}
return retval;
}
示例15: get_event_widget
static GtkWidget *
get_event_widget (GtkWidget *proxy)
{
GtkWidget *widget;
/**
* Finding the interesting widget requires internal knowledge of
* the widgets in question. This can't be helped, but by keeping
* the sneaky code in one place, it can easily be updated.
*/
if (GTK_IS_MENU_ITEM (proxy)) {
/* Menu items already forward middle clicks */
widget = NULL;
} else if (GTK_IS_MENU_TOOL_BUTTON (proxy)) {
widget = eel_gtk_menu_tool_button_get_button (GTK_MENU_TOOL_BUTTON (proxy));
} else if (GTK_IS_TOOL_BUTTON (proxy)) {
/* The tool button's button is the direct child */
widget = gtk_bin_get_child (GTK_BIN (proxy));
} else if (GTK_IS_BUTTON (proxy)) {
widget = proxy;
} else {
/* Don't touch anything we don't know about */
widget = NULL;
}
return widget;
}