Don't create GtkScrolledWindow if neither wxHSCROLL
or wxVSCROLL are defined. This prevents wasting some resources. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45193 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2323,6 +2323,22 @@ bool wxWindowGTK::Create( wxWindow *parent,
|
|||||||
|
|
||||||
m_insertCallback = wxInsertChildInWindow;
|
m_insertCallback = wxInsertChildInWindow;
|
||||||
|
|
||||||
|
if (!HasFlag(wxHSCROLL) && !HasFlag(wxVSCROLL))
|
||||||
|
{
|
||||||
|
m_widget = gtk_pizza_new();
|
||||||
|
|
||||||
|
m_wxwindow = m_widget;
|
||||||
|
|
||||||
|
#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__
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
|
m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
|
||||||
|
|
||||||
GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);
|
GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);
|
||||||
@@ -2330,8 +2346,7 @@ bool wxWindowGTK::Create( wxWindow *parent,
|
|||||||
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT_GET_CLASS(m_widget) );
|
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT_GET_CLASS(m_widget) );
|
||||||
scroll_class->scrollbar_spacing = 0;
|
scroll_class->scrollbar_spacing = 0;
|
||||||
|
|
||||||
// we create a GtkScrolledWindow for all windows, even those which don't
|
// There is a conflict with default bindings at GTK+
|
||||||
// use scrollbars, but there is a conflict with default bindings at GTK+
|
|
||||||
// level between scrolled windows and notebooks both of which want to use
|
// level between scrolled windows and notebooks both of which want to use
|
||||||
// Ctrl-PageUp/Down: scrolled windows for scrolling in the horizontal
|
// Ctrl-PageUp/Down: scrolled windows for scrolling in the horizontal
|
||||||
// direction and notebooks for changing pages -- we decide that if we don't
|
// direction and notebooks for changing pages -- we decide that if we don't
|
||||||
@@ -2397,6 +2412,7 @@ bool wxWindowGTK::Create( wxWindow *parent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gtk_widget_show( m_wxwindow );
|
gtk_widget_show( m_wxwindow );
|
||||||
|
}
|
||||||
|
|
||||||
if (m_parent)
|
if (m_parent)
|
||||||
m_parent->DoAddChild( this );
|
m_parent->DoAddChild( this );
|
||||||
@@ -2442,7 +2458,7 @@ wxWindowGTK::~wxWindowGTK()
|
|||||||
// delete before the widgets to avoid a crash on solaris
|
// delete before the widgets to avoid a crash on solaris
|
||||||
delete m_imData;
|
delete m_imData;
|
||||||
|
|
||||||
if (m_wxwindow)
|
if (m_wxwindow && (m_wxwindow != m_widget))
|
||||||
{
|
{
|
||||||
gtk_widget_destroy( m_wxwindow );
|
gtk_widget_destroy( m_wxwindow );
|
||||||
m_wxwindow = (GtkWidget*) NULL;
|
m_wxwindow = (GtkWidget*) NULL;
|
||||||
@@ -2527,7 +2543,7 @@ void wxWindowGTK::PostCreation()
|
|||||||
if ( !AcceptsFocusFromKeyboard() )
|
if ( !AcceptsFocusFromKeyboard() )
|
||||||
{
|
{
|
||||||
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
|
||||||
if ( m_wxwindow )
|
if (m_wxwindow && (m_widget != m_wxwindow))
|
||||||
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
|
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
|
||||||
|
|
||||||
g_signal_connect(m_widget, "focus",
|
g_signal_connect(m_widget, "focus",
|
||||||
@@ -2807,7 +2823,7 @@ void wxWindowGTK::OnInternalIdle()
|
|||||||
windows above so that checking for the current cursor is
|
windows above so that checking for the current cursor is
|
||||||
not possible. */
|
not possible. */
|
||||||
|
|
||||||
if (m_wxwindow)
|
if (m_wxwindow && (m_wxwindow != m_widget))
|
||||||
{
|
{
|
||||||
GdkWindow *window = GTK_PIZZA(m_wxwindow)->bin_window;
|
GdkWindow *window = GTK_PIZZA(m_wxwindow)->bin_window;
|
||||||
if (window)
|
if (window)
|
||||||
@@ -3044,7 +3060,7 @@ void wxWindowGTK::DoEnable( bool enable )
|
|||||||
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
|
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
|
||||||
|
|
||||||
gtk_widget_set_sensitive( m_widget, enable );
|
gtk_widget_set_sensitive( m_widget, enable );
|
||||||
if ( m_wxwindow )
|
if (m_wxwindow && (m_wxwindow != m_widget))
|
||||||
gtk_widget_set_sensitive( m_wxwindow, enable );
|
gtk_widget_set_sensitive( m_wxwindow, enable );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3355,7 +3371,7 @@ void wxWindowGTK::SetLayoutDirection(wxLayoutDirection dir)
|
|||||||
|
|
||||||
GTKSetLayout(m_widget, dir);
|
GTKSetLayout(m_widget, dir);
|
||||||
|
|
||||||
if (m_wxwindow)
|
if (m_wxwindow && (m_wxwindow != m_widget))
|
||||||
GTKSetLayout(m_wxwindow, dir);
|
GTKSetLayout(m_wxwindow, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3647,7 +3663,7 @@ void wxWindowGTK::GtkUpdate()
|
|||||||
{
|
{
|
||||||
if (m_wxwindow && GTK_PIZZA(m_wxwindow)->bin_window)
|
if (m_wxwindow && GTK_PIZZA(m_wxwindow)->bin_window)
|
||||||
gdk_window_process_updates( GTK_PIZZA(m_wxwindow)->bin_window, FALSE );
|
gdk_window_process_updates( GTK_PIZZA(m_wxwindow)->bin_window, FALSE );
|
||||||
if (m_widget && m_widget->window)
|
if (m_widget && m_widget->window && (m_wxwindow != m_widget))
|
||||||
gdk_window_process_updates( m_widget->window, FALSE );
|
gdk_window_process_updates( m_widget->window, FALSE );
|
||||||
|
|
||||||
// for consistency with other platforms (and also because it's convenient
|
// for consistency with other platforms (and also because it's convenient
|
||||||
@@ -4123,6 +4139,7 @@ void wxWindowGTK::SetScrollbar(int orient,
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
|
wxCHECK_RET( m_widget != NULL, wxT("invalid window") );
|
||||||
wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
|
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") );
|
||||||
|
|
||||||
if (range > 0)
|
if (range > 0)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user