Commit c5b020e6 authored by Matthias Clasen's avatar Matthias Clasen

Remove sealed members from GtkMenu

parent 65652d81
......@@ -152,7 +152,6 @@ gtk_public_h_sources = \
gtkaccessible.h \
gtkaction.h \
gtkactiongroup.h \
gtkaccelgroupprivate.h \
gtkactivatable.h \
gtkadjustment.h \
gtkalignment.h \
......@@ -379,6 +378,7 @@ endif
# GTK+ header files that don't get installed
gtk_private_h_sources = \
gtk9slice.h \
gtkaccelgroupprivate.h \
gtkbuttonprivate.h \
gtkquery.h \
gtksearchengine.h \
......
......@@ -30,7 +30,7 @@
#include "gtkhbox.h"
#include "gtkliststore.h"
#include "gtkmain.h"
#include "gtkmenu.h"
#include "gtkmenuprivate.h"
#include "gtkscrolledwindow.h"
#include "gtkseparatormenuitem.h"
#include "gtktearoffmenuitem.h"
......@@ -1641,10 +1641,10 @@ gtk_combo_box_detacher (GtkWidget *widget,
g_return_if_fail (priv->popup_widget == (GtkWidget *) menu);
g_signal_handlers_disconnect_by_func (menu->toplevel,
g_signal_handlers_disconnect_by_func (menu->priv->toplevel,
gtk_combo_box_menu_show,
combo_box);
g_signal_handlers_disconnect_by_func (menu->toplevel,
g_signal_handlers_disconnect_by_func (menu->priv->toplevel,
gtk_combo_box_menu_hide,
combo_box);
......@@ -1672,6 +1672,8 @@ gtk_combo_box_set_popup_widget (GtkComboBox *combo_box,
if (GTK_IS_MENU (popup))
{
GtkMenu *menu = GTK_MENU (popup);
if (priv->popup_window)
{
gtk_widget_destroy (priv->popup_window);
......@@ -1680,26 +1682,23 @@ gtk_combo_box_set_popup_widget (GtkComboBox *combo_box,
priv->popup_widget = popup;
/*
* Note that we connect to show/hide on the toplevel, not the
/* Note that we connect to show/hide on the toplevel, not the
* menu itself, since the menu is not shown/hidden when it is
* popped up while torn-off.
*/
g_signal_connect (GTK_MENU (popup)->toplevel, "show",
g_signal_connect (menu->priv->toplevel, "show",
G_CALLBACK (gtk_combo_box_menu_show), combo_box);
g_signal_connect (GTK_MENU (popup)->toplevel, "hide",
g_signal_connect (menu->priv->toplevel, "hide",
G_CALLBACK (gtk_combo_box_menu_hide), combo_box);
gtk_menu_attach_to_widget (GTK_MENU (popup),
GTK_WIDGET (combo_box),
gtk_combo_box_detacher);
gtk_menu_attach_to_widget (menu, GTK_WIDGET (combo_box), gtk_combo_box_detacher);
}
else
{
if (!priv->popup_window)
{
GtkWidget *toplevel;
priv->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_set_name (priv->popup_window, "gtk-combobox-popup-window");
......@@ -1932,21 +1931,21 @@ gtk_combo_box_menu_position (GtkMenu *menu,
/* FIXME handle nested menus better */
menu_item = gtk_menu_get_active (GTK_MENU (priv->popup_widget));
if (menu_item)
gtk_menu_shell_select_item (GTK_MENU_SHELL (priv->popup_widget),
gtk_menu_shell_select_item (GTK_MENU_SHELL (priv->popup_widget),
menu_item);
gtk_combo_box_menu_position_over (menu, x, y, push_in, user_data);
}
if (!gtk_widget_get_visible (GTK_MENU (priv->popup_widget)->toplevel))
gtk_window_set_type_hint (GTK_WINDOW (GTK_MENU (priv->popup_widget)->toplevel),
if (!gtk_widget_get_visible (GTK_MENU (priv->popup_widget)->priv->toplevel))
gtk_window_set_type_hint (GTK_WINDOW (GTK_MENU (priv->popup_widget)->priv->toplevel),
GDK_WINDOW_TYPE_HINT_COMBO);
}
static void
gtk_combo_box_list_position (GtkComboBox *combo_box,
gint *x,
gint *y,
gtk_combo_box_list_position (GtkComboBox *combo_box,
gint *x,
gint *y,
gint *width,
gint *height)
{
......
This diff is collapsed.
......@@ -46,8 +46,9 @@ G_BEGIN_DECLS
#define GTK_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU, GtkMenuClass))
typedef struct _GtkMenu GtkMenu;
typedef struct _GtkMenuClass GtkMenuClass;
typedef struct _GtkMenu GtkMenu;
typedef struct _GtkMenuClass GtkMenuClass;
typedef struct _GtkMenuPrivate GtkMenuPrivate;
typedef void (*GtkMenuPositionFunc) (GtkMenu *menu,
gint *x,
......@@ -59,55 +60,10 @@ typedef void (*GtkMenuDetachFunc) (GtkWidget *attach_widget,
struct _GtkMenu
{
GtkMenuShell GSEAL (menu_shell);
GtkWidget *GSEAL (parent_menu_item);
GtkWidget *GSEAL (old_active_menu_item);
GtkAccelGroup *GSEAL (accel_group);
gchar *GSEAL (accel_path);
GtkMenuPositionFunc GSEAL (position_func);
gpointer GSEAL (position_func_data);
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 *GSEAL (toplevel);
GtkWidget *GSEAL (tearoff_window);
GtkWidget *GSEAL (tearoff_hbox);
GtkWidget *GSEAL (tearoff_scrollbar);
GtkAdjustment *GSEAL (tearoff_adjustment);
GdkWindow *GSEAL (view_window);
GdkWindow *GSEAL (bin_window);
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
*/
cairo_region_t *GSEAL (navigation_region); /* unused */
guint GSEAL (navigation_timeout);
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 GSEAL (tearoff_active) : 1;
guint GSEAL (scroll_fast) : 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;
GtkMenuShell menu_shell;
/*< private >*/
GtkMenuPrivate *priv;
};
struct _GtkMenuClass
......
......@@ -30,7 +30,7 @@
#include "gtkaccellabel.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkmenu.h"
#include "gtkmenuprivate.h"
#include "gtkmenubar.h"
#include "gtkmenuprivate.h"
#include "gtkseparatormenuitem.h"
......@@ -1253,8 +1253,8 @@ gtk_menu_item_select (GtkMenuItem *menu_item)
{
GtkMenu *menu = GTK_MENU (parent);
if (menu->parent_menu_item)
gtk_widget_queue_draw (GTK_WIDGET (menu->parent_menu_item));
if (menu->priv->parent_menu_item)
gtk_widget_queue_draw (GTK_WIDGET (menu->priv->parent_menu_item));
}
}
......@@ -1275,8 +1275,8 @@ gtk_menu_item_deselect (GtkMenuItem *menu_item)
{
GtkMenu *menu = GTK_MENU (parent);
if (menu->parent_menu_item)
gtk_widget_queue_draw (GTK_WIDGET (menu->parent_menu_item));
if (menu->priv->parent_menu_item)
gtk_widget_queue_draw (GTK_WIDGET (menu->priv->parent_menu_item));
}
}
......@@ -1621,7 +1621,7 @@ gtk_real_menu_item_select (GtkMenuItem *menu_item)
if (!touchscreen_mode &&
menu_item->submenu &&
(!gtk_widget_get_mapped (menu_item->submenu) ||
GTK_MENU (menu_item->submenu)->tearoff_active))
GTK_MENU (menu_item->submenu)->priv->tearoff_active))
{
_gtk_menu_item_popup_submenu (GTK_WIDGET (menu_item), TRUE);
}
......@@ -1836,8 +1836,8 @@ gtk_menu_item_popup_timeout (gpointer data)
parent = gtk_widget_get_parent (GTK_WIDGET (menu_item));
if ((GTK_IS_MENU_SHELL (parent) && GTK_MENU_SHELL (parent)->active) ||
(GTK_IS_MENU (parent) && GTK_MENU (parent)->torn_off))
if ((GTK_IS_MENU_SHELL (parent) && GTK_MENU_SHELL (parent)->active) ||
(GTK_IS_MENU (parent) && GTK_MENU (parent)->priv->torn_off))
{
gtk_menu_item_real_popup_submenu (GTK_WIDGET (menu_item), TRUE);
if (menu_item->timer_from_keypress && menu_item->submenu)
......@@ -2027,8 +2027,8 @@ gtk_menu_item_position_menu (GtkMenu *menu,
}
else if (GTK_IS_MENU (parent))
{
if (GTK_MENU (parent)->parent_menu_item)
menu_item->from_menubar = GTK_MENU_ITEM (GTK_MENU (parent)->parent_menu_item)->from_menubar;
if (GTK_MENU (parent)->priv->parent_menu_item)
menu_item->from_menubar = GTK_MENU_ITEM (GTK_MENU (parent)->priv->parent_menu_item)->from_menubar;
else
menu_item->from_menubar = FALSE;
}
......@@ -2059,13 +2059,13 @@ gtk_menu_item_position_menu (GtkMenu *menu,
case GTK_LEFT_RIGHT:
if (GTK_IS_MENU (parent))
parent_menu_item = GTK_MENU_ITEM (GTK_MENU (parent)->parent_menu_item);
parent_menu_item = GTK_MENU_ITEM (GTK_MENU (parent)->priv->parent_menu_item);
else
parent_menu_item = NULL;
parent_xthickness = gtk_widget_get_style (parent)->xthickness;
if (parent_menu_item && !GTK_MENU (parent)->torn_off)
if (parent_menu_item && !GTK_MENU (parent)->priv->torn_off)
{
menu_item->submenu_direction = parent_menu_item->submenu_direction;
}
......@@ -2117,9 +2117,9 @@ gtk_menu_item_position_menu (GtkMenu *menu,
gtk_menu_set_monitor (menu, monitor_num);
if (!gtk_widget_get_visible (menu->toplevel))
if (!gtk_widget_get_visible (menu->priv->toplevel))
{
gtk_window_set_type_hint (GTK_WINDOW (menu->toplevel), menu_item->from_menubar?
gtk_window_set_type_hint (GTK_WINDOW (menu->priv->toplevel), menu_item->from_menubar?
GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU : GDK_WINDOW_TYPE_HINT_POPUP_MENU);
}
}
......@@ -2233,8 +2233,8 @@ gtk_menu_item_parent_set (GtkWidget *widget,
if (menu)
_gtk_menu_item_refresh_accel_path (menu_item,
menu->accel_path,
menu->accel_group,
menu->priv->accel_path,
menu->priv->accel_group,
TRUE);
if (GTK_WIDGET_CLASS (gtk_menu_item_parent_class)->parent_set)
......@@ -2338,10 +2338,10 @@ gtk_menu_item_set_accel_path (GtkMenuItem *menu_item,
{
GtkMenu *menu = GTK_MENU (parent);
if (menu->accel_group)
if (menu->priv->accel_group)
_gtk_menu_item_refresh_accel_path (GTK_MENU_ITEM (widget),
NULL,
menu->accel_group,
menu->priv->accel_group,
FALSE);
}
}
......
......@@ -26,6 +26,10 @@
#ifndef __GTK_MENU_PRIVATE_H__
#define __GTK_MENU_PRIVATE_H__
#include <gtk/gtkmenu.h>
G_BEGIN_DECLS
/* Directions for submenus */
typedef enum
{
......@@ -41,4 +45,89 @@ typedef enum
} GtkSubmenuPlacement;
struct _GtkMenuPrivate
{
GtkWidget *parent_menu_item;
GtkWidget *old_active_menu_item;
GtkAccelGroup *accel_group;
gchar *accel_path;
GtkMenuPositionFunc position_func;
gpointer position_func_data;
GDestroyNotify position_func_data_destroy;
gint position_x;
gint position_y;
guint toggle_size;
guint accel_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 *tearoff_window;
GtkWidget *tearoff_hbox;
GtkWidget *tearoff_scrollbar;
GtkAdjustment *tearoff_adjustment;
GdkWindow *view_window;
GdkWindow *bin_window;
gint scroll_offset;
gint saved_scroll_offset;
gint scroll_step;
guint scroll_timeout;
guint needs_destruction_ref : 1;
guint 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 scroll_fast : 1;
guint upper_arrow_visible : 1;
guint lower_arrow_visible : 1;
guint upper_arrow_prelight : 1;
guint lower_arrow_prelight : 1;
guint have_position : 1;
guint have_layout : 1;
guint seen_item_enter : 1;
guint ignore_button_release : 1;
guint no_toggle_size : 1;
/* info used for the table */
guint *heights;
gint heights_length;
gint requested_height;
gboolean initially_pushed_in;
gint monitor_num;
/* Cached layout information */
gint n_rows;
gint n_columns;
gchar *title;
/* Arrow states */
GtkStateFlags lower_arrow_state;
GtkStateFlags upper_arrow_state;
/* navigation region */
gint navigation_x;
gint navigation_y;
gint navigation_width;
gint navigation_height;
guint navigation_timeout;
};
G_END_DECLS
#endif /* __GTK_MENU_PRIVATE_H__ */
......@@ -31,7 +31,7 @@
#include "gtklabel.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkmenu.h"
#include "gtkmenuprivate.h"
#include "gtkmenubar.h"
#include "gtkmenuitem.h"
#include "gtkmenushell.h"
......@@ -1530,7 +1530,7 @@ gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
if (touchscreen_mode)
{
/* close menu when returning from submenu. */
_gtk_menu_item_popdown_submenu (GTK_MENU (menu_shell)->parent_menu_item);
_gtk_menu_item_popdown_submenu (GTK_MENU (menu_shell)->priv->parent_menu_item);
_gtk_menu_shell_update_mnemonics (parent_menu_shell);
break;
}
......
......@@ -26,7 +26,7 @@
#include "config.h"
#include "gtkmenu.h"
#include "gtkmenuprivate.h"
#include "gtktearoffmenuitem.h"
#include "gtkintl.h"
......@@ -120,7 +120,7 @@ gtk_tearoff_menu_item_get_preferred_height (GtkWidget *widget,
*minimum = *natural = (border_width + style->ythickness) * 2;
parent = gtk_widget_get_parent (widget);
if (GTK_IS_MENU (parent) && GTK_MENU (parent)->torn_off)
if (GTK_IS_MENU (parent) && GTK_MENU (parent)->priv->torn_off)
{
*minimum += ARROW_SIZE;
*natural += ARROW_SIZE;
......@@ -177,7 +177,7 @@ gtk_tearoff_menu_item_draw (GtkWidget *widget,
}
parent = gtk_widget_get_parent (widget);
if (GTK_IS_MENU (parent) && GTK_MENU (parent)->torn_off)
if (GTK_IS_MENU (parent) && GTK_MENU (parent)->priv->torn_off)
{
gint arrow_x;
......@@ -254,7 +254,7 @@ gtk_tearoff_menu_item_activate (GtkMenuItem *menu_item)
gtk_widget_queue_resize (GTK_WIDGET (menu_item));
gtk_menu_set_tearoff_state (GTK_MENU (parent),
!menu->torn_off);
!menu->priv->torn_off);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment