cecd34301d Delay load DPI-related functions bfc172f702 Added exception to some unimplemented functions 7c8d469bcb Added item modifications functions 847d0e6d9e Improved keyboard navigation 8c4270e0f8 Dropdown can now be closed by re-selecting it 91402c31ec Fix dropdown positioning in x11 and win32 git-subtree-dir: libraries/ZWidget git-subtree-split: cecd34301d369400227eb0f27bad2ab41ad756d2
34 lines
703 B
C++
34 lines
703 B
C++
|
|
#pragma once
|
|
|
|
#include "../../core/widget.h"
|
|
#include "../textlabel/textlabel.h"
|
|
#include "../imagebox/imagebox.h"
|
|
|
|
class ToolbarButton : public Widget
|
|
{
|
|
public:
|
|
ToolbarButton(Widget* parent);
|
|
~ToolbarButton();
|
|
|
|
void SetIcon(std::string icon);
|
|
void SetText(std::string text);
|
|
|
|
void Click();
|
|
|
|
double GetPreferredWidth();
|
|
double GetPreferredHeight();
|
|
|
|
std::function<void()> OnClick;
|
|
|
|
protected:
|
|
void OnMouseMove(const Point& pos) override;
|
|
void OnMouseLeave() override;
|
|
bool OnMouseDown(const Point& pos, InputKey key) override;
|
|
bool OnMouseUp(const Point& pos, InputKey key) override;
|
|
void OnGeometryChanged() override;
|
|
|
|
private:
|
|
ImageBox* image = nullptr;
|
|
TextLabel* label = nullptr;
|
|
};
|