Cavestory Mod API
Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
ScrollAreaInfo Class Reference

A scroll area. More...

#include <CSMAPI_types.h>

Inheritance diagram for ScrollAreaInfo:
GuiBase

Public Types

enum  HoverType : unsigned char { HOVER_NONE = 0 , HOVER_BUTTON_1 , HOVER_HANDLE , HOVER_BUTTON_2 }
 Scroll hover type. More...
 
enum  ScrollState { SCROLL_NONE = 0 , SCROLL_X , SCROLL_Y }
 State of scrolling. More...
 
typedef void(* OnScrollCallbackFunc) (ScrollAreaInfo *pGui, GUI_POINT_F scrollAmt)
 Func callback for when a scroll element scrolls. More...
 
- Public Types inherited from GuiBase
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

 ScrollAreaInfo ()
 Default constructor.
 
bool isScrolling ()
 Check if this element is being scrolled. More...
 
virtual const char * getClassName ()
 Get this class' name. More...
 
virtual void setSelected (int value)
 Set this GUI element as selected or not. More...
 
virtual void setHovered (int value)
 Set this GUI element as hovered over or not. More...
 
virtual bool isSelected ()
 Check selection status. More...
 
virtual bool isHovered ()
 Check hover status. More...
 
virtual bool isHoverable ()
 Check hoverability status. More...
 
void fitIntoContent (GUI_POINT p)
 Fit the point into the content. More...
 
void fitIntoContent (GUI_RECT r)
 Fit the rect into the content. More...
 
void scrollTo (GUI_RECT r)
 Scroll to a rect. More...
 
void scrollByPixelAmount (GUI_POINT p)
 Scroll by pixel amount. More...
 
GUI_POINT getOffset ()
 Get the scroll offsets. More...
 
GUI_POINT getRelativeOffset ()
 Get the scroll offsets. More...
 
GUI_RECT getContentArea ()
 Calculate the content area for this scroll. More...
 
GUI_RECT getHorizontalScrollBar ()
 Calculate the rect for the horizontal scroll bar. More...
 
GUI_RECT getVerticalScrollBar ()
 Calculate the rect for the vertical scroll bar. More...
 
virtual int process (GUI_POINT mouse)
 Process mouse input for this element. More...
 
virtual void calculate ()
 Re-calculate this element's data. More...
 
virtual void render ()
 Render this element.
 
void begin ()
 Enforce a clip rect that accomodates the content area. More...
 
void end ()
 Clear the clip rect enforced by begin(). More...
 
- Public Member Functions inherited from GuiBase
 GuiBase ()
 Default constructor.
 
virtual ~GuiBase ()
 Default deconstructor.
 
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 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

OnScrollCallbackFunc OnScroll
 Called when this element's scroll amount changes.
 
GUI_POINT_F scroll
 Normalized scroll amounts (for both x and y)
 
bool drawBackground
 Draw scroll background.
 
bool drawBorder
 Draw scroll border.
 
bool showScrollX
 Show the horizontal scrollbar.
 
bool showScrollY
 Show the vertical scrollbar.
 
int scrollBarSize
 The size of the scrollbar (height for the horizontal scrollbar, width for the vertical scrollbar)
 
int scrollBarHandleMargin
 Scroll bar handle margin.
 
int scrollBarHandleMinSize
 Scroll bar handle minimum size (width for horizontal scrollbar, width for vertical scrollbar)
 
HoverType hoverScrollX
 The current hover state for the horizontal bar.
 
HoverType hoverScrollY
 The current hover state for the vertical bar.
 
GUI_POINT contentSize
 Size of the content area.
 
GUI_POINT mouseWheelScroll
 Amount of scroll on mousewheel movement for both X and Y.
 
- Public Attributes inherited from GuiBase
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'.
 

Protected Attributes

ScrollState scrollState
 
GUI_RECT scrollBarXBtn_Left
 
GUI_RECT scrollBarXBtn_Right
 
GUI_RECT scrollBarYBtn_Up
 
GUI_RECT scrollBarYBtn_Down
 
GUI_RECT scrollBarHandleY
 
GUI_RECT scrollBarY
 
GUI_RECT scrollBarHandleX
 
GUI_RECT scrollBarX
 
GUI_POINT offsetPoint
 
bool showingHandleX
 
bool showingHandleY
 

Additional Inherited Members

- Static Public Attributes inherited from GuiBase
static unsigned int defaultCustomMagnification
 
static GuiBasegFirst
 
- Protected Member Functions inherited from GuiBase
void Link ()
 Link ourselves to the global GUI element linkage.
 
void Unlink ()
 Unlink ourselves from the global GUI element linkage.
 

Detailed Description

A scroll area.

Member Typedef Documentation

◆ OnScrollCallbackFunc

typedef void(* ScrollAreaInfo::OnScrollCallbackFunc) (ScrollAreaInfo *pGui, GUI_POINT_F scrollAmt)

