[−][src]Struct orbtk_widgets::prelude::Context
The Context
is provides access for the states to objects they could work with.
Fields
entity: Entity
theme: &'a Theme
Methods
impl<'a> Context<'a>
[src]
pub fn new(
ecs: (Entity, &'a mut EntityComponentManager<Tree, StringComponentStore>),
window_shell: &'a mut WindowShell<WindowAdapter>,
theme: &'a Theme,
render_objects: &'a RefCell<BTreeMap<Entity, Box<dyn RenderObject + 'static>>>,
layouts: &'a mut BTreeMap<Entity, Box<dyn Layout + 'static>>,
handlers: &'a mut BTreeMap<Entity, Vec<Rc<dyn EventHandler + 'static>>>,
states: &'a RefCell<BTreeMap<Entity, Box<dyn State + 'static>>>,
new_states: &'a mut BTreeMap<Entity, Box<dyn State + 'static>>
) -> Context<'a>
[src]
ecs: (Entity, &'a mut EntityComponentManager<Tree, StringComponentStore>),
window_shell: &'a mut WindowShell<WindowAdapter>,
theme: &'a Theme,
render_objects: &'a RefCell<BTreeMap<Entity, Box<dyn RenderObject + 'static>>>,
layouts: &'a mut BTreeMap<Entity, Box<dyn Layout + 'static>>,
handlers: &'a mut BTreeMap<Entity, Vec<Rc<dyn EventHandler + 'static>>>,
states: &'a RefCell<BTreeMap<Entity, Box<dyn State + 'static>>>,
new_states: &'a mut BTreeMap<Entity, Box<dyn State + 'static>>
) -> Context<'a>
Creates a new container.
pub fn get_widget(&mut self, entity: Entity) -> WidgetContainer
[src]
Returns a specific widget.
pub fn widget(&mut self) -> WidgetContainer
[src]
Returns the widget of the current state ctx.
pub fn window(&mut self) -> WidgetContainer
[src]
Returns the window widget.
pub fn child<'b>(&mut self, id: impl Into<&'b str>) -> WidgetContainer
[src]
Returns a child of the widget of the current state referenced by css id
.
If there is no id defined, it will panic.
pub fn try_child<'b>(
&mut self,
id: impl Into<&'b str>
) -> Option<WidgetContainer>
[src]
&mut self,
id: impl Into<&'b str>
) -> Option<WidgetContainer>
Returns a child of the widget of the current state referenced by css id
.
If there is no id defined, None will returned.
pub fn parent(&mut self) -> WidgetContainer
[src]
Returns the parent of the current widget. Panics if the parent does not exists.
pub fn try_parent(&mut self) -> Option<WidgetContainer>
[src]
Returns the parent of the current widget. If the current widget is the root None will be returned.
pub fn parent_from_id<'b>(&mut self, id: impl Into<&'b str>) -> WidgetContainer
[src]
Returns a parent of the widget of the current state referenced by css id
.
Panics if a parent with the given id could not be found
pub fn try_parent_from_id<'b>(
&mut self,
id: impl Into<&'b str>
) -> Option<WidgetContainer>
[src]
&mut self,
id: impl Into<&'b str>
) -> Option<WidgetContainer>
Returns a parent of the widget of the current state referenced by css id
.
If there is no id defined None will be returned.
pub fn child_from_index(&mut self, index: usize) -> WidgetContainer
[src]
Returns the child of the current widget. Panics if a child on the given index could not be found.
pub fn try_child_from_index(&mut self, index: usize) -> Option<WidgetContainer>
[src]
Returns the child of the current widget. If the index is out of the children index bounds or the widget has no children None will be returned.
pub fn build_context(&mut self) -> BuildContext
[src]
Returns the current build ctx.
pub fn append_child_to<W>(&mut self, child: W, parent: Entity) where
W: Widget,
[src]
W: Widget,
Appends a child widget to the given parent.
pub fn append_child_to_overlay<W>(&mut self, child: W) -> Result<(), String> where
W: Widget,
[src]
W: Widget,
Appends a child widget to overlay (on the top of the main tree). If the overlay does not exists an error will be returned.
pub fn append_child_entity_to(&mut self, child: Entity, parent: Entity)
[src]
Appends a child widget by entity to the given parent.
pub fn append_child_entity_to_overlay(
&mut self,
child: Entity
) -> Result<(), String>
[src]
&mut self,
child: Entity
) -> Result<(), String>
Appends a child entity to overlay (on the top of the main tree). If the overlay does not exists an error will be returned.
pub fn append_child<W>(&mut self, child: W) where
W: Widget,
[src]
W: Widget,
Appends a child to the current widget.
pub fn append_child_entity(&mut self, child: Entity)
[src]
Appends a child widget by entity to the current widget.
pub fn remove_child(&mut self, child: Entity)
[src]
Removes a child from the current widget. If the given entity is not a child of the given parent nothing will happen.
pub fn remove_child_from_overlay(&mut self, child: Entity) -> Result<(), String>
[src]
Removes a child from the overlay. If the given entity is not a child of the given parent nothing will happen.
pub fn remove_child_from(&mut self, child: Entity, parent: Entity)
[src]
Removes a child from the given parent. If the given entity is not a child of the given parent nothing will happen.
pub fn remove_widget_list(&mut self) -> &mut Vec<Entity>
[src]
Returns a mutable reference of the children that should be removed.
pub fn clear_children(&mut self)
[src]
Clears all children of the current widget.
pub fn clear_children_of(&mut self, parent: Entity)
[src]
Clears all children of the given widget.
pub fn entity_of_child<'b>(&mut self, id: impl Into<&'b str>) -> Option<Entity>
[src]
Returns the entity id of an child by the given name.
pub fn parent_entity_by_element<'b>(
&mut self,
element: impl Into<&'b str>
) -> Option<Entity>
[src]
&mut self,
element: impl Into<&'b str>
) -> Option<Entity>
Returns the entity of the parent referenced by css element
.
If there is no id defined None will be returned.
pub fn entity_of_parent(&mut self) -> Option<Entity>
[src]
Returns the entity of the parent.
pub fn index_as_child(&mut self, entity: Entity) -> Option<usize>
[src]
Returns the child index of the current entity.
pub fn send_message(
&mut self,
target_widget: &str,
message: impl Into<MessageBox>
)
[src]
&mut self,
target_widget: &str,
message: impl Into<MessageBox>
)
Sends a message to the widget with the given id over the message channel.
pub fn push_event_strategy<E>(&mut self, event: E, strategy: EventStrategy) where
E: Event,
[src]
E: Event,
Pushes an event to the event queue with the given strategy
.
pub fn push_event<E>(&mut self, event: E) where
E: Event,
[src]
E: Event,
Pushes an event to the event queue.
pub fn push_event_by_entity<E>(&mut self, event: E, entity: Entity) where
E: Event,
[src]
E: Event,
Pushes an event to the event queue.
pub fn push_event_by_window<E>(&mut self, event: E) where
E: Event,
[src]
E: Event,
Pushes an event to the event queue.
pub fn push_event_strategy_by_entity<E>(
&mut self,
event: E,
entity: Entity,
strategy: EventStrategy
) where
E: Event,
[src]
&mut self,
event: E,
entity: Entity,
strategy: EventStrategy
) where
E: Event,
Pushes an event to the event queue.
pub fn render_context_2_d(&mut self) -> &mut RenderContext2D
[src]
Returns a mutable reference of the 2d render ctx.
pub fn request_sender(&self) -> Sender<ShellRequest>
[src]
Gets a new sender to send request to the window shell.
pub fn new_states_keys(&self) -> Vec<Entity>
[src]
Returns a keys collection of new added states.
Trait Implementations
impl<'a> Drop for Context<'a>
[src]
impl<'a> HasRawWindowHandle for Context<'a>
[src]
fn raw_window_handle(&self) -> RawWindowHandle
[src]
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Context<'a>
impl<'a> !Send for Context<'a>
impl<'a> !Sync for Context<'a>
impl<'a> Unpin for Context<'a>
impl<'a> !UnwindSafe for Context<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<E> Component for E where
E: Any,
[src]
E: Any,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,