Gdlmm port nuances. Signals/Containers etc...

This commit is contained in:
Michael R. Fisher 2011-10-16 21:28:55 -05:00 committed by Ichthyostega
parent 68c6cef003
commit 2d8805c554
4 changed files with 36 additions and 48 deletions

View file

@ -47,42 +47,36 @@ Panel::Panel(workspace::PanelManager &panel_manager,
val.set(long_name);
g_object_set_property (G_OBJECT (dockItem.gobj()), "long-name", val.gobj());
// Set the grip handle
/* Set the grip handle */
FIXME("Implement interpanel docking. Try using the dockItem.signal_dock(). Signal Handler will switch the grip depending on dock position. For iconify and interpanel docking, it needs to be a plain label");
/* @todo This code causes a crash on panel iconify and interpanel docking */
GdlDockItemGrip *grip = GDL_DOCK_ITEM_GRIP(
gdl_dock_item_get_grip(dockItem.gobj()));
gdl_dock_item_grip_show_handle(grip);
gdl_dock_item_grip_set_label(grip, ((Widget&)panelBar).gobj());
// Set up the panel body
gtk_container_add (GTK_CONTAINER(dockItem.gobj()), GTK_WIDGET(gobj()));
gtk_widget_show (GTK_WIDGET(dockItem.gobj()));
// Connect the signals
hide_panel_handler_id = g_signal_connect (GTK_OBJECT(dockItem.gobj()),
"hide", G_CALLBACK(on_item_hidden), this);
/* End FIXME */
/* Set up the panel body */
// Add this panel's container to the DockItem
dockItem.add((Gtk::Widget&)*this);
/* Connect the signals */
dockItem.signal_hide().connect(
sigc::mem_fun(*this, &Panel::on_item_hidden));
dockItem.show();
}
Panel::~Panel()
{
TODO("Fix for Gdlmm");
//REQUIRE(dockItem != NULL);
// Detach the panel bar
/* Detach the panel bar */
GdlDockItemGrip *grip = GDL_DOCK_ITEM_GRIP(
gdl_dock_item_get_grip(dockItem.gobj()));
gtk_container_remove (GTK_CONTAINER(grip),
((Widget&)panelBar).gobj());
gtk_container_remove (GTK_CONTAINER(dockItem.gobj()), GTK_WIDGET(gobj()));
// Detach the signals
g_signal_handler_disconnect(
GTK_OBJECT(dockItem.gobj()), hide_panel_handler_id);
// Unref the dock item
// g_object_unref(dockItem);
// dockItem = NULL;
/* Remove this panel's container from the DockItem */
dockItem.remove((Gtk::Widget&)*this);
}
Gdl::DockItem&
@ -162,17 +156,16 @@ Panel::get_controller()
return panelManager.get_workspace_window().get_controller();
}
sigc::signal<void>&
sigc::signal<void>
Panel::signal_hide_panel()
{
return hidePanelSignal;
}
void
Panel::on_item_hidden(GdlDockItem*, Panel *panel)
Panel::on_item_hidden()
{
REQUIRE(panel);
panel->hidePanelSignal();
hidePanelSignal.emit();
}
} // namespace panels

View file

@ -135,9 +135,8 @@ private:
/**
* An event handler for when dockItem is hidden.
* @param func_data A pointer to the panel that owns dock_item
*/
static void on_item_hidden(GdlDockItem*, Panel *panel);
void on_item_hidden();
protected:

View file

@ -50,7 +50,13 @@ PanelManager::PanelManager(WorkspaceWindow &workspace_window) :
dockBar(dock),
dockLayout()
{
/* Create the DockLayout */
dockLayout = Gdl::DockLayout::create(dock);
/* Setup the Switcher Style */
Glib::RefPtr<Gdl::DockMaster> dock_master = dock.property_master();
dock_master->property_switcher_style() = Gdl::SWITCHER_STYLE_ICON;
memset(&dockPlaceholders, 0, sizeof(dockPlaceholders));
}
@ -118,7 +124,6 @@ PanelManager::show_panel(const int description_index)
Gdl::DockItem &dock_item = panel->get_dock_item();
// ENSURE(dock_item);
dock_item.present(dock);
// gdl_dock_object_present(GDL_DOCK_OBJECT(dock_item.gobj()), NULL);
return;
}
}
@ -144,37 +149,36 @@ void PanelManager::switch_panel(panels::Panel &old_panel,
// Create the new panel
create_panel_by_index(description_index, dock_item);
}
void
PanelManager::split_panel(panels::Panel &panel,
Gtk::Orientation split_direction)
{
TODO("Port to Gdlmm");
// Create the new panel
const int index = get_panel_type(&panel);
panels::Panel *new_panel = create_panel_by_index(index);
// Dock the panel
// Gdl::DockPlacement placement = Gdl::DOCK_NONE;
GdlDockPlacement placement = GDL_DOCK_NONE;
Gdl::DockPlacement placement = Gdl::DOCK_NONE;
switch(split_direction)
{
case ORIENTATION_HORIZONTAL:
placement = GDL_DOCK_RIGHT;
placement = Gdl::DOCK_RIGHT;
break;
case ORIENTATION_VERTICAL:
placement = GDL_DOCK_BOTTOM;
placement = Gdl::DOCK_BOTTOM;
break;
default:
ERROR(gui, "Unrecognisized split_direction: %d", split_direction);
ERROR(gui, "Unrecognisized split_direction: %d",
split_direction);
return;
break;
}
gdl_dock_object_dock(GDL_DOCK_OBJECT(panel.get_dock_item().gobj()),
GDL_DOCK_OBJECT(new_panel->get_dock_item().gobj()), placement, NULL);
panel.get_dock_item().dock(
new_panel->get_dock_item(),placement);
}
int

View file

@ -57,7 +57,7 @@ WorkspaceWindow::WorkspaceWindow(Project &source_project,
WorkspaceWindow::~WorkspaceWindow()
{
INFO (gui_dbg, "closing workspace window...");
INFO (gui_dbg, "Closing workspace window...");
}
Project&
@ -103,14 +103,6 @@ WorkspaceWindow::create_ui()
//----- Create the Docks -----//
panelManager.setup_dock();
/*
GdlDock const *dock = panelManager.get_dock();
gtk_box_pack_start(GTK_BOX(dockContainer.gobj()),
GTK_WIDGET(panelManager.get_dock_bar()), FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(dockContainer.gobj()),
GTK_WIDGET(dock), TRUE, TRUE, 0);
*/
dockContainer.pack_start(panelManager.get_dock_bar(),false,false,0);
dockContainer.pack_start(panelManager.get_dock(),true,true,0);
baseContainer.pack_start(dockContainer, PACK_EXPAND_WIDGET);