package ocgtk
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054
doc/ocgtk.gtk/Ocgtk_gtk/Gtk/Wrappers/Style_context/index.html
Module Wrappers.Style_context
type t = [ `style_context | `object_ ] Gobject.objval to_string : t -> Gtk_enums.stylecontextprintflags -> stringConverts the style context into a string representation.
The string representation always includes information about the name, state, id, visibility and style classes of the CSS node that is backing @context. Depending on the flags, more information may be included.
This function is intended for testing and debugging of the CSS implementation in GTK. There are no guarantees about the format of the returned string, it may change.
val set_state : t -> Gtk_enums.stateflags -> unitSets the state to be used for style matching.
val set_scale : t -> int -> unitSets the scale to use when getting image assets for the style.
val set_display : t -> Ocgtk_gdk.Gdk.Wrappers.Display.t -> unitAttaches @context to the given display.
The display is used to add style information from “global” style providers, such as the display's `GtkSettings` instance.
If you are using a `GtkStyleContext` returned from method@Gtk.Widget.get_style_context, you do not need to call this yourself.
val save : t -> unitSaves the @context state.
This allows temporary modifications done through method@Gtk.StyleContext.add_class, method@Gtk.StyleContext.remove_class, method@Gtk.StyleContext.set_state to be quickly reverted in one go through method@Gtk.StyleContext.restore.
The matching call to method@Gtk.StyleContext.restore must be done before GTK returns to the main loop.
val restore : t -> unitRestores @context state to a previous stage.
See method@Gtk.StyleContext.save.
val remove_provider : t -> [ `style_provider ] Gobject.obj -> unitRemoves @provider from the style providers list in @context.
val remove_class : t -> string -> unitRemoves @class_name from @context.
val lookup_color : t -> string -> bool * Ocgtk_gdk.Gdk.Wrappers.Rgb_a.tLooks up and resolves a color name in the @context color map.
val has_class : t -> string -> boolReturns %TRUE if @context currently has defined the given class name.
val get_state : t -> Gtk_enums.stateflagsReturns the state used for style matching.
This method should only be used to retrieve the `GtkStateFlags` to pass to `GtkStyleContext` methods, like method@Gtk.StyleContext.get_padding. If you need to retrieve the current state of a `GtkWidget`, use method@Gtk.Widget.get_state_flags.
val get_scale : t -> intReturns the scale used for assets.
val get_padding : t -> [ `border ] Gobject.objGets the padding for a given state as a `GtkBorder`.
val get_margin : t -> [ `border ] Gobject.objGets the margin for a given state as a `GtkBorder`.
val get_display : t -> Ocgtk_gdk.Gdk.Wrappers.Display.tReturns the `GdkDisplay` to which @context is attached.
val get_color : t -> Ocgtk_gdk.Gdk.Wrappers.Rgb_a.tGets the foreground color for a given state.
val get_border : t -> [ `border ] Gobject.objGets the border for a given state as a `GtkBorder`.
val add_provider : t -> [ `style_provider ] Gobject.obj -> int -> unitAdds a style provider to @context, to be used in style construction.
Note that a style provider added by this function only affects the style of the widget to which @context belongs. If you want to affect the style of all widgets, use func@Gtk.StyleContext.add_provider_for_display.
Note: If both priorities are the same, a `GtkStyleProvider` added through this function takes precedence over another added through func@Gtk.StyleContext.add_provider_for_display.
val add_class : t -> string -> unitAdds a style class to @context, so later uses of the style context will make use of this new class for styling.
In the CSS file format, a `GtkEntry` defining a “search” class, would be matched by:
```css entry.search ... ```
While any widget defining a “search” class would be matched by: ```css .search ... ```