Skip to content

Commit 5b4cc3e

Browse files
authored
Add value-pos to scale widget (#1285)
* Add value-pos to gtk scale * add possible values to value-pos * add value-pos change to CHANGELOG.md
1 parent 29fa158 commit 5b4cc3e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ All notable changes to eww will be listed here, starting at changes since versio
3535
- Support empty string for safe access operator (By: ModProg)
3636
- Add `log` function calls to simplexpr (By: topongo)
3737
- Add `:lines` and `:wrap-mode` properties to label widget (By: vaporii)
38+
- Add `value-pos` to scale widget (By: ipsvn)
3839

3940
## [0.6.0] (21.04.2024)
4041

crates/eww/src/widgets/widget_definitions.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,9 @@ fn build_gtk_scale(bargs: &mut BuilderArgs) -> Result<gtk::Scale> {
459459
// @prop draw-value - draw the value of the property
460460
prop(draw_value: as_bool = false) { gtk_widget.set_draw_value(draw_value) },
461461

462+
// @prop value-pos - position of the drawn value. possible values: $position
463+
prop(value_pos: as_string) { gtk_widget.set_value_pos(parse_position_type(&value_pos)?) },
464+
462465
// @prop round-digits - Sets the number of decimals to round the value to when it changes
463466
prop(round_digits: as_i32 = 0) { gtk_widget.set_round_digits(round_digits) }
464467

@@ -1381,6 +1384,16 @@ fn parse_justification(j: &str) -> Result<gtk::Justification> {
13811384
}
13821385
}
13831386

1387+
/// @var position - "left", "right", "top", "bottom"
1388+
fn parse_position_type(g: &str) -> Result<gtk::PositionType> {
1389+
enum_parse! { "position", g,
1390+
"left" => gtk::PositionType::Left,
1391+
"right" => gtk::PositionType::Right,
1392+
"top" => gtk::PositionType::Top,
1393+
"bottom" => gtk::PositionType::Bottom,
1394+
}
1395+
}
1396+
13841397
/// @var gravity - "south", "east", "west", "north", "auto"
13851398
fn parse_gravity(g: &str) -> Result<gtk::pango::Gravity> {
13861399
enum_parse! { "gravity", g,

0 commit comments

Comments
 (0)