Panel

From Crumbled World Wiki
Revision as of 08:59, 4 August 2025 by Anders (talk | contribs) (→‎Functions)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

PanelExampleCode

Constructor

function description
Panel(PanelSize size)
Panel(Panel panel)

Functions

return function description
clear() Clear panel from all children.
clearEvents() Clear panel from all events.
Panel add(Panel panel) Add child panel.
addRenderObject(Scene2DNode renderObject) Add render object to this panel.
bool removePanel(Panel panel) Remove child panel.
Form getForm() Return the form this panel belongs to.
string getName() Return the name of the panel.
setBackground(Sprite background) Set panel background.
setBackground(Sprite background, PanelSize backgroundSize) Set panel background. BackgroundSize set the size of the background the background is aligned to the center.
setBackground(Gradient background) Set panel background.
setBackground(Gradient background, PanelSize backgroundSize) Set panel background. BackgroundSize set the size of the background the background is aligned to the center.
setBorder(BaseBorder panelBorder) Set panel border.
setPadding(BorderSize padding) Set panel padding.
setMargin(BorderSize margin) Set panel margin.
setPanelId(string panelId) Set panelsize.
setPanelSize(PanelSize size) Set panel id.
setLayout(Layout layout) Set panel Layout.
setRender() Force panel to render.
setVisible(bool visible) Set panel visible.
setEnableScroll() Set enable scroll.
ScrollBar getYScrollBar() Get scrrollbar. if no scrollbar has been created return nil.
ScrollBar getXScrollBar() Get scrrollbar. if no scrollbar has been created return nil.
setTag(string tag) Set tag.
setTag(Text tag) Set tag.
setToolTip(Text toolTip) Set tag.
setToolTip(string toolTip) Set tag.
setToolTip(Panel toolTipPanel) Set a panel that will be shown as a tool-tip.
setToolTipParentpanel(Panel panel) Set another parent where the tool-tip will be displayed.
setCanHandleInput(bool canTakeInput) Set if the panel can access inputs.
setKeyboardOwner()) Set this panel as the keyboard owner.
clearKeyboardOwner()) Clear keyboard owner.
setEnabled(bool enabled) Set if the panel is enabled. if disabled still visible but cant be changed.
addEventCallbackExecute(nil function) Add callback for execution event.
addEventCallbackUpdate(nil function) Add callback for update event.
addEventCallbackResized(nil function) Add callback for resize event.
addEventCallbackMouseFocusGain(nil function) Add mouse focus gain
addEventCallbackMouseFocusLost(nil function) Add callback for focus gain event.
addEventCallbackKeyboardFocusGain([nil function) Add callback for keyboard focus gain event.
addEventCallbackKeyboardFocusLost(nil function) Add callback for keybord focus lost event.
addEventCallbackChanged(nil function) Add callback for when somthinge has changed.
addEventCallbackOnClick(nil function) Add callback for on mouse left click event.
addEventCallbackOnRightClick(nil function) Add callback for on mouse right click event.
addEventCallbackOnDoubleclick(nil function) Add callback for when on mouse left doubleclick event.
Panel getPanelById(string id) Get panel by id.
int getNumPanel() Get num panel children.
Panel getPanel(int index) Get panel by index.
PanelSize getPanelSize() Get panel size.
BorderSize getMarginSize() Get margin size.
BorderSize getPaddingSize() Get padding size.
Layout getLayout() Get layout.
BaseBorder getBorder() Get border.
string getPanelId() Get id.
bool getVisible() Get if visible.
Vec2i getMinPos() Get minPos.
Vec2i getMaxPos() Get max position.
Text getTag() Get tag.
bool getEnabled() Get is enabled.
Vec2i getPanelContentPixelSize() Get panel content size.
Vec2i getPanelGlobalMinMaxPosition(Vec2 outMin, Vec2 outMax) Get panel content size. NOTE outmin outMax is set by this function
bool getWillBeRenderd()
Panel getParent()
bool haskeyboardFocus()
bool hasMouseFocus()
setName(string name) Set name of the panel.

Operators

return function description
bool Panel == Panel

Overloaded returns

return function Parameter
Panel add panel