+ return _torn;
+}
+
+void
+TearOff::add_state (XMLNode& node) const
+{
+ node.add_property ("tornoff", (_torn ? "yes" : "no"));
+
+ if (own_window_width > 0) {
+ char buf[32];
+
+ snprintf (buf, sizeof (buf), "%d", own_window_width);
+ node.add_property ("width", buf);
+ snprintf (buf, sizeof (buf), "%d", own_window_height);
+ node.add_property ("height", buf);
+ snprintf (buf, sizeof (buf), "%d", own_window_xpos);
+ node.add_property ("xpos", buf);
+ 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;
+ XMLProperty const * prop;
+
+ if ((prop = node.property (X_("tornoff"))) == 0) {
+ return;
+ }
+
+ if (prop->value() == "yes") {
+ tear_it_off ();
+ } else {
+ put_it_back ();
+ }
+
+ if ((prop = node.property (X_("width"))) != 0) {
+ sscanf (prop->value().c_str(), "%d", &own_window_width);
+ }
+ if ((prop = node.property (X_("height"))) != 0) {
+ sscanf (prop->value().c_str(), "%d", &own_window_height);
+ }
+ if ((prop = node.property (X_("xpos"))) != 0) {
+ sscanf (prop->value().c_str(), "%d", &own_window_xpos);
+ }
+ if ((prop = node.property (X_("ypos"))) != 0) {
+ sscanf (prop->value().c_str(), "%d", &own_window_ypos);
+ }
+
+ if (own_window.is_realized()) {
+ own_window.set_default_size (own_window_width, own_window_height);
+ own_window.move (own_window_xpos, own_window_ypos);
+ }
+ /* otherwise do it once the window is realized, see below */