]>
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 | ||
6522713c | 44 | IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow) |
1e6feb95 VZ |
45 | |
46 | // ---------------------------------------------------------------------------- | |
47 | // ctors | |
48 | // ---------------------------------------------------------------------------- | |
49 | ||
50 | wxFrame::wxFrame() | |
51 | { | |
52 | } | |
53 | ||
54 | wxFrame::wxFrame(wxWindow *parent, | |
55 | wxWindowID id, | |
56 | const wxString& title, | |
57 | const wxPoint& pos, | |
58 | const wxSize& size, | |
59 | long style, | |
60 | const wxString& name) | |
61 | : wxFrameNative(parent, id, title, pos, size, style, name) | |
62 | { | |
63 | m_renderer = NULL; | |
64 | } | |
65 | ||
66 | // ---------------------------------------------------------------------------- | |
3379ed37 | 67 | // menu support |
1e6feb95 VZ |
68 | // ---------------------------------------------------------------------------- |
69 | ||
70 | void wxFrame::OnSize(wxSizeEvent& event) | |
71 | { | |
3379ed37 | 72 | #if wxUSE_MENUS |
1e6feb95 | 73 | PositionMenuBar(); |
54800df8 | 74 | #endif // wxUSE_MENUS |
1e6feb95 VZ |
75 | |
76 | event.Skip(); | |
77 | } | |
78 | ||
3379ed37 VZ |
79 | #if wxUSE_MENUS |
80 | ||
1e6feb95 VZ |
81 | void wxFrame::PositionMenuBar() |
82 | { | |
1e6feb95 VZ |
83 | if ( m_frameMenuBar ) |
84 | { | |
85 | // the menubar is positioned above the client size, hence the negative | |
86 | // y coord | |
75c9da25 VZ |
87 | wxCoord heightMbar = m_frameMenuBar->GetSize().y; |
88 | m_frameMenuBar->SetSize(0, | |
89 | ||
90 | // FIXME: why doesn't this work as expected in wxGTK?? | |
91 | #ifdef __WXGTK__ | |
92 | 0, | |
93 | #else | |
94 | -heightMbar, | |
95 | #endif | |
96 | GetClientSize().x, heightMbar); | |
1e6feb95 | 97 | } |
1e6feb95 | 98 | } |
75c9da25 | 99 | |
3379ed37 VZ |
100 | #endif // wxUSE_MENUS |
101 | ||
1e6feb95 VZ |
102 | wxPoint wxFrame::GetClientAreaOrigin() const |
103 | { | |
104 | wxPoint pt = wxFrameNative::GetClientAreaOrigin(); | |
105 | ||
106 | #if wxUSE_MENUS | |
107 | if ( m_frameMenuBar ) | |
108 | { | |
109 | pt.y += m_frameMenuBar->GetSize().y; | |
110 | } | |
111 | #endif // wxUSE_MENUS | |
112 | ||
113 | return pt; | |
114 | } | |
115 | ||
98363307 JS |
116 | bool wxFrame::Enable( bool enable ) |
117 | { | |
118 | if (!wxFrameNative::Enable(enable)) | |
119 | return FALSE; | |
120 | #ifdef __WXMICROWIN__ | |
121 | if (m_frameMenuBar) | |
122 | m_frameMenuBar->Enable(enable); | |
123 | #endif | |
124 | return TRUE; | |
125 | } |