Developer documentation
Version 3.0.3-105-gd3941f44
colourmap_button.h
Go to the documentation of this file.
1/* Copyright (c) 2008-2022 the MRtrix3 contributors.
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 *
7 * Covered Software is provided under this License on an "as is"
8 * basis, without warranty of any kind, either expressed, implied, or
9 * statutory, including, without limitation, warranties that the
10 * Covered Software is free of defects, merchantable, fit for a
11 * particular purpose or non-infringing.
12 * See the Mozilla Public License v. 2.0 for more details.
13 *
14 * For more details, see http://www.mrtrix.org/.
15 */
16
17#ifndef __gui_mrview_colourmap_button_h__
18#define __gui_mrview_colourmap_button_h__
19
20#include "mrtrix.h"
21
22#include "colourmap.h"
23#include "gui/opengl/gl.h"
24
25namespace MR
26{
27namespace GUI
28{
29namespace MRView
30{
31
32class ColourMapButton;
33
36public:
37 virtual void selected_colourmap(size_t, const ColourMapButton&) {}
38 virtual void selected_custom_colour(const QColor&, const ColourMapButton&) {}
39 virtual void toggle_show_colour_bar(bool, const ColourMapButton&) {}
40 virtual void toggle_invert_colourmap(bool, const ColourMapButton&) {}
41 virtual void reset_colourmap(const ColourMapButton&) {}
42};
43
44
45class ColourMapButton : public QToolButton
47 Q_OBJECT
48public:
49 ColourMapButton(QWidget* parent, ColourMapButtonObserver& obs,
50 bool use_shortcuts = false,
51 bool use_special_colourmaps = true,
52 bool use_customise_state_items = true);
53 void set_colourmap_index(size_t index);
54 void set_scale_inverted(bool yesno);
55 void set_fixed_colour();
56 vector<QAction*> colourmap_actions;
57 void open_menu (const QPoint& p) { colourmap_menu->exec (p); }
58private:
59 void init_menu(bool create_shortcuts, bool use_special, bool customise_state);
60 void init_core_menu_items(bool create_shortcuts);
61 void init_custom_colour_menu_items();
62 void init_special_colour_menu_items(bool create_shortcuts);
63 void init_customise_state_menu_items();
64
65 static const vector<ColourMap::Entry> core_colourmaps_entries;
66 static const vector<ColourMap::Entry> special_colourmaps_entries;
67
69 QActionGroup *core_colourmaps_actions;
70
71 QMenu* colourmap_menu;
72 QAction* custom_colour_action;
73 QAction* invert_scale_action;
74
75 size_t fixed_colour_index;
76
77
78private slots:
79 void select_colourmap_slot(QAction* action);
80 void select_colour_slot();
81 void select_random_colour_slot();
82 void show_colour_bar_slot(bool visible);
83 void invert_colourmap_slot(bool inverted);
84 void reset_intensity_slot();
85};
86
87}
88}
89}
90
91#endif // __gui_mrview_colourmap_button_h__
virtual void selected_colourmap(size_t, const ColourMapButton &)
virtual void reset_colourmap(const ColourMapButton &)
virtual void selected_custom_colour(const QColor &, const ColourMapButton &)
virtual void toggle_invert_colourmap(bool, const ColourMapButton &)
virtual void toggle_show_colour_bar(bool, const ColourMapButton &)
#define NOMEMALIGN
Definition: memory.h:22
Definition: base.h:24
size_t index
#define MEMALIGN(...)
Definition: types.h:185