forked from AuroraMiddleware/gtk
Combo box flipping support.
Fri Dec 12 21:00:12 2003 Kristian Rietveld <kris@gtk.org> Combo box flipping support. * gtk/gtkcombobox.c (gtk_combo_box_menu_position), (gtk_combo_box_size_allocate): support RTL flipping (#126518, patch from Matthias Clasen), (gtk_combo_box_popup): fix popup window alignment if there's a cell view frame visible (#126518, patch from Semion Chichelnitsky). * gtk/gtkcellview.c (gtk_cell_view_expose): support RTL flipping (#128348, patch from Semion Chichelnitsky).
This commit is contained in:
parent
f0293295db
commit
375ccb28b3
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
|||||||
|
Fri Dec 12 21:00:12 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Combo box flipping support.
|
||||||
|
|
||||||
|
* gtk/gtkcombobox.c (gtk_combo_box_menu_position),
|
||||||
|
(gtk_combo_box_size_allocate): support RTL flipping (#126518,
|
||||||
|
patch from Matthias Clasen),
|
||||||
|
(gtk_combo_box_popup): fix popup window alignment if there's a
|
||||||
|
cell view frame visible (#126518, patch from Semion Chichelnitsky).
|
||||||
|
|
||||||
|
* gtk/gtkcellview.c (gtk_cell_view_expose): support RTL flipping
|
||||||
|
(#128348, patch from Semion Chichelnitsky).
|
||||||
|
|
||||||
Fri Dec 12 01:13:34 2003 Matthias Clasen <maclas@gmx.de>
|
Fri Dec 12 01:13:34 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* examples/gtkdial/gtkdial.c:
|
* examples/gtkdial/gtkdial.c:
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
Fri Dec 12 21:00:12 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Combo box flipping support.
|
||||||
|
|
||||||
|
* gtk/gtkcombobox.c (gtk_combo_box_menu_position),
|
||||||
|
(gtk_combo_box_size_allocate): support RTL flipping (#126518,
|
||||||
|
patch from Matthias Clasen),
|
||||||
|
(gtk_combo_box_popup): fix popup window alignment if there's a
|
||||||
|
cell view frame visible (#126518, patch from Semion Chichelnitsky).
|
||||||
|
|
||||||
|
* gtk/gtkcellview.c (gtk_cell_view_expose): support RTL flipping
|
||||||
|
(#128348, patch from Semion Chichelnitsky).
|
||||||
|
|
||||||
Fri Dec 12 01:13:34 2003 Matthias Clasen <maclas@gmx.de>
|
Fri Dec 12 01:13:34 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* examples/gtkdial/gtkdial.c:
|
* examples/gtkdial/gtkdial.c:
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
Fri Dec 12 21:00:12 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Combo box flipping support.
|
||||||
|
|
||||||
|
* gtk/gtkcombobox.c (gtk_combo_box_menu_position),
|
||||||
|
(gtk_combo_box_size_allocate): support RTL flipping (#126518,
|
||||||
|
patch from Matthias Clasen),
|
||||||
|
(gtk_combo_box_popup): fix popup window alignment if there's a
|
||||||
|
cell view frame visible (#126518, patch from Semion Chichelnitsky).
|
||||||
|
|
||||||
|
* gtk/gtkcellview.c (gtk_cell_view_expose): support RTL flipping
|
||||||
|
(#128348, patch from Semion Chichelnitsky).
|
||||||
|
|
||||||
Fri Dec 12 01:13:34 2003 Matthias Clasen <maclas@gmx.de>
|
Fri Dec 12 01:13:34 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* examples/gtkdial/gtkdial.c:
|
* examples/gtkdial/gtkdial.c:
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
Fri Dec 12 21:00:12 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Combo box flipping support.
|
||||||
|
|
||||||
|
* gtk/gtkcombobox.c (gtk_combo_box_menu_position),
|
||||||
|
(gtk_combo_box_size_allocate): support RTL flipping (#126518,
|
||||||
|
patch from Matthias Clasen),
|
||||||
|
(gtk_combo_box_popup): fix popup window alignment if there's a
|
||||||
|
cell view frame visible (#126518, patch from Semion Chichelnitsky).
|
||||||
|
|
||||||
|
* gtk/gtkcellview.c (gtk_cell_view_expose): support RTL flipping
|
||||||
|
(#128348, patch from Semion Chichelnitsky).
|
||||||
|
|
||||||
Fri Dec 12 01:13:34 2003 Matthias Clasen <maclas@gmx.de>
|
Fri Dec 12 01:13:34 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* examples/gtkdial/gtkdial.c:
|
* examples/gtkdial/gtkdial.c:
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
Fri Dec 12 21:00:12 2003 Kristian Rietveld <kris@gtk.org>
|
||||||
|
|
||||||
|
Combo box flipping support.
|
||||||
|
|
||||||
|
* gtk/gtkcombobox.c (gtk_combo_box_menu_position),
|
||||||
|
(gtk_combo_box_size_allocate): support RTL flipping (#126518,
|
||||||
|
patch from Matthias Clasen),
|
||||||
|
(gtk_combo_box_popup): fix popup window alignment if there's a
|
||||||
|
cell view frame visible (#126518, patch from Semion Chichelnitsky).
|
||||||
|
|
||||||
|
* gtk/gtkcellview.c (gtk_cell_view_expose): support RTL flipping
|
||||||
|
(#128348, patch from Semion Chichelnitsky).
|
||||||
|
|
||||||
Fri Dec 12 01:13:34 2003 Matthias Clasen <maclas@gmx.de>
|
Fri Dec 12 01:13:34 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* examples/gtkdial/gtkdial.c:
|
* examples/gtkdial/gtkdial.c:
|
||||||
|
@ -403,6 +403,7 @@ gtk_cell_view_expose (GtkWidget *widget,
|
|||||||
GList *i;
|
GList *i;
|
||||||
GtkCellView *cellview;
|
GtkCellView *cellview;
|
||||||
GdkRectangle area;
|
GdkRectangle area;
|
||||||
|
gboolean rtl = (gtk_widget_get_direction(widget) == GTK_TEXT_DIR_RTL);
|
||||||
|
|
||||||
cellview = GTK_CELL_VIEW (widget);
|
cellview = GTK_CELL_VIEW (widget);
|
||||||
|
|
||||||
@ -439,7 +440,7 @@ gtk_cell_view_expose (GtkWidget *widget,
|
|||||||
area = widget->allocation;
|
area = widget->allocation;
|
||||||
|
|
||||||
/* we draw on our very own window, initialize x and y to zero */
|
/* we draw on our very own window, initialize x and y to zero */
|
||||||
area.x = widget->allocation.x;
|
area.x = widget->allocation.x + (rtl ? widget->allocation.width : 0);
|
||||||
area.y = widget->allocation.y;
|
area.y = widget->allocation.y;
|
||||||
|
|
||||||
/* PACK_START */
|
/* PACK_START */
|
||||||
@ -454,6 +455,8 @@ gtk_cell_view_expose (GtkWidget *widget,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
area.width = info->real_width;
|
area.width = info->real_width;
|
||||||
|
if (rtl)
|
||||||
|
area.x -= area.width;
|
||||||
|
|
||||||
gtk_cell_renderer_render (info->cell,
|
gtk_cell_renderer_render (info->cell,
|
||||||
event->window,
|
event->window,
|
||||||
@ -461,9 +464,12 @@ gtk_cell_view_expose (GtkWidget *widget,
|
|||||||
/* FIXME! */
|
/* FIXME! */
|
||||||
&area, &area, &event->area, 0);
|
&area, &area, &event->area, 0);
|
||||||
|
|
||||||
area.x += info->real_width;
|
if (!rtl)
|
||||||
|
area.x += info->real_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
area.x = rtl ? widget->allocation.x : (widget->allocation.x + widget->allocation.width);
|
||||||
|
|
||||||
/* PACK_END */
|
/* PACK_END */
|
||||||
for (i = cellview->priv->cell_list; i; i = i->next)
|
for (i = cellview->priv->cell_list; i; i = i->next)
|
||||||
{
|
{
|
||||||
@ -476,13 +482,16 @@ gtk_cell_view_expose (GtkWidget *widget,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
area.width = info->real_width;
|
area.width = info->real_width;
|
||||||
|
if (!rtl)
|
||||||
|
area.x -= area.width;
|
||||||
|
|
||||||
gtk_cell_renderer_render (info->cell,
|
gtk_cell_renderer_render (info->cell,
|
||||||
widget->window,
|
widget->window,
|
||||||
widget,
|
widget,
|
||||||
/* FIXME ! */
|
/* FIXME ! */
|
||||||
&area, &area, &event->area, 0);
|
&area, &area, &event->area, 0);
|
||||||
area.x += info->real_width;
|
if (rtl)
|
||||||
|
area.x += info->real_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -694,7 +694,10 @@ gtk_combo_box_menu_position (GtkMenu *menu,
|
|||||||
|
|
||||||
gtk_widget_size_request (GTK_WIDGET (menu), &req);
|
gtk_widget_size_request (GTK_WIDGET (menu), &req);
|
||||||
|
|
||||||
*x = sx + child->allocation.width - req.width;
|
if (gtk_widget_get_direction (GTK_WIDGET (combo_box)) == GTK_TEXT_DIR_RTL)
|
||||||
|
*x = sx;
|
||||||
|
else
|
||||||
|
*x = sx + child->allocation.width - req.width;
|
||||||
*y = sy + child->allocation.height;
|
*y = sy + child->allocation.height;
|
||||||
|
|
||||||
if (GTK_WIDGET_NO_WINDOW (child))
|
if (GTK_WIDGET_NO_WINDOW (child))
|
||||||
@ -742,6 +745,15 @@ gtk_combo_box_popup (GtkComboBox *combo_box)
|
|||||||
|
|
||||||
gdk_window_get_origin (sample->window,
|
gdk_window_get_origin (sample->window,
|
||||||
&x, &y);
|
&x, &y);
|
||||||
|
|
||||||
|
if (combo_box->priv->cell_view_frame)
|
||||||
|
{
|
||||||
|
x -= GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
|
||||||
|
GTK_WIDGET (combo_box->priv->cell_view_frame)->style->xthickness;
|
||||||
|
width += 2 * (GTK_CONTAINER (combo_box->priv->cell_view_frame)->border_width +
|
||||||
|
GTK_WIDGET (combo_box->priv->cell_view_frame)->style->xthickness);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_widget_set_size_request (combo_box->priv->popup_window,
|
gtk_widget_set_size_request (combo_box->priv->popup_window,
|
||||||
width, -1);
|
width, -1);
|
||||||
|
|
||||||
@ -939,6 +951,7 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
|||||||
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
|
GtkComboBox *combo_box = GTK_COMBO_BOX (widget);
|
||||||
GtkAllocation child;
|
GtkAllocation child;
|
||||||
GtkRequisition req;
|
GtkRequisition req;
|
||||||
|
gboolean is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
|
||||||
|
|
||||||
widget->allocation = *allocation;
|
widget->allocation = *allocation;
|
||||||
|
|
||||||
@ -960,36 +973,54 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
|||||||
child.x = allocation->x + border_width + 1 + xthickness + 2;
|
child.x = allocation->x + border_width + 1 + xthickness + 2;
|
||||||
child.y = allocation->y + border_width + 1 + ythickness + 2;
|
child.y = allocation->y + border_width + 1 + ythickness + 2;
|
||||||
|
|
||||||
width = allocation->width - (border_width + 1 + ythickness * 2 + 4);
|
width = allocation->width - (border_width + 1 + xthickness * 2 + 4);
|
||||||
|
|
||||||
/* handle the childs */
|
/* handle the childs */
|
||||||
gtk_widget_size_request (combo_box->priv->arrow, &req);
|
gtk_widget_size_request (combo_box->priv->arrow, &req);
|
||||||
child.width = req.width;
|
child.width = req.width;
|
||||||
child.height = allocation->height - 2 * (child.y - allocation->y);
|
child.height = allocation->height - 2 * (child.y - allocation->y);
|
||||||
child.x += width - req.width;
|
if (!is_rtl)
|
||||||
|
child.x += width - req.width;
|
||||||
gtk_widget_size_allocate (combo_box->priv->arrow, &child);
|
gtk_widget_size_allocate (combo_box->priv->arrow, &child);
|
||||||
|
if (is_rtl)
|
||||||
|
child.x += req.width;
|
||||||
gtk_widget_size_request (combo_box->priv->separator, &req);
|
gtk_widget_size_request (combo_box->priv->separator, &req);
|
||||||
child.width = req.width;
|
child.width = req.width;
|
||||||
child.x -= req.width;
|
if (!is_rtl)
|
||||||
|
child.x -= req.width;
|
||||||
gtk_widget_size_allocate (combo_box->priv->separator, &child);
|
gtk_widget_size_allocate (combo_box->priv->separator, &child);
|
||||||
|
|
||||||
child.width = child.x;
|
if (is_rtl)
|
||||||
child.x = allocation->x + border_width + 1 + xthickness + 2;
|
{
|
||||||
child.width -= child.x;
|
child.x += req.width;
|
||||||
|
child.width = allocation->x + allocation->width
|
||||||
|
- (border_width + 1 + xthickness + 2) - child.x;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
child.width = child.x;
|
||||||
|
child.x = allocation->x + border_width + 1 + xthickness + 2;
|
||||||
|
child.width -= child.x;
|
||||||
|
}
|
||||||
|
|
||||||
gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
|
gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_widget_size_request (combo_box->priv->button, &req);
|
gtk_widget_size_request (combo_box->priv->button, &req);
|
||||||
child.x = allocation->x + allocation->width - req.width;
|
if (is_rtl)
|
||||||
|
child.x = allocation->x;
|
||||||
|
else
|
||||||
|
child.x = allocation->x + allocation->width - req.width;
|
||||||
child.y = allocation->y;
|
child.y = allocation->y;
|
||||||
child.width = req.width;
|
child.width = req.width;
|
||||||
child.height = allocation->height;
|
child.height = allocation->height;
|
||||||
gtk_widget_size_allocate (combo_box->priv->button, &child);
|
gtk_widget_size_allocate (combo_box->priv->button, &child);
|
||||||
|
|
||||||
child.x = allocation->x;
|
if (is_rtl)
|
||||||
|
child.x = allocation->x + req.width;
|
||||||
|
else
|
||||||
|
child.x = allocation->x;
|
||||||
child.y = allocation->y;
|
child.y = allocation->y;
|
||||||
child.width = allocation->width - req.width;
|
child.width = allocation->width - req.width;
|
||||||
gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
|
gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
|
||||||
@ -1001,14 +1032,20 @@ gtk_combo_box_size_allocate (GtkWidget *widget,
|
|||||||
|
|
||||||
/* button */
|
/* button */
|
||||||
gtk_widget_size_request (combo_box->priv->button, &req);
|
gtk_widget_size_request (combo_box->priv->button, &req);
|
||||||
child.x = allocation->x + allocation->width - req.width;
|
if (is_rtl)
|
||||||
|
child.x = allocation->x;
|
||||||
|
else
|
||||||
|
child.x += allocation->x + allocation->width - req.width;
|
||||||
child.y = allocation->y;
|
child.y = allocation->y;
|
||||||
child.width = req.width;
|
child.width = req.width;
|
||||||
child.height = allocation->height;
|
child.height = allocation->height;
|
||||||
gtk_widget_size_allocate (combo_box->priv->button, &child);
|
gtk_widget_size_allocate (combo_box->priv->button, &child);
|
||||||
|
|
||||||
/* frame */
|
/* frame */
|
||||||
child.x = allocation->x;
|
if (is_rtl)
|
||||||
|
child.x = allocation->x + req.width;
|
||||||
|
else
|
||||||
|
child.x = allocation->x;
|
||||||
child.y = allocation->y;
|
child.y = allocation->y;
|
||||||
child.width = allocation->width - req.width;
|
child.width = allocation->width - req.width;
|
||||||
child.height = allocation->height;
|
child.height = allocation->height;
|
||||||
|
Loading…
Reference in New Issue
Block a user