]> git.saurik.com Git - wxWidgets.git/commitdiff
Further RTL fixes.
authorRobert Roebling <robert@roebling.de>
Mon, 11 Sep 2006 14:20:24 +0000 (14:20 +0000)
committerRobert Roebling <robert@roebling.de>
Mon, 11 Sep 2006 14:20:24 +0000 (14:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41162 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/win_gtk.h
src/gtk/renderer.cpp
src/gtk/win_gtk.c
src/gtk/window.cpp

index 34e665a4104af1920413b8d372f113500fbf58ef..a62ed2d8417691fbabba9d89c44e1c03624bf86b 100644 (file)
@@ -86,6 +86,9 @@ WXDLLIMPEXP_CORE
 void       gtk_pizza_set_yoffset     (GtkPizza          *pizza, gint yoffset); 
 
 
+WXDLLIMPEXP_CORE
+gint       gtk_pizza_get_rtl_offset  (GtkPizza          *pizza); 
+
 WXDLLIMPEXP_CORE
 void       gtk_pizza_set_shadow_type (GtkPizza          *pizza,
                                       GtkMyShadowType    type);
index 6661e7ff53f259fb7be6edb4bc7c1521a51c1dcd..f1cd95c8564a6c3fd0d4485f7cb12286d846afbf 100644 (file)
@@ -216,6 +216,10 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win,
     else
         state = GTK_STATE_NORMAL;
 
+    int x_diff = 0;
+    if (win->GetLayoutDirection() == wxLayout_RightToLeft)
+        x_diff = rect.width;
+        
     // VZ: I don't know how to get the size of the expander so as to centre it
     //     in the given rectangle, +2/3 below is just what looks good here...
     gtk_paint_expander
@@ -226,7 +230,7 @@ wxRendererGTK::DrawTreeItemButton(wxWindow* win,
         NULL,
         tree,
         "treeview",
-        dc.LogicalToDeviceX(rect.x) + 2,
+        dc.LogicalToDeviceX(rect.x) + 2 - x_diff,
         dc.LogicalToDeviceY(rect.y) + 3,
         flags & wxCONTROL_EXPANDED ? GTK_EXPANDER_EXPANDED
                                    : GTK_EXPANDER_COLLAPSED
index 6e473cfa673eb94ea9234fdd3bc7268e0ddbdcb8..12ccb9b591a6135221dcc3c5b731302925d57399 100644 (file)
@@ -243,6 +243,21 @@ void       gtk_pizza_set_yoffset     (GtkPizza          *pizza, gint yoffset)
     // do something
 }
 
+gint       gtk_pizza_get_rtl_offset  (GtkPizza          *pizza)
+{
+    gint width;
+
+    g_return_val_if_fail ( (pizza != NULL), 0 );
+    g_return_val_if_fail ( (GTK_IS_PIZZA (pizza)), 0 );
+    
+    if (!pizza->bin_window) return 0;
+    
+    gdk_window_get_geometry( pizza->bin_window, NULL, NULL, &width, NULL, NULL );
+    
+    return width;
+}
+
+
 static void
 gtk_pizza_scroll_set_adjustments (GtkPizza     *pizza,
                                     GtkAdjustment  *hadj,
index c77d7a904149bc3ec7328d9a663149ab1d98d446..7f7721e327cea0d13379a1ed1906c505644109d5 100644 (file)
@@ -1284,7 +1284,12 @@ template<typename T> void InitMouseEvent(wxWindowGTK *win,
     event.m_y = (wxCoord)gdk_event->y - pt.y;
     
     if ((win->m_wxwindow) && (win->GetLayoutDirection() == wxLayout_RightToLeft))
-        event.m_x = GTK_PIZZA(win->m_wxwindow)->m_width - event.m_x;
+    {
+        // origin in the upper right corner
+        int virtual_width = win->GetVirtualSize().x;
+        int window_width = gtk_pizza_get_rtl_offset( GTK_PIZZA(win->m_wxwindow) );
+        event.m_x = wxMax( virtual_width, window_width ) - event.m_x;
+    }
 
     event.SetEventObject( win );
     event.SetId( win->GetId() );