anatomist  5.1.2
3D neuroimaging data viewer
qwObjPalette.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 
35 #ifndef ANAQT_COLOR_QWOBJPALETTE_H
36 #define ANAQT_COLOR_QWOBJPALETTE_H
37 
38 
40 #include <cartobase/smart/rcptr.h>
41 #include <qwidget.h>
42 #include <qaction.h>
43 
44 class QListWidgetItem;
45 
46 namespace anatomist
47 {
48  class AObjectPalette;
49  class APalette;
50  class APaletteExtensionAction;
51 }
52 
53 
54 class QAPaletteWin : public QWidget, public anatomist::APaletteWin
55 {
56  Q_OBJECT
57 
58 public:
59  QAPaletteWin( const std::set<anatomist::AObject *> & obj );
60  virtual ~QAPaletteWin();
61 
62  virtual void update( const anatomist::Observable* obs, void* arg );
63 
64  static anatomist::APaletteWin*
65  createPalWin( const std::set<anatomist::AObject* > & obj );
72 
73 signals:
74 
75 protected slots:
77  void palette2Changed( const QString & );
78  void min1Changed( int value );
79  void max1Changed( int value );
80  void min2Changed( int value );
81  void max2Changed( int value );
82  void responsiveToggled( bool val );
83  void updateClicked();
84  void dimChanged( int );
85  void mixMethodChanged( const QString & );
86  void palette1DMappingMethodChanged( const QString & );
87  void enablePalette2( bool );
88  void mixFactorChanged( int );
93  void resetValues1();
94  void resetValues2();
95  void resetBounds1();
96  void resetBounds2();
97  void chooseObject();
98  void objectsChosen( const std::set<anatomist::AObject *> & );
99  void extensionActionTriggered( QAction* action );
100  void zeroCentered1Changed( int state );
101  void zeroCentered2Changed( int state );
102 
103 
104 protected:
105  struct DimBox;
106 
107  virtual void closeEvent( QCloseEvent* );
109 
111 
112  void fillPalettes();
113  void fillPalette1();
114  void fillPalette2();
116  QPixmap & pix );
117  void fillObjPal();
119  virtual QWidget* makeDimBox( const QString & title, QWidget* parent,
120  DimBox* dbox );
121  virtual void setValues( DimBox* dimBox, float min, float max,
122  float objMin, float objMax );
123  virtual void setValues1();
124  virtual void setValues2();
125  virtual void updateObjects();
126  virtual void updateObjPal();
130  void runCommand();
131  void fillToolBar();
132 
133 private:
134  struct Private;
135  Private *d;
136 };
137 
138 
139 namespace anatomist
140 {
141 
142  class APaletteExtensionAction : public QAction
143  {
144  Q_OBJECT
145 
146  public:
147  friend class ::QAPaletteWin;
148 
149  APaletteExtensionAction( QObject* parent );
150  APaletteExtensionAction( const QString & text, QObject * parent );
151  APaletteExtensionAction( const QIcon & icon, const QString & text,
152  QObject * parent );
154 
155  virtual void extensionTriggered(
156  const std::set<anatomist::AObject *> & ) = 0;
157  };
158 
159 
160  namespace internal
161  {
162 
163  // static class
164  class PaletteWinExtensionActions : public QObject
165  {
166  Q_OBJECT
167 
168  public:
169  virtual ~PaletteWinExtensionActions() { _instance() = 0; }
170 
172 
173  private:
174  PaletteWinExtensionActions( QObject * parent ) : QObject( parent ) {}
175  static PaletteWinExtensionActions *& _instance();
176  };
177 
178  }
179 
180 }
181 
182 #endif
#define slots
void resetValues2()
anatomist::AObjectPalette * objPalette()
virtual void setValues1()
void fillObjPal()
void palette1Changed()
void max2EditChanged()
virtual ~QAPaletteWin()
void fillPalette1()
void fillPalette1DMappingMethods()
void runCommand()
void zeroCentered1Changed(int state)
static anatomist::APaletteWin * createPalWin(const std::set< anatomist::AObject * > &obj)
void mixFactorChanged(int)
void fillPalette2List()
void max1EditChanged()
void min2EditChanged()
void min2Changed(int value)
void min1Changed(int value)
void palette1DMappingMethodChanged(const QString &)
void updateClicked()
virtual QWidget * makeDimBox(const QString &title, QWidget *parent, DimBox *dbox)
void max2Changed(int value)
void max1Changed(int value)
void chooseObject()
void resetBounds1()
void fillPalettes()
void enablePalette2(bool)
void fillToolBar()
virtual void closeEvent(QCloseEvent *)
void responsiveToggled(bool val)
void zeroCentered2Changed(int state)
virtual void setValues(DimBox *dimBox, float min, float max, float objMin, float objMax)
void fillPalette(const carto::rc_ptr< anatomist::APalette > pal, QPixmap &pix)
QAPaletteWin(const std::set< anatomist::AObject * > &obj)
void resetBounds2()
virtual void unregisterObservable(anatomist::Observable *)
Called when an observable is destroyed, only called by Observable: don't use this function directly.
void fillPalette2()
void objectsChosen(const std::set< anatomist::AObject * > &)
void palette2Changed(const QString &)
void mixMethodChanged(const QString &)
void extensionActionTriggered(QAction *action)
void fillMixMethods()
virtual void updateObjPal()
void resetValues1()
virtual void setValues2()
void updateInterface()
void dimChanged(int)
virtual void update(const anatomist::Observable *obs, void *arg)
This method is called whenever the observed object is changed.
virtual void updateObjects()
static void addExtensionAction(anatomist::APaletteExtensionAction *action)
Actions can be added here, they will show on a toolbar.
void min1EditChanged()
APaletteExtensionAction(const QIcon &icon, const QString &text, QObject *parent)
virtual void extensionTriggered(const std::set< anatomist::AObject * > &)=0
APaletteExtensionAction(QObject *parent)
APaletteExtensionAction(const QString &text, QObject *parent)
Object color palette window.
Definition: wObjPalette.h:49
This class can be subclassed to represent an object that the programmer wants to have observed.
Definition: Observable.h:68
static PaletteWinExtensionActions * instance()