pub struct SearchCtrl { /* private fields */ }Expand description
Represents a wxSearchCtrl widget.
SearchCtrl uses WindowHandle internally for safe memory management.
When the underlying window is destroyed (by calling destroy() or when
its parent is destroyed), the handle becomes invalid and all operations
become safe no-ops.
§Example
let search = SearchCtrl::builder(&frame).value("Search...").build();
// SearchCtrl is Copy - no clone needed for closures!
search.bind_search_button_clicked(move |_| {
// Safe: if search was destroyed, this is a no-op
let query = search.get_value();
println!("Searching for: {}", query);
});
// After parent destruction, search operations are safe no-ops
frame.destroy();
assert!(!search.is_valid());Implementations§
Source§impl SearchCtrl
impl SearchCtrl
Sourcepub fn builder(parent: &dyn WxWidget) -> SearchCtrlBuilder<'_>
pub fn builder(parent: &dyn WxWidget) -> SearchCtrlBuilder<'_>
Creates a new SearchCtrl builder.
Shows or hides the search button. No-op if the control has been destroyed.
Returns whether the search button is visible. Returns false if the control has been destroyed.
Shows or hides the cancel button. No-op if the control has been destroyed.
Returns whether the cancel button is visible. Returns false if the control has been destroyed.
Sourcepub fn set_value(&self, value: &str)
pub fn set_value(&self, value: &str)
Sets the text value of the control. No-op if the control has been destroyed.
Sourcepub fn get_value(&self) -> String
pub fn get_value(&self) -> String
Gets the current text value of the control. Returns empty string if the control has been destroyed.
Sourcepub fn window_handle(&self) -> WindowHandle
pub fn window_handle(&self) -> WindowHandle
Returns the underlying WindowHandle for this searchctrl.
Source§impl SearchCtrl
impl SearchCtrl
Binds a handler to a widget-specific event. Returns an EventToken that can be used to unbind the handler later.
Binds a handler to a widget-specific event. Returns an EventToken that can be used to unbind the handler later.
Trait Implementations§
Source§impl Clone for SearchCtrl
impl Clone for SearchCtrl
Source§fn clone(&self) -> SearchCtrl
fn clone(&self) -> SearchCtrl
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SearchCtrl
Source§impl FromWindowWithClassName for SearchCtrl
impl FromWindowWithClassName for SearchCtrl
Source§fn class_name() -> &'static str
fn class_name() -> &'static str
Source§impl TextEvents for SearchCtrl
impl TextEvents for SearchCtrl
Source§fn on_text_updated<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(TextEventData) + 'static,
fn on_text_updated<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(TextEventData) + 'static,
Source§fn on_enter_pressed<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(TextEventData) + 'static,
fn on_enter_pressed<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(TextEventData) + 'static,
Source§impl WindowEvents for SearchCtrl
impl WindowEvents for SearchCtrl
Source§fn on_mouse_left_down<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_mouse_left_down<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_mouse_left_up<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_mouse_left_up<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_mouse_right_down<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_mouse_right_down<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_mouse_right_up<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_mouse_right_up<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_mouse_middle_down<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_mouse_middle_down<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_mouse_middle_up<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_mouse_middle_up<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_mouse_motion<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_mouse_motion<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_mouse_wheel<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_mouse_wheel<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_mouse_enter<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_mouse_enter<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_mouse_leave<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_mouse_leave<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_key_down<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_key_down<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_key_up<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_key_up<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_char<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_char<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_size<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_size<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_move_event<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_move_event<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_paint<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_paint<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_erase_background<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_erase_background<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_set_focus<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_set_focus<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_kill_focus<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_kill_focus<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_activate<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_activate<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_idle<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_idle<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_close<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_close<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§fn on_destroy<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
fn on_destroy<F>(&self, callback: F) -> EventTokenwhere
F: FnMut(WindowEventData) + 'static,
Source§impl WxEvtHandler for SearchCtrl
impl WxEvtHandler for SearchCtrl
Source§unsafe fn get_event_handler_ptr(&self) -> *mut wxd_EvtHandler_t
unsafe fn get_event_handler_ptr(&self) -> *mut wxd_EvtHandler_t
Source§fn unbind(&self, token: EventToken) -> bool
fn unbind(&self, token: EventToken) -> bool
Source§fn unbind_all(&self) -> usize
fn unbind_all(&self) -> usize
Source§impl WxWidget for SearchCtrl
impl WxWidget for SearchCtrl
Source§fn handle_ptr(&self) -> *mut wxd_Window_t
fn handle_ptr(&self) -> *mut wxd_Window_t
Source§fn layout(&self)
fn layout(&self)
Source§fn get_best_size(&self) -> Size
fn get_best_size(&self) -> Size
Source§fn set_background_color(&self, color: Colour)
fn set_background_color(&self, color: Colour)
Source§fn set_background_style(&self, style: BackgroundStyle)
fn set_background_style(&self, style: BackgroundStyle)
Source§fn get_background_style(&self) -> BackgroundStyle
fn get_background_style(&self) -> BackgroundStyle
Source§fn set_min_size(&self, size: Size)
fn set_min_size(&self, size: Size)
Source§fn refresh(&self, erase_background: bool, rect: Option<&Rect>)
fn refresh(&self, erase_background: bool, rect: Option<&Rect>)
Source§fn set_tooltip(&self, tip: &str)
fn set_tooltip(&self, tip: &str)
Source§fn destroy(&self)
fn destroy(&self)
fn set_font(&self, font: &Font)
Source§fn get_sizer(&self) -> Option<Sizer>
fn get_sizer(&self) -> Option<Sizer>
Source§fn set_sizer(&self, sizer: impl WxSizer, delete_old_sizer: bool)where
Self: Sized,
fn set_sizer(&self, sizer: impl WxSizer, delete_old_sizer: bool)where
Self: Sized,
Source§fn set_sizer_and_fit(&self, sizer: impl WxSizer, delete_old_sizer: bool)where
Self: Sized,
fn set_sizer_and_fit(&self, sizer: impl WxSizer, delete_old_sizer: bool)where
Self: Sized,
Fit() on the window. Read moreSource§fn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
true if the widget is enabled, false otherwise.Source§fn get_position(&self) -> Point
fn get_position(&self) -> Point
Source§fn set_size_with_pos(&self, x: i32, y: i32, width: i32, height: i32)
fn set_size_with_pos(&self, x: i32, y: i32, width: i32, height: i32)
Source§fn set_client_size(&self, size: Size)
fn set_client_size(&self, size: Size)
Source§fn get_client_size(&self) -> Size
fn get_client_size(&self) -> Size
Source§fn get_min_size(&self) -> Size
fn get_min_size(&self) -> Size
Source§fn move_window(&self, x: i32, y: i32)
fn move_window(&self, x: i32, y: i32)
Source§fn client_to_screen(&self, pt: Point) -> Point
fn client_to_screen(&self, pt: Point) -> Point
Source§fn screen_to_client(&self, pt: Point) -> Point
fn screen_to_client(&self, pt: Point) -> Point
Source§fn get_label(&self) -> Option<String>
fn get_label(&self) -> Option<String>
None if the label is not set, cannot be converted to UTF-8, or an error occurs.Source§fn set_extra_style(&self, extra_style: ExtraWindowStyle)
fn set_extra_style(&self, extra_style: ExtraWindowStyle)
Source§fn set_extra_style_raw(&self, extra_style: i64)
fn set_extra_style_raw(&self, extra_style: i64)
Source§fn get_extra_style_raw(&self) -> i64
fn get_extra_style_raw(&self) -> i64
Source§fn has_extra_style(&self, style: ExtraWindowStyle) -> bool
fn has_extra_style(&self, style: ExtraWindowStyle) -> bool
Source§fn add_extra_style(&self, style: ExtraWindowStyle)
fn add_extra_style(&self, style: ExtraWindowStyle)
Source§fn remove_extra_style(&self, style: ExtraWindowStyle)
fn remove_extra_style(&self, style: ExtraWindowStyle)
Source§fn set_foreground_color(&self, color: Colour)
fn set_foreground_color(&self, color: Colour)
Source§fn get_foreground_color(&self) -> Colour
fn get_foreground_color(&self) -> Colour
Source§fn get_background_color(&self) -> Colour
fn get_background_color(&self) -> Colour
Source§fn can_accept_focus(&self) -> bool
fn can_accept_focus(&self) -> bool
true if this window can accept focus. Read moreSource§fn accepts_focus_from_keyboard(&self) -> bool
fn accepts_focus_from_keyboard(&self) -> bool
true if this window accepts focus from keyboard navigation. Read moreSource§fn set_can_focus(&self, can_focus: bool)
fn set_can_focus(&self, can_focus: bool)
Source§fn set_max_size(&self, size: Size)
fn set_max_size(&self, size: Size)
Source§fn get_max_size(&self) -> Size
fn get_max_size(&self) -> Size
Source§fn find_window_by_name(&self, name: &str) -> Option<Window>
fn find_window_by_name(&self, name: &str) -> Option<Window>
Source§fn get_cursor(&self) -> Option<Cursor>
fn get_cursor(&self) -> Option<Cursor>
Source§fn capture_mouse(&self)
fn capture_mouse(&self)
Source§fn release_mouse(&self)
fn release_mouse(&self)
Source§fn has_capture(&self) -> bool
fn has_capture(&self) -> bool
true if this window currently has mouse capture.Source§fn get_capture() -> Option<Window>where
Self: Sized,
fn get_capture() -> Option<Window>where
Self: Sized,
Source§fn get_text_extent(&self, text: &str) -> Size
fn get_text_extent(&self, text: &str) -> Size
Source§fn get_full_text_extent(
&self,
text: &str,
font: Option<&Font>,
) -> (Size, i32, i32)
fn get_full_text_extent( &self, text: &str, font: Option<&Font>, ) -> (Size, i32, i32)
Source§fn get_char_height(&self) -> i32
fn get_char_height(&self) -> i32
Source§fn get_char_width(&self) -> i32
fn get_char_width(&self) -> i32
Source§fn set_style(&self, style: WindowStyle)
fn set_style(&self, style: WindowStyle)
Source§fn set_style_raw(&self, style: i64)
fn set_style_raw(&self, style: i64)
Source§fn get_style_raw(&self) -> i64
fn get_style_raw(&self) -> i64
Source§fn has_style(&self, style: WindowStyle) -> bool
fn has_style(&self, style: WindowStyle) -> bool
Source§fn add_style(&self, style: WindowStyle)
fn add_style(&self, style: WindowStyle)
Source§fn remove_style(&self, style: WindowStyle)
fn remove_style(&self, style: WindowStyle)
Source§fn get_handle(&self) -> *mut c_void
fn get_handle(&self) -> *mut c_void
Source§fn move_after_in_tab_order(&self, win: &dyn WxWidget)
fn move_after_in_tab_order(&self, win: &dyn WxWidget)
Source§fn move_before_in_tab_order(&self, win: &dyn WxWidget)
fn move_before_in_tab_order(&self, win: &dyn WxWidget)
Source§fn get_next_sibling(&self) -> Option<Window>
fn get_next_sibling(&self) -> Option<Window>
Source§fn get_prev_sibling(&self) -> Option<Window>
fn get_prev_sibling(&self) -> Option<Window>
Source§fn set_accessible(&self, accessible: Accessible)
fn set_accessible(&self, accessible: Accessible)
Source§fn get_accessible(&self) -> Option<Accessible>
fn get_accessible(&self) -> Option<Accessible>
Source§impl XrcSupport for SearchCtrl
Available on crate feature xrc only.
impl XrcSupport for SearchCtrl
xrc only.Source§unsafe fn from_xrc_ptr(ptr: *mut wxd_Window_t) -> Self
unsafe fn from_xrc_ptr(ptr: *mut wxd_Window_t) -> Self
Auto Trait Implementations§
impl Freeze for SearchCtrl
impl RefUnwindSafe for SearchCtrl
impl Send for SearchCtrl
impl Sync for SearchCtrl
impl Unpin for SearchCtrl
impl UnsafeUnpin for SearchCtrl
impl UnwindSafe for SearchCtrl
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromXrcPtr for Twhere
T: XrcSupport,
impl<T> FromXrcPtr for Twhere
T: XrcSupport,
type RawFfiType = *mut wxd_Window_t
Source§unsafe fn from_xrc_ptr(ptr: <T as FromXrcPtr>::RawFfiType) -> T
unsafe fn from_xrc_ptr(ptr: <T as FromXrcPtr>::RawFfiType) -> T
Source§impl<W> WindowXrcMethods for Wwhere
W: WxWidget,
impl<W> WindowXrcMethods for Wwhere
W: WxWidget,
Source§fn find_child_by_xrc_name<T: FromXrcPtr<RawFfiType = *mut wxd_Window_t> + WxWidget>(
&self,
name: &str,
) -> Option<T>
fn find_child_by_xrc_name<T: FromXrcPtr<RawFfiType = *mut wxd_Window_t> + WxWidget>( &self, name: &str, ) -> Option<T>
Source§impl<W> WxWidgetDowncast for W
impl<W> WxWidgetDowncast for W
Source§fn downcast_ref<T>(&self) -> Option<&T>where
T: WxWidget + 'static,
fn downcast_ref<T>(&self) -> Option<&T>where
T: WxWidget + 'static,
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,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: WxWidget + 'static,
Some(&mut T) if the widget is of type T, None otherwise.