Layout Manager.
More...
#include <CLayoutManager.h>
|
| CLayoutManager (Fl_Group *group, int layoutSize, CLayoutAlign ca) |
|
| ~CLayoutManager () override=default |
|
virtual void | clear () |
| Removes all the children. More...
|
|
int | layoutSpacing () const |
|
void | layoutSpacing (int ls) |
|
void | layoutGrowMode (CLayoutGrowMode gm=CLayoutGrowMode::LGM_AUTO_GROW) |
|
CLayoutGrowMode | layoutGrowMode () const |
|
void | relayout () |
|
void | frame (CFrame *frame, bool drawBackground=true) |
| Defines frame. More...
|
|
const CFrame * | frame () const |
| Returnes the current frame.
|
|
uint32_t | frameWidth () const |
| Returns frame width.
|
|
virtual void | loadLayout (const xdoc::SNode &node, CLayoutXMLmode xmlMode) |
| Loads group controls data from XML node. More...
|
|
virtual void | saveLayout (const xdoc::SNode &node, CLayoutXMLmode xmlMode) const |
| Saves group controls data into XML node. More...
|
|
void | nameIndex (CWidgetNamesMap &index, bool recursive, bool clean=true) const |
| Builds an index of internal widget names. More...
|
|
bool | noXml () const |
| Returns flag of blocking XML processing. More...
|
|
void | noXml (bool noXml) |
| Sets flag of blocking XML processing. More...
|
|
| 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 String & | label () const |
|
void | name (const char *aname) |
|
void | name (const String &aname) |
|
const String & | name () 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 |
|
|
static void | registerControl (std::string typeName, createControlCallback creator) noexcept |
| Register control type for loading layouts. More...
|
|
static const std::map< std::string, Fl_Boxtype > & | boxTypeNames () |
| Returns a read-only map of box type names and corresponding constants.
|
|
|
class | CLayoutManagerInitializer |
|
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
◆ CLayoutManager()
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 |
◆ ~CLayoutManager()
sptk::CLayoutManager::~CLayoutManager |
( |
| ) |
|
|
overridedefault |
◆ autoLayout()
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)
◆ clear()
virtual void sptk::CLayoutManager::clear |
( |
| ) |
|
|
virtual |
◆ frame()
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 |
◆ layoutGrowMode() [1/2]
Returns current layout grow mode
- See also
- CLayoutGrowMode
◆ layoutGrowMode() [2/2]
Defines layout grow mode
- Parameters
-
gm | CLayoutGrowMode, new layout grow mode |
- See also
- CLayoutGrowMode
◆ layoutSpacing() [1/2]
int sptk::CLayoutManager::layoutSpacing |
( |
| ) |
const |
|
inline |
Returns current layout spacing between widgets
◆ layoutSpacing() [2/2]
void sptk::CLayoutManager::layoutSpacing |
( |
int |
ls | ) |
|
|
inline |
Defines layout spacing between widgets
- Parameters
-
ls | int, new layout spacing |
◆ loadLayout()
virtual void sptk::CLayoutManager::loadLayout |
( |
const xdoc::SNode & |
node, |
|
|
CLayoutXMLmode |
xmlMode |
|
) |
| |
|
virtual |
Loads group controls data from XML node.
- Parameters
-
node | const xml::Node*, node to load data from |
xmlMode | CLayoutXMLmode, the mode defining how the layout and/or data should be loaded |
◆ nameIndex()
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 |
◆ noXml() [1/2]
bool sptk::CLayoutManager::noXml |
( |
| ) |
const |
|
inline |
Returns flag of blocking XML processing.
If this flag is set then no XML is loaded or saved
◆ noXml() [2/2]
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 |
◆ paintBackground()
virtual void sptk::CLayoutManager::paintBackground |
( |
| ) |
|
|
protectedvirtual |
Paints background in tiles mode
◆ registerControl()
static void sptk::CLayoutManager::registerControl |
( |
std::string |
typeName, |
|
|
createControlCallback |
creator |
|
) |
| |
|
staticnoexcept |
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 |
◆ relayout()
void sptk::CLayoutManager::relayout |
( |
| ) |
|
Relayouts the attached group. It may be necessary if the inside widgets have changed content or shown/hidden.
◆ saveLayout()
virtual void sptk::CLayoutManager::saveLayout |
( |
const xdoc::SNode & |
node, |
|
|
CLayoutXMLmode |
xmlMode |
|
) |
| const |
|
virtual |
Saves group controls data into XML node.
- Parameters
-
node | const xml::Node*, node to save data into |
xmlMode | CLayoutXMLmode, the mode defining how the layout and/or data should be stored |
◆ controlCreator
A map of control types and callbacks that create them
◆ m_boxTypeNames
std::map<std::string, Fl_Boxtype> sptk::CLayoutManager::m_boxTypeNames |
|
staticprotected |
A map of box type names and corresponding constants
◆ m_frame
CFrame* sptk::CLayoutManager::m_frame |
|
protected |
The group frame, including optional background image
◆ m_frameDrawBackground
bool sptk::CLayoutManager::m_frameDrawBackground |
|
protected |
Should we draw background
◆ m_group
Fl_Group* sptk::CLayoutManager::m_group |
|
protected |
◆ m_layoutGrowMode
Layout grow mode,
- See also
- CLayoutGrowMode
◆ m_layoutSpacing
int sptk::CLayoutManager::m_layoutSpacing |
|
protected |
An extra space between widgets
◆ m_noXml
bool sptk::CLayoutManager::m_noXml |
|
protected |
If true - do not read or write any XML
The documentation for this class was generated from the following file: