]> git.saurik.com Git - wxWidgets.git/blob - include/wx/os2/frame.h
TIFF code 1.
[wxWidgets.git] / include / wx / os2 / frame.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: frame.h
3 // Purpose: wxFrame class
4 // Author: David Webster
5 // Modified by:
6 // Created: 10/27/99
7 // RCS-ID: $Id$
8 // Copyright: (c) David Webster
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_FRAME_H_
13 #define _WX_FRAME_H_
14
15 class WXDLLEXPORT wxFrame : public wxFrameBase
16 {
17 public:
18 // construction
19 wxFrame() { Init(); }
20 wxFrame(wxWindow *parent,
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)
27 {
28 Init();
29
30 Create(parent, id, title, pos, size, style, name);
31 }
32
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);
40
41 virtual ~wxFrame();
42
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);
51
52 // implementation only from now on
53 // -------------------------------
54
55 // override some more virtuals
56 virtual bool Show(bool show = TRUE);
57
58 // event handlers
59 void OnActivate(wxActivateEvent& event);
60 void OnSysColourChanged(wxSysColourChangedEvent& event);
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
68 virtual void PositionToolBar();
69 #endif // wxUSE_TOOLBAR
70
71 // Status bar
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);
77
78 virtual void PositionStatusBar();
79
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
83
84 // TODO: should this go into a wxFrameworkSettings class perhaps?
85 static void UseNativeStatusBar(bool useNative)
86 { m_useNativeStatusBar = useNative; };
87 static bool UsesNativeStatusBar()
88 { return m_useNativeStatusBar; };
89 #endif // wxUSE_STATUSBAR
90
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
97 // event handlers
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
107 // tooltip management
108 #if wxUSE_TOOLTIPS
109 WXHWND GetToolTipCtrl() const { return m_hwndToolTip; }
110 void SetToolTipCtrl(WXHWND hwndTT) { m_hwndToolTip = hwndTT; }
111 #endif // tooltips
112
113 protected:
114 // common part of all ctors
115 void Init();
116
117 // common part of Iconize(), Maximize() and Restore()
118 void DoShowWindow(int nShowCmd);
119
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
127 virtual void DoClientToScreen(int *x, int *y) const;
128 virtual void DoScreenToClient(int *x, int *y) const;
129
130 // helper
131 void DetachMenuBar();
132
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
146 bool m_iconized;
147 WXHICON m_defaultIcon;
148
149 #if wxUSE_STATUSBAR
150 static bool m_useNativeStatusBar;
151 #endif // wxUSE_STATUSBAR
152
153 private:
154 #if wxUSE_TOOLTIPS
155 WXHWND m_hwndToolTip;
156 #endif // tooltips
157
158 DECLARE_EVENT_TABLE()
159 DECLARE_DYNAMIC_CLASS(wxFrame)
160 };
161
162 #endif
163 // _WX_FRAME_H_
164