mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-09-30 11:07:38 +00:00
Removed GtkMenuItem->show_submenu_indicator flag
The show_submenu_indicator flag was explicitly set in various places from GtkMenu/GtkMenuBar at request times, since the GtkMenuItem already checks the parent type for GTK_IS_MENU_BAR() in various places, removed this flag in favor of just checking the parent type (only in the interest of better readable code).
This commit is contained in:
parent
7352a166b6
commit
58cdd6d38e
@ -3033,7 +3033,6 @@ gtk_menu_get_preferred_width (GtkWidget *widget,
|
||||
* case the toggle size request depends on the size
|
||||
* request of a child of the child (e.g. for ImageMenuItem)
|
||||
*/
|
||||
GTK_MENU_ITEM (child)->priv->show_submenu_indicator = TRUE;
|
||||
gtk_widget_get_preferred_width (child, &child_min, &child_nat);
|
||||
|
||||
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child), &toggle_size);
|
||||
|
@ -313,7 +313,6 @@ gtk_menu_bar_size_request (GtkWidget *widget,
|
||||
{
|
||||
gint toggle_size;
|
||||
|
||||
GTK_MENU_ITEM (child)->priv->show_submenu_indicator = FALSE;
|
||||
gtk_widget_get_preferred_size (child, &child_requisition, NULL);
|
||||
gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
|
||||
&toggle_size);
|
||||
|
@ -422,10 +422,12 @@ gtk_menu_item_init (GtkMenuItem *menu_item)
|
||||
|
||||
gtk_widget_set_has_window (GTK_WIDGET (menu_item), FALSE);
|
||||
|
||||
priv->submenu = NULL;
|
||||
priv->toggle_size = 0;
|
||||
priv->accelerator_width = 0;
|
||||
priv->show_submenu_indicator = FALSE;
|
||||
priv->action = NULL;
|
||||
priv->use_action_appearance = TRUE;
|
||||
|
||||
menu_item->submenu = NULL;
|
||||
menu_item->toggle_size = 0;
|
||||
menu_item->accelerator_width = 0;
|
||||
if (gtk_widget_get_direction (GTK_WIDGET (menu_item)) == GTK_TEXT_DIR_RTL)
|
||||
priv->submenu_direction = GTK_DIRECTION_LEFT;
|
||||
else
|
||||
@ -711,10 +713,16 @@ gtk_menu_item_get_preferred_width (GtkWidget *widget,
|
||||
|
||||
gtk_widget_get_preferred_width (child, &child_min, &child_nat);
|
||||
|
||||
if (priv->submenu && priv->show_submenu_indicator)
|
||||
{
|
||||
guint arrow_spacing;
|
||||
gint arrow_size;
|
||||
if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
|
||||
{
|
||||
guint arrow_spacing;
|
||||
gint arrow_size;
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"arrow-spacing", &arrow_spacing,
|
||||
NULL);
|
||||
|
||||
get_arrow_size (widget, child, &arrow_size);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"arrow-spacing", &arrow_spacing,
|
||||
@ -806,9 +814,9 @@ gtk_menu_item_get_preferred_height (GtkWidget *widget,
|
||||
min_height += child_min;
|
||||
nat_height += child_nat;
|
||||
|
||||
if (priv->submenu && priv->show_submenu_indicator)
|
||||
{
|
||||
gint arrow_size;
|
||||
if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
|
||||
{
|
||||
gint arrow_size;
|
||||
|
||||
get_arrow_size (widget, child, &arrow_size);
|
||||
|
||||
@ -910,9 +918,9 @@ gtk_menu_item_get_preferred_height_for_width (GtkWidget *widget,
|
||||
{
|
||||
gint child_min, child_nat;
|
||||
gint arrow_size = 0;
|
||||
|
||||
if (priv->submenu && priv->show_submenu_indicator)
|
||||
{
|
||||
|
||||
if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
|
||||
{
|
||||
guint arrow_spacing;
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
@ -933,11 +941,11 @@ gtk_menu_item_get_preferred_height_for_width (GtkWidget *widget,
|
||||
min_height += child_min;
|
||||
nat_height += child_nat;
|
||||
|
||||
if (priv->submenu && priv->show_submenu_indicator)
|
||||
{
|
||||
min_height = MAX (min_height, arrow_size);
|
||||
nat_height = MAX (nat_height, arrow_size);
|
||||
}
|
||||
if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
|
||||
{
|
||||
min_height = MAX (min_height, arrow_size);
|
||||
nat_height = MAX (nat_height, arrow_size);
|
||||
}
|
||||
}
|
||||
else /* separator item */
|
||||
{
|
||||
@ -1385,13 +1393,13 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
|
||||
child_allocation.y += allocation->y;
|
||||
|
||||
gtk_widget_get_preferred_size (child, &child_requisition, NULL);
|
||||
if (priv->submenu && priv->show_submenu_indicator)
|
||||
{
|
||||
if (direction == GTK_TEXT_DIR_RTL)
|
||||
child_allocation.x += child_requisition.height;
|
||||
child_allocation.width -= child_requisition.height;
|
||||
}
|
||||
|
||||
if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
|
||||
{
|
||||
if (direction == GTK_TEXT_DIR_RTL)
|
||||
child_allocation.x += child_requisition.height;
|
||||
child_allocation.width -= child_requisition.height;
|
||||
}
|
||||
|
||||
if (child_allocation.width < 1)
|
||||
child_allocation.width = 1;
|
||||
|
||||
@ -1509,7 +1517,7 @@ gtk_menu_item_draw (GtkWidget *widget,
|
||||
GtkStateType state_type;
|
||||
GtkShadowType shadow_type, selected_shadow_type;
|
||||
GtkStyle *style;
|
||||
GtkWidget *child;
|
||||
GtkWidget *child, *parent;
|
||||
GdkWindow *window;
|
||||
gint x, y, w, h, width, height;
|
||||
guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
@ -1526,7 +1534,8 @@ gtk_menu_item_draw (GtkWidget *widget,
|
||||
h = height - border_width * 2;
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (menu_item));
|
||||
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
|
||||
if (child && state_type == GTK_STATE_PRELIGHT)
|
||||
{
|
||||
gtk_widget_style_get (widget,
|
||||
@ -1540,7 +1549,7 @@ gtk_menu_item_draw (GtkWidget *widget,
|
||||
x, y, w, h);
|
||||
}
|
||||
|
||||
if (priv->submenu && priv->show_submenu_indicator)
|
||||
if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
|
||||
{
|
||||
gint arrow_x, arrow_y;
|
||||
gint arrow_size;
|
||||
|
Loading…
Reference in New Issue
Block a user