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