CRM64Pro GDK v0.11.0
A free cross-platform game development kit built on top of SDL 3.0
Loading...
Searching...
No Matches
Classes | Macros | Enumerations | Functions

Detailed Description

v2.00 (23 June 2023)
The Widget module includes all Widgets that can be used inside Panels.

Todo:
Complete the documentation and describe all widgets

Classes

class  CRM64Pro::Widget
 Widget Object. More...
 

Macros

#define WIDGET_FEATURE_FADE   0x00010000
 
#define WIDGET_FEATURE_DRAGDROP   0x00020000
 
#define WIDGET_FEATURE_ENCLOSE   0x00040000
 
#define WIDGET_FEATURE_DETACH   0x00080000
 
#define WIDGET_FEATURE_BGFIT   0x00100000
 
#define WIDGET_FEATURE_BGDISABLE   0x00200000
 
#define WIDGET_FEATURE_EVENTS   0x00400000
 
#define WIDGET_FEATURE_MOUSEOVER   0x00800000
 
#define WIDGET_FEATURE_LOSTFOCUS   0x01000000
 
#define WIDGET_FEATURE_MULTILINE   0x02000000
 
#define WIDGET_FEATURE_READONLY   0x04000000
 
#define WIDGET_FEATURE_AUTOSORT   0x08000000
 

Enumerations

enum  CRM64Pro::eWidgetState {
  CRM64Pro::WS_DEFAULT = -1 , CRM64Pro::WS_NORMAL = 0 , CRM64Pro::WS_HOVERED = 1 , CRM64Pro::WS_PRESSED = 2 ,
  CRM64Pro::WS_ACTION = 3 , CRM64Pro::WS_DEACTIVATED = 4
}
 Widget state. More...
 
enum  CRM64Pro::eWidgetType {
  CRM64Pro::WT_BASE = 0 , CRM64Pro::WT_LABEL = 1 , CRM64Pro::WT_IMAGE = 2 , CRM64Pro::WT_BUTTON = 4 ,
  CRM64Pro::WT_CHECKBOX = 8 , CRM64Pro::WT_PROGRESSBAR = 16 , CRM64Pro::WT_HSLIDER = 32 , CRM64Pro::WT_VSLIDER = 64 ,
  CRM64Pro::WT_TEXTBOX = 128 , CRM64Pro::WT_LISTBOX = 256
}
 Widget type. More...
 

Functions

virtual Sint32 CRM64Pro::Widget::info (Sint32 iMode=0)
 Request Widget object information.
 
Sint32 CRM64Pro::Widget::disable ()
 Disable a widget.
 
Sint32 CRM64Pro::Widget::show ()
 Show a widget.
 
Sint32 CRM64Pro::Widget::hide ()
 Hide a widget.
 
Sint32 CRM64Pro::Widget::status ()
 Get the widget status.
 
Sint32 CRM64Pro::Widget::features (Sint32 iFeatures)
 Set or get advanced features.
 
virtual Sint32 CRM64Pro::Widget::setSize (Sint32 iWidth, Sint32 iHeight)
 Set the size.
 
Sint32 CRM64Pro::Widget::getSize (Sint32 *iWidth, Sint32 *iHeight)
 Get the size.
 
Sint32 CRM64Pro::Widget::setPosition (Sint32 iX=PH_CENTER, Sint32 iY=PH_CENTER)
 Set the position.
 
Sint32 CRM64Pro::Widget::getPosition (Sint32 *iX, Sint32 *iY)
 Get the position.
 
virtual Sint32 CRM64Pro::Widget::setMargin (Sint32 iTop, Sint32 iRight, Sint32 iBottom, Sint32 iLeft)
 Set the margins.
 
Sint32 CRM64Pro::Widget::getMargin (Sint32 *iTop, Sint32 *iRight, Sint32 *iBottom, Sint32 *iLeft)
 Get the margins.
 
Sint32 CRM64Pro::Widget::setAlphaMod (Uint8 iAlpha)
 Set alpha modulation used for rendering this widget.
 
Uint8 CRM64Pro::Widget::getAlphaMod ()
 Get alpha modulation used for rendering this widget.
 
virtual Sint32 CRM64Pro::Widget::setText (const string &sText, Sint32 iParam1=PH_CENTER, Sint32 iParam2=PH_CENTER)
 Set the text.
 
virtual Sint32 CRM64Pro::Widget::getText (string &sText, Sint32 iParam1=-1)
 Get the text.
 
virtual Sint32 CRM64Pro::Widget::setKey (SDL_Keycode keycode)
 Set the assigned key.
 
SDL_Keycode CRM64Pro::Widget::getKey ()
 Get the assigned key.
 
virtual Sint32 CRM64Pro::Widget::setValue (Sint32 iValue)
 Set a value.
 
