sptk2 logo
SPTK Home Page

sptk::CLayoutManager Class Reference
[GUI Classes]

Layout Manager. More...

#include <CLayoutManager.h>

Inheritance diagram for sptk::CLayoutManager:

sptk::CLayoutClient sptk::CGroup sptk::CScroll sptk::CWindow sptk::CTabs sptk::CToolBar sptk::CTreeItem sptk::CTreeControl sptk::CDialog sptk::CPopupWindow sptk::CDialogTabs sptk::CAskDialog sptk::CFileDialog sptk::CSpellChecker sptk::CDBDropDownList sptk::CPopupCalendar sptk::CInputDialog sptk::CMessageDialog sptk::CDirOpenDialog sptk::CFileOpenDialog sptk::CFileSaveDialog sptk::CEditorSpellChecker

List of all members.

Public Member Functions

 CLayoutManager (Fl_Group *group, int layoutSize, CLayoutAlign ca)
virtual ~CLayoutManager ()
 Destructor.
virtual void clear ()
 Removes all the children.
int layoutSpacing () const
 Returns current layout spacing between widgets.
void layoutSpacing (int ls)
void layoutGrowMode (CLayoutGrowMode gm=LGM_AUTO_GROW)
CLayoutGrowMode layoutGrowMode () const
void relayout ()
void frame (CFrame *frame, bool drawBackground=true)
 Defines frame.
const CFrameframe () const
 Returnes the current frame.
uint32_t frameWidth () const
 Returns frame width.
virtual void loadLayout (const CXmlNode *node, CLayoutXMLmode xmlMode) throw (CException)
 Loads group controls data from XML node.
virtual void saveLayout (CXmlNode *node, CLayoutXMLmode xmlMode) const
 Saves group controls data into XML node.
void nameIndex (CWidgetNamesMap &index, bool recursive, bool clean=true) const
 Builds an index of internal widget names.
bool noXml () const
 Returns flag of blocking XML processing.
void noXml (bool noXml)
 Sets flag of blocking XML processing.

Static Public Member Functions

static void registerControl (std::string typeName, createControlCallback creator)
 Register control type for loading layouts.
static const std::map
< std::string, Fl_Boxtype > & 
boxTypeNames ()
 Returns a read-only map of box type names and corresponding constants.

Protected Member Functions

bool autoLayout (int x, int y, int &w, int &h, bool resizeWidgets) const
virtual void paintBackground ()
 Paints background in tiles mode.

Protected Attributes

int m_layoutSpacing
 An extra space between widgets.
CLayoutGrowMode m_layoutGrowMode
 Layout grow mode,.
Fl_Group * m_group
 Attached group to manage.
CFramem_frame
 The group frame, including optional background image.
bool m_frameDrawBackground
 Should we draw background.
bool m_noXml
 If true - do not read or write any XML.

Static Protected Attributes

static std::map< std::string,
Fl_Boxtype > 
m_boxTypeNames
 A map of box type names and corresponding constants.
static createControlCallbackMap controlCreator
 A map of control types and callbacks that create them.

Friends

class CLayoutManagerInitializer


Detailed Description

Layout Manager.

Maintains the position and size of the CLayoutClient-derived objects in the attached group. It uses the CLayoutClient::layoutAlign() property of such objects and the output of CLayoutClient::preferredSize() to determine the widget's size and position.

See also:
CLayoutClient

Constructor & Destructor Documentation

sptk::CLayoutManager::CLayoutManager ( Fl_Group *  group,
int  layoutSize,
CLayoutAlign  ca 
)

Constructor

Parameters:
group Fl_Group*, a group widget to manage (CGroup, CScroll, or CWindow)
layoutSize int, the size of the widget in layout. See m_layoutSize for more information.
ca CLayoutAlign, widget align in layout


Member Function Documentation

bool sptk::CLayoutManager::autoLayout ( int  x,
int  y,
int &  w,
int &  h,
bool  resizeWidgets 
) const [protected]

Does the auto layout computations and optional actual widget resizing

Parameters:
x int, the layout x position, input
y int, the layout y position, input
w int&, the layout width, input/output
h int&, the layout height, input/output
resizeWidgets bool, resize widgets if true, or just compute the layout size
Returns:
true if the size is stable (doesn't depend on input sizes w,h)

void sptk::CLayoutManager::frame ( CFrame frame,
bool  drawBackground = true 
) [inline]

Defines frame.

Parameters:
frame CFrame *, frame to use
drawBackground bool, if true then background is paint

References m_frame, and m_frameDrawBackground.

CLayoutGrowMode sptk::CLayoutManager::layoutGrowMode (  )  const [inline]

Returns current layout grow mode

See also:
CLayoutGrowMode

References m_layoutGrowMode.

void sptk::CLayoutManager::layoutGrowMode ( CLayoutGrowMode  gm = LGM_AUTO_GROW  )  [inline]

Defines layout grow mode

Parameters:
gm CLayoutGrowMode, new layout grow mode
See also:
CLayoutGrowMode

References m_layoutGrowMode.

void sptk::CLayoutManager::layoutSpacing ( int  ls  )  [inline]

Defines layout spacing between widgets

Parameters:
ls int, new layout spacing

References m_layoutSpacing.

virtual void sptk::CLayoutManager::loadLayout ( const CXmlNode node,
CLayoutXMLmode  xmlMode 
) throw (CException) [virtual]

Loads group controls data from XML node.

Parameters:
node const CXmlNode*, node to load data from
xmlMode CLayoutXMLmode, the mode defining how the layout and/or data should be loaded

void sptk::CLayoutManager::nameIndex ( CWidgetNamesMap &  index,
bool  recursive,
bool  clean = true 
) const

Builds an index of internal widget names.

The index is filled in with pairs of widget name - widget. Only CLayoutClient-derived widgets with names are included.

Parameters:
index CWidgetNamesMap&, the index to fill in
recursive bool, if true also processes the children
clean bool, if true, the list is cleaned prior to fill

void sptk::CLayoutManager::noXml ( bool  noXml  )  [inline]

Sets flag of blocking XML processing.

If this flag is set then no XML is loaded or saved. This flag may be used, for instance, if you want to exclude some control (widget) from being stored in XML.

Parameters:
noXml bool, if true - no XML is red or written

References m_noXml.

bool sptk::CLayoutManager::noXml (  )  const [inline]

Returns flag of blocking XML processing.

If this flag is set then no XML is loaded or saved

References m_noXml.

static void sptk::CLayoutManager::registerControl ( std::string  typeName,
createControlCallback  creator 
) [inline, static]

Register control type for loading layouts.

The control name can be anything as far as in can be used as XML tag name. The creator callback creates a control (widget) using the XML information passed to the callback by the layout manager.

Parameters:
typeName std::string, the type of the (control) widget
creator createControlCallback, a callback that creates the required widget

References controlCreator.

void sptk::CLayoutManager::relayout (  ) 

Relayouts the attached group. It may be necessary if the inside widgets have changed content or shown/hidden.

Reimplemented in sptk::CWindow.

virtual void sptk::CLayoutManager::saveLayout ( CXmlNode node,
CLayoutXMLmode  xmlMode 
) const [virtual]

Saves group controls data into XML node.

Parameters:
node const CXmlNode*, node to save data into
xmlMode CLayoutXMLmode, the mode defining how the layout and/or data should be stored


Member Data Documentation

Layout grow mode,.

See also:
CLayoutGrowMode

Referenced by layoutGrowMode().


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

Mon Mar 5 11:56:16 2012: SPTK 3.5.7