pub struct ProgressBar {
pub handle: ControlHandle,
}
Expand description
A progress bar is a window that an application can use to indicate the progress of a lengthy operation.
Requires the progress-bar
feature.
Builder parameters:
parent
: Required. The progress bar parent container.size
: The progress bar size.position
: The progress bar position.state
: The initial state of the progress bar.step
: The value in which the progress bar value increase whenadvance
is used.pos
: The initial value of the progress bar.range
: The minimum and maximum value in the progress bar.enabled
: If the progress bar is enabled.flags
: A combination of the ProgressBarFlags values.ex_flags
: A combination of win32 window extended flags. Unlikeflags
, ex_flags must be used straight from winapimarquee
: Enable of disable the marquee animation (only used with the MARQUEE flags)marquee_update
: The update interval of the marquee mode
Control events:
MousePress(_)
: Generic mouse press events on the progress barOnMouseMove
: Generic mouse mouse eventOnMouseWheel
: Generic mouse wheel event
use native_windows_gui as nwg;
fn build_progress_bar(bar: &mut nwg::ProgressBar, window: &nwg::Window) {
nwg::ProgressBar::builder()
.state(nwg::ProgressBarState::Paused)
.step(10)
.range(0..100)
.parent(window)
.build(bar);
}
Fields§
§handle: ControlHandle
Implementations§
Source§impl ProgressBar
impl ProgressBar
pub fn builder() -> ProgressBarBuilder
Sourcepub fn state(&self) -> ProgressBarState
pub fn state(&self) -> ProgressBarState
Return the current state of the progress bar
Sourcepub fn set_state(&self, state: ProgressBarState)
pub fn set_state(&self, state: ProgressBarState)
Set the state of the progress bar
Sourcepub fn advance_delta(&self, v: u32)
pub fn advance_delta(&self, v: u32)
Increase the bar value by a value
Sourcepub fn set_pos(&self, p: u32)
pub fn set_pos(&self, p: u32)
Set the position of the progress bar. If the value is outside of range sets the value to the nearest bound.
Sourcepub fn set_marquee(&self, enable: bool, update_interval: u32)
pub fn set_marquee(&self, enable: bool, update_interval: u32)
Set the progress bar marquee mode
Sourcepub fn add_flags(&self, styles: ProgressBarFlags)
pub fn add_flags(&self, styles: ProgressBarFlags)
Updates the flags of the progress bar.
Sourcepub fn remove_flags(&self, styles: ProgressBarFlags)
pub fn remove_flags(&self, styles: ProgressBarFlags)
Removes flags from the progress bar.
Sourcepub fn enabled(&self) -> bool
pub fn enabled(&self) -> bool
Return true if the control user can interact with the control, return false otherwise
Sourcepub fn set_enabled(&self, v: bool)
pub fn set_enabled(&self, v: bool)
Enable or disable the control
Sourcepub fn visible(&self) -> bool
pub fn visible(&self) -> bool
Return true if the control is visible to the user. Will return true even if the control is outside of the parent client view (ex: at the position (10000, 10000))
Sourcepub fn set_visible(&self, v: bool)
pub fn set_visible(&self, v: bool)
Show or hide the control to the user
Sourcepub fn set_position(&self, x: i32, y: i32)
pub fn set_position(&self, x: i32, y: i32)
Set the position of the button in the parent window
Sourcepub fn class_name(&self) -> &'static str
pub fn class_name(&self) -> &'static str
Winapi class name used during control creation
Sourcepub fn forced_flags(&self) -> u32
pub fn forced_flags(&self) -> u32
Winapi flags required by the control