Window

Struct Window 

Source
pub struct Window(/* private fields */);
Expand description

Represents a pointer to any wxDragon window object. This is typically used as a base struct or in trait objects. Note: Deliberately NOT Copy or Clone, as it represents unique FFI resource ownership.

Implementations§

Source§

impl Window

Source

pub fn as_ptr(&self) -> *mut wxd_Window_t

Returns the raw underlying pointer. Temporary: Made public for FFI callbacks until safe event handling is done.

Source

pub fn is_null(&self) -> bool

Checks if the underlying pointer is null.

Source

pub fn set_sizer(&self, sizer: impl WxSizer, delete_old_sizer: bool)

Sets the window’s sizer. Takes ownership of the Sizer object (caller should std::mem::forget it). delete_old_sizer: If true, the previous sizer (if any) is deleted.

Source

pub fn set_sizer_and_fit(&self, sizer: impl WxSizer, delete_old_sizer: bool)

Sets the window’s sizer and calls Fit() on the window. Takes ownership of the Sizer object (caller should std::mem::forget it). delete_old_sizer: If true, the previous sizer (if any) is deleted.

Source§

impl Window

Source

pub fn get_class_name(&self) -> Option<String>

Gets the wxWidgets class name for this window using built-in RTTI

Source

pub fn as_widget<T: FromWindowWithClassName>(&self) -> Option<T>

Generic method to cast this window to a specific widget type Uses wxWidgets’ built-in RTTI to safely verify the type before casting

Trait Implementations§

Source§

impl Clone for Window

Source§

fn clone(&self) -> Window

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Window

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Window

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Window

Source§

fn eq(&self, other: &Window) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl WxEvtHandler for Window

Source§

unsafe fn get_event_handler_ptr(&self) -> *mut wxd_EvtHandler_t

Returns the raw event handler pointer for this widget. Read more
Source§

fn unbind(&self, token: EventToken) -> bool

Unbind a specific event handler by token. Read more
Source§

fn unbind_all(&self) -> usize

Unbind all event handlers currently attached to this handler. Read more
Source§

impl WxWidget for Window

Source§

fn handle_ptr(&self) -> *mut wxd_Window_t

Returns the raw underlying window pointer. Unsafe because the lifetime is not tied to self. Primarily for internal use or passing back to FFI.
Source§

fn get_id(&self) -> i32

Returns the window ID for this widget.
Source§

fn fit(&self)

Adjusts the window size to fit its contents or its sizer.
Source§

fn layout(&self)

Forces the window to recalculate its layout using its sizer. This is called when the window size changes to update the positions and sizes of child widgets according to the sizer constraints.
Source§

fn get_best_size(&self) -> Size

Gets the window’s sizer-calculated best size.
Source§

fn show(&self, show: bool)

Shows or hides the widget.
Source§

fn set_background_color(&self, color: Colour)

Sets the window’s background color.
Source§

fn set_background_style(&self, style: BackgroundStyle)

Sets the background style for the window. Read more
Source§

fn get_background_style(&self) -> BackgroundStyle

Gets the background style for the window.
Source§

fn set_min_size(&self, size: Size)

Sets the window’s minimum size.
Source§

fn refresh(&self, erase_background: bool, rect: Option<&Rect>)

Refreshes the window, optionally erasing the background and specifying a rectangle.
Source§

fn update(&self)

Repaints all invalid areas of the window immediately. Read more
Source§

fn set_tooltip(&self, tip: &str)

Sets the tooltip string for this widget.
Source§

fn destroy(&self)

Explicitly destroys the underlying wxWidgets object. After calling this, the widget wrapper should not be used further. This is useful for dynamically creating and destroying widgets.
Source§

fn set_font(&self, font: &Font)

Source§

fn get_font(&self) -> Option<Font>

Gets the font currently used for this widget. Read more
Source§

fn get_sizer(&self) -> Option<Sizer>

Gets the sizer currently assigned to this widget. Read more
Source§

fn enable(&self, enable: bool)

Enables or disables the widget. Read more
Source§

fn is_enabled(&self) -> bool

Returns true if the widget is enabled, false otherwise.
Source§

fn get_position(&self) -> Point

Gets the window’s position relative to its parent.
Source§

fn get_size(&self) -> Size

Gets the window’s size.
Source§

fn set_size(&self, size: Size)

Sets the window’s size.
Source§

fn set_size_with_pos(&self, x: i32, y: i32, width: i32, height: i32)

Sets the window’s position and size.
Source§

fn set_client_size(&self, size: Size)

Sets the window’s client area size (the area inside borders, scrollbars, etc).
Source§

fn get_client_size(&self) -> Size

Gets the client area size.
Source§

fn get_min_size(&self) -> Size

Gets the window’s minimum size.
Source§

fn move_window(&self, x: i32, y: i32)

Moves the window to the specified position.
Source§

fn center(&self)

Centers the window relative to its parent.
Source§

fn centre(&self)

UK spelling alias for center()
Source§

fn client_to_screen(&self, pt: Point) -> Point

Converts client coordinates to screen coordinates.
Source§

fn screen_to_client(&self, pt: Point) -> Point

Converts screen coordinates to client coordinates.
Source§

fn get_label(&self) -> Option<String>

Gets the window label (title or text). Returns None if the label is not set, cannot be converted to UTF-8, or an error occurs.
Source§

fn set_label(&self, label: &str)

Sets the window label (title or text). Read more
Source§

fn set_extra_style(&self, extra_style: ExtraWindowStyle)

Sets the extra window style flags. Read more
Source§

fn set_extra_style_raw(&self, extra_style: i64)

Sets extra window style flags using raw i64 value. Read more
Source§

fn get_extra_style_raw(&self) -> i64

Gets the current extra window style flags as raw value. Read more
Source§

fn has_extra_style(&self, style: ExtraWindowStyle) -> bool

Checks if a specific extra window style flag is set. Read more
Source§

fn add_extra_style(&self, style: ExtraWindowStyle)

Adds extra window style flags to the current set. Read more
Source§

fn remove_extra_style(&self, style: ExtraWindowStyle)

Removes extra window style flags from the current set. Read more
Source§

fn get_parent(&self) -> Option<Window>

Gets the parent window of this widget. Read more
Source§

fn set_foreground_color(&self, color: Colour)

Sets the foreground color of the window. Read more
Source§

fn get_foreground_color(&self) -> Colour

Gets the foreground color of the window. Read more
Source§

fn get_background_color(&self) -> Colour

Gets the background color of the window. Read more
Source§

fn set_focus(&self)

Sets the focus to this window. Read more
Source§

fn has_focus(&self) -> bool

Returns true if this window currently has focus.
Source§

fn can_accept_focus(&self) -> bool

Returns true if this window can accept focus. Read more
Source§

fn accepts_focus_from_keyboard(&self) -> bool

Returns true if this window accepts focus from keyboard navigation. Read more
Source§

fn set_can_focus(&self, can_focus: bool)

Sets whether this window can accept focus. Read more
Source§

fn is_shown(&self) -> bool

Returns true if the window is currently shown. Read more
Source§

fn hide(&self)

Hides the window. Read more
Source§

fn set_max_size(&self, size: Size)

Sets the maximum size for the window. Read more
Source§

fn get_max_size(&self) -> Size

Gets the maximum size for the window. Read more
Source§

fn set_name(&self, name: &str)

Sets the window name. Read more
Source§

fn get_name(&self) -> String

Gets the window name. Read more
Source§

fn close(&self, force: bool) -> bool

Attempts to close the window. Read more
Source§

fn find_window_by_name(&self, name: &str) -> Option<Window>

Finds a child window by name. Read more
Source§

fn find_window_by_id(&self, id: i32) -> Option<Window>

Finds a child window by ID. Read more
Source§

fn set_cursor(&self, cursor: Option<&Cursor>)

Sets the cursor for this window. Read more
Source§

fn get_cursor(&self) -> Option<Cursor>

Gets the cursor currently associated with this window. Read more
Source§

fn raise(&self)

Raises the window to the top of the window hierarchy (Z-order). Read more
Source§

fn lower(&self)

Lowers the window to the bottom of the window hierarchy (Z-order). Read more
Source§

