2 Copyright (C) 2015 Paul Davis
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.
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.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __gtkmm2ext_window_proxy_h__
21 #define __gtkmm2ext_window_proxy_h__
24 #include <gdkmm/event.h>
25 #include <glibmm/refptr.h>
26 #include <sigc++/trackable.h>
28 #include "pbd/statefuldestructible.h"
30 #include "gtkmm2ext/visibility.h"
39 class VisibilityTracker;
41 class LIBGTKMM2EXT_API WindowProxy : public PBD::StatefulDestructible, public virtual sigc::trackable
44 WindowProxy (const std::string& name);
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();
56 bool fully_visible() const;
57 const std::string& name() const { return _name; }
58 const std::string& menu_name() const { return _menu_name; }
60 std::string action_name() const;
61 void set_action (Glib::RefPtr<Gtk::Action>);
62 Glib::RefPtr<Gtk::Action> action() const { return _action; };
65 void use_window (Gtk::Window&);
67 virtual Gtk::Window* get (bool create = false) = 0;
69 virtual int set_state (const XMLNode&, int version);
70 virtual XMLNode& get_state ();
77 void set_state_mask (StateMask);
78 StateMask state_mask () const { return _state_mask; }
80 operator bool() const { return _window != 0; }
82 static std::string xml_node_name();
86 std::string _menu_name;
87 Glib::RefPtr<Gtk::Action> _action;
89 mutable bool _visible; ///< true if the window should be visible on startup
90 mutable int _x_off; ///< x position
91 mutable int _y_off; ///< y position
92 mutable int _width; ///< width
93 mutable int _height; ///< height
94 Gtkmm2ext::VisibilityTracker* vistracker;
95 StateMask _state_mask;
96 sigc::connection delete_connection;
97 sigc::connection configure_connection;
99 void save_pos_and_size ();
100 void set_pos_and_size ();
103 virtual bool delete_event_handler (GdkEventAny *ev);
104 virtual bool configure_handler (GdkEventConfigure*);
106 virtual void setup ();
112 #endif /* __gtkmm2ext_window_proxy_h__ */