|
Stardew Engine
|
#include "Widget.h"#include <stdbool.h>#include <string.h>#include <stdlib.h>#include "Scripting.h"#include "AssertLib.h"#include "DataNode.h"#include "DrawContext.h"#include "Log.h"
Macros | |
| #define | WIDGET_POOL_BOUNDS_CHECK(handle, rVal) OBJ_POOL_BOUNDS_CHECK(handle, rVal, gWidgetPool) |
| #define | WIDGET_POOL_BOUNDS_CHECK_NO_RETURN(handle) OBJ_POOL_BOUNDS_CHECK_NO_RETURN(handle, gWidgetPool) |
Typedefs | |
| typedef float(* | GetWorHFn) (struct UIWidget *pW) |
Functions | |
| OBJECT_POOL (struct UIWidget) | |
| HWidget | UI_NewBlankWidget () |
| size_t | UI_CountWidgetChildrenPtr (struct UIWidget *pWidget) |
| size_t | UI_CountWidgetChildren (HWidget hWidget) |
| struct UIWidget * | UI_GetWidget (HWidget hWidget) |
| struct UIWidget * | UI_FirstChild (HWidget hWidget) |
| void | UI_AddChild (HWidget hParent, HWidget hChild) |
| void | UI_Init () |
| HWidget | UI_GetScratchWiget () |
| void | UI_DestroyWidget (HWidget widget) |
| void | UI_ParseWidgetDimsAttribute (const char *attributeContent, struct WidgetDim *outWidgetDims) |
| void | UI_ParseWidgetPaddingAttributes (struct DataNode *pInNode, struct WidgetPadding *outWidgetPadding) |
| void | UI_ParseHorizontalAlignementAttribute (const char *contents, enum WidgetHorizontalAlignment *outAlignment) |
| void | UI_ParseVerticalAlignementAttribute (const char *contents, enum WidgetVerticalAlignment *outAlignment) |
| struct WidgetDim * | GetWidgetWidthDim (struct UIWidget *pWidget) |
| struct WidgetDim * | GetWidgetHeightDim (struct UIWidget *pWidget) |
| float | GetWidgetW (struct UIWidget *pW) |
| float | GetWidgetH (struct UIWidget *pW) |
| struct UIWidget * | FindResolveableDimensionAncestor (struct UIWidget *pWidgetParent, WidgetDimGetterFn getter) |
| float | UI_ResolveWidthDimPxls (struct UIWidget *pWidget, const struct WidgetDim *dim) |
| float | UI_ResolveHeightDimPxls (struct UIWidget *pWidget, const struct WidgetDim *dim) |
| bool | UI_ParseWidgetDockPoint (struct DataNode *pInNode, struct UIWidget *outWidget) |
| void | UI_DefaultOnChildrenChanged (struct UIWidget *outWidget) |
| void | UI_WidgetCommonInit (struct DataNode *pInNode, struct UIWidget *outWidget) |
| Init common attributes that all widgets can have. | |
| void | UI_DebugPrintCommonWidgetInfo (const struct UIWidget *inWidget, PrintfFn pPrintfFn) |
| print a text representation of the widget tree. Falls appart if a widget fails to implement its debug print hook correctly. Shit. DON'T USE | |
| void * | UI_Helper_OnOutputVerts (struct UIWidget *pWidget, VECTOR(WidgetVertex) pOutVerts) |
| void | UI_Helper_OnLayoutChildren (struct UIWidget *pWidget, struct UIWidget *pParent) |
| void | UI_SendWidgetMouseEvent (struct UIWidget *pWidget, enum WidgetCallbackTypes type, struct WidgetMouseInfo *pMouseInfo) |
| send a mouse event to the widget that will be handled either by either or both a lua function and a c function. If both the C function is called first | |
| void | UI_GetWidgetSize (HWidget hWidget, float *pOutW, float *pOutH) |
| void | UI_GetWidgetPadding (HWidget hWidget, float *pOutPaddingTop, float *pOutPaddingBottom, float *pOutPaddingLeft, float *pOutPaddingRight) |
| void | UI_GetWidgetTopLeft (HWidget hWidget, float *pOutLeft, float *pOutTop) |
| get top left BEFORE padding is applied (the raw top left) | |
| void | UI_GetHitBox (GeomRect outRect, HWidget hWidget) |
| Get the AABB of the widget, excluding padding. | |
| bool | UI_IsAttributeStringABindingExpression (const char *attributeValue) |
| char * | UI_MakeBindingGetterFunctionName (const char *inBindingName) |
| USER MUST FREE RETURNED PTR append Get_ to the start of the string. | |
| char * | UI_MakeBindingSetterFunctionName (const char *inBindingName) |
| struct WidgetPropertyBinding * | UI_FindBinding (struct UIWidget *pWidget, const char *bindingName) |
| void | UI_AddStringPropertyBinding (struct UIWidget *pWidget, char *inBoundPropertyName, char *inBindingExpression, char **pOutData, int viewmodelTableIndex) |
| Add a bound string property entry to the widget and initialise a value by calling the binding getter function. | |
| void | UI_AddIntPropertyBinding (struct UIWidget *pWidget, char *inBoundPropertyName, char *inBindingExpression, int *pOutData, int viewmodelTableIndex) |
| void | UI_AddFloatPropertyBinding (struct UIWidget *pWidget, char *inBoundPropertyName, char *inBindingExpression, float *pOutData, int viewmodelTableIndex) |
| #define WIDGET_POOL_BOUNDS_CHECK | ( | handle, | |
| rVal | |||
| ) | OBJ_POOL_BOUNDS_CHECK(handle, rVal, gWidgetPool) |
| #define WIDGET_POOL_BOUNDS_CHECK_NO_RETURN | ( | handle | ) | OBJ_POOL_BOUNDS_CHECK_NO_RETURN(handle, gWidgetPool) |
| typedef float(* GetWorHFn) (struct UIWidget *pW) |
| struct UIWidget * FindResolveableDimensionAncestor | ( | struct UIWidget * | pWidgetParent, |
| WidgetDimGetterFn | getter | ||
| ) |
| float GetWidgetH | ( | struct UIWidget * | pW | ) |
| float GetWidgetW | ( | struct UIWidget * | pW | ) |
| OBJECT_POOL | ( | struct UIWidget | ) |
| void UI_AddFloatPropertyBinding | ( | struct UIWidget * | pWidget, |
| char * | inBoundPropertyName, | ||
| char * | inBindingExpression, | ||
| float * | pOutData, | ||
| int | viewmodelTableIndex | ||
| ) |
| void UI_AddIntPropertyBinding | ( | struct UIWidget * | pWidget, |
| char * | inBoundPropertyName, | ||
| char * | inBindingExpression, | ||
| int * | pOutData, | ||
| int | viewmodelTableIndex | ||
| ) |
| void UI_AddStringPropertyBinding | ( | struct UIWidget * | pWidget, |
| char * | inBoundPropertyName, | ||
| char * | inBindingExpression, | ||
| char ** | pOutData, | ||
| int | viewmodelTableIndex | ||
| ) |
Add a bound string property entry to the widget and initialise a value by calling the binding getter function.
| pWidget | theWidget to add the property binding. When the value changes the property of the widget will change when OnPropertyChanged is called. 2 way bindings will also be introduced for sliders, text entry fields, ect |
| inBoundPropertyName | bound property name - as it appears in the viewmodel lua table |
| inBindingExpression | the incoming binding expression, i.e. {spritename} |
| pOutData | the value returned from calling the lua string getter - allocates a string setting the pointer. user must deallocate |
| viewmodelTableIndex | the index in the lua registry that contains the lua table containing the function to call |
| size_t UI_CountWidgetChildren | ( | HWidget | hWidget | ) |
| size_t UI_CountWidgetChildrenPtr | ( | struct UIWidget * | pWidget | ) |
print a text representation of the widget tree. Falls appart if a widget fails to implement its debug print hook correctly. Shit. DON'T USE
| inWidget | |
| pPrintfFn |
| void UI_DefaultOnChildrenChanged | ( | struct UIWidget * | outWidget | ) |
| void UI_DestroyWidget | ( | HWidget | widget | ) |
| struct WidgetPropertyBinding * UI_FindBinding | ( | struct UIWidget * | pWidget, |
| const char * | bindingName | ||
| ) |
Get the AABB of the widget, excluding padding.
| outRect | |
| hWidget |
| HWidget UI_GetScratchWiget | ( | ) |
| void UI_GetWidgetPadding | ( | HWidget | hWidget, |
| float * | pOutPaddingTop, | ||
| float * | pOutPaddingBottom, | ||
| float * | pOutPaddingLeft, | ||
| float * | pOutPaddingRight | ||
| ) |
| void UI_GetWidgetSize | ( | HWidget | hWidget, |
| float * | pOutW, | ||
| float * | pOutH | ||
| ) |
| void UI_GetWidgetTopLeft | ( | HWidget | hWidget, |
| float * | pOutLeft, | ||
| float * | pOutTop | ||
| ) |
get top left BEFORE padding is applied (the raw top left)
| hWidget | |
| pOutLeft | |
| pOutTop |
| void * UI_Helper_OnOutputVerts | ( | struct UIWidget * | pWidget, |
| VECTOR(WidgetVertex) | pOutVerts | ||
| ) |
| void UI_Init | ( | ) |
| bool UI_IsAttributeStringABindingExpression | ( | const char * | attributeValue | ) |
| attributeValue |
| char * UI_MakeBindingGetterFunctionName | ( | const char * | inBindingName | ) |
USER MUST FREE RETURNED PTR append Get_ to the start of the string.
| inBindingName |
| char * UI_MakeBindingSetterFunctionName | ( | const char * | inBindingName | ) |
| HWidget UI_NewBlankWidget | ( | ) |
| void UI_ParseHorizontalAlignementAttribute | ( | const char * | contents, |
| enum WidgetHorizontalAlignment * | outAlignment | ||
| ) |
| void UI_ParseVerticalAlignementAttribute | ( | const char * | contents, |
| enum WidgetVerticalAlignment * | outAlignment | ||
| ) |
| void UI_ParseWidgetDimsAttribute | ( | const char * | attributeContent, |
| struct WidgetDim * | outWidgetDims | ||
| ) |
| void UI_ParseWidgetPaddingAttributes | ( | struct DataNode * | pInNode, |
| struct WidgetPadding * | outWidgetPadding | ||
| ) |
| void UI_SendWidgetMouseEvent | ( | struct UIWidget * | pWidget, |
| enum WidgetCallbackTypes | type, | ||
| struct WidgetMouseInfo * | pMouseInfo | ||
| ) |
send a mouse event to the widget that will be handled either by either or both a lua function and a c function. If both the C function is called first
| pWidget | |
| <br> | |
| pMouseInfo | data about the event |