]> git.saurik.com Git - wxWidgets.git/blame - src/univ/framuniv.cpp
Make easier to compile with MSVC5.
[wxWidgets.git] / src / univ / framuniv.cpp
CommitLineData
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
d9d4df0e 40BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
1e6feb95
VZ
41 EVT_SIZE(wxFrame::OnSize)
42END_EVENT_TABLE()
43
d9d4df0e 44IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow)
1e6feb95
VZ
45
46// ----------------------------------------------------------------------------
47// ctors
48// ----------------------------------------------------------------------------
49
d9d4df0e
VS
50bool wxFrame::Create(wxWindow *parent,
51 wxWindowID id,
52 const wxString& title,
53 const wxPoint& pos,
54 const wxSize& size,
55 long style,
56 const wxString& name)
1e6feb95
VZ
57{
58 m_renderer = NULL;
d9d4df0e 59 return wxTopLevelWindow::Create(parent, id, title, pos, size, style, name);
1e6feb95
VZ
60}
61
d9d4df0e 62
1e6feb95 63// ----------------------------------------------------------------------------
3379ed37 64// menu support
1e6feb95
VZ
65// ----------------------------------------------------------------------------
66
67void wxFrame::OnSize(wxSizeEvent& event)
68{
3379ed37 69#if wxUSE_MENUS
1e6feb95 70 PositionMenuBar();
54800df8 71#endif // wxUSE_MENUS
1e6feb95
VZ
72
73 event.Skip();
74}
75
3379ed37
VZ
76#if wxUSE_MENUS
77
1e6feb95
VZ
78void wxFrame::PositionMenuBar()
79{
1e6feb95
VZ
80 if ( m_frameMenuBar )
81 {
82 // the menubar is positioned above the client size, hence the negative
83 // y coord
75c9da25 84 wxCoord heightMbar = m_frameMenuBar->GetSize().y;
d9d4df0e 85 m_frameMenuBar->SetSize(0, -heightMbar,
75c9da25 86 GetClientSize().x, heightMbar);
1e6feb95 87 }
1e6feb95 88}
75c9da25 89
3379ed37
VZ
90#endif // wxUSE_MENUS
91
1e6feb95
VZ
92wxPoint wxFrame::GetClientAreaOrigin() const
93{
d9d4df0e 94 wxPoint pt = wxFrameBase::GetClientAreaOrigin();
1e6feb95
VZ
95
96#if wxUSE_MENUS
97 if ( m_frameMenuBar )
98 {
99 pt.y += m_frameMenuBar->GetSize().y;
100 }
101#endif // wxUSE_MENUS
102
103 return pt;
104}
105
d9d4df0e 106bool wxFrame::Enable(bool enable)
98363307 107{
d9d4df0e 108 if (!wxFrameBase::Enable(enable))
98363307
JS
109 return FALSE;
110#ifdef __WXMICROWIN__
111 if (m_frameMenuBar)
112 m_frameMenuBar->Enable(enable);
113#endif
114 return TRUE;
115}