sptk2 logo
SPTK Home Page
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
sptk::CLayoutClient Class Reference

#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

Public Member Functions

 CLayoutClient (Fl_Widget *widget, int layoutSize, CLayoutAlign ca)
 
virtual ~CLayoutClient ()
 
CLayoutAlign layoutAlign () const
 
void layoutAlign (CLayoutAlign al)
 
int layoutSize () const
 
void layoutSize (int ls)
 
virtual void label (const String &l)
 
virtual const Stringlabel () const
 
void name (const char *aname)
 
void name (const String &aname)
 
const Stringname () const
 
virtual bool preferredSize (int &w, int &h)
 
virtual bool computeSize (int &w, int &h)
 
virtual String className () const
 
Fl_Widget * widget () const
 
virtual void load (const xdoc::SNode &node, CLayoutXMLmode xmlMode)
 
virtual void load (const std::shared_ptr< xdoc::Node > &node)
 
virtual void save (const std::shared_ptr< xdoc::Node > &node, CLayoutXMLmode xmlMode) const
 

Protected Member Functions

int lastPreferredH () const
 
int lastPreferredW () const
 
void lastPreferredH (int height)
 
void lastPreferredW (int width)
 

Protected Attributes

Fl_Widget * m_widget
 
String m_name
 
String m_label
 
CLayoutAlign m_layoutAlign
 

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

◆ CLayoutClient()

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

Constructor

Parameters
widgetFl_Widget*, widget to control
layoutSizeint, the size of the widget in layout. See m_layoutSize for more information.
caCLayoutAlign, widget align in layout

◆ ~CLayoutClient()

virtual sptk::CLayoutClient::~CLayoutClient ( )
inlinevirtual

Destructor

Member Function Documentation

◆ className()

virtual String sptk::CLayoutClient::className ( ) const
inlinevirtual

◆ computeSize()

virtual bool sptk::CLayoutClient::computeSize ( int &  w,
int &  h 
)
inlinevirtual

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

Used internally by CLayoutManager.

Parameters
wint&, input/output widget preferred width
hint&, input/output widget preferred height

◆ label() [1/2]

virtual const String & sptk::CLayoutClient::label ( ) const
inlinevirtual

◆ label() [2/2]

virtual void sptk::CLayoutClient::label ( const String l)
inlinevirtual

Sets label, makes an internal copy of the string

Parameters
lNew label

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

◆ lastPreferredH() [1/2]

int sptk::CLayoutClient::lastPreferredH ( ) const
protected
Returns
last preferred height

◆ lastPreferredH() [2/2]

void sptk::CLayoutClient::lastPreferredH ( int  height)
protected

Set last preferred height

Parameters
heightHeight

◆ lastPreferredW() [1/2]

int sptk::CLayoutClient::lastPreferredW ( ) const
protected
Returns
last preferred width

◆ lastPreferredW() [2/2]

void sptk::CLayoutClient::lastPreferredW ( int  width)
protected

Set last preferred width

Parameters
widthWidth

◆ layoutAlign() [1/2]

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

Returns widget's layout align

See also
CLayoutAlign

◆ layoutAlign() [2/2]

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

Sets widget's layout align

See also
CLayoutAlign

◆ layoutSize() [1/2]

int sptk::CLayoutClient::layoutSize ( ) const
inline

Returns widget's layout size

◆ layoutSize() [2/2]

void sptk::CLayoutClient::layoutSize ( int  ls)
inline

Sets widget's layout size

◆ load() [1/2]

virtual void sptk::CLayoutClient::load ( const std::shared_ptr< xdoc::Node > &  node)
inlinevirtual

Loads layout client information from XML node

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

Parameters
nodethe XML node

Reimplemented in sptk::CWindow.

References LAYOUT.

◆ load() [2/2]

virtual void sptk::CLayoutClient::load ( const xdoc::SNode &  node,
CLayoutXMLmode  xmlMode 
)
virtual

Loads layout client information from XML node

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

Parameters
nodethe XML node
xmlModethe 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::CTreeControl.

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

◆ name() [1/3]

const String & sptk::CLayoutClient::name ( ) const
inline

Returns the current name

◆ name() [2/3]

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

Sets the new widget name

Parameters
anameconst char*, new widget name

◆ name() [3/3]

void sptk::CLayoutClient::name ( const String aname)
inline

Sets the new widget name

Parameters
anameNew widget name

◆ preferredSize()

virtual bool sptk::CLayoutClient::preferredSize ( int &  w,
int &  h 
)
inlinevirtual

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
wint&, input/output widget preferred width
hint&, input/output widget preferred height
Returns
true if the size is stable (doesn't depend on input sizes)

Reimplemented in sptk::CToolBar, 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::CTreeItem, and sptk::CWindow.

◆ save()

virtual void sptk::CLayoutClient::save ( const std::shared_ptr< xdoc::Node > &  node,
CLayoutXMLmode  xmlMode 
) const
virtual

Saves layout client information from XML node

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

Parameters
nodethe XML node
xmlModethe mode defining how the layout and/or data should be stored

Reimplemented in sptk::CButton, and sptk::CWindow.

◆ widget()

Fl_Widget * sptk::CLayoutClient::widget ( ) const
inline

Returns widget handled by that object

Member Data Documentation

◆ m_label

String sptk::CLayoutClient::m_label
protected

Widget caption storage

◆ m_layoutAlign

CLayoutAlign sptk::CLayoutClient::m_layoutAlign
protected

The layout align for the widget in CLayoutManager group

◆ m_name

String sptk::CLayoutClient::m_name
protected

Widget name (widget id)

◆ m_widget

Fl_Widget* sptk::CLayoutClient::m_widget
protected

Widget to manage


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

Fri Oct 14 2022 09:58:37: SPTK 5.4.1