]> git.saurik.com Git - wxWidgets.git/blame - include/wx/os2/mdi.h
added support for item attributes in virtual list control
[wxWidgets.git] / include / wx / os2 / mdi.h
CommitLineData
0e320a79
DW
1/////////////////////////////////////////////////////////////////////////////
2// Name: mdi.h
3// Purpose: MDI (Multiple Document Interface) classes.
4// This doesn't have to be implemented just like Windows,
5// it could be a tabbed design as in wxGTK.
75f11ad7 6// Author: David Webster
0e320a79 7// Modified by:
75f11ad7 8// Created: 10/10/99
0e320a79 9// RCS-ID: $Id$
75f11ad7
DW
10// Copyright: (c) David Webster
11// Licence: wxWindows licence
0e320a79
DW
12/////////////////////////////////////////////////////////////////////////////
13
14#ifndef _WX_MDI_H_
15#define _WX_MDI_H_
16
0e320a79
DW
17#include "wx/frame.h"
18
19WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
20WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr;
21
22class WXDLLEXPORT wxMDIClientWindow;
23class WXDLLEXPORT wxMDIChildFrame;
24
25class WXDLLEXPORT wxMDIParentFrame: public wxFrame
26{
27DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
28
29 friend class WXDLLEXPORT wxMDIChildFrame;
30public:
31
32 wxMDIParentFrame();
33 inline wxMDIParentFrame(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 | wxVSCROLL | wxHSCROLL, // Scrolling refers to client window
39 const wxString& name = wxFrameNameStr)
40 {
41 Create(parent, id, title, pos, size, style, name);
42 }
43
44 ~wxMDIParentFrame();
45
46 bool Create(wxWindow *parent,
47 wxWindowID id,
48 const wxString& title,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize,
51 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
52 const wxString& name = wxFrameNameStr);
53
75f11ad7
DW
54 // accessors
55 // ---------
56
57 // Get the active MDI child window (Windows only)
58 wxMDIChildFrame *GetActiveChild() const;
59
60 // Get the client window
61 wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; }
62
63 // Create the client window class (don't Create the window,
64 // just return a new class)
65 virtual wxMDIClientWindow *OnCreateClient(void);
66
67 WXHMENU GetWindowMenu() const { return m_windowMenu; }
0e320a79 68
75f11ad7
DW
69 // MDI operations
70 // --------------
71 virtual void Cascade();
72 virtual void Tile();
73 virtual void ArrangeIcons();
74 virtual void ActivateNext();
75 virtual void ActivatePrevious();
0e320a79 76
75f11ad7
DW
77 // handlers
78 // --------
0e320a79 79
75f11ad7
DW
80 // Responds to colour changes
81 void OnSysColourChanged(wxSysColourChangedEvent& event);
0e320a79 82
75f11ad7 83 void OnSize(wxSizeEvent& event);
0e320a79 84
75f11ad7
DW
85 bool HandleActivate(int state, bool minimized, WXHWND activate);
86 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
0e320a79 87
75f11ad7 88 // override window proc for MDI-specific message processing
a885d89a 89 virtual MRESULT OS2WindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
75f11ad7 90
a885d89a 91 virtual MRESULT OS2DefWindowProc(WXUINT, WXWPARAM, WXLPARAM);
75f11ad7 92 virtual bool OS2TranslateMessage(WXMSG* msg);
0e320a79
DW
93
94protected:
75f11ad7
DW
95 virtual void InternalSetMenuBar();
96
97 wxMDIClientWindow * m_clientWindow;
98 wxMDIChildFrame * m_currentChild;
99 WXHMENU m_windowMenu;
0e320a79 100
75f11ad7
DW
101 // TRUE if MDI Frame is intercepting commands, not child
102 bool m_parentFrameActive;
0e320a79 103
75f11ad7 104private:
75f11ad7 105 DECLARE_EVENT_TABLE()
0e320a79
DW
106};
107
108class WXDLLEXPORT wxMDIChildFrame: public wxFrame
109{
110DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
111public:
112
113 wxMDIChildFrame();
114 inline wxMDIChildFrame(wxMDIParentFrame *parent,
115 wxWindowID id,
116 const wxString& title,
117 const wxPoint& pos = wxDefaultPosition,
118 const wxSize& size = wxDefaultSize,
119 long style = wxDEFAULT_FRAME_STYLE,
120 const wxString& name = wxFrameNameStr)
121 {
122 Create(parent, id, title, pos, size, style, name);
123 }
124
125 ~wxMDIChildFrame();
126
127 bool Create(wxMDIParentFrame *parent,
128 wxWindowID id,
129 const wxString& title,
130 const wxPoint& pos = wxDefaultPosition,
131 const wxSize& size = wxDefaultSize,
132 long style = wxDEFAULT_FRAME_STYLE,
133 const wxString& name = wxFrameNameStr);
134
75f11ad7
DW
135 // MDI operations
136 virtual void Maximize(bool maximize = TRUE);
137 virtual void Restore();
138 virtual void Activate();
0e320a79 139
75f11ad7
DW
140 // Handlers
141
142 bool HandleMDIActivate(long bActivate, WXHWND, WXHWND);
143 bool HandleSize(int x, int y, WXUINT);
144 bool HandleWindowPosChanging(void *lpPos);
145 bool HandleCommand(WXWORD id, WXWORD cmd, WXHWND control);
146
a885d89a
DW
147 virtual MRESULT OS2WindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
148 virtual MRESULT OS2DefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
75f11ad7
DW
149 virtual bool OS2TranslateMessage(WXMSG *msg);
150
151 virtual void OS2DestroyWindow();
152
153 // Implementation
154 bool ResetWindowStyle(void *vrect);
155
156protected:
157 virtual void DoGetPosition(int *x, int *y) const;
158 virtual void DoSetClientSize(int width, int height);
159 virtual void InternalSetMenuBar();
0e320a79
DW
160};
161
162/* The client window is a child of the parent MDI frame, and itself
163 * contains the child MDI frames.
164 * However, you create the MDI children as children of the MDI parent:
165 * only in the implementation does the client window become the parent
166 * of the children. Phew! So the children are sort of 'adopted'...
167 */
168
169class WXDLLEXPORT wxMDIClientWindow: public wxWindow
170{
171 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
75f11ad7 172
0e320a79
DW
173 public:
174
75f11ad7
DW
175 wxMDIClientWindow() { Init(); }
176 wxMDIClientWindow(wxMDIParentFrame *parent, long style = 0)
177 {
178 Init();
0e320a79 179
75f11ad7
DW
180 CreateClient(parent, style);
181 }
0e320a79 182
75f11ad7
DW
183 // Note: this is virtual, to allow overridden behaviour.
184 virtual bool CreateClient(wxMDIParentFrame *parent,
185 long style = wxVSCROLL | wxHSCROLL);
0e320a79 186
75f11ad7
DW
187 // Explicitly call default scroll behaviour
188 void OnScroll(wxScrollEvent& event);
0e320a79
DW
189
190protected:
75f11ad7 191 void Init() { m_scrollX = m_scrollY = 0; }
0e320a79 192
75f11ad7
DW
193 int m_scrollX, m_scrollY;
194
195private:
196 DECLARE_EVENT_TABLE()
0e320a79
DW
197};
198
199#endif
200 // _WX_MDI_H_