Project

General

Profile

Actions

Feature #1116

open

Add support for styles to pigtk

Added by Hammel 23 days ago. Updated 20 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
Libraries
Target version:
Start date:
06 Apr 2024
Due date:
% Done:

10%

Estimated time:
Severity:
03 - Medium

Description

See gtk_widget_get_style and friends.

Actions #1

Updated by Hammel 20 days ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

Once a style is retrieved, a color hex value from the style can be converted to a GdkColor with

gboolean    gdk_color_parse                 (const gchar *spec,
                                             GdkColor *color);

The GdkColor is

struct GdkColor
{
  gulong  pixel;
  gushort red;
  gushort green;
  gushort blue;
};

The red, green and blue values can be divided by 65535 to get a percentage value that can then be applied to a cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 1.0) call, as in

cairo_set_source_rgba(cr, color.red/65535, color.green/65535, color.blue/65535, 1.0);

The actual colors to use should be computed from the style either when the _init() function is called (if the style is available then) or from the _expose() call. Appropriate defaults (re: white) should be used if the expected style setting is not found or is not set.

This can be tested with the pigtk app using the -T argument which will load the data/gtkrc file.

Actions #2

Updated by Hammel 20 days ago

  • Priority changed from Immediate to Normal
  • Severity changed from 02 - High to 03 - Medium

I tried to do this but couldn't get the bg[] and fg[] to get passed through correctly. I was only ever able to pass the red component of the fg color, everything else was never set correctly - or couldn't be used correctly. I never figured it out and it's just not that important for now.

So I'll move this way down the list and maybe come back to it some other time.

Actions

Also available in: Atom PDF