ALBA
albaGUIListCtrl.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaGUIListCtrl
5 Authors: Silvano Imboden
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#ifndef __albaGUIListCtrl_H__
17#define __albaGUIListCtrl_H__
18//----------------------------------------------------------------------------
19// Include:
20//----------------------------------------------------------------------------
21#include <wx/laywin.h>
22#include <wx/image.h>
23#include <wx/imaglist.h>
24#include <wx/listctrl.h>
25#include <wx/hash.h>
26
27#include "albaEvent.h"
28#include "albaObserver.h"
29#include "albaGUINamedPanel.h"
30//----------------------------------------------------------------------------
31// Constants :
32//----------------------------------------------------------------------------
35{
36 ITEM_ERROR =-1, //restituito da GetItemIcon(id) se id non esiste
37
38
39 ITEM_YELLOW =0, //todo: to be verified (after changes in albaGUIBitmaps) //SIL. 7-4-2005:
43};
44//----------------------------------------------------------------------------
45// albaGUIListCtrl :
46//----------------------------------------------------------------------------
49{
50public:
51 albaGUIListCtrl (wxWindow* parent, wxWindowID id=-1, bool CloseButton = false, bool HideTitle = false);
53 void SetListener (albaObserver *listener) {m_Listener=listener;};
54
56 void Reset();
57
59 bool AddItem(wxString label, ITEM_ICONS icon = ITEM_GRAY);
60
62 bool DeleteItem(long index);
63
65 void DeselectItem(long index);
66
68 bool SetItemLabel(long index, wxString label);
69
71 wxString GetItemLabel (long index);
72
74 bool SetItemIcon(long index, ITEM_ICONS icon);
75
77 ITEM_ICONS GetItemIcon (long index);
78
80 bool SelectItem(long index);
81
83 void SetColumnLabel(int col, wxString label);
84
85protected:
87 void OnSelectionChanged(wxListEvent& event);
88
90 wxListCtrl *m_List;
91 wxImageList *m_Images;
93
94DECLARE_EVENT_TABLE()
95}; // end of albaGUIListCtrl
96#endif
ITEM_ICONS
possible values for icon
ITEM_ICONS
possible values for icon
@ ITEM_GRAY
@ ITEM_ERROR
@ ITEM_YELLOW
@ ITEM_RED
@ ITEM_BLUE
albaGUIListCtrl allows a simplified use of a wxWindows ListCtrl widget.
wxString GetItemLabel(long index)
Get the item's label.
bool AddItem(wxString label, ITEM_ICONS icon=ITEM_GRAY)
Add one item to the list.
ITEM_ICONS GetItemIcon(long index)
Get the item's icon.
bool DeleteItem(long index)
Remove the item from the list.
wxListCtrl * m_List
void SetListener(albaObserver *listener)
bool SetItemLabel(long index, wxString label)
Set the item's label.
void OnSelectionChanged(wxListEvent &event)
Notify the Listener of item selection and deselection.
albaGUIListCtrl(wxWindow *parent, wxWindowID id=-1, bool CloseButton=false, bool HideTitle=false)
void Reset()
Clear the control list.
wxImageList * m_Images
bool SetItemIcon(long index, ITEM_ICONS icon)
Set the item's icon, return true on success.
void DeselectItem(long index)
Deselect an item from the list.
bool SelectItem(long index)
Select the item 'id'.
albaObserver * m_Listener
virtual ~albaGUIListCtrl()
void SetColumnLabel(int col, wxString label)
Set the label for the list's column.
Class Name: albaGUINamedPanel.
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36