Re: Reduce the size of a GtkScale indicator





On 03/29/18 21:19, Stefan Salewski wrote:
On Thu, 2018-03-29 at 18:02 +0200, Bas Wassink wrote:
Any hints?

https://developer.gnome.org/gtk3/stable/chap-css-overview.html

grep -A100 GtkScale ~/.config/gtk-3.0/gtk-default.css

Well, I do provide a colored label example at

https://github.com/StefanSalewski/gintro

Starting from that one, it is easy to get a really big slider:

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)
   let cssProvider = newCssProvider()
   let data = "scale slider {min-width: 32pt; min-height: 32pt;}"
   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()

Yes, I know you want a tiny one. But setting nim-width, min-height to
small values does not decrease size, which is not really surprising, as
  that are min and max values. So we have to search for other properties
-- maybe Mr Bassi or Mr Bader will tell us.


I kinda figured I had to go the CSS route, bur I was hoping for something like gtk_scale_set_indicator(GTK_INDICATOR_TINY);, alas it was not be.

Thanks anyway, I'll see what I can with CSS without breaking themes too much.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]