ALBA
albaGUIDynamicVP.h
Go to the documentation of this file.
1/*=========================================================================
2 Program: Multimod Application Framework RELOADED
3 Module: $RCSfile: albaGUIDynamicVP.h,v $
4 Language: C++
5 Date: $Date: 2012-04-06 08:28:41 $
6 Version: $Revision: 1.1.2.5 $
7 Authors: Josef Kohout (Josef.Kohout *AT* beds.ac.uk)
8 ==========================================================================
9 Copyright (c) 2008 University of Bedfordshire (www.beds.ac.uk)
10 See the COPYINGS file for license details
11 =========================================================================
12*/
13
14#ifndef __albaGUIDynamicVP_H__
15#define __albaGUIDynamicVP_H__
16
17//----------------------------------------------------------------------------
18// Include:
19//----------------------------------------------------------------------------
20#include "albaDefines.h"
21#include "albaEvent.h"
22#include "albaObserver.h"
23#include "albaGUIPanel.h"
24
25//----------------------------------------------------------------------------
26// forward references :
27//----------------------------------------------------------------------------
28class albaPipe;
29class albaSceneNode;
30
31class albaView;
32class albaGUI;
34class wxStaticLine;
35
36//----------------------------------------------------------------------------
51//----------------------------------------------------------------------------
52class ALBA_EXPORT albaGUIDynamicVP: public albaGUIPanel, public albaObserver
53{
54public:
56 {
57 ID_NAME = MINID, //must be MINID otherwise validators do not work
60 };
61
63 {
64 GS_DEFAULT = 0,
65 GS_READONLY_NAME = 1,
66 GS_NO_NAME = 2,
67 GS_NO_CREATE_VP = 4,
68 GS_NO_CLOSE_VP = 8,
69 };
70
71 //structure to store information about visual pipe
72 typedef struct SUPPORTED_VP_ENTRY
73 {
74 const char* szClassName;
75 const char* szUserFriendlyName;
76 } SUPPORTED_VP_ENTRY;
77
78protected:
79#pragma region Register of Pipes
85 {
86 protected:
87 typedef struct VIEW_ITEM
88 {
90 std::vector< albaPipe* > m_Pipes;
91 } VIEW_ITEM;
92
93 static std::vector< VIEW_ITEM > m_RegViews;
94 public:
98 static int RegisterPipe(albaPipe* pipe, albaView* view);
99
102 static int UnregisterPipe(albaPipe* pipe, albaView* view = NULL);
103 protected:
105 static int FindView(albaView* view);
106 };
107#pragma endregion Register of Pipes
108
109protected:
111 wxWindowID m_NotifyId;
113
115
120
121#pragma region GUI
122 wxComboBox* m_ComboVP;
123
124 wxPanel* m_GUI_This;
126#pragma endregion GUI
127
129
130protected:
133
134public:
136 albaGUIDynamicVP(wxWindow* parent, wxWindowID id,
137 long GUIstyle = GS_DEFAULT,
138 const wxPoint& pos = wxDefaultPosition,
139 const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
142
145 return m_Listener;
146 };
147
149 inline void SetListener(albaObserver *Listener){
150 m_Listener = Listener;
151 };
152
154 inline const char* GetName() {
155 return m_Name;
156 }
157
159 void SetName(const char* szNewName);
160
163 return m_VPipes;
164 }
165
168
170 inline int GetVPipeIndex() {
171 return m_VPipeIndex;
172 }
173
175 void SetVPipeIndex(int nNewIndex);
176
178 inline long GetGUIStyle() {
179 return m_GuiStyle;
180 }
181
183 void SetGUIStyle(long newtyle);
184
187 return m_SceneNode;
188 }
189
193
196 return m_VPipe;
197 }
198
200 /*virtual*/ void OnEvent(albaEventBase *e);
201
202protected:
204 virtual void CreateVisualPipe(const char* classname);
205
207 virtual void DestroyVisualPipe();
208
210 virtual void OnCreateVP();
211
213 virtual void OnCloseVP();
214
217 virtual void NotifyListener(long nData);
218
224 virtual wxSizer* CreateGUI(long style);
225
229 void OnDeferedDelete(wxEvent& event);
230};
231#endif
MINID
Definition: albaDecl.h:420
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
class name: albaPipeRegister This class registe the pipes.
static std::vector< VIEW_ITEM > m_RegViews
array of registered views-pipes
static int UnregisterPipe(albaPipe *pipe, albaView *view=NULL)
Unregisters the specified pipe with the view (if specified).
static int FindView(albaView *view)
returns index of given view in m_RegViews, or -1, if not found
static int RegisterPipe(albaPipe *pipe, albaView *view)
Registers the specified pipe with the view.
albaGUIDynamicVP is a wxPanel with a set of widget to handle dynamic construction/destruction of visu...
albaObserver * GetListener()
Gets the listener that will be notified when any control changes.
DECLARE_EVENT_TABLE()
declare event table macro
long GetGUIStyle()
Gets the current style.
albaPipe * GetCurrentVisualPipe()
Gets the currently constructed visual pipe.
bool m_BGUIThisShown
true, if the GUIThis is shown
albaSceneNode * GetSceneNode()
Gets the current scene node.
virtual void NotifyListener(long nData)
Notifies the listener, sending the specified notify id and nData as and argument.
albaGUIDynamicVP(wxWindow *parent, wxWindowID id, long GUIstyle=GS_DEFAULT, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
constructor
void SetSceneNode(albaSceneNode *node)
Sets a new scene node for visual pipes.
virtual void DestroyVisualPipe()
Destroys geometry visual pipe.
void SetVPipeIndex(int nNewIndex)
Sets a new visual pipe.
void OnDeferedDelete(wxEvent &event)
Handles destroying of controls.
virtual void OnCloseVP()
Handles the closing of VP.
const SUPPORTED_VP_ENTRY * GetVPipesList()
Gets the current list of visual pipes.
void SetGUIStyle(long newtyle)
Sets a new style = combination from GUI_STYLE.
const SUPPORTED_VP_ENTRY * m_VPipes
list of currently supported visual pipes, terminated by (NULL, NULL)
wxComboBox * m_ComboVP
int m_VPipeIndex
index of the selected visual pipe
wxWindowID m_NotifyId
Id used for when listener is notified.
void SetVPipesList(const SUPPORTED_VP_ENTRY *pList)
Sets a new list of visual pipes.
albaSceneNode * m_SceneNode
reference to the scene node associated with this pipe
virtual ~albaGUIDynamicVP()
destructor
albaObserver * m_Listener
object that is notified when something changes (notified by ID)
albaGUIScrolledPanel * m_GUI_VP
const char * GetName()
Gets the currently associated name with the GUI.
void SetName(const char *szNewName)
Sets a new name associated with the GUI.
void SetListener(albaObserver *Listener)
Specifies the listener that will be notified when any control changes.
int GetVPipeIndex()
Gets the currently selected visual pipe.
virtual void OnCreateVP()
Handles the construction of VP.
albaString m_Name
user name associated with this panel
albaPipe * m_VPipe
this is the current visual pipe
long m_GuiStyle
style/mode of the GUI
virtual void CreateVisualPipe(const char *classname)
Constructs geometry visual pipe.
virtual wxSizer * CreateGUI(long style)
Creates GUI (to be added into m_GUI_This) according to the given style.
void OnEvent(albaEventBase *e)
process the events sent by subjects
class name: albaGUIPanel Inherits directly from wxPanel and adds the pointer to the next panel
Definition: albaGUIPanel.h:27
albaGUIScrolledPanel is a Panel on which is possible to add child-widget.
albaGUI is a panel with function to easily create GUI.
Definition: albaGUI.h:110
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36
albaSceneNode is a node of albaScenegraph.
Definition: albaSceneNode.h:32
albaString - performs common string operations on c-strings.
Definition: albaString.h:43
albaView is the base class for Views in alba.
Definition: albaView.h:79
const char * szClassName
visual pipe class name
const char * szUserFriendlyName
user friendly name to be displayed in GUI