sptk2 logo
SPTK Home Page

sptk::CLayoutClient Class Reference
[GUI Classes]

Base layout manager client. More...

#include <CLayoutClient.h>

Inheritance diagram for sptk::CLayoutClient:

sptk::CBaseButton sptk::CCalendar sptk::CCheckButton sptk::CControl sptk::CEditor sptk::CInput_ sptk::CLayoutManager sptk::CMenuBar sptk::CScrollBar

List of all members.

Public Member Functions

 CLayoutClient (Fl_Widget *widget, int layoutSize, CLayoutAlign ca)
 Constructor.
virtual ~CLayoutClient ()
 Destructor.
CLayoutAlign layoutAlign () const
 Returns widget's layout align.
void layoutAlign (CLayoutAlign al)
 Sets widget's layout align.
int layoutSize () const
 Returns widget's layout size.
void layoutSize (int ls)
 Sets widget's layout size.
void label (const char *lbl)
 Sets the new label, makes an internal copy of the string.
void label (const std::string &l)
 Sets label, makes an internal copy of the string.
const std::string & label () const
 Returns the current label.
void name (const char *aname)
 Sets the new widget name.
void name (const std::string &aname)
 Sets the new widget name.
const std::string & name () const
 Returns the current name.
virtual bool preferredSize (int &w, int &h)
 Computes widget's preferred size.
virtual bool computeSize (int &w, int &h)
 Computes widget's preferred size, and stores size values internally as cache.
virtual std::string className () const
 Returns widget class name (internal SPTK RTTI).
Fl_Widget * widget () const
 Returns widget handled by that object.
void load (const CXmlNode *node, CLayoutXMLmode xmlMode)
 Loads layout client information from XML node.
void save (CXmlNode *node, CLayoutXMLmode xmlMode) const
 Saves layout client information from XML node.

Protected Attributes

int m_layoutSize
 The preferred layout size.
int m_lastPreferredW
 The width as a result of the last call of preferredSize().
int m_lastPreferredH
 The width as a result of the last call of preferredSize().
Fl_Widget * m_widget
 Widget to manage.
std::string m_name
 Widget name (widget id).
std::string m_label
 Widget caption storage.
CLayoutAlign m_layoutAlign
 The layout align for the widget in CLayoutManager group.

Friends

class CLayoutManager


Detailed Description

Base layout manager client.

Allows CLayoutManager objects to move and resize the CLayoutClient objects in accordancy with they preferredSize() and layout alignment.


Constructor & Destructor Documentation

sptk::CLayoutClient::CLayoutClient ( Fl_Widget *  widget,
int  layoutSize,
CLayoutAlign  ca 
)

Constructor.

Parameters:
widget Fl_Widget*, widget to control
layoutSize int, the size of the widget in layout. See m_layoutSize for more information.
ca CLayoutAlign, widget align in layout


Member Function Documentation

virtual bool sptk::CLayoutClient::computeSize ( int &  w,
int &  h 
) [inline, virtual]

Computes widget's preferred size, and stores size values internally as cache.

Used internally by CLayoutManager.

Parameters:
w int&, input/output widget preferred width
h int&, input/output widget preferred height

References m_lastPreferredH, m_lastPreferredW, and preferredSize().

void sptk::CLayoutClient::label ( const std::string &  l  )  [inline]

Sets label, makes an internal copy of the string.

Parameters:
l const string&, new label

Reimplemented in sptk::CGroup, sptk::CScroll, and sptk::CWindow.

References m_label, and m_widget.

void sptk::CLayoutClient::label ( const char *  lbl  )  [inline]

Sets the new label, makes an internal copy of the string.

Parameters:
lbl const char*, new label

Reimplemented in sptk::CBaseButton, sptk::CGroup, sptk::CScroll, sptk::CTreeItem, and sptk::CWindow.

References m_label, and m_widget.

Referenced by sptk::CTreeItem::label().

void sptk::CLayoutClient::layoutAlign ( CLayoutAlign  al  )  [inline]

Sets widget's layout align.

See also:
CLayoutAlign

References m_layoutAlign.

CLayoutAlign sptk::CLayoutClient::layoutAlign (  )  const [inline]

Returns widget's layout align.

See also:
CLayoutAlign

References m_layoutAlign.

void sptk::CLayoutClient::load ( const CXmlNode node,
CLayoutXMLmode  xmlMode 
)

Loads layout client information from XML node.

Layout information may also include widget size and position, as well as visible() and active() states

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

Reimplemented in sptk::CButtonGroup, sptk::CBaseListBox, sptk::CControl, sptk::CDateTimeBaseInput, sptk::CInput, sptk::CListView, and sptk::CWindow.

Referenced by sptk::CMenuBar::creator().

void sptk::CLayoutClient::name ( const std::string &  aname  )  [inline]

Sets the new widget name.

Parameters:
aname std::string&, new widget name

References m_name.

void sptk::CLayoutClient::name ( const char *  aname  )  [inline]

Sets the new widget name.

Parameters:
aname const char*, new widget name

References m_name.

virtual bool sptk::CLayoutClient::preferredSize ( int &  w,
int &  h 
) [inline, virtual]

Computes widget's preferred size.

Should be overriten in derived widget if it has any ideas about it's size limits. Widget may want to change none, one, or both preferred width and height suggested by the CLayoutManager.

Parameters:
w int&, input/output widget preferred width
h int&, input/output widget preferred height
Returns:
true if the size is stable (doesn't depend on input sizes)

Reimplemented in sptk::CBox, sptk::CBaseButton, sptk::CButtonGroup, sptk::CCheckButton, sptk::CBaseListBox, sptk::CDBDropDownList, sptk::CEditor, sptk::CGroup, sptk::CHtmlBox, sptk::CInput_, sptk::CInput, sptk::CListView, sptk::CMemoInput, sptk::CMenuBar, sptk::CProgressBar, sptk::CScroll, sptk::CScrollBar, sptk::CToolBar, sptk::CTreeItem, and sptk::CWindow.

Referenced by computeSize().

void sptk::CLayoutClient::save ( CXmlNode node,
CLayoutXMLmode  xmlMode 
) const

Saves layout client information from XML node.

Layout information may also include widget size and position, as well as visible() and active() states

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

Reimplemented in sptk::CButtonGroup, sptk::CBaseListBox, sptk::CControl, sptk::CDateTimeBaseInput, sptk::CInput, sptk::CListView, and sptk::CWindow.


Member Data Documentation

The preferred layout size.

It makes different sense depending on the widget layout align. For layout align SP_ALIGN_TOP or SP_ALIGN_BOTTOM it is a recomended height of the widget. For layout align SP_ALIGN_LEFT or SP_ALIGN_RIGHT it is a recomended width of the widget. For layout align SP_ALIGN_NONE or SP_ALIGN_CLIENT it is ignored. If the widget isn't in CLayoutManager group - it is ignored. If it doesn't contradict with preferred widget size it will define the final size of the widget.

Referenced by layoutSize().


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

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