Documented PanelManager
This commit is contained in:
parent
6151415029
commit
bb38e5fb76
1 changed files with 80 additions and 3 deletions
|
|
@ -70,27 +70,61 @@ public:
|
|||
**/
|
||||
GdlDock* get_dock() const;
|
||||
|
||||
/**
|
||||
* Gets a pointer to the dock bar.
|
||||
* @remarks Note that this must not be called before setup_dock.
|
||||
**/
|
||||
GdlDockBar* get_dock_bar() const;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Creates the standard panel layout.
|
||||
**/
|
||||
void create_panels();
|
||||
|
||||
/**
|
||||
* Creates a panel by class name.
|
||||
* @param class_name The name of the object class to create.
|
||||
**/
|
||||
boost::shared_ptr<panels::Panel> create_panel_by_name(
|
||||
const char* class_name);
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* A reference to the owner workspace window object.
|
||||
**/
|
||||
WorkspaceWindow &workspaceWindow;
|
||||
|
||||
/**
|
||||
* The pointer to GDL dock widget.
|
||||
* @remarks This value is NULL until setup_dock has been called.
|
||||
**/
|
||||
GdlDock *dock;
|
||||
|
||||
/**
|
||||
* The pointer to GDL dock bar widget.
|
||||
* @remarks This value is NULL until setup_dock has been called.
|
||||
**/
|
||||
GdlDockBar *dockBar;
|
||||
|
||||
/**
|
||||
* The pointer to GDL dock layout object.
|
||||
* @remarks This value is NULL until setup_dock has been called.
|
||||
**/
|
||||
GdlDockLayout *dockLayout;
|
||||
|
||||
/**
|
||||
* Pointers to the 4 root place holders.
|
||||
* @remarks All 4 entries are NULL until setup_dock has been called.
|
||||
**/
|
||||
GdlDockPlaceholder *dockPlaceholders[4];
|
||||
|
||||
/**
|
||||
* The list of created panels.
|
||||
**/
|
||||
std::list< boost::shared_ptr<panels::Panel> > panels;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
|
@ -100,6 +134,14 @@ private:
|
|||
class PanelDescription
|
||||
{
|
||||
protected:
|
||||
/**
|
||||
* Constructor
|
||||
* @param class_name The name of the Panel class
|
||||
* @param title The localized title that will be shown on the
|
||||
* panel.
|
||||
* @param create_panel_proc A pointer to a function that will
|
||||
* instantiate the panel object.
|
||||
**/
|
||||
PanelDescription(const char* class_name, const char *title,
|
||||
boost::shared_ptr<panels::Panel> (*const create_panel_proc)(
|
||||
WorkspaceWindow&)) :
|
||||
|
|
@ -112,18 +154,27 @@ private:
|
|||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* Returns a pointer to the string name of class.
|
||||
**/
|
||||
const char* get_class_name() const
|
||||
{
|
||||
ENSURE(className);
|
||||
return className;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the localized title that will be shown on the panel.
|
||||
**/
|
||||
const char* get_title() const
|
||||
{
|
||||
ENSURE(titleName);
|
||||
return titleName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of this panel.
|
||||
**/
|
||||
boost::shared_ptr<panels::Panel> create(
|
||||
WorkspaceWindow& owner_window) const
|
||||
{
|
||||
|
|
@ -132,21 +183,45 @@ private:
|
|||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* A pointer to the string name of class.
|
||||
**/
|
||||
const char* className;
|
||||
|
||||
/**
|
||||
* The localized title that will be shown on the panel.
|
||||
**/
|
||||
const char* titleName;
|
||||
|
||||
/**
|
||||
* A pointer to a function that will instantiate the panel object.
|
||||
**/
|
||||
boost::shared_ptr<panels::Panel> (*const createPanelProc)(
|
||||
WorkspaceWindow&);
|
||||
};
|
||||
|
||||
/**
|
||||
* A helper class that will create PanelDescription objects.
|
||||
* @param P The type of panels::Panel that the PanelDescription will
|
||||
* describe.
|
||||
**/
|
||||
template<class P> class Panel : public PanelDescription
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
**/
|
||||
Panel() :
|
||||
PanelDescription(typeid(P).name(), P::get_title(),
|
||||
Panel::create_panel)
|
||||
{}
|
||||
|
||||
private:
|
||||
/**
|
||||
* A helper function that will create a panel of type P
|
||||
* @param workspace_window The owner workspace window.
|
||||
* @return Returns a shared pointer to the panel object.
|
||||
**/
|
||||
static boost::shared_ptr<panels::Panel> create_panel(
|
||||
WorkspaceWindow &workspace_window)
|
||||
{
|
||||
|
|
@ -155,8 +230,10 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The list of panel descriptions.
|
||||
**/
|
||||
static const PanelDescription panelDescriptionList[];
|
||||
|
||||
};
|
||||
|
||||
} // namespace workspace
|
||||
|
|
|
|||
Loading…
Reference in a new issue