Skip to content
This repository has been archived by the owner on May 12, 2022. It is now read-only.

Commit

Permalink
feat(ui): assign #SLIDER_KNOB to the knob of the slider
Browse files Browse the repository at this point in the history
  • Loading branch information
yvt committed May 16, 2020
1 parent a98bee3 commit 0b990b5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tcw3/src/ui/views/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use crate::{
ui::{
layouts::FillLayout,
theming::{
roles, ClassSet, HElem, Manager, ModifyArrangementArgs, PropKindFlags, StyledBox,
StyledBoxOverride, Widget,
elem_id, roles, ClassSet, HElem, Manager, ModifyArrangementArgs, PropKindFlags,
StyledBox, StyledBoxOverride, Widget,
},
},
uicore::{HView, HViewRef, MouseDragListener, ViewFlags, ViewListener},
Expand Down Expand Up @@ -52,11 +52,12 @@ pub use super::scrollbar::{Dir, ScrollbarDragListener};
///
/// - `style_elem > *` - Custom label views.
///
/// - `style_elem > #SLIDER_KNOB` - The knob. See
/// - `style_elem > `[`#SLIDER_KNOB`] - The knob. See
/// [`StyledBox`](crate::ui::theming::StyledBox)
///
/// [`subviews[roles::SLIDER_KNOB]`]: crate::ui::theming::roles::SLIDER_KNOB
/// [`subviews[roles::SLIDER_TICKS]`]: crate::ui::theming::roles::SLIDER_TICKS
/// [`#SLIDER_KNOB`]: crate::ui::theming::elem_id::SLIDER_KNOB
///
#[derive(Debug)]
pub struct Slider {
Expand Down Expand Up @@ -113,6 +114,7 @@ impl Slider {
frame.set_auto_class_set(ClassSet::HOVER | ClassSet::FOCUS);

let knob = StyledBox::new(style_manager, ViewFlags::default());
knob.set_class_set(elem_id::SLIDER_KNOB);
frame.set_child(roles::SLIDER_KNOB, Some(&knob));

let wrapper = HView::new(ViewFlags::ACCEPT_MOUSE_DRAG);
Expand Down

0 comments on commit 0b990b5

Please sign in to comment.