Can someone please point me in the right direction when it comes to changing properties of an element in Gtk2Hs.
For example, how do I change the background-color of a DrawingArea?
Can someone please point me in the right direction when it comes to changing properties of an element in Gtk2Hs.
For example, how do I change the background-color of a DrawingArea?
Copyright © 2021 Jogjafile Inc.
There are various methods for modifying a widget's style. For example to modify the background style you can use
widgetModifyBg
(corresponding to the C functiongtk_widget_modify_bg()
). In principle, if you change the style for one state (e.g. StateNormal) then you should also change it for the others.Y would suggest you describe the styles you want in an RC file, and then load that file from your application, but it seems that functions like
gtk_rc_parse()
are not bound in gtk2hs.Here's an example:
If you need to do custom drawing based on a widget's styles, you can do that using
widgetGetState
, thewidgetStyle
property and thestyleGet*
family of functions (e.g.styleGetText
). Here's an example of that: