CRM64Pro GDK  v0.94
A free cross-platform game development kit built on top of SDL 2.0
Classes | Macros | Functions

Classes

class  CRM64Pro::Widget
 

Macros

#define WIDGET_POSITION_CENTER   0x01000000
 
#define WIDGET_POSITION_CENTERD   0x11000000
 
#define WIDGET_POSITION_TOP   0x02000000
 
#define WIDGET_POSITION_TOPD   0x12000000
 
#define WIDGET_POSITION_BOTTOM   0x03000000
 
#define WIDGET_POSITION_BOTTOMD   0x13000000
 
#define WIDGET_POSITION_LEFT   0x04000000
 
#define WIDGET_POSITION_LEFTD   0x14000000
 
#define WIDGET_POSITION_RIGHT   0x05000000
 
#define WIDGET_POSITION_RIGHTD   0x15000000
 
#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_EVENTS   0x00200000
 
#define WIDGET_FEATURE_MOUSEOVER   0x00400000
 
#define WIDGET_FEATURE_LOSTFOCUS   0x00800000
 
#define WIDGET_FEATURE_MULTILINE   0x01000000
 
#define WIDGET_FEATURE_READONLY   0x02000000
 
#define WIDGET_FEATURE_AUTOSORT   0x04000000
 

Functions

virtual Sint32 CRM64Pro::Widget::info (Sint32 iMode=0)
 
Sint32 CRM64Pro::Widget::disable ()
 
Sint32 CRM64Pro::Widget::show ()
 
Sint32 CRM64Pro::Widget::hide ()
 
Sint32 CRM64Pro::Widget::status ()
 
Sint32 CRM64Pro::Widget::features (Sint32 iFeatures)
 
virtual Sint32 CRM64Pro::Widget::setSize (Sint32 iWidth, Sint32 iHeight)
 
Sint32 CRM64Pro::Widget::getSize (Sint32 *iWidth, Sint32 *iHeight)
 
Sint32 CRM64Pro::Widget::setPosition (Sint32 iX=WIDGET_POSITION_CENTER, Sint32 iY=WIDGET_POSITION_CENTER)
 
Sint32 CRM64Pro::Widget::getPosition (Sint32 *iX, Sint32 *iY)
 
virtual Sint32 CRM64Pro::Widget::setMargin (Sint32 iTop, Sint32 iRight, Sint32 iBottom, Sint32 iLeft)
 
Sint32 CRM64Pro::Widget::getMargin (Sint32 *iTop, Sint32 *iRight, Sint32 *iBottom, Sint32 *iLeft)
 
Sint32 CRM64Pro::Widget::setAlphaMod (Uint8 iAlpha)
 
Uint8 CRM64Pro::Widget::getAlphaMod ()
 
virtual Sint32 CRM64Pro::Widget::setText (const string &sText, Sint32 iParam1=WIDGET_POSITION_CENTER, Sint32 iParam2=WIDGET_POSITION_CENTER)
 
virtual Sint32 CRM64Pro::Widget::getText (string &sText, Sint32 iParam1=-1)
 
virtual Sint32 CRM64Pro::Widget::setKey (SDL_Keycode keycode)
 
SDL_Keycode CRM64Pro::Widget::getKey ()
 
virtual Sint32 CRM64Pro::Widget::setValue (Sint32 iValue)
 
virtual Sint32 CRM64Pro::Widget::getValue ()
 
virtual Sint32 CRM64Pro::Widget::setRange (Sint32 iRange)
 
virtual Sint32 CRM64Pro::Widget::getRange ()
 
Sint32 CRM64Pro::Widget::setState (eWidgetState eWS=WS_NORMAL)
 
virtual Sint32 CRM64Pro::Widget::setScroll (Sint32 iUnitsX, Sint32 iUnitsY)
 
virtual Sint32 CRM64Pro::Widget::getScroll (Sint32 *iUnitsX, Sint32 *iUnitsY)
 
virtual Sint32 CRM64Pro::Widget::getVisibleItems (Sint32 *iUnitsX, Sint32 *iUnitsY)
 
virtual Sint32 CRM64Pro::Widget::setFont (Sint32 idFont, eWidgetState eWS=WS_DEFAULT)
 
Sint32 CRM64Pro::Widget::getFont (eWidgetState eWS=WS_NORMAL)
 
Sint32 CRM64Pro::Widget::setBorderWidth (Sint32 iWidth, eWidgetState eWS=WS_DEFAULT)
 
Sint32 CRM64Pro::Widget::getBorderWidth (eWidgetState eWS=WS_NORMAL)
 
Sint32 CRM64Pro::Widget::setBorderCorner (Sint32 iRad, eWidgetState eWS=WS_DEFAULT)
 
Sint32 CRM64Pro::Widget::getBorderCorner (eWidgetState eWS=WS_NORMAL)
 
Sint32 CRM64Pro::Widget::setBorderColor (Uint8 iR, Uint8 iG, Uint8 iB, Uint8 iA, eWidgetState eWS=WS_DEFAULT)
 
Sint32 CRM64Pro::Widget::getBorderColor (Uint8 *iR, Uint8 *iG, Uint8 *iB, Uint8 *iA, eWidgetState eWS=WS_NORMAL)
 
Sint32 CRM64Pro::Widget::setBgColor (Uint8 iR, Uint8 iG, Uint8 iB, eWidgetState eWS=WS_DEFAULT)
 
Sint32 CRM64Pro::Widget::getBgColor (Uint8 *iR, Uint8 *iG, Uint8 *iB, eWidgetState eWS=WS_NORMAL)
 
Sint32 CRM64Pro::Widget::setBgImage (const string &sFileCDC, const string &sName, eWidgetState eWS=WS_NORMAL)
 
Sint32 CRM64Pro::Widget::setBgImage (Sint32 idCDC, const string &sName, eWidgetState eWS=WS_NORMAL)
 
Sint32 CRM64Pro::Widget::setBgImage (Sint32 idImage, eWidgetState eWS=WS_NORMAL)
 
Sint32 CRM64Pro::Widget::getBgImage (eWidgetState eWS=WS_NORMAL)
 
Sint32 CRM64Pro::Widget::setBgSprite (const string &sFileCDC, const string &sName, eWidgetState eWS=WS_DEFAULT, Sint32 iAnim=0)
 
Sint32 CRM64Pro::Widget::setBgSprite (Sint32 idCDC, const string &sName, eWidgetState eWS=WS_DEFAULT, Sint32 iAnim=0)
 
Sint32 CRM64Pro::Widget::setBgSprite (Sint32 idSprite, eWidgetState eWS=WS_DEFAULT, Sint32 iAnim=0)
 
Sint32 CRM64Pro::Widget::getBgSprite (eWidgetState eWS=WS_NORMAL, Sint32 *iAnim=nullptr)
 
Sint32 CRM64Pro::Widget::setFunction (Sint32(*stateFunc)(void *, void *), void *iParam1=nullptr, void *iParam2=nullptr, eWidgetState eWS=WS_ACTION)
 

Detailed Description

Macro Definition Documentation

#define WIDGET_POSITION_CENTER   0x01000000

Widget relative position: center with optional increment.

#define WIDGET_POSITION_CENTERD   0x11000000

Widget relative position: center with optional decrement.

#define WIDGET_POSITION_TOP   0x02000000

Widget relative position: top with optional increment.

#define WIDGET_POSITION_TOPD   0x12000000

Widget relative position: top with optional decrement.

#define WIDGET_POSITION_BOTTOM   0x03000000

Widget relative position: bottom with optional increment.

#define WIDGET_POSITION_BOTTOMD   0x13000000

Widget relative position: bottom with optional decrement.

#define WIDGET_POSITION_LEFT   0x04000000

Widget relative position: left with optional increment.

#define WIDGET_POSITION_LEFTD   0x14000000

Widget relative position: left with optional decrement.

#define WIDGET_POSITION_RIGHT   0x05000000

Widget relative position: right with optional increment.

#define WIDGET_POSITION_RIGHTD   0x15000000

Widget relative position: right with optional decrement.

#define WIDGET_FEATURE_FADE   0x00010000

Widget feature: fading effect at showing and hiding time.

#define WIDGET_FEATURE_DRAGDROP   0x00020000

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

#define WIDGET_FEATURE_ENCLOSE   0x00040000

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

#define WIDGET_FEATURE_DETACH   0x00080000

Widget feature: the widget is detached from its parent.

#define WIDGET_FEATURE_BGFIT   0x00100000

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

#define WIDGET_FEATURE_EVENTS   0x00200000

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

#define WIDGET_FEATURE_MOUSEOVER   0x00400000

Widget feature: allow the widget to generate C64_EVENT_WIDGET_MOUSEOVER events.

#define WIDGET_FEATURE_LOSTFOCUS   0x00800000

Widget feature: allow the widget to generate C64_EVENT_WIDGET_LOSTFOCUS events.

#define WIDGET_FEATURE_MULTILINE   0x01000000

Widget feature: TextBox supports multiline text.

#define WIDGET_FEATURE_READONLY   0x02000000

Widget feature: TextBox on read-only mode.

#define WIDGET_FEATURE_AUTOSORT   0x04000000

Widget feature: ListBox auto-sorting of items.

Enumeration Type Documentation

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.

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

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.
Sint32 CRM64Pro::Widget::disable ( )

Disable a widget.

Returns
0 on success or a negative error code on failure.
Sint32 CRM64Pro::Widget::show ( )

Show a widget.

Returns
0 on success or a negative error code on failure.
Sint32 CRM64Pro::Widget::hide ( )

Hide a widget.

Returns
0 on success or a negative error code on failure.
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.
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.
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.
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.
Sint32 CRM64Pro::Widget::setPosition ( Sint32  iX = WIDGET_POSITION_CENTER,
Sint32  iY = WIDGET_POSITION_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 WIDGET_POSITION_x defines for a list of supported position helpers.
iYwidget Y position.
Check WIDGET_POSITION_x defines for a list of supported position helpers.
Returns
0 on success or a negative error code on failure.
Note
The widget can be "moved" at any time.
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.
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.
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.
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.
Uint8 CRM64Pro::Widget::getAlphaMod ( )

Get alpha modulation used for rendering this widget.

Returns
It ranges from 255 (opaque) to 0 (fully transparent).
Sint32 CRM64Pro::Widget::setText ( const string &  sText,
Sint32  iParam1 = WIDGET_POSITION_CENTER,
Sint32  iParam2 = WIDGET_POSITION_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 WIDGET_POSITION_CENTER.
  • WT_LABEL,WT_BUTTON and WT_CHECKBOX: caption X position, check WIDGET_POSITION_x defines 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 WIDGET_POSITION_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.
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.
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.
SDL_Keycode CRM64Pro::Widget::getKey ( )

Get the assigned key.

Returns
SDL_Keycode assigned for enabling the WS_ACTION state.
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.
  • 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.
Sint32 CRM64Pro::Widget::getValue ( )
virtual

Get current value.

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

Returns
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 has sense with WT_PROGRESSBAR, WT_HSLIDER and WT_VSLIDER widget types.
Returns
0 on success or a negative error code on failure.
Sint32 CRM64Pro::Widget::getRange ( )
virtual

Get current range.

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

Returns
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.
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.
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.
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.
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.
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.
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.
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
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.
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
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. return 0 on success or a negative error code on failure.
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.
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. return 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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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. return 0 on success or a negative error code on failure.