sptk2 logo
SPTK Home Page
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
sptk::CGroup Class Reference

SPTK group widget. More...

#include <CGroup.h>

Inheritance diagram for sptk::CGroup:
sptk::CLayoutManager sptk::CLayoutClient sptk::CTabs sptk::CToolBar sptk::CTreeItem sptk::CDialogTabs

Public Member Functions

bool drawClipped () const
 
void drawClipped (bool drawClipped)
 
 CGroup (const char *label=nullptr, int layoutSize=10, CLayoutAlign layoutAlign=CLayoutAlign::TOP)
 
void draw () override
 
void resize (int x, int y, int w, int h) override
 
bool preferredSize (int &w, int &h) override
 
void clear () override
 Removes all the widgets inside the group. More...
 
const Stringlabel () const override
 Returns the current label. More...
 
String className () const override
 Returns widget class name (internal SPTK RTTI). More...
 
virtual void label (const String &l)
 
virtual const Stringlabel () const
 
- Public Member Functions inherited from sptk::CLayoutManager
 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 CFrameframe () 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...
 
- Public Member Functions inherited from sptk::CLayoutClient
 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
 

Static Public Member Functions

static CLayoutClientcreator (const xdoc::SNode &node)
 Creates a widget based on the XML node information. More...
 
- Static Public Member Functions inherited from sptk::CLayoutManager
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.
 

Protected Member Functions

void ctor_init (const char *label)
 
- Protected Member Functions inherited from sptk::CLayoutManager
bool autoLayout (int x, int y, int &w, int &h, bool resizeWidgets) const
 
virtual void paintBackground ()
 
- Protected Member Functions inherited from sptk::CLayoutClient
int lastPreferredH () const
 
int lastPreferredW () const
 
void lastPreferredH (int height)
 
void lastPreferredW (int width)
 

Additional Inherited Members

- Protected Attributes inherited from sptk::CLayoutManager
int m_layoutSpacing
 
CLayoutGrowMode m_layoutGrowMode
 
Fl_Group * m_group
 
CFramem_frame
 
bool m_frameDrawBackground
 
bool m_noXml
 
- Protected Attributes inherited from sptk::CLayoutClient
Fl_Widget * m_widget
 
String m_name
 
String m_label
 
CLayoutAlign m_layoutAlign
 
- Static Protected Attributes inherited from sptk::CLayoutManager
static std::map< std::string, Fl_Boxtype > m_boxTypeNames
 
static createControlCallbackMap controlCreator
 

Detailed Description

SPTK group widget.

Extended version of FLTK Fl_Group that can be a layout manager and layout client at the same time.

Constructor & Destructor Documentation

◆ CGroup()

sptk::CGroup::CGroup ( const char *  label = nullptr,
int  layoutSize = 10,
CLayoutAlign  layoutAlign = CLayoutAlign::TOP 
)
explicit

Constructor in SPTK style

Parameters
labelconst char *, label
layoutSizeint, widget align in layout
layoutAlignCLayoutAlign, widget align in layout

Member Function Documentation

◆ className()

String sptk::CGroup::className ( ) const
inlineoverridevirtual

Returns widget class name (internal SPTK RTTI).

Reimplemented from sptk::CLayoutClient.

Reimplemented in sptk::CTabs, sptk::CToolBar, and sptk::CTreeItem.

◆ clear()

void sptk::CGroup::clear ( )
inlineoverridevirtual

Removes all the widgets inside the group.

Reimplemented from sptk::CLayoutManager.

Reimplemented in sptk::CTreeItem.

◆ creator()

static CLayoutClient * sptk::CGroup::creator ( const xdoc::SNode &  node)
static

Creates a widget based on the XML node information.

Parameters
nodean XML node with widget information

◆ ctor_init()

void sptk::CGroup::ctor_init ( const char *  label)
protected

Constructor initializer

Parameters
labelconst char *, label

◆ draw()

void sptk::CGroup::draw ( )
override

Draws the group

◆ drawClipped() [1/2]

bool sptk::CGroup::drawClipped ( ) const
Returns
true if contents of the group is drawn clipped inside the group

◆ drawClipped() [2/2]

void sptk::CGroup::drawClipped ( bool  drawClipped)

Set that contents of the group is drawn clipped or not inside the group

Parameters
drawClippedTrue if contents of the group is drawn clipped inside the group

◆ label() [1/3]

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

Returns the current label

Reimplemented from sptk::CLayoutClient.

◆ label() [2/3]

const String & sptk::CGroup::label ( ) const
inlineoverridevirtual

Returns the current label.

Reimplemented from sptk::CLayoutClient.

Reimplemented in sptk::CTreeItem.

◆ label() [3/3]

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

Sets label, makes an internal copy of the string

Parameters
lNew label

Reimplemented from sptk::CLayoutClient.

◆ preferredSize()

bool sptk::CGroup::preferredSize ( int &  w,
int &  h 
)
overridevirtual

Computes the optimal group size

Parameters
wint&, input - width offered by the program, output - width required by widget
hint&, input - height offered by the program, output - height required by widget
Returns
true if the size is stable (doesn't depend on input sizes)

Reimplemented from sptk::CLayoutClient.

Reimplemented in sptk::CToolBar, and sptk::CTreeItem.

◆ resize()

void sptk::CGroup::resize ( int  x,
int  y,
int  w,
int  h 
)
override

Resizes the group and inside widgets.

Parameters
xint, x-position
yint, y-position
wint, width
hint, height

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

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