ALBA
albaGUILutWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaGUILutWidget
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
17#ifndef __albaGUILutWidget_H__
18#define __albaGUILutWidget_H__
19
20#include "albaDecl.h"
21#include "albaEvent.h"
22#include "albaColor.h"
23#include "vtkLookupTable.h"
24//----------------------------------------------------------------------------
28class albaGUILutWidget: public wxPanel, public albaObserver
29{
30public:
31 albaGUILutWidget(wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
32 const wxSize& size = wxSize(300,290), long style = wxTAB_TRAVERSAL /*| wxSUNKEN_BORDER */);
33
34 virtual void SetListener(albaObserver *Listener) {m_Listener = Listener;};
35 void OnEvent( albaEventBase *event );
36
38 albaColor GetSelectionColor(); // return the color of the first selected entry
41 void GetSelection(int *min, int *max, int *num=NULL);
42
43 struct LutEntry {
46 } m_LutEntry[257];
47
48 void SetNumEntry( int num );
49
50 //void ReadLut(vtkLookupTable *lut);
51 //void WriteLut(vtkLookupTable *lut);
52 void SetLut(vtkLookupTable *lut);
53
54protected:
56 vtkLookupTable *m_Lut;
57
60
64 int m_SelectionColMax; //selection rectangle expressed using row/cols coord -- used during drag operation
65
66 wxBitmap m_Bmp; //the bitmap with the LUT
67 wxBitmap m_Bmp2; //the bitmap with the LUT and the Selection Indicator
68 wxPoint m_BmpPosition; //position of the bitmap
69 wxSize m_BmpSize; //size of the bitmap
70
74 int m_EntryM; // margin
76
77 void InitBitmaps();
78 void DrawEntries();
79 void DrawEntry(int idx);
81 void OnEraseBackground(wxEraseEvent& event) {}; // overriden to prevent flickering
82 void OnPaint(wxPaintEvent &event);
83
84 int MouseToIndex(wxMouseEvent &event);
85 void OnLeftMouseButtonDown(wxMouseEvent &event);
86 void OnLeftMouseButtonUp(wxMouseEvent &event);
87 void OnMouseMotion(wxMouseEvent &event);
88
89 DECLARE_EVENT_TABLE()
90};
91#endif
albaColor is a class representing an RGBA color:
Definition: albaColor.h:44
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
albaGUILutWidget : Helper class for albaLutEditor
vtkLookupTable * m_Lut
albaColor GetSelectionColor()
void DrawEntry(int idx)
virtual void SetListener(albaObserver *Listener)
albaGUILutWidget(wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(300, 290), long style=wxTAB_TRAVERSAL)
albaObserver * m_Listener
void GetSelection(int *min, int *max, int *num=NULL)
void ShadeSelectionInRGB()
void SetSelectionColor(albaColor col)
void OnMouseMotion(wxMouseEvent &event)
void OnEvent(albaEventBase *event)
process the events sent by subjects
void OnLeftMouseButtonUp(wxMouseEvent &event)
void OnPaint(wxPaintEvent &event)
void SetNumEntry(int num)
int MouseToIndex(wxMouseEvent &event)
void ShadeSelectionInHSV()
void OnEraseBackground(wxEraseEvent &event)
struct albaGUILutWidget::LutEntry m_LutEntry[257]
void OnLeftMouseButtonDown(wxMouseEvent &event)
void SetLut(vtkLookupTable *lut)
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36