Lumiera  0.pre.03
»edityourfreedom«
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PanelManager Class Reference

#include "gui/workspace/panel-manager.hpp"

Description

A class to manage DockItem objects for WorkspaceWindow.

Todo:
this code is smelly and needs some clean-up ///////////////////////////////TICKET #1026

Definition at line 52 of file panel-manager.hpp.

Public Member Functions

 PanelManager (WorkspaceWindow &)
 
 ~PanelManager ()
 
Gdl::Dock & getDock ()
 Gets a pointer to the dock object. More...
 
Gdl::DockBar & getDockBar ()
 Gets a pointer to the dock bar. More...
 
WorkspaceWindowgetWorkspaceWindow ()
 Returns a reference to the owner workspace window. More...
 
void setupDock ()
 Initialises this dock manager and creates the dock and all it's widgets. More...
 
void showPanel (const int description_index)
 Shows a panel given a description index. More...
 
void splitPanel (panel::Panel &panel, Gtk::Orientation split_direction)
 Splits a panel into two panels of the same type. More...
 
void switchPanel (panel::Panel &old_panel, const int description_index)
 Switches a panel from one type to another, without touching the underlying GdlDockItem. More...
 

Static Public Member Functions

static int getPanelDescriptionCount ()
 Gets the number of panel descriptions. More...
 
static const gchar * getPanelStockID (const int index)
 Gets a panel description's stock id. More...
 
static const char * getPanelTitle (int index)
 Gets a panel description's title. More...
 

Classes

class  Panel
 A helper class that will create PanelDescription objects. More...
 
class  PanelDescription
 A class to describe and instantiate Panel types. More...
 

Private Member Functions

void clearPanels ()
 Removes all panels from the panel list and deletes them. More...
 
panel::PanelcreatePanel_by_index (const int index)
 Creates a panel by description index. More...
 
panel::PanelcreatePanel_by_index (const int index, Gdl::DockItem &dock_item)
 Creates a panel by description index with a given GdlDockItem. More...
 
panel::PanelcreatePanel_by_name (const char *class_name)
 Creates a panel by class name. More...
 
void createPanels ()
 Creates the standard panel layout. More...
 
int findPanelDescription (const char *class_name) const
 Find the index of a panel description given the class name. More...
 
int getPanelType (panel::Panel *const panel) const
 Gets the type of a given panel. More...
 
void on_panel_shown (panel::Panel *panel)
 An event handler for when the panel is shown or hidden. More...
 
void removePanel (panel::Panel *const panel)
 Removes a panel from the panel list and deletes it. More...
 

Private Attributes

Gdl::Dock dock_
 The pointer to GDL dock widget. More...
 
Gdl::DockBar dockBar_
 The pointer to GDL dock bar widget. More...
 
Glib::RefPtr< Gdl::DockLayout > dockLayout_
 The pointer to GDL dock layout object. More...
 
GdlDockPlaceholder * dockPlaceholders_ [4]
 Pointers to the 4 root place holders. More...
 
std::list< panel::Panel * > panels_
 list of all panels created More...
 
WorkspaceWindowworkspaceWindow_
 reference to the owner workspace window object More...
 

Static Private Attributes

static const PanelDescription panelDescriptionList []
 The list of panel descriptions. More...
 
static unsigned short panelID
 An accumulator for the panel id. More...
 

Constructor & Destructor Documentation

Definition at line 78 of file panel-manager.cpp.

References PanelManager::clearPanels(), and PanelManager::dockPlaceholders_.

+ Here is the call graph for this function:

Member Function Documentation

void setupDock ( )

Initialises this dock manager and creates the dock and all it's widgets.

Remarks
This function must be called only once as the first call after construction.

Definition at line 96 of file panel-manager.cpp.

References PanelManager::createPanels(), PanelManager::dock_, PanelManager::dockPlaceholders_, ENSURE(), and NULL.

Referenced by WorkspaceWindow::createUI().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Gdl::Dock & getDock ( )

Gets a pointer to the dock object.

Remarks
Note that this must not be called before setup_dock. ///////////////////////////////TICKET #1026 : code smell

Definition at line 118 of file panel-manager.cpp.

References PanelManager::dock_.

Referenced by WorkspaceWindow::createUI().

+ Here is the caller graph for this function:

Gdl::DockBar & getDockBar ( )

Gets a pointer to the dock bar.

Remarks
Note that this must not be called before setup_dock.

Definition at line 125 of file panel-manager.cpp.

References PanelManager::dockBar_.

Referenced by WorkspaceWindow::createUI().

+ Here is the caller graph for this function:

WorkspaceWindow & getWorkspaceWindow ( )

Returns a reference to the owner workspace window.

Definition at line 132 of file panel-manager.cpp.

References PanelManager::workspaceWindow_.

Referenced by Panel::getWorkspaceWindow().

+ Here is the caller graph for this function:

void showPanel ( const int  description_index)

Shows a panel given a description index.

Parameters
description_indexThe index of the panel type to show.

Definition at line 139 of file panel-manager.cpp.

References PanelManager::createPanel_by_index(), PanelManager::dock_, Panel::getDockItem(), PanelManager::getPanelType(), Panel::is_shown(), PanelManager::panels_, and Panel::show().

Referenced by Actions::populateShowPanelActions().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void switchPanel ( panel::Panel old_panel,
const int  description_index 
)

Switches a panel from one type to another, without touching the underlying GdlDockItem.

Parameters
old_panelThe panel which will be transformed to a new type.
description_indexThe index of the panel description that will be instantiated.

Definition at line 166 of file panel-manager.cpp.

References PanelManager::createPanel_by_index(), Panel::getDockItem(), PanelManager::getPanelDescriptionCount(), and PanelManager::removePanel().

Referenced by PanelBar::on_panel_type().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void splitPanel ( panel::Panel panel,
Gtk::Orientation  split_direction 
)

Splits a panel into two panels of the same type.

Parameters
panelThe panel to split.
split_directionThe direction to split the panel in.

Definition at line 183 of file panel-manager.cpp.

References PanelManager::createPanel_by_index(), Panel::getDockItem(), and PanelManager::getPanelType().

Referenced by PanelBar::on_split_panel().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int getPanelDescriptionCount ( )
static

Gets the number of panel descriptions.

Definition at line 214 of file panel-manager.cpp.

References PanelManager::panelDescriptionList.

Referenced by PanelManager::createPanel_by_index(), PanelManager::findPanelDescription(), PanelManager::getPanelStockID(), PanelManager::getPanelTitle(), PanelManager::getPanelType(), Actions::populateShowPanelActions(), and PanelManager::switchPanel().

+ Here is the caller graph for this function:

const gchar * getPanelStockID ( const int  index)
static

Gets a panel description's stock id.

Parameters
indexThe index of the panel to retrieve.
Returns
Returns the stock id of a panel at this index.

Definition at line 221 of file panel-manager.cpp.

References PanelManager::getPanelDescriptionCount(), PanelManager::PanelDescription::getStockID(), and PanelManager::panelDescriptionList.

Referenced by Actions::populateShowPanelActions().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const char * getPanelTitle ( int  index)
static

Gets a panel description's title.

Parameters
indexThe index of the panel to retrieve.
Returns
Returns the title of a panel at this index.

Definition at line 229 of file panel-manager.cpp.

References PanelManager::getPanelDescriptionCount(), PanelManager::PanelDescription::getTitle(), and PanelManager::panelDescriptionList.

+ Here is the call graph for this function:

void createPanels ( )
private

Creates the standard panel layout.

Definition at line 237 of file panel-manager.cpp.

References PanelManager::createPanel_by_name(), PanelManager::dock_, and Panel::getDockItem().

Referenced by PanelManager::setupDock().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int findPanelDescription ( const char *  class_name) const
private

Find the index of a panel description given the class name.

Parameters
class_nameThe name of the object class to search for.
Returns
Returns the index of the panel description found, or -1 if no description was found for this type.

Definition at line 251 of file panel-manager.cpp.

References PanelManager::getPanelDescriptionCount(), and PanelManager::panelDescriptionList.

Referenced by PanelManager::createPanel_by_name().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

panel::Panel * createPanel_by_index ( const int  index)
private

Creates a panel by description index.

Parameters
indexThe index of the description to instantiate.
Returns
Returns a pointer to the new instantiated panel object.

Definition at line 268 of file panel-manager.cpp.

References PanelManager::getPanelDescriptionCount(), and PanelManager::panelID.

