Struct microui::Context

source ·
#[repr(C)]
pub struct Context {
Show 35 fields pub char_width: Option<fn(_: FontId, _: char) -> usize>, pub font_height: Option<fn(_: FontId) -> usize>, pub draw_frame: Option<fn(_: &mut Context, _: Rect, _: ControlColor)>, pub style: Style, pub hover: Option<Id>, pub focus: Option<Id>, pub last_id: Option<Id>, pub last_rect: Rect, pub last_zindex: i32, pub updated_focus: bool, pub frame: usize, pub hover_root: Option<usize>, pub next_hover_root: Option<usize>, pub scroll_target: Option<usize>, pub number_edit_buf: FixedString<127>, pub number_edit: Option<Id>, pub command_list: FixedVec<Command, 4096>, pub root_list: FixedVec<usize, 32>, pub container_stack: FixedVec<usize, 32>, pub clip_stack: FixedVec<Rect, 32>, pub id_stack: FixedVec<Id, 32>, pub layout_stack: FixedVec<Layout, 16>, pub text_stack: FixedString<65536>, pub container_pool: Pool<48>, pub containers: [Container; 48], pub treenode_pool: Pool<48>, pub mouse_pos: Vec2i, pub last_mouse_pos: Vec2i, pub mouse_delta: Vec2i, pub scroll_delta: Vec2i, pub mouse_down: MouseButton, pub mouse_pressed: MouseButton, pub key_down: KeyMode, pub key_pressed: KeyMode, pub input_text: FixedString<32>,
}

Fields§

§char_width: Option<fn(_: FontId, _: char) -> usize>§font_height: Option<fn(_: FontId) -> usize>§draw_frame: Option<fn(_: &mut Context, _: Rect, _: ControlColor)>§style: Style§hover: Option<Id>§focus: Option<Id>§last_id: Option<Id>§last_rect: Rect§last_zindex: i32§updated_focus: bool§frame: usize§hover_root: Option<usize>§next_hover_root: Option<usize>§scroll_target: Option<usize>§number_edit_buf: FixedString<127>§number_edit: Option<Id>§command_list: FixedVec<Command, 4096>§root_list: FixedVec<usize, 32>§container_stack: FixedVec<usize, 32>§clip_stack: FixedVec<Rect, 32>§id_stack: FixedVec<Id, 32>§layout_stack: FixedVec<Layout, 16>§text_stack: FixedString<65536>§container_pool: Pool<48>§containers: [Container; 48]§treenode_pool: Pool<48>§mouse_pos: Vec2i§last_mouse_pos: Vec2i§mouse_delta: Vec2i§scroll_delta: Vec2i§mouse_down: MouseButton§mouse_pressed: MouseButton§key_down: KeyMode§key_pressed: KeyMode§input_text: FixedString<32>

Implementations§

source§

impl Context

source

pub fn new() -> Self

source

pub fn begin(&mut self)

source

pub fn end(&mut self)

source

pub fn set_focus(&mut self, id: Option<Id>)

source

pub fn get_id_u32(&mut self, orig_id: u32) -> Id

source

pub fn get_id_from_ptr<T: ?Sized>(&mut self, orig_id: &T) -> Id

source

pub fn get_id_from_str(&mut self, s: &str) -> Id

source

pub fn push_id_from_ptr<T>(&mut self, orig_id: &T)

source

pub fn push_id_from_str(&mut self, s: &str)

source

pub fn pop_id(&mut self)

source

pub fn push_clip_rect(&mut self, rect: Rect)

source

pub fn pop_clip_rect(&mut self)

source

pub fn get_clip_rect(&mut self) -> Rect

source

pub fn check_clip(&mut self, r: Rect) -> Clip

source

pub fn get_current_container(&self) -> usize

source

pub fn get_current_container_rect(&self) -> Rect

source

pub fn set_current_container_rect(&mut self, rect: &Rect)

source

pub fn get_current_container_scroll(&self) -> Vec2i

source

pub fn set_current_container_scroll(&mut self, scroll: &Vec2i)

source

pub fn get_current_container_content_size(&self) -> Vec2i

source

