Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added
set_fullscreen
API to WindowAdapter.
See #3283
- Loading branch information
Showing
15 changed files
with
126 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright © SixtyFPS GmbH <info@slint.dev> | ||
# SPDX-License-Identifier: MIT | ||
|
||
cmake_minimum_required(VERSION 3.21) | ||
project(fullscreen_toggle LANGUAGES CXX) | ||
|
||
if (NOT TARGET Slint::Slint) | ||
find_package(Slint REQUIRED) | ||
endif() | ||
|
||
add_executable(fullscreen_toggle fullscreen_toggle.cpp) | ||
target_link_libraries(fullscreen_toggle PRIVATE Slint::Slint) | ||
slint_target_sources(fullscreen_toggle fullscreen_toggle.slint) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright © SixtyFPS GmbH <info@slint.dev> | ||
# SPDX-License-Identifier: MIT | ||
|
||
[package] | ||
name = "fullscreen_toggle" | ||
version = "1.4.0" | ||
authors = ["Slint Developers <info@slint.dev>"] | ||
edition = "2021" | ||
publish = false | ||
license = "MIT" | ||
|
||
[[bin]] | ||
path = "main.rs" | ||
name = "fullscreen_toggle" | ||
|
||
[dependencies] | ||
slint = { path = "../../api/rs/slint" } | ||
|
||
[build-dependencies] | ||
slint-build = { path = "../../api/rs/build" } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright © SixtyFPS GmbH <info@slint.dev> | ||
// SPDX-License-Identifier: MIT | ||
|
||
#include "fullscreen_toggle.h" | ||
#include <random> | ||
|
||
int main() | ||
{ | ||
auto app_window = AppWindow::create(); | ||
Check failure on line 9 in examples/fullscreen_toggle/fullscreen_toggle.cpp GitHub Actions / docs / docs
|
||
bool fullscreen = false; | ||
app_window.on_fullscreen_toggle([fullscreen, main_window_weak = slint::ComponentWeakHandle(main_window)] { | ||
auto main_window = *main_window_weak.lock(); | ||
fullscreen = !fullscreen; | ||
main_window.window().set_fullscreen(fullscreen); | ||
}); | ||
|
||
main_window->run(); | ||
Check failure on line 17 in examples/fullscreen_toggle/fullscreen_toggle.cpp GitHub Actions / docs / docs
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright © SixtyFPS GmbH <info@slint.dev> | ||
// SPDX-License-Identifier: MIT | ||
|
||
import { Button, VerticalBox } from "std-widgets.slint"; | ||
|
||
export component AppWindow inherits Window { | ||
callback fullscreen-toggle(); | ||
VerticalBox { | ||
Text { | ||
text: "Toggle Button"; | ||
} | ||
Button { | ||
text: "Toggle fullscreen"; | ||
clicked => { | ||
root.fullscreen-toggle(); | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright © SixtyFPS GmbH <info@slint.dev> | ||
// SPDX-License-Identifier: MIT | ||
|
||
slint::slint! { | ||
import { AppWindow } from "fullscreen_toggle.slint"; | ||
} | ||
|
||
fn main() -> Result<(), slint::PlatformError> { | ||
let ui = AppWindow::new()?; | ||
let mut fullscreen = false; | ||
|
||
let ui_handle = ui.as_weak(); | ||
ui.on_fullscreen_toggle(move || { | ||
let ui = ui_handle.unwrap(); | ||
fullscreen = !fullscreen; | ||
ui.window().set_fullscreen(fullscreen); | ||
}); | ||
|
||
ui.run() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters