/*
Copyright (C) 2003 Paul Barton-Davis
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
#include "gtkmm2ext/tearoff.h"
#include "gtkmm2ext/utils.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace Gtkmm2ext;
using namespace Gtk;
, _visible (true)
, _torn (false)
, _can_be_torn_off (true)
-
+
{
own_window_width = 0;
own_window_height = 0;
tearoff_event_box.set_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK);
tearoff_event_box.signal_button_release_event().connect (mem_fun (*this, &TearOff::tearoff_click));
- tearoff_event_box.set_tooltip_text (_("Click to to tear this into its own window"));
-
+ tearoff_event_box.set_tooltip_text (_("Click to tear this into its own window"));
+
close_event_box.add (close_arrow);
close_event_box.set_events (BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK);
close_event_box.signal_button_release_event().connect (mem_fun (*this, &TearOff::close_click));
VBox* box1;
box1 = manage (new VBox);
box1->pack_start (close_event_box, false, false, 2);
-
+
window_box.pack_end (*box1, false, false, 2);
own_window.add_events (KEY_PRESS_MASK|KEY_RELEASE_MASK|BUTTON_PRESS_MASK|BUTTON_RELEASE_MASK|POINTER_MOTION_MASK|POINTER_MOTION_HINT_MASK);
own_window.set_resizable (allow_resize);
- own_window.set_type_hint (WINDOW_TYPE_HINT_TOOLBAR);
+ own_window.set_type_hint (WINDOW_TYPE_HINT_UTILITY);
own_window.add (window_box);
-
+
own_window.signal_button_press_event().connect (mem_fun (*this, &TearOff::window_button_press));
own_window.signal_button_release_event().connect (mem_fun (*this, &TearOff::window_button_release));
own_window.signal_motion_notify_event().connect (mem_fun (*this, &TearOff::window_motion));
VBox* box2;
box2 = manage (new VBox);
- box2->pack_start (tearoff_event_box, false, false, 2);
+ box2->pack_start (tearoff_event_box, false, false);
pack_start (contents);
- pack_start (*box2, false, false, 2);
+ pack_start (*box2, false, false);
}
TearOff::~TearOff ()
if (!_can_be_torn_off) {
return;
}
-
+
if (torn_off()) {
return;
}
_torn = true;
Detach ();
-}
+}
gint
TearOff::close_click (GdkEventButton* /*ev*/)
{
put_it_back ();
return true;
-}
+}
void
TearOff::put_it_back ()
double x_delta;
double y_delta;
RefPtr<Gdk::Window> win (own_window.get_window());
-
+
own_window.get_pointer (mx, my);
if (!dragging) {
win->get_root_origin (x, y);
win->move ((gint) floor (x + x_delta), (gint) floor (y + y_delta));
-
+
drag_x = ev->x_root;
drag_y = ev->y_root;
-
+
return true;
}
snprintf (buf, sizeof (buf), "%d", own_window_ypos);
node.add_property ("ypos", buf);
}
-}
+}
void
TearOff::set_state (const XMLNode& node)
{
Glib::RefPtr<Gdk::Window> win;
- const XMLProperty* prop;
+ XMLProperty const * prop;
if ((prop = node.property (X_("tornoff"))) == 0) {
return;
own_window.move (own_window_xpos, own_window_ypos);
}
/* otherwise do it once the window is realized, see below */
-}
+}
void
TearOff::own_window_realized ()
Glib::RefPtr<const Gdk::Window> win;
win = own_window.get_window ();
-
+
if (win) {
win->get_size (own_window_width, own_window_height);
win->get_position (own_window_xpos, own_window_ypos);