diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-11-11 07:02:00 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-11-11 07:02:00 +0000 |
commit | 018316957cf66092502b889002c9cfeb607c9d3d (patch) | |
tree | 4da64d77023fa8a6f6e2ec51bdd3bc64bf231858 /libs/gtkmm2ext | |
parent | 4b8fb7e081bcd5172e5903ff3c4d603cfb72aa50 (diff) |
make it possible to not tearoff tearoff boxes :(
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4135 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/tearoff.h | 3 | ||||
-rw-r--r-- | libs/gtkmm2ext/tearoff.cc | 33 |
2 files changed, 29 insertions, 7 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/tearoff.h b/libs/gtkmm2ext/gtkmm2ext/tearoff.h index 5e80892b98..737a6ddd03 100644 --- a/libs/gtkmm2ext/gtkmm2ext/tearoff.h +++ b/libs/gtkmm2ext/gtkmm2ext/tearoff.h @@ -34,6 +34,8 @@ class TearOff : public Gtk::HBox virtual ~TearOff (); void set_visible (bool yn); + void set_can_be_torn_off (bool); + bool can_be_torn_off () const { return _can_be_torn_off; } sigc::signal<void> Detach; sigc::signal<void> Attach; @@ -55,6 +57,7 @@ class TearOff : public Gtk::HBox double drag_y; bool dragging; bool _visible; + bool _can_be_torn_off; gint tearoff_click (GdkEventButton*); gint close_click (GdkEventButton*); diff --git a/libs/gtkmm2ext/tearoff.cc b/libs/gtkmm2ext/tearoff.cc index 3df70ad54b..31de301318 100644 --- a/libs/gtkmm2ext/tearoff.cc +++ b/libs/gtkmm2ext/tearoff.cc @@ -36,6 +36,7 @@ TearOff::TearOff (Widget& c, bool allow_resize) { dragging = false; _visible = true; + _can_be_torn_off = true; tearoff_event_box.add (tearoff_arrow); tearoff_event_box.set_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK); @@ -79,6 +80,21 @@ TearOff::~TearOff () } void +TearOff::set_can_be_torn_off (bool yn) +{ + if (yn != _can_be_torn_off) { + if (yn) { + tearoff_arrow.set_no_show_all (false); + tearoff_arrow.show (); + } else { + tearoff_arrow.set_no_show_all (true); + tearoff_arrow.hide (); + } + _can_be_torn_off = yn; + } +} + +void TearOff::set_visible (bool yn) { /* don't change visibility if torn off */ @@ -102,13 +118,16 @@ TearOff::set_visible (bool yn) gint TearOff::tearoff_click (GdkEventButton* ev) { - remove (contents); - window_box.pack_start (contents); - own_window.set_name (get_name()); - close_event_box.set_name (get_name()); - own_window.show_all (); - hide (); - Detach (); + if (_can_be_torn_off) { + remove (contents); + window_box.pack_start (contents); + own_window.set_name (get_name()); + close_event_box.set_name (get_name()); + own_window.show_all (); + hide (); + Detach (); + } + return true; } |