add 'cursor' ui property
This commit is contained in:
@@ -25,6 +25,7 @@ TextBox::TextBox(std::wstring placeholder, glm::vec4 padding)
|
||||
input(L""),
|
||||
placeholder(std::move(placeholder))
|
||||
{
|
||||
setCursor(CursorShape::TEXT);
|
||||
setOnUpPressed(nullptr);
|
||||
setOnDownPressed(nullptr);
|
||||
setColor(glm::vec4(0.0f, 0.0f, 0.0f, 0.75f));
|
||||
|
||||
@@ -150,6 +150,14 @@ float UINode::getTooltipDelay() const {
|
||||
return tooltipDelay;
|
||||
}
|
||||
|
||||
void UINode::setCursor(CursorShape shape) {
|
||||
cursor = shape;
|
||||
}
|
||||
|
||||
CursorShape UINode::getCursor() const {
|
||||
return cursor;
|
||||
}
|
||||
|
||||
glm::vec2 UINode::calcPos() const {
|
||||
if (parent) {
|
||||
return pos + parent->calcPos() + parent->getContentOffset();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "delegates.hpp"
|
||||
#include "graphics/core/commons.hpp"
|
||||
#include "window/input.hpp"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
@@ -112,6 +113,8 @@ namespace gui {
|
||||
std::wstring tooltip;
|
||||
/// @brief element tooltip delay
|
||||
float tooltipDelay = 0.5f;
|
||||
/// @brief cursor shape when mouse is over the element
|
||||
CursorShape cursor = CursorShape::ARROW;
|
||||
|
||||
UINode(glm::vec2 size);
|
||||
public:
|
||||
@@ -206,6 +209,9 @@ namespace gui {
|
||||
virtual void setTooltipDelay(float delay);
|
||||
virtual float getTooltipDelay() const;
|
||||
|
||||
virtual void setCursor(CursorShape shape);
|
||||
virtual CursorShape getCursor() const;
|
||||
|
||||
virtual glm::vec4 calcColor() const;
|
||||
|
||||
/// @brief Get inner content offset. Used for scroll
|
||||
|
||||
Reference in New Issue
Block a user