]>
Commit | Line | Data |
---|---|---|
1e6feb95 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: univ/frame.cpp | |
3 | // Purpose: wxFrame class for wxUniversal | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 19.05.01 | |
7 | // RCS-ID: $Id$ | |
442b35b5 | 8 | // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) |
1e6feb95 VZ |
9 | // Licence: wxWindows licence |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // =========================================================================== | |
13 | // declarations | |
14 | // =========================================================================== | |
15 | ||
16 | // --------------------------------------------------------------------------- | |
17 | // headers | |
18 | // --------------------------------------------------------------------------- | |
19 | ||
20 | #ifdef __GNUG__ | |
a3870b2f | 21 | #pragma implementation "univframe.h" |
1e6feb95 VZ |
22 | #endif |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
28 | #pragma hdrstop | |
29 | #endif | |
30 | ||
31 | #include "wx/menu.h" | |
32 | #ifndef WX_PRECOMP | |
33 | #include "wx/frame.h" | |
34 | #endif // WX_PRECOMP | |
35 | ||
36 | // ============================================================================ | |
37 | // implementation | |
38 | // ============================================================================ | |
39 | ||
40 | BEGIN_EVENT_TABLE(wxFrame, wxFrameNative) | |
41 | EVT_SIZE(wxFrame::OnSize) | |
42 | END_EVENT_TABLE() | |
43 | ||
44 | #if defined(__WXMSW__) | |
45 | IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxFrameMSW) | |
46 | #elif defined(__WXGTK__) | |
47 | IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxFrameGTK) | |
48 | #endif | |
49 | ||
50 | // ---------------------------------------------------------------------------- | |
51 | // ctors | |
52 | // ---------------------------------------------------------------------------- | |
53 | ||
54 | wxFrame::wxFrame() | |
55 | { | |
56 | } | |
57 | ||
58 | wxFrame::wxFrame(wxWindow *parent, | |
59 | wxWindowID id, | |
60 | const wxString& title, | |
61 | const wxPoint& pos, | |
62 | const wxSize& size, | |
63 | long style, | |
64 | const wxString& name) | |
65 | : wxFrameNative(parent, id, title, pos, size, style, name) | |
66 | { | |
67 | m_renderer = NULL; | |
68 | } | |
69 | ||
70 | // ---------------------------------------------------------------------------- | |
3379ed37 | 71 | // menu support |
1e6feb95 VZ |
72 | // ---------------------------------------------------------------------------- |
73 | ||
74 | void wxFrame::OnSize(wxSizeEvent& event) | |
75 | { | |
3379ed37 | 76 | #if wxUSE_MENUS |
1e6feb95 | 77 | PositionMenuBar(); |
54800df8 | 78 | #endif // wxUSE_MENUS |
1e6feb95 VZ |
79 | |
80 | event.Skip(); | |
81 | } | |
82 | ||
3379ed37 VZ |
83 | #if wxUSE_MENUS |
84 | ||
1e6feb95 VZ |
85 | void wxFrame::PositionMenuBar() |
86 | { | |
1e6feb95 VZ |
87 | if ( m_frameMenuBar ) |
88 | { | |
89 | // the menubar is positioned above the client size, hence the negative | |
90 | // y coord | |
91 | m_frameMenuBar->SetSize(0, -m_frameMenuBar->GetSize().y, | |
92 | GetClientSize().x, -1); | |
93 | } | |
1e6feb95 | 94 | } |
3379ed37 VZ |
95 | #endif // wxUSE_MENUS |
96 | ||
1e6feb95 VZ |
97 | wxPoint wxFrame::GetClientAreaOrigin() const |
98 | { | |
99 | wxPoint pt = wxFrameNative::GetClientAreaOrigin(); | |
100 | ||
101 | #if wxUSE_MENUS | |
102 | if ( m_frameMenuBar ) | |
103 | { | |
104 | pt.y += m_frameMenuBar->GetSize().y; | |
105 | } | |
106 | #endif // wxUSE_MENUS | |
107 | ||
108 | return pt; | |
109 | } | |
110 | ||
98363307 JS |
111 | bool wxFrame::Enable( bool enable ) |
112 | { | |
113 | if (!wxFrameNative::Enable(enable)) | |
114 | return FALSE; | |
115 | #ifdef __WXMICROWIN__ | |
116 | if (m_frameMenuBar) | |
117 | m_frameMenuBar->Enable(enable); | |
118 | #endif | |
119 | return TRUE; | |
120 | } |