Better place for coordinate mirroring and removal

of stupid hack.
  This makes the positioning correct in the end but
    leaves window hopping when resizing unsolved
    in RTL mode.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42000 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2006-10-14 07:06:50 +00:00
parent bfeeb7f3a2
commit db71eb0640
4 changed files with 20 additions and 33 deletions

View File

@@ -53,8 +53,6 @@ struct _GtkPizza
guint m_xoffset; guint m_xoffset;
guint m_yoffset; guint m_yoffset;
gint m_width;
GdkWindow *bin_window; GdkWindow *bin_window;
}; };

View File

@@ -243,9 +243,6 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
win->m_width = alloc->width; win->m_width = alloc->width;
win->m_height = alloc->height; win->m_height = alloc->height;
if (win->m_mainWidget)
GTK_PIZZA(win->m_mainWidget)->m_width = win->m_width;
win->GtkUpdateSize(); win->GtkUpdateSize();
} }
} }
@@ -566,8 +563,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS ); GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS );
gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget ); gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget );
GTK_PIZZA(m_mainWidget)->m_width = m_width;
if (m_miniEdge == 0) // wxMiniFrame has its own version. if (m_miniEdge == 0) // wxMiniFrame has its own version.
{ {
// For m_mainWidget themes // For m_mainWidget themes
@@ -862,9 +857,6 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si
if (width != -1) m_width = width; if (width != -1) m_width = width;
if (height != -1) m_height = height; if (height != -1) m_height = height;
if (m_mainWidget)
GTK_PIZZA(m_mainWidget)->m_width = m_width;
/* /*
if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH) if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH)
{ {

View File

@@ -193,8 +193,6 @@ gtk_pizza_init (GtkPizza *pizza)
pizza->m_xoffset = 0; pizza->m_xoffset = 0;
pizza->m_yoffset = 0; pizza->m_yoffset = 0;
pizza->m_width = -1;
} }
GtkWidget* GtkWidget*
@@ -299,8 +297,8 @@ gtk_pizza_put (GtkPizza *pizza,
if (gtk_widget_get_direction( GTK_WIDGET(pizza) ) == GTK_TEXT_DIR_RTL) if (gtk_widget_get_direction( GTK_WIDGET(pizza) ) == GTK_TEXT_DIR_RTL)
{ {
// reverse horizontal placement /* reverse horizontal placement */
x = pizza->m_width - x - width; x = GTK_WIDGET(pizza)->allocation.width - x - width;
} }
child_info = g_new (GtkPizzaChild, 1); child_info = g_new (GtkPizzaChild, 1);
@@ -311,9 +309,6 @@ gtk_pizza_put (GtkPizza *pizza,
child_info->width = width; child_info->width = width;
child_info->height = height; child_info->height = height;
if (GTK_IS_PIZZA(widget))
GTK_PIZZA(widget)->m_width = width;
pizza->children = g_list_append (pizza->children, child_info); pizza->children = g_list_append (pizza->children, child_info);
if (GTK_WIDGET_REALIZED (pizza)) if (GTK_WIDGET_REALIZED (pizza))
@@ -357,26 +352,16 @@ gtk_pizza_set_size (GtkPizza *pizza,
if (child->widget == widget) if (child->widget == widget)
{ {
gint new_x = x; if ((child->x == x) &&
if (gtk_widget_get_direction( GTK_WIDGET(pizza) ) == GTK_TEXT_DIR_RTL)
{
// reverse horizontal placement
new_x = pizza->m_width - new_x - width;
}
if ((child->x == new_x) &&
(child->y == y) && (child->y == y) &&
(child->width == width) && (child->width == width) &&
(child->height == height)) return; (child->height == height)) return;
child->x = new_x; child->x = x;
child->y = y; child->y = y;
child->width = width; child->width = width;
child->height = height; child->height = height;
if (GTK_IS_PIZZA(widget))
GTK_PIZZA(widget)->m_width = width;
gtk_widget_set_size_request (widget, width, height); gtk_widget_set_size_request (widget, width, height);
return; return;
@@ -578,6 +563,7 @@ gtk_pizza_size_allocate (GtkWidget *widget,
gint x,y,w,h; gint x,y,w,h;
GtkPizzaChild *child; GtkPizzaChild *child;
GList *children; GList *children;
gboolean only_resize;
g_return_if_fail (widget != NULL); g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_PIZZA(widget)); g_return_if_fail (GTK_IS_PIZZA(widget));
@@ -585,6 +571,8 @@ gtk_pizza_size_allocate (GtkWidget *widget,
pizza = GTK_PIZZA (widget); pizza = GTK_PIZZA (widget);
only_resize = ((widget->allocation.x == allocation->x) &&
(widget->allocation.y == allocation->y));
widget->allocation = *allocation; widget->allocation = *allocation;
if (pizza->shadow_type == GTK_MYSHADOW_NONE) if (pizza->shadow_type == GTK_MYSHADOW_NONE)
@@ -606,8 +594,12 @@ gtk_pizza_size_allocate (GtkWidget *widget,
if (GTK_WIDGET_REALIZED (widget)) if (GTK_WIDGET_REALIZED (widget))
{ {
if (only_resize)
gdk_window_resize( widget->window, w, h );
else
gdk_window_move_resize( widget->window, x, y, w, h ); gdk_window_move_resize( widget->window, x, y, w, h );
gdk_window_move_resize( pizza->bin_window, 0, 0, w, h );
gdk_window_resize( pizza->bin_window, w, h );
} }
children = pizza->children; children = pizza->children;
@@ -742,6 +734,13 @@ gtk_pizza_allocate_child (GtkPizza *pizza,
allocation.width = requisition.width; allocation.width = requisition.width;
allocation.height = requisition.height; allocation.height = requisition.height;
if (gtk_widget_get_direction( GTK_WIDGET(pizza) ) == GTK_TEXT_DIR_RTL)
{
/* reverse horizontal placement */
printf( "alloc width %d\n", GTK_WIDGET(pizza)->allocation.width );
allocation.x = GTK_WIDGET(pizza)->allocation.width - child->x - allocation.width - pizza->m_xoffset;
}
gtk_widget_size_allocate (child->widget, &allocation); gtk_widget_size_allocate (child->widget, &allocation);
} }

View File

@@ -2114,8 +2114,6 @@ void gtk_window_size_callback( GtkWidget *WXUNUSED(widget),
alloc->height ); alloc->height );
#endif #endif
GTK_PIZZA(win->m_wxwindow)->m_width = win->GetClientSize().x;
win->m_oldClientWidth = client_width; win->m_oldClientWidth = client_width;
win->m_oldClientHeight = client_height; win->m_oldClientHeight = client_height;