mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-19 18:00:09 +00:00
Seal GtkMenu
svn path=/trunk/; revision=20589
This commit is contained in:
parent
f79c213b33
commit
f61c311176
@ -2244,7 +2244,9 @@ gtk_menu_attach
|
||||
gtk_menu_attach_to_widget
|
||||
gtk_menu_detach
|
||||
gtk_menu_get_accel_group
|
||||
gtk_menu_get_accel_path
|
||||
gtk_menu_get_active
|
||||
gtk_menu_get_monitor
|
||||
gtk_menu_get_attach_widget
|
||||
gtk_menu_get_for_attach_widget
|
||||
gtk_menu_get_tearoff_state
|
||||
|
154
gtk/gtkmenu.c
154
gtk/gtkmenu.c
@ -121,8 +121,13 @@ enum {
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ACTIVE,
|
||||
PROP_ACCEL_GROUP,
|
||||
PROP_ACCEL_PATH,
|
||||
PROP_ATTACH_WIDGET,
|
||||
PROP_TEAROFF_STATE,
|
||||
PROP_TEAROFF_TITLE
|
||||
PROP_TEAROFF_TITLE,
|
||||
PROP_MONITOR
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -482,7 +487,67 @@ gtk_menu_class_init (GtkMenuClass *class)
|
||||
_gtk_marshal_VOID__ENUM,
|
||||
G_TYPE_NONE, 1,
|
||||
GTK_TYPE_SCROLL_TYPE);
|
||||
|
||||
|
||||
/**
|
||||
* GtkMenu:active:
|
||||
*
|
||||
* The currently selected menu item.
|
||||
*
|
||||
* Since: GSEAL-branch
|
||||
**/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ACTIVE,
|
||||
g_param_spec_uint ("active",
|
||||
P_("Active"),
|
||||
P_("The currently selected menu item"),
|
||||
0, G_MAXUINT, 0,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkMenu:accel-group:
|
||||
*
|
||||
* The accel group holding accelerators for the menu.
|
||||
*
|
||||
* Since: GSEAL-branch
|
||||
**/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ACCEL_GROUP,
|
||||
g_param_spec_object ("accel-group",
|
||||
P_("Accel Group"),
|
||||
P_("The accel group holding accelerators for the menu"),
|
||||
GTK_TYPE_ACCEL_GROUP,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkMenu:accel-path:
|
||||
*
|
||||
* An accel path used to conveniently construct accel paths of child items.
|
||||
*
|
||||
* Since: GSEAL-branch
|
||||
**/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ACCEL_PATH,
|
||||
g_param_spec_string ("accel-path",
|
||||
P_("Accel Path"),
|
||||
P_("An accel path used to conveniently construct accel paths of child items"),
|
||||
NULL,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkMenu:attach-widget:
|
||||
*
|
||||
* The widget the menu is attached to.
|
||||
*
|
||||
* Since: GSEAL-branch
|
||||
**/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ACCEL_PATH,
|
||||
g_param_spec_string ("attach-widget",
|
||||
P_("Attach Widget"),
|
||||
P_("The widget the menu is attached to"),
|
||||
NULL,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_TEAROFF_TITLE,
|
||||
g_param_spec_string ("tearoff-title",
|
||||
@ -506,6 +571,21 @@ gtk_menu_class_init (GtkMenuClass *class)
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkMenu:monitor:
|
||||
*
|
||||
* The monitor the menu will be popped up on.
|
||||
*
|
||||
* Since: GSEAL-branch
|
||||
**/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_MONITOR,
|
||||
g_param_spec_int ("monitor",
|
||||
P_("Monitor"),
|
||||
P_("The monitor the menu will be popped up on"),
|
||||
-1, G_MAXINT, -1,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("vertical-padding",
|
||||
P_("Vertical Padding"),
|
||||
@ -702,12 +782,27 @@ gtk_menu_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ACTIVE:
|
||||
gtk_menu_set_active (menu, g_value_get_uint (value));
|
||||
break;
|
||||
case PROP_ACCEL_GROUP:
|
||||
gtk_menu_set_accel_group (menu, g_value_get_object (value));
|
||||
break;
|
||||
case PROP_ACCEL_PATH:
|
||||
gtk_menu_set_accel_path (menu, g_value_get_string (value));
|
||||
break;
|
||||
case PROP_ATTACH_WIDGET:
|
||||
gtk_menu_attach (menu, g_value_get_object (value), 0, 0, 0, 0);
|
||||
break;
|
||||
case PROP_TEAROFF_STATE:
|
||||
gtk_menu_set_tearoff_state (menu, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_TEAROFF_TITLE:
|
||||
gtk_menu_set_title (menu, g_value_get_string (value));
|
||||
break;
|
||||
break;
|
||||
case PROP_MONITOR:
|
||||
gtk_menu_set_monitor (menu, g_value_get_int (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -726,12 +821,27 @@ gtk_menu_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ACTIVE:
|
||||
g_value_set_boolean (value, gtk_menu_get_active (menu));
|
||||
break;
|
||||
case PROP_ACCEL_GROUP:
|
||||
g_value_set_object (value, gtk_menu_get_accel_group (menu));
|
||||
break;
|
||||
case PROP_ACCEL_PATH:
|
||||
g_value_set_string (value, gtk_menu_get_accel_path (menu));
|
||||
break;
|
||||
case PROP_ATTACH_WIDGET:
|
||||
g_value_set_object (value, gtk_menu_get_attach_widget (menu));
|
||||
break;
|
||||
case PROP_TEAROFF_STATE:
|
||||
g_value_set_boolean (value, gtk_menu_get_tearoff_state (menu));
|
||||
break;
|
||||
case PROP_TEAROFF_TITLE:
|
||||
g_value_set_string (value, gtk_menu_get_title (menu));
|
||||
break;
|
||||
case PROP_MONITOR:
|
||||
g_value_set_int (value, gtk_menu_get_monitor (menu));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -1655,6 +1765,22 @@ gtk_menu_set_accel_path (GtkMenu *menu,
|
||||
_gtk_menu_refresh_accel_paths (menu, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_get_accel_path
|
||||
* @menu: a valid #GtkMenu
|
||||
*
|
||||
* Retrieves the accelerator path set on the menu.
|
||||
*
|
||||
* Since: GSEAL-branch
|
||||
*/
|
||||
const gchar*
|
||||
gtk_menu_get_accel_path (GtkMenu *menu)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_MENU (menu));
|
||||
|
||||
return menu->accel_path;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GtkMenu *menu;
|
||||
gboolean group_changed;
|
||||
@ -4919,6 +5045,28 @@ gtk_menu_set_monitor (GtkMenu *menu,
|
||||
priv->monitor_num = monitor_num;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_get_monitor:
|
||||
* @menu: a #GtkMenu
|
||||
*
|
||||
* Retrieves the number of the monitor on which to show the menu.
|
||||
*
|
||||
* Since: GSEAL-branch
|
||||
*
|
||||
* Returns: the number of the monitor on which the menu should
|
||||
* be popped up or -1
|
||||
**/
|
||||
gint
|
||||
gtk_menu_get_monitor (GtkMenu *menu)
|
||||
{
|
||||
GtkMenuPrivate *priv;
|
||||
g_return_if_fail (GTK_IS_MENU (menu));
|
||||
|
||||
priv = gtk_menu_get_private (menu);
|
||||
|
||||
return priv->monitor_num;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_menu_get_for_attach_widget:
|
||||
* @widget: a #GtkWidget
|
||||
|
@ -60,55 +60,55 @@ typedef void (*GtkMenuDetachFunc) (GtkWidget *attach_widget,
|
||||
|
||||
struct _GtkMenu
|
||||
{
|
||||
GtkMenuShell menu_shell;
|
||||
GtkMenuShell GSEAL (menu_shell);
|
||||
|
||||
GtkWidget *parent_menu_item;
|
||||
GtkWidget *old_active_menu_item;
|
||||
GtkWidget *GSEAL (parent_menu_item);
|
||||
GtkWidget *GSEAL (old_active_menu_item);
|
||||
|
||||
GtkAccelGroup *accel_group;
|
||||
gchar *accel_path;
|
||||
GtkMenuPositionFunc position_func;
|
||||
gpointer position_func_data;
|
||||
GtkAccelGroup *GSEAL (accel_group);
|
||||
gchar *GSEAL (accel_path);
|
||||
GtkMenuPositionFunc GSEAL (position_func);
|
||||
gpointer GSEAL (position_func_data);
|
||||
|
||||
guint toggle_size;
|
||||
guint GSEAL (toggle_size);
|
||||
/* Do _not_ touch these widgets directly. We hide the reference
|
||||
* count from the toplevel to the menu, so it must be restored
|
||||
* before operating on these widgets
|
||||
*/
|
||||
GtkWidget *toplevel;
|
||||
GtkWidget *GSEAL (toplevel);
|
||||
|
||||
GtkWidget *tearoff_window;
|
||||
GtkWidget *tearoff_hbox;
|
||||
GtkWidget *tearoff_scrollbar;
|
||||
GtkAdjustment *tearoff_adjustment;
|
||||
GtkWidget *GSEAL (tearoff_window);
|
||||
GtkWidget *GSEAL (tearoff_hbox);
|
||||
GtkWidget *GSEAL (tearoff_scrollbar);
|
||||
GtkAdjustment *GSEAL (tearoff_adjustment);
|
||||
|
||||
GdkWindow *view_window;
|
||||
GdkWindow *bin_window;
|
||||
GdkWindow *GSEAL (view_window);
|
||||
GdkWindow *GSEAL (bin_window);
|
||||
|
||||
gint scroll_offset;
|
||||
gint saved_scroll_offset;
|
||||
gint scroll_step;
|
||||
guint timeout_id;
|
||||
gint GSEAL (scroll_offset);
|
||||
gint GSEAL (saved_scroll_offset);
|
||||
gint GSEAL (scroll_step);
|
||||
guint GSEAL (timeout_id);
|
||||
|
||||
/* When a submenu of this menu is popped up, motion in this
|
||||
* region is ignored
|
||||
*/
|
||||
GdkRegion *navigation_region;
|
||||
guint navigation_timeout;
|
||||
GdkRegion *GSEAL (navigation_region);
|
||||
guint GSEAL (navigation_timeout);
|
||||
|
||||
guint needs_destruction_ref_count : 1;
|
||||
guint torn_off : 1;
|
||||
guint GSEAL (needs_destruction_ref_count : 1);
|
||||
guint GSEAL (torn_off : 1);
|
||||
/* The tearoff is active when it is torn off and the not-torn-off
|
||||
* menu is not popped up.
|
||||
*/
|
||||
guint tearoff_active : 1;
|
||||
guint GSEAL (tearoff_active : 1);
|
||||
|
||||
guint scroll_fast : 1;
|
||||
guint GSEAL (scroll_fast : 1);
|
||||
|
||||
guint upper_arrow_visible : 1;
|
||||
guint lower_arrow_visible : 1;
|
||||
guint upper_arrow_prelight : 1;
|
||||
guint lower_arrow_prelight : 1;
|
||||
guint GSEAL (upper_arrow_visible : 1);
|
||||
guint GSEAL (lower_arrow_visible : 1);
|
||||
guint GSEAL (upper_arrow_prelight : 1);
|
||||
guint GSEAL (lower_arrow_prelight : 1);
|
||||
};
|
||||
|
||||
struct _GtkMenuClass
|
||||
@ -157,6 +157,7 @@ void gtk_menu_set_accel_group (GtkMenu *menu,
|
||||
GtkAccelGroup* gtk_menu_get_accel_group (GtkMenu *menu);
|
||||
void gtk_menu_set_accel_path (GtkMenu *menu,
|
||||
const gchar *accel_path);
|
||||
const gchar* gtk_menu_get_accel_path (GtkMenu *menu);
|
||||
|
||||
/* A reference count is kept for a widget when it is attached to
|
||||
* a particular widget. This is typically a menu item; it may also
|
||||
@ -200,6 +201,7 @@ void gtk_menu_attach (GtkMenu *menu,
|
||||
|
||||
void gtk_menu_set_monitor (GtkMenu *menu,
|
||||
gint monitor_num);
|
||||
gint gtk_menu_get_monitor (GtkMenu *menu);
|
||||
GList* gtk_menu_get_for_attach_widget (GtkWidget *widget);
|
||||
|
||||
#ifndef GTK_DISABLE_DEPRECATED
|
||||
|
Loading…
Reference in New Issue
Block a user