Func callback for when a scroll element scrolls.

Parameters
pGuiThe GUI element being scrolled.
scrollAmtNormalized scroll amount.

Member Enumeration Documentation

◆ HoverType

enum ScrollAreaInfo::HoverType : unsigned char

Scroll hover type.

Enumerator
HOVER_NONE 

Not hovering.

HOVER_BUTTON_1 

Left / Up arrow button.

HOVER_HANDLE 

Scroll handle.

HOVER_BUTTON_2 

Right / Down arrow button.

◆ ScrollState

State of scrolling.

Enumerator
SCROLL_NONE 

Not scrolling.

SCROLL_X 

User is scrolling the bottom (horizontal) scrollbar.

SCROLL_Y 

User is scrolling the right (vertical) scrollbar.

Member Function Documentation

◆ begin()

void ScrollAreaInfo::begin ( )

Enforce a clip rect that accomodates the content area.

Note
ALWAYS use this BEFORE rendering things that should be inside the scroll!

◆ calculate()

virtual void ScrollAreaInfo::calculate ( )
virtual

Re-calculate this element's data.

Warning
You should ALWAYS call this at least once BEFORE you call render()!

Implements GuiBase.

◆ end()

void ScrollAreaInfo::end ( )

Clear the clip rect enforced by begin().

Note
ALWAYS use this AFTER rendering things that should be inside the scroll!
...Unless you didn't use begin() for whatever reason.

◆ fitIntoContent() [1/2]

void ScrollAreaInfo::fitIntoContent ( GUI_POINT  p)

Fit the point into the content.

Parameters
pThe point to show

Resizes the contentSize variable to accomodate showing p

◆ fitIntoContent() [2/2]

void ScrollAreaInfo::fitIntoContent ( GUI_RECT  r)

Fit the rect into the content.

Parameters
rThe rect to show

Resizes the contentSize variable to accomodate showing the entirety of r

◆ getClassName()

virtual const char* ScrollAreaInfo::getClassName ( )
inlinevirtual

Get this class' name.

Returns
Should return the name of this class.

Reimplemented from GuiBase.

◆ getContentArea()

GUI_RECT ScrollAreaInfo::getContentArea ( )

Calculate the content area for this scroll.

Returns
Returns the currently visible content area rect.

◆ getHorizontalScrollBar()

GUI_RECT ScrollAreaInfo::getHorizontalScrollBar ( )

Calculate the rect for the horizontal scroll bar.

Returns
Returns a rect that contains the entirety of the horizontal scroll bar.

◆ getOffset()

GUI_POINT ScrollAreaInfo::getOffset ( )

Get the scroll offsets.

Returns
Returns the scroll offset in pixels.

You should use this offset things that should be inside this scroll.

◆ getRelativeOffset()

GUI_POINT ScrollAreaInfo::getRelativeOffset ( )

Get the scroll offsets.

Returns
Returns the scroll offset in pixels.

◆ getVerticalScrollBar()

GUI_RECT ScrollAreaInfo::getVerticalScrollBar ( )

Calculate the rect for the vertical scroll bar.

Returns
Returns a rect that contains the entirety of the vertical scroll bar.

◆ isHoverable()

virtual bool ScrollAreaInfo::isHoverable ( )
virtual

Check hoverability status.

Returns
Returns true if this element can be hovered over.

Implements GuiBase.

◆ isHovered()

virtual bool ScrollAreaInfo::isHovered ( )
virtual

Check hover status.

Returns
Returns true if this element is being hovered over.

Implements GuiBase.

◆ isScrolling()

bool ScrollAreaInfo::isScrolling ( )
inline

Check if this element is being scrolled.

Returns
Returns true if the element is being scrolled.

◆ isSelected()

virtual bool ScrollAreaInfo::isSelected ( )
virtual

Check selection status.

Returns
Returns true if this element is selected.

Implements GuiBase.

◆ process()

virtual int ScrollAreaInfo::process ( GUI_POINT  mouse)
virtual

Process mouse input for this element.

Returns
Returns ProcessReturnType flags.
See also
ProcessReturnType

Implements GuiBase.

◆ scrollByPixelAmount()

void ScrollAreaInfo::scrollByPixelAmount ( GUI_POINT  p)

Scroll by pixel amount.

Parameters
pThe pixel amounts to scroll by

◆ scrollTo()

void ScrollAreaInfo::scrollTo ( GUI_RECT  r)

Scroll to a rect.

Parameters
rThe rect to scroll to

Automatically scroll to show the entirety of rect r

◆ setHovered()

virtual void ScrollAreaInfo::setHovered ( int  value)
virtual

Set this GUI element as hovered over or not.

Parameters
valueThe hover value.

Implements GuiBase.

◆ setSelected()

virtual void ScrollAreaInfo::setSelected ( int  value)
virtual

Set this GUI element as selected or not.

Parameters
valueThe selection value.

Implements GuiBase.


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