Cavestory Mod API
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | List of all members
GuiBase Class Referenceabstract

The base class for GUI elements. More...

#include <CSMAPI_types.h>

Inheritance diagram for GuiBase:
ButtonInfo CaveStoryDialogBoxInfo CenteredTextInfo CheckBoxInfo ColorPickerInfo CustomDrawInfo DraggableWindowInfo DrawBitmapInfo DropdownBoxInfo GroupBoxInfo KeyInputInfo LabelInfo ScrollAreaInfo SelectableLabelInfo SelectableListInfo SliderIntInfo SystemMenuInfo TabBookInfo TextInputInfo

Public Types

enum  ProcessReturnType {
  PRT_DIRTY = 0b000001 , PRT_IGNORE_MOUSE = 0b000010 , PRT_IGNORE_KEYS = 0b000100 , PRT_SELECTED = 0b001000 ,
  PRT_DISABLE_MOUSE_ON_MOVE = 0b010000 , PRT_CHANGED = 0b100000
}
 Return flags for GuiBase::process and GuiBase::processKeys. More...
 
typedef void(* OnHoverChangeCallbackFunc) (GuiBase *, int value)
 Hover callback.
 
typedef void(* OnValueChangeCallbackFunc) (GuiBase *, const char *&newValue)
 Value change callback.
 
typedef bool(* OnValidateChangeCallbackFunc) (GuiBase *, const char *oldValue, char *newValue)
 Validate change callback.
 

Public Member Functions

 GuiBase ()
 Default constructor.
 
virtual ~GuiBase ()
 Default deconstructor.
 
virtual const char * getClassName ()
 Get this class' name. More...
 
virtual void setSelected (int value)=0
 Set this GUI element as selected or not. More...
 
virtual void setHovered (int value)=0
 Set this GUI element as hovered over or not. More...
 
virtual bool isSelected ()=0
 Check selection status. More...
 
virtual bool isHovered ()=0
 Check hover status. More...
 
virtual bool isHoverable ()=0
 Check hoverability status. More...
 
virtual int getSelectableCount ()
 Get the selectable number of elements in this element. More...
 
virtual int getHoverableCount ()
 Get the number of elements that can be hovered over in this element. More...
 
virtual GuiBasegetHoverable (int index)
 Get a hoverable sub-element. More...
 
virtual GuiBasegetSelectable (int index)
 Get a selectable sub-element. More...
 
virtual bool SelectOnMouseUp ()
 Select on mouse up. More...
 
virtual void setFont (FontObject *pFont)
 Set the font for this GUI element. More...
 
virtual FontObject * getFont ()
 Get the font for this GUI element. More...
 
virtual int process (GUI_POINT mouse)=0
 Process mouse input for this element. More...
 
virtual void calculate ()=0
 Re-calculate this element's data. More...
 
virtual void render ()=0
 Render this element.
 
virtual int processKeys ()
 Process key input for this element. More...
 
virtual void importantRender ()
 Render the important bits of this element. More...
 
virtual int getMagnification ()
 
 GuiBase (const GuiBase &)=delete
 
GuiBaseoperator= (const GuiBase &)=delete
 
 GuiBase (GuiBase &&)=delete
 
GuiBaseoperator= (GuiBase &&)=delete
 

Public Attributes

GuiBasepNext
 
GuiBasepPrev
 
OnValueChangeCallbackFunc OnValueChange
 Called in specific GuiBase children classes to indicate that a value has been changed.
 
OnValidateChangeCallbackFunc OnValidateChange
 Called in specific GuiBase children classes to indicate that a value has been changed.
 
GUI_RECT rect
 The display rect this GUI element will use.
 
void * userData
 Custom user data.
 
void * userData2
 Custom user data.
 
unsigned int customMagnification
 The magnification to display this element at.
 
OnHoverChangeCallbackFunc OnHoverChange
 Called in specific GuiBase children classes to indicate that the GUI element is being hovered over.
 
bool has_special_mouse_processing
 Has special mouse processing.
 
GUI_RECT hotspot_rect
 The special hotspot rect.
 
bool has_special_hotspot_rect
 Has special hotspot rect; If true, 'process' will be called everytime the mouse is inside of 'hotspot_rect' instead of 'rect'.
 

Static Public Attributes

static unsigned int defaultCustomMagnification
 
static GuiBasegFirst
 

Protected Member Functions

void Link ()
 Link ourselves to the global GUI element linkage.
 
void Unlink ()
 Unlink ourselves from the global GUI element linkage.
 

Detailed Description

The base class for GUI elements.

Member Enumeration Documentation

◆ ProcessReturnType

Return flags for GuiBase::process and GuiBase::processKeys.

