Further RTL fixes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41162 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2006-09-11 14:20:24 +00:00
parent f1a9b1a3d9
commit 428f4657b6
4 changed files with 29 additions and 2 deletions

View 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);

View 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

View 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,

View 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() );