aseprite/src/app/ui/font_entry.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

92 lines
1.7 KiB
C
Raw Normal View History

// Aseprite
// Copyright (c) 2024-2025 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
#ifndef APP_UI_FONT_ENTRY_H_INCLUDED
#define APP_UI_FONT_ENTRY_H_INCLUDED
#pragma once
#include "app/fonts/font_info.h"
#include "app/ui/button_set.h"
#include "app/ui/search_entry.h"
#include "ui/box.h"
#include "ui/button.h"
#include "ui/combobox.h"
#include <string>
namespace app {
class FontPopup;
2024-12-17 01:52:19 +08:00
class FontEntry : public ui::HBox {
2024-12-17 01:52:19 +08:00
public:
enum class From {
2024-12-17 01:52:19 +08:00
Init,
Face,
Size,
Style,
Flags,
Popup,
};
FontEntry();
~FontEntry();
FontInfo info() { return m_info; }
void setInfo(const FontInfo& info, From from);
obs::signal<void(const FontInfo&, From)> FontChange;
2024-12-17 01:52:19 +08:00
private:
class FontFace : public SearchEntry {
2024-12-17 01:52:19 +08:00
public:
FontFace();
obs::signal<void(const FontInfo&, From)> FontChange;
protected:
void onInitTheme(ui::InitThemeEvent& ev) override;
bool onProcessMessage(ui::Message* msg) override;
void onChange() override;
os::Surface* onGetCloseIcon() const override;
void onCloseIconPressed() override;
2024-12-17 01:52:19 +08:00
private:
FontEntry* fontEntry() const { return static_cast<FontEntry*>(parent()); }
2024-12-17 01:52:19 +08:00
std::unique_ptr<FontPopup> m_popup;
bool m_fromEntryChange = false;
2024-12-17 01:52:19 +08:00
};
class FontSize : public ui::ComboBox {
2024-12-17 01:52:19 +08:00
public:
FontSize();
protected:
void onEntryChange() override;
};
class FontStyle : public ButtonSet {
2024-12-17 01:52:19 +08:00
public:
FontStyle();
2024-12-17 01:52:19 +08:00
};
class FontLigatures : public ButtonSet {
2024-12-17 01:52:19 +08:00
public:
FontLigatures();
2024-12-17 01:52:19 +08:00
};
FontInfo m_info;
FontFace m_face;
FontSize m_size;
FontStyle m_style;
FontLigatures m_ligatures;
ui::CheckBox m_antialias;
bool m_lockFace = false;
2024-12-17 01:52:19 +08:00
};
} // namespace app
#endif