diff options
Diffstat (limited to 'src/theme_builder/components/stylers/CursorStylerEditor.cpp')
-rw-r--r-- | src/theme_builder/components/stylers/CursorStylerEditor.cpp | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/src/theme_builder/components/stylers/CursorStylerEditor.cpp b/src/theme_builder/components/stylers/CursorStylerEditor.cpp deleted file mode 100644 index 9984d81a..00000000 --- a/src/theme_builder/components/stylers/CursorStylerEditor.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "CursorStylerEditor.h" -#include "cru/platform/gui/Cursor.h" -#include "cru/platform/gui/UiApplication.h" - -namespace cru::theme_builder::components::stylers { -CursorStylerEditor::CursorStylerEditor() { - SetLabel(u"Cursor Styler"); - GetContainer()->AddChild(cursor_select_.GetRootControl()); - - cursor_select_.SetLabel(u"Cursor"); - cursor_select_.SetItems({u"arrow", u"hand", u"ibeam"}); - cursor_select_.SetSelectedIndex(0); - - ConnectChangeEvent(cursor_select_); -} - -CursorStylerEditor::~CursorStylerEditor() {} - -ClonablePtr<ui::style::CursorStyler> CursorStylerEditor::GetValue() { - auto cursor_manager = - platform::gui::IUiApplication::GetInstance()->GetCursorManager(); - - std::shared_ptr<platform::gui::ICursor> cursor; - - switch (cursor_select_.GetSelectedIndex()) { - case 0: - cursor = cursor_manager->GetSystemCursor( - platform::gui::SystemCursorType::Arrow); - break; - case 1: - cursor = cursor_manager->GetSystemCursor( - platform::gui::SystemCursorType::Hand); - break; - case 2: - cursor = cursor_manager->GetSystemCursor( - platform::gui::SystemCursorType::IBeam); - break; - } - - return ui::style::CursorStyler::Create(cursor); -} - -void CursorStylerEditor::SetValue(ui::style::CursorStyler* styler, - bool trigger_change) { - auto cursor_manager = - platform::gui::IUiApplication::GetInstance()->GetCursorManager(); - - auto cursor = styler->GetCursor(); - - if (cursor == - cursor_manager->GetSystemCursor(platform::gui::SystemCursorType::Arrow)) { - cursor_select_.SetSelectedIndex(0); - } else if (cursor == cursor_manager->GetSystemCursor( - platform::gui::SystemCursorType::Hand)) { - cursor_select_.SetSelectedIndex(1); - } else if (cursor == cursor_manager->GetSystemCursor( - platform::gui::SystemCursorType::IBeam)) { - cursor_select_.SetSelectedIndex(2); - } - - if (trigger_change) { - RaiseChangeEvent(); - } -} -} // namespace cru::theme_builder::components::stylers |