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

Window widget. More...

#include <CWindow.h>

Inheritance diagram for sptk::CWindow:
sptk::CLayoutManager sptk::CWindowShape sptk::CLayoutClient sptk::CDialog sptk::CPopupWindow sptk::CAskDialog sptk::CFileDialog sptk::CSpellChecker sptk::CDBDropDownList sptk::CPopupCalendar sptk::CInputDialog sptk::CMessageDialog sptk::CDirOpenDialog sptk::CFileOpenDialog sptk::CFileSaveDialog sptk::CEditorSpellChecker

Public Member Functions

 CWindow (int w, int h, const char *label=0L)
 Constructor. More...
 
 CWindow (int x, int y, int w, int h, const char *label=0L)
 Constructor. More...
 
void draw () override
 Draws a window, including an optional background image.
 
void show () override
 Custom show method.
 
void show (int argc, char *argv[])
 Custom show method. More...
 
void hide () override
 Custom hide method.
 
virtual void relayout ()
 Relayouts window's widgets that have CLayoutClient interface.
 
void clear () override
 Removes all the widgets inside the window. More...
 
void resize (int x, int y, int w, int h) override
 Resizes the window and inside widgets. More...
 
bool preferredSize (int &w, int &h) override
 Computes the optimal window size. More...
 
int handle (int event) override
 Custom window events handle. More...
 
void load (const std::shared_ptr< xdoc::Node > &node, CLayoutXMLmode xmlMode) override
 Loads window coordinates and widgets from XML node. More...
 
void load (const std::shared_ptr< xdoc::Node > &node) override
 Loads window coordinates and widgets from XML node. More...
 
void save (const std::shared_ptr< xdoc::Node > &node, CLayoutXMLmode xmlMode) const override
 Saves window coordinates and widgets into XML node. More...
 
virtual void save (const xdoc::SNode &node) const
 Saves window coordinates and widgets into XML node. More...
 
void loadPosition (const xdoc::SNode &node)
 Loads the window position from XML node. More...
 
void savePosition (const xdoc::SNode &node) const
 Saves the window position into XML node. 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
 
- Public Member Functions inherited from sptk::CWindowShape
 CWindowShape (sptk::CWindow *window)
 Constructor. More...
 
virtual ~CWindowShape ()
 Destructor.
 
bool shapeResizing ()
 Returns true if the window is resizing as a result of border drag. More...
 

Additional Inherited Members

- 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 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)
 
- Protected Member Functions inherited from sptk::CWindowShape
int mouseZone (int mouseX, int mouseY) const
 Computes mouse zone from window coordinates. More...
 
void changeSize (int mouseX, int mouseY)
 Resizes the window based on mouse zone and mouse screen coordinates. More...
 
virtual int shapeCursorHandle (int event)
 Changes the window cursor based on the mouse position in the window. More...
 
void initShapeExtension ()
 Initializes shape extension. More...
 
bool borderCleared () const
 Returns true if border was cleared for the shape.
 
void shapeApply ()
 Sets the shape to the window during window->draw()
 
void resizingShape (int w, int h)
 Calls resizeShape() from inside CWindow::resize()
 
virtual void shapeResize (int w, int h)
 Shape resize. More...
 
- 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
 
- Protected Attributes inherited from sptk::CWindowShape
int m_resizingZone {0}
 
int m_pushedX {0}
 
int m_pushedY {0}
 
std::vector< CShapePointm_shapePoints
 
bool m_shapeChanged {true}
 
int m_borderWidth {6}
 
bool m_borderCleared {false}
 
bool m_shapeExtension {false}
 
- Static Protected Attributes inherited from sptk::CLayoutManager
static std::map< std::string, Fl_Boxtype > m_boxTypeNames
 
static createControlCallbackMap controlCreator
 

Detailed Description

Window widget.

Extended version of FLTK's standard Fl_Double_Window, with added CLayoutManager capabilities

Constructor & Destructor Documentation

◆ CWindow() [1/2]

sptk::CWindow::CWindow ( int  w,
int  h,
const char *  label = 0L 
)
inline

Constructor.

Parameters
wint, window width
hint, window height
labelint, window label

References NONE.

◆ CWindow() [2/2]

sptk::CWindow::CWindow ( int  x,
int  y,
int  w,
int  h,
const char *  label = 0L 
)
inline

Constructor.

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

References NONE.

Member Function Documentation

◆ className()

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

Returns widget class name (internal SPTK RTTI).

Reimplemented from sptk::CLayoutClient.

◆ clear()

void sptk::CWindow::clear ( )
inlineoverridevirtual

Removes all the widgets inside the window.

Reimplemented from sptk::CLayoutManager.

◆ handle()

int sptk::CWindow::handle ( int  event)
override

Custom window events handle.

Mostly used for supporting non-rectangular shape windows.

◆ 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::CWindow::label ( ) const
inlineoverridevirtual

Returns the current label.

Reimplemented from sptk::CLayoutClient.

◆ 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.

◆ load() [1/2]

void sptk::CWindow::load ( const std::shared_ptr< xdoc::Node > &  node)
inlineoverridevirtual

Loads window coordinates and widgets from XML node.

Parameters
nodeconst xml::Node*, node to load data from

Reimplemented from sptk::CLayoutClient.

References DATA.

◆ load() [2/2]

void sptk::CWindow::load ( const std::shared_ptr< xdoc::Node > &  node,
CLayoutXMLmode  xmlMode 
)
override

Loads window coordinates and widgets from XML node.

Parameters
nodeconst xml::Node*, node to load data from
xmlModeCLayoutXMLmode, the mode defining how the layout and/or data should be loaded

◆ loadPosition()

void sptk::CWindow::loadPosition ( const xdoc::SNode &  node)

Loads the window position from XML node.

Parameters
nodeconst xml::Node&, node to load position from

◆ preferredSize()

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

Computes the optimal window 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.

◆ resize()

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

Resizes the window and inside widgets.

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

◆ save() [1/2]

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

Saves window coordinates and widgets into XML node.

Parameters
nodexml::Node*, node to save data into
xmlModeCLayoutXMLmode, the mode defining how the layout and/or data should be loaded

Reimplemented from sptk::CLayoutClient.

◆ save() [2/2]

virtual void sptk::CWindow::save ( const xdoc::SNode &  node) const
inlinevirtual

Saves window coordinates and widgets into XML node.

Parameters
nodexml::Node*, node to save data into

Reimplemented in sptk::CDialog.

References DATA.

◆ savePosition()

void sptk::CWindow::savePosition ( const xdoc::SNode &  node) const

Saves the window position into XML node.

Parameters
nodexml::Node&, node to save position into

◆ show()

void sptk::CWindow::show ( int  argc,
char *  argv[] 
)
inline

Custom show method.

Parameters
argcint, number of parameters in argv[]
argvchar*[], an array of program command line arguments

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

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