mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-09 21:11:50 +00:00
buttons-related semantics update + refactor
This commit is contained in:
parent
537a0ca358
commit
6cdb45485b
12 changed files with 130 additions and 110 deletions
|
|
@ -13,12 +13,13 @@ namespace gui {
|
|||
class UINode;
|
||||
class GUI;
|
||||
|
||||
typedef std::function<void(GUI*)> onaction;
|
||||
typedef std::function<void(GUI*, double)> onnumberchange;
|
||||
using onaction = std::function<void(GUI*)>;
|
||||
using onnumberchange = std::function<void(GUI*, double)>;
|
||||
|
||||
enum class Align {
|
||||
left, center, right
|
||||
};
|
||||
|
||||
class UINode {
|
||||
protected:
|
||||
glm::vec2 coord;
|
||||
|
|
@ -31,6 +32,7 @@ namespace gui {
|
|||
bool pressed = false;
|
||||
bool focused = false;
|
||||
bool interactive = true;
|
||||
bool resizing = true;
|
||||
Align align = Align::left;
|
||||
UINode* parent = nullptr;
|
||||
UINode(glm::vec2 coord, glm::vec2 size);
|
||||
|
|
@ -96,6 +98,9 @@ namespace gui {
|
|||
/* Make the element opaque (true) or transparent (false) for cursor */
|
||||
virtual void setInteractive(bool flag);
|
||||
|
||||
virtual void setResizing(bool flag);
|
||||
virtual bool isResizing() const;
|
||||
|
||||
/* Get inner content offset. Used for scroll */
|
||||
virtual glm::vec2 contentOffset() {return glm::vec2(0.0f);};
|
||||
/* Calculate screen position of the element */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue