blob: 0c8f258d05eb3e9db515cedffa134d09ebb46332 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#include "cru/ui/UiManager.hpp"
#include "Helper.hpp"
#include "cru/platform/graphics/Brush.hpp"
#include "cru/platform/graphics/Factory.hpp"
#include "cru/platform/graphics/Font.hpp"
#include "cru/platform/gui/Cursor.hpp"
#include "cru/platform/gui/UiApplication.hpp"
#include "cru/ui/Base.hpp"
#include "cru/ui/helper/ClickDetector.hpp"
#include "cru/ui/mapper/MapperRegistry.hpp"
#include "cru/ui/render/ScrollBar.hpp"
#include "cru/ui/style/ApplyBorderStyleInfo.hpp"
#include "cru/ui/style/Condition.hpp"
#include "cru/ui/style/Styler.hpp"
#include "cru/xml/XmlNode.hpp"
#include "cru/xml/XmlParser.hpp"
#include <optional>
namespace cru::ui {
using namespace cru::platform::graphics;
using namespace cru::ui::style;
using namespace cru::ui::helper;
UiManager* UiManager::GetInstance() {
static UiManager* instance = new UiManager();
GetUiApplication()->AddOnQuitHandler([] {
delete instance;
instance = nullptr;
});
return instance;
}
UiManager::UiManager() {
const auto factory = GetGraphicsFactory();
theme_resource_.default_font_family = u"";
theme_resource_.default_font =
factory->CreateFont(theme_resource_.default_font_family, 24.0f);
const auto black_brush =
std::shared_ptr<platform::graphics::ISolidColorBrush>(
factory->CreateSolidColorBrush(colors::black));
theme_resource_.text_brush = black_brush;
theme_resource_.text_selection_brush =
factory->CreateSolidColorBrush(colors::skyblue);
theme_resource_.caret_brush = black_brush;
}
UiManager::~UiManager() = default;
} // namespace cru::ui
|