Enumerator
PRT_DIRTY 

This GUI element is dirty and should be updated.

PRT_IGNORE_MOUSE 

Stop processing mouse input for this frame.

PRT_IGNORE_KEYS 

Stop processing key input for this frame.

PRT_SELECTED 

This GUI element was selected.

PRT_DISABLE_MOUSE_ON_MOVE 

This is telling the mode to set m_ModeConfig.ProcessMouseOnMove to 'false' so it can process the next frame.

PRT_CHANGED 

This GUI element was changed.

Member Function Documentation

◆ calculate()

virtual void GuiBase::calculate ( )
pure virtual

◆ getClassName()

virtual const char* GuiBase::getClassName ( )
inlinevirtual

◆ getFont()

virtual FontObject* GuiBase::getFont ( )
inlinevirtual

Get the font for this GUI element.

Returns
Returns the font object for this element.

Reimplemented in TabBookInfo, GroupBoxInfo, DraggableWindowInfo, ColorPickerInfo, DropdownBoxInfo, ButtonInfo, SliderIntInfo, KeyInputInfo, TextInputInfo, SelectableLabelInfo, LabelInfo, and CenteredTextInfo.

◆ getHoverable()

virtual GuiBase* GuiBase::getHoverable ( int  index)
inlinevirtual

Get a hoverable sub-element.

Parameters
indexThe sub-element's index.
Returns
Returns a sub-element, NULL if it couldn't be resolved.

Reimplemented in ColorPickerInfo.

◆ getHoverableCount()

virtual int GuiBase::getHoverableCount ( )
inlinevirtual

Get the number of elements that can be hovered over in this element.

Returns
Returns the amount of elements that can be hovered over in this element.

Reimplemented in SelectableListInfo, SystemMenuInfo, TabBookInfo, GroupBoxInfo, DraggableWindowInfo, ColorPickerInfo, DropdownBoxInfo, ButtonInfo, SliderIntInfo, CheckBoxInfo, KeyInputInfo, TextInputInfo, and SelectableLabelInfo.

◆ getSelectable()

virtual GuiBase* GuiBase::getSelectable ( int  index)
inlinevirtual

Get a selectable sub-element.

Parameters
indexThe sub-element's index.
Returns
Returns a sub-element, NULL if it couldn't be resolved.

Reimplemented in ColorPickerInfo.

◆ getSelectableCount()

virtual int GuiBase::getSelectableCount ( )
inlinevirtual

Get the selectable number of elements in this element.

Returns
Returns the amount of selectable elements in this element.

Reimplemented in SelectableListInfo, SystemMenuInfo, TabBookInfo, GroupBoxInfo, DraggableWindowInfo, ColorPickerInfo, DropdownBoxInfo, ButtonInfo, SliderIntInfo, CheckBoxInfo, KeyInputInfo, TextInputInfo, and SelectableLabelInfo.

◆ importantRender()

virtual void GuiBase::importantRender ( )
inlinevirtual

Render the important bits of this element.

Note
This function is used to draw things that should be at the front of the screen, so make sure to call it AFTER rendering everything else.

Reimplemented in SystemMenuInfo, ColorPickerInfo, DropdownBoxInfo, and SliderIntInfo.

◆ isHoverable()

virtual bool GuiBase::isHoverable ( )
pure virtual

◆ isHovered()

virtual bool GuiBase::isHovered ( )
pure virtual

◆ isSelected()

virtual bool GuiBase::isSelected ( )
pure virtual

◆ process()

virtual int GuiBase::process ( GUI_POINT  mouse)
pure virtual

◆ processKeys()

virtual int GuiBase::processKeys ( )
inlinevirtual

Process key input for this element.

Returns
Returns ProcessReturnType flags.
See also
ProcessReturnType

Reimplemented in SystemMenuInfo, TabBookInfo, DraggableWindowInfo, DropdownBoxInfo, ButtonInfo, SliderIntInfo, CheckBoxInfo, KeyInputInfo, and TextInputInfo.

◆ SelectOnMouseUp()

virtual bool GuiBase::SelectOnMouseUp ( )
inlinevirtual

Select on mouse up.

Returns
Return false if you want this element to be selected on mousedown instead of mouseup

Reimplemented in SelectableListInfo, SliderIntInfo, KeyInputInfo, TextInputInfo, and SelectableLabelInfo.

◆ setFont()

virtual void GuiBase::setFont ( FontObject *  pFont)
inlinevirtual

◆ setHovered()

virtual void GuiBase::setHovered ( int  value)
pure virtual

◆ setSelected()

virtual void GuiBase::setSelected ( int  value)
pure virtual

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