]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/frame.h
reverting to native mac pathnames
[wxWidgets.git] / include / wx / msw / frame.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/frame.h
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
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FRAME_H_
13 #define _WX_FRAME_H_
14
15 #ifdef __GNUG__
16 #pragma interface "frame.h"
17 #endif
18
19 class WXDLLEXPORT wxFrame : public wxFrameBase
20 {
21 public:
22 // construction
23 wxFrame() { Init(); }
24 wxFrame(wxWindow *parent,
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)
31 {
32 Init();
33
34 Create(parent, id, title, pos, size, style, name);
35 }
36
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);
44
45 virtual ~wxFrame();
46
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);
55 virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
56 virtual bool IsFullScreen() const { return m_fsIsShowing; };
57
58 // implementation only from now on
59 // -------------------------------
60
61 // override some more virtuals
62 virtual bool Show(bool show = TRUE);
63
64 virtual void RemoveChild( wxWindowBase *child );
65
66 // event handlers
67 void OnActivate(wxActivateEvent& event);
68 void OnSysColourChanged(wxSysColourChangedEvent& event);
69
70 // Toolbar
71 #if wxUSE_TOOLBAR
72 virtual wxToolBar* CreateToolBar(long style = wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT,
73 wxWindowID id = -1,
74 const wxString& name = wxToolBarNameStr);
75
76 virtual void PositionToolBar();
77 #endif // wxUSE_TOOLBAR
78
79 // Status bar
80 #if wxUSE_STATUSBAR
81 virtual wxStatusBar* OnCreateStatusBar(int number = 1,
82 long style = wxST_SIZEGRIP,
83 wxWindowID id = 0,
84 const wxString& name = wxStatusLineNameStr);
85
86 virtual void PositionStatusBar();
87
88 // Hint to tell framework which status bar to use: the default is to use
89 // native one for the platforms which support it (Win32), the generic one
90 // otherwise
91
92 // TODO: should this go into a wxFrameworkSettings class perhaps?
93 static void UseNativeStatusBar(bool useNative)
94 { m_useNativeStatusBar = useNative; };
95 static bool UsesNativeStatusBar()
96 { return m_useNativeStatusBar; };
97 #endif // wxUSE_STATUSBAR
98
99 WXHMENU GetWinMenu() const { return m_hMenu; }
100
101 // event handlers
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
107 bool MSWCreate(int id, wxWindow *parent, const wxChar *wclass,
108 wxWindow *wx_win, const wxChar *title,
109 int x, int y, int width, int height, long style);
110
111 // tooltip management
112 #if wxUSE_TOOLTIPS
113 WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
114 void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
115 #endif // tooltips
116
117 // a MSW only function which sends a size event to the window using its
118 // current size - this has an effect of refreshing the window layout
119 void SendSizeEvent();
120
121 protected:
122 // common part of all ctors
123 void Init();
124
125 // common part of Iconize(), Maximize() and Restore()
126 void DoShowWindow(int nShowCmd);
127
128 // override base class virtuals
129 virtual void DoGetClientSize(int *width, int *height) const;
130 virtual void DoGetSize(int *width, int *height) const;
131 virtual void DoGetPosition(int *x, int *y) const;
132
133 virtual void DoSetClientSize(int width, int height);
134
135 // helper
136 void DetachMenuBar();
137
138 // a plug in for MDI frame classes which need to do something special when
139 // the menubar is set
140 virtual void InternalSetMenuBar();
141
142 // propagate our state change to all child frames
143 void IconizeChildFrames(bool bIconize);
144
145 // we add menu bar accel processing
146 bool MSWTranslateMessage(WXMSG* pMsg);
147
148 // window proc for the frames
149 long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
150
151 virtual bool IsMDIChild() const { return FALSE; }
152
153 // is the frame currently iconized?
154 bool m_iconized;
155
156 // should the frame be maximized when it will be shown? set by Maximize()
157 // when it is called while the frame is hidden
158 bool m_maximizeOnShow;
159
160 WXHICON m_defaultIcon;
161
162 #if wxUSE_STATUSBAR
163 static bool m_useNativeStatusBar;
164 #endif // wxUSE_STATUSBAR
165
166 // the last focused child: we restore focus to it on activation
167 wxWindow *m_winLastFocused;
168
169 // Data to save/restore when calling ShowFullScreen
170 long m_fsStyle; // Passed to ShowFullScreen
171 wxRect m_fsOldSize;
172 long m_fsOldWindowStyle;
173 int m_fsStatusBarFields; // 0 for no status bar
174 int m_fsStatusBarHeight;
175 int m_fsToolBarHeight;
176 // WXHMENU m_fsMenu;
177 bool m_fsIsMaximized;
178 bool m_fsIsShowing;
179
180 private:
181 #if wxUSE_TOOLTIPS
182 WXHWND m_hwndToolTip;
183 #endif // tooltips
184
185 DECLARE_EVENT_TABLE()
186 DECLARE_DYNAMIC_CLASS(wxFrame)
187 };
188
189 #endif
190 // _WX_FRAME_H_