mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-18 09:00:34 +00:00
Seal GtkMenuItem
svn path=/trunk/; revision=20610
This commit is contained in:
parent
f1f95ef71d
commit
a66946e2a5
@ -2272,6 +2272,7 @@ gtk_menu_set_title
|
|||||||
#if IN_FILE(__GTK_MENU_ITEM_C__)
|
#if IN_FILE(__GTK_MENU_ITEM_C__)
|
||||||
gtk_menu_item_activate
|
gtk_menu_item_activate
|
||||||
gtk_menu_item_deselect
|
gtk_menu_item_deselect
|
||||||
|
gtk_menu_item_get_accel_path
|
||||||
gtk_menu_item_get_right_justified
|
gtk_menu_item_get_right_justified
|
||||||
gtk_menu_item_get_submenu
|
gtk_menu_item_get_submenu
|
||||||
gtk_menu_item_get_type G_GNUC_CONST
|
gtk_menu_item_get_type G_GNUC_CONST
|
||||||
|
@ -52,7 +52,9 @@ enum {
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_SUBMENU
|
PROP_RIGHT_JUSTIFIED,
|
||||||
|
PROP_SUBMENU,
|
||||||
|
PROP_ACCEL_PATH
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -189,6 +191,21 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
|
|||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
G_TYPE_INT);
|
G_TYPE_INT);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkMenuItem:right-justified:
|
||||||
|
*
|
||||||
|
* Sets whether the menu item appears justified at the right side of a menu bar.
|
||||||
|
*
|
||||||
|
* Since: GSEAL-branch
|
||||||
|
**/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_RIGHT_JUSTIFIED,
|
||||||
|
g_param_spec_boolean ("right-justified",
|
||||||
|
P_("Right Justified"),
|
||||||
|
P_("Sets whether the menu item appears justified at the right side of a menu bar"),
|
||||||
|
FALSE,
|
||||||
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GtkMenuItem:submenu:
|
* GtkMenuItem:submenu:
|
||||||
*
|
*
|
||||||
@ -204,6 +221,23 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
|
|||||||
GTK_TYPE_MENU,
|
GTK_TYPE_MENU,
|
||||||
GTK_PARAM_READWRITE));
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkMenuItem:accel-path:
|
||||||
|
*
|
||||||
|
* Sets the accelerator path of the menu item, through which runtime
|
||||||
|
* changes of the menu item's accelerator caused by the user can be
|
||||||
|
* identified and saved to persistant storage.
|
||||||
|
*
|
||||||
|
* Since: GSEAL-branch
|
||||||
|
**/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_ACCEL_PATH,
|
||||||
|
g_param_spec_string ("accel-path",
|
||||||
|
P_("Accel Path"),
|
||||||
|
P_("Sets the accelerator path of the menu item"),
|
||||||
|
NULL,
|
||||||
|
GTK_PARAM_READWRITE));
|
||||||
|
|
||||||
gtk_widget_class_install_style_property_parser (widget_class,
|
gtk_widget_class_install_style_property_parser (widget_class,
|
||||||
g_param_spec_enum ("selected-shadow-type",
|
g_param_spec_enum ("selected-shadow-type",
|
||||||
"Selected Shadow Type",
|
"Selected Shadow Type",
|
||||||
@ -329,9 +363,15 @@ gtk_menu_item_set_property (GObject *object,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
|
case PROP_RIGHT_JUSTIFIED:
|
||||||
|
gtk_menu_item_set_right_justified (menu_item, g_value_get_boolean (value));
|
||||||
|
break;
|
||||||
case PROP_SUBMENU:
|
case PROP_SUBMENU:
|
||||||
gtk_menu_item_set_submenu (menu_item, g_value_get_object (value));
|
gtk_menu_item_set_submenu (menu_item, g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_ACCEL_PATH:
|
||||||
|
gtk_menu_item_set_accel_path (menu_item, g_value_get_string (value));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
@ -349,9 +389,15 @@ gtk_menu_item_get_property (GObject *object,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
|
case PROP_RIGHT_JUSTIFIED:
|
||||||
|
g_value_set_boolean (value, gtk_menu_item_get_right_justified (menu_item));
|
||||||
|
break;
|
||||||
case PROP_SUBMENU:
|
case PROP_SUBMENU:
|
||||||
g_value_set_object (value, gtk_menu_item_get_submenu (menu_item));
|
g_value_set_object (value, gtk_menu_item_get_submenu (menu_item));
|
||||||
break;
|
break;
|
||||||
|
case PROP_ACCEL_PATH:
|
||||||
|
g_value_set_string (value, gtk_menu_item_get_accel_path (menu_item));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
@ -1632,6 +1678,29 @@ gtk_menu_item_set_accel_path (GtkMenuItem *menu_item,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gtk_menu_item_get_accel_path
|
||||||
|
* @menu_item: a valid #GtkMenuItem
|
||||||
|
*
|
||||||
|
* Set the accelerator path on @menu_item, through which runtime changes of the
|
||||||
|
* menu item's accelerator caused by the user can be identified and saved to
|
||||||
|
* persistant storage (see gtk_accel_map_save() on this).
|
||||||
|
* To setup a default accelerator for this menu item, call
|
||||||
|
* gtk_accel_map_add_entry() with the same @accel_path.
|
||||||
|
* See also gtk_accel_map_add_entry() on the specifics of accelerator paths,
|
||||||
|
* and gtk_menu_set_accel_path() for a more convenient variant of this function.
|
||||||
|
*
|
||||||
|
* Returns: the accelerator path corresponding to this menu item's
|
||||||
|
* functionality, or %NULL if not set
|
||||||
|
*/
|
||||||
|
G_CONST_RETURN gchar *
|
||||||
|
gtk_menu_item_get_accel_path (GtkMenuItem *menu_item)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
|
||||||
|
|
||||||
|
return menu_item->accel_path;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_menu_item_forall (GtkContainer *container,
|
gtk_menu_item_forall (GtkContainer *container,
|
||||||
gboolean include_internals,
|
gboolean include_internals,
|
||||||
|
@ -52,21 +52,21 @@ typedef struct _GtkMenuItemClass GtkMenuItemClass;
|
|||||||
struct _GtkMenuItem
|
struct _GtkMenuItem
|
||||||
{
|
{
|
||||||
GtkItem item;
|
GtkItem item;
|
||||||
|
|
||||||
GtkWidget *submenu;
|
GtkWidget *GSEAL (submenu);
|
||||||
GdkWindow *event_window;
|
GdkWindow *GSEAL (event_window);
|
||||||
|
|
||||||
guint16 toggle_size;
|
guint16 GSEAL (toggle_size);
|
||||||
guint16 accelerator_width;
|
guint16 GSEAL (accelerator_width);
|
||||||
gchar *accel_path;
|
gchar *GSEAL (accel_path);
|
||||||
|
|
||||||
guint show_submenu_indicator : 1;
|
guint GSEAL (show_submenu_indicator : 1);
|
||||||
guint submenu_placement : 1;
|
guint GSEAL (submenu_placement : 1);
|
||||||
guint submenu_direction : 1;
|
guint GSEAL (submenu_direction : 1);
|
||||||
guint right_justify: 1;
|
guint GSEAL (right_justify: 1);
|
||||||
guint timer_from_keypress : 1;
|
guint GSEAL (timer_from_keypress : 1);
|
||||||
guint from_menubar : 1;
|
guint GSEAL (from_menubar : 1);
|
||||||
guint timer;
|
guint GSEAL (timer);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkMenuItemClass
|
struct _GtkMenuItemClass
|
||||||
@ -115,6 +115,7 @@ void gtk_menu_item_set_right_justified (GtkMenuItem *menu_item,
|
|||||||
gboolean gtk_menu_item_get_right_justified (GtkMenuItem *menu_item);
|
gboolean gtk_menu_item_get_right_justified (GtkMenuItem *menu_item);
|
||||||
void gtk_menu_item_set_accel_path (GtkMenuItem *menu_item,
|
void gtk_menu_item_set_accel_path (GtkMenuItem *menu_item,
|
||||||
const gchar *accel_path);
|
const gchar *accel_path);
|
||||||
|
G_CONST_RETURN gchar* gtk_menu_item_get_accel_path (GtkMenuItem *menu_item);
|
||||||
|
|
||||||
/* private */
|
/* private */
|
||||||
void _gtk_menu_item_refresh_accel_path (GtkMenuItem *menu_item,
|
void _gtk_menu_item_refresh_accel_path (GtkMenuItem *menu_item,
|
||||||
|
Loading…
Reference in New Issue
Block a user