Re: Reduce the size of a GtkScale indicator



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()


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