virtual Sint32 CRM64Pro::Widget::getValue ()
 Get current value.
 
virtual Sint32 CRM64Pro::Widget::getValueGroup (Sint32 iGroup)
 Get enabled checkbox in a group.
 
virtual Sint32 CRM64Pro::Widget::setRange (Sint32 iRange)
 Set the range.
 
virtual Sint32 CRM64Pro::Widget::getRange ()
 Get current range.
 
Sint32 CRM64Pro::Widget::setState (eWidgetState eWS=WS_NORMAL)
 
virtual Sint32 CRM64Pro::Widget::setScroll (Sint32 iUnitsX, Sint32 iUnitsY)
 Modify the widget scroll.
 
virtual Sint32 CRM64Pro::Widget::getScroll (Sint32 *iUnitsX, Sint32 *iUnitsY)
 Get the widget current scroll.
 
virtual Sint32 CRM64Pro::Widget::getVisibleItems (Sint32 *iUnitsX, Sint32 *iUnitsY)
 Get visible items.
 
virtual Sint32 CRM64Pro::Widget::setFont (Sint32 idFont, eWidgetState eWS=WS_DEFAULT)
 Set the font.
 
Sint32 CRM64Pro::Widget::getFont (eWidgetState eWS=WS_NORMAL)
 Get the font.
 
virtual Sint32 CRM64Pro::Widget::setGroup (Sint32 iGroup)
 Set the checkbox group.
 
virtual Sint32 CRM64Pro::Widget::getGroup ()
 Get the checkbox group.
 
Sint32 CRM64Pro::Widget::setBorderWidth (Sint32 iWidth, eWidgetState eWS=WS_DEFAULT)
 Set the border width.
 
Sint32 CRM64Pro::Widget::getBorderWidth (eWidgetState eWS=WS_NORMAL)
 Get the border width.
 
Sint32 CRM64Pro::Widget::setBorderCorner (Sint32 iRad, eWidgetState eWS=WS_DEFAULT)
 Set the border corner radius.
 
Sint32 CRM64Pro::Widget::getBorderCorner (eWidgetState eWS=WS_NORMAL)
 Get the border corner radius.
 
Sint32 CRM64Pro::Widget::setBorderColor (Uint8 iR, Uint8 iG, Uint8 iB, Uint8 iA, eWidgetState eWS=WS_DEFAULT)
 Set the border color.
 
Sint32 CRM64Pro::Widget::getBorderColor (Uint8 *iR, Uint8 *iG, Uint8 *iB, Uint8 *iA, eWidgetState eWS=WS_NORMAL)
 Get the border color.
 
Sint32 CRM64Pro::Widget::setBgColor (Uint8 iR, Uint8 iG, Uint8 iB, eWidgetState eWS=WS_DEFAULT)
 Set the background color.
 
Sint32 CRM64Pro::Widget::getBgColor (Uint8 *iR, Uint8 *iG, Uint8 *iB, eWidgetState eWS=WS_NORMAL)
 Get the background color.
 
Sint32 CRM64Pro::Widget::setBgImage (const string &sFileCDC, const string &sName, eWidgetState eWS=WS_NORMAL)
 Set the background image.
 
Sint32 CRM64Pro::Widget::setBgImage (Sint32 idCDC, const string &sName, eWidgetState eWS=WS_NORMAL)
 Set the background image.
 
Sint32 CRM64Pro::Widget::setBgImage (Sint32 idImage, eWidgetState eWS=WS_NORMAL)
 Set the background image.
 
Sint32 CRM64Pro::Widget::getBgImage (eWidgetState eWS=WS_NORMAL)
 Get the background image.
 
Sint32 CRM64Pro::Widget::setBgSprite (const string &sFileCDC, const string &sName, eWidgetState eWS=WS_DEFAULT, Sint32 iAnim=0)
 Set the background sprite.
 
Sint32 CRM64Pro::Widget::setBgSprite (Sint32 idCDC, const string &sName, eWidgetState eWS=WS_DEFAULT, Sint32 iAnim=0)
 Set the background sprite.
 
Sint32 CRM64Pro::Widget::setBgSprite (Sint32 idSprite, eWidgetState eWS=WS_DEFAULT, Sint32 iAnim=0)
 Set the background sprite.
 
Sint32 CRM64Pro::Widget::getBgSprite (eWidgetState eWS=WS_NORMAL, Sint32 *iAnim=nullptr)
 Get the background sprite.
 
Sint32 CRM64Pro::Widget::setFunction (Sint32(*stateFunc)(void *, void *), void *iParam1=nullptr, void *iParam2=nullptr, eWidgetState eWS=WS_ACTION)
 Set a function to be called on given state.
 

Macro Definition Documentation

◆ WIDGET_FEATURE_FADE

#define WIDGET_FEATURE_FADE   0x00010000

