[−][src]Struct amethyst_ui::UiButtonBuilder
Convenience structure for building a button
Methods
impl<'a, G: PartialEq + Send + Sync + 'static, I: WidgetId> UiButtonBuilder<G, I>
[src]
pub fn new<S: ToString>(text: S) -> UiButtonBuilder<G, I>
[src]
Construct a new UiButtonBuilder.
This allows easy use of default values for text and button appearance and allows the user
to easily set other UI-related options. It also allows easy retrieval and updating through
the appropriate widgets resouce, see Widgets
.
pub fn with_id(self, id: I) -> Self
[src]
Sets an ID for this widget. The type of this ID will determine which Widgets
resource this widget will be added to, see see Widgets
.
pub fn with_parent(self, parent: Entity) -> Self
[src]
Add a parent to the button.
pub fn with_anchor(self, anchor: Anchor) -> Self
[src]
Add an anchor to the button.
pub fn with_stretch(self, stretch: Stretch) -> Self
[src]
Stretch the button.
pub fn with_text<S>(self, text: S) -> Self where
S: ToString,
[src]
S: ToString,
This will set the rendered characters within the button. Use this to just change what
characters will appear. If you need to change the font size, color, etc., then you should
use
with_uitext
and provide a new UiText
object.
pub fn with_image(self, image: Handle<Texture>) -> Self
[src]
Replace the default Handleimage
.
pub fn with_font(self, font: FontHandle) -> Self
[src]
Use a different font for the button text.
pub fn with_position(self, x: f32, y: f32) -> Self
[src]
Provide an X and Y position for the button.
This will create a default UiTransform if one is not already attached.
See DEFAULT_Z
, DEFAULT_WIDTH
, DEFAULT_HEIGHT
, and DEFAULT_TAB_ORDER
for
the values that will be provided to the default UiTransform.
pub fn with_layer(self, z: f32) -> Self
[src]
Provide a Z position, i.e UI layer
pub fn with_size(self, width: f32, height: f32) -> Self
[src]
Set button size
pub fn with_tab_order(self, tab_order: u32) -> Self
[src]
Set button tab order
pub fn with_font_size(self, size: f32) -> Self
[src]
Set font size
pub fn with_text_color(self, text_color: [f32; 4]) -> Self
[src]
Set text color
pub fn with_hover_text_color(self, text_color: [f32; 4]) -> Self
[src]
Text color to use when the mouse is hovering over this button
pub fn with_press_text_color(self, text_color: [f32; 4]) -> Self
[src]
Set text color when the button is pressed
pub fn with_hover_image(self, image: UiImage) -> Self
[src]
Button image to use when the mouse is hovering over this button
pub fn with_press_image(self, image: UiImage) -> Self
[src]
Button image to use when this button is pressed
pub fn with_hover_sound(self, sound: SourceHandle) -> Self
[src]
Sound emitted when this button is hovered over
pub fn with_press_sound(self, sound: SourceHandle) -> Self
[src]
Sound emitted when this button is pressed
pub fn with_release_sound(self, sound: SourceHandle) -> Self
[src]
Sound emitted when this button is released
pub fn build(self, res: UiButtonBuilderResources<'a, G, I>) -> (I, UiButton)
[src]
Build this with the UiButtonBuilderResources
.
pub fn build_from_world(self, world: &World) -> (I, UiButton)
[src]
Create the UiButton based on provided configuration parameters.
Trait Implementations
impl<G, I> Default for UiButtonBuilder<G, I> where
I: WidgetId,
[src]
I: WidgetId,
impl<G: Clone, I: Clone + WidgetId> Clone for UiButtonBuilder<G, I>
[src]
fn clone(&self) -> UiButtonBuilder<G, I>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<G: Debug, I: Debug + WidgetId> Debug for UiButtonBuilder<G, I>
[src]
Auto Trait Implementations
impl<G, I> Unpin for UiButtonBuilder<G, I> where
G: Unpin,
I: Unpin,
G: Unpin,
I: Unpin,
impl<G, I> Sync for UiButtonBuilder<G, I> where
G: Sync,
G: Sync,
impl<G, I> Send for UiButtonBuilder<G, I> where
G: Send,
G: Send,
impl<G, I> UnwindSafe for UiButtonBuilder<G, I> where
G: UnwindSafe,
I: UnwindSafe,
G: UnwindSafe,
I: UnwindSafe,
impl<G, I> RefUnwindSafe for UiButtonBuilder<G, I> where
G: RefUnwindSafe,
I: RefUnwindSafe,
G: RefUnwindSafe,
I: RefUnwindSafe,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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<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<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
[src]
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
[src]
fn is_in_subset(&self) -> bool
[src]
unsafe fn to_subset_unchecked(&self) -> SS
[src]
fn from_subset(element: &SS) -> SP
[src]
impl<T> Resource for T where
T: Any + Send + Sync,
[src]
T: Any + Send + Sync,
impl<T> Any for T where
T: Any,
[src]
T: Any,
fn get_type_id(&self) -> TypeId
[src]
impl<T> TryDefault for T where
T: Default,
[src]
T: Default,
fn try_default() -> Result<T, String>
[src]
fn unwrap_default() -> Self
[src]
Calls try_default
and panics on an error case.
impl<T> Event for T where
T: Send + Sync + 'static,
[src]
T: Send + Sync + 'static,
impl<T> Erased for T
[src]
impl<T> Clone for T where
T: Clone,
[src]
T: Clone,
impl<T> SetParameter for T
[src]
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
[src]
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<T> Supports<T> for T
[src]
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
[src]
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into(self) -> D
[src]
Convert the source color to the destination color using the bradford method by default Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,