Simple GUI Library
button.h
Go to the documentation of this file.
1/**
2 * @author Nikita Mochalov (github.com/tralf-strues)
3 * @file button.h
4 * @date 2021-11-08
5 *
6 * @copyright Copyright (c) 2021
7 */
8
9#pragma once
10
11#include "control.h"
12#include "../style/default_skins.h"
13
14namespace Sgl
15{
16 class Button : public Control
17 {
18 public:
19 Button();
20 Button(const char* label);
21 Button(const Image* icon);
23 Button(BaseSkin<Button>* skin, const char* label);
24 Button(BaseSkin<Button>* skin, const Image* icon);
25
26 const char* getLabel() const;
27 void setLabel(const char* label);
28
29 const Image* getIcon() const;
30 void setIcon(const Image* icon);
31
32 void setOnAction(ActionListener<Button>* listener);
33 ActionListener<Button>* getOnAction(); // TODO: get rid of
34
35 private:
36 const char* m_Label = nullptr;
37 const Image* m_Icon = nullptr;
38
39 ActionListener<Button>* m_ActionListener = nullptr;
40 };
41}