]>
git.saurik.com Git - wxWidgets.git/blob - src/univ/framuniv.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: univ/frame.cpp
3 // Purpose: wxFrame class for wxUniversal
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ===========================================================================
14 // ===========================================================================
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
21 #pragma implementation "univframe.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
34 #include "wx/statusbr.h"
37 // ============================================================================
39 // ============================================================================
41 BEGIN_EVENT_TABLE(wxFrame
, wxFrameBase
)
42 EVT_SIZE(wxFrame::OnSize
)
45 IMPLEMENT_DYNAMIC_CLASS(wxFrame
, wxTopLevelWindow
)
47 // ----------------------------------------------------------------------------
49 // ----------------------------------------------------------------------------
51 bool wxFrame::Create(wxWindow
*parent
,
53 const wxString
& title
,
59 return wxTopLevelWindow::Create(parent
, id
, title
, pos
, size
, style
, name
);
63 // ----------------------------------------------------------------------------
65 // ----------------------------------------------------------------------------
67 void wxFrame::OnSize(wxSizeEvent
& event
)
74 #endif // wxUSE_STATUSBAR
79 void wxFrame::SendSizeEvent()
81 wxSizeEvent
event(GetSize(), GetId());
82 event
.SetEventObject(this);
83 GetEventHandler()->ProcessEvent(event
);
88 void wxFrame::PositionMenuBar()
92 // the menubar is positioned above the client size, hence the negative
94 wxCoord heightMbar
= m_frameMenuBar
->GetSize().y
;
95 m_frameMenuBar
->SetSize(0, -heightMbar
,
96 GetClientSize().x
, heightMbar
);
100 void wxFrame::DetachMenuBar()
102 wxFrameBase::DetachMenuBar();
106 void wxFrame::AttachMenuBar(wxMenuBar
*menubar
)
108 wxFrameBase::AttachMenuBar(menubar
);
112 #endif // wxUSE_MENUS
116 void wxFrame::PositionStatusBar()
118 if ( m_frameStatusBar
)
120 wxSize size
= GetClientSize();
121 m_frameStatusBar
->SetSize(0, size
.y
, size
.x
, -1);
125 wxStatusBar
* wxFrame::CreateStatusBar(int number
, long style
,
126 wxWindowID id
, const wxString
& name
)
128 wxStatusBar
*bar
= wxFrameBase::CreateStatusBar(number
, style
, id
, name
);
133 #endif // wxUSE_STATUSBAR
135 wxPoint
wxFrame::GetClientAreaOrigin() const
137 wxPoint pt
= wxFrameBase::GetClientAreaOrigin();
140 if ( m_frameMenuBar
)
142 pt
.y
+= m_frameMenuBar
->GetSize().y
;
144 #endif // wxUSE_MENUS
149 void wxFrame::DoGetClientSize(int *width
, int *height
) const
151 wxFrameBase::DoGetClientSize(width
, height
);
154 if ( m_frameMenuBar
&& height
)
156 (*height
) -= m_frameMenuBar
->GetSize().y
;
158 #endif // wxUSE_MENUS
161 if ( m_frameStatusBar
&& height
)
163 (*height
) -= m_frameStatusBar
->GetSize().y
;
165 #endif // wxUSE_STATUSBAR
168 void wxFrame::DoSetClientSize(int width
, int height
)
171 if ( m_frameMenuBar
)
173 height
+= m_frameMenuBar
->GetSize().y
;
175 #endif // wxUSE_MENUS
178 if ( m_frameStatusBar
)
180 height
+= m_frameStatusBar
->GetSize().y
;
182 #endif // wxUSE_STATUSBAR
184 wxFrameBase::DoSetClientSize(width
, height
);
187 bool wxFrame::Enable(bool enable
)
189 if (!wxFrameBase::Enable(enable
))
191 #ifdef __WXMICROWIN__
193 m_frameMenuBar
->Enable(enable
);