Guitarix
gx_main_boxes.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009, 2010 Hermann Meyer, James Warden, Andreas Degert
3  * Copyright (C) 2011 Pete Shorthose
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  * --------------------------------------------------------------------------
19  *
20  * This file is part of the guitarix GUI main class
21  * Note: this header file depends on gx_main_interface.h
22  *
23  * ----------------------------------------------------------------------------
24  */
25 
26 /* ------- This is part of the GUI namespace ------- */
27 
28 
29 #pragma once
30 
31 #ifndef SRC_HEADERS_GX_MAIN_BOXES_H_
32 #define SRC_HEADERS_GX_MAIN_BOXES_H_
33 
34 #include <gtkmm/liststore.h>
35 #include <gtkmm/window.h>
36 #include <gtkmm/frame.h>
37 #include <gtkmm/accelgroup.h>
38 #include <gtkmm/scrolledwindow.h>
39 #include <gtkmm/fixed.h>
40 #include <gtkmm/eventbox.h>
41 #include <gtkmm/notebook.h>
42 #include <gxwmm/paintbox.h>
43 #include <gtkmm/radiomenuitem.h>
44 #include <gtkmm/paned.h>
45 #include <gxwmm/switch.h>
46 
47 namespace gx_gui {
48 
49 void set_accessible(Gtk::Widget& widget,Gtk::Label& label);
50 
51 /****************************************************************/
52 
53 class UiSwitch: public Gxw::Switch {
54  public:
55  explicit UiSwitch(const char *sw_type);
56  static UiSwitch *create(gx_engine::GxMachineBase& machine, const char *sw_type, gx_engine::Parameter &param);
57  static UiSwitch *create(gx_engine::GxMachineBase& machine, const char *sw_type, const std::string& id) {
58  if (!machine.parameter_hasId(id)) return 0;
59  return create(machine, sw_type, machine.get_parameter(id));
60  }
61 };
62 
63 /****************************************************************/
64 
65 class UiSwitchFloat: public UiSwitch {
66  protected:
69  void on_toggled();
70  void set_value(float v);
71  public:
73 };
74 
75 /****************************************************************/
76 
77 class UiSwitchBool: public UiSwitch {
78  protected:
81  void on_toggled();
82  void set_value(bool v);
83  public:
85 };
86 
87 /****************************************************************/
88 
89 // can be done more elegantly when Gtk::Orientable can be used
90 
91 class UiHSwitchWithCaption: public Gtk::HBox {
92  private:
93  Gtk::Label m_label;
94  protected:
96  public:
97  static Gtk::Widget* create(gx_engine::GxMachineBase& machine, const char *sw_type, const std::string& id,
98  const char *label);
99  UiHSwitchWithCaption(gx_engine::GxMachineBase& machine, const char *sw_type, gx_engine::Parameter &param,
100  const char *label);
101  void set_rack_label_inverse() {m_label.set_name("rack_label_inverse"); }
102  UiSwitch *get_regler() { return m_switch; }
104 };
105 
106 class UiVSwitchWithCaption: public Gtk::VBox {
107  private:
108  Gtk::HBox m_hbox;
109  Gtk::HBox m_hbox1;
110  Gtk::HBox m_hbox2;
111  Gtk::Label m_label;
112  protected:
114  public:
115  static Gtk::Widget* create(gx_engine::GxMachineBase& machine, const char *sw_type, const std::string& id,
116  const char *label);
117  UiVSwitchWithCaption(gx_engine::GxMachineBase& machine, const char *sw_type, gx_engine::Parameter &param,
118  const char *label);
119  void set_rack_label_inverse() {m_label.set_name("rack_label_inverse"); }
120  UiSwitch *get_regler() { return m_switch; }
122 };
123 
124 /****************************************************************/
125 
126 class GxVBox: public Gtk::VBox {
127  public:
128  Gtk::Label m_label;
129  GxVBox(): Gtk::VBox(), m_label() {}
130  ~GxVBox() {}
131 };
132 
133 /****************************************************************/
134 
135 class GxHBox: public Gtk::HBox {
136 public:
137  Gtk::Label m_label;
138  GxHBox(): Gtk::HBox(), m_label() {}
139  ~GxHBox() {}
140 };
141 
142 class GxHFrame: public Gtk::Frame {
143 public:
144  Gtk::Label m_label;
145  Gtk::HBox m_hbox;
146  GxHFrame(): Gtk::Frame(), m_label(), m_hbox() {}
148 };
149 
150 /****************************************************************/
151 
152 class GxPaintBox: public Gxw::PaintBox {
153  public:
154  Gtk::HBox m_hbox;
155  GxPaintBox(const char *expose_funk);
156  ~GxPaintBox();
157 };
158 
159 /****************************************************************/
160 
161 class GxEventBox: public Gtk::HBox {
162  public:
163  Gtk::HBox m_hbox;
164  Gtk::HBox m_pbox;
165  Gtk::HBox m_tbox;
166  Gtk::EventBox m_eventbox;
167  Gtk::HBox m_fbox;
168  Gtk::HBox m_fixedbox;
169  Gtk::Label m_label;
170  GxEventBox();
171  ~GxEventBox();
172 };
173 
174 /****************************************************************/
175 
176 class GxMainBox: public Gtk::HBox {
177  public:
178  Gtk::HBox m_hbox;
179  Gtk::HBox m_pbox;
180  Gtk::HBox m_tbox;
181  Gtk::HBox m_fbox;
182  Gtk::EventBox m_eventbox;
183  Gtk::Fixed m_fixedbox;
184  Gtk::Label m_label;
186  GxMainBox(const char *expose_funk);
187  ~GxMainBox();
188 };
189 
190 /****************************************************************/
191 
192 class GxNotebookBox: public Gtk::Notebook {
193  public:
194  GxNotebookBox();
195 };
196 
197 /****************************************************************/
198 
199 }/* end of gx_gui namespace */
200 
201 #endif // SRC_HEADERS_GX_MAIN_BOXES_H_
202 
gx_gui::GxNotebookBox
Definition: gx_main_boxes.h:192
gx_engine::GxMachineBase::parameter_hasId
virtual bool parameter_hasId(const char *p)=0
gx_gui::GxEventBox::m_pbox
Gtk::HBox m_pbox
Definition: gx_main_boxes.h:164
gx_gui::UiHSwitchWithCaption::~UiHSwitchWithCaption
~UiHSwitchWithCaption()
Definition: gxw_mm_controllers.cpp:461
gx_gui::UiVSwitchWithCaption::UiVSwitchWithCaption
UiVSwitchWithCaption(gx_engine::GxMachineBase &machine, const char *sw_type, gx_engine::Parameter &param, const char *label)
Definition: gxw_mm_controllers.cpp:440
gx_gui::set_accessible
void set_accessible(Gtk::Widget &widget, Gtk::Label &label)
Definition: gxw_mm_controllers.cpp:36
gx_gui::UiVSwitchWithCaption::m_switch
UiSwitch * m_switch
Definition: gx_main_boxes.h:113
gx_gui::UiHSwitchWithCaption::UiHSwitchWithCaption
UiHSwitchWithCaption(gx_engine::GxMachineBase &machine, const char *sw_type, gx_engine::Parameter &param, const char *label)
Definition: gxw_mm_controllers.cpp:417
gx_gui::GxHBox
Definition: gx_main_boxes.h:135
gx_gui::GxEventBox::m_hbox
Gtk::HBox m_hbox
Definition: gx_main_boxes.h:163
gx_gui::GxHFrame
Definition: gx_main_boxes.h:142
gx_gui::UiSwitchBool::UiSwitchBool
UiSwitchBool(gx_engine::GxMachineBase &machine, const char *sw_type, gx_engine::BoolParameter &param)
Definition: gxw_mm_controllers.cpp:379
gx_gui::GxMainBox::m_label
Gtk::Label m_label
Definition: gx_main_boxes.h:184
gx_gui::UiSwitchBool::param
gx_engine::BoolParameter & param
Definition: gx_main_boxes.h:80
gx_gui::GxHBox::m_label
Gtk::Label m_label
Definition: gx_main_boxes.h:137
gx_engine::GxMachineBase
Definition: machine.h:53
gx_gui::GxMainBox::m_pbox
Gtk::HBox m_pbox
Definition: gx_main_boxes.h:179
gx_gui::GxMainBox::m_fixedbox
Gtk::Fixed m_fixedbox
Definition: gx_main_boxes.h:183
gx_gui::UiSwitchBool::set_value
void set_value(bool v)
Definition: gxw_mm_controllers.cpp:375
gx_gui::GxHBox::~GxHBox
~GxHBox()
Definition: gx_main_boxes.h:139
Gxw::PaintBox
Definition: paintbox.h:42
gx_gui::GxMainBox::m_fbox
Gtk::HBox m_fbox
Definition: gx_main_boxes.h:181
gx_gui::UiVSwitchWithCaption::set_rack_label_inverse
void set_rack_label_inverse()
Definition: gx_main_boxes.h:119
Gxw::Switch
Definition: switch.h:44
gx_gui::GxEventBox::m_label
Gtk::Label m_label
Definition: gx_main_boxes.h:169
gx_gui::UiSwitchFloat::param
gx_engine::FloatParameter & param
Definition: gx_main_boxes.h:68
gx_engine::ParameterV< bool >
Definition: gx_parameter.h:351
gx_gui::GxMainBox::~GxMainBox
~GxMainBox()
gx_gui::GxEventBox
Definition: gx_main_boxes.h:161
gx_gui::GxEventBox::m_fbox
Gtk::HBox m_fbox
Definition: gx_main_boxes.h:167
gx_gui::GxEventBox::m_eventbox
Gtk::EventBox m_eventbox
Definition: gx_main_boxes.h:166
gx_gui::GxMainBox::m_eventbox
Gtk::EventBox m_eventbox
Definition: gx_main_boxes.h:182
gx_gui::UiSwitchBool::machine
gx_engine::GxMachineBase & machine
Definition: gx_main_boxes.h:79
gx_gui::UiSwitchFloat::set_value
void set_value(float v)
Definition: gxw_mm_controllers.cpp:346
gx_gui::GxPaintBox
Definition: gx_main_boxes.h:152
gx_gui::GxVBox::~GxVBox
~GxVBox()
Definition: gx_main_boxes.h:130
gx_gui::UiVSwitchWithCaption::create
static Gtk::Widget * create(gx_engine::GxMachineBase &machine, const char *sw_type, const std::string &id, const char *label)
Definition: gxw_mm_controllers.cpp:431
gx_gui::UiSwitchFloat::UiSwitchFloat
UiSwitchFloat(gx_engine::GxMachineBase &machine, const char *sw_type, gx_engine::FloatParameter &param)
Definition: gxw_mm_controllers.cpp:350
gx_gui::GxVBox::m_label
Gtk::Label m_label
Definition: gx_main_boxes.h:128
gx_engine::ParameterV< float >
Definition: gx_parameter.h:230
gx_gui::UiSwitchFloat::on_toggled
void on_toggled()
Definition: gxw_mm_controllers.cpp:342
gx_gui::UiHSwitchWithCaption::create
static Gtk::Widget * create(gx_engine::GxMachineBase &machine, const char *sw_type, const std::string &id, const char *label)
Definition: gxw_mm_controllers.cpp:408
gx_gui::GxEventBox::~GxEventBox
~GxEventBox()
Definition: gx_main_boxes.cpp:68
gx_gui::UiSwitchFloat::machine
gx_engine::GxMachineBase & machine
Definition: gx_main_boxes.h:67
gx_gui::UiVSwitchWithCaption::get_regler
UiSwitch * get_regler()
Definition: gx_main_boxes.h:120
gx_engine::GxMachineBase::get_parameter
virtual Parameter & get_parameter(const std::string &id)=0
gx_gui::GxEventBox::m_tbox
Gtk::HBox m_tbox
Definition: gx_main_boxes.h:165
gx_gui::UiSwitch::create
static UiSwitch * create(gx_engine::GxMachineBase &machine, const char *sw_type, const std::string &id)
Definition: gx_main_boxes.h:57
gx_gui::UiVSwitchWithCaption
Definition: gx_main_boxes.h:106
gx_gui::GxEventBox::m_fixedbox
Gtk::HBox m_fixedbox
Definition: gx_main_boxes.h:168
gx_gui::UiSwitchBool
Definition: gx_main_boxes.h:77
gx_gui::UiVSwitchWithCaption::~UiVSwitchWithCaption
~UiVSwitchWithCaption()
Definition: gxw_mm_controllers.cpp:465
gx_gui::GxPaintBox::~GxPaintBox
~GxPaintBox()
Definition: gx_main_boxes.cpp:47
gx_gui::GxHFrame::~GxHFrame
~GxHFrame()
Definition: gx_main_boxes.h:147
gx_gui::UiHSwitchWithCaption
Definition: gx_main_boxes.h:91
gx_gui::GxMainBox::m_paintbox
Gxw::PaintBox m_paintbox
Definition: gx_main_boxes.h:185
gx_gui::GxHFrame::m_label
Gtk::Label m_label
Definition: gx_main_boxes.h:144
gx_gui::GxPaintBox::m_hbox
Gtk::HBox m_hbox
Definition: gx_main_boxes.h:154
gx_gui::UiHSwitchWithCaption::m_switch
UiSwitch * m_switch
Definition: gx_main_boxes.h:95
gx_gui::UiSwitch
Definition: gx_main_boxes.h:53
gx_gui
Definition: gx_gui_helpers.h:28
gx_gui::GxMainBox::m_hbox
Gtk::HBox m_hbox
Definition: gx_main_boxes.h:178
gx_gui::GxPaintBox::GxPaintBox
GxPaintBox(const char *expose_funk)
Definition: gx_main_boxes.cpp:41
gx_gui::GxHFrame::GxHFrame
GxHFrame()
Definition: gx_main_boxes.h:146
gx_gui::GxVBox
Definition: gx_main_boxes.h:126
gx_gui::GxEventBox::GxEventBox
GxEventBox()
Definition: gx_main_boxes.cpp:51
gx_gui::GxMainBox
Definition: gx_main_boxes.h:176
gx_gui::GxNotebookBox::GxNotebookBox
GxNotebookBox()
Definition: gx_main_boxes.cpp:72
gx_gui::UiHSwitchWithCaption::get_regler
UiSwitch * get_regler()
Definition: gx_main_boxes.h:102
gx_gui::UiSwitch::UiSwitch
UiSwitch(const char *sw_type)
Definition: gxw_mm_controllers.cpp:330
gx_gui::GxVBox::GxVBox
GxVBox()
Definition: gx_main_boxes.h:129
gx_gui::UiHSwitchWithCaption::set_rack_label_inverse
void set_rack_label_inverse()
Definition: gx_main_boxes.h:101
gx_gui::UiSwitchBool::on_toggled
void on_toggled()
Definition: gxw_mm_controllers.cpp:371
gx_gui::GxMainBox::GxMainBox
GxMainBox(const char *expose_funk)
gx_gui::GxHFrame::m_hbox
Gtk::HBox m_hbox
Definition: gx_main_boxes.h:145
gx_gui::UiSwitchFloat
Definition: gx_main_boxes.h:65
gx_gui::GxHBox::GxHBox
GxHBox()
Definition: gx_main_boxes.h:138
gx_engine::Parameter
Definition: gx_parameter.h:106
gx_gui::GxMainBox::m_tbox
Gtk::HBox m_tbox
Definition: gx_main_boxes.h:180
gx_gui::UiSwitch::create
static UiSwitch * create(gx_engine::GxMachineBase &machine, const char *sw_type, gx_engine::Parameter &param)
Definition: gxw_mm_controllers.cpp:334