fn capture_mouse(&self)

Directs all mouse input to this window. Read more
Source§

fn release_mouse(&self)

Releases mouse capture. Read more
Source§

fn has_capture(&self) -> bool

Returns true if this window currently has mouse capture.
Source§

fn get_capture() -> Option<Window>
where Self: Sized,

Returns the window that currently has mouse capture. Read more
Source§

fn freeze(&self)

Freeze the window: don’t redraw it until it is thawed
Source§

fn thaw(&self)

Thaw the window: redraw it after it had been frozen
Source§

fn is_frozen(&self) -> bool

Return true if window had been frozen and not unthawed yet
Source§

fn get_text_extent(&self, text: &str) -> Size

Gets the dimensions of the string as it would be drawn on the window with the currently selected font. Read more
Source§

fn get_full_text_extent( &self, text: &str, font: Option<&Font>, ) -> (Size, i32, i32)

Gets the full dimensions of the string as it would be drawn on the window. Read more
Source§

fn get_char_height(&self) -> i32

Returns the character height for this window using the current font. Read more
Source§

fn get_char_width(&self) -> i32

Returns the average character width for this window using the current font. Read more
Source§

fn set_style(&self, style: WindowStyle)

Sets the window style flags. Read more
Source§

fn set_style_raw(&self, style: i64)

Sets window style flags using raw i64 value. Read more
Source§

fn get_style_raw(&self) -> i64

Gets the current window style flags as raw value. Read more
Source§

fn has_style(&self, style: WindowStyle) -> bool

Checks if a specific window style flag is set. Read more
Source§

fn add_style(&self, style: WindowStyle)

Adds window style flags to the current set. Read more
Source§

fn remove_style(&self, style: WindowStyle)

Removes window style flags from the current set. Read more
Source§

fn get_handle(&self) -> *mut c_void

Gets the native handle of the window (platform-specific). Read more
Source§

fn move_after_in_tab_order(&self, win: &dyn WxWidget)

Moves this window to appear after the specified window in the tab order. Read more
Source§

fn move_before_in_tab_order(&self, win: &dyn WxWidget)

Moves this window to appear before the specified window in the tab order. Read more
Source§

fn get_next_sibling(&self) -> Option<Window>

Gets the next sibling window in the parent’s child list. Read more
Source§

fn get_prev_sibling(&self) -> Option<Window>

Gets the previous sibling window in the parent’s child list. Read more
Source§

fn navigate(&self, forward: bool) -> bool

Navigates to the next or previous control. Read more
Source§

fn popup_menu(&self, menu: &mut Menu, screen_pos: Option<Point>) -> bool

Shows a popup menu at the specified position or at the current mouse position. Read more
Source§

fn process_menu_command(&self, id: i32) -> bool

Synchronously dispatch a wxEVT_MENU with the given command ID to this window. Returns true if any handler processed the event.
Source§

fn post_menu_command(&self, id: i32)

Asynchronously post a wxEVT_MENU with the given command ID to this window. The event will be queued and delivered later by the main loop.
Source§

impl Copy for Window

Source§

impl Eq for Window

Source§

impl StructuralPartialEq for Window

Auto Trait Implementations§

§

impl Freeze for Window

§

impl RefUnwindSafe for Window

§

impl !Send for Window

§

impl !Sync for Window

§

impl Unpin for Window

§

impl UnwindSafe for Window

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<W> WindowXrcMethods for W
where W: WxWidget,

Source§

fn find_child_by_xrc_name<T: FromXrcPtr<RawFfiType = *mut wxd_Window_t> + WxWidget>( &self, name: &str, ) -> Option<T>

Find a child window by XRC name
Source§

impl<W> WxWidgetDowncast for W
where W: WxWidget + Any,

Source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: WxWidget + 'static,

Attempts to downcast this widget to a specific type. Returns Some(&T) if the widget is of type T, None otherwise.
Source§

fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: WxWidget + 'static,

Attempts to downcast this widget to a specific type (mutable). Returns Some(&mut T) if the widget is of type T, None otherwise.
Source§

fn widget_type_name(&self) -> &'static str

Returns the type name of this widget for debugging purposes.