Clean project structure.
This commit is contained in:
parent
78a4fa99ff
commit
947bf937fd
496 changed files with 206 additions and 137 deletions
|
@ -1,46 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "Widget.h"
|
||||
#include "Color.h"
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
class PaintEvent;
|
||||
class MouseEvent;
|
||||
class TextNode;
|
||||
|
||||
class Button : public Widget
|
||||
{
|
||||
public:
|
||||
using clickFunc = std::function<void(Widget* self)>;
|
||||
|
||||
Button();
|
||||
|
||||
~Button();
|
||||
|
||||
static std::unique_ptr<Button> Create();
|
||||
|
||||
void setLabel(const std::string& text);
|
||||
|
||||
void setOnClickFunction(clickFunc func);
|
||||
|
||||
protected:
|
||||
void onMyMouseEvent(const MouseEvent* event) override;
|
||||
|
||||
bool isDirty() const override;
|
||||
void doPaint(const PaintEvent* event) override;
|
||||
|
||||
void updateLabel(const PaintEvent* event);
|
||||
|
||||
private:
|
||||
std::string mLabel;
|
||||
clickFunc mClickFunc;
|
||||
Color mCachedColor;
|
||||
Color mClickedColor;
|
||||
|
||||
std::unique_ptr<TextNode> mTextNode;
|
||||
bool mContentDirty{true};
|
||||
};
|
||||
|
||||
using ButtonUPtr = std::unique_ptr<Button>;
|
Loading…
Add table
Add a link
Reference in a new issue