Re: Reduce the size of a GtkScale indicator
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. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
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() ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Reduce the size of a GtkScale indicator
On Fri, 2018-03-30 at 21:01 +0200, Stefan Salewski wrote: > I have the impression there is no CSS property to make GtkScale > slider > smaller. Finally I have a working solution. The trick is, that we have to set margin also. Margin is negative in default, which does not work with tiny min-width and max-width. margin is the size of the colored bar. Here is the Nim code for a tiny slider, code for other languages should be similar: 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: 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() Note that this CSS code does affect only the widgets of your tool, not other Gnome widgets. You may even name your widgets and then can set CSS properties of single widgets. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Reduce the size of a GtkScale indicator
On Thu, 2018-03-29 at 21:50 +0200, Bas Wassink wrote: > I kinda figured I had to go the CSS route, I have the impression there is no CSS property to make GtkScale slider smaller. I did a few tests yesterday, without a result. But I have to admit that for my screen it is already small. Maybe Mr Bassi will have an idea when he is back from vacation. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
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. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Reduce the size of a GtkScale indicator
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. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Reduce the size of a GtkScale indicator
Hey there, I'm working on some code the uses a bunch of GtkScale's, but unfortunately the indicator (the thing you grab with the mouse) is way too large. I'd rather not break the user's theme but still provide a smaller indicator to save vertical space. So how do I go about this? Are there CSS properties to set this, or do I provide my own image for the indicator (breaking the user's theme)? I've looked at the Gtk3 docs and googled for setting the indicator size, but did not come up with a satisfying answer. (I should probably also note this application is supposed to run on Linux, BSD, MacOS and Windows) Any hints? --Compyx ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list