Commit 2ed81aa5 authored by Matthias Clasen's avatar Matthias Clasen

Remove sealed members from GtkMenuShell

parent c5b020e6
......@@ -400,6 +400,7 @@ gtk_private_h_sources = \
gtkintl.h \
gtkkeyhash.h \
gtkmenuprivate.h \
gtkmenushellprivate.h \
gtkmnemonichash.h \
gtkmodifierstyle.h \
gtkmountoperationprivate.h \
......
......@@ -31,6 +31,7 @@
#include "gtkliststore.h"
#include "gtkmain.h"
#include "gtkmenuprivate.h"
#include "gtkmenushellprivate.h"
#include "gtkscrolledwindow.h"
#include "gtkseparatormenuitem.h"
#include "gtktearoffmenuitem.h"
......@@ -1874,7 +1875,7 @@ gtk_combo_box_menu_position_over (GtkMenu *menu,
menu_ypos -= child_allocation.height / 2;
}
children = GTK_MENU_SHELL (combo_box->priv->popup_widget)->children;
children = GTK_MENU_SHELL (combo_box->priv->popup_widget)->priv->children;
while (children)
{
child = children->data;
......@@ -1924,15 +1925,15 @@ gtk_combo_box_menu_position (GtkMenu *menu,
GtkComboBoxPrivate *priv = combo_box->priv;
GtkWidget *menu_item;
if (priv->wrap_width > 0 || priv->cell_view == NULL)
if (priv->wrap_width > 0 || priv->cell_view == NULL)
gtk_combo_box_menu_position_below (menu, x, y, push_in, user_data);
else
{
/* 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),
menu_item);
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);
}
......@@ -3189,13 +3190,13 @@ gtk_combo_box_menu_fill (GtkComboBox *combo_box)
GtkWidget *tearoff = gtk_tearoff_menu_item_new ();
gtk_widget_show (tearoff);
if (priv->wrap_width)
gtk_menu_attach (GTK_MENU (menu), tearoff, 0, priv->wrap_width, 0, 1);
gtk_menu_attach (GTK_MENU (menu), tearoff, 0, priv->wrap_width, 0, 1);
else
gtk_menu_shell_append (GTK_MENU_SHELL (menu), tearoff);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), tearoff);
}
gtk_combo_box_menu_fill_level (combo_box, menu, NULL);
}
......@@ -3342,11 +3343,11 @@ menu_occupied (GtkMenu *menu,
{
GList *i;
for (i = GTK_MENU_SHELL (menu)->children; i; i = i->next)
for (i = GTK_MENU_SHELL (menu)->priv->children; i; i = i->next)
{
guint l, r, b, t;
gtk_container_child_get (GTK_CONTAINER (menu),
gtk_container_child_get (GTK_CONTAINER (menu),
i->data,
"left-attach", &l,
"right-attach", &r,
......@@ -3375,12 +3376,12 @@ gtk_combo_box_relayout_item (GtkComboBox *combo_box,
if (!GTK_IS_MENU_SHELL (menu))
return;
if (priv->col_column == -1 &&
priv->row_column == -1 &&
last)
{
gtk_container_child_get (GTK_CONTAINER (menu),
gtk_container_child_get (GTK_CONTAINER (menu),
last,
"right-attach", &current_col,
"top-attach", &current_row,
......
......@@ -42,6 +42,7 @@
#include "gtkseparatormenuitem.h"
#include "gtktextutil.h"
#include "gtkmenuitem.h"
#include "gtkmenushellprivate.h"
#include "gtknotebook.h"
#include "gtkstock.h"
#include "gtkbindings.h"
......
This diff is collapsed.
......@@ -34,6 +34,7 @@
#include "gtkmarshalers.h"
#include "gtkmenuitem.h"
#include "gtkmenuprivate.h"
#include "gtkmenushellprivate.h"
#include "gtksettings.h"
#include "gtksizerequest.h"
#include "gtkwindow.h"
......@@ -301,7 +302,7 @@ gtk_menu_bar_size_request (GtkWidget *widget,
priv = menu_bar->priv;
nchildren = 0;
children = menu_shell->children;
children = menu_shell->priv->children;
while (children)
{
......@@ -425,7 +426,7 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
if (menu_shell->children)
if (menu_shell->priv->children)
{
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_bar));
child_allocation.x = (border_width +
......@@ -454,15 +455,15 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
priv->pack_direction == GTK_PACK_DIRECTION_RTL)
{
child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2);
offset = child_allocation.x; /* Window edge to menubar start */
ltr_x = child_allocation.x;
children = menu_shell->children;
while (children)
{
gint toggle_size;
offset = child_allocation.x; /* Window edge to menubar start */
ltr_x = child_allocation.x;
children = menu_shell->priv->children;
while (children)
{
gint toggle_size;
child = children->data;
children = children->next;
......@@ -504,15 +505,15 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
else
{
child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2);
offset = child_allocation.y; /* Window edge to menubar start */
ltr_y = child_allocation.y;
children = menu_shell->children;
while (children)
{
gint toggle_size;
offset = child_allocation.y; /* Window edge to menubar start */
ltr_y = child_allocation.y;
children = menu_shell->priv->children;
while (children)
{
gint toggle_size;
child = children->data;
children = children->next;
......@@ -766,8 +767,8 @@ _gtk_menu_bar_cycle_focus (GtkMenuBar *menubar,
if (current && current->next)
{
GtkMenuShell *new_menushell = GTK_MENU_SHELL (current->next->data);
if (new_menushell->children)
to_activate = new_menushell->children->data;
if (new_menushell->priv->children)
to_activate = new_menushell->priv->children->data;
}
}
......@@ -912,7 +913,7 @@ gtk_menu_bar_set_pack_direction (GtkMenuBar *menubar,
gtk_widget_queue_resize (GTK_WIDGET (menubar));
for (l = GTK_MENU_SHELL (menubar)->children; l; l = l->next)
for (l = GTK_MENU_SHELL (menubar)->priv->children; l; l = l->next)
gtk_widget_queue_resize (GTK_WIDGET (l->data));
g_object_notify (G_OBJECT (menubar), "pack-direction");
......@@ -965,7 +966,7 @@ gtk_menu_bar_set_child_pack_direction (GtkMenuBar *menubar,
gtk_widget_queue_resize (GTK_WIDGET (menubar));
for (l = GTK_MENU_SHELL (menubar)->children; l; l = l->next)
for (l = GTK_MENU_SHELL (menubar)->priv->children; l; l = l->next)
gtk_widget_queue_resize (GTK_WIDGET (l->data));
g_object_notify (G_OBJECT (menubar), "child-pack-direction");
......
......@@ -31,6 +31,7 @@
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkmenuprivate.h"
#include "gtkmenushellprivate.h"
#include "gtkmenubar.h"
#include "gtkmenuprivate.h"
#include "gtkseparatormenuitem.h"
......@@ -1656,7 +1657,7 @@ gtk_menu_item_mnemonic_activate (GtkWidget *widget,
if (group_cycling &&
parent &&
GTK_IS_MENU_SHELL (parent) &&
GTK_MENU_SHELL (parent)->active)
GTK_MENU_SHELL (parent)->priv->active)
{
gtk_menu_shell_select_item (GTK_MENU_SHELL (parent),
widget);
......@@ -1816,7 +1817,7 @@ gtk_menu_item_real_popup_submenu (GtkWidget *widget,
widget,
menu_position_func,
menu_item,
GTK_MENU_SHELL (parent)->button,
GTK_MENU_SHELL (parent)->priv->button,
0);
}
......@@ -1836,12 +1837,12 @@ 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) ||
if ((GTK_IS_MENU_SHELL (parent) && GTK_MENU_SHELL (parent)->priv->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)
GTK_MENU_SHELL (menu_item->submenu)->ignore_enter = TRUE;
GTK_MENU_SHELL (menu_item->submenu)->priv->ignore_enter = TRUE;
}
menu_item->timer = 0;
......
This diff is collapsed.
......@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
......@@ -37,59 +37,48 @@
G_BEGIN_DECLS
#define GTK_TYPE_MENU_SHELL (gtk_menu_shell_get_type ())
#define GTK_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShell))
#define GTK_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_SHELL, GtkMenuShellClass))
#define GTK_IS_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_SHELL))
#define GTK_IS_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_SHELL))
#define GTK_TYPE_MENU_SHELL (gtk_menu_shell_get_type ())
#define GTK_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShell))
#define GTK_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_SHELL, GtkMenuShellClass))
#define GTK_IS_MENU_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_SHELL))
#define GTK_IS_MENU_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_MENU_SHELL))
#define GTK_MENU_SHELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_MENU_SHELL, GtkMenuShellClass))
typedef struct _GtkMenuShell GtkMenuShell;
typedef struct _GtkMenuShellClass GtkMenuShellClass;
typedef struct _GtkMenuShell GtkMenuShell;
typedef struct _GtkMenuShellClass GtkMenuShellClass;
typedef struct _GtkMenuShellPrivate GtkMenuShellPrivate;
struct _GtkMenuShell
{
GtkContainer container;
GList *GSEAL (children);
GtkWidget *GSEAL (active_menu_item);
GtkWidget *GSEAL (parent_menu_shell);
guint GSEAL (button);
guint32 GSEAL (activate_time);
guint GSEAL (active) : 1;
guint GSEAL (have_grab) : 1;
guint GSEAL (have_xgrab) : 1;
guint GSEAL (ignore_leave) : 1; /* unused */
guint GSEAL (menu_flag) : 1; /* unused */
guint GSEAL (ignore_enter) : 1;
guint GSEAL (keyboard_mode) : 1;
/*< private >*/
GtkMenuShellPrivate *priv;
};
struct _GtkMenuShellClass
{
GtkContainerClass parent_class;
guint submenu_placement : 1;
void (*deactivate) (GtkMenuShell *menu_shell);
void (*selection_done) (GtkMenuShell *menu_shell);
void (*move_current) (GtkMenuShell *menu_shell,
GtkMenuDirectionType direction);
void (*activate_current) (GtkMenuShell *menu_shell,
gboolean force_hide);
void (*cancel) (GtkMenuShell *menu_shell);
void (*select_item) (GtkMenuShell *menu_shell,
GtkWidget *menu_item);
void (*insert) (GtkMenuShell *menu_shell,
GtkWidget *child,
gint position);
gint (*get_popup_delay) (GtkMenuShell *menu_shell);
gboolean (*move_selected) (GtkMenuShell *menu_shell,
gint distance);
void (*deactivate) (GtkMenuShell *menu_shell);
void (*selection_done) (GtkMenuShell *menu_shell);
void (*move_current) (GtkMenuShell *menu_shell,
GtkMenuDirectionType direction);
void (*activate_current) (GtkMenuShell *menu_shell,
gboolean force_hide);
void (*cancel) (GtkMenuShell *menu_shell);
void (*select_item) (GtkMenuShell *menu_shell,
GtkWidget *menu_item);
void (*insert) (GtkMenuShell *menu_shell,
GtkWidget *child,
gint position);
gint (*get_popup_delay) (GtkMenuShell *menu_shell);
gboolean (*move_selected) (GtkMenuShell *menu_shell,
gint distance);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
......@@ -99,50 +88,29 @@ struct _GtkMenuShellClass
};
GType gtk_menu_shell_get_type (void) G_GNUC_CONST;
void gtk_menu_shell_append (GtkMenuShell *menu_shell,
GtkWidget *child);
void gtk_menu_shell_prepend (GtkMenuShell *menu_shell,
GtkWidget *child);
void gtk_menu_shell_insert (GtkMenuShell *menu_shell,
GtkWidget *child,
gint position);
void gtk_menu_shell_deactivate (GtkMenuShell *menu_shell);
void gtk_menu_shell_select_item (GtkMenuShell *menu_shell,
GtkWidget *menu_item);
void gtk_menu_shell_deselect (GtkMenuShell *menu_shell);
void gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
GtkWidget *menu_item,
gboolean force_deactivate);
void gtk_menu_shell_select_first (GtkMenuShell *menu_shell,
gboolean search_sensitive);
void _gtk_menu_shell_select_last (GtkMenuShell *menu_shell,
gboolean search_sensitive);
void _gtk_menu_shell_activate (GtkMenuShell *menu_shell);
gint _gtk_menu_shell_get_popup_delay (GtkMenuShell *menu_shell);
void _gtk_menu_shell_set_grab_device (GtkMenuShell *menu_shell,
GdkDevice *device);
GdkDevice * _gtk_menu_shell_get_grab_device (GtkMenuShell *menu_shell);
void gtk_menu_shell_cancel (GtkMenuShell *menu_shell);
void _gtk_menu_shell_add_mnemonic (GtkMenuShell *menu_shell,
guint keyval,
GtkWidget *target);
void _gtk_menu_shell_remove_mnemonic (GtkMenuShell *menu_shell,
guint keyval,
GtkWidget *target);
GType gtk_menu_shell_get_type (void) G_GNUC_CONST;
void gtk_menu_shell_append (GtkMenuShell *menu_shell,
GtkWidget *child);
void gtk_menu_shell_prepend (GtkMenuShell *menu_shell,
GtkWidget *child);
void gtk_menu_shell_insert (GtkMenuShell *menu_shell,
GtkWidget *child,
gint position);
void gtk_menu_shell_deactivate (GtkMenuShell *menu_shell);
void gtk_menu_shell_select_item (GtkMenuShell *menu_shell,
GtkWidget *menu_item);
void gtk_menu_shell_deselect (GtkMenuShell *menu_shell);
void gtk_menu_shell_activate_item (GtkMenuShell *menu_shell,
GtkWidget *menu_item,
gboolean force_deactivate);
void gtk_menu_shell_select_first (GtkMenuShell *menu_shell,
gboolean search_sensitive);
void gtk_menu_shell_cancel (GtkMenuShell *menu_shell);
gboolean gtk_menu_shell_get_take_focus (GtkMenuShell *menu_shell);
void gtk_menu_shell_set_take_focus (GtkMenuShell *menu_shell,
gboolean take_focus);
void _gtk_menu_shell_update_mnemonics (GtkMenuShell *menu_shell);
void _gtk_menu_shell_set_keyboard_mode (GtkMenuShell *menu_shell,
gboolean keyboard_mode);
gboolean _gtk_menu_shell_get_keyboard_mode (GtkMenuShell *menu_shell);
G_END_DECLS
#endif /* __GTK_MENU_SHELL_H__ */
/* GTK - The GIMP Toolkit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GTK_MENU_SHELL_PRIVATE_H__
#define __GTK_MENU_SHELL_PRIVATE_H__
#include <gtk/gtkmenushell.h>
#include <gtk/gtkmnemonichash.h>
#include <gtk/gtkkeyhash.h>
G_BEGIN_DECLS
struct _GtkMenuShellPrivate
{
GList *children;
GtkWidget *active_menu_item;
GtkWidget *parent_menu_shell;
guint button;
guint32 activate_time;
guint active : 1;
guint have_grab : 1;
guint have_xgrab : 1;
guint ignore_enter : 1;
guint keyboard_mode : 1;
guint take_focus : 1;
guint activated_submenu : 1;
guint in_unselectable_item : 1; /* This flag is a crutch to keep
* mnemonics in the same menu if
* the user moves the mouse over
* an unselectable menuitem.
*/
GtkMnemonicHash *mnemonic_hash;
GtkKeyHash *key_hash;
GdkDevice *grab_pointer;
};
void _gtk_menu_shell_select_last (GtkMenuShell *menu_shell,
gboolean search_sensitive);
void _gtk_menu_shell_activate (GtkMenuShell *menu_shell);
gint _gtk_menu_shell_get_popup_delay (GtkMenuShell *menu_shell);
void _gtk_menu_shell_set_grab_device (GtkMenuShell *menu_shell,
GdkDevice *device);
GdkDevice *_gtk_menu_shell_get_grab_device (GtkMenuShell *menu_shell);
void _gtk_menu_shell_add_mnemonic (GtkMenuShell *menu_shell,
guint keyval,
GtkWidget *target);
void _gtk_menu_shell_remove_mnemonic (GtkMenuShell *menu_shell,
guint keyval,
GtkWidget *target);
void _gtk_menu_shell_update_mnemonics (GtkMenuShell *menu_shell);
void _gtk_menu_shell_set_keyboard_mode (GtkMenuShell *menu_shell,
gboolean keyboard_mode);
gboolean _gtk_menu_shell_get_keyboard_mode (GtkMenuShell *menu_shell);
G_END_DECLS
#endif /* __GTK_MENU_SHELL_PRIVATE_H__ */
......@@ -38,6 +38,7 @@
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtkmenu.h"
#include "gtkmenushellprivate.h"
#include "gtkmenubar.h"
#include "gtkmenutoolbutton.h"
#include "gtkseparatormenuitem.h"
......@@ -1955,9 +1956,9 @@ get_action_by_name (GtkUIManager *merge,
}
static gboolean
find_menu_position (GNode *node,
GtkWidget **menushell_p,
gint *pos_p)
find_menu_position (GNode *node,
GtkWidget **menushell_p,
gint *pos_p)
{
GtkWidget *menushell;
gint pos = 0;
......@@ -1998,7 +1999,7 @@ find_menu_position (GNode *node,
case NODE_TYPE_MENU_PLACEHOLDER:
menushell = gtk_widget_get_parent (NODE_INFO (parent)->proxy);
g_return_val_if_fail (GTK_IS_MENU_SHELL (menushell), FALSE);
pos = g_list_index (GTK_MENU_SHELL (menushell)->children,
pos = g_list_index (GTK_MENU_SHELL (menushell)->priv->children,
NODE_INFO (parent)->proxy) + 1;
break;
default:
......@@ -2025,7 +2026,7 @@ find_menu_position (GNode *node,
if (!GTK_IS_MENU_SHELL (menushell))
return FALSE;
pos = g_list_index (GTK_MENU_SHELL (menushell)->children, prev_child) + 1;
pos = g_list_index (GTK_MENU_SHELL (menushell)->priv->children, prev_child) + 1;
}
if (menushell_p)
......
......@@ -5173,7 +5173,6 @@ gtk_window_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = window->priv;
GtkAllocation child_allocation;
GtkWidget *child;
guint border_width;
......
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