Skip to content

Commit

Permalink
Gallery: revise accelerator keys
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Jul 16, 2022
1 parent c6ff3d3 commit 173dd39
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
14 changes: 7 additions & 7 deletions crates/kas-view/src/driver/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl_scope! {
0, 8: "Mouse text pan:"; 1..3, 8: self.mouse_text_pan;
1..3, 9: self.mouse_nav_focus;
1..3, 10: self.touch_nav_focus;
0, 11: "Restore default values:"; 1..3, 11: TextButton::new_msg("Reset", Msg::Reset);
0, 11: "Restore default values:"; 1..3, 11: TextButton::new_msg("&Reset", Msg::Reset);
};
}]
#[derive(Debug)]
Expand Down Expand Up @@ -71,10 +71,10 @@ impl driver::Driver<Config, SharedRc<Config>> for EventConfig {

fn make(&self) -> Self::Widget {
let mouse_pan = ComboBox::from([
("Never", MousePan::Never),
("With Alt key", MousePan::WithAlt),
("With Ctrl key", MousePan::WithCtrl),
("Always", MousePan::Always),
("&Never", MousePan::Never),
("With &Alt key", MousePan::WithAlt),
("With &Ctrl key", MousePan::WithCtrl),
("Alwa&ys", MousePan::Always),
]);

EventConfigWidget {
Expand All @@ -97,9 +97,9 @@ impl driver::Driver<Config, SharedRc<Config>> for EventConfig {
.clone()
.on_select(|mgr, v| mgr.push_msg(Msg::MousePan(v))),
mouse_text_pan: mouse_pan.on_select(|mgr, v| mgr.push_msg(Msg::MouseTextPan(v))),
mouse_nav_focus: CheckButton::new("Mouse navigation focus")
mouse_nav_focus: CheckButton::new("&Mouse navigation focus")
.on_toggle(|mgr, v| mgr.push_msg(Msg::MouseNavFocus(v))),
touch_nav_focus: CheckButton::new("Touchscreen navigation focus")
touch_nav_focus: CheckButton::new("&Touchscreen navigation focus")
.on_toggle(|mgr, v| mgr.push_msg(Msg::TouchNavFocus(v))),
}
}
Expand Down
22 changes: 11 additions & 11 deletions examples/gallery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ fn widgets() -> Box<dyn SetDisabled> {
#[widget] bi = Row::new_vec(vec![
Button::new_msg(img_light.clone(), Item::Theme("light"))
.with_color("#B38DF9".parse().unwrap())
.with_keys(&[VK::L]),
.with_keys(&[VK::P]),
Button::new_msg(img_light, Item::Theme("blue"))
.with_color("#7CDAFF".parse().unwrap())
.with_keys(&[VK::L]),
.with_keys(&[VK::B]),
Button::new_msg(img_dark, Item::Theme("dark"))
.with_color("#E77346".parse().unwrap())
.with_keys(&[VK::K]),
]),
#[widget] cb = CheckButton::new("&Check me")
#[widget] cb = CheckButton::new("Chec&k me")
.with_state(true)
.on_toggle(|mgr, check| mgr.push_msg(Item::Check(check))),
#[widget] rb = RadioButton::new("radio button &1", radio.clone())
Expand Down Expand Up @@ -311,9 +311,9 @@ fn filter_list() -> Box<dyn SetDisabled> {
#[derive(Debug)]
struct {
core: widget_core!(),
#[widget] r0 = RadioButton::new_msg("none", r.clone(), SelectionMode::None).with_state(true),
#[widget] r1 = RadioButton::new_msg("single", r.clone(), SelectionMode::Single),
#[widget] r2 = RadioButton::new_msg("multiple", r, SelectionMode::Multiple),
#[widget] r0 = RadioButton::new_msg("&n&one", r.clone(), SelectionMode::None).with_state(true),
#[widget] r1 = RadioButton::new_msg("s&ingle", r.clone(), SelectionMode::Single),
#[widget] r2 = RadioButton::new_msg("&multiple", r, SelectionMode::Multiple),
#[widget] filter = EditBox::new("")
.on_edit(move |s, mgr| filter.update(mgr, &(), s.to_string())),
#[widget] list: ScrollBars<MyListView> =
Expand Down Expand Up @@ -543,11 +543,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
core: widget_core!(),
#[widget] menubar = menubar,
#[widget] stack: TabStack<Box<dyn SetDisabled>> = TabStack::new()
.with_title("Widgets", widgets()) //TODO: use img_gallery as logo
.with_title("Text editor", editor())
.with_title("List", filter_list())
.with_title("Canvas", canvas())
.with_title("Config", config(toolkit.event_config().clone())),
.with_title("&Widgets", widgets()) //TODO: use img_gallery as logo
.with_title("&Text editor", editor())
.with_title("&List", filter_list())
.with_title("Can&vas", canvas())
.with_title("&Config", config(toolkit.event_config().clone())),
}
impl Widget for Self {
fn handle_message(&mut self, mgr: &mut EventMgr, _: usize) {
Expand Down

0 comments on commit 173dd39

Please sign in to comment.