Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
230b011
commit b53212e
Showing
3 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using Gtk 4.0; | ||
using Adw 1; | ||
|
||
Adw.StatusPage { | ||
title: "Scale"; | ||
description: _("A simple sliding control"); | ||
|
||
Box { | ||
orientation: vertical; | ||
halign: center; | ||
|
||
Scale one { | ||
orientation: horizontal; | ||
margin-bottom: 20; | ||
} | ||
|
||
Scale two { | ||
orientation: horizontal; | ||
margin-bottom: 20; | ||
} | ||
|
||
Scale disabled { | ||
orientation: horizontal; | ||
sensitive: false; | ||
margin-bottom: 20; | ||
} | ||
|
||
LinkButton { | ||
label: "Tutoral"; | ||
uri: "https://developer-old.gnome.org/gtkmm-tutorial/stable/sec-scale-widgets.html.en"; | ||
} | ||
|
||
LinkButton { | ||
label: "API Reference"; | ||
uri: "https://docs.gtk.org/gtk4/class.Scale.html"; | ||
} | ||
|
||
LinkButton { | ||
label: "Human Interface Guidelines"; | ||
uri: "https://developer.gnome.org/hig/patterns/controls/sliders.html"; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const scale_one = workbench.builder.get_object("one"); | ||
const scale_two = workbench.builder.get_object("two"); | ||
const scale_disabled = workbench.builder.get_object("disabled"); | ||
|
||
scale_one.set_range(true, 50); | ||
|
||
scale_two.set_range(true, 50); | ||
scale_two.set_inverted(true); | ||
scale_two.add_mark(10.0, "right", null); | ||
scale_two.add_mark(20.0, "right", null); | ||
scale_two.add_mark(30.0, "right", null); | ||
scale_two.add_mark(40.0, "right", null); | ||
scale_two.add_mark(50.0, "right", null); | ||
scale_two.set_increments(10.0, 10.0); | ||
|
||
scale_disabled.set_range(true, 50); | ||
scale_disabled.set_value(25); | ||
scale_disabled.set_show_fill_level(25); | ||
|
||
scale_one.connect("value_changed", () => { | ||
let scale_value = scale_one.get_value(); | ||
if (scale_value === 50) { | ||
console.log("Max Value Reached"); | ||
} else if (scale_value === 1) { | ||
console.log("Min Value Reached"); | ||
} | ||
}); | ||
|
||
scale_two.connect("value_changed", () => { | ||
let scale_value_two = scale_two.get_value(); | ||
if (scale_value_two === 50) { | ||
console.log("Max Value Reached"); | ||
} else if (scale_value_two === 1) { | ||
console.log("Min Value Reached"); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "Scale", | ||
"category": "user_interface", | ||
"description": "A simple sliding control", | ||
"panels": [ | ||
"ui", | ||
"preview" | ||
], | ||
"autorun": true | ||
} |