]> git.saurik.com Git - wxWidgets.git/blob - utils/framelayout/src/frmview.h
Cleaned up paint DC cache in ~wxPaintDC to avoid spurious memory warning
[wxWidgets.git] / utils / framelayout / src / frmview.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: No names yet.
3 // Purpose: Contrib. demo
4 // Author: Aleksandras Gluchovas
5 // Modified by:
6 // Created: 02/01/99
7 // RCS-ID: $Id$
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef __FRMVIEW_G__
13 #define __FRMVIEW_G__
14
15 #include "wx/module.h"
16
17 #if 0
18 #include "objstore.h"
19 #endif
20
21 class wxObjectStorage;
22
23 #include "controlbar.h"
24
25 class wxFrameManager;
26
27 class wxFrameView : public wxEvtHandler
28 {
29 protected:
30 wxStringList mTopMenus;
31 wxFrameLayout* mpLayout;
32 wxFrameManager* mpFrameMgr;
33 bool mDoToolUpdates;
34
35 friend class wxFrameManager;
36 friend class wxFrameViewSerializer;
37
38 protected:
39 void OnIdle( wxIdleEvent& event);
40
41 public:
42 wxFrameView();
43 ~wxFrameView();
44
45 virtual void Activate();
46 virtual void Deactivate();
47
48 wxFrame* GetParentFrame();
49 wxWindow* GetClientWindow();
50
51 wxFrameManager& GetFrameManager();
52
53 void RegisterMenu( const wxString& topMenuName );
54
55 void CreateLayout();
56 wxFrameLayout* GetLayout();
57 void SetLayout( wxFrameLayout* pLayout );
58 void SetToolUpdates( bool doToolUpdates = TRUE );
59
60
61 // hooks for specific frame-views
62
63 virtual void OnInit() {}
64
65 virtual void OnSerialize( wxObjectStorage& store ) {}
66 virtual void OnActiveate() {}
67 virtual void OnDeactivate() {}
68
69 // imp. is mandatory
70 virtual void OnRecreate() {}
71 virtual void OnInitMenus() {}
72
73 DECLARE_EVENT_TABLE()
74 };
75
76 class wxFrame;
77
78 class wxFrameManager : wxObject
79 {
80 protected:
81 wxList mViews;
82 wxWindow* mpFrameWnd;
83 int mActiveViewNo;
84 wxWindow* mpClientWnd;
85
86 #if 0
87 wxObjectStorage mStore;
88 #endif
89
90 wxString mSettingsFile;
91
92 protected:
93 void DoSerialize( wxObjectStorage& store );
94 void DestroyViews();
95 int GetViewNo( wxFrameView* pView );
96 void EnableMenusForView( wxFrameView* pView, bool enable );
97 void SyncAllMenus();
98
99 public:
100 wxFrameManager();
101 ~wxFrameManager();
102
103 // if file name is empty, views are are not saved/loaded
104
105 virtual void Init( wxWindow* pMainFrame, const wxString& settingsFile = "" );
106
107 // synonyms
108 wxFrame* GetParentFrame();
109 wxWindow* GetParentWindow();
110
111 int GetActiveViewNo();
112 wxFrameView* GetActiveView();
113 wxNode* GetActiveViewNode();
114
115 wxFrameView* GetView( int viewNo );
116
117 void SetClinetWindow( wxWindow* pFrameClient );
118 wxWindow* GetClientWindow();
119
120 void AddView( wxFrameView* pFrmView );
121 void RemoveView( wxFrameView* pFrmView );
122
123 void ActivateView( int viewNo );
124 void ActivateView( wxFrameView* pFrmView );
125 void DeactivateCurrentView();
126
127 wxObjectStorage& GetObjectStore();
128
129 void SaveViewsNow();
130 bool ReloadViews();
131
132 bool ViewsAreLoaded();
133 };
134
135 #endif