]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/frame.h
test
[wxWidgets.git] / include / wx / msw / frame.h
CommitLineData
2bda0e17 1/////////////////////////////////////////////////////////////////////////////
7c0ea335 2// Name: wx/msw/frame.h
2bda0e17
KB
3// Purpose: wxFrame class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
16f6dfd8 9// Licence: wxWindows license
2bda0e17
KB
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_FRAME_H_
13#define _WX_FRAME_H_
2bda0e17
KB
14
15#ifdef __GNUG__
42e69d6b 16 #pragma interface "frame.h"
2bda0e17
KB
17#endif
18
7c0ea335 19class WXDLLEXPORT wxFrame : public wxFrameBase
3a19e16d 20{
2bda0e17 21public:
7c0ea335
VZ
22 // construction
23 wxFrame() { Init(); }
3a19e16d 24 wxFrame(wxWindow *parent,
7c0ea335
VZ
25 wxWindowID id,
26 const wxString& title,
27 const wxPoint& pos = wxDefaultPosition,
28 const wxSize& size = wxDefaultSize,
29 long style = wxDEFAULT_FRAME_STYLE,
30 const wxString& name = wxFrameNameStr)
3a19e16d 31 {
7c0ea335
VZ
32 Init();
33
3a19e16d
VZ
34 Create(parent, id, title, pos, size, style, name);
35 }
16f6dfd8 36
3a19e16d
VZ
37 bool Create(wxWindow *parent,
38 wxWindowID id,
39 const wxString& title,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = wxDEFAULT_FRAME_STYLE,
43 const wxString& name = wxFrameNameStr);
16f6dfd8 44
7c0ea335 45 virtual ~wxFrame();
16f6dfd8 46
7c0ea335
VZ
47 // implement base class pure virtuals
48 virtual void Maximize(bool maximize = TRUE);
49 virtual bool IsMaximized() const;
50 virtual void Iconize(bool iconize = TRUE);
51 virtual bool IsIconized() const;
52 virtual void Restore();
53 virtual void SetMenuBar(wxMenuBar *menubar);
54 virtual void SetIcon(const wxIcon& icon);
42e69d6b 55
7c0ea335
VZ
56 // implementation only from now on
57 // -------------------------------
16f6dfd8 58
7c0ea335
VZ
59 // override some more virtuals
60 virtual bool Show(bool show = TRUE);
b5423899 61
7c0ea335
VZ
62 // event handlers
63 void OnActivate(wxActivateEvent& event);
64 void OnSysColourChanged(wxSysColourChangedEvent& event);
16f6dfd8 65
3a19e16d 66 // Toolbar
d427503c 67#if wxUSE_TOOLBAR
3a19e16d
VZ
68 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
69 wxWindowID id = -1,
70 const wxString& name = wxToolBarNameStr);
71
3a19e16d 72 virtual void PositionToolBar();
d427503c 73#endif // wxUSE_TOOLBAR
16f6dfd8 74
3a19e16d 75 // Status bar
7c0ea335
VZ
76#if wxUSE_STATUSBAR
77 virtual wxStatusBar* OnCreateStatusBar(int number = 1,
78 long style = wxST_SIZEGRIP,
79 wxWindowID id = 0,
80 const wxString& name = wxStatusLineNameStr);
3a19e16d
VZ
81
82 virtual void PositionStatusBar();
16f6dfd8 83
7c0ea335
VZ
84 // Hint to tell framework which status bar to use: the default is to use
85 // native one for the platforms which support it (Win32), the generic one
86 // otherwise
16f6dfd8 87
3a19e16d 88 // TODO: should this go into a wxFrameworkSettings class perhaps?
7c0ea335
VZ
89 static void UseNativeStatusBar(bool useNative)
90 { m_useNativeStatusBar = useNative; };
91 static bool UsesNativeStatusBar()
92 { return m_useNativeStatusBar; };
d427503c 93#endif // wxUSE_STATUSBAR
16f6dfd8 94
42e69d6b 95 WXHMENU GetWinMenu() const { return m_hMenu; }
16f6dfd8 96
3a19e16d
VZ
97 // Returns the origin of client area (may be different from (0,0) if the
98 // frame has a toolbar)
99 virtual wxPoint GetClientAreaOrigin() const;
16f6dfd8 100
7c0ea335 101 // event handlers
42e69d6b
VZ
102 bool HandlePaint();
103 bool HandleSize(int x, int y, WXUINT flag);
104 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
105 bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu);
106
9df8c2df
OK
107 bool MSWCreate(int id, wxWindow *parent, const wxChar *wclass,
108 wxWindow *wx_win, const wxChar *title,
debe6624 109 int x, int y, int width, int height, long style);
2bda0e17 110
7c0ea335 111 // tooltip management
3a19e16d 112#if wxUSE_TOOLTIPS
a23fd0e1
VZ
113 WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
114 void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
3a19e16d
VZ
115#endif // tooltips
116
2bda0e17 117protected:
7c0ea335
VZ
118 // common part of all ctors
119 void Init();
120
121 // common part of Iconize(), Maximize() and Restore()
122 void DoShowWindow(int nShowCmd);
123
a23fd0e1
VZ
124 // override base class virtuals
125 virtual void DoGetClientSize(int *width, int *height) const;
42e69d6b
VZ
126 virtual void DoGetSize(int *width, int *height) const;
127 virtual void DoGetPosition(int *x, int *y) const;
a23fd0e1 128
a23fd0e1 129 virtual void DoSetClientSize(int width, int height);
cc2b7472 130
d59ceba5
VZ
131 virtual void DoClientToScreen(int *x, int *y) const;
132 virtual void DoScreenToClient(int *x, int *y) const;
133
7c0ea335
VZ
134 // helper
135 void DetachMenuBar();
136
42e69d6b
VZ
137 // a plug in for MDI frame classes which need to do something special when
138 // the menubar is set
139 virtual void InternalSetMenuBar();
140
3a19e16d
VZ
141 // propagate our state change to all child frames
142 void IconizeChildFrames(bool bIconize);
16f6dfd8 143
42e69d6b
VZ
144 // we add menu bar accel processing
145 bool MSWTranslateMessage(WXMSG* pMsg);
146
a23fd0e1
VZ
147 // window proc for the frames
148 long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
149
3a19e16d
VZ
150 bool m_iconized;
151 WXHICON m_defaultIcon;
d427503c
VZ
152
153#if wxUSE_STATUSBAR
3a19e16d 154 static bool m_useNativeStatusBar;
d427503c
VZ
155#endif // wxUSE_STATUSBAR
156
a23fd0e1 157private:
3a19e16d
VZ
158#if wxUSE_TOOLTIPS
159 WXHWND m_hwndToolTip;
160#endif // tooltips
161
3a19e16d 162 DECLARE_EVENT_TABLE()
7c0ea335 163 DECLARE_DYNAMIC_CLASS(wxFrame)
2bda0e17
KB
164};
165
166#endif
bbcdf8bc 167 // _WX_FRAME_H_