mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 23:11:49 +00:00
cleanup element classes
This commit is contained in:
parent
660bd0a5d3
commit
8c5a549773
11 changed files with 141 additions and 141 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
#include "Panel.hpp"
|
#include "Panel.hpp"
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
class CheckBox : public UINode {
|
class CheckBox final : public UINode {
|
||||||
protected:
|
protected:
|
||||||
glm::vec4 checkColor {1.0f, 1.0f, 1.0f, 0.4f};
|
glm::vec4 checkColor {1.0f, 1.0f, 1.0f, 0.4f};
|
||||||
boolsupplier supplier = nullptr;
|
boolsupplier supplier = nullptr;
|
||||||
|
|
@ -15,23 +15,22 @@ namespace gui {
|
||||||
public:
|
public:
|
||||||
explicit CheckBox(GUI& gui, bool checked = false);
|
explicit CheckBox(GUI& gui, bool checked = false);
|
||||||
|
|
||||||
virtual void draw(const DrawContext& pctx, const Assets& assets)
|
void draw(const DrawContext& pctx, const Assets& assets) override;
|
||||||
override;
|
|
||||||
|
|
||||||
virtual void mouseRelease(int x, int y) override;
|
void mouseRelease(int x, int y) override;
|
||||||
|
|
||||||
virtual void setSupplier(boolsupplier supplier);
|
void setSupplier(boolsupplier supplier);
|
||||||
virtual void setConsumer(boolconsumer consumer);
|
void setConsumer(boolconsumer consumer);
|
||||||
|
|
||||||
virtual CheckBox* setChecked(bool flag);
|
CheckBox* setChecked(bool flag);
|
||||||
|
|
||||||
virtual bool isChecked() const {
|
bool isChecked() const {
|
||||||
if (supplier) return supplier();
|
if (supplier) return supplier();
|
||||||
return checked;
|
return checked;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class FullCheckBox : public Panel {
|
class FullCheckBox final : public Panel {
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<CheckBox> checkbox;
|
std::shared_ptr<CheckBox> checkbox;
|
||||||
std::shared_ptr<Label> label;
|
std::shared_ptr<Label> label;
|
||||||
|
|
@ -43,28 +42,28 @@ namespace gui {
|
||||||
bool checked = false
|
bool checked = false
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual void setSupplier(boolsupplier supplier) {
|
void setSupplier(boolsupplier supplier) {
|
||||||
checkbox->setSupplier(std::move(supplier));
|
checkbox->setSupplier(std::move(supplier));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setConsumer(boolconsumer consumer) {
|
void setConsumer(boolconsumer consumer) {
|
||||||
checkbox->setConsumer(std::move(consumer));
|
checkbox->setConsumer(std::move(consumer));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setChecked(bool flag) {
|
void setChecked(bool flag) {
|
||||||
checkbox->setChecked(flag);
|
checkbox->setChecked(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool isChecked() const {
|
bool isChecked() const {
|
||||||
return checkbox->isChecked();
|
return checkbox->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setTooltip(const std::wstring& text) override {
|
void setTooltip(const std::wstring& text) override {
|
||||||
Panel::setTooltip(text);
|
Panel::setTooltip(text);
|
||||||
checkbox->setTooltip(text);
|
checkbox->setTooltip(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void setSize(const glm::vec2& new_size) override {
|
void setSize(const glm::vec2& new_size) override {
|
||||||
Panel::setSize(new_size);
|
Panel::setSize(new_size);
|
||||||
checkbox->setSize(glm::vec2(size.y, size.y));
|
checkbox->setSize(glm::vec2(size.y, size.y));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ namespace gui {
|
||||||
class Frame final : public Container {
|
class Frame final : public Container {
|
||||||
public:
|
public:
|
||||||
Frame(GUI& gui, std::string id, std::string outputTexture);
|
Frame(GUI& gui, std::string id, std::string outputTexture);
|
||||||
virtual ~Frame();
|
~Frame();
|
||||||
|
|
||||||
void draw(const DrawContext& pctx, const Assets& assets) override;
|
void draw(const DrawContext& pctx, const Assets& assets) override;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ namespace gui {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
class SlotView : public gui::UINode {
|
class SlotView final : public gui::UINode {
|
||||||
struct {
|
struct {
|
||||||
ItemStack stack {};
|
ItemStack stack {};
|
||||||
std::wstring countStr;
|
std::wstring countStr;
|
||||||
|
|
@ -89,14 +89,14 @@ namespace gui {
|
||||||
public:
|
public:
|
||||||
SlotView(GUI& gui, SlotLayout layout);
|
SlotView(GUI& gui, SlotLayout layout);
|
||||||
|
|
||||||
virtual void draw(const DrawContext& pctx, const Assets& assets) override;
|
void draw(const DrawContext& pctx, const Assets& assets) override;
|
||||||
|
|
||||||
void setHighlighted(bool flag);
|
void setHighlighted(bool flag);
|
||||||
bool isHighlighted() const;
|
bool isHighlighted() const;
|
||||||
|
|
||||||
virtual void clicked(Mousecode) override;
|
void clicked(Mousecode) override;
|
||||||
virtual void onFocus() override;
|
void onFocus() override;
|
||||||
virtual const std::wstring& getTooltip() const override;
|
const std::wstring& getTooltip() const override;
|
||||||
|
|
||||||
void bind(
|
void bind(
|
||||||
int64_t inventoryid,
|
int64_t inventoryid,
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ namespace gui {
|
||||||
uint getLineByTextIndex(size_t index) const;
|
uint getLineByTextIndex(size_t index) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Label : public UINode {
|
class Label final : public UINode {
|
||||||
LabelCache cache;
|
LabelCache cache;
|
||||||
|
|
||||||
glm::vec2 calcSize();
|
glm::vec2 calcSize();
|
||||||
|
|
@ -69,64 +69,64 @@ namespace gui {
|
||||||
Label(GUI& gui, const std::string& text, std::string fontName="normal");
|
Label(GUI& gui, const std::string& text, std::string fontName="normal");
|
||||||
Label(GUI& gui, const std::wstring& text, std::string fontName="normal");
|
Label(GUI& gui, const std::wstring& text, std::string fontName="normal");
|
||||||
|
|
||||||
virtual ~Label();
|
~Label();
|
||||||
|
|
||||||
virtual void setText(std::wstring text);
|
void setText(std::wstring text);
|
||||||
const std::wstring& getText() const;
|
const std::wstring& getText() const;
|
||||||
|
|
||||||
virtual void setFontName(std::string name);
|
void setFontName(std::string name);
|
||||||
virtual const std::string& getFontName() const;
|
const std::string& getFontName() const;
|
||||||
|
|
||||||
/// @brief Set text vertical alignment (default value: center)
|
/// @brief Set text vertical alignment (default value: center)
|
||||||
/// @param align Align::top / Align::center / Align::bottom
|
/// @param align Align::top / Align::center / Align::bottom
|
||||||
virtual void setVerticalAlign(Align align);
|
void setVerticalAlign(Align align);
|
||||||
virtual Align getVerticalAlign() const;
|
Align getVerticalAlign() const;
|
||||||
|
|
||||||
/// @brief Get line height multiplier used for multiline labels
|
/// @brief Get line height multiplier used for multiline labels
|
||||||
/// (default value: 1.5)
|
/// (default value: 1.5)
|
||||||
virtual float getLineInterval() const;
|
float getLineInterval() const;
|
||||||
|
|
||||||
/// @brief Set line height multiplier used for multiline labels
|
/// @brief Set line height multiplier used for multiline labels
|
||||||
virtual void setLineInterval(float interval);
|
void setLineInterval(float interval);
|
||||||
|
|
||||||
/// @brief Get Y position of the text relative to label position
|
/// @brief Get Y position of the text relative to label position
|
||||||
/// @return Y offset
|
/// @return Y offset
|
||||||
virtual int getTextYOffset() const;
|
int getTextYOffset() const;
|
||||||
|
|
||||||
/// @brief Get Y position of the line relative to label position
|
/// @brief Get Y position of the line relative to label position
|
||||||
/// @param line target line index
|
/// @param line target line index
|
||||||
/// @return Y offset
|
/// @return Y offset
|
||||||
virtual int getLineYOffset(uint line) const;
|
int getLineYOffset(uint line) const;
|
||||||
|
|
||||||
/// @brief Get position of line start in the text
|
/// @brief Get position of line start in the text
|
||||||
/// @param line target line index
|
/// @param line target line index
|
||||||
/// @return position in the text [0..length]
|
/// @return position in the text [0..length]
|
||||||
virtual size_t getTextLineOffset(size_t line) const;
|
size_t getTextLineOffset(size_t line) const;
|
||||||
|
|
||||||
/// @brief Get line index by its Y offset relative to label position
|
/// @brief Get line index by its Y offset relative to label position
|
||||||
/// @param offset target Y offset
|
/// @param offset target Y offset
|
||||||
/// @return line index [0..+]
|
/// @return line index [0..+]
|
||||||
virtual uint getLineByYOffset(int offset) const;
|
uint getLineByYOffset(int offset) const;
|
||||||
virtual uint getLineByTextIndex(size_t index) const;
|
uint getLineByTextIndex(size_t index) const;
|
||||||
virtual uint getLinesNumber() const;
|
uint getLinesNumber() const;
|
||||||
virtual bool isFakeLine(size_t line) const;
|
bool isFakeLine(size_t line) const;
|
||||||
|
|
||||||
virtual void draw(const DrawContext& pctx, const Assets& assets) override;
|
void draw(const DrawContext& pctx, const Assets& assets) override;
|
||||||
|
|
||||||
virtual void textSupplier(wstringsupplier supplier);
|
void textSupplier(wstringsupplier supplier);
|
||||||
|
|
||||||
virtual void setAutoResize(bool flag);
|
void setAutoResize(bool flag);
|
||||||
virtual bool isAutoResize() const;
|
bool isAutoResize() const;
|
||||||
|
|
||||||
virtual void setMultiline(bool multiline);
|
void setMultiline(bool multiline);
|
||||||
virtual bool isMultiline() const;
|
bool isMultiline() const;
|
||||||
|
|
||||||
virtual void setTextWrapping(bool flag);
|
void setTextWrapping(bool flag);
|
||||||
virtual bool isTextWrapping() const;
|
bool isTextWrapping() const;
|
||||||
|
|
||||||
virtual void setMarkup(std::string_view lang);
|
void setMarkup(std::string_view lang);
|
||||||
virtual const std::string& getMarkup() const;
|
const std::string& getMarkup() const;
|
||||||
|
|
||||||
virtual void setStyles(std::unique_ptr<FontStylesScheme> styles);
|
void setStyles(std::unique_ptr<FontStylesScheme> styles);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ namespace gui {
|
||||||
|
|
||||||
using PageLoaderFunc = std::function<std::shared_ptr<UINode>(const std::string&)>;
|
using PageLoaderFunc = std::function<std::shared_ptr<UINode>(const std::string&)>;
|
||||||
|
|
||||||
class Menu : public Container {
|
class Menu final : public Container {
|
||||||
protected:
|
protected:
|
||||||
std::unordered_map<std::string, Page> pages;
|
std::unordered_map<std::string, Page> pages;
|
||||||
std::stack<Page> pageStack;
|
std::stack<Page> pageStack;
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "Container.hpp"
|
||||||
|
#include "window/Camera.hpp"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "Container.hpp"
|
|
||||||
#include "window/Camera.hpp"
|
|
||||||
|
|
||||||
class Batch3D;
|
class Batch3D;
|
||||||
class Framebuffer;
|
class Framebuffer;
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
class ModelViewer : public Container {
|
class ModelViewer final : public Container {
|
||||||
private:
|
private:
|
||||||
std::string modelName;
|
std::string modelName;
|
||||||
Camera camera;
|
Camera camera;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ class Assets;
|
||||||
class DrawContext;
|
class DrawContext;
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
class Plotter : public UINode {
|
class Plotter final : public UINode {
|
||||||
std::unique_ptr<int[]> points;
|
std::unique_ptr<int[]> points;
|
||||||
float multiplier;
|
float multiplier;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
|
||||||
|
|
@ -1133,10 +1133,10 @@ void TextBox::setOnControlCombination(key_handler handler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextBox::setFocusedColor(glm::vec4 color) {
|
void TextBox::setFocusedColor(glm::vec4 color) {
|
||||||
this->focusedColor = color;
|
this->focusedColor = std::move(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec4 TextBox::getFocusedColor() const {
|
const glm::vec4& TextBox::getFocusedColor() const {
|
||||||
return focusedColor;
|
return focusedColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1144,7 +1144,7 @@ void TextBox::setTextColor(glm::vec4 color) {
|
||||||
this->textColor = color;
|
this->textColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec4 TextBox::getTextColor() const {
|
const glm::vec4& TextBox::getTextColor() const {
|
||||||
return textColor;
|
return textColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1248,7 +1248,7 @@ void TextBox::setPadding(glm::vec4 padding) {
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec4 TextBox::getPadding() const {
|
const glm::vec4& TextBox::getPadding() const {
|
||||||
return padding;
|
return padding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ class ActionsHistory;
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
class TextBoxHistorian;
|
class TextBoxHistorian;
|
||||||
class TextBox : public Container {
|
class TextBox final : public Container {
|
||||||
const Input& inputEvents;
|
const Input& inputEvents;
|
||||||
LabelCache rawTextCache;
|
LabelCache rawTextCache;
|
||||||
std::shared_ptr<ActionsHistory> history;
|
std::shared_ptr<ActionsHistory> history;
|
||||||
|
|
@ -100,124 +100,124 @@ namespace gui {
|
||||||
glm::vec4 padding=glm::vec4(4.0f)
|
glm::vec4 padding=glm::vec4(4.0f)
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual ~TextBox();
|
~TextBox();
|
||||||
|
|
||||||
void paste(const std::wstring& text, bool history=true);
|
void paste(const std::wstring& text, bool history=true);
|
||||||
void erase(size_t start, size_t length);
|
void erase(size_t start, size_t length);
|
||||||
void resetSelection();
|
void resetSelection();
|
||||||
|
|
||||||
virtual void setTextSupplier(wstringsupplier supplier);
|
void setTextSupplier(wstringsupplier supplier);
|
||||||
|
|
||||||
/// @brief Consumer called on stop editing text (textbox defocus)
|
/// @brief Consumer called on stop editing text (textbox defocus)
|
||||||
/// @param consumer std::wstring consumer function
|
/// @param consumer std::wstring consumer function
|
||||||
virtual void setTextConsumer(wstringconsumer consumer);
|
void setTextConsumer(wstringconsumer consumer);
|
||||||
|
|
||||||
/// @brief Sub-consumer called while editing text
|
/// @brief Sub-consumer called while editing text
|
||||||
/// @param consumer std::wstring consumer function
|
/// @param consumer std::wstring consumer function
|
||||||
virtual void setTextSubConsumer(wstringconsumer consumer);
|
void setTextSubConsumer(wstringconsumer consumer);
|
||||||
|
|
||||||
/// @brief Text validator called while text editing and returns true if
|
/// @brief Text validator called while text editing and returns true if
|
||||||
/// text is valid
|
/// text is valid
|
||||||
/// @param validator std::wstring consumer returning boolean
|
/// @param validator std::wstring consumer returning boolean
|
||||||
virtual void setTextValidator(wstringchecker validator);
|
void setTextValidator(wstringchecker validator);
|
||||||
|
|
||||||
virtual void setOnControlCombination(key_handler handler);
|
void setOnControlCombination(key_handler handler);
|
||||||
|
|
||||||
virtual void setFocusedColor(glm::vec4 color);
|
void setFocusedColor(glm::vec4 color);
|
||||||
virtual glm::vec4 getFocusedColor() const;
|
const glm::vec4& getFocusedColor() const;
|
||||||
|
|
||||||
virtual void setTextColor(glm::vec4 color);
|
void setTextColor(glm::vec4 color);
|
||||||
virtual glm::vec4 getTextColor() const;
|
const glm::vec4& getTextColor() const;
|
||||||
|
|
||||||
/// @brief Set color of textbox marked by validator as invalid
|
/// @brief Set color of textbox marked by validator as invalid
|
||||||
virtual void setErrorColor(glm::vec4 color);
|
void setErrorColor(glm::vec4 color);
|
||||||
|
|
||||||
/// @brief Get color of textbox marked by validator as invalid
|
/// @brief Get color of textbox marked by validator as invalid
|
||||||
virtual glm::vec4 getErrorColor() const;
|
glm::vec4 getErrorColor() const;
|
||||||
|
|
||||||
/// @brief Get TextBox content text or placeholder if empty
|
/// @brief Get TextBox content text or placeholder if empty
|
||||||
virtual const std::wstring& getText() const;
|
const std::wstring& getText() const;
|
||||||
|
|
||||||
/// @brief Set TextBox content text
|
/// @brief Set TextBox content text
|
||||||
virtual void setText(const std::wstring &value);
|
void setText(const std::wstring &value);
|
||||||
|
|
||||||
/// @brief Get text placeholder
|
/// @brief Get text placeholder
|
||||||
virtual const std::wstring& getPlaceholder() const;
|
const std::wstring& getPlaceholder() const;
|
||||||
|
|
||||||
/// @brief Set text placeholder
|
/// @brief Set text placeholder
|
||||||
/// @param text will be used instead of empty
|
/// @param text will be used instead of empty
|
||||||
virtual void setPlaceholder(const std::wstring& text);
|
void setPlaceholder(const std::wstring& text);
|
||||||
|
|
||||||
/// @brief Get textbox hint
|
/// @brief Get textbox hint
|
||||||
virtual const std::wstring& getHint() const;
|
const std::wstring& getHint() const;
|
||||||
|
|
||||||
/// @brief Set textbox hint
|
/// @brief Set textbox hint
|
||||||
/// @param text will be shown instead of empty
|
/// @param text will be shown instead of empty
|
||||||
virtual void setHint(const std::wstring& text);
|
void setHint(const std::wstring& text);
|
||||||
|
|
||||||
/// @brief Get selected text
|
/// @brief Get selected text
|
||||||
virtual std::wstring getSelection() const;
|
std::wstring getSelection() const;
|
||||||
|
|
||||||
/// @brief Get current caret position in text
|
/// @brief Get current caret position in text
|
||||||
/// @return integer in range [0, text.length()]
|
/// @return integer in range [0, text.length()]
|
||||||
virtual size_t getCaret() const;
|
size_t getCaret() const;
|
||||||
|
|
||||||
/// @brief Set caret position in the text
|
/// @brief Set caret position in the text
|
||||||
/// @param position integer in range [0, text.length()]
|
/// @param position integer in range [0, text.length()]
|
||||||
virtual void setCaret(size_t position);
|
void setCaret(size_t position);
|
||||||
|
|
||||||
/// @brief Set caret position in the text
|
/// @brief Set caret position in the text
|
||||||
/// @param position integer in range [-text.length(), text.length()]
|
/// @param position integer in range [-text.length(), text.length()]
|
||||||
virtual void setCaret(ptrdiff_t position);
|
void setCaret(ptrdiff_t position);
|
||||||
|
|
||||||
/// @brief Select part of the text
|
/// @brief Select part of the text
|
||||||
/// @param start index of the first selected character
|
/// @param start index of the first selected character
|
||||||
/// @param end index of the last selected character + 1
|
/// @param end index of the last selected character + 1
|
||||||
virtual void select(int start, int end);
|
void select(int start, int end);
|
||||||
|
|
||||||
/// @brief Get number of line at specific position in text
|
/// @brief Get number of line at specific position in text
|
||||||
/// @param position target position
|
/// @param position target position
|
||||||
/// @return line number
|
/// @return line number
|
||||||
virtual uint getLineAt(size_t position) const;
|
uint getLineAt(size_t position) const;
|
||||||
|
|
||||||
/// @brief Get specific line text position
|
/// @brief Get specific line text position
|
||||||
/// @param line target line
|
/// @param line target line
|
||||||
/// @return line position in text
|
/// @return line position in text
|
||||||
virtual size_t getLinePos(uint line) const;
|
size_t getLinePos(uint line) const;
|
||||||
|
|
||||||
int calcIndexAt(int x, int y) const;
|
int calcIndexAt(int x, int y) const;
|
||||||
int getLineYOffset(int line) const;
|
int getLineYOffset(int line) const;
|
||||||
|
|
||||||
/// @brief Check text with validator set with setTextValidator
|
/// @brief Check text with validator set with setTextValidator
|
||||||
/// @return true if text is valid
|
/// @return true if text is valid
|
||||||
virtual bool validate();
|
bool validate();
|
||||||
|
|
||||||
virtual void setValid(bool valid);
|
void setValid(bool valid);
|
||||||
virtual bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
/// @brief Enable/disable multiline mode
|
/// @brief Enable/disable multiline mode
|
||||||
virtual void setMultiline(bool multiline);
|
void setMultiline(bool multiline);
|
||||||
|
|
||||||
/// @brief Check if multiline mode is enabled
|
/// @brief Check if multiline mode is enabled
|
||||||
virtual bool isMultiline() const;
|
bool isMultiline() const;
|
||||||
|
|
||||||
/// @brief Enable/disable text wrapping
|
/// @brief Enable/disable text wrapping
|
||||||
virtual void setTextWrapping(bool flag);
|
void setTextWrapping(bool flag);
|
||||||
|
|
||||||
/// @brief Check if text wrapping is enabled
|
/// @brief Check if text wrapping is enabled
|
||||||
virtual bool isTextWrapping() const;
|
bool isTextWrapping() const;
|
||||||
|
|
||||||
/// @brief Enable/disable text editing feature
|
/// @brief Enable/disable text editing feature
|
||||||
virtual void setEditable(bool editable);
|
void setEditable(bool editable);
|
||||||
|
|
||||||
/// @brief Check if text editing feature is enabled
|
/// @brief Check if text editing feature is enabled
|
||||||
virtual bool isEditable() const;
|
bool isEditable() const;
|
||||||
|
|
||||||
virtual bool isEdited() const;
|
bool isEdited() const;
|
||||||
virtual void setUnedited();
|
void setUnedited();
|
||||||
|
|
||||||
virtual void setPadding(glm::vec4 padding);
|
void setPadding(glm::vec4 padding);
|
||||||
glm::vec4 getPadding() const;
|
const glm::vec4& getPadding() const;
|
||||||
|
|
||||||
size_t getSelectionStart() const;
|
size_t getSelectionStart() const;
|
||||||
size_t getSelectionEnd() const;
|
size_t getSelectionEnd() const;
|
||||||
|
|
@ -226,34 +226,34 @@ namespace gui {
|
||||||
bool isKeepLineSelection() const;
|
bool isKeepLineSelection() const;
|
||||||
|
|
||||||
/// @brief Set runnable called on textbox focus
|
/// @brief Set runnable called on textbox focus
|
||||||
virtual void setOnEditStart(runnable oneditstart);
|
void setOnEditStart(runnable oneditstart);
|
||||||
|
|
||||||
virtual void setAutoResize(bool flag);
|
void setAutoResize(bool flag);
|
||||||
virtual bool isAutoResize() const;
|
bool isAutoResize() const;
|
||||||
|
|
||||||
virtual void setShowLineNumbers(bool flag);
|
void setShowLineNumbers(bool flag);
|
||||||
virtual bool isShowLineNumbers() const;
|
bool isShowLineNumbers() const;
|
||||||
|
|
||||||
virtual void reposition() override;
|
void reposition() override;
|
||||||
virtual void onFocus() override;
|
void onFocus() override;
|
||||||
virtual void refresh() override;
|
void refresh() override;
|
||||||
virtual void doubleClick(int x, int y) override;
|
void doubleClick(int x, int y) override;
|
||||||
virtual void click(int, int) override;
|
void click(int, int) override;
|
||||||
virtual void mouseMove(int x, int y) override;
|
void mouseMove(int x, int y) override;
|
||||||
virtual bool isFocuskeeper() const override {return true;}
|
bool isFocuskeeper() const override {return true;}
|
||||||
virtual void draw(const DrawContext& pctx, const Assets& assets) override;
|
void draw(const DrawContext& pctx, const Assets& assets) override;
|
||||||
virtual void drawBackground(const DrawContext& pctx, const Assets& assets) override;
|
void drawBackground(const DrawContext& pctx, const Assets& assets) override;
|
||||||
virtual void typed(unsigned int codepoint) override;
|
void typed(unsigned int codepoint) override;
|
||||||
virtual void keyPressed(Keycode key) override;
|
void keyPressed(Keycode key) override;
|
||||||
virtual std::shared_ptr<UINode> getAt(const glm::vec2& pos) override;
|
std::shared_ptr<UINode> getAt(const glm::vec2& pos) override;
|
||||||
virtual void setOnUpPressed(const runnable &callback);
|
void setOnUpPressed(const runnable& callback);
|
||||||
virtual void setOnDownPressed(const runnable &callback);
|
void setOnDownPressed(const runnable& callback);
|
||||||
|
|
||||||
virtual void setSyntax(std::string_view lang);
|
void setSyntax(std::string_view lang);
|
||||||
virtual const std::string& getSyntax() const;
|
const std::string& getSyntax() const;
|
||||||
|
|
||||||
virtual void setMarkup(std::string_view lang);
|
void setMarkup(std::string_view lang);
|
||||||
virtual const std::string& getMarkup() const;
|
const std::string& getMarkup() const;
|
||||||
|
|
||||||
std::shared_ptr<Label> getLabel() const;
|
std::shared_ptr<Label> getLabel() const;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ int TrackBar::getTrackWidth() const {
|
||||||
return trackWidth;
|
return trackWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec4 TrackBar::getTrackColor() const {
|
const glm::vec4& TrackBar::getTrackColor() const {
|
||||||
return trackColor;
|
return trackColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include "UINode.hpp"
|
#include "UINode.hpp"
|
||||||
|
|
||||||
namespace gui {
|
namespace gui {
|
||||||
class TrackBar : public UINode {
|
class TrackBar final : public UINode {
|
||||||
protected:
|
protected:
|
||||||
glm::vec4 trackColor {1.0f, 1.0f, 1.0f, 0.4f};
|
glm::vec4 trackColor {1.0f, 1.0f, 1.0f, 0.4f};
|
||||||
doublesupplier supplier = nullptr;
|
doublesupplier supplier = nullptr;
|
||||||
|
|
@ -24,29 +24,29 @@ namespace gui {
|
||||||
double step = 1.0,
|
double step = 1.0,
|
||||||
int trackWidth = 12
|
int trackWidth = 12
|
||||||
);
|
);
|
||||||
virtual void draw(const DrawContext& pctx, const Assets& assets) override;
|
void draw(const DrawContext& pctx, const Assets& assets) override;
|
||||||
|
|
||||||
virtual void setSupplier(doublesupplier);
|
void setSupplier(doublesupplier);
|
||||||
virtual void setConsumer(doubleconsumer);
|
void setConsumer(doubleconsumer);
|
||||||
virtual void setSubConsumer(doubleconsumer);
|
void setSubConsumer(doubleconsumer);
|
||||||
|
|
||||||
virtual void mouseMove(int x, int y) override;
|
void mouseMove(int x, int y) override;
|
||||||
virtual void mouseRelease(int x, int y) override;
|
void mouseRelease(int x, int y) override;
|
||||||
|
|
||||||
virtual double getValue() const;
|
double getValue() const;
|
||||||
virtual double getMin() const;
|
double getMin() const;
|
||||||
virtual double getMax() const;
|
double getMax() const;
|
||||||
virtual double getStep() const;
|
double getStep() const;
|
||||||
virtual int getTrackWidth() const;
|
int getTrackWidth() const;
|
||||||
virtual glm::vec4 getTrackColor() const;
|
const glm::vec4& getTrackColor() const;
|
||||||
virtual bool isChangeOnRelease() const;
|
bool isChangeOnRelease() const;
|
||||||
|
|
||||||
virtual void setValue(double);
|
void setValue(double);
|
||||||
virtual void setMin(double);
|
void setMin(double);
|
||||||
virtual void setMax(double);
|
void setMax(double);
|
||||||
virtual void setStep(double);
|
void setStep(double);
|
||||||
virtual void setTrackWidth(int);
|
void setTrackWidth(int);
|
||||||
virtual void setTrackColor(glm::vec4);
|
void setTrackColor(glm::vec4);
|
||||||
virtual void setChangeOnRelease(bool);
|
void setChangeOnRelease(bool);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue