aboutsummaryrefslogtreecommitdiff
path: root/src/ui/controls/text_control.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-11-09 22:59:38 +0800
committercrupest <crupest@outlook.com>2018-11-09 22:59:38 +0800
commitac4b0f8d438e7a7c2ecd836af8332b5da1e035c9 (patch)
treee5b886f1884fa56dd90059523b1f4dc730bb5003 /src/ui/controls/text_control.cpp
parent4b219b569c16db6027dd36e4656152f261321c60 (diff)
downloadcru-ac4b0f8d438e7a7c2ecd836af8332b5da1e035c9.tar.gz
cru-ac4b0f8d438e7a7c2ecd836af8332b5da1e035c9.tar.bz2
cru-ac4b0f8d438e7a7c2ecd836af8332b5da1e035c9.zip
Add predefine resource.
Diffstat (limited to 'src/ui/controls/text_control.cpp')
-rw-r--r--src/ui/controls/text_control.cpp12
1 files changed, 6 insertions, 6 deletions
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 <cassert>
+
#include "ui/window.hpp"
#include "graph/graph.hpp"
#include "exception.hpp"
-#include <cassert>
+#include "ui/predefine.hpp"
namespace cru::ui::controls
{
- using graph::CreateSolidBrush;
-
inline Microsoft::WRL::ComPtr<IDWriteFactory> GetDWriteFactory()
{
return graph::GraphManager::GetInstance()->GetDWriteFactory();
@@ -17,13 +17,13 @@ namespace cru::ui::controls
TextControl::TextControl(const Microsoft::WRL::ComPtr<IDWriteTextFormat>& init_text_format,
const Microsoft::WRL::ComPtr<ID2D1Brush>& 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<ID2D1Brush>(predefine::key_text_control_selection_brush);
}