mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-01 02:33:54 +03:00
label_underlined_text for "link" buttons
This commit is contained in:
parent
7e3d8bded9
commit
143fdc3fd5
@ -360,7 +360,8 @@ impl Proposals {
|
||||
if edits.proposal_link.is_some() {
|
||||
current_tab.push(
|
||||
ctx.style()
|
||||
.btn_solid_text("Read detailed write-up")
|
||||
.btn_plain()
|
||||
.label_underlined_text("Read detailed write-up")
|
||||
.build_def(ctx)
|
||||
.margin_below(10),
|
||||
);
|
||||
|
@ -592,7 +592,7 @@ fn trip_category_selector(ctx: &mut EventCtx, app: &App, tab: DashTab) -> Widget
|
||||
button = button
|
||||
.disabled(true)
|
||||
.bg_color(ctx.style().btn_solid_floating.bg, ControlState::Disabled)
|
||||
.label_styled_text(Text::from(Line(label).underlined()), ControlState::Default)
|
||||
.label_underlined_text(label);
|
||||
}
|
||||
button.build_widget(ctx, action)
|
||||
};
|
||||
|
@ -213,6 +213,17 @@ impl<'b, 'a: 'b> ButtonBuilder<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the text of the button's label. The text will be decorated with an underline.
|
||||
///
|
||||
/// See `label_styled_text` if you need something more customizable text styling.
|
||||
pub fn label_underlined_text(mut self, text: &'a str) -> Self {
|
||||
let mut label = self.default_style.label.take().unwrap_or_default();
|
||||
label.text = Some(text);
|
||||
label.styled_text = Some(Text::from(Line(text).underlined()));
|
||||
self.default_style.label = Some(label);
|
||||
self
|
||||
}
|
||||
|
||||
/// Assign a pre-styled `Text` instance if your button need something more than uniformly
|
||||
/// colored text.
|
||||
pub fn label_styled_text(mut self, styled_text: Text, for_state: ControlState) -> Self {
|
||||
|
Loading…
Reference in New Issue
Block a user