From ac4b0f8d438e7a7c2ecd836af8332b5da1e035c9 Mon Sep 17 00:00:00 2001 From: crupest Date: Fri, 9 Nov 2018 22:59:38 +0800 Subject: Add predefine resource. --- src/ui/controls/text_control.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/ui/controls/text_control.cpp') diff --git a/src/ui/controls/text_control.cpp b/src/ui/controls/text_control.cpp index 5d2c840e..42214583 100644 --- a/src/ui/controls/text_control.cpp +++ b/src/ui/controls/text_control.cpp @@ -1,14 +1,14 @@ #include "text_control.hpp" +#include + #include "ui/window.hpp" #include "graph/graph.hpp" #include "exception.hpp" -#include +#include "ui/predefine.hpp" namespace cru::ui::controls { - using graph::CreateSolidBrush; - inline Microsoft::WRL::ComPtr GetDWriteFactory() { return graph::GraphManager::GetInstance()->GetDWriteFactory(); @@ -17,13 +17,13 @@ namespace cru::ui::controls TextControl::TextControl(const Microsoft::WRL::ComPtr& init_text_format, const Microsoft::WRL::ComPtr& init_brush) : Control(false) { - text_format_ = init_text_format == nullptr ? graph::CreateDefaultTextFormat() : init_text_format; + text_format_ = init_text_format; RecreateTextLayout(); - brush_ = init_brush == nullptr ? CreateSolidBrush(D2D1::ColorF(D2D1::ColorF::Black)) : init_brush; + brush_ = init_brush; - selection_brush_ = CreateSolidBrush(D2D1::ColorF(D2D1::ColorF::LightSkyBlue)); + selection_brush_ = predefine::GetPredefineResourceComPtr(predefine::key_text_control_selection_brush); } -- cgit v1.2.3