From c91922129fbedcb65905d148b7e2393e56dbdf4a Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Tue, 3 Apr 2007 02:15:02 +0000 Subject: [PATCH] more checks for non-scrolling windows, some code duplication cleanup git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45231 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 81ae393be9..83368e7c24 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2322,20 +2322,19 @@ bool wxWindowGTK::Create( wxWindow *parent, } m_insertCallback = wxInsertChildInWindow; - - if (!HasFlag(wxHSCROLL) && !HasFlag(wxVSCROLL)) - { - m_widget = gtk_pizza_new(); - - m_wxwindow = m_widget; - + + 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); + 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_widget = m_wxwindow; } else { @@ -2380,15 +2379,6 @@ bool wxWindowGTK::Create( wxWindow *parent, if (GetLayoutDirection() == wxLayout_RightToLeft) gtk_range_set_inverted( m_scrollBar[ScrollDir_Horz], TRUE ); - 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__ - gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow ); // connect various scroll-related events @@ -4169,6 +4159,7 @@ void wxWindowGTK::SetScrollPos(int orient, int pos, bool WXUNUSED(refresh)) { wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); + wxCHECK_RET( m_wxwindow != m_widget, wxT("no scrolling for this wxWindow, use wxHSCROLL or wxVSCROLL") ); // This check is more than an optimization. Without it, the slider // will not move smoothly while tracking when using wxScrollHelper. @@ -4195,6 +4186,7 @@ int wxWindowGTK::GetScrollThumb(int orient) const { wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") ); wxCHECK_MSG( m_wxwindow != NULL, 0, wxT("window needs client area for scrolling") ); + wxCHECK_MSG( m_wxwindow != m_widget, 0, wxT("no scrolling for this wxWindow, use wxHSCROLL or wxVSCROLL") ); return int(m_scrollBar[ScrollDirFromOrient(orient)]->adjustment->page_size); } @@ -4203,6 +4195,7 @@ int wxWindowGTK::GetScrollPos( int orient ) const { wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") ); wxCHECK_MSG( m_wxwindow != NULL, 0, wxT("window needs client area for scrolling") ); + wxCHECK_MSG( m_wxwindow != m_widget, 0, wxT("no scrolling for this wxWindow, use wxHSCROLL or wxVSCROLL") ); return int(m_scrollBar[ScrollDirFromOrient(orient)]->adjustment->value + 0.5); } @@ -4211,6 +4204,7 @@ int wxWindowGTK::GetScrollRange( int orient ) const { wxCHECK_MSG( m_widget != NULL, 0, wxT("invalid window") ); wxCHECK_MSG( m_wxwindow != NULL, 0, wxT("window needs client area for scrolling") ); + wxCHECK_MSG( m_wxwindow != m_widget, 0, wxT("no scrolling for this wxWindow, use wxHSCROLL or wxVSCROLL") ); return int(m_scrollBar[ScrollDirFromOrient(orient)]->adjustment->upper); } -- 2.45.2