Referenced by PanelManager::createPanel_by_name(), PanelManager::showPanel(), PanelManager::splitPanel(), and PanelManager::switchPanel().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

panel::Panel * createPanel_by_index ( const int  index,
Gdl::DockItem &  dock_item 
)
private

Creates a panel by description index with a given GdlDockItem.

Parameters
indexThe index of the description to instantiate.
dock_itemThe GdlDockItem to attach this panel to
Returns
Returns a pointer to the new instantiated panel object.

Definition at line 283 of file panel-manager.cpp.

References PanelManager::PanelDescription::create(), ENSURE(), PanelManager::on_panel_shown(), PanelManager::panelDescriptionList, PanelManager::panels_, and Panel::signal_hidePanel().

+ Here is the call graph for this function:

panel::Panel * createPanel_by_name ( const char *  class_name)
private

Creates a panel by class name.

Parameters
class_nameThe name of the object class to create.
Returns
Returns a pointer to the new instantiated panel object.

Definition at line 302 of file panel-manager.cpp.

References PanelManager::createPanel_by_index(), and PanelManager::findPanelDescription().

Referenced by PanelManager::createPanels().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int getPanelType ( panel::Panel *const  panel) const
private

Gets the type of a given panel.

Parameters
panelThe Panel to get the type of
Returns
Returns the index of the panel description found, or -1 if no description was found for this type.

Definition at line 311 of file panel-manager.cpp.

References PanelManager::getPanelDescriptionCount(), and PanelManager::panelDescriptionList.

Referenced by PanelManager::showPanel(), and PanelManager::splitPanel().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void removePanel ( panel::Panel *const  panel)
private

Removes a panel from the panel list and deletes it.

Parameters
panelThe panel to remove and delete.

Definition at line 329 of file panel-manager.cpp.

References PanelManager::panels_.

Referenced by PanelManager::on_panel_shown(), and PanelManager::switchPanel().

+ Here is the caller graph for this function:

void clearPanels ( )
private

Removes all panels from the panel list and deletes them.

Definition at line 347 of file panel-manager.cpp.

References PanelManager::panels_.

Referenced by PanelManager::~PanelManager().

+ Here is the caller graph for this function:

void on_panel_shown ( panel::Panel panel)
private

An event handler for when the panel is shown or hidden.

Parameters
panelA pointer to the panel that was hidden.

Definition at line 359 of file panel-manager.cpp.

References Panel::is_iconified(), Panel::is_shown(), and PanelManager::removePanel().

Referenced by PanelManager::createPanel_by_index().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

WorkspaceWindow& workspaceWindow_
private

reference to the owner workspace window object

Definition at line 55 of file panel-manager.hpp.

Referenced by PanelManager::getWorkspaceWindow().

Gdl::Dock dock_
private

The pointer to GDL dock widget.

Remarks
This value is NULL until setup_dock has been called.

Definition at line 60 of file panel-manager.hpp.

Referenced by PanelManager::createPanels(), PanelManager::getDock(), PanelManager::PanelManager(), PanelManager::setupDock(), and PanelManager::showPanel().

Gdl::DockBar dockBar_
private

The pointer to GDL dock bar widget.

Remarks
This value is NULL until setup_dock has been called.

Definition at line 65 of file panel-manager.hpp.

Referenced by PanelManager::getDockBar().

Glib::RefPtr<Gdl::DockLayout> dockLayout_
private

The pointer to GDL dock layout object.

Remarks
This value is NULL until setup_dock has been called.

Definition at line 70 of file panel-manager.hpp.

Referenced by PanelManager::PanelManager().

GdlDockPlaceholder* dockPlaceholders_[4]
private

Pointers to the 4 root place holders.

Remarks
All 4 entries are NULL until setup_dock has been called.

Definition at line 75 of file panel-manager.hpp.

Referenced by PanelManager::PanelManager(), PanelManager::setupDock(), and PanelManager::~PanelManager().

std::list<panel::Panel*> panels_
private
unsigned short panelID
staticprivate

An accumulator for the panel id.

Definition at line 83 of file panel-manager.hpp.

Referenced by PanelManager::createPanel_by_index().

+ Collaboration diagram for PanelManager:

The documentation for this class was generated from the following files: