ALBA
albaGUIColorWidget.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaGUIColorWidget
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 __albaGUIColorWidget_H__
18#define __albaGUIColorWidget_H__
19
20#include "albaDecl.h"
21#include "albaEvent.h"
22#include "albaColor.h"
23#include "albaGUIColorSwatch.h"
28class ALBA_EXPORT albaGUIColorWidget: public wxPanel, public albaObserver
29{
30public:
31 albaGUIColorWidget(wxWindow* parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
32 const wxSize& size = wxSize(350,135), long style = wxTAB_TRAVERSAL);
33
34 virtual void SetListener(albaObserver *Listener) {m_Listener = Listener;};
35
38
39 void OnEvent( albaEventBase *event );
40
41protected:
43
44 wxBitmap m_HsvBmp; //the bitmap with the hsv chooser
45 wxPoint m_HsvPosition; //position of the hsv chooser
46 int m_HsvSize; //size of the hsv chooser
47 int m_HsvInnerRadius; //inner radius of the h cirle
48 int m_HsvOuterRadius; //outer radius of the h cirle
49 wxPoint m_SvPosition; //position of the sv chooser within the hsv bmp
50 int m_SvSize; //size of the sv chooser
51
52 wxBitmap m_AlphaBmp; //the bitmap with the alpha chooser
53 wxPoint m_AlphaBmpPosition; //position of the alpha chooser
54 wxSize m_AlphaBmpSize; //size of the alpha chooser
55
56 int m_CursorSize; //cursor size
57 wxPoint m_AlphaCursorPosition; //position of the a cursor
58 wxPoint m_HsvCursorPosition; //position of the h cursor
59 wxPoint m_SvCursorPosition; //position of the sv cursor
60 int m_Dragging; //= DRAG_NONE | DRAG_H | DRAG_SV
61
62 void InitBitmap(); // create the bitmaps, draw the h circle
63 void UpdateHSVBitmap(); // update the sv square (H changed)
64 void UpdateAlphaBitmap(); // update the alpha chooser (A changed)
65 void PaintHandles(wxPaintDC &DC);
66 void OnPaint(wxPaintEvent &event);
67
68 void OnLeftMouseButtonDown(wxMouseEvent &event);
69 void OnLeftMouseButtonUp(wxMouseEvent &event);
70 void OnMouseMotion(wxMouseEvent &event);
71 void OnColorChanged(bool notify = true);
72
73 // widgets
76
79
80 DECLARE_EVENT_TABLE()
81};
82#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
albaGUIColorSwatch : small widget representing an RGBA color.
albaGUIColorWidget : helper class for albaGUILutEditor and albaGUIColorEditor.
void PaintHandles(wxPaintDC &DC)
void SetColor(albaColor c)
albaObserver * m_Listener
albaGUIColorWidget(wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(350, 135), long style=wxTAB_TRAVERSAL)
virtual void SetListener(albaObserver *Listener)
void OnColorChanged(bool notify=true)
void OnLeftMouseButtonDown(wxMouseEvent &event)
void OnLeftMouseButtonUp(wxMouseEvent &event)
albaColor GetColor()
albaGUIColorSwatch * m_PrevColorSwatch
void OnMouseMotion(wxMouseEvent &event)
albaGUIColorSwatch * m_ColorSwatch
void OnPaint(wxPaintEvent &event)
void OnEvent(albaEventBase *event)
process the events sent by subjects
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36