some refactore

This commit is contained in:
2026-02-05 14:33:19 +01:00
parent ce0643b6ac
commit 64b3babd3d
27 changed files with 239 additions and 141 deletions

View File

@@ -1,18 +0,0 @@
#pragma once
#include <gtkmm/button.h>
#include "gtkmm/image.h"
#include "sigc++/signal.h"
class Button : public Gtk::Button {
public:
Button(const std::string label);
Button(Gtk::Image &image);
sigc::signal<void()> onClickedSignal;
private:
void on_clicked() {
onClickedSignal.emit();
}
};

View File

@@ -0,0 +1,12 @@
#pragma once
#include <string>
#include "components/button/textButton.hpp"
#include "components/types/icon.hpp"
class IconButton : public TextButton {
public:
IconButton(Icon::Type icon, std::string fontFamilyCss = "materia-icons");
void setIcon(Icon::Type icon);
};

View File

@@ -0,0 +1,9 @@
#pragma once
#include "components/button/iconButton.hpp"
class TabButton : public IconButton {
public:
TabButton(Icon::Type icon);
void setActive(bool active);
};

View File

@@ -0,0 +1,13 @@
#pragma once
#include <string>
#include "gtkmm/button.h"
class TextButton : public Gtk::Button {
public:
TextButton(const std::string &label);
void setText(const std::string &text);
};

View File

@@ -3,11 +3,12 @@
#include <gtkmm/button.h>
#include <gtkmm/popover.h>
#include <string>
#include "components/base/button.hpp"
#include "components/button/iconButton.hpp"
#include "components/button/textButton.hpp"
class Popover : public Button {
class Popover : public IconButton {
public:
Popover(const std::string icon, std::string name);
Popover(Icon::Type icon, std::string name);
~Popover() override;
protected:

View File

@@ -0,0 +1,48 @@
#include <fcntl.h>
#include <map>
#include <string>
class Icon {
public:
enum Type {
HOME_ASSISTANT,
CONTROL_CENTER,
SKIP_PREVIOUS,
SKIP_NEXT,
PLAY_ARROW,
PAUSE,
PLAY_CIRCLE,
EMPTY_DASHBOARD,
SAVE,
CONTENT_COPY,
};
static const std::string toString(Type type) {
return typeToString[type];
}
private:
static inline std::map<Type, const std::string> typeToString = {
{HOME_ASSISTANT, "\uf024"},
{CONTROL_CENTER, "\ue062"},
{SKIP_PREVIOUS, "\ue045"},
{SKIP_NEXT, "\ue044"},
{PLAY_ARROW, "\ue037"},
{PAUSE, "\ue034"},
{PLAY_CIRCLE, "\ue1c4"},
{EMPTY_DASHBOARD, "\uf844"},
{SAVE, "\ue161"},
{CONTENT_COPY, "\ue14d"},
};
};