MDI fixes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1703 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -114,6 +114,7 @@ public:
|
|||||||
virtual void OnInternalIdle();
|
virtual void OnInternalIdle();
|
||||||
|
|
||||||
wxMenuBar *m_frameMenuBar;
|
wxMenuBar *m_frameMenuBar;
|
||||||
|
wxMenuBar *m_mdiMenuBar;
|
||||||
wxStatusBar *m_frameStatusBar;
|
wxStatusBar *m_frameStatusBar;
|
||||||
wxToolBar *m_frameToolBar;
|
wxToolBar *m_frameToolBar;
|
||||||
wxString m_title;
|
wxString m_title;
|
||||||
|
@@ -90,7 +90,6 @@ class wxMDIParentFrame: public wxFrame
|
|||||||
|
|
||||||
wxMDIClientWindow *m_clientWindow;
|
wxMDIClientWindow *m_clientWindow;
|
||||||
bool m_parentFrameActive;
|
bool m_parentFrameActive;
|
||||||
wxMenuBar *m_mdiMenuBar;
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@@ -114,6 +114,7 @@ public:
|
|||||||
virtual void OnInternalIdle();
|
virtual void OnInternalIdle();
|
||||||
|
|
||||||
wxMenuBar *m_frameMenuBar;
|
wxMenuBar *m_frameMenuBar;
|
||||||
|
wxMenuBar *m_mdiMenuBar;
|
||||||
wxStatusBar *m_frameStatusBar;
|
wxStatusBar *m_frameStatusBar;
|
||||||
wxToolBar *m_frameToolBar;
|
wxToolBar *m_frameToolBar;
|
||||||
wxString m_title;
|
wxString m_title;
|
||||||
|
@@ -90,7 +90,6 @@ class wxMDIParentFrame: public wxFrame
|
|||||||
|
|
||||||
wxMDIClientWindow *m_clientWindow;
|
wxMDIClientWindow *m_clientWindow;
|
||||||
bool m_parentFrameActive;
|
bool m_parentFrameActive;
|
||||||
wxMenuBar *m_mdiMenuBar;
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@@ -113,6 +113,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow)
|
|||||||
wxFrame::wxFrame()
|
wxFrame::wxFrame()
|
||||||
{
|
{
|
||||||
m_frameMenuBar = (wxMenuBar *) NULL;
|
m_frameMenuBar = (wxMenuBar *) NULL;
|
||||||
|
m_mdiMenuBar = (wxMenuBar *) NULL;
|
||||||
m_frameStatusBar = (wxStatusBar *) NULL;
|
m_frameStatusBar = (wxStatusBar *) NULL;
|
||||||
m_frameToolBar = (wxToolBar *) NULL;
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
@@ -125,6 +126,7 @@ wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
long style, const wxString &name )
|
long style, const wxString &name )
|
||||||
{
|
{
|
||||||
m_frameMenuBar = (wxMenuBar *) NULL;
|
m_frameMenuBar = (wxMenuBar *) NULL;
|
||||||
|
m_mdiMenuBar = (wxMenuBar *) NULL;
|
||||||
m_frameStatusBar = (wxStatusBar *) NULL;
|
m_frameStatusBar = (wxStatusBar *) NULL;
|
||||||
m_frameToolBar = (wxToolBar *) NULL;
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
@@ -193,8 +195,13 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
wxFrame::~wxFrame()
|
wxFrame::~wxFrame()
|
||||||
{
|
{
|
||||||
if (m_frameMenuBar) delete m_frameMenuBar;
|
if (m_frameMenuBar) delete m_frameMenuBar;
|
||||||
|
m_frameMenuBar = (wxMenuBar *) NULL;
|
||||||
|
|
||||||
if (m_frameStatusBar) delete m_frameStatusBar;
|
if (m_frameStatusBar) delete m_frameStatusBar;
|
||||||
|
m_frameStatusBar = (wxStatusBar *) NULL;
|
||||||
|
|
||||||
if (m_frameToolBar) delete m_frameToolBar;
|
if (m_frameToolBar) delete m_frameToolBar;
|
||||||
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
|
|
||||||
wxTopLevelWindows.DeleteObject( this );
|
wxTopLevelWindows.DeleteObject( this );
|
||||||
|
|
||||||
@@ -215,10 +222,10 @@ bool wxFrame::Show( bool show )
|
|||||||
|
|
||||||
if (show && !m_sizeSet)
|
if (show && !m_sizeSet)
|
||||||
{
|
{
|
||||||
// by calling GtkOnSize here, we don't have to call
|
/* by calling GtkOnSize here, we don't have to call
|
||||||
// either after showing the frame, which would entail
|
either after showing the frame, which would entail
|
||||||
// much ugly flicker nor from within the size_allocate
|
much ugly flicker nor from within the size_allocate
|
||||||
// handler, because GTK 1.1.X forbids that.
|
handler, because GTK 1.1.X forbids that. */
|
||||||
|
|
||||||
GtkOnSize( m_x, m_y, m_width, m_height );
|
GtkOnSize( m_x, m_y, m_width, m_height );
|
||||||
}
|
}
|
||||||
@@ -257,7 +264,7 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
|
|||||||
{
|
{
|
||||||
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
||||||
|
|
||||||
// Don't do anything for children of wxMDIChildFrame
|
/* Don't do anything for children of wxMDIChildFrame */
|
||||||
if (!m_wxwindow) return;
|
if (!m_wxwindow) return;
|
||||||
|
|
||||||
if (m_resizing) return; // I don't like recursions
|
if (m_resizing) return; // I don't like recursions
|
||||||
@@ -413,12 +420,12 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
|||||||
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy );
|
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy );
|
||||||
gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh );
|
gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_frameToolBar)
|
if (m_frameToolBar)
|
||||||
{
|
{
|
||||||
int xx = m_miniEdge;
|
int xx = m_miniEdge;
|
||||||
int yy = m_miniEdge + m_miniTitle;
|
int yy = m_miniEdge + m_miniTitle;
|
||||||
if (m_frameMenuBar) yy += wxMENU_HEIGHT;
|
if ((m_frameMenuBar) || (m_mdiMenuBar)) yy += wxMENU_HEIGHT;
|
||||||
int ww = m_width - 2*m_miniEdge;
|
int ww = m_width - 2*m_miniEdge;
|
||||||
int hh = m_frameToolBar->m_height;
|
int hh = m_frameToolBar->m_height;
|
||||||
|
|
||||||
@@ -556,6 +563,9 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
|
|||||||
m_frameMenuBar->m_parent = this;
|
m_frameMenuBar->m_parent = this;
|
||||||
gtk_myfixed_put( GTK_MYFIXED(m_wxwindow),
|
gtk_myfixed_put( GTK_MYFIXED(m_wxwindow),
|
||||||
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
|
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
|
||||||
|
|
||||||
|
/* an mdi child menu bar might be underneath */
|
||||||
|
if (m_mdiMenuBar) m_frameMenuBar->Show( FALSE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -52,7 +52,7 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// page change callback
|
// "switch_page"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void gtk_page_change_callback( GtkNotebook *WXUNUSED(widget),
|
static void gtk_page_change_callback( GtkNotebook *WXUNUSED(widget),
|
||||||
@@ -135,8 +135,12 @@ void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height )
|
|||||||
|
|
||||||
void wxMDIParentFrame::SetMDIMenuBar( wxMenuBar *menu_bar )
|
void wxMDIParentFrame::SetMDIMenuBar( wxMenuBar *menu_bar )
|
||||||
{
|
{
|
||||||
|
/* hide old child menu bar */
|
||||||
if (m_mdiMenuBar) m_mdiMenuBar->Show( FALSE );
|
if (m_mdiMenuBar) m_mdiMenuBar->Show( FALSE );
|
||||||
|
|
||||||
m_mdiMenuBar = menu_bar;
|
m_mdiMenuBar = menu_bar;
|
||||||
|
|
||||||
|
/* show and resize new menu child menu bar */
|
||||||
if (m_mdiMenuBar)
|
if (m_mdiMenuBar)
|
||||||
{
|
{
|
||||||
m_mdiMenuBar->m_x = 0;
|
m_mdiMenuBar->m_x = 0;
|
||||||
@@ -147,6 +151,9 @@ void wxMDIParentFrame::SetMDIMenuBar( wxMenuBar *menu_bar )
|
|||||||
gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT );
|
gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT );
|
||||||
m_mdiMenuBar->Show( TRUE );
|
m_mdiMenuBar->Show( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* show/hide parent menu bar as required */
|
||||||
|
if (m_frameMenuBar) m_frameMenuBar->Show( (m_mdiMenuBar == NULL) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
|
void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
|
||||||
@@ -283,10 +290,11 @@ void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
|
|||||||
|
|
||||||
m_menuBar->m_parent = mdi_frame;
|
m_menuBar->m_parent = mdi_frame;
|
||||||
}
|
}
|
||||||
mdi_frame->SetMDIMenuBar( m_menuBar );
|
|
||||||
|
|
||||||
gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_wxwindow),
|
gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_wxwindow),
|
||||||
m_menuBar->m_widget, m_menuBar->m_x, m_menuBar->m_y );
|
m_menuBar->m_widget, m_menuBar->m_x, m_menuBar->m_y );
|
||||||
|
|
||||||
|
mdi_frame->SetMDIMenuBar( m_menuBar );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1537,18 +1537,27 @@ wxWindow::~wxWindow()
|
|||||||
m_hasVMT = FALSE;
|
m_hasVMT = FALSE;
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
wxDELETE(m_dropTarget);
|
if (m_dropTarget)
|
||||||
|
{
|
||||||
|
delete m_dropTarget;
|
||||||
|
m_dropTarget = (wxDropTarget*) NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
wxDELETE(m_toolTip);
|
if (m_toolTip)
|
||||||
|
{
|
||||||
|
delete m_toolTip;
|
||||||
|
m_toolTip = (wxToolTip*) NULL;
|
||||||
|
}
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
if (m_parent) m_parent->RemoveChild( this );
|
|
||||||
if (m_widget) Show( FALSE );
|
if (m_widget) Show( FALSE );
|
||||||
|
|
||||||
DestroyChildren();
|
DestroyChildren();
|
||||||
|
|
||||||
|
if (m_parent) m_parent->RemoveChild( this );
|
||||||
|
|
||||||
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
|
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
|
||||||
|
|
||||||
if (m_scrollGC) gdk_gc_unref( m_scrollGC );
|
if (m_scrollGC) gdk_gc_unref( m_scrollGC );
|
||||||
@@ -1562,28 +1571,29 @@ wxWindow::~wxWindow()
|
|||||||
DeleteRelatedConstraints();
|
DeleteRelatedConstraints();
|
||||||
if (m_constraints)
|
if (m_constraints)
|
||||||
{
|
{
|
||||||
// This removes any dangling pointers to this window
|
/* This removes any dangling pointers to this window
|
||||||
// in other windows' constraintsInvolvedIn lists.
|
* in other windows' constraintsInvolvedIn lists. */
|
||||||
UnsetConstraints(m_constraints);
|
UnsetConstraints(m_constraints);
|
||||||
delete m_constraints;
|
delete m_constraints;
|
||||||
m_constraints = (wxLayoutConstraints *) NULL;
|
m_constraints = (wxLayoutConstraints *) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_windowSizer)
|
if (m_windowSizer)
|
||||||
{
|
{
|
||||||
delete m_windowSizer;
|
delete m_windowSizer;
|
||||||
m_windowSizer = (wxSizer *) NULL;
|
m_windowSizer = (wxSizer *) NULL;
|
||||||
}
|
}
|
||||||
// If this is a child of a sizer, remove self from parent
|
/* If this is a child of a sizer, remove self from parent */
|
||||||
if (m_sizerParent) m_sizerParent->RemoveChild((wxWindow *)this);
|
if (m_sizerParent) m_sizerParent->RemoveChild((wxWindow *)this);
|
||||||
|
|
||||||
// Just in case the window has been Closed, but
|
/* Just in case the window has been Closed, but
|
||||||
// we're then deleting immediately: don't leave
|
* we're then deleting immediately: don't leave
|
||||||
// dangling pointers.
|
* dangling pointers. */
|
||||||
wxPendingDelete.DeleteObject(this);
|
wxPendingDelete.DeleteObject(this);
|
||||||
|
|
||||||
// Just in case we've loaded a top-level window via
|
/* Just in case we've loaded a top-level window via
|
||||||
// wxWindow::LoadNativeDialog but we weren't a dialog
|
* wxWindow::LoadNativeDialog but we weren't a dialog
|
||||||
// class
|
* class */
|
||||||
wxTopLevelWindows.DeleteObject(this);
|
wxTopLevelWindows.DeleteObject(this);
|
||||||
|
|
||||||
if (m_windowValidator) delete m_windowValidator;
|
if (m_windowValidator) delete m_windowValidator;
|
||||||
@@ -1611,7 +1621,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
|||||||
m_x = (int)pos.x;
|
m_x = (int)pos.x;
|
||||||
m_y = (int)pos.y;
|
m_y = (int)pos.y;
|
||||||
|
|
||||||
if (!m_needParent) // some reasonable defaults
|
if (!m_needParent) /* some reasonable defaults */
|
||||||
{
|
{
|
||||||
if (m_x == -1)
|
if (m_x == -1)
|
||||||
{
|
{
|
||||||
@@ -1744,8 +1754,8 @@ bool wxWindow::Close( bool force )
|
|||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
event.SetCanVeto(!force);
|
event.SetCanVeto(!force);
|
||||||
|
|
||||||
// return FALSE if window wasn't closed because the application vetoed the
|
/* return FALSE if window wasn't closed because the application vetoed the
|
||||||
// close event
|
* close event */
|
||||||
return GetEventHandler()->ProcessEvent(event) && !event.GetVeto();
|
return GetEventHandler()->ProcessEvent(event) && !event.GetVeto();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1798,12 +1808,12 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
|
|||||||
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
||||||
wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" );
|
wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" );
|
||||||
|
|
||||||
if (m_resizing) return; // I don't like recursions
|
if (m_resizing) return; /* I don't like recursions */
|
||||||
m_resizing = TRUE;
|
m_resizing = TRUE;
|
||||||
|
|
||||||
if (m_parent->m_wxwindow == NULL) // i.e. wxNotebook
|
if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */
|
||||||
{
|
{
|
||||||
// don't set the size for children of wxNotebook, just take the values.
|
/* don't set the size for children of wxNotebook, just take the values. */
|
||||||
m_x = x;
|
m_x = x;
|
||||||
m_y = y;
|
m_y = y;
|
||||||
m_width = width;
|
m_width = width;
|
||||||
@@ -2160,6 +2170,8 @@ bool wxWindow::Show( bool show )
|
|||||||
{
|
{
|
||||||
wxCHECK_MSG( (m_widget != NULL), FALSE, "invalid window" );
|
wxCHECK_MSG( (m_widget != NULL), FALSE, "invalid window" );
|
||||||
|
|
||||||
|
if (show == m_isShown) return TRUE;
|
||||||
|
|
||||||
if (show)
|
if (show)
|
||||||
gtk_widget_show( m_widget );
|
gtk_widget_show( m_widget );
|
||||||
else
|
else
|
||||||
|
@@ -113,6 +113,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow)
|
|||||||
wxFrame::wxFrame()
|
wxFrame::wxFrame()
|
||||||
{
|
{
|
||||||
m_frameMenuBar = (wxMenuBar *) NULL;
|
m_frameMenuBar = (wxMenuBar *) NULL;
|
||||||
|
m_mdiMenuBar = (wxMenuBar *) NULL;
|
||||||
m_frameStatusBar = (wxStatusBar *) NULL;
|
m_frameStatusBar = (wxStatusBar *) NULL;
|
||||||
m_frameToolBar = (wxToolBar *) NULL;
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
@@ -125,6 +126,7 @@ wxFrame::wxFrame( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
long style, const wxString &name )
|
long style, const wxString &name )
|
||||||
{
|
{
|
||||||
m_frameMenuBar = (wxMenuBar *) NULL;
|
m_frameMenuBar = (wxMenuBar *) NULL;
|
||||||
|
m_mdiMenuBar = (wxMenuBar *) NULL;
|
||||||
m_frameStatusBar = (wxStatusBar *) NULL;
|
m_frameStatusBar = (wxStatusBar *) NULL;
|
||||||
m_frameToolBar = (wxToolBar *) NULL;
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
m_sizeSet = FALSE;
|
m_sizeSet = FALSE;
|
||||||
@@ -193,8 +195,13 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
|
|||||||
wxFrame::~wxFrame()
|
wxFrame::~wxFrame()
|
||||||
{
|
{
|
||||||
if (m_frameMenuBar) delete m_frameMenuBar;
|
if (m_frameMenuBar) delete m_frameMenuBar;
|
||||||
|
m_frameMenuBar = (wxMenuBar *) NULL;
|
||||||
|
|
||||||
if (m_frameStatusBar) delete m_frameStatusBar;
|
if (m_frameStatusBar) delete m_frameStatusBar;
|
||||||
|
m_frameStatusBar = (wxStatusBar *) NULL;
|
||||||
|
|
||||||
if (m_frameToolBar) delete m_frameToolBar;
|
if (m_frameToolBar) delete m_frameToolBar;
|
||||||
|
m_frameToolBar = (wxToolBar *) NULL;
|
||||||
|
|
||||||
wxTopLevelWindows.DeleteObject( this );
|
wxTopLevelWindows.DeleteObject( this );
|
||||||
|
|
||||||
@@ -215,10 +222,10 @@ bool wxFrame::Show( bool show )
|
|||||||
|
|
||||||
if (show && !m_sizeSet)
|
if (show && !m_sizeSet)
|
||||||
{
|
{
|
||||||
// by calling GtkOnSize here, we don't have to call
|
/* by calling GtkOnSize here, we don't have to call
|
||||||
// either after showing the frame, which would entail
|
either after showing the frame, which would entail
|
||||||
// much ugly flicker nor from within the size_allocate
|
much ugly flicker nor from within the size_allocate
|
||||||
// handler, because GTK 1.1.X forbids that.
|
handler, because GTK 1.1.X forbids that. */
|
||||||
|
|
||||||
GtkOnSize( m_x, m_y, m_width, m_height );
|
GtkOnSize( m_x, m_y, m_width, m_height );
|
||||||
}
|
}
|
||||||
@@ -257,7 +264,7 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
|
|||||||
{
|
{
|
||||||
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
||||||
|
|
||||||
// Don't do anything for children of wxMDIChildFrame
|
/* Don't do anything for children of wxMDIChildFrame */
|
||||||
if (!m_wxwindow) return;
|
if (!m_wxwindow) return;
|
||||||
|
|
||||||
if (m_resizing) return; // I don't like recursions
|
if (m_resizing) return; // I don't like recursions
|
||||||
@@ -413,12 +420,12 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
|
|||||||
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy );
|
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameMenuBar->m_widget, xx, yy );
|
||||||
gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh );
|
gtk_widget_set_usize( m_frameMenuBar->m_widget, ww, hh );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_frameToolBar)
|
if (m_frameToolBar)
|
||||||
{
|
{
|
||||||
int xx = m_miniEdge;
|
int xx = m_miniEdge;
|
||||||
int yy = m_miniEdge + m_miniTitle;
|
int yy = m_miniEdge + m_miniTitle;
|
||||||
if (m_frameMenuBar) yy += wxMENU_HEIGHT;
|
if ((m_frameMenuBar) || (m_mdiMenuBar)) yy += wxMENU_HEIGHT;
|
||||||
int ww = m_width - 2*m_miniEdge;
|
int ww = m_width - 2*m_miniEdge;
|
||||||
int hh = m_frameToolBar->m_height;
|
int hh = m_frameToolBar->m_height;
|
||||||
|
|
||||||
@@ -556,6 +563,9 @@ void wxFrame::SetMenuBar( wxMenuBar *menuBar )
|
|||||||
m_frameMenuBar->m_parent = this;
|
m_frameMenuBar->m_parent = this;
|
||||||
gtk_myfixed_put( GTK_MYFIXED(m_wxwindow),
|
gtk_myfixed_put( GTK_MYFIXED(m_wxwindow),
|
||||||
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
|
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
|
||||||
|
|
||||||
|
/* an mdi child menu bar might be underneath */
|
||||||
|
if (m_mdiMenuBar) m_frameMenuBar->Show( FALSE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -52,7 +52,7 @@ static void gtk_page_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// page change callback
|
// "switch_page"
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void gtk_page_change_callback( GtkNotebook *WXUNUSED(widget),
|
static void gtk_page_change_callback( GtkNotebook *WXUNUSED(widget),
|
||||||
@@ -135,8 +135,12 @@ void wxMDIParentFrame::GtkOnSize( int x, int y, int width, int height )
|
|||||||
|
|
||||||
void wxMDIParentFrame::SetMDIMenuBar( wxMenuBar *menu_bar )
|
void wxMDIParentFrame::SetMDIMenuBar( wxMenuBar *menu_bar )
|
||||||
{
|
{
|
||||||
|
/* hide old child menu bar */
|
||||||
if (m_mdiMenuBar) m_mdiMenuBar->Show( FALSE );
|
if (m_mdiMenuBar) m_mdiMenuBar->Show( FALSE );
|
||||||
|
|
||||||
m_mdiMenuBar = menu_bar;
|
m_mdiMenuBar = menu_bar;
|
||||||
|
|
||||||
|
/* show and resize new menu child menu bar */
|
||||||
if (m_mdiMenuBar)
|
if (m_mdiMenuBar)
|
||||||
{
|
{
|
||||||
m_mdiMenuBar->m_x = 0;
|
m_mdiMenuBar->m_x = 0;
|
||||||
@@ -147,6 +151,9 @@ void wxMDIParentFrame::SetMDIMenuBar( wxMenuBar *menu_bar )
|
|||||||
gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT );
|
gtk_widget_set_usize( m_mdiMenuBar->m_widget, m_width, wxMENU_HEIGHT );
|
||||||
m_mdiMenuBar->Show( TRUE );
|
m_mdiMenuBar->Show( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* show/hide parent menu bar as required */
|
||||||
|
if (m_frameMenuBar) m_frameMenuBar->Show( (m_mdiMenuBar == NULL) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
|
void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
|
||||||
@@ -283,10 +290,11 @@ void wxMDIChildFrame::SetMenuBar( wxMenuBar *menu_bar )
|
|||||||
|
|
||||||
m_menuBar->m_parent = mdi_frame;
|
m_menuBar->m_parent = mdi_frame;
|
||||||
}
|
}
|
||||||
mdi_frame->SetMDIMenuBar( m_menuBar );
|
|
||||||
|
|
||||||
gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_wxwindow),
|
gtk_myfixed_put( GTK_MYFIXED(mdi_frame->m_wxwindow),
|
||||||
m_menuBar->m_widget, m_menuBar->m_x, m_menuBar->m_y );
|
m_menuBar->m_widget, m_menuBar->m_x, m_menuBar->m_y );
|
||||||
|
|
||||||
|
mdi_frame->SetMDIMenuBar( m_menuBar );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1537,18 +1537,27 @@ wxWindow::~wxWindow()
|
|||||||
m_hasVMT = FALSE;
|
m_hasVMT = FALSE;
|
||||||
|
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
wxDELETE(m_dropTarget);
|
if (m_dropTarget)
|
||||||
|
{
|
||||||
|
delete m_dropTarget;
|
||||||
|
m_dropTarget = (wxDropTarget*) NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_TOOLTIPS
|
#if wxUSE_TOOLTIPS
|
||||||
wxDELETE(m_toolTip);
|
if (m_toolTip)
|
||||||
|
{
|
||||||
|
delete m_toolTip;
|
||||||
|
m_toolTip = (wxToolTip*) NULL;
|
||||||
|
}
|
||||||
#endif // wxUSE_TOOLTIPS
|
#endif // wxUSE_TOOLTIPS
|
||||||
|
|
||||||
if (m_parent) m_parent->RemoveChild( this );
|
|
||||||
if (m_widget) Show( FALSE );
|
if (m_widget) Show( FALSE );
|
||||||
|
|
||||||
DestroyChildren();
|
DestroyChildren();
|
||||||
|
|
||||||
|
if (m_parent) m_parent->RemoveChild( this );
|
||||||
|
|
||||||
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
|
if (m_widgetStyle) gtk_style_unref( m_widgetStyle );
|
||||||
|
|
||||||
if (m_scrollGC) gdk_gc_unref( m_scrollGC );
|
if (m_scrollGC) gdk_gc_unref( m_scrollGC );
|
||||||
@@ -1562,28 +1571,29 @@ wxWindow::~wxWindow()
|
|||||||
DeleteRelatedConstraints();
|
DeleteRelatedConstraints();
|
||||||
if (m_constraints)
|
if (m_constraints)
|
||||||
{
|
{
|
||||||
// This removes any dangling pointers to this window
|
/* This removes any dangling pointers to this window
|
||||||
// in other windows' constraintsInvolvedIn lists.
|
* in other windows' constraintsInvolvedIn lists. */
|
||||||
UnsetConstraints(m_constraints);
|
UnsetConstraints(m_constraints);
|
||||||
delete m_constraints;
|
delete m_constraints;
|
||||||
m_constraints = (wxLayoutConstraints *) NULL;
|
m_constraints = (wxLayoutConstraints *) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_windowSizer)
|
if (m_windowSizer)
|
||||||
{
|
{
|
||||||
delete m_windowSizer;
|
delete m_windowSizer;
|
||||||
m_windowSizer = (wxSizer *) NULL;
|
m_windowSizer = (wxSizer *) NULL;
|
||||||
}
|
}
|
||||||
// If this is a child of a sizer, remove self from parent
|
/* If this is a child of a sizer, remove self from parent */
|
||||||
if (m_sizerParent) m_sizerParent->RemoveChild((wxWindow *)this);
|
if (m_sizerParent) m_sizerParent->RemoveChild((wxWindow *)this);
|
||||||
|
|
||||||
// Just in case the window has been Closed, but
|
/* Just in case the window has been Closed, but
|
||||||
// we're then deleting immediately: don't leave
|
* we're then deleting immediately: don't leave
|
||||||
// dangling pointers.
|
* dangling pointers. */
|
||||||
wxPendingDelete.DeleteObject(this);
|
wxPendingDelete.DeleteObject(this);
|
||||||
|
|
||||||
// Just in case we've loaded a top-level window via
|
/* Just in case we've loaded a top-level window via
|
||||||
// wxWindow::LoadNativeDialog but we weren't a dialog
|
* wxWindow::LoadNativeDialog but we weren't a dialog
|
||||||
// class
|
* class */
|
||||||
wxTopLevelWindows.DeleteObject(this);
|
wxTopLevelWindows.DeleteObject(this);
|
||||||
|
|
||||||
if (m_windowValidator) delete m_windowValidator;
|
if (m_windowValidator) delete m_windowValidator;
|
||||||
@@ -1611,7 +1621,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
|
|||||||
m_x = (int)pos.x;
|
m_x = (int)pos.x;
|
||||||
m_y = (int)pos.y;
|
m_y = (int)pos.y;
|
||||||
|
|
||||||
if (!m_needParent) // some reasonable defaults
|
if (!m_needParent) /* some reasonable defaults */
|
||||||
{
|
{
|
||||||
if (m_x == -1)
|
if (m_x == -1)
|
||||||
{
|
{
|
||||||
@@ -1744,8 +1754,8 @@ bool wxWindow::Close( bool force )
|
|||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
event.SetCanVeto(!force);
|
event.SetCanVeto(!force);
|
||||||
|
|
||||||
// return FALSE if window wasn't closed because the application vetoed the
|
/* return FALSE if window wasn't closed because the application vetoed the
|
||||||
// close event
|
* close event */
|
||||||
return GetEventHandler()->ProcessEvent(event) && !event.GetVeto();
|
return GetEventHandler()->ProcessEvent(event) && !event.GetVeto();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1798,12 +1808,12 @@ void wxWindow::SetSize( int x, int y, int width, int height, int sizeFlags )
|
|||||||
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
wxASSERT_MSG( (m_widget != NULL), "invalid window" );
|
||||||
wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" );
|
wxASSERT_MSG( (m_parent != NULL), "wxWindow::SetSize requires parent.\n" );
|
||||||
|
|
||||||
if (m_resizing) return; // I don't like recursions
|
if (m_resizing) return; /* I don't like recursions */
|
||||||
m_resizing = TRUE;
|
m_resizing = TRUE;
|
||||||
|
|
||||||
if (m_parent->m_wxwindow == NULL) // i.e. wxNotebook
|
if (m_parent->m_wxwindow == NULL) /* i.e. wxNotebook */
|
||||||
{
|
{
|
||||||
// don't set the size for children of wxNotebook, just take the values.
|
/* don't set the size for children of wxNotebook, just take the values. */
|
||||||
m_x = x;
|
m_x = x;
|
||||||
m_y = y;
|
m_y = y;
|
||||||
m_width = width;
|
m_width = width;
|
||||||
@@ -2160,6 +2170,8 @@ bool wxWindow::Show( bool show )
|
|||||||
{
|
{
|
||||||
wxCHECK_MSG( (m_widget != NULL), FALSE, "invalid window" );
|
wxCHECK_MSG( (m_widget != NULL), FALSE, "invalid window" );
|
||||||
|
|
||||||
|
if (show == m_isShown) return TRUE;
|
||||||
|
|
||||||
if (show)
|
if (show)
|
||||||
gtk_widget_show( m_widget );
|
gtk_widget_show( m_widget );
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user