Commit ba040cf1 authored by Kjell Ahlstedt's avatar Kjell Ahlstedt

Gtk::Widget: Undeprecate reparent()

* gtk/src/widget.[hg|ccg]: Undeprecate reparent() and implement it without
calling the deprecated gtk_widget_reparent().
parent 3dcaec8c
......@@ -416,6 +416,24 @@ void Widget_Class::get_preferred_width_for_height_vfunc_callback(GtkWidget* self
void Widget::reparent(Widget& new_parent)
//TODO: When 'Widget& new_parent' is changed to 'Container& new_parent',
// remove the next two statements.
Container* new_container = dynamic_cast<Container*>(&new_parent);
g_return_if_fail(new_container != 0); // if new_parent is not a Container
Container* old_container = get_parent();
g_return_if_fail(old_container != 0); // if the widget is not in a Container
if (old_container != new_container)
bool Widget::intersect(const Gdk::Rectangle& area) const
return gtk_widget_intersect(
......@@ -178,9 +178,15 @@ public:
_WRAP_METHOD(bool send_focus_change(GdkEvent* event), gtk_widget_send_focus_change)
_WRAP_METHOD(bool activate(), gtk_widget_activate)
//TODO: Maybe keep this or implement it ourselves,
//because the C API now requires manual ref/unrefing to stop remove() and add() from breaking things.
_WRAP_METHOD(void reparent(Widget& new_parent), gtk_widget_reparent, deprecated "Use Container::remove() and Container::add() instead.")
//TODO: When we can break ABI/API, change to void reparent(Container& new_parent).
// gtk_widget_reparent() is deprecated, but we want to keep Gtk::Widget::reparent().
/** Moves a widget from one Gtk::Container to another, handling reference
* count issues to avoid destroying the widget.
* @param new_parent A Gtk::Container to move the widget into.
void reparent(Widget& new_parent);
bool intersect(const Gdk::Rectangle& area) const;
_WRAP_METHOD(bool intersect(const Gdk::Rectangle& area, Gdk::Rectangle& intersection) const, gtk_widget_intersect)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment