Window->Form.
This commit is contained in:
parent
5087d919cc
commit
37ded9acc3
|
@ -34,25 +34,23 @@ MainWindow::~MainWindow() = default;
|
||||||
bool MainWindow::Initialize() {
|
bool MainWindow::Initialize() {
|
||||||
client_ = app_->client();
|
client_ = app_->client();
|
||||||
|
|
||||||
platform_window_ = xe::ui::Window::Create(app()->loop(), kBaseTitle);
|
window_ = xe::ui::Window::Create(app()->loop(), kBaseTitle);
|
||||||
if (!platform_window_) {
|
if (!window_) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
platform_window_->Initialize();
|
window_->Initialize();
|
||||||
platform_window_->set_context(
|
window_->set_context(xe::ui::gl::GLContext::Create(window_.get()));
|
||||||
xe::ui::gl::GLContext::Create(platform_window_.get()));
|
window_->MakeReady();
|
||||||
platform_window_->MakeReady();
|
|
||||||
|
|
||||||
platform_window_->on_closed.AddListener(
|
window_->on_closed.AddListener(std::bind(&MainWindow::OnClose, this));
|
||||||
std::bind(&MainWindow::OnClose, this));
|
|
||||||
|
|
||||||
platform_window_->on_key_down.AddListener([this](xe::ui::KeyEvent& e) {
|
window_->on_key_down.AddListener([this](xe::ui::KeyEvent& e) {
|
||||||
bool handled = true;
|
bool handled = true;
|
||||||
switch (e.key_code()) {
|
switch (e.key_code()) {
|
||||||
case 0x1B: { // VK_ESCAPE
|
case 0x1B: { // VK_ESCAPE
|
||||||
// Allow users to escape fullscreen (but not enter it).
|
// Allow users to escape fullscreen (but not enter it).
|
||||||
if (platform_window_->is_fullscreen()) {
|
if (window_->is_fullscreen()) {
|
||||||
platform_window_->ToggleFullscreen(false);
|
window_->ToggleFullscreen(false);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -69,9 +67,9 @@ bool MainWindow::Initialize() {
|
||||||
auto main_menu = MenuItem::Create(MenuItem::Type::kNormal);
|
auto main_menu = MenuItem::Create(MenuItem::Type::kNormal);
|
||||||
auto file_menu = MenuItem::Create(MenuItem::Type::kPopup, L"&File");
|
auto file_menu = MenuItem::Create(MenuItem::Type::kPopup, L"&File");
|
||||||
{
|
{
|
||||||
file_menu->AddChild(
|
file_menu->AddChild(MenuItem::Create(MenuItem::Type::kString, L"E&xit",
|
||||||
MenuItem::Create(MenuItem::Type::kString, L"E&xit", L"Alt+F4",
|
L"Alt+F4",
|
||||||
[this]() { platform_window_->Close(); }));
|
[this]() { window_->Close(); }));
|
||||||
}
|
}
|
||||||
main_menu->AddChild(std::move(file_menu));
|
main_menu->AddChild(std::move(file_menu));
|
||||||
|
|
||||||
|
@ -87,9 +85,9 @@ bool MainWindow::Initialize() {
|
||||||
}
|
}
|
||||||
main_menu->AddChild(std::move(help_menu));
|
main_menu->AddChild(std::move(help_menu));
|
||||||
|
|
||||||
platform_window_->set_main_menu(std::move(main_menu));
|
window_->set_main_menu(std::move(main_menu));
|
||||||
|
|
||||||
platform_window_->Resize(1440, 1200);
|
window_->Resize(1440, 1200);
|
||||||
|
|
||||||
BuildUI();
|
BuildUI();
|
||||||
|
|
||||||
|
@ -100,10 +98,10 @@ void MainWindow::BuildUI() {
|
||||||
using namespace el::dsl;
|
using namespace el::dsl;
|
||||||
el::AnimationBlocker animation_blocker;
|
el::AnimationBlocker animation_blocker;
|
||||||
|
|
||||||
auto root_element = platform_window_->root_element();
|
auto root_element = window_->root_element();
|
||||||
window_ = std::make_unique<el::Window>();
|
form_ = std::make_unique<el::Form>();
|
||||||
window_->set_settings(el::WindowSettings::kFullScreen);
|
form_->set_settings(el::FormSettings::kFullScreen);
|
||||||
root_element->AddChild(window_.get());
|
root_element->AddChild(form_.get());
|
||||||
|
|
||||||
auto root_node =
|
auto root_node =
|
||||||
LayoutBoxNode()
|
LayoutBoxNode()
|
||||||
|
@ -132,14 +130,14 @@ void MainWindow::BuildUI() {
|
||||||
.align(Align::kTop))
|
.align(Align::kTop))
|
||||||
.pane(LayoutBoxNode().id("log_box").gravity(Gravity::kAll)));
|
.pane(LayoutBoxNode().id("log_box").gravity(Gravity::kAll)));
|
||||||
|
|
||||||
window_->LoadNodeTree(root_node);
|
form_->LoadNodeTree(root_node);
|
||||||
window_->GetElementsById({
|
form_->GetElementsById({
|
||||||
{TBIDC("split_container"), &ui_.split_container},
|
{TBIDC("split_container"), &ui_.split_container},
|
||||||
{TBIDC("toolbar_box"), &ui_.toolbar_box},
|
{TBIDC("toolbar_box"), &ui_.toolbar_box},
|
||||||
{TBIDC("tab_container"), &ui_.tab_container},
|
{TBIDC("tab_container"), &ui_.tab_container},
|
||||||
});
|
});
|
||||||
|
|
||||||
handler_ = std::make_unique<el::EventHandler>(window_.get());
|
handler_ = std::make_unique<el::EventHandler>(form_.get());
|
||||||
handler_->Listen(el::EventType::kClick, TBIDC("pause_button"),
|
handler_->Listen(el::EventType::kClick, TBIDC("pause_button"),
|
||||||
[this](const el::Event& ev) {
|
[this](const el::Event& ev) {
|
||||||
client_->Interrupt();
|
client_->Interrupt();
|
||||||
|
@ -164,7 +162,7 @@ void MainWindow::BuildUI() {
|
||||||
|
|
||||||
UpdateElementState();
|
UpdateElementState();
|
||||||
|
|
||||||
el::util::ShowDebugInfoSettingsWindow(root_element);
|
el::util::ShowDebugInfoSettingsForm(root_element);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::UpdateElementState() {
|
void MainWindow::UpdateElementState() {
|
||||||
|
@ -173,7 +171,7 @@ void MainWindow::UpdateElementState() {
|
||||||
el::TabContainer* tab_container;
|
el::TabContainer* tab_container;
|
||||||
el::Button* pause_button;
|
el::Button* pause_button;
|
||||||
el::Button* resume_button;
|
el::Button* resume_button;
|
||||||
window_->GetElementsById({
|
form_->GetElementsById({
|
||||||
{TBIDC("tab_container"), &tab_container},
|
{TBIDC("tab_container"), &tab_container},
|
||||||
{TBIDC("pause_button"), &pause_button},
|
{TBIDC("pause_button"), &pause_button},
|
||||||
{TBIDC("resume_button"), &resume_button},
|
{TBIDC("resume_button"), &resume_button},
|
||||||
|
|
|
@ -44,8 +44,8 @@ class MainWindow {
|
||||||
Application* app_ = nullptr;
|
Application* app_ = nullptr;
|
||||||
xe::debug::client::xdp::XdpClient* client_ = nullptr;
|
xe::debug::client::xdp::XdpClient* client_ = nullptr;
|
||||||
|
|
||||||
std::unique_ptr<xe::ui::Window> platform_window_;
|
std::unique_ptr<xe::ui::Window> window_;
|
||||||
std::unique_ptr<el::Window> window_;
|
std::unique_ptr<el::Form> form_;
|
||||||
struct {
|
struct {
|
||||||
el::SplitContainer* split_container;
|
el::SplitContainer* split_container;
|
||||||
el::LayoutBox* toolbar_box;
|
el::LayoutBox* toolbar_box;
|
||||||
|
|
|
@ -22,13 +22,13 @@ namespace kernel {
|
||||||
SHIM_CALL XamIsUIActive_shim(PPCContext* ppc_context,
|
SHIM_CALL XamIsUIActive_shim(PPCContext* ppc_context,
|
||||||
KernelState* kernel_state) {
|
KernelState* kernel_state) {
|
||||||
XELOGD("XamIsUIActive()");
|
XELOGD("XamIsUIActive()");
|
||||||
SHIM_SET_RETURN_32(el::ModalWindow::is_any_visible());
|
SHIM_SET_RETURN_32(el::ModalForm::is_any_visible());
|
||||||
}
|
}
|
||||||
|
|
||||||
class MessageBoxWindow : public el::ModalWindow {
|
class MessageBoxWindow : public el::ModalForm {
|
||||||
public:
|
public:
|
||||||
MessageBoxWindow(xe::threading::Fence* fence)
|
MessageBoxWindow(xe::threading::Fence* fence)
|
||||||
: ModalWindow([fence]() { fence->Signal(); }) {}
|
: ModalForm([fence]() { fence->Signal(); }) {}
|
||||||
~MessageBoxWindow() override = default;
|
~MessageBoxWindow() override = default;
|
||||||
|
|
||||||
// TODO(benvanik): icon.
|
// TODO(benvanik): icon.
|
||||||
|
@ -44,7 +44,7 @@ class MessageBoxWindow : public el::ModalWindow {
|
||||||
// In case we are cancelled, always set default button.
|
// In case we are cancelled, always set default button.
|
||||||
*out_chosen_button_ = default_button;
|
*out_chosen_button_ = default_button;
|
||||||
|
|
||||||
ModalWindow::Show(root_element);
|
ModalForm::Show(root_element);
|
||||||
|
|
||||||
EnsureFocus();
|
EnsureFocus();
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ class MessageBoxWindow : public el::ModalWindow {
|
||||||
Die();
|
Die();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return ModalWindow::OnEvent(ev);
|
return ModalForm::OnEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring title_;
|
std::wstring title_;
|
||||||
|
@ -168,10 +168,10 @@ SHIM_CALL XamShowMessageBoxUI_shim(PPCContext* ppc_context,
|
||||||
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
SHIM_SET_RETURN_32(X_ERROR_IO_PENDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
class KeyboardInputWindow : public el::ModalWindow {
|
class KeyboardInputWindow : public el::ModalForm {
|
||||||
public:
|
public:
|
||||||
KeyboardInputWindow(xe::threading::Fence* fence)
|
KeyboardInputWindow(xe::threading::Fence* fence)
|
||||||
: ModalWindow([fence]() { fence->Signal(); }) {}
|
: ModalForm([fence]() { fence->Signal(); }) {}
|
||||||
~KeyboardInputWindow() override = default;
|
~KeyboardInputWindow() override = default;
|
||||||
|
|
||||||
// TODO(benvanik): icon.
|
// TODO(benvanik): icon.
|
||||||
|
@ -189,7 +189,7 @@ class KeyboardInputWindow : public el::ModalWindow {
|
||||||
*out_text = default_text;
|
*out_text = default_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
ModalWindow::Show(root_element);
|
ModalForm::Show(root_element);
|
||||||
|
|
||||||
EnsureFocus();
|
EnsureFocus();
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ class KeyboardInputWindow : public el::ModalWindow {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ModalWindow::OnEvent(ev);
|
return ModalForm::OnEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring title_;
|
std::wstring title_;
|
||||||
|
@ -341,10 +341,10 @@ dword_result_t XamShowDeviceSelectorUI(dword_t user_index, dword_t content_type,
|
||||||
}
|
}
|
||||||
DECLARE_XAM_EXPORT(XamShowDeviceSelectorUI, ExportTag::kImplemented);
|
DECLARE_XAM_EXPORT(XamShowDeviceSelectorUI, ExportTag::kImplemented);
|
||||||
|
|
||||||
class DirtyDiscWindow : public el::ModalWindow {
|
class DirtyDiscWindow : public el::ModalForm {
|
||||||
public:
|
public:
|
||||||
DirtyDiscWindow(xe::threading::Fence* fence)
|
DirtyDiscWindow(xe::threading::Fence* fence)
|
||||||
: ModalWindow([fence]() { fence->Signal(); }) {}
|
: ModalForm([fence]() { fence->Signal(); }) {}
|
||||||
~DirtyDiscWindow() override = default;
|
~DirtyDiscWindow() override = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -377,7 +377,7 @@ class DirtyDiscWindow : public el::ModalWindow {
|
||||||
Die();
|
Die();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return ModalWindow::OnEvent(ev);
|
return ModalForm::OnEvent(ev);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 66048454a5b720eb32f6d1a117038a507001b975
|
Subproject commit 54ccef6df50a7d92a1869c6b54ae4b1f57356933
|
Loading…
Reference in New Issue