ALBA
albaGUIDictionaryWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaGUIDictionaryWidget
5 Authors: Daniele Giunchi
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16
17#ifndef __albaGUIDictionaryWidget_H__
18#define __albaGUIDictionaryWidget_H__
19
20// albaGUIDictionaryWidget :
24#include "albaObserver.h"
25#include "albaStorable.h"
26#include "albaDefines.h"
27#include "albaGUIListCtrl.h"
28//----------------------------------------------------------------------------
29// Forward Refs:
30//----------------------------------------------------------------------------
31class albaVME;
32class albaGUIListCtrl;
33class albaEvent;
34class albaObserver;
35
36
41class ALBA_EXPORT albaGUIDictionaryWidget : public albaObserver
42{
43
44public:
46 albaGUIDictionaryWidget(wxWindow *parent, int id);
50 void SetListener(albaObserver *Listener) {m_Listener = Listener;};
52 void OnEvent(albaEventBase *event);
53
55 void SetCloud(albaVME *vme);
56
57 void AddItem(wxString item);
58
59 int RemoveItem(long itemId);
60
61 int RemoveItem(albaString itemName);
62
63 int GetItemIndex(albaString itemName);
64
66
67 int UpdateItem(albaString oldItemName, albaString newItemName);
68
69 int SelectItem(albaString itemName, bool select=true);
70
71 int DeselectItem(albaString itemName);
72
73 int GetSize() { return m_Items.size(); };
74
75 void SetTitle(wxString title){ m_List->SetColumnLabel(0, title); };
76
78 wxString ChooseItem();
79
82
84 void LoadDictionary(wxString file);
85
86 void InitDictionary(std::vector<wxString> *strVect);
87
89 wxWindow *GetWidget() {return (wxWindow *)m_List;};
90
92 const char* GetDictionaryFileName(){return m_File;};
93
94protected:
96 void ValidateAllItem(bool valid = true);
97
99 wxString m_File;
100 std::vector<albaString> m_Items;
101 std::vector<bool> m_Selections;
104};
105
106#ifdef ALBA_EXPORTS
107#include "albaDllMacros.h"
108EXPORT_STL_VECTOR(ALBA_EXPORT,albaString);
109#endif
114class ALBA_EXPORT albaStorableDictionary: public albaObject, public albaStorable
115{
116public:
124 virtual int InternalStore(albaStorageElement *parent){return ALBA_OK;}
127 std::vector<albaString> m_StrVector;
128};
129#endif
ALBA_OK
Definition: albaDefines.h:66
#define EXPORT_STL_VECTOR(declspec_, T_)
Definition: albaDllMacros.h:84
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
albaEvent - Class implementing ALBA application events.
Definition: albaEvent.h:55
class name : albaGUIDictionaryWidget Widget that handle a dictionary object.
int DeselectItem(albaString itemName)
void SetTitle(wxString title)
std::vector< albaString > m_Items
std::vector< bool > m_Selections
int GetItemIndex(albaString itemName)
albaGUIDictionaryWidget(wxWindow *parent, int id)
constructor
wxString ChooseItem()
Return choosed item.
void SetCloud(albaVME *vme)
Set the reference cloud.
void LoadDictionary()
Load dictionary opening file dialog.
void SetListener(albaObserver *Listener)
Set the listener of the events launched.
~albaGUIDictionaryWidget()
destructor
int RemoveItem(albaString itemName)
int SelectItem(albaString itemName, bool select=true)
wxWindow * GetWidget()
Return dictionary GUI.
int UpdateItem(albaString oldItemName, albaString newItemName)
void InitDictionary(std::vector< wxString > *strVect)
albaString GetItemByIndex(int index)
void LoadDictionary(wxString file)
Load dictionary from file.
int RemoveItem(long itemId)
void ValidateAllItem(bool valid=true)
Set the icon of all the items present into the cloud to red or gray according to valid.
void AddItem(wxString item)
const char * GetDictionaryFileName()
Return file name dictionary.
void OnEvent(albaEventBase *event)
Answer to the messages coming from interface.
albaGUIListCtrl allows a simplified use of a wxWindows ListCtrl widget.
Abstract superclass for all ALBA classes implementing RTTI APIs.
Definition: albaObject.h:38
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36
class name: albaStorableDictionary Utility object that supply the InternalStore and InternalRestore m...
std::vector< albaString > m_StrVector
virtual int InternalStore(albaStorageElement *parent)
serialize object attributes
virtual int InternalRestore(albaStorageElement *node)
restore object attributes
~albaStorableDictionary()
destructor
albaStorableDictionary()
constructor
albaTypeMacro(albaStorableDictionary, albaObject)
RTTI macro.
albaStorable is an interface for serializable objects.
Definition: albaStorable.h:41
Abstract class representing the interface for the unit of information stored in the storage.
albaString - performs common string operations on c-strings.
Definition: albaString.h:43
albaVME -
Definition: albaVME.h:150