Make it possible to set Glium windows as not resizable. (#69)
This commit is contained in:
parent
dbab277658
commit
bb469bf52f
3 changed files with 9 additions and 2 deletions
|
@ -38,6 +38,11 @@ pub trait App {
|
|||
/// Optional.
|
||||
fn setup(&mut self, _ctx: &crate::CtxRef) {}
|
||||
|
||||
/// Returns true if this app window should be resizable.
|
||||
fn is_resizable(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// Called each time the UI needs repainting, which may be many times per second.
|
||||
/// Put your widgets into a `SidePanel`, `TopPanel`, `CentralPanel`, `Window` or `Area`.
|
||||
fn ui(&mut self, ctx: &crate::CtxRef, integration_context: &mut IntegrationContext<'_>);
|
||||
|
|
|
@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
### Added
|
||||
|
||||
* `egui_glium` will auto-save your app state every 30 seconds.
|
||||
* `egui_glium` can now set windows as fixed size (e.g. the user can't resize the window). See `egui::App::is_resizable()`.
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -42,11 +42,12 @@ impl egui::app::RepaintSignal for GliumRepaintSignal {
|
|||
fn create_display(
|
||||
title: &str,
|
||||
window_settings: Option<WindowSettings>,
|
||||
is_resizable: bool,
|
||||
event_loop: &glutin::event_loop::EventLoop<RequestRepaintEvent>,
|
||||
) -> glium::Display {
|
||||
let mut window_builder = glutin::window::WindowBuilder::new()
|
||||
.with_decorations(true)
|
||||
.with_resizable(true)
|
||||
.with_resizable(is_resizable)
|
||||
.with_title(title)
|
||||
.with_transparent(false);
|
||||
|
||||
|
@ -102,7 +103,7 @@ pub fn run(mut app: Box<dyn App>) -> ! {
|
|||
.as_mut()
|
||||
.and_then(|storage| egui::app::get_value(storage.as_ref(), WINDOW_KEY));
|
||||
let event_loop = glutin::event_loop::EventLoop::with_user_event();
|
||||
let display = create_display(app.name(), window_settings, &event_loop);
|
||||
let display = create_display(app.name(), window_settings, app.is_resizable(), &event_loop);
|
||||
|
||||
let repaint_signal = std::sync::Arc::new(GliumRepaintSignal(event_loop.create_proxy()));
|
||||
|
||||
|
|
Loading…
Reference in a new issue