#[repr(transparent)]pub struct Assistant { /* private fields */ }
Expand description
Assistant
is used to represent a complex as a series of steps.
Each step consists of one or more pages. Assistant
guides the user
through the pages, and controls the page flow to collect the data needed
for the operation.
Assistant
handles which buttons to show and to make sensitive based
on page sequence knowledge and the AssistantPageType
of each
page in addition to state information like the completed and committed
page statuses.
If you have a case that doesn’t quite fit in Assistant
s way of
handling buttons, you can use the AssistantPageType::Custom
page
type and handle buttons yourself.
Assistant
maintains a AssistantPage
object for each added
child, which holds additional per-child properties. You
obtain the AssistantPage
for a child with page()
.
GtkAssistant as GtkBuildable
The Assistant
implementation of the Buildable
interface
exposes the @action_area as internal children with the name
“action_area”.
To add pages to an assistant in Builder
, simply add it as a
child to the Assistant
object. If you need to set per-object
properties, create a AssistantPage
object explicitly, and
set the child widget as a property on it.
CSS nodes
Assistant
has a single CSS node with the name window and style
class .assistant.
Implements
GtkWindowExt
, WidgetExt
, glib::ObjectExt
, AccessibleExt
, BuildableExt
, ConstraintTargetExt
, NativeExt
, RootExt
, ShortcutManagerExt
, WidgetExtManual
, AccessibleExtManual
Implementations§
source§impl Assistant
impl Assistant
sourcepub fn builder() -> AssistantBuilder
pub fn builder() -> AssistantBuilder
Creates a new builder-pattern struct instance to construct Assistant
objects.
This method returns an instance of AssistantBuilder
which can be used to create Assistant
objects.
sourcepub fn add_action_widget(&self, child: &impl IsA<Widget>)
pub fn add_action_widget(&self, child: &impl IsA<Widget>)
sourcepub fn append_page(&self, page: &impl IsA<Widget>) -> i32
pub fn append_page(&self, page: &impl IsA<Widget>) -> i32
sourcepub fn commit(&self)
pub fn commit(&self)
Erases the visited page history.
GTK will then hide the back button on the current page, and removes the cancel button from subsequent pages.
Use this when the information provided up to the current page is hereafter deemed permanent and cannot be modified or undone. For example, showing a progress page to track a long-running, unreversible operation after the user has clicked apply on a confirmation page.
sourcepub fn current_page(&self) -> i32
pub fn current_page(&self) -> i32
Returns the page number of the current page.
Returns
The index (starting from 0) of the current page in the @self, or -1 if the @self has no pages, or no current page
sourcepub fn page(&self, child: &impl IsA<Widget>) -> AssistantPage
pub fn page(&self, child: &impl IsA<Widget>) -> AssistantPage
Returns the AssistantPage
object for @child.
child
a child of @self
Returns
the AssistantPage
for @child
sourcepub fn page_is_complete(&self, page: &impl IsA<Widget>) -> bool
pub fn page_is_complete(&self, page: &impl IsA<Widget>) -> bool
sourcepub fn page_title(&self, page: &impl IsA<Widget>) -> GString
pub fn page_title(&self, page: &impl IsA<Widget>) -> GString
sourcepub fn page_type(&self, page: &impl IsA<Widget>) -> AssistantPageType
pub fn page_type(&self, page: &impl IsA<Widget>) -> AssistantPageType
sourcepub fn next_page(&self)
pub fn next_page(&self)
Navigate to the next page.
It is a programming error to call this function when there is no next page.
This function is for use when creating pages of the
AssistantPageType::Custom
type.
sourcepub fn prepend_page(&self, page: &impl IsA<Widget>) -> i32
pub fn prepend_page(&self, page: &impl IsA<Widget>) -> i32
sourcepub fn previous_page(&self)
pub fn previous_page(&self)
Navigate to the previous visited page.
It is a programming error to call this function when no previous page is available.
This function is for use when creating pages of the
AssistantPageType::Custom
type.
sourcepub fn remove_action_widget(&self, child: &impl IsA<Widget>)
pub fn remove_action_widget(&self, child: &impl IsA<Widget>)
sourcepub fn remove_page(&self, page_num: i32)
pub fn remove_page(&self, page_num: i32)
Removes the @page_num’s page from @self.
page_num
the index of a page in the @self, or -1 to remove the last page
sourcepub fn set_current_page(&self, page_num: i32)
pub fn set_current_page(&self, page_num: i32)
Switches the page to @page_num.
Note that this will only be necessary in custom buttons, as the @self flow can be set with gtk_assistant_set_forward_page_func().
page_num
index of the page to switch to, starting from 0. If negative, the last page will be used. If greater than the number of pages in the @self, nothing will be done.
sourcepub fn set_forward_page_func<P: Fn(i32) -> i32 + 'static>(&self, page_func: P)
pub fn set_forward_page_func<P: Fn(i32) -> i32 + 'static>(&self, page_func: P)
Sets the page forwarding function to be @page_func.
This function will be used to determine what will be
the next page when the user presses the forward button.
Setting @page_func to None
will make the assistant to
use the default forward function, which just goes to the
next visible page.
page_func
the GtkAssistantPageFunc
, or None
to use the default one
sourcepub fn set_page_complete(&self, page: &impl IsA<Widget>, complete: bool)
pub fn set_page_complete(&self, page: &impl IsA<Widget>, complete: bool)
sourcepub fn set_page_title(&self, page: &impl IsA<Widget>, title: &str)
pub fn set_page_title(&self, page: &impl IsA<Widget>, title: &str)
sourcepub fn set_page_type(&self, page: &impl IsA<Widget>, type_: AssistantPageType)
pub fn set_page_type(&self, page: &impl IsA<Widget>, type_: AssistantPageType)
Forces @self to recompute the buttons state.
GTK automatically takes care of this in most situations, e.g. when the user goes to a different page, or when the visibility or completeness of a page changes.
One situation where it can be necessary to call this function is when changing a value on the current page affects the future page flow of the assistant.
sourcepub fn use_header_bar(&self) -> i32
pub fn use_header_bar(&self) -> i32
sourcepub fn connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
pub fn connect_apply<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when the apply button is clicked.
The default behavior of the Assistant
is to switch to the page
after the current page, unless the current page is the last one.
A handler for the ::apply signal should carry out the actions for
which the wizard has collected data. If the action takes a long time
to complete, you might consider putting a page of type
AssistantPageType::Progress
after the confirmation page and handle
this operation within the signal::Assistant::prepare
signal of
the progress page.
sourcepub fn connect_cancel<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
pub fn connect_cancel<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted when then the cancel button is clicked.
sourcepub fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
pub fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
Emitted either when the close button of a summary page is clicked,
or when the apply button in the last page in the flow (of type
AssistantPageType::Confirm
) is clicked.
sourcepub fn connect_escape<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
pub fn connect_escape<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId
The action signal for the Escape binding.
pub fn emit_escape(&self)
sourcepub fn connect_prepare<F: Fn(&Self, &Widget) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_prepare<F: Fn(&Self, &Widget) + 'static>(
&self,
f: F
) -> SignalHandlerId
Emitted when a new page is set as the assistant’s current page, before making the new page visible.
A handler for this signal can do any preparations which are necessary before showing @page.
page
the current page
pub fn connect_pages_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
source§impl Assistant
impl Assistant
pub fn unset_forward_page_func(&self)
Trait Implementations§
source§impl Ord for Assistant
impl Ord for Assistant
source§impl<OT: ObjectType> PartialEq<OT> for Assistant
impl<OT: ObjectType> PartialEq<OT> for Assistant
source§impl<OT: ObjectType> PartialOrd<OT> for Assistant
impl<OT: ObjectType> PartialOrd<OT> for Assistant
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StaticType for Assistant
impl StaticType for Assistant
source§fn static_type() -> Type
fn static_type() -> Type
Self
.impl Eq for Assistant
impl IsA<Accessible> for Assistant
impl IsA<Buildable> for Assistant
impl IsA<ConstraintTarget> for Assistant
impl IsA<Native> for Assistant
impl IsA<Root> for Assistant
impl IsA<ShortcutManager> for Assistant
impl IsA<Widget> for Assistant
impl IsA<Window> for Assistant
Auto Trait Implementations§
impl RefUnwindSafe for Assistant
impl !Send for Assistant
impl !Sync for Assistant
impl Unpin for Assistant
impl UnwindSafe for Assistant
Blanket Implementations§
source§impl<O> AccessibleExtManual for Owhere
O: IsA<Accessible>,
impl<O> AccessibleExtManual for Owhere
O: IsA<Accessible>,
source§fn update_property(&self, properties: &[Property<'_>])
fn update_property(&self, properties: &[Property<'_>])
source§fn update_relation(&self, relations: &[Relation<'_>])
fn update_relation(&self, relations: &[Relation<'_>])
source§fn update_state(&self, states: &[State])
fn update_state(&self, states: &[State])
source§impl<T> Cast for Twhere
T: ObjectType,
impl<T> Cast for Twhere
T: ObjectType,
source§fn upcast<T>(self) -> Twhere
T: ObjectType,
Self: IsA<T>,
fn upcast<T>(self) -> Twhere
T: ObjectType,
Self: IsA<T>,
T
. Read moresource§fn upcast_ref<T>(&self) -> &Twhere
T: ObjectType,
Self: IsA<T>,
fn upcast_ref<T>(&self) -> &Twhere
T: ObjectType,
Self: IsA<T>,
T
. Read moresource§fn downcast<T>(self) -> Result<T, Self>where
T: ObjectType,
Self: CanDowncast<T>,
fn downcast<T>(self) -> Result<T, Self>where
T: ObjectType,
Self: CanDowncast<T>,
T
. Read moresource§fn downcast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
Self: CanDowncast<T>,
fn downcast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
Self: CanDowncast<T>,
T
. Read moresource§fn dynamic_cast<T>(self) -> Result<T, Self>where
T: ObjectType,
fn dynamic_cast<T>(self) -> Result<T, Self>where
T: ObjectType,
T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read moresource§fn dynamic_cast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
fn dynamic_cast_ref<T>(&self) -> Option<&T>where
T: ObjectType,
T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read moresource§unsafe fn unsafe_cast<T>(self) -> Twhere
T: ObjectType,
unsafe fn unsafe_cast<T>(self) -> Twhere
T: ObjectType,
T
unconditionally. Read moresource§unsafe fn unsafe_cast_ref<T>(&self) -> &Twhere
T: ObjectType,
unsafe fn unsafe_cast_ref<T>(&self) -> &Twhere
T: ObjectType,
&T
unconditionally. Read moresource§impl<U> IsSubclassableExt for Uwhere
U: IsClass + ParentClassIs,
impl<U> IsSubclassableExt for Uwhere
U: IsClass + ParentClassIs,
fn parent_class_init<T>(class: &mut Class<U>)where
T: ObjectSubclass,
<U as ParentClassIs>::Parent: IsSubclassable<T>,
fn parent_instance_init<T>(instance: &mut InitializingObject<T>)where
T: ObjectSubclass,
<U as ParentClassIs>::Parent: IsSubclassable<T>,
source§impl<T> ObjectExt for Twhere
T: ObjectType,
impl<T> ObjectExt for Twhere
T: ObjectType,
source§fn is<U>(&self) -> boolwhere
U: StaticType,
fn is<U>(&self) -> boolwhere
U: StaticType,
true
if the object is an instance of (can be cast to) T
.source§fn object_class(&self) -> &Class<Object>
fn object_class(&self) -> &Class<Object>
ObjectClass
of the object. Read moresource§fn class_of<U>(&self) -> Option<&Class<U>>where
U: IsClass,
fn class_of<U>(&self) -> Option<&Class<U>>where
U: IsClass,
T
. Read moresource§fn interface<U>(&self) -> Option<InterfaceRef<'_, U>>where
U: IsInterface,
fn interface<U>(&self) -> Option<InterfaceRef<'_, U>>where
U: IsInterface,
T
of the object. Read moresource§fn set_property<V>(&self, property_name: &str, value: V)where
V: ToValue,
fn set_property<V>(&self, property_name: &str, value: V)where
V: ToValue,
source§fn set_property_from_value(&self, property_name: &str, value: &Value)
fn set_property_from_value(&self, property_name: &str, value: &Value)
source§fn set_properties(&self, property_values: &[(&str, &dyn ToValue)])
fn set_properties(&self, property_values: &[(&str, &dyn ToValue)])
source§fn set_properties_from_value(&self, property_values: &[(&str, Value)])
fn set_properties_from_value(&self, property_values: &[(&str, Value)])
source§fn property<V>(&self, property_name: &str) -> Vwhere
V: 'static + for<'b> FromValue<'b>,
fn property<V>(&self, property_name: &str) -> Vwhere
V: 'static + for<'b> FromValue<'b>,
property_name
of the object and cast it to the type V. Read moresource§fn property_value(&self, property_name: &str) -> Value
fn property_value(&self, property_name: &str) -> Value
property_name
of the object. Read moresource§fn property_type(&self, property_name: &str) -> Option<Type>
fn property_type(&self, property_name: &str) -> Option<Type>
property_name
of this object. Read moresource§fn find_property(&self, property_name: &str) -> Option<ParamSpec>
fn find_property(&self, property_name: &str) -> Option<ParamSpec>
ParamSpec
of the property property_name
of this object.source§fn list_properties(&self) -> PtrSlice<ParamSpec>
fn list_properties(&self) -> PtrSlice<ParamSpec>
ParamSpec
of the properties of this object.source§fn freeze_notify(&self) -> PropertyNotificationFreezeGuard
fn freeze_notify(&self) -> PropertyNotificationFreezeGuard
source§unsafe fn set_qdata<QD>(&self, key: Quark, value: QD)where
QD: 'static,
unsafe fn set_qdata<QD>(&self, key: Quark, value: QD)where
QD: 'static,
key
. Read moresource§unsafe fn qdata<QD>(&self, key: Quark) -> Option<NonNull<QD>>where
QD: 'static,
unsafe fn qdata<QD>(&self, key: Quark) -> Option<NonNull<QD>>where
QD: 'static,
key
. Read moresource§unsafe fn steal_qdata<QD>(&self, key: Quark) -> Option<QD>where
QD: 'static,
unsafe fn steal_qdata<QD>(&self, key: Quark) -> Option<QD>where
QD: 'static,
key
. Read moresource§unsafe fn set_data<QD>(&self, key: &str, value: QD)where
QD: 'static,
unsafe fn set_data<QD>(&self, key: &str, value: QD)where
QD: 'static,
key
. Read moresource§unsafe fn data<QD>(&self, key: &str) -> Option<NonNull<QD>>where
QD: 'static,
unsafe fn data<QD>(&self, key: &str) -> Option<NonNull<QD>>where
QD: 'static,
key
. Read moresource§unsafe fn steal_data<QD>(&self, key: &str) -> Option<QD>where
QD: 'static,
unsafe fn steal_data<QD>(&self, key: &str) -> Option<QD>where
QD: 'static,
key
. Read moresource§fn block_signal(&self, handler_id: &SignalHandlerId)
fn block_signal(&self, handler_id: &SignalHandlerId)
source§fn unblock_signal(&self, handler_id: &SignalHandlerId)
fn unblock_signal(&self, handler_id: &SignalHandlerId)
source§fn stop_signal_emission(&self, signal_id: SignalId, detail: Option<Quark>)
fn stop_signal_emission(&self, signal_id: SignalId, detail: Option<Quark>)
source§fn stop_signal_emission_by_name(&self, signal_name: &str)
fn stop_signal_emission_by_name(&self, signal_name: &str)
source§fn connect<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
fn connect<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
signal_name
on this object. Read moresource§fn connect_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
fn connect_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
signal_id
on this object. Read moresource§fn connect_local<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value>,
fn connect_local<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value>,
signal_name
on this object. Read moresource§fn connect_local_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value>,
fn connect_local_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: 'static + Fn(&[Value]) -> Option<Value>,
signal_id
on this object. Read moresource§unsafe fn connect_unsafe<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: Fn(&[Value]) -> Option<Value>,
unsafe fn connect_unsafe<F>(
&self,
signal_name: &str,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: Fn(&[Value]) -> Option<Value>,
signal_name
on this object. Read moresource§unsafe fn connect_unsafe_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: Fn(&[Value]) -> Option<Value>,
unsafe fn connect_unsafe_id<F>(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
callback: F
) -> SignalHandlerIdwhere
F: Fn(&[Value]) -> Option<Value>,
signal_id
on this object. Read moresource§fn connect_closure(
&self,
signal_name: &str,
after: bool,
closure: RustClosure
) -> SignalHandlerId
fn connect_closure(
&self,
signal_name: &str,
after: bool,
closure: RustClosure
) -> SignalHandlerId
signal_name
on this object. Read moresource§fn connect_closure_id(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
closure: RustClosure
) -> SignalHandlerId
fn connect_closure_id(
&self,
signal_id: SignalId,
details: Option<Quark>,
after: bool,
closure: RustClosure
) -> SignalHandlerId
signal_id
on this object. Read moresource§fn watch_closure(&self, closure: &impl AsRef<Closure>)
fn watch_closure(&self, closure: &impl AsRef<Closure>)
closure
to the lifetime of the object. When
the object’s reference count drops to zero, the closure will be
invalidated. An invalidated closure will ignore any calls to
invoke_with_values
, or
invoke
when using Rust closures.source§fn emit<R>(&self, signal_id: SignalId, args: &[&dyn ToValue]) -> Rwhere
R: TryFromClosureReturnValue,
fn emit<R>(&self, signal_id: SignalId, args: &[&dyn ToValue]) -> Rwhere
R: TryFromClosureReturnValue,
source§fn emit_with_values(&self, signal_id: SignalId, args: &[Value]) -> Option<Value>
fn emit_with_values(&self, signal_id: SignalId, args: &[Value]) -> Option<Value>
Self::emit
but takes Value
for the arguments.source§fn emit_by_name<R>(&self, signal_name: &str, args: &[&dyn ToValue]) -> Rwhere
R: TryFromClosureReturnValue,
fn emit_by_name<R>(&self, signal_name: &str, args: &[&dyn ToValue]) -> Rwhere
R: TryFromClosureReturnValue,
source§fn emit_by_name_with_values(
&self,
signal_name: &str,
args: &[Value]
) -> Option<Value>
fn emit_by_name_with_values(
&self,
signal_name: &str,
args: &[Value]
) -> Option<Value>
source§fn emit_by_name_with_details<R>(
&self,
signal_name: &str,
details: Quark,
args: &[&dyn ToValue]
) -> Rwhere
R: TryFromClosureReturnValue,
fn emit_by_name_with_details<R>(
&self,
signal_name: &str,
details: Quark,
args: &[&dyn ToValue]
) -> Rwhere
R: TryFromClosureReturnValue,
source§fn emit_by_name_with_details_and_values(
&self,
signal_name: &str,
details: Quark,
args: &[Value]
) -> Option<Value>
fn emit_by_name_with_details_and_values(
&self,
signal_name: &str,
details: Quark,
args: &[Value]
) -> Option<Value>
source§fn emit_with_details<R>(
&self,
signal_id: SignalId,
details: Quark,
args: &[&dyn ToValue]
) -> Rwhere
R: TryFromClosureReturnValue,
fn emit_with_details<R>(
&self,
signal_id: SignalId,
details: Quark,
args: &[&dyn ToValue]
) -> Rwhere
R: TryFromClosureReturnValue,
source§fn emit_with_details_and_values(
&self,
signal_id: SignalId,
details: Quark,
args: &[Value]
) -> Option<Value>
fn emit_with_details_and_values(
&self,
signal_id: SignalId,
details: Quark,
args: &[Value]
) -> Option<Value>
source§fn disconnect(&self, handler_id: SignalHandlerId)
fn disconnect(&self, handler_id: SignalHandlerId)
source§fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerIdwhere
F: 'static + Fn(&T, &ParamSpec) + Send + Sync,
fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerIdwhere
F: 'static + Fn(&T, &ParamSpec) + Send + Sync,
notify
signal of the object. Read moresource§fn connect_notify_local<F>(&self, name: Option<&str>, f: F) -> SignalHandlerIdwhere
F: 'static + Fn(&T, &ParamSpec),
fn connect_notify_local<F>(&self, name: Option<&str>, f: F) -> SignalHandlerIdwhere
F: 'static + Fn(&T, &ParamSpec),
notify
signal of the object. Read moresource§unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerIdwhere
F: Fn(&T, &ParamSpec),
unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerIdwhere
F: Fn(&T, &ParamSpec),
notify
signal of the object. Read more