]>
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 wxCoord heightBar
= m_frameStatusBar
->GetSize().y
;
121 m_frameStatusBar
->SetSize(0, GetClientSize().y
,
122 GetClientSize().x
, heightBar
);
126 wxStatusBar
* wxFrame::CreateStatusBar(int number
, long style
,
127 wxWindowID id
, const wxString
& name
)
129 wxStatusBar
*bar
= wxFrameBase::CreateStatusBar(number
, style
, id
, name
);
134 #endif // wxUSE_STATUSBAR
136 wxPoint
wxFrame::GetClientAreaOrigin() const
138 wxPoint pt
= wxFrameBase::GetClientAreaOrigin();
141 if ( m_frameMenuBar
)
143 pt
.y
+= m_frameMenuBar
->GetSize().y
;
145 #endif // wxUSE_MENUS
150 void wxFrame::DoGetClientSize(int *width
, int *height
) const
152 wxFrameBase::DoGetClientSize(width
, height
);
155 if ( m_frameMenuBar
&& height
)
157 (*height
) -= m_frameMenuBar
->GetSize().y
;
159 #endif // wxUSE_MENUS
162 if ( m_frameStatusBar
&& height
)
164 (*height
) -= m_frameStatusBar
->GetSize().y
;
166 #endif // wxUSE_STATUSBAR
169 void wxFrame::DoSetClientSize(int width
, int height
)
172 if ( m_frameMenuBar
)
174 height
+= m_frameMenuBar
->GetSize().y
;
176 #endif // wxUSE_MENUS
179 if ( m_frameStatusBar
)
181 height
+= m_frameStatusBar
->GetSize().y
;
183 #endif // wxUSE_STATUSBAR
185 wxFrameBase::DoSetClientSize(width
, height
);
188 bool wxFrame::Enable(bool enable
)
190 if (!wxFrameBase::Enable(enable
))
192 #ifdef __WXMICROWIN__
194 m_frameMenuBar
->Enable(enable
);