"treadmill" design for new faders, for real
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / tearoff.h
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     $Id$
19 */
20
21 #ifndef __gtkmm2ext_tearoff_h__
22 #define __gtkmm2ext_tearoff_h__
23
24 #include <gtkmm/window.h>
25 #include <gtkmm/arrow.h>
26 #include <gtkmm/box.h>
27 #include <gtkmm/eventbox.h>
28
29 namespace Gtkmm2ext {
30
31 class TearOff : public Gtk::HBox
32 {
33   public:
34         TearOff (Gtk::Widget& contents, bool allow_resize = false);
35         virtual ~TearOff ();
36
37         void set_visible (bool yn);
38
39         sigc::signal<void> Detach;
40         sigc::signal<void> Attach;
41         sigc::signal<void> Visible;
42         sigc::signal<void> Hidden;
43
44         Gtk::Window& tearoff_window() { return own_window; }
45         bool torn_off() const;
46
47   private:
48         Gtk::Widget&   contents;
49         Gtk::Window    own_window;
50         Gtk::Arrow     tearoff_arrow;
51         Gtk::Arrow     close_arrow;
52         Gtk::HBox      window_box;
53         Gtk::EventBox  tearoff_event_box;
54         Gtk::EventBox  close_event_box;
55         double         drag_x;
56         double         drag_y;
57         bool           dragging;
58         bool          _visible;
59
60         gint tearoff_click (GdkEventButton*);
61         gint close_click (GdkEventButton*);
62
63         gint window_motion (GdkEventMotion*);
64         gint window_button_press (GdkEventButton*);
65         gint window_button_release (GdkEventButton*);
66         gint window_delete_event (GdkEventAny*);
67 };
68
69 } /* namespace */
70
71 #endif  // __gtkmm2ext_tearoff_h__