Ardour  8.7-15-gadf511264b
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 "gtkmm2ext/visibility.h"
30 
31 namespace Gtk {
32 class Window;
33 class Action;
34 }
35 
36 namespace Gtkmm2ext {
37 
38 class VisibilityTracker;
39 
40 class LIBGTKMM2EXT_API WindowProxy : public PBD::StatefulDestructible, public virtual sigc::trackable
41 {
42 public:
43  WindowProxy (const std::string& name, const std::string& menu_name);
44  WindowProxy (const std::string& name, const std::string& menu_name, const XMLNode&);
45  virtual ~WindowProxy();
46 
47  void show ();
48  void show_all ();
49  void hide ();
50  void present ();
51  void maybe_show ();
52 
53  virtual bool visible() const;
54  virtual bool fully_visible() const;
55  const std::string& name() const { return _name; }
56  const std::string& menu_name() const { return _menu_name; }
57 
58  std::string action_name() const;
59  void set_action (Glib::RefPtr<Gtk::Action>);
60  Glib::RefPtr<Gtk::Action> action() const { return _action; };
61 
62  void drop_window ();
64 
66 
67  virtual Gtk::Window* get (bool create = false) = 0;
68 
69  virtual int set_state (const XMLNode&, int version);
70  virtual XMLNode& get_state () const;
71 
72  enum StateMask {
73  Position = 0x1,
74  Size = 0x2
75  };
76 
78  StateMask state_mask () const { return _state_mask; }
79 
80  operator bool() const { return _window != 0; }
81 
82  static std::string xml_node_name();
83 
84  sigc::signal0<void> signal_map;
85  sigc::signal0<void> signal_unmap;
86 
87 protected:
88  std::string _name;
89  std::string _menu_name;
90  Glib::RefPtr<Gtk::Action> _action;
92  mutable bool _visible;
93  mutable int _x_off;
94  mutable int _y_off;
95  mutable int _width;
96  mutable int _height;
99  sigc::connection delete_connection;
100  sigc::connection configure_connection;
101  sigc::connection map_connection;
102  sigc::connection unmap_connection;
103 
104 
107  void set_pos ();
108 
109  virtual bool delete_event_handler (GdkEventAny *ev);
111  void map_handler ();
112  void unmap_handler ();
113  virtual void setup ();
114  void toggle ();
115 };
116 
117 }
118 
119 #endif /* __gtkmm2ext_window_proxy_h__ */
sigc::connection map_connection
Definition: window_proxy.h:101
virtual void setup()
virtual bool visible() const
int _y_off
y position
Definition: window_proxy.h:94
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:93
virtual Gtk::Window * get(bool create=false)=0
sigc::connection delete_connection
Definition: window_proxy.h:99
bool _visible
true if the window should be visible on startup
Definition: window_proxy.h:92
void use_window(Gtk::Window &)
Glib::RefPtr< Gtk::Action > action() const
Definition: window_proxy.h:60
sigc::signal0< void > signal_unmap
Definition: window_proxy.h:85
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:56
virtual XMLNode & get_state() const
Gtkmm2ext::VisibilityTracker * vistracker
Definition: window_proxy.h:97
static std::string xml_node_name()
Glib::RefPtr< Gtk::Action > _action
Definition: window_proxy.h:90
const std::string & name() const
Definition: window_proxy.h:55
Gtk::Window * _window
Definition: window_proxy.h:91
sigc::connection unmap_connection
Definition: window_proxy.h:102
virtual bool configure_handler(GdkEventConfigure *)
StateMask state_mask() const
Definition: window_proxy.h:78
void set_state_mask(StateMask)
sigc::connection configure_connection
Definition: window_proxy.h:100
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:89
sigc::signal0< void > signal_map
Definition: window_proxy.h:84
Definition: Window.h:41
Definition: xml++.h:114
GtkImageIconNameData name
Definition: gtkimage.h:6
#define LIBGTKMM2EXT_API
Definition: ardour_ui.h:188