make it possible to not tearoff tearoff boxes :(
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4135 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
4b8fb7e081
commit
018316957c
|
@ -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*);
|
||||
|
|
|
@ -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);
|
||||
|
@ -78,6 +79,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)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue