]>
Commit | Line | Data |
---|---|---|
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 | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_FRAME_H_ | |
13 | #define _WX_FRAME_H_ | |
14 | ||
15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
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 bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL); | |
49 | virtual void Raise(); | |
50 | ||
51 | // implementation only from now on | |
52 | // ------------------------------- | |
53 | ||
54 | // event handlers | |
55 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
56 | ||
57 | // Toolbar | |
58 | #if wxUSE_TOOLBAR | |
59 | virtual wxToolBar* CreateToolBar(long style = -1, | |
60 | wxWindowID id = -1, | |
61 | const wxString& name = wxToolBarNameStr); | |
62 | ||
63 | virtual void PositionToolBar(); | |
64 | #endif // wxUSE_TOOLBAR | |
65 | ||
66 | // Status bar | |
67 | #if wxUSE_STATUSBAR | |
68 | virtual wxStatusBar* OnCreateStatusBar(int number = 1, | |
69 | long style = wxST_SIZEGRIP, | |
70 | wxWindowID id = 0, | |
71 | const wxString& name = wxStatusLineNameStr); | |
72 | ||
73 | virtual void PositionStatusBar(); | |
74 | ||
75 | // Hint to tell framework which status bar to use: the default is to use | |
76 | // native one for the platforms which support it (Win32), the generic one | |
77 | // otherwise | |
78 | ||
79 | // TODO: should this go into a wxFrameworkSettings class perhaps? | |
80 | static void UseNativeStatusBar(bool useNative) | |
81 | { m_useNativeStatusBar = useNative; }; | |
82 | static bool UsesNativeStatusBar() | |
83 | { return m_useNativeStatusBar; }; | |
84 | #endif // wxUSE_STATUSBAR | |
85 | ||
86 | WXHMENU GetWinMenu() const { return m_hMenu; } | |
87 | ||
88 | // event handlers | |
89 | bool HandlePaint(); | |
90 | bool HandleSize(int x, int y, WXUINT flag); | |
91 | bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control); | |
92 | bool HandleMenuSelect(WXWORD nItem, WXWORD nFlags, WXHMENU hMenu); | |
93 | bool HandleMenuLoop(const wxEventType& evtType, WXWORD isPopup); | |
94 | ||
95 | // tooltip management | |
96 | #if wxUSE_TOOLTIPS | |
97 | WXHWND GetToolTipCtrl() const { return m_hwndToolTip; } | |
98 | void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; } | |
99 | #endif // tooltips | |
100 | ||
101 | // a MSW only function which sends a size event to the window using its | |
102 | // current size - this has an effect of refreshing the window layout | |
103 | virtual void SendSizeEvent(); | |
104 | ||
105 | protected: | |
106 | // common part of all ctors | |
107 | void Init(); | |
108 | ||
109 | // override base class virtuals | |
110 | virtual void DoGetClientSize(int *width, int *height) const; | |
111 | virtual void DoSetClientSize(int width, int height); | |
112 | ||
113 | #if wxUSE_MENUS_NATIVE | |
114 | // perform MSW-specific action when menubar is changed | |
115 | virtual void AttachMenuBar(wxMenuBar *menubar); | |
116 | ||
117 | // a plug in for MDI frame classes which need to do something special when | |
118 | // the menubar is set | |
119 | virtual void InternalSetMenuBar(); | |
120 | #endif // wxUSE_MENUS_NATIVE | |
121 | ||
122 | // propagate our state change to all child frames | |
123 | void IconizeChildFrames(bool bIconize); | |
124 | ||
125 | // we add menu bar accel processing | |
126 | bool MSWTranslateMessage(WXMSG* pMsg); | |
127 | ||
128 | // window proc for the frames | |
129 | WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam); | |
130 | ||
131 | // handle WM_INITMENUPOPUP message | |
132 | bool HandleInitMenuPopup(WXHMENU hMenu); | |
133 | ||
134 | virtual bool IsMDIChild() const { return FALSE; } | |
135 | ||
136 | // get default (wxWindows) icon for the frame | |
137 | virtual WXHICON GetDefaultIcon() const; | |
138 | ||
139 | #if wxUSE_STATUSBAR | |
140 | static bool m_useNativeStatusBar; | |
141 | #endif // wxUSE_STATUSBAR | |
142 | ||
143 | // Data to save/restore when calling ShowFullScreen | |
144 | int m_fsStatusBarFields; // 0 for no status bar | |
145 | int m_fsStatusBarHeight; | |
146 | int m_fsToolBarHeight; | |
147 | ||
148 | private: | |
149 | #if wxUSE_TOOLTIPS | |
150 | WXHWND m_hwndToolTip; | |
151 | #endif // tooltips | |
152 | ||
153 | // used by IconizeChildFrames(), see comments there | |
154 | bool m_wasMinimized; | |
155 | ||
156 | DECLARE_EVENT_TABLE() | |
157 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxFrame) | |
158 | }; | |
159 | ||
160 | #endif | |
161 | // _WX_FRAME_H_ |