Widget feature: fading effect at showing and hiding time.

◆ WIDGET_FEATURE_DRAGDROP

#define WIDGET_FEATURE_DRAGDROP   0x00020000

Widget feature: allow to move the widget (drag&drop).

◆ WIDGET_FEATURE_ENCLOSE

#define WIDGET_FEATURE_ENCLOSE   0x00040000

Widget feature: enclose the widget inside its parent (default).

◆ WIDGET_FEATURE_DETACH

#define WIDGET_FEATURE_DETACH   0x00080000

Widget feature: the widget is detached from its parent.

◆ WIDGET_FEATURE_BGFIT

#define WIDGET_FEATURE_BGFIT   0x00100000

Widget feature: background image/sprite auto-fit to widget size.

◆ WIDGET_FEATURE_BGDISABLE

#define WIDGET_FEATURE_BGDISABLE   0x00200000

Widget feature: background rendering is disabled.

◆ WIDGET_FEATURE_EVENTS

#define WIDGET_FEATURE_EVENTS   0x00400000

Widget feature: allow the widget to process events and generate C64_EVENT_WIDGET event.

◆ WIDGET_FEATURE_MOUSEOVER

#define WIDGET_FEATURE_MOUSEOVER   0x00800000

Widget feature: allow the widget to generate C64_EVENT_WIDGET_MOUSEOVER events.

◆ WIDGET_FEATURE_LOSTFOCUS

#define WIDGET_FEATURE_LOSTFOCUS   0x01000000

Widget feature: allow the widget to generate C64_EVENT_WIDGET_LOSTFOCUS events.

◆ WIDGET_FEATURE_MULTILINE

#define WIDGET_FEATURE_MULTILINE   0x02000000

Widget feature: TextBox supports multiline text.

◆ WIDGET_FEATURE_READONLY

#define WIDGET_FEATURE_READONLY   0x04000000

Widget feature: TextBox on read-only mode.

◆ WIDGET_FEATURE_AUTOSORT

#define WIDGET_FEATURE_AUTOSORT   0x08000000

Widget feature: ListBox auto-sorting of items.

Enumeration Type Documentation

◆ eWidgetState

Widget state.

Enumerator
WS_DEFAULT 

Flag used for "setters" methods. Not a real state.

WS_NORMAL 

Normal widget state.

WS_HOVERED 

Mouse pointer is over the widget.

WS_PRESSED 

Pressed widget state.

WS_ACTION 

Action widget state.

WS_DEACTIVATED 

Deactivated widget state.

◆ eWidgetType

Widget type.

Enumerator
WT_BASE 

Base widget.

WT_LABEL 

Simple label widget.

WT_IMAGE 

Simple image widget.

WT_BUTTON 

Standard button widget.

WT_CHECKBOX 

CheckBox widget.

WT_PROGRESSBAR 

ProgressBar widget.

WT_HSLIDER 

Horizontal slider widget.

WT_VSLIDER 

Vertical slider widget.

WT_TEXTBOX 

TextBox widget.

WT_LISTBOX 

ListBox widget.

Function Documentation

◆ info()

Sint32 CRM64Pro::Widget::info ( Sint32  iMode = 0)
virtual

Request Widget object information.

For displaying the information, it uses the default log.

Parameters
iMode0 for a stand-alone info calling or 1 when it is called from a nested info method.
0 is set by default.
Returns
0 on success or a negative error code on failure.

◆ disable()

Sint32 CRM64Pro::Widget::disable ( )

Disable a widget.

Returns
0 on success or a negative error code on failure.

◆ show()

Sint32 CRM64Pro::Widget::show ( )

Show a widget.

Returns
0 on success or a negative error code on failure.

◆ hide()

Sint32 CRM64Pro::Widget::hide ( )

Hide a widget.

Returns
0 on success or a negative error code on failure.

◆ status()

Sint32 CRM64Pro::Widget::status ( )

Get the widget status.

Returns
C64_STATUS_DISABLEDwidget is disabled.
C64_STATUS_HIDDEN widget is enabled but hidden.
C64_STATUS_SHOWNwidget is enabled and shown.

◆ features()

Sint32 CRM64Pro::Widget::features ( Sint32  iFeatures)

Set or get advanced features.

Check WIDGET_FEATURE_x defines for a list of supported features.

Parameters
iFeatures32bits signed integer with desired flags enabled.
Enabling a current enabled flag will disable it.
For getting current enabled flags, use -1.
Returns
greater than 0 on success(current features) or a negative error code on failure.

◆ setSize()

Sint32 CRM64Pro::Widget::setSize ( Sint32  iWidth,
Sint32  iHeight 
)
virtual

Set the size.

Parameters
iWidthwidget width. Minimum width is 8.
iHeightwidget height. Minimum height is 8.
Returns
0 on success or a negative error code on failure.
Note
The widget can be "resized" at any time but will never be greater than its parent.

