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;
double drag_y;
bool dragging;
bool _visible;
+ bool _can_be_torn_off;
gint tearoff_click (GdkEventButton*);
gint close_click (GdkEventButton*);
{
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);
{
}
+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)
{
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;
}