Ardour  9.0-pre0-350-gf17a656217
window_proxy.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2016 Paul Davis <paul@linuxaudiosystems.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __gtkmm2ext_window_proxy_h__
20 #define __gtkmm2ext_window_proxy_h__
21 
22 #include <string>
23 #include <gdkmm/event.h>
24 #include <glibmm/refptr.h>
25 #include <sigc++/trackable.h>
26 
28 
29 #include <gtkmm/action.h>
30 
31 #include "gtkmm2ext/visibility.h"
32 
33 namespace Gtk {
34 class Window;
35 class Action;
36 }
37 
38 namespace Gtkmm2ext {
39 
40 class VisibilityTracker;
41 
42 class LIBGTKMM2EXT_API WindowProxy : public PBD::StatefulDestructible, public virtual sigc::trackable
43 {
44 public:
45  WindowProxy (const std::string& name, const std::string& menu_name);
46  WindowProxy (const std::string& name, const std::string& menu_name, const XMLNode&);
47  virtual ~WindowProxy();
48 
49  void show ();
50  void show_all ();
51  void hide ();
52  void present ();
53  void maybe_show ();
54 
55  virtual bool visible() const;
56  virtual bool fully_visible() const;
57  const std::string& name() const { return _name; }
58  const std::string& menu_name() const { return _menu_name; }
59 
60  std::string action_name() const;
61  void set_action (Glib::RefPtr<Gtk::Action>);
62  Glib::RefPtr<Gtk::Action> action() const { return _action; };
63 
64  void drop_window ();
66 
68 
69  virtual Gtk::Window* get (bool create = false) = 0;
70 
71  virtual int set_state (const XMLNode&, int version);
72  virtual XMLNode& get_state () const;
73 
74  enum StateMask {
75  Position = 0x1,
76  Size = 0x2
77  };
78 
80  StateMask state_mask () const { return _state_mask; }
81 
82  operator bool() const { return _window != 0; }
83 
84  static std::string xml_node_name();
85 
86  sigc::signal0<void> signal_map;
87  sigc::signal0<void> signal_unmap;
88 
89 protected:
90  std::string _name;
91  std::string _menu_name;
92  Glib::RefPtr<Gtk::Action> _action;
94  mutable bool _visible;
95  mutable int _x_off;
96  mutable int _y_off;
97  mutable int _width;
98  mutable int _height;
101  sigc::connection delete_connection;
102  sigc::connection configure_connection;
103  sigc::connection map_connection;
104  sigc::connection unmap_connection;
105 
106 
109  void set_pos ();
110 
111  virtual bool delete_event_handler (GdkEventAny *ev);
113  void map_handler ();
114  void unmap_handler ();
115  virtual void setup ();
116  void toggle ();
117 };
118 
119 }
120 
121 #endif /* __gtkmm2ext_window_proxy_h__ */
sigc::connection map_connection
Definition: window_proxy.h:103
virtual void setup()
virtual bool visible() const
int _y_off
y position
Definition: window_proxy.h:96
virtual bool fully_visible() const
virtual bool delete_event_handler(GdkEventAny *ev)
WindowProxy(const std::string &name, const std::string &menu_name, const XMLNode &)
int _x_off
x position
Definition: window_proxy.h:95
virtual Gtk::Window * get(bool create=false)=0
sigc::connection delete_connection
Definition: window_proxy.h:101
bool _visible
true if the window should be visible on startup
Definition: window_proxy.h:94
void use_window(Gtk::Window &)
Glib::RefPtr< Gtk::Action > action() const
Definition: window_proxy.h:62
sigc::signal0< void > signal_unmap
Definition: window_proxy.h:87
WindowProxy(const std::string &name, const std::string &menu_name)
void set_transient_for(Gtk::Window &)
const std::string & menu_name() const
Definition: window_proxy.h:58
virtual XMLNode & get_state() const
Gtkmm2ext::VisibilityTracker * vistracker
Definition: window_proxy.h:99
static std::string xml_node_name()
Glib::RefPtr< Gtk::Action > _action
Definition: window_proxy.h:92
const std::string & name() const
Definition: window_proxy.h:57
Gtk::Window * _window
Definition: window_proxy.h:93
sigc::connection unmap_connection
Definition: window_proxy.h:104
virtual bool configure_handler(GdkEventConfigure *)
StateMask state_mask() const
Definition: window_proxy.h:80
void set_state_mask(StateMask)
sigc::connection configure_connection
Definition: window_proxy.h:102
virtual int set_state(const XMLNode &, int version)
std::string action_name() const
void set_action(Glib::RefPtr< Gtk::Action >)
std::string _menu_name
Definition: window_proxy.h:91
sigc::signal0< void > signal_map
Definition: window_proxy.h:86
Definition: Window.h:41
Definition: xml++.h:114
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBGTKMM2EXT_API
Definition: ardour_ui.h:187