◆ getSize()

Sint32 CRM64Pro::Widget::getSize ( Sint32 *  iWidth,
Sint32 *  iHeight 
)

Get the size.

Parameters
iWidthan integer pointer filled in with widget width.
If nullptr is passed, the method ignores the retrieving of this value.
iHeightan integer pointer filled in with widget height.
If nullptr is passed, the method ignores the retrieving of this value.
Returns
0 on success or a negative error code on failure.

◆ setPosition()

Sint32 CRM64Pro::Widget::setPosition ( Sint32  iX = PH_CENTER,
Sint32  iY = PH_CENTER 
)

Set the position.

Setting the position of a "base" widget is relative to the screen where it is rendered to, for the rest of widgets, the position is always relative to the "base" widget.

Parameters
iXwidget X position.
Check ePositionHelpers enum for a list of supported position helpers. By default, it is set to PH_CENTER.
iYwidget Y position.
Check ePositionHelpers enum for a list of supported position helpers. By default, it is set to PH_CENTER.
Returns
0 on success or a negative error code on failure.
Note
The widget can be "moved" at any time.

◆ getPosition()

Sint32 CRM64Pro::Widget::getPosition ( Sint32 *  iX,
Sint32 *  iY 
)

Get the position.

Getting the position of a "base" widget is relative to the screen where it is rendered to, for the rest of widgets, the position is always relative to the "base" widget.

Parameters
iXa pointer filled in with widget X position.
If nullptr is passed, the method ignores the retrieving of this value.
iYa pointer filled in with widget Y position.
If nullptr is passed, the method ignores the retrieving of this value.
Returns
0 on success or a negative error code on failure.

◆ setMargin()

Sint32 CRM64Pro::Widget::setMargin ( Sint32  iTop,
Sint32  iRight,
Sint32  iBottom,
Sint32  iLeft 
)
virtual

Set the margins.

By default, the margins are set to 3.

Parameters
iToptop margin in pixels.
iRightright margin in pixels.
iBottombottom margin in pixels.
iLeftleft margin in pixels.
Returns
0 on success or a negative error code on failure.
Note
The widget margins can be modified at any time.

◆ getMargin()

Sint32 CRM64Pro::Widget::getMargin ( Sint32 *  iTop,
Sint32 *  iRight,
Sint32 *  iBottom,
Sint32 *  iLeft 
)

Get the margins.

Parameters
iTopa pointer filled in with top margin in pixels.
If nullptr is passed, the method ignores the retrieving of this value.
iRighta pointer filled in with right margin in pixels.
If nullptr is passed, the method ignores the retrieving of this value.
iBottoma pointer filled in with bottom margin in pixels.
If nullptr is passed, the method ignores the retrieving of this value.
iLefta pointer filled in with left margin in pixels.
If nullptr is passed, the method ignores the retrieving of this value.
Returns
0 on success or a negative error code on failure.

◆ setAlphaMod()

Sint32 CRM64Pro::Widget::setAlphaMod ( Uint8  iAlpha)

Set alpha modulation used for rendering this widget.

Parameters
iAlphaIt ranges from 255 (opaque) to 0 (fully transparent).
Returns
0 on success or a negative error code on failure.

◆ getAlphaMod()

Uint8 CRM64Pro::Widget::getAlphaMod ( )

Get alpha modulation used for rendering this widget.

Returns
It ranges from 255 (opaque) to 0 (fully transparent).

◆ setText()

Sint32 CRM64Pro::Widget::setText ( const string &  sText,
Sint32  iParam1 = PH_CENTER,
Sint32  iParam2 = PH_CENTER 
)
virtual

Set the text.

The working way of this method differs depending on the widget type.

Parameters
sTextA text string (caption, item or text).
iParam1By default, it is set to PH_CENTER.
  • WT_LABEL,WT_BUTTON and WT_CHECKBOX: caption X position, check ePositionHelpers enum for a list of supported position helpers.
  • WT_TEXTBOX with WIDGET_FEATURE_MULTILINE: line for performing an action [1, number of lines] or less than 1 for affecting all lines.
  • WT_LISTBOX: less than 0 for removing all items, 0 for adding a new one and select it, item number to be removed [1, number of items] or any greater value than number of items for adding a new one(default).
  • Unused for other widgets.
iParam2By default, it is set to PH_CENTER.
Returns
0 on success or a negative error code on failure.
Note
If the status of this widget is disabled (C64_STATUS_DISABLED), this method does nothing.

◆ getText()

Sint32 CRM64Pro::Widget::getText ( string &  sText,
Sint32  iParam1 = -1 
)
virtual

Get the text.

The working way of this method differs depending on the widget type.

