Re: EggDock status ?
- From: Matthias Clasen <maclas gmx de>
- To: GTK Devel <gtk-devel-list gnome org>
- Subject: Re: EggDock status ?
- Date: 18 Apr 2003 01:32:08 +0200
On Thu, 2003-04-17 at 10:27, Biswapesh Chattopadhyay wrote:
> Just a quick note to let you all know that EggDock, the cool new
> hierarchical docking widget written by Gustavo, and Eggified by yours
> truly is now in libegg for your usage and testing pleasure. A test
> program is provided as a demo and to freely steal code from. It
> (temporarily) needs libxml2 and libglade, apart from GTK+.
Here is a first cut at rtl support for EggDock. Ok to commit ?
Matthias
Index: egg-dock-item.c
===================================================================
RCS file: /cvs/gnome/libegg/libegg/dock/egg-dock-item.c,v
retrieving revision 1.1
diff -u -b -B -p -r1.1 egg-dock-item.c
--- egg-dock-item.c 17 Apr 2003 06:45:04 -0000 1.1
+++ egg-dock-item.c 17 Apr 2003 23:20:38 -0000
@@ -708,9 +708,12 @@ egg_dock_item_size_allocate (GtkWidget
grip_alloc.x = grip_alloc.y = 0;
if (item->orientation == GTK_ORIENTATION_HORIZONTAL) {
- child_allocation.x += item->_priv->grip_size;
child_allocation.width -= item->_priv->grip_size;
grip_alloc.width = item->_priv->grip_size;
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ grip_alloc.x = child_allocation.x + child_allocation.width;
+ else
+ child_allocation.x += item->_priv->grip_size;
} else {
child_allocation.y += item->_priv->grip_size;
child_allocation.height -= item->_priv->grip_size;
@@ -890,6 +893,9 @@ egg_dock_item_button_changed (GtkWidget
/* Check if user clicked on the drag handle. */
switch (item->orientation) {
case GTK_ORIENTATION_HORIZONTAL:
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ in_handle = event->x > widget->allocation.width - item->_priv->grip_size;
+ else
in_handle = event->x < item->_priv->grip_size;
break;
case GTK_ORIENTATION_VERTICAL:
Index: egg-dock-notebook.c
===================================================================
RCS file: /cvs/gnome/libegg/libegg/dock/egg-dock-notebook.c,v
retrieving revision 1.1
diff -u -b -B -p -r1.1 egg-dock-notebook.c
--- egg-dock-notebook.c 17 Apr 2003 06:45:04 -0000 1.1
+++ egg-dock-notebook.c 17 Apr 2003 23:20:38 -0000
@@ -177,7 +177,13 @@ egg_dock_notebook_instance_init (EggDock
if (item->orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (item->child), GTK_POS_TOP);
else
+ {
+ if (gtk_widget_get_direction (GTK_WIDGET (item->child)) == GTK_TEXT_DIR_RTL)
+
+ gtk_notebook_set_tab_pos (GTK_NOTEBOOK (item->child), GTK_POS_RIGHT);
+ else
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (item->child), GTK_POS_LEFT);
+ }
g_signal_connect (item->child, "switch_page",
(GCallback) egg_dock_notebook_switch_page_cb, (gpointer) item);
g_signal_connect (item->child, "notify::page",
@@ -410,7 +416,13 @@ egg_dock_notebook_set_orientation (EggDo
if (orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (item->child), GTK_POS_TOP);
else
+ {
+ if (gtk_widget_get_direction (GTK_WIDGET (item->child)) == GTK_TEXT_DIR_RTL)
+
+ gtk_notebook_set_tab_pos (GTK_NOTEBOOK (item->child), GTK_POS_RIGHT);
+ else
gtk_notebook_set_tab_pos (GTK_NOTEBOOK (item->child), GTK_POS_LEFT);
+ }
}
EGG_CALL_PARENT (EGG_DOCK_ITEM_CLASS, set_orientation, (item, orientation));
Index: egg-dock-tablabel.c
===================================================================
RCS file: /cvs/gnome/libegg/libegg/dock/egg-dock-tablabel.c,v
retrieving revision 1.1
diff -u -b -B -p -r1.1 egg-dock-tablabel.c
--- egg-dock-tablabel.c 17 Apr 2003 06:45:04 -0000 1.1
+++ egg-dock-tablabel.c 17 Apr 2003 23:20:38 -0000
@@ -340,12 +340,11 @@ egg_dock_tablabel_size_allocate (GtkWidg
child_allocation.x = widget->allocation.x + border_width;
child_allocation.y = widget->allocation.y + border_width;
- allocation->width = MAX (1, (int) allocation->width -
- (int) tablabel->drag_handle_size);
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
child_allocation.x += tablabel->drag_handle_size;
child_allocation.width =
- MAX (1, (int) allocation->width - 2 * border_width);
+ MAX (1, (int) allocation->width - tablabel->drag_handle_size - 2 * border_width);
child_allocation.height =
MAX (1, (int) allocation->height - 2 * border_width);
@@ -370,6 +369,8 @@ egg_dock_tablabel_paint (GtkWidget
rect.y = widget->allocation.y + border_width;
rect.width = tablabel->drag_handle_size * HANDLE_RATIO;
rect.height = widget->allocation.height - 2*border_width;
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ rect.x = widget->allocation.x + widget->allocation.width - border_width - rect.width;
if (gdk_rectangle_intersect (&event->area, &rect, &dest)) {
gtk_paint_handle (widget->style, widget->window,
@@ -429,6 +430,9 @@ egg_dock_tablabel_button_event (GtkWidge
rel_x = event->x - border_width;
rel_y = event->y - border_width;
+ if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+ rel_x = widget->allocation.width - rel_x;
+
/* Check if user clicked on the drag handle. */
in_handle = (rel_x < tablabel->drag_handle_size * HANDLE_RATIO) &&
(rel_x > 0);
Index: test-dock.c
===================================================================
RCS file: /cvs/gnome/libegg/libegg/dock/test-dock.c,v
retrieving revision 1.1
diff -u -b -B -p -r1.1 test-dock.c
--- test-dock.c 17 Apr 2003 07:03:23 -0000 1.1
+++ test-dock.c 17 Apr 2003 23:20:38 -0000
@@ -129,6 +129,9 @@ main (int argc, char **argv)
setup_handlers ();
+ if (g_getenv ("TEXT_DIR_RTL"))
+ gtk_widget_set_default_direction (GTK_TEXT_DIR_RTL);
+
/* window creation */
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (win, "delete_event",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]