fix focus lockin & sketch3d new gui
This commit is contained in:
parent
aecc75828b
commit
2460c9ce8d
44 changed files with 1015 additions and 322 deletions
18
Widgets/public/widgets/ColorPickerWidget.hpp
Normal file
18
Widgets/public/widgets/ColorPickerWidget.hpp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include "Widget.hpp"
|
||||
|
||||
namespace tp {
|
||||
class RGBPickerWidget : public Widget {
|
||||
public:
|
||||
RGBPickerWidget() = default;
|
||||
|
||||
void process(const EventHandler& events) override;
|
||||
void draw(Canvas& canvas) override;
|
||||
|
||||
[[nodiscard]] bool processesEvents() const override { return true; }
|
||||
|
||||
public:
|
||||
Canvas::ColorWheel mColorWheel;
|
||||
};
|
||||
}
|
||||
|
|
@ -17,6 +17,8 @@ namespace tp {
|
|||
void drawSide(DockLayout::Side side, Canvas& canvas);
|
||||
|
||||
public:
|
||||
DockLayout::Side getSide(Widget* widget) { return layout()->getSideFromWidget(widget); }
|
||||
|
||||
void setCenterWidget(Widget* widget);
|
||||
|
||||
void dockWidget(Widget* widget, DockLayout::Side side);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ namespace tp {
|
|||
[[nodiscard]] bool getDirection() const { return mVertical; }
|
||||
[[nodiscard]] halnf getPosFactor() const { return mPosFactor - mSizeFactor / 2; }
|
||||
|
||||
void setDirection(bool direction) { mVertical = direction; }
|
||||
|
||||
private:
|
||||
[[nodiscard]] const RectF& getHandleRect() const;
|
||||
void updateHandleRect();
|
||||
|
|
@ -53,5 +55,13 @@ namespace tp {
|
|||
class ScrollableWidget : public Widget {
|
||||
public:
|
||||
ScrollableWidget();
|
||||
|
||||
void setDirection(bool direction);
|
||||
|
||||
Widget* getContainer() { return &mContent; }
|
||||
|
||||
private:
|
||||
Widget mContent;
|
||||
ScrollableBarWidget mScroller;
|
||||
};
|
||||
}
|
||||
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue