+
+bool wxWindow::Create( wxWindow *parent, wxWindowID id,
+ const wxPoint &pos, const wxSize &size,
+ long style, const wxString &name )
+{
+ m_isShown = FALSE;
+ m_isEnabled = TRUE;
+ m_needParent = TRUE;
+
+ PreCreation( parent, id, pos, size, style, name );
+
+ m_widget = gtk_scrolled_window_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL );
+ m_hasScrolling = TRUE;
+
+ GtkScrolledWindow *s_window = GTK_SCROLLED_WINDOW(m_widget);
+
+ gtk_signal_connect( GTK_OBJECT(s_window->vscrollbar), "button_press_event",
+ (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this );
+
+ gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_press_event",
+ (GtkSignalFunc)gtk_scrollbar_button_press_callback, (gpointer) this );
+
+ gtk_signal_connect( GTK_OBJECT(s_window->vscrollbar), "button_release_event",
+ (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this );
+
+ gtk_signal_connect( GTK_OBJECT(s_window->hscrollbar), "button_release_event",
+ (GtkSignalFunc)gtk_scrollbar_button_release_callback, (gpointer) this );
+
+ GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT(m_widget)->klass );
+ scroll_class->scrollbar_spacing = 0;
+
+ gtk_scrolled_window_set_policy( s_window, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+
+ m_oldHorizontalPos = 0.0;
+ m_oldVerticalPos = 0.0;
+
+ m_hAdjust = gtk_range_get_adjustment( GTK_RANGE(s_window->hscrollbar) );
+ m_vAdjust = gtk_range_get_adjustment( GTK_RANGE(s_window->vscrollbar) );
+
+ gtk_signal_connect( GTK_OBJECT(m_hAdjust), "value_changed",
+ (GtkSignalFunc) gtk_window_hscroll_callback, (gpointer) this );
+ gtk_signal_connect( GTK_OBJECT(m_vAdjust), "value_changed",
+ (GtkSignalFunc) gtk_window_vscroll_callback, (gpointer) this );
+
+ gtk_signal_connect( GTK_OBJECT(m_hAdjust), "changed",
+ (GtkSignalFunc) gtk_window_hscroll_change_callback, (gpointer) this );
+ gtk_signal_connect(GTK_OBJECT(m_vAdjust), "changed",
+ (GtkSignalFunc) gtk_window_vscroll_change_callback, (gpointer) this );
+
+ GtkViewport *viewport = GTK_VIEWPORT(s_window->viewport);
+
+ if (m_windowStyle & wxRAISED_BORDER)
+ {
+ gtk_viewport_set_shadow_type( viewport, GTK_SHADOW_OUT );
+ }
+ else if (m_windowStyle & wxSUNKEN_BORDER)
+ {
+ gtk_viewport_set_shadow_type( viewport, GTK_SHADOW_IN );
+ }
+ else
+ {
+ gtk_viewport_set_shadow_type( viewport, GTK_SHADOW_NONE );
+ }
+
+ m_wxwindow = gtk_myfixed_new();
+
+ GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
+
+ if (m_windowStyle & wxTAB_TRAVERSAL == wxTAB_TRAVERSAL)
+ GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
+ else
+ GTK_WIDGET_SET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
+
+ gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
+
+ // shut the viewport up
+ gtk_viewport_set_hadjustment( viewport, (GtkAdjustment*) gtk_adjustment_new( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) );
+ gtk_viewport_set_vadjustment( viewport, (GtkAdjustment*) gtk_adjustment_new( 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) );
+
+ // I _really_ don't want scrollbars in the beginning
+ m_vAdjust->lower = 0.0;
+ m_vAdjust->upper = 1.0;
+ m_vAdjust->value = 0.0;
+ m_vAdjust->step_increment = 1.0;
+ m_vAdjust->page_increment = 1.0;
+ m_vAdjust->page_size = 5.0;
+ gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" );
+ m_hAdjust->lower = 0.0;
+ m_hAdjust->upper = 1.0;
+ m_hAdjust->value = 0.0;
+ m_hAdjust->step_increment = 1.0;
+ m_hAdjust->page_increment = 1.0;
+ m_hAdjust->page_size = 5.0;
+ gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" );
+
+ gtk_widget_show( m_wxwindow );
+
+ if (m_parent) m_parent->AddChild( this );
+
+ (m_parent->m_insertCallback)( m_parent, this );
+
+ PostCreation();
+
+ Show( TRUE );
+
+ return TRUE;
+}
+
+wxWindow::~wxWindow()
+{
+ m_hasVMT = FALSE;
+
+ if (m_dropTarget) delete m_dropTarget;
+
+ if (m_parent) m_parent->RemoveChild( this );
+ if (m_widget) Show( FALSE );
+
+ DestroyChildren();
+
+ if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
+
+ if (m_scrollGC) gdk_gc_unref( m_scrollGC );
+
+ if (m_wxwindow) gtk_widget_destroy( m_wxwindow );
+
+ if (m_widget) gtk_widget_destroy( m_widget );
+
+ if (m_cursor) delete m_cursor;
+
+ DeleteRelatedConstraints();
+ if (m_constraints)
+ {
+ // This removes any dangling pointers to this window
+ // in other windows' constraintsInvolvedIn lists.
+ UnsetConstraints(m_constraints);
+ delete m_constraints;
+ m_constraints = (wxLayoutConstraints *) NULL;
+ }
+ if (m_windowSizer)
+ {
+ delete m_windowSizer;
+ m_windowSizer = (wxSizer *) NULL;
+ }
+ // If this is a child of a sizer, remove self from parent
+ if (m_sizerParent) m_sizerParent->RemoveChild((wxWindow *)this);
+
+ // Just in case the window has been Closed, but
+ // we're then deleting immediately: don't leave
+ // dangling pointers.
+ wxPendingDelete.DeleteObject(this);
+
+ // Just in case we've loaded a top-level window via
+ // wxWindow::LoadNativeDialog but we weren't a dialog
+ // class
+ wxTopLevelWindows.DeleteObject(this);