kFullScreen flag for windows. Fixes #11.

This commit is contained in:
Ben Vanik
2015-07-08 22:17:49 -07:00
parent 20a0dee815
commit 35af1384e2
5 changed files with 31 additions and 7 deletions

View File

@@ -282,6 +282,10 @@ elements
overrides
element Window.selected
state selected
Window.fullscreen
clone Window
expand 12
padding 0
Window.selected
bitmap window_active.png
cut 16

View File

@@ -168,6 +168,14 @@ void Window::set_settings(WindowSettings settings) {
title_close_button_.RemoveFromParent();
}
if (any(settings & WindowSettings::kFullScreen)) {
set_background_skin(TBIDC("Window.fullscreen"));
set_rect(parent()->rect());
set_gravity(Gravity::kAll);
} else {
set_background_skin(TBIDC("Window"));
}
// FIX: invalidate layout / resize window!
Invalidate();
}

View File

@@ -19,12 +19,13 @@
namespace el {
enum class WindowSettings {
kNone = 0, // Chrome less window without any other settings.
kTitleBar = 1, // Show a title bar that can also move the window.
kResizable = 2, // Show an element for resizing the window.
kCloseButton = 4, // Show an element for closing the window.
kCanActivate = 8, // Can be activated and deactivate other windows.
kDesignButton = 16, // Show an element for opening a designer for the window.
kNone = 0, // Chrome less window without any other settings.
kTitleBar = 1 << 0, // Show a title bar that can also move the window.
kResizable = 1 << 1, // Show an element for resizing the window.
kCloseButton = 1 << 2, // Show an element for closing the window.
kCanActivate = 1 << 3, // Can be activated and deactivate other windows.
kDesignButton = 1 << 4, // Show a button to open a designer for the window.
kFullScreen = 1 << 5, // Fully fill parent.
kDefault =
kTitleBar | kResizable | kCloseButton | kCanActivate | kDesignButton,

View File

@@ -21,6 +21,7 @@ LayoutBox: axis: y, distribution-position: "left top", distribution: "available"
id: "test-layout"
data: "test_toggle_containers.tb.txt"
Button: skin: "Button.flat", text: "Close with dim & alert", id: "Window.close"
Button: skin: "Button.flat", text: "Fullscreen Window", id: "test-fullscreen-window"
Button: skin: "Button.flat", text: "ResourceEditWindow", id: "test-resource-edit"
GroupBox: value: 0, text: "Layout tests"

View File

@@ -218,7 +218,7 @@ int app_main() {
el::Initialize(application_backend->GetRenderer());
CodeTextBox::RegisterInflater();
//el::io::FileManager::RegisterFileSystem(
// el::io::FileManager::RegisterFileSystem(
// std::make_unique<el::io::PosixFileSystem>("./resources"));
el::io::FileManager::RegisterFileSystem(
std::make_unique<el::io::PosixFileSystem>("./testbed/resources"));
@@ -727,6 +727,13 @@ bool AnimationsWindow::OnEvent(const Event& ev) {
return DemoWindow::OnEvent(ev);
}
class FullScreenWindow : public DemoWindow {
public:
FullScreenWindow() : DemoWindow() {
set_settings(WindowSettings::kFullScreen);
}
};
// == MainWindow ==============================================================
MainWindow::MainWindow() {
@@ -850,6 +857,9 @@ bool MainWindow::OnEvent(const Event& ev) {
(new DemoWindow())->LoadResourceFile("test_skin_conditions01.tb.txt");
(new DemoWindow())->LoadResourceFile("test_skin_conditions02.tb.txt");
return true;
} else if (ev.target->id() == TBIDC("test-fullscreen-window")) {
new FullScreenWindow();
return true;
} else if (ev.target->id() == TBIDC("test-resource-edit")) {
ResourceEditWindow* res_edit_win = new ResourceEditWindow();
res_edit_win->Load("resource_edit_test.tb.txt");