"Selected Shadow Type",
"Shadow type when item is selected",
GTK_TYPE_SHADOW_TYPE,
- GTK_SHADOW_OUT,
+ GTK_SHADOW_NONE,
G_PARAM_READABLE),
gtk_rc_property_parse_enum);
}
menu_item->toggle_size = 0;
menu_item->accelerator_width = 0;
menu_item->show_submenu_indicator = FALSE;
- menu_item->submenu_direction = GTK_DIRECTION_RIGHT;
+ if (gtk_widget_get_direction (GTK_WIDGET (menu_item)) == GTK_TEXT_DIR_RTL)
+ menu_item->submenu_direction = GTK_DIRECTION_LEFT;
+ else
+ menu_item->submenu_direction = GTK_DIRECTION_RIGHT;
menu_item->submenu_placement = GTK_TOP_BOTTOM;
menu_item->right_justify = FALSE;
GtkMenuItem *menu_item;
GtkBin *bin;
GtkAllocation child_allocation;
+ GtkTextDirection direction;
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
g_return_if_fail (allocation != NULL);
menu_item = GTK_MENU_ITEM (widget);
bin = GTK_BIN (widget);
+ direction = gtk_widget_get_direction (widget);
+
widget->allocation = *allocation;
if (bin->child)
widget->style->ythickness);
child_allocation.width = MAX (1, (gint)allocation->width - child_allocation.x * 2);
child_allocation.height = MAX (1, (gint)allocation->height - child_allocation.y * 2);
- child_allocation.x += GTK_MENU_ITEM (widget)->toggle_size;
+ if (direction == GTK_TEXT_DIR_LTR)
+ child_allocation.x += GTK_MENU_ITEM (widget)->toggle_size;
child_allocation.width -= GTK_MENU_ITEM (widget)->toggle_size;
child_allocation.x += widget->allocation.x;
child_allocation.y += widget->allocation.y;
gtk_widget_get_child_requisition (bin->child, &child_requisition);
- if (menu_item->submenu && menu_item->show_submenu_indicator)
- child_allocation.width -= child_requisition.height;
-
+ if (menu_item->submenu && menu_item->show_submenu_indicator)
+ {
+ 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;
menu_item = GTK_MENU_ITEM (widget);
state_type = widget->state;
-
+
x = widget->allocation.x + border_width;
y = widget->allocation.y + border_width;
width = widget->allocation.width - border_width * 2;
gint arrow_x, arrow_y;
gint arrow_size;
gint arrow_extent;
+ GtkTextDirection direction;
+ GtkArrowType arrow_type;
+ direction = gtk_widget_get_direction (widget);
+
gtk_widget_get_child_requisition (GTK_BIN (menu_item)->child,
&child_requisition);
if (state_type == GTK_STATE_PRELIGHT)
shadow_type = GTK_SHADOW_IN;
- arrow_x = x + width - 1 - arrow_size + (arrow_size - arrow_extent) / 2;
+ if (direction == GTK_TEXT_DIR_LTR) {
+ arrow_x = x + width - 1 - arrow_size + (arrow_size - arrow_extent) / 2;
+ arrow_type = GTK_ARROW_RIGHT;
+ }
+ else {
+ arrow_x = x + 1 + (arrow_size - arrow_extent) / 2;
+ arrow_type = GTK_ARROW_LEFT;
+ }
+
arrow_y = y + (height - arrow_extent) / 2;
gtk_paint_arrow (widget->style, widget->window,
state_type, shadow_type,
area, widget, "menuitem",
- GTK_ARROW_RIGHT, TRUE,
+ arrow_type, TRUE,
arrow_x, arrow_y,
arrow_extent, arrow_extent);
}
if (menu_item->submenu)
{
gint popup_delay;
- GtkWidget *parent;
if (menu_item->timer)
gtk_timeout_remove (menu_item->timer);
menu_item->timer_from_keypress = FALSE;
if (event)
- gdk_event_free(event);
+ gdk_event_free (event);
}
else
gtk_menu_item_popup_submenu (menu_item);
static void
gtk_menu_item_popup_submenu (gpointer data)
{
+ GtkWidget *widget;
GtkMenuItem *menu_item;
- menu_item = GTK_MENU_ITEM (data);
+ widget = GTK_WIDGET (data);
+ menu_item = GTK_MENU_ITEM (widget);
if (menu_item->timer)
gtk_timeout_remove (menu_item->timer);
menu_item->timer = 0;
if (GTK_WIDGET_IS_SENSITIVE (menu_item->submenu))
- {
- gtk_menu_popup (GTK_MENU (menu_item->submenu),
- GTK_WIDGET (menu_item)->parent,
- GTK_WIDGET (menu_item),
- gtk_menu_item_position_menu,
- menu_item,
- GTK_MENU_SHELL (GTK_WIDGET (menu_item)->parent)->button,
- 0);
- }
+ gtk_menu_popup (GTK_MENU (menu_item->submenu),
+ widget->parent,
+ widget,
+ gtk_menu_item_position_menu,
+ menu_item,
+ GTK_MENU_SHELL (widget->parent)->button,
+ 0);
}
static void
gint screen_height;
gint twidth, theight;
gint tx, ty;
+ GtkTextDirection direction;
g_return_if_fail (menu != NULL);
g_return_if_fail (x != NULL);
menu_item = GTK_MENU_ITEM (user_data);
widget = GTK_WIDGET (user_data);
+ direction = gtk_widget_get_direction (widget);
+
twidth = GTK_WIDGET (menu)->requisition.width;
theight = GTK_WIDGET (menu)->requisition.height;
switch (menu_item->submenu_placement)
{
case GTK_TOP_BOTTOM:
+ if (direction == GTK_TEXT_DIR_LTR)
+ menu_item->submenu_direction = GTK_DIRECTION_RIGHT;
+ else
+ {
+ menu_item->submenu_direction = GTK_DIRECTION_LEFT;
+ tx += widget->allocation.width - twidth;
+ }
+
if ((ty + widget->allocation.height + theight) <= screen_height)
ty += widget->allocation.height;
else if ((ty - theight) >= 0)
break;
case GTK_LEFT_RIGHT:
- menu_item->submenu_direction = GTK_DIRECTION_RIGHT;
parent_menu_item = GTK_MENU (widget->parent)->parent_menu_item;
- if (parent_menu_item)
+ if (parent_menu_item &&
+ !GTK_MENU (widget->parent)->torn_off &&
+ !GTK_MENU_SHELL (menu)->active)
menu_item->submenu_direction = GTK_MENU_ITEM (parent_menu_item)->submenu_direction;
+ else if (direction == GTK_TEXT_DIR_LTR)
+ menu_item->submenu_direction = GTK_DIRECTION_RIGHT;
+ else
+ menu_item->submenu_direction = GTK_DIRECTION_LEFT;
switch (menu_item->submenu_direction)
{