Parameters
sTextA text string pointer to be filled in (caption, item or text).
iParam1By default, it is set to -1.
  • WT_TEXTBOX: get the text of this line number [1, number of lines] or less than 1 for getting the text of current cursor line.
  • WT_LISTBOX: get the text of this item number [1, number of items] or less than 1 for getting the text of selected item.
  • Unused for other widgets.
Returns
0 on success or a negative error code on failure.

◆ setKey()

Sint32 CRM64Pro::Widget::setKey ( SDL_Keycode  keycode)
virtual

Set the assigned key.

Parameters
keycodeSDL_Keycode to be assigned for enabling the WS_ACTION state.
Returns
0 on success or a negative error code on failure.

◆ getKey()

SDL_Keycode CRM64Pro::Widget::getKey ( )

Get the assigned key.

Returns
SDL_Keycode assigned for enabling the WS_ACTION state.

◆ setValue()

Sint32 CRM64Pro::Widget::setValue ( Sint32  iValue)
virtual

Set a value.

The working way of this method differs depending on the widget type.

Parameters
iValuevalue to be set.
  • WT_LABEL, WT_IMAGE, WT_BUTTON and WT_TEXTBOX: this method has not any effect.
  • WT_LISTBOX: select this item number [1, number of items] or less than 1 for de-selecting any item.
  • WT_CHECKBOX: 0 for disabling or 1 for enabling it. When the checkbox belongs to a group, only one checkbox on the group can be enabled at the same time so it is not possible to individually disabling a checkbox, only to enable one of them and automatically the others will be disabled.
  • For the others widgets, it sets the value that must belongs to [0, iRange] interval.
Returns
0 on success or a negative error code on failure.
Note
If the status of this widget is disabled (C64_STATUS_DISABLED), this method does nothing.

◆ getValue()

Sint32 CRM64Pro::Widget::getValue ( )
virtual

Get current value.

The working way of this method differs depending on the widget type.

Returns
  • WT_PROGRESSBAR, WT_HSLIDER and WT_VSLIDER: returns current value inside [0, iRange] interval.
  • WT_CHECKBOX: get checkbox value [0,1]. It gets the individual value even if it is part of a group. For getting the enabled checkbox in a group, use getValueGroup() method instead.
  • WT_TEXTBOX: get current line number [1,number of lines] or 0 if any.
  • WT_LISTBOX: get selected item number [1,number of items] or 0 if any.
  • Unused for other widgets.

◆ getValueGroup()

Sint32 CRM64Pro::Widget::getValueGroup ( Sint32  iGroup)
virtual

Get enabled checkbox in a group.

The working way of this method differs depending on the widget type.

Parameters
iGroupid of the group to retrieve the enabled widget id.
Returns
  • WT_CHECKBOX: widget id of the enabled checkbox in a group.
  • Unused for other widgets.

◆ setRange()

Sint32 CRM64Pro::Widget::setRange ( Sint32  iRange)
virtual

Set the range.

The working way of this method differs depending on the widget type.

Parameters
iRangerange of possible values.
Minimum value is 1.
Only used with:
WT_PROGRESSBAR: when the widget has associated an image or sprite for the relevant status, this method also calculate the proper size of the widget.
WT_HSLIDER
WT_VSLIDER widget types.
Returns
0 on success or a negative error code on failure.

◆ getRange()

Sint32 CRM64Pro::Widget::getRange ( )
virtual

Get current range.

The working way of this method differs depending on the widget type.

Returns

◆ setState()

Sint32 CRM64Pro::Widget::setState ( eWidgetState  eWS = WS_NORMAL)
Parameters
eWSWidget state. Check eWidgetState for further information.
By default it is set to WS_NORMAL.
Returns
current widget range.
Note
It is normally used for set the WS_DEACTIVATED state or return back to WS_NORMAL.
Wrong usage of this method could cause an unexpected GUI system behavior.

◆ setScroll()

Sint32 CRM64Pro::Widget::setScroll ( Sint32  iUnitsX,
Sint32  iUnitsY 
)
virtual

Modify the widget scroll.

The working way of this method differs depending on the widget type.

  • WT_TEXTBOX: can move the scroll on X and Y axes, so both parameters are valid. Units are text characters.
  • WT_LISTBOX: can move the scroll on Y axis so only iUnitsY parameter is valid. Units are items.
  • Unused for other widgets.
Parameters
iUnitsXnumber of units to move the scroll. Negative value move it to the left, 0 will not modify it and a positive one, will move it to the right.
iUnitsYnumber of units to move the scroll. Negative value move it to the top, 0 will not modify it and a positive one, will move it to the bottom.
Returns
0 on success or a negative error code on failure.

◆ getScroll()

Sint32 CRM64Pro::Widget::getScroll ( Sint32 *  iUnitsX,
Sint32 *  iUnitsY 
)
virtual

Get the widget current scroll.

