Trait TkWidget

Source
pub trait TkWidget {
Show 22 methods // Required method fn id(&self) -> &str; // Provided methods fn bind(&self, pattern: &str, command: impl Fn(TkEvent) + Send + 'static) { ... } fn cget(&self, option: &str) -> String { ... } fn configure(&self, option: &str, value: &str) { ... } fn destroy(&self) { ... } fn winfo(&self, option: &str) -> String { ... } fn focus(&self) { ... } fn position_x(&self) -> u64 { ... } fn position_y(&self) -> u64 { ... } fn widget_height(&self) -> u64 { ... } fn widget_width(&self) -> u64 { ... } fn mouse_position(&self) -> (i64, i64) { ... } fn mouse_x(&self) -> i64 { ... } fn mouse_y(&self) -> i64 { ... } fn screen_height(&self) -> u64 { ... } fn screen_height_mm(&self) -> u64 { ... } fn screen_width(&self) -> u64 { ... } fn screen_width_mm(&self) -> u64 { ... } fn lower(&self) { ... } fn raise(&self) { ... } fn grid_configure_column(&self, index: u64, option: &str, value: &str) { ... } fn grid_configure_row(&self, index: u64, option: &str, value: &str) { ... }
}
Expand description

Common trait for container widgets. Child widgets should implement the id method. The remaining methods are standard Tk methods and convenient, type-safe versions of them.

Required Methods§

Source

fn id(&self) -> &str

Returns the widget’s id reference - used within tk

Provided Methods§

Source

fn bind(&self, pattern: &str, command: impl Fn(TkEvent) + Send + 'static)

Binds a command to this widget to call on given event pattern

Source

fn cget(&self, option: &str) -> String

Retrieve the value of a configuration option as a string.

  • option - the option to read
Source

fn configure(&self, option: &str, value: &str)

Used to change properties of a widget. This function can be used to directly configure the widget using an option-value string pair:

  • option - the option to change
  • value - the value to change it to
Source

fn destroy(&self)

Destroys a widget and its children.

Source

fn winfo(&self, option: &str) -> String

winfo retrieves information about widget.

Source

fn focus(&self)

Makes this widget the focus window (e.g. for key presses)

Source

fn position_x(&self) -> u64

Returns the widget x position in pixels, within its parent.

Source

fn position_y(&self) -> u64

Returns the widget y position in pixels, within its parent.

Source

fn widget_height(&self) -> u64

Returns the widget height in pixels.

Source

fn widget_width(&self) -> u64

Returns the widget width in pixels.

Source

fn mouse_position(&self) -> (i64, i64)

Returns the position of the mouse on screen of widget as (x,y).

Source

fn mouse_x(&self) -> i64

Gives the x position of the mouse on screen of widget.

Source

fn mouse_y(&self) -> i64

Gives the y position of the mouse on screen of widget.

Source

fn screen_height(&self) -> u64

Height of screen of widget in pixels.

Source

fn screen_height_mm(&self) -> u64

Height of screen of widget in millimetres.

Source

fn screen_width(&self) -> u64

Width of screen of widget in pixels.

Source

fn screen_width_mm(&self) -> u64

Width of screen of widget in millimetres.

Source

fn lower(&self)

Lowers the widget in stacking order.

Source

fn raise(&self)

Raises the widget in stacking order.

Source

fn grid_configure_column(&self, index: u64, option: &str, value: &str)

Sets property for a given column of the grid layout contained within this widget.

Source

fn grid_configure_row(&self, index: u64, option: &str, value: &str)

Sets property for a given row of the grid layout contained within this widget.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§