void gdl_dock_add_floating_item (GdlDock *dock, GdlDockItem *item, gint x, gint y, gint width, gint height) { GdlDock *new_dock; g_return_if_fail (dock != NULL); g_return_if_fail (item != NULL); new_dock = GDL_DOCK (g_object_new (GDL_TYPE_DOCK, "master", GDL_DOCK_OBJECT_GET_MASTER (dock), "floating", TRUE, "width", width, "height", height, "floatx", x, "floaty", y, NULL)); if (GTK_WIDGET_VISIBLE (dock)) { gtk_widget_show (GTK_WIDGET (new_dock)); if (GTK_WIDGET_MAPPED (dock)) gtk_widget_map (GTK_WIDGET (new_dock)); /* Make the widget resize. */ gtk_widget_queue_resize (GTK_WIDGET (new_dock)); } gdl_dock_add_item (GDL_DOCK (new_dock), item, GDL_DOCK_TOP); }
/** * gdl_dock_add_floating_item: * @dock: A #GdlDock widget * @item: A #GdlDockItem widget * @x: X coordinate of the floating item * @y: Y coordinate of the floating item * @width: width of the floating item * @height: height of the floating item * * Dock an item as a floating item. It creates a new window containing a new * dock widget sharing the same master where the item is docked. */ void gdl_dock_add_floating_item (GdlDock *dock, GdlDockItem *item, gint x, gint y, gint width, gint height) { GdlDock *new_dock; g_return_if_fail (dock != NULL); g_return_if_fail (item != NULL); new_dock = GDL_DOCK (g_object_new (GDL_TYPE_DOCK, "master", gdl_dock_object_get_master (GDL_DOCK_OBJECT (dock)), "floating", TRUE, "width", width, "height", height, "floatx", x, "floaty", y, "skip-taskbar", dock->priv->skip_taskbar, NULL)); if (gtk_widget_get_visible (GTK_WIDGET (dock))) { gtk_widget_show (GTK_WIDGET (new_dock)); if (gtk_widget_get_mapped (GTK_WIDGET (dock))) gtk_widget_map (GTK_WIDGET (new_dock)); /* Make the widget resize. */ gtk_widget_queue_resize (GTK_WIDGET (new_dock)); } gdl_dock_add_item (GDL_DOCK (new_dock), item, GDL_DOCK_TOP); }
static void gdl_dock_add (GtkContainer *container, GtkWidget *widget) { g_return_if_fail (container != NULL); g_return_if_fail (GDL_IS_DOCK (container)); g_return_if_fail (GDL_IS_DOCK_ITEM (widget)); gdl_dock_add_item (GDL_DOCK (container), GDL_DOCK_ITEM (widget), GDL_DOCK_TOP); /* default position */ }
void Dock::addItem(DockItem& item, DockItem::Placement placement) { _dock_items.push_back(&item); gdl_dock_add_item(GDL_DOCK(_gdl_dock), GDL_DOCK_ITEM(item.gobj()), (GdlDockPlacement)placement); // FIXME: This is a hack to prevent the dock from expanding the main window, this can't be done // initially as the paned doesn't exist. if (Gtk::Paned *paned = getParentPaned()) { paned->set_resize_mode(Gtk::RESIZE_QUEUE); } }