The working way of this method differs depending on the widget type.

  • WT_TEXTBOX: both parameters are valid.
  • WT_LISTBOX: only iUnitsY parameter is valid.
  • Unused for other widgets.
Parameters
iUnitsXan integer pointer filled in with current scroll position on X axis. Units are text characters.
If nullptr is passed, the method ignores the retrieving of this value.
iUnitsYan integer pointer filled in with current scroll position on Y axis. Units are items.
If nullptr is passed, the method ignores the retrieving of this value.
Returns
0 on success or a negative error code on failure.

◆ getVisibleItems()

Sint32 CRM64Pro::Widget::getVisibleItems ( Sint32 *  iUnitsX,
Sint32 *  iUnitsY 
)
virtual

Get visible items.

The working way of this method differs depending on the widget type.

  • WT_TEXTBOX: both parameters are valid.
  • WT_LISTBOX: only iUnitsY parameter is valid.
  • Unused for other widgets.
Parameters
iUnitsXan integer pointer filled in with maximum number of visible text characters on the X axis.
If nullptr is passed, the method ignores the retrieving of this value.
iUnitsYan integer pointer filled in with maximum number of visible lines on the Y axis.
If nullptr is passed, the method ignores the retrieving of this value.
Returns
0 on success or a negative error code on failure.

◆ setFont()

Sint32 CRM64Pro::Widget::setFont ( Sint32  idFont,
eWidgetState  eWS = WS_DEFAULT 
)
virtual

Set the font.

Parameters
idFontFont id.
eWSWidget state. Check eWidgetState for further information.
By default it is set to WS_DEFAULT which affect to all states.
Returns
0 on success or a negative error code on failure.

◆ getFont()

Sint32 CRM64Pro::Widget::getFont ( eWidgetState  eWS = WS_NORMAL)

Get the font.

Parameters
eWSWidget state. Check eWidgetState for further information.
By default it is set to WS_NORMAL.
Returns
greater than 0 on success(the Font id) or a negative value when using the default font.

◆ setGroup()

Sint32 CRM64Pro::Widget::setGroup ( Sint32  iGroup)
virtual

Set the checkbox group.

The working way of this method differs depending on the widget type.

  • WT_CHECKBOX: assign the checkbox to a group (iGroup greater than 1). Checkbox in the same group (conceptually, a collection of checkbox widgets describing a set of related options) can only have one selected at the same time.
  • Unused for other widgets.
Parameters
iGroupid of the group that this widget belongs to.
Returns
0 on success or a negative error code on failure.

◆ getGroup()

Sint32 CRM64Pro::Widget::getGroup ( )
virtual

Get the checkbox group.

Returns
0 when no group is assigned, greater than 0 with the group id or a negative error code on failure.

◆ setBorderWidth()

Sint32 CRM64Pro::Widget::setBorderWidth ( Sint32  iWidth,
eWidgetState  eWS = WS_DEFAULT 
)

Set the border width.

Parameters
iWidthborder width in pixels.
eWSWidget state. Check eWidgetState for further information.
By default it is set to WS_DEFAULT which affect to all states.
Returns
0 on success or a negative error code on failure.

◆ getBorderWidth()

Sint32 CRM64Pro::Widget::getBorderWidth ( eWidgetState  eWS = WS_NORMAL)

Get the border width.

Parameters
eWSWidget state. Check eWidgetState for further information.
By default it is set to WS_NORMAL.
Returns
Border width in pixels

◆ setBorderCorner()

Sint32 CRM64Pro::Widget::setBorderCorner ( Sint32  iRad,
eWidgetState  eWS = WS_DEFAULT 
)

Set the border corner radius.

Parameters
iRadborder corner radius width in pixels.
eWSWidget state. Check eWidgetState for further information.
By default it is set to WS_DEFAULT which affect to all states.
Returns
0 on success or a negative error code on failure.

◆ getBorderCorner()

Sint32 CRM64Pro::Widget::getBorderCorner ( eWidgetState  eWS = WS_NORMAL)

Get the border corner radius.

Parameters
eWSWidget state. Check eWidgetState for further information.
By default it is set to WS_NORMAL.
Returns
Border radius in pixels

◆ setBorderColor()

Sint32 CRM64Pro::Widget::setBorderColor ( Uint8  iR,
Uint8  iG,
Uint8  iB,
Uint8  iA,
eWidgetState  eWS = WS_DEFAULT 
)

Set the border color.

Parameters
iRThe red color value.
iGThe green color value.
iBThe blue color value.
iAThe alpha value ranging from 0(fully transparent) to 255(opaque).
eWSWidget state. Check eWidgetState for further information.
By default it is set to WS_DEFAULT which affect to all states.
Returns
0 on success or a negative error code on failure.

◆ getBorderColor()

