From 3e09bcfd02bdb2c1dcc561c8975b870806e69775 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sat, 7 Apr 2007 14:41:41 +0000 Subject: [PATCH] Restore border around non-scrolling widgets. The border seems to have the wrong colour now (?). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45301 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/win_gtk.h | 4 ++++ src/gtk/win_gtk.c | 29 ++++++++++++++++++++++++++++- src/gtk/window.cpp | 26 ++++++++++++++++++-------- 3 files changed, 50 insertions(+), 9 deletions(-) diff --git a/include/wx/gtk/win_gtk.h b/include/wx/gtk/win_gtk.h index 1bfeaa799e..a6c5180f4e 100644 --- a/include/wx/gtk/win_gtk.h +++ b/include/wx/gtk/win_gtk.h @@ -32,6 +32,8 @@ struct _GtkPizza guint m_xoffset; guint m_yoffset; + gboolean m_noscroll; + GdkWindow *bin_window; }; @@ -39,6 +41,8 @@ WXDLLIMPEXP_CORE GtkType gtk_pizza_get_type (void); WXDLLIMPEXP_CORE GtkWidget* gtk_pizza_new (void); +WXDLLIMPEXP_CORE +GtkWidget* gtk_pizza_new_no_scroll (void); /* accessors */ diff --git a/src/gtk/win_gtk.c b/src/gtk/win_gtk.c index caa1b5f497..f057e25f95 100644 --- a/src/gtk/win_gtk.c +++ b/src/gtk/win_gtk.c @@ -215,6 +215,20 @@ gtk_pizza_new () GtkPizza *pizza; pizza = g_object_new (gtk_pizza_get_type (), NULL); + + pizza->m_noscroll = FALSE; + + return GTK_WIDGET (pizza); +} + +GtkWidget* +gtk_pizza_new_no_scroll () +{ + GtkPizza *pizza; + + pizza = g_object_new (gtk_pizza_get_type (), NULL); + + pizza->m_noscroll = TRUE; return GTK_WIDGET (pizza); } @@ -555,7 +569,20 @@ gtk_pizza_size_allocate (GtkWidget *widget, if (h < 0) h = 0; - if (GTK_WIDGET_REALIZED (widget)) + if (!GTK_WIDGET_REALIZED (widget)) + return; + + if (pizza->m_noscroll) + { + if (only_resize) + gdk_window_resize( widget->window, allocation->width, allocation->height ); + else + gdk_window_move_resize( widget->window, allocation->x, allocation->y, + allocation->width, allocation->height ); + + gdk_window_move_resize( pizza->bin_window, border, border, w, h ); + } + else { if (only_resize) gdk_window_resize( widget->window, w, h ); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 4b64709e76..75a8c2df44 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2324,21 +2324,31 @@ bool wxWindowGTK::Create( wxWindow *parent, m_insertCallback = wxInsertChildInWindow; - m_wxwindow = gtk_pizza_new(); - -#ifndef __WXUNIVERSAL__ - if (HasFlag(wxSIMPLE_BORDER)) - gtk_container_set_border_width((GtkContainer*)m_wxwindow, 1); - else if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER)) - gtk_container_set_border_width((GtkContainer*)m_wxwindow, 2); -#endif // __WXUNIVERSAL__ if (!HasFlag(wxHSCROLL) && !HasFlag(wxVSCROLL)) { + m_wxwindow = gtk_pizza_new_no_scroll(); + +#ifndef __WXUNIVERSAL__ + if (HasFlag(wxSIMPLE_BORDER)) + gtk_container_set_border_width((GtkContainer*)m_wxwindow, 1); + else if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER)) + gtk_container_set_border_width((GtkContainer*)m_wxwindow, 2); +#endif // __WXUNIVERSAL__ + m_widget = m_wxwindow; } else { + m_wxwindow = gtk_pizza_new(); + +#ifndef __WXUNIVERSAL__ + if (HasFlag(wxSIMPLE_BORDER)) + gtk_container_set_border_width((GtkContainer*)m_wxwindow, 1); + else if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER)) + gtk_container_set_border_width((GtkContainer*)m_wxwindow, 2); +#endif // __WXUNIVERSAL__ + m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL ); GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);