]>
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,
97 GetClientSize().y
- heightMbar
,
101 GetClientSize().x
, heightMbar
);
105 void wxFrame::DetachMenuBar()
107 wxFrameBase::DetachMenuBar();
111 void wxFrame::AttachMenuBar(wxMenuBar
*menubar
)
113 wxFrameBase::AttachMenuBar(menubar
);
117 #endif // wxUSE_MENUS
121 void wxFrame::PositionStatusBar()
123 if ( m_frameStatusBar
)
125 wxSize size
= GetClientSize();
126 m_frameStatusBar
->SetSize(0, size
.y
, size
.x
, -1);
130 wxStatusBar
* wxFrame::CreateStatusBar(int number
, long style
,
131 wxWindowID id
, const wxString
& name
)
133 wxStatusBar
*bar
= wxFrameBase::CreateStatusBar(number
, style
, id
, name
);
138 #endif // wxUSE_STATUSBAR
140 wxPoint
wxFrame::GetClientAreaOrigin() const
142 wxPoint pt
= wxFrameBase::GetClientAreaOrigin();
144 #if wxUSE_MENUS && !defined(__WXPM__)
145 if ( m_frameMenuBar
)
147 pt
.y
+= m_frameMenuBar
->GetSize().y
;
149 #endif // wxUSE_MENUS
154 void wxFrame::DoGetClientSize(int *width
, int *height
) const
156 wxFrameBase::DoGetClientSize(width
, height
);
159 if ( m_frameMenuBar
&& height
)
161 (*height
) -= m_frameMenuBar
->GetSize().y
;
163 #endif // wxUSE_MENUS
166 if ( m_frameStatusBar
&& height
)
168 (*height
) -= m_frameStatusBar
->GetSize().y
;
170 #endif // wxUSE_STATUSBAR
173 void wxFrame::DoSetClientSize(int width
, int height
)
176 if ( m_frameMenuBar
)
178 height
+= m_frameMenuBar
->GetSize().y
;
180 #endif // wxUSE_MENUS
183 if ( m_frameStatusBar
)
185 height
+= m_frameStatusBar
->GetSize().y
;
187 #endif // wxUSE_STATUSBAR
189 wxFrameBase::DoSetClientSize(width
, height
);
192 bool wxFrame::Enable(bool enable
)
194 if (!wxFrameBase::Enable(enable
))
196 #ifdef __WXMICROWIN__
198 m_frameMenuBar
->Enable(enable
);