LV2 Toolkit  1.2.0
gtkui.hpp
1 /*
2 
3  gtkui.hpp - Wrapper library to make it easier to write LV2 GtkUIs in C++
4 
5  Copyright (C) 2006-2008 Lars Luthman <lars.luthman@gmail.com>
6  Modified by Dave Robillard, 2008 (URI map mixin)
7  Modified by Michael Fisher, 2012 (LV2 rev3)
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 3 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  Boston, MA 02110-1301 USA
23 
24  */
25 
26 #ifndef LVTK_GTKUI_HPP
27 #define LVTK_GTKUI_HPP
28 
29 #include <gtkmm.h>
30 #include <lvtk/ui.hpp>
31 
32 
33 namespace lvtk {
34 
35 
42  template <bool Required = true>
43  struct GtkUI
44  {
46  template <class Derived>
47  struct I : Extension<Required>
48  {
49  I() : p_container(NULL)
50  {
51  /* Call before anything else. Prevents glib warnings */
52  Gtk::Main::init_gtkmm_internals();
53 
54  p_container = Gtk::manage (new Gtk::VBox());
55  }
56 
57  ~I()
58  {
60  }
61 
63  static void
65  {
67  }
68 
69 
74  bool
76  {
77  return (p_container != NULL);
78  }
79 
80  protected:
81 
86  Gtk::VBox& container()
87  {
88  return *p_container;
89  }
90 
100  void add (Gtk::Widget& widget)
101  {
102  p_container->pack_start (widget);
103  }
104 
109  LV2UI_Widget*
111  {
112  return widget_cast (p_container->gobj());
113  }
114 
115  private:
117  Gtk::VBox *p_container;
118 
119  };
120  };
121 
122 
123 } /* namespace lvtk */
124 
125 
126 #endif /* LVTK_GTKUI_HPP */
void add(Gtk::Widget &widget)
Definition: gtkui.hpp:100
static void map_feature_handlers(FeatureHandlerMap &hmap)
Definition: gtkui.hpp:64
Definition: gtkui.hpp:43
Gtk::VBox & container()
Definition: gtkui.hpp:86
Definition: gtkui.hpp:47
~I()
Definition: gtkui.hpp:57
Definition: feature.hpp:34
bool check_ok()
Definition: gtkui.hpp:75
map< string, FeatureHandler > FeatureHandlerMap
Definition: feature.hpp:57
LV2UI_Widget * widget()
Definition: gtkui.hpp:110