ardour
tearoff.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 Paul Barton-Davis
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
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #ifndef __gtkmm2ext_tearoff_h__
21 #define __gtkmm2ext_tearoff_h__
22 
23 #include <gtkmm/window.h>
24 #include <gtkmm/arrow.h>
25 #include <gtkmm/box.h>
26 #include <gtkmm/eventbox.h>
27 
28 #include "gtkmm2ext/visibility.h"
29 
30 class XMLNode;
31 
32 namespace Gtkmm2ext {
33 
34 class LIBGTKMM2EXT_API TearOff : public Gtk::HBox
35 {
36  public:
37  TearOff (Gtk::Widget& contents, bool allow_resize = false);
38  virtual ~TearOff ();
39 
40  void set_visible (bool yn, bool force = false);
41  void set_can_be_torn_off (bool);
42  bool can_be_torn_off () const { return _can_be_torn_off; }
43  bool visible () const { return _visible; }
44 
45  sigc::signal<void> Detach;
46  sigc::signal<void> Attach;
47  sigc::signal<void> Visible;
48  sigc::signal<void> Hidden;
49 
50  Gtk::Window& tearoff_window() { return own_window; }
51  bool torn_off() const;
52  void tear_it_off ();
53  void put_it_back ();
54  void hide_visible ();
55 
56  void set_state (const XMLNode&);
57  void add_state (XMLNode&) const;
58 
59  private:
60  Gtk::Widget& contents;
61  Gtk::Window own_window;
62  Gtk::Arrow tearoff_arrow;
63  Gtk::Arrow close_arrow;
64  Gtk::HBox window_box;
65  Gtk::EventBox tearoff_event_box;
66  Gtk::EventBox close_event_box;
67  double drag_x;
68  double drag_y;
69  bool dragging;
70  bool _visible;
71  bool _torn;
77 
78  gint tearoff_click (GdkEventButton*);
79  gint close_click (GdkEventButton*);
80 
81  gint window_motion (GdkEventMotion*);
82  gint window_button_press (GdkEventButton*);
83  gint window_button_release (GdkEventButton*);
84  gint window_delete_event (GdkEventAny*);
85 
86  void own_window_realized ();
87  bool own_window_configured (GdkEventConfigure*);
88 };
89 
90 } /* namespace */
91 
92 #endif // __gtkmm2ext_tearoff_h__
sigc::signal< void > Hidden
Definition: tearoff.h:48
bool can_be_torn_off() const
Definition: tearoff.h:42
Gtk::HBox window_box
Definition: tearoff.h:64
LIBGTKMM2EXT_API
bool _can_be_torn_off
Definition: tearoff.h:72
bool visible() const
Definition: tearoff.h:43
int own_window_height
Definition: tearoff.h:74
Gtk::EventBox tearoff_event_box
Definition: tearoff.h:65
Gtk::Arrow close_arrow
Definition: tearoff.h:63
sigc::signal< void > Attach
Definition: tearoff.h:46
sigc::signal< void > Detach
Definition: tearoff.h:45
Gtk::Window & tearoff_window()
Definition: tearoff.h:50
Gtk::Window own_window
Definition: tearoff.h:61
sigc::signal< void > Visible
Definition: tearoff.h:47
int own_window_width
Definition: tearoff.h:73
Gtk::Arrow tearoff_arrow
Definition: tearoff.h:62
Definition: xml++.h:95
Gtk::Widget & contents
Definition: tearoff.h:60
Gtk::EventBox close_event_box
Definition: tearoff.h:66