NCBI C++ ToolKit
test_views.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: test_views.cpp 23394 2011-03-18 18:36:24Z falkrb $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Andrey Yazhuk
27  *
28  */
29 
30 #include <ncbi_pch.hpp>
31 
33 #include <wx/sizer.h>
34 
36 
37 ///////////////////////////////////////////////////////////////////////////////
38 /// CwxGLTestView
40  "OpenGL Test View", // type name
41  "", // icon alias TODO
42  "OpenGL Test View hint",
43  "OpenGL Test View description",
44  "", // help ID
45  "Test", // category
46  false); // not a singleton
47 
48 
50 : m_Client(NULL)
51 {
52 }
53 
54 
56 {
57  return m_TypeDescr;
58 }
59 
60 
62 {
63 }
64 
65 
66 void CwxGLTestView::CreateViewWindow(wxWindow* parent)
67 {
68  m_Client = new CGLTestWMClient(parent);
69 }
70 
71 
73 {
74  if(m_Client) {
75  m_Client->Destroy();
76  m_Client = NULL;
77  }
78 }
79 
80 
82 {
83  return m_Client;
84 }
85 
87 {
88  return "CwxGLTestView WM Client";
89 }
90 
92 {
93  return m_TypeDescr.GetLabel();
94 }
95 
96 
98 {
99  return m_TypeDescr.GetIconAlias();
100 }
101 
102 
104 {
105  return m_Client->GetColor();
106 }
107 
108 
110 {
112 }
113 
114 
115 const wxMenu* CwxGLTestView::GetMenu()
116 {
117  return m_Client->GetMenu();
118 }
119 
120 
121 void CwxGLTestView::UpdateMenu(wxMenu& root_menu)
122 {
123  return m_Client->UpdateMenu(root_menu);
124 }
125 
126 
128 {
129  return CFingerprint(m_TypeDescr.GetLabel(), false);
130 }
131 
132 
133 ///////////////////////////////////////////////////////////////////////////////
134 /// CwxGLTestViewFactory
136 {
137  //TODO
138 }
139 
140 
142 {
144 }
145 
146 
148 {
149  return new CwxGLTestView();
150 }
151 
152 
154 {
156  if(print == fingerprint) {
157  return new CwxGLTestView();
158  }
159  return NULL;
160 }
161 
162 
163 ///////////////////////////////////////////////////////////////////////////////
164 /// CClockView
166  "Clock View", // type name
167  "", // icon alias TODO
168  "Clock Test View hint.",
169  "Clock Test View description.",
170  "", // help ID
171  "Test", // category
172  false); // not a singleton
173 
174 
176 {
177  return m_TypeDescr;
178 }
179 
180 
182 {
183 }
184 
185 
186 void CClockView::CreateViewWindow(wxWindow* parent)
187 {
188  m_Client = new CClockPanelWMClient(parent);
189 }
190 
191 
193 {
194  if(m_Client) {
195  m_Client->Destroy();
196  m_Client = NULL;
197  }
198 }
199 
200 
202 {
204 }
205 
206 
207 ///////////////////////////////////////////////////////////////////////////////
208 /// CClockViewFactory
210 {
211 }
212 
213 
215 {
217 }
218 
219 
221 {
222  return new CClockView();
223 }
224 
225 
227 {
229  if(print == fingerprint) {
230  return new CClockView();
231  }
232  return NULL;
233 }
234 
235 
CClockPanelWMClient.
virtual IView * CreateInstance() const
creates a view instance
Definition: test_views.cpp:220
virtual IView * CreateInstanceByFingerprint(const TFingerprint &fingerprint) const
if fingerprint is recognized - creates and returns a new instance
Definition: test_views.cpp:226
virtual const CViewTypeDescriptor & GetViewTypeDescriptor() const
returns a Descriptor for the View Type supported by the Factory
Definition: test_views.cpp:214
virtual void RegisterIconAliases(wxFileArtProvider &provider)
CClockViewFactory.
Definition: test_views.cpp:209
CClockView.
Definition: test_views.hpp:104
virtual IWMClient::CFingerprint GetFingerprint() const
overriding CClockPanelWMClient::GetFingerprint()
Definition: test_views.cpp:201
CClockPanelWMClient * m_Client
Definition: test_views.hpp:121
static CViewTypeDescriptor m_TypeDescr
CClockView.
Definition: test_views.hpp:119
virtual void SetWorkbench(IWorkbench *workbench)
connect / disconnect this view with / from Workbench
Definition: test_views.cpp:181
virtual const CViewTypeDescriptor & GetTypeDescriptor() const
return an object providing meta information about thei view type
Definition: test_views.cpp:175
virtual void DestroyViewWindow()
destroy Window corresponding to the view
Definition: test_views.cpp:192
virtual void CreateViewWindow(wxWindow *parent)
create Window corresponding to the view
Definition: test_views.cpp:186
CTextWMClient.
virtual void UpdateMenu(wxMenu &root_menu)
virtual void SetColor(const CRgbaColor &color)
returns a color associated with the client
virtual const wxMenu * GetMenu()
returns a menu (must be deleted by the caller) menu injections should follow a separator named "Contr...
virtual const CRgbaColor * GetColor() const
returns a color associated with the client, n/a if NULL
class CRgbaColor provides a simple abstraction for managing colors.
Definition: rgba_color.hpp:58
CViewTypeDescriptor - holds description of a view type.
Definition: view.hpp:98
virtual const CViewTypeDescriptor & GetViewTypeDescriptor() const
returns a Descriptor for the View Type supported by the Factory
Definition: test_views.cpp:141
virtual void RegisterIconAliases(wxFileArtProvider &provider)
CwxGLTestViewFactory.
Definition: test_views.cpp:135
virtual IView * CreateInstance() const
creates a view instance
Definition: test_views.cpp:147
virtual IView * CreateInstanceByFingerprint(const TFingerprint &fingerprint) const
if fingerprint is recognized - creates and returns a new instance
Definition: test_views.cpp:153
CwxGLTestView.
Definition: test_views.hpp:51
virtual string GetIconAlias() const
returns an icon alias that can be used to retrieve the client's icon
Definition: test_views.cpp:97
CGLTestWMClient * m_Client
Definition: test_views.hpp:81
virtual const CRgbaColor * GetColor() const
returns a color associated with the client, n/a if NULL
Definition: test_views.cpp:103
virtual void DestroyViewWindow()
destroy Window corresponding to the view
Definition: test_views.cpp:72
virtual void UpdateMenu(wxMenu &root_menu)
Definition: test_views.cpp:121
virtual wxWindow * GetWindow()
returns a pointer to the wxWindow representing the client
Definition: test_views.cpp:81
virtual CFingerprint GetFingerprint() const
returns a fingerprint identifying the client
Definition: test_views.cpp:127
virtual string GetClientLabel() const
Definition: test_views.cpp:91
virtual const wxMenu * GetMenu()
returns a menu (must be deleted by the caller) menu injections should follow a separator named "Contr...
Definition: test_views.cpp:115
static CViewTypeDescriptor m_TypeDescr
CwxGLTestView.
Definition: test_views.hpp:80
virtual const CViewTypeDescriptor & GetTypeDescriptor() const
return an object providing meta information about thei view type
Definition: test_views.cpp:55
virtual void SetWorkbench(IWorkbench *workbench)
connect / disconnect this view with / from Workbench
Definition: test_views.cpp:61
virtual void CreateViewWindow(wxWindow *parent)
create Window corresponding to the view
Definition: test_views.cpp:66
virtual void SetColor(const CRgbaColor &color)
returns a color associated with the client
Definition: test_views.cpp:109
IView - represents a standard visual part of Workbench UI.
Definition: view.hpp:73
CFingerprint identifies an instance of IWMClient and is used for labeling layout positions.
Definition: wm_client.hpp:58
ELabel
Different flavors of label types for different GUI aspects.
Definition: wm_client.hpp:80
IWorkbench is the central interface in the application framework.
Definition: workbench.hpp:113
#define NULL
Definition: ncbistd.hpp:225
virtual const string & GetIconAlias() const
Definition: ui_object.cpp:130
virtual const string & GetLabel() const
Definition: ui_object.cpp:124
string GetLabel(const CSeq_id &id)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
n background color
Modified on Tue Dec 05 02:10:36 2023 by modify_doxy.py rev. 669887