Widgets Additions and sketch3d new gui

This commit is contained in:
IlyaShurupov 2024-10-20 12:01:42 +03:00
parent aecc75828b
commit 762268387e
44 changed files with 1015 additions and 322 deletions

View file

@ -71,7 +71,7 @@ namespace tp {
void draw(Canvas& canvas) override;
[[nodiscard]] bool processesEvents() const override { return true; }
[[nodiscard]] bool needsNextFrame() const override { return mState != SLIDING; }
[[nodiscard]] bool needsNextFrame() const override { return mState != IDLE; }
[[nodiscard]] halnf val() const { return mFactor; }
@ -86,9 +86,55 @@ namespace tp {
halnf mHandleSize = 20;
halnf mRounding = 5;
RGBA mColorActive = { 0.5f, 0.5f, 0.5f, 1.f };
RGBA mColorHovered = { 0.3f, 0.3f, 0.3f, 1.f };
RGBA mColorIdle = { 0.2f, 0.2f, 0.2f, 1.f };
RGBA mColorBG = { 0.08f, 0.08f, 0.08f, 1.0f };
RGBA mColorActive = { 0.99f, 0.99f, 0.99f, 1.f };
RGBA mColorHovered = { 0.9f, 0.9f, 0.9f, 1.f };
RGBA mColorIdle = { 0.8f, 0.8f, 0.8f, 1.f };
RGBA mColorBG = { 0.3f, 0.3f, 0.3f, 1.0f };
};
class PopupWidget : public Widget {
public:
PopupWidget() = default;
public:
void process(const EventHandler& events) override;
void draw(Canvas& canvas) override;
void open(Widget* parent, const RectF& at);
[[nodiscard]] bool processesEvents() const override { return true; }
private:
RectF mParentArea {};
RGBA col = RGBA(0.03f, 0.03f, 0.03f, 0.9f);
halnf rounding = 5;
halnf borders = 2;
};
class HoverPopupTriggerWidget : public LabelWidget {
public:
enum ExpandDirection {
Right,
Bottom,
};
public:
HoverPopupTriggerWidget() = default;
[[nodiscard]] bool processesEvents() const override { return true; }
void mouseEnter() override;
void draw(Canvas& canvas) override;
PopupWidget* getPopup();
void setDirection(ExpandDirection dir) { mDirection = dir; }
private:
PopupWidget mPopup;
private:
ExpandDirection mDirection = Bottom;
RGBA col = RGBA(0.03f, 0.03f, 0.03f, 0.07f);
halnf rounding = 5;
halnf gap = 7;
};
}