]>
Commit | Line | Data |
---|---|---|
8e08b761 JS |
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 | #ifdef __GNUG__ | |
16 | #pragma interface "frmview.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/module.h" | |
20 | ||
21 | #if 0 | |
22 | #include "wx/fl/objstore.h" | |
23 | #endif | |
24 | ||
25 | class wxObjectStorage; | |
26 | ||
27 | #include "wx/fl/controlbar.h" | |
28 | ||
29 | class wxFrameManager; | |
30 | ||
31 | class wxFrameView : public wxEvtHandler | |
32 | { | |
33 | protected: | |
34 | wxStringList mTopMenus; | |
35 | wxFrameLayout* mpLayout; | |
36 | wxFrameManager* mpFrameMgr; | |
37 | bool mDoToolUpdates; | |
38 | ||
39 | friend class wxFrameManager; | |
40 | friend class wxFrameViewSerializer; | |
41 | ||
42 | protected: | |
43 | void OnIdle( wxIdleEvent& event); | |
44 | ||
45 | public: | |
46 | wxFrameView(); | |
47 | ~wxFrameView(); | |
48 | ||
49 | virtual void Activate(); | |
50 | virtual void Deactivate(); | |
51 | ||
52 | wxFrame* GetParentFrame(); | |
53 | wxWindow* GetClientWindow(); | |
54 | ||
55 | wxFrameManager& GetFrameManager(); | |
56 | ||
57 | void RegisterMenu( const wxString& topMenuName ); | |
58 | ||
59 | void CreateLayout(); | |
60 | wxFrameLayout* GetLayout(); | |
61 | void SetLayout( wxFrameLayout* pLayout ); | |
62 | void SetToolUpdates( bool doToolUpdates = TRUE ); | |
63 | ||
64 | ||
65 | // hooks for specific frame-views | |
66 | ||
67 | virtual void OnInit() {} | |
68 | ||
69 | virtual void OnSerialize( wxObjectStorage& store ) {} | |
70 | virtual void OnActiveate() {} | |
71 | virtual void OnDeactivate() {} | |
72 | ||
73 | // imp. is mandatory | |
74 | virtual void OnRecreate() {} | |
75 | virtual void OnInitMenus() {} | |
76 | ||
77 | DECLARE_EVENT_TABLE() | |
78 | }; | |
79 | ||
80 | class wxFrame; | |
81 | ||
82 | class wxFrameManager : wxObject | |
83 | { | |
84 | protected: | |
85 | wxList mViews; | |
86 | wxWindow* mpFrameWnd; | |
87 | int mActiveViewNo; | |
88 | wxWindow* mpClientWnd; | |
89 | ||
90 | #if 0 | |
91 | wxObjectStorage mStore; | |
92 | #endif | |
93 | ||
94 | wxString mSettingsFile; | |
95 | ||
96 | protected: | |
97 | void DoSerialize( wxObjectStorage& store ); | |
98 | void DestroyViews(); | |
99 | int GetViewNo( wxFrameView* pView ); | |
100 | void EnableMenusForView( wxFrameView* pView, bool enable ); | |
101 | void SyncAllMenus(); | |
102 | ||
103 | public: | |
104 | wxFrameManager(); | |
105 | ~wxFrameManager(); | |
106 | ||
107 | // if file name is empty, views are are not saved/loaded | |
108 | ||
109 | virtual void Init( wxWindow* pMainFrame, const wxString& settingsFile = "" ); | |
110 | ||
111 | // synonyms | |
112 | wxFrame* GetParentFrame(); | |
113 | wxWindow* GetParentWindow(); | |
114 | ||
115 | int GetActiveViewNo(); | |
116 | wxFrameView* GetActiveView(); | |
117 | wxNode* GetActiveViewNode(); | |
118 | ||
119 | wxFrameView* GetView( int viewNo ); | |
120 | ||
121 | void SetClinetWindow( wxWindow* pFrameClient ); | |
122 | wxWindow* GetClientWindow(); | |
123 | ||
124 | void AddView( wxFrameView* pFrmView ); | |
125 | void RemoveView( wxFrameView* pFrmView ); | |
126 | ||
127 | void ActivateView( int viewNo ); | |
128 | void ActivateView( wxFrameView* pFrmView ); | |
129 | void DeactivateCurrentView(); | |
130 | ||
131 | wxObjectStorage& GetObjectStore(); | |
132 | ||
133 | void SaveViewsNow(); | |
134 | bool ReloadViews(); | |
135 | ||
136 | bool ViewsAreLoaded(); | |
137 | }; | |
138 | ||
139 | #endif /* __FRMVIEW_G__ */ | |
140 |