summaryrefslogtreecommitdiff
path: root/gtk/gtkpaned.c
diff options
context:
space:
mode:
authorSoeren Sandmann <sandmann@daimi.au.dk>2003-09-19 16:18:16 +0000
committerSøren Sandmann Pedersen <ssp@src.gnome.org>2003-09-19 16:18:16 +0000
commitfc3f1ef30c58aa6da31b63d27ed34786212aaa14 (patch)
tree733d4a8c0f681e7b22731dae33f4ae8858832ab1 /gtk/gtkpaned.c
parentad709dcfea6565239902d6c37db09cf2757bf041 (diff)
downloadgdk-pixbuf-fc3f1ef30c58aa6da31b63d27ed34786212aaa14.tar.gz
implement RTL flipping (#96632)
Fri Sep 19 18:15:31 2003 Soeren Sandmann <sandmann@daimi.au.dk> * gtk/gtkpaned.c, gtk/gtkhpaned.c: implement RTL flipping (#96632)
Diffstat (limited to 'gtk/gtkpaned.c')
-rw-r--r--gtk/gtkpaned.c55
1 files changed, 45 insertions, 10 deletions
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 58dfd9ed2..c064d752e 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -733,6 +733,18 @@ gtk_paned_expose (GtkWidget *widget,
return FALSE;
}
+static gboolean
+is_rtl (GtkPaned *paned)
+{
+ if (paned->orientation == GTK_ORIENTATION_VERTICAL &&
+ gtk_widget_get_direction (GTK_WIDGET (paned)) == GTK_TEXT_DIR_RTL)
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
update_drag (GtkPaned *paned)
{
@@ -745,9 +757,23 @@ update_drag (GtkPaned *paned)
else
gtk_widget_get_pointer (GTK_WIDGET (paned), &pos, NULL);
- gtk_widget_style_get (GTK_WIDGET (paned), "handle_size", &handle_size, NULL);
+ pos -= paned->drag_pos;
+
+ if (is_rtl (paned))
+ {
+ gtk_widget_style_get (GTK_WIDGET (paned),
+ "handle_size", &handle_size,
+ NULL);
+
+ size = GTK_WIDGET (paned)->allocation.width - pos - handle_size;
+ }
+ else
+ {
+ size = pos;
+ }
+
+ size -= GTK_CONTAINER (paned)->border_width;
- size = pos - GTK_CONTAINER (paned)->border_width - paned->drag_pos;
size = CLAMP (size, paned->min_position, paned->max_position);
if (size != paned->child1_size)
@@ -1332,7 +1358,7 @@ gtk_paned_cycle_child_focus (GtkPaned *paned,
{
GList *cycle_chain = NULL;
GList *list;
-
+
GtkDirectionType direction = reversed? GTK_DIR_TAB_BACKWARD : GTK_DIR_TAB_FORWARD;
/* ignore f6 if the handle is focused */
@@ -1429,38 +1455,40 @@ gtk_paned_move_handle (GtkPaned *paned,
{
gint old_position;
gint new_position;
+ gint increment;
enum {
SINGLE_STEP_SIZE = 1,
PAGE_STEP_SIZE = 75
};
- old_position = gtk_paned_get_position (paned);
+ new_position = old_position = gtk_paned_get_position (paned);
+ increment = 0;
switch (scroll)
{
case GTK_SCROLL_STEP_LEFT:
case GTK_SCROLL_STEP_UP:
case GTK_SCROLL_STEP_BACKWARD:
- new_position = old_position - SINGLE_STEP_SIZE;
+ increment = - SINGLE_STEP_SIZE;
break;
case GTK_SCROLL_STEP_RIGHT:
case GTK_SCROLL_STEP_DOWN:
case GTK_SCROLL_STEP_FORWARD:
- new_position = old_position + SINGLE_STEP_SIZE;
+ increment = SINGLE_STEP_SIZE;
break;
case GTK_SCROLL_PAGE_LEFT:
case GTK_SCROLL_PAGE_UP:
case GTK_SCROLL_PAGE_BACKWARD:
- new_position = old_position - PAGE_STEP_SIZE;
+ increment = - PAGE_STEP_SIZE;
break;
case GTK_SCROLL_PAGE_RIGHT:
case GTK_SCROLL_PAGE_DOWN:
case GTK_SCROLL_PAGE_FORWARD:
- new_position = old_position + PAGE_STEP_SIZE;
+ increment = PAGE_STEP_SIZE;
break;
case GTK_SCROLL_START:
@@ -1470,11 +1498,18 @@ gtk_paned_move_handle (GtkPaned *paned,
case GTK_SCROLL_END:
new_position = paned->max_position;
break;
-
+
default:
- new_position = old_position;
break;
}
+
+ if (increment)
+ {
+ if (is_rtl (paned))
+ increment = -increment;
+
+ new_position = old_position + increment;
+ }
new_position = CLAMP (new_position, paned->min_position, paned->max_position);