pub struct WindowHandle(/* private fields */);Implementations§
Source§impl WindowHandle
impl WindowHandle
Sourcepub fn show(&self)
pub fn show(&self)
Examples found in repository?
examples/hello.rs (line 113)
98fn main() {
99 druid_win_shell::init();
100
101 let mut file_menu = Menu::new();
102 file_menu.add_item(0x100, "E&xit");
103 file_menu.add_item(0x101, "O&pen");
104 let mut menubar = Menu::new();
105 menubar.add_dropdown(file_menu, "&File");
106
107 let mut run_loop = win_main::RunLoop::new();
108 let mut builder = WindowBuilder::new();
109 builder.set_handler(Box::new(HelloState::default()));
110 builder.set_title("Hello example");
111 builder.set_menu(menubar);
112 let window = builder.build().unwrap();
113 window.show();
114 run_loop.run();
115}More examples
examples/perftest.rs (line 139)
124fn main() {
125 druid_win_shell::init();
126
127 let mut run_loop = win_main::RunLoop::new();
128 let mut builder = WindowBuilder::new();
129 let perf_state = PerfState {
130 dwrite_factory: directwrite::Factory::new().unwrap(),
131 handle: Default::default(),
132 last_time: 0.0,
133 };
134 builder.set_handler(Box::new(PerfTest(RefCell::new(perf_state))));
135 builder.set_title("Performance tester");
136 // Note: experiment with changing this
137 builder.set_present_strategy(PresentStrategy::FlipRedirect);
138 let window = builder.build().unwrap();
139 window.show();
140 run_loop.run();
141}Sourcepub fn close(&self)
pub fn close(&self)
Examples found in repository?
More examples
examples/hello.rs (line 55)
53 fn command(&self, id: u32) {
54 match id {
55 0x100 => self.handle.borrow().close(),
56 0x101 => {
57 let mut options = FileDialogOptions::default();
58 options.set_show_hidden();
59 let filename = self.handle.borrow().file_dialog(FileDialogType::Open, options);
60 println!("result: {:?}", filename);
61 }
62 _ => println!("unexpected id {}", id),
63 }
64 }pub fn invalidate(&self)
Sourcepub fn get_hwnd(&self) -> Option<HWND>
pub fn get_hwnd(&self) -> Option<HWND>
Get the raw HWND handle, for uses that are not wrapped in druid_win_shell.
Sourcepub fn file_dialog(
&self,
ty: FileDialogType,
options: FileDialogOptions,
) -> Result<OsString, Error>
pub fn file_dialog( &self, ty: FileDialogType, options: FileDialogOptions, ) -> Result<OsString, Error>
Examples found in repository?
examples/hello.rs (line 59)
53 fn command(&self, id: u32) {
54 match id {
55 0x100 => self.handle.borrow().close(),
56 0x101 => {
57 let mut options = FileDialogOptions::default();
58 options.set_show_hidden();
59 let filename = self.handle.borrow().file_dialog(FileDialogType::Open, options);
60 println!("result: {:?}", filename);
61 }
62 _ => println!("unexpected id {}", id),
63 }
64 }Sourcepub fn get_idle_handle(&self) -> Option<IdleHandle>
pub fn get_idle_handle(&self) -> Option<IdleHandle>
Get a handle that can be used to schedule an idle task.
Sourcepub fn px_to_pixels(&self, x: f32) -> i32
pub fn px_to_pixels(&self, x: f32) -> i32
Convert a dimension in px units to physical pixels (rounding).
Sourcepub fn px_to_pixels_xy(&self, x: f32, y: f32) -> (i32, i32)
pub fn px_to_pixels_xy(&self, x: f32, y: f32) -> (i32, i32)
Convert a point in px units to physical pixels (rounding).
Sourcepub fn pixels_to_px<T: Into<f64>>(&self, x: T) -> f32
pub fn pixels_to_px<T: Into<f64>>(&self, x: T) -> f32
Convert a dimension in physical pixels to px units.
Trait Implementations§
Source§impl Clone for WindowHandle
impl Clone for WindowHandle
Source§fn clone(&self) -> WindowHandle
fn clone(&self) -> WindowHandle
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for WindowHandle
impl Default for WindowHandle
Source§fn default() -> WindowHandle
fn default() -> WindowHandle
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for WindowHandle
impl !RefUnwindSafe for WindowHandle
impl !Send for WindowHandle
impl !Sync for WindowHandle
impl Unpin for WindowHandle
impl !UnwindSafe for WindowHandle
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more