Reference Codebot.Themes.Gtk3.pas
Part of the Codebot Themes Design package
The Codebot.Themes.Gtk3 unit themes every window of the program with the GTK3 widgetset by adding one style sheet to the screen. GTK styles every widget again when the style sheet changes, including widgets created later, so nothing is patched and nothing is hooked.
Gtk3ThemesInstall adds an empty style sheet to the screen, and returns False if the widgetset is not GTK3. Before that, it saves the system colors the widgetset reads from the GTK theme into SystemColors, so the dialog shows System Default as it really looks. The style sheet sits above the GTK theme and below the style sheets the widgetset gives single widgets, so a control with a color or font of its own keeps it.
Gtk3ThemesSetTheme fills the style sheet from a theme of Codebot.Themes.Palettes. Each color of the palette is defined with @define-color as cb_ followed by its name, along with the colors the widgetset looks up by name, such as theme_bg_color, theme_base_color, and theme_selected_bg_color. The rules that follow give windows, menus, tool tips, buttons, check boxes, edits, lists, tabs, scroll bars, and other widgets the colors and font of the theme. A dark theme also turns on gtk-application-prefer-dark-theme, so GTK starts from its dark theme and title bars are dark where the window manager allows it. System Default empties the style sheet.
After the widgetset reads the system colors again, the unit sets them to the colors of the palette, refreshes the cached brushes and pens of the LCL, and sets the color of every control whose color is a system color again, so the controls the LCL draws itself match the ones GTK draws.
Gtk3ThemesUninstall removes the style sheet and puts back the dark setting and the system colors as they were, so nothing calls into the unit again.
Items 3 items
| Name | Kind | Line |
|---|---|---|
| Gtk3ThemesInstall | function | 26 |
| Gtk3ThemesSetTheme | procedure | 31 |
| Gtk3ThemesUninstall | procedure | 29 |