Re: Reduce the size of a GtkScale indicator
- From: Bas Wassink <b wassink ziggo nl>
- To: Stefan Salewski <mail ssalewski de>, gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Re: Reduce the size of a GtkScale indicator
- Date: Sat, 31 Mar 2018 17:31:58 +0200
On 03/30/18 23:11, Stefan Salewski wrote:
On Fri, 2018-03-30 at 22:25 +0200, Stefan Salewski wrote:
You may even name your widgets and then can set
CSS properties of single widgets.
Like this:
import gintro/[gtk, glib, gobject, gio]
proc appActivate(app: Application) =
let window = newApplicationWindow(app)
let scale = newScaleWithRange(Orientation.horizontal, 0.0, 100.0, 10.0)
scale.setName("MyTinyOne")
echo scale.getName
let cssProvider = newCssProvider()
let data = "scale#MyTinyOne slider {min-width: 4px; min-height: 4px; margin: 0px}"
discard cssProvider.loadFromData(data)
let styleContext = scale.getStyleContext
assert styleContext != nil
addProvider(styleContext, cssProvider, STYLE_PROVIDER_PRIORITY_USER)
window.add(scale)
showAll(window)
proc main =
let app = newApplication("org.gtk.example")
connect(app, "activate", appActivate)
discard run(app)
main()
Thanks a lot! This is what I was looking for.
I now have smaller scales and sliders (apparently what I called an
'indicator' is called a 'slider'). The margin can be used to have the
slider either inside (>= 0) the bar or larger than the bar (< 0).
It will take a bit of tweaking to get this to look acceptable across
themes/OSes, but the basis is here.
Again, thank you.
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]