mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
initial commit jolt
This commit is contained in:
parent
0c2aa5328c
commit
8acf7da95b
1086 changed files with 214612 additions and 4 deletions
58
Engine/lib/JoltPhysics/TestFramework/UI/UICheckBox.h
Normal file
58
Engine/lib/JoltPhysics/TestFramework/UI/UICheckBox.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
|
||||
// SPDX-FileCopyrightText: 2021 Jorrit Rouwe
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <UI/UIStaticText.h>
|
||||
#include <UI/UITexturedQuad.h>
|
||||
|
||||
/// Check box control that allows the user to select between true or false
|
||||
class UICheckBox : public UIStaticText
|
||||
{
|
||||
public:
|
||||
JPH_DECLARE_RTTI_VIRTUAL(JPH_NO_EXPORT, UICheckBox)
|
||||
|
||||
enum EState
|
||||
{
|
||||
STATE_UNCHECKED,
|
||||
STATE_CHECKED
|
||||
};
|
||||
|
||||
using ClickAction = function<void(EState)>;
|
||||
|
||||
/// Properties
|
||||
void SetState(EState inState) { mState = inState; }
|
||||
EState GetState() const { return mState; }
|
||||
void SetClickAction(ClickAction inAction) { mClickAction = inAction; }
|
||||
void SetUncheckedStateQuad(const UITexturedQuad &inQuad) { mUncheckedState = inQuad; }
|
||||
void SetCheckedStateQuad(const UITexturedQuad &inQuad) { mCheckedState = inQuad; }
|
||||
|
||||
/// When added to a parent
|
||||
virtual void OnAdded() override;
|
||||
|
||||
/// Cloning / copying
|
||||
virtual void CopyTo(UIElement *ioElement) const override;
|
||||
|
||||
/// Actions
|
||||
virtual bool MouseDown(int inX, int inY) override;
|
||||
virtual bool MouseUp(int inX, int inY) override;
|
||||
virtual bool MouseMove(int inX, int inY) override;
|
||||
virtual void MouseCancel() override;
|
||||
|
||||
/// Draw element
|
||||
virtual void Draw() const override;
|
||||
|
||||
protected:
|
||||
/// Properties
|
||||
Color mDownTextColor { Color::sGrey };
|
||||
Color mHighlightTextColor { Color::sWhite };
|
||||
int mPaddingBetweenCheckboxAndText = 8;
|
||||
ClickAction mClickAction;
|
||||
UITexturedQuad mUncheckedState;
|
||||
UITexturedQuad mCheckedState;
|
||||
|
||||
/// State
|
||||
EState mState = STATE_UNCHECKED;
|
||||
bool mPressed = false;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue