]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/mdi.h
Fixes #10443: wxListCtrl::MoveToItem
[wxWidgets.git] / include / wx / osx / mdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/carbon/mdi.h
3 // Purpose: MDI (Multiple Document Interface) classes.
4 // Author: Stefan Csomor
5 // Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // (c) 2008 Vadim Zeitlin
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _WX_OSX_CARBON_MDI_H_
14 #define _WX_OSX_CARBON_MDI_H_
15
16 class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase
17 {
18 public:
19 wxMDIParentFrame() { Init(); }
20 wxMDIParentFrame(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 | wxVSCROLL | wxHSCROLL,
26 const wxString& name = wxFrameNameStr)
27 {
28 Init();
29 Create(parent, id, title, pos, size, style, name);
30 }
31
32 bool Create(wxWindow *parent,
33 wxWindowID id,
34 const wxString& title,
35 const wxPoint& pos = wxDefaultPosition,
36 const wxSize& size = wxDefaultSize,
37 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
38 const wxString& name = wxFrameNameStr);
39
40 virtual ~wxMDIParentFrame();
41
42 // implement/override base class [pure] virtuals
43 // ---------------------------------------------
44
45 static bool IsTDI() { return false; }
46
47 virtual void AddChild(wxWindowBase *child);
48 virtual void RemoveChild(wxWindowBase *child);
49
50 virtual void ActivateNext() { /* TODO */ }
51 virtual void ActivatePrevious() { /* TODO */ }
52
53 virtual bool Show(bool show = true);
54
55
56 // Mac-specific implementation from now on
57 // ---------------------------------------
58
59 // Mac OS activate event
60 virtual void MacActivate(long timestamp, bool activating);
61
62 // wxWidgets activate event
63 void OnActivate(wxActivateEvent& event);
64 void OnSysColourChanged(wxSysColourChangedEvent& event);
65
66 void SetMenuBar(wxMenuBar *menu_bar);
67
68 // Get rect to be used to center top-level children
69 virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h);
70
71 protected:
72 // common part of all ctors
73 void Init();
74
75 // returns true if this frame has some contents and so should be visible,
76 // false if it's used solely as container for its children
77 bool ShouldBeVisible() const;
78
79
80 wxMenu *m_windowMenu;
81
82 // true if MDI Frame is intercepting commands, not child
83 bool m_parentFrameActive;
84
85 // true if the frame should be shown but is not because it is empty and
86 // useless otherwise than a container for its children
87 bool m_shouldBeShown;
88
89 private:
90 friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame;
91
92 DECLARE_EVENT_TABLE()
93 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame)
94 };
95
96 class WXDLLIMPEXP_CORE wxMDIChildFrame : public wxMDIChildFrameBase
97 {
98 public:
99 wxMDIChildFrame() { Init(); }
100 wxMDIChildFrame(wxMDIParentFrame *parent,
101 wxWindowID id,
102 const wxString& title,
103 const wxPoint& pos = wxDefaultPosition,
104 const wxSize& size = wxDefaultSize,
105 long style = wxDEFAULT_FRAME_STYLE,
106 const wxString& name = wxFrameNameStr)
107 {
108 Init() ;
109 Create(parent, id, title, pos, size, style, name);
110 }
111
112 bool Create(wxMDIParentFrame *parent,
113 wxWindowID id,
114 const wxString& title,
115 const wxPoint& pos = wxDefaultPosition,
116 const wxSize& size = wxDefaultSize,
117 long style = wxDEFAULT_FRAME_STYLE,
118 const wxString& name = wxFrameNameStr);
119
120 virtual ~wxMDIChildFrame();
121
122 // un-override the base class override
123 virtual bool IsTopLevel() const { return true; }
124
125 // implement MDI operations
126 virtual void Activate();
127
128
129 // Mac OS activate event
130 virtual void MacActivate(long timestamp, bool activating);
131
132 protected:
133 // common part of all ctors
134 void Init();
135
136 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame)
137 };
138
139 class WXDLLIMPEXP_CORE wxMDIClientWindow : public wxMDIClientWindowBase
140 {
141 public:
142 wxMDIClientWindow() { }
143 virtual ~wxMDIClientWindow();
144
145 virtual bool CreateClient(wxMDIParentFrame *parent,
146 long style = wxVSCROLL | wxHSCROLL);
147
148 protected:
149 virtual void DoGetClientSize(int *width, int *height) const;
150
151 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
152 };
153
154 #endif // _WX_OSX_CARBON_MDI_H_