pub fn get_current_container_body(&self) -> Rect

source

pub fn bring_to_front(&mut self, cnt: usize)

source

pub fn input_mousemove(&mut self, x: i32, y: i32)

source

pub fn input_mousedown(&mut self, x: i32, y: i32, btn: MouseButton)

source

pub fn input_mouseup(&mut self, x: i32, y: i32, btn: MouseButton)

source

pub fn input_scroll(&mut self, x: i32, y: i32)

source

pub fn input_keydown(&mut self, key: KeyMode)

source

pub fn input_keyup(&mut self, key: KeyMode)

source

pub fn input_text(&mut self, text: &str)

source

pub fn push_command(&mut self, cmd: Command) -> (&mut Command, usize)

source

pub fn push_text(&mut self, str: &str) -> usize

source

pub fn mu_next_command(&mut self, cmd_id: usize) -> Option<(Command, usize)>

returns the next command to execute and the next index to use

source

pub fn set_clip(&mut self, rect: Rect)

source

pub fn draw_rect(&mut self, rect: Rect, color: Color)

source

pub fn draw_box(&mut self, r: Rect, color: Color)

source

pub fn draw_text(&mut self, font: FontId, str: &str, pos: Vec2i, color: Color)

source

pub fn draw_icon(&mut self, id: Icon, rect: Rect, color: Color)

source

pub fn layout_begin_column(&mut self)

source

pub fn layout_end_column(&mut self)

source

pub fn layout_row_for_layout(layout: &mut Layout, widths: &[i32], height: i32)

source

pub fn layout_row(&mut self, widths: &[i32], height: i32)

source

pub fn layout_width(&mut self, width: i32)

source

pub fn layout_height(&mut self, height: i32)

source

pub fn layout_set_next(&mut self, r: Rect, position: LayoutPosition)

source

pub fn layout_next(&mut self) -> Rect

source

pub fn draw_control_frame( &mut self, id: Id, rect: Rect, colorid: ControlColor, opt: WidgetOption )

source

pub fn draw_control_text( &mut self, str: &str, rect: Rect, colorid: ControlColor, opt: WidgetOption )

source

pub fn mouse_over(&mut self, rect: Rect) -> bool

source

pub fn update_control(&mut self, id: Id, rect: Rect, opt: WidgetOption)

source

pub fn get_text_width(&self, font: FontId, text: &str) -> i32

source

pub fn get_text_height(&self, font: FontId, text: &str) -> i32

source

pub fn text(&mut self, text: &str)

source

pub fn label(&mut self, text: &str)

source

pub fn button_ex( &mut self, label: &str, icon: Icon, opt: WidgetOption ) -> ResourceState

source

pub fn checkbox(&mut self, label: &str, state: &mut bool) -> ResourceState

source

pub fn textbox_raw( &mut self, buf: &mut dyn IString, id: Id, r: Rect, opt: WidgetOption ) -> ResourceState

source

pub fn textbox_ex( &mut self, buf: &mut dyn IString, opt: WidgetOption ) -> ResourceState

source

pub fn slider_ex( &mut self, value: &mut Real, low: Real, high: Real, step: Real, precision: usize, opt: WidgetOption ) -> ResourceState

source

pub fn number_ex( &mut self, value: &mut Real, step: Real, precision: usize, opt: WidgetOption ) -> ResourceState

source

pub fn header_ex(&mut self, label: &str, opt: WidgetOption) -> ResourceState

source

pub fn begin_treenode_ex( &mut self, label: &str, opt: WidgetOption ) -> ResourceState

source

pub fn end_treenode(&mut self)

source

pub fn begin_window_ex( &mut self, title: &str, r: Rect, opt: WidgetOption ) -> ResourceState

source

pub fn end_window(&mut self)

source

pub fn open_popup(&mut self, name: &str)

source

pub fn begin_popup(&mut self, name: &str) -> ResourceState

source

pub fn end_popup(&mut self)

source

pub fn begin_panel_ex(&mut self, name: &str, opt: WidgetOption)

source

pub fn end_panel(&mut self)

Trait Implementations§

source§

impl Default for Context

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.