Sint32 CRM64Pro::Widget::getBorderColor ( Uint8 *  iR,
Uint8 *  iG,
Uint8 *  iB,
Uint8 *  iA,
eWidgetState  eWS = WS_NORMAL 
)

Get the border color.

Parameters
iRa pointer filled with the Red component.
If nullptr is passed, the method ignores the retrieving of this value.
iGa pointer filled with the Green component.
If nullptr is passed, the method ignores the retrieving of this value.
iBa pointer filled with the Blue component.
If nullptr is passed, the method ignores the retrieving of this value.
iAa pointer filled with the alpha component.
If nullptr is passed, the method ignores the retrieving of this value.
eWSWidget state. Check eWidgetState for further information.
By default it is set to WS_NORMAL.
Returns
0 on success or a negative error code on failure.

◆ setBgColor()

Sint32 CRM64Pro::Widget::setBgColor ( Uint8  iR,
Uint8  iG,
Uint8  iB,
eWidgetState  eWS = WS_DEFAULT 
)

Set the background color.

Parameters
iRThe red color value.
iGThe green color value.
iBThe blue color value.
eWSWidget state. Check eWidgetState for further information.
By default it is set to WS_DEFAULT which affect to all states.
Returns
0 on success or a negative error code on failure.
Note
This method will overwrite any other previous existing background.
  • WT_LISTBOX: WS_ACTION is used for rendering the selected item (font and background color are used).

◆ getBgColor()

Sint32 CRM64Pro::Widget::getBgColor ( Uint8 *  iR,
Uint8 *  iG,
Uint8 *  iB,
eWidgetState  eWS = WS_NORMAL 
)

Get the background color.

Parameters
iRa pointer filled with the Red component.
If nullptr is passed, the method ignores the retrieving of this value.
iGa pointer filled with the Green component.
If nullptr is passed, the method ignores the retrieving of this value.
iBa pointer filled with the Blue component.
If nullptr is passed, the method ignores the retrieving of this value.
eWSWidget state. Check eWidgetState for further information.
By default it is set to WS_NORMAL.
Returns
0 on success or a negative error code on failure.

◆ setBgImage() [1/3]

Sint32 CRM64Pro::Widget::setBgImage ( const string &  sFileCDC,
const string &  sName,
eWidgetState  eWS = WS_NORMAL 
)

Set the background image.

Parameters
sFileCDCstring containing the [directory]+filename.
sNamestring with the image name (maximum size of 64 characters).
If the image is already loaded, a new child will be created.
eWSWidget state. Check eWidgetState for further information (WS_DEFAULT is not supported).
  • with WS_NORMAL state, if there is not any other background (image or sprite) set on WS_HOVERED and WS_DEACTIVATED, they will use this background
  • with WS_PRESSED state, if there is not any other background (image or sprite) set on WS_ACTION, it will use this background
In addition, all states modified by this method will also include:
  • the widget border is disabled (using alpha border color set to 0)
  • without WIDGET_FEATURE_BGFIT, the size of the widget will be modified for matching the image size
Returns
0 or greater on success or a negative error code on failure.
Note
This method will overwrite any other previous existing background. Alpha modulation is inherited from the image.

◆ setBgImage() [2/3]

Sint32 CRM64Pro::Widget::setBgImage ( Sint32  idCDC,
const string &  sName,
eWidgetState  eWS = WS_NORMAL 
)

Set the background image.

Parameters
idCDCCDC id.
sNamestring with the image name (maximum size of 64 characters).
If the image is already loaded, a new child will be created.
eWSWidget state. Check eWidgetState for further information (WS_DEFAULT is not supported).
  • with WS_NORMAL state, if there is not any other background (image or sprite) set on WS_HOVERED and WS_DEACTIVATED, they will use this background
  • with WS_PRESSED state, if there is not any other background (image or sprite) set on WS_ACTION, it will use this background
In addition, all states modified by this method will also include:
  • the widget border is disabled (using alpha border color set to 0)
  • without WIDGET_FEATURE_BGFIT, the size of the widget will be modified for matching the image size
Returns
0 or greater on success or a negative error code on failure.
Note
This method will overwrite any other previous existing background. Alpha modulation is inherited from the image.

◆ setBgImage() [3/3]

Sint32 CRM64Pro::Widget::setBgImage ( Sint32  idImage,
eWidgetState  eWS = WS_NORMAL 
)

Set the background image.

Parameters
idImageImage id. The image ownership will be taken by this widget.
eWSWidget state. Check eWidgetState for further information (WS_DEFAULT is not supported).
  • with WS_NORMAL state, if there is not any other background (image or sprite) set on WS_HOVERED and WS_DEACTIVATED, they will use this background
  • with WS_PRESSED state, if there is not any other background (image or sprite) set on WS_ACTION, it will use this background
In addition, all states modified by this method will also include:
  • the widget border is disabled (using alpha border color set to 0)
  • without WIDGET_FEATURE_BGFIT, the size of the widget will be modified for matching the image size
Returns
0 or greater on success or a negative error code on failure.
Note
This method will overwrite any other previous existing background. Alpha modulation is inherited from the image.

◆ getBgImage()

Sint32 CRM64Pro::Widget::getBgImage ( eWidgetState  eWS = WS_NORMAL)

Get the background image.

Parameters
eWSWidget state. Check eWidgetState for further information.
By default it is set to WS_NORMAL.
Returns
0 on success or a negative error code on failure.

◆ setBgSprite() [1/3]

Sint32 CRM64Pro::Widget::setBgSprite ( const string &  sFileCDC,
const string &  sName,
eWidgetState  eWS = WS_DEFAULT,
Sint32  iAnim = 0 
)

Set the background sprite.

Parameters
sFileCDCstring containing the [directory]+filename.
sNamestring with the image name (maximum size of 64 characters).
If the sprite is already loaded, a new child will be created.
eWSWidget state. Check eWidgetState for further information.
When it is set to WS_DEFAULT (default value), it will try to assign an animation for each state: In addition, all states modified by this method will also include:
  • the widget border is disabled (using alpha border color set to 0)
  • without WIDGET_FEATURE_BGFIT, the size of the widget will be modified for matching the sprite size
iAnimstarting animation state (high-state + low-state) or the animation number to be used on this widget.
At least, one animation must exist.
By default, it is set to 0.
Returns
0 or greater on success or a negative error code on failure.
Note
This method will overwrite any other previous existing background. Alpha modulation is inherited from the sprite.

◆ setBgSprite() [2/3]

Sint32 CRM64Pro::Widget::setBgSprite ( Sint32  idCDC,
const string &  sName,
eWidgetState  eWS = WS_DEFAULT,
Sint32  iAnim = 0 
)

Set the background sprite.

Parameters
idCDCCDC id.
sNamestring with the image name (maximum size of 64 characters).
If the sprite is already loaded, a new child will be created.
eWSWidget state. Check eWidgetState for further information.
When it is set to WS_DEFAULT (default value), it will try to assign an animation for each state: In addition, all states modified by this method will also include:
  • the widget border is disabled (using alpha border color set to 0)
  • without WIDGET_FEATURE_BGFIT, the size of the widget will be modified for matching the sprite size
iAnimstarting animation state (high-state + low-state) or the animation number to be used on this widget.
At least, one animation must exist.
By default, it is set to 0.
Returns
0 or greater on success or a negative error code on failure.
Note
This method will overwrite any other previous existing background. Alpha modulation is inherited from the sprite.

◆ setBgSprite() [3/3]

Sint32 CRM64Pro::Widget::setBgSprite ( Sint32  idSprite,
eWidgetState  eWS = WS_DEFAULT,
Sint32  iAnim = 0 
)

Set the background sprite.

Parameters
idSpriteSprite id.
eWSWidget state. Check eWidgetState for further information.
When it is set to WS_DEFAULT (default value), it will try to assign an animation for each state: In addition, all states modified by this method will also include:
  • the widget border is disabled (using alpha border color set to 0)
  • without WIDGET_FEATURE_BGFIT, the size of the widget will be modified for matching the sprite size
iAnimstarting animation state (high-state + low-state) or the animation number to be used on this widget.
At least, one animation must exist.
By default, it is set to 0.
Returns
0 or greater on success or a negative error code on failure.
Note
This method will overwrite any other previous existing background. Alpha modulation is inherited from the sprite.

◆ getBgSprite()

Sint32 CRM64Pro::Widget::getBgSprite ( eWidgetState  eWS = WS_NORMAL,
Sint32 *  iAnim = nullptr 
)

Get the background sprite.

Parameters
eWSWidget state. Check eWidgetState for further information.
By default it is set to WS_NORMAL.
iAnimpointer to an integer for getting the animation number of selected state or nullptr when dont want to return it.
By default is set to nullptr.
Returns
0 on success or a negative error code on failure.

◆ setFunction()

Sint32 CRM64Pro::Widget::setFunction ( Sint32(*)(void *, void *)  stateFunc,
void *  iParam1 = nullptr,
void *  iParam2 = nullptr,
eWidgetState  eWS = WS_ACTION 
)

Set a function to be called on given state.

Parameters
stateFuncpointer to a function "Sint32 myFunc(void*,void*)" to be called when the widget is on the given state.
Set it to nullptr for removing a previous exiting function.
iParam1Optional void pointer passed to myFunc.
iParam2Optional void pointer passed to myFunc.
eWSWidget state. Check eWidgetState for further information (WS_DEFAULT and WS_DEACTIVATED are not supported).
By default it is set to WS_ACTION.
Returns
0 on success or a negative error code on failure.