aboutsummaryrefslogtreecommitdiff
path: root/src/theme_builder/components/MainWindow.cpp
blob: d52193f19210d1c6086a44d6db4ffad1775bef9b (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
#include "MainWindow.hpp"
#include "cru/ui/Base.hpp"
#include "cru/ui/controls/StackLayout.hpp"
#include "cru/ui/controls/TextBlock.hpp"

namespace cru::theme_builder {
using namespace cru::ui;
using namespace cru::ui::controls;
using namespace cru::platform::gui;

MainWindow::MainWindow() {
  window_ = Window::Create();
  window_->GetNativeWindow()->SetTitle(u"CruUI Theme Builder");

  main_layout_ = FlexLayout::Create();
  main_layout_->SetFlexDirection(FlexDirection::Horizontal);
  window_->AddChild(main_layout_, 0);

  preview_layout_ = StackLayout::Create();
  main_layout_->AddChild(preview_layout_, 0);

  preview_button_ = Button::Create();
  preview_button_->SetChild(TextBlock::Create(u"Preview"));
  preview_layout_->AddChild(preview_button_, 0);
  preview_layout_->SetChildLayoutData(
      0, StackChildLayoutData{Alignment::Center, Alignment::Center});
}

MainWindow::~MainWindow() { delete window_; }

void MainWindow::Show() {
  window_->GetNativeWindow()->SetVisibility(WindowVisibilityType::Show);
  window_->GetNativeWindow()->SetToForeground();
}
}  // namespace cru::theme_builder