Commit Graph

174 Commits

Author SHA1 Message Date
Carlos Garnacho
087249db07 GtkCssProvider: Update end string when misparsing symbolic colors. 2010-12-04 15:38:26 +01:00
Carlos Garnacho
7d441000f7 GtkCssProvider: Allow '\t' when parsing values. 2010-12-04 15:38:26 +01:00
Carlos Garnacho
39ce35dd75 GtkCssProvider: Improve default CSS. 2010-12-04 15:38:26 +01:00
Carlos Garnacho
4e02218f52 Use GdkRGBA all around in GtkStyleContext. 2010-12-04 15:38:25 +01:00
Carlos Garnacho
0a0a1a20a7 GtkCssProvider: Make it able to parse enums. 2010-12-04 15:38:23 +01:00
Carlos Garnacho
d03caa4683 GtkCssProvider: Run through the widget path in the correct order.
Comparing a selector with a widget path was being done backwards since
the change to use GtkContainer::get_path_for_child().
2010-12-04 15:38:23 +01:00
Carlos Garnacho
c2f47063c3 GtkCssProvider: Parse default/sorted region flags. 2010-12-04 15:38:22 +01:00
Carlos Garnacho
4a9890e3ab GtkCssProvider: Parse missing widget states. 2010-12-04 15:38:22 +01:00
Carlos Garnacho
a79626b7fb Add theming docs
Both API and file format is documented, there's still missing
a migration doc though.
2010-12-04 15:38:21 +01:00
Benjamin Berg
e8c103f652 Use cairo gobject support instead of a new boxed type. 2010-12-04 15:38:20 +01:00
Carlos Garnacho
88a3c2daae GtkGradient: Handle symbolic gradients.
The css parser has been modified to parse correctly radial gradients:

background-image: -gtk-gradient (radial,
                                 center center, 0,
                                 center center, 0.8,
                                 from (#000), to (#fff));

The theming engine has been modified to correctly animate these,
as well as transitions between different pattern types.
2010-12-04 15:38:20 +01:00
Carlos Garnacho
f9788eb173 GtkCssProvider: Add support for @import rules
Now other CSS files can be referenced from the currently parsed file:

@import url (other-file.css);
@import url (/some/file.css);
2010-12-04 15:38:18 +01:00
Carlos Garnacho
0ef48c0bde GtkCssProvider: no need for resetting the parser prior to parsing data
This is done anyway on each iteration to parse_rule() in parse_stylesheet()
2010-12-04 15:38:18 +01:00
Carlos Garnacho
8e96e4e41f GtkCssProvider: improve file paths parser.
It will now return a full path, and check about the file being sane.
2010-12-04 15:38:18 +01:00
Carlos Garnacho
1772b00e85 GtkCssProvider: Transform custom colors to a @define-color rule.
Given there are other rules such as @import (which will be supported),
keep a sane namespace here, so for (re)defining a color name, in the CSS
file it will look like:

@define-color color-name #fff;
@define-color other-color mix (@color-name, #f00, 0.4);
2010-12-04 15:38:18 +01:00
Carlos Garnacho
5c2cf1e934 Plug some leaks. 2010-12-04 15:38:18 +01:00
Carlos Garnacho
5c8a818671 Fix typo in the Gtk9Slice parser. 2010-12-04 15:38:17 +01:00
Carlos Garnacho
20051e02eb GtkCssProvider: use mapped file to read CSS files. 2010-12-04 15:38:16 +01:00
Carlos Garnacho
80cf01c271 GtkCssProvider: unset filename on load_from_data() 2010-12-04 15:38:16 +01:00
Carlos Garnacho
7ee564c7cd GtkCssProvider: Add a parser for 9slice typed properties.
The value it parses is similar to the border-image CSS3 property,
so strings like this will be accepted:

  border-image: url (foo.png) 4 3 4 3 repeat repeat;

the image path is relative to the parsed CSS file dirname if no
absolute path is provided.
2010-12-04 15:38:16 +01:00
Carlos Garnacho
679ff63d5c GtkCssProvider: Add gtk_css_provider_get_named()
This functions loads a CSS file from a installed theme.
2010-12-04 15:38:15 +01:00
Carlos Garnacho
3fc5c87bcb GtkCssProvider: Add a parser for gradients. 2010-12-04 15:38:12 +01:00
Carlos Garnacho
c908e263ac GtkCssProvider: strip whitespaces in symbolic color values. 2010-12-04 15:38:11 +01:00
Carlos Garnacho
f12d7409cc Allow linefeeds in property values. 2010-12-04 15:38:11 +01:00
Carlos Garnacho
58a51bca97 GtkStyle: Fill in x/ythickness and font_desc from the style context. 2010-12-04 15:38:11 +01:00
Carlos Garnacho
585afafa39 Add basic parser for GtkBorder properties.
Different units aren't supported, it takes 1 to 4 integers representing
pixel distances.
2010-12-04 15:38:10 +01:00
Carlos Garnacho
c9d626523d Remove gtkalias from style context code. 2010-12-04 15:38:09 +01:00
Carlos Garnacho
9dfba95f09 GtkCssProvider: Add gtk_css_provider_load_from_path() 2010-12-04 15:38:09 +01:00
Carlos Garnacho
52baa7d51e GtkCssProvider: Parse properties of type GtkAnimationDescription. 2010-12-04 15:37:38 +01:00
Carlos Garnacho
4781f94de2 Move all theming stack to use GtkStateFlags.
This support goes from the theming engines, which are able to retrieve
style for different combined states to the CSS provider, where several
state pseudo-classes may be specified, such as:

GtkButton:active:prelight {}
2010-12-04 15:37:37 +01:00
Carlos Garnacho
bccec3ef0c GtkCssProvider: Use class for tooltips. 2010-12-04 15:37:36 +01:00
Carlos Garnacho
74697d91fe GtkCssProvider: Parse and match class info. 2010-12-04 15:37:36 +01:00
Carlos Garnacho
a3637ec60d s/child class/region/ everywhere.
"Child class" is an invented term anyway, and it conceptually defines
identifiable regions in widgets.
2010-12-04 15:37:35 +01:00
Carlos Garnacho
e04dfd4d6d GtkThemingEngine: Add gtk_theming_engine_register_property().
This function may be used for custom property registration from
theming engines. The property names will have the
-${engine-type-name}-${prop-name} format, the parser has been
modified to allow properties with '-' as the first char.
2010-12-04 15:37:35 +01:00
Carlos Garnacho
355f0d69ab GtkStyleSet: Allow custom parsers on registered properties. 2010-12-04 15:37:35 +01:00
Carlos Garnacho
99224c9eec GtkCssProvider: Parse correctly widget types with a name.
There's now a distinction between:

GtkLabel#label-name: Label with name "label-name"
GtkWindow #label-name: Window containing a widget named "label-name"
2010-12-04 15:37:34 +01:00
Carlos Garnacho
56e4ffabea Compare widget names as GQuarks in style matching. 2010-12-04 15:37:34 +01:00
Carlos Garnacho
09d8592b5b GtkWidgetPath: Make API more consistent. 2010-12-04 15:37:34 +01:00
Carlos Garnacho
ad08330fae Compare region names as quarks in style matching. 2010-12-04 15:37:34 +01:00
Carlos Garnacho
d47d3d0200 GtkCssProvider: Set child combinators in default CSS. 2010-12-04 15:37:34 +01:00
Carlos Garnacho
5f77ead9c6 GtkCssProvider: Parse and compare widget names. 2010-12-04 15:37:33 +01:00
Carlos Garnacho
52878c45b5 GtkCssProvider: Don't jump too eagerly to the next element when comparing selectors. 2010-12-04 15:37:33 +01:00
Carlos Garnacho
85dbc71921 GtkCssProvider: Immediately bail out if GType couldn't be resolved. 2010-12-04 15:37:33 +01:00
Carlos Garnacho
9ebbc7b5c5 GtkCssProvider: Small optimization. 2010-12-04 15:37:33 +01:00
Sven Herzberg
c001833ed1 GtkCssProvider: don't ignore custom attributes
* gtk/gtkcssprovider.c: don't ignore custom attribites (which can be
  added by theme engines)
2010-12-04 15:37:33 +01:00
Carlos Garnacho
85398fc05f GtkCssProvider: Add gtk_css_provider_get_default().
This method returns a GtkCssProvider with the default style information
loaded.
2010-12-04 15:37:26 +01:00
Carlos Garnacho
0813a2283e GtkCssProvider: Allow '_' in the middle of symbolic color names. 2010-12-04 15:37:22 +01:00
Carlos Garnacho
875237187c GtkCssProvider: Add priv pointer to object struct. 2010-12-04 15:37:17 +01:00
Carlos Garnacho
be5d4adf6b GtkCssProvider: Allow symbolic colors when parsing style rules. 2010-12-04 15:37:15 +01:00
Carlos Garnacho
1de8f75517 GtkCssProvider: Parse color mappings.
These are of the form:

@color-a: #fff;
@color-b: mix (@color-a, #000, 0.5)
@color-c: shade (@color-b, 0.7)

In the stylesheet, arbitrary nesting of these commands is handled.
2010-12-04 15:37:15 +01:00
Carlos Garnacho
b50c88d170 GtkCssProvider: Plug memory leak. 2010-12-04 15:37:14 +01:00
Carlos Garnacho
2cd4ff4215 GtkCssProvider: Fix compile warning. 2010-12-04 15:37:14 +01:00
Carlos Garnacho
1d4687675f GtkCssProvider: set scanner->input_name. 2010-12-04 15:37:13 +01:00
Carlos Garnacho
bf12227435 GtkCssProvider: Implement GtkStyleProvider->get_style_property
Style properties in the resource files are something like:

-GtkComboBox-appears-as-string
-GtkEntry-icon-prelight

Following the usual naming spec for extensions to CSS.
2010-12-04 15:37:13 +01:00
Carlos Garnacho
eaddc9f254 GtkCssProvider: refactor out selector matching. 2010-12-04 15:37:12 +01:00
Carlos Garnacho
eec75f1f59 GtkCssProvider: Ensure each scope has its parser config. 2010-12-04 15:37:12 +01:00
Carlos Garnacho
ff05cc4849 GtkCssProvider: Parse boolean values. 2010-12-04 15:37:12 +01:00
Carlos Garnacho
aa5ec97cac GtkCssProvider: Make additions to parse_value() less error prone. 2010-12-04 15:37:11 +01:00
Carlos Garnacho
66d1cb8054 GtkStyleSet: Register GtkThemingEngine type.
This has been also hooked up to the CSS provider, which parses the "engine"
value to load the corresponding module.
2010-12-04 15:37:11 +01:00
Carlos Garnacho
6906138e45 GtkStyleSet: Remove default value for registered properties.
This should be handled at a higher level, a single default value for all
states isn't that useful...
2010-12-04 15:37:10 +01:00
Carlos Garnacho
e899fdd973 GtkCssProvider: Set default value if no state pseudo-class is specified. 2010-12-04 15:37:10 +01:00
Carlos Garnacho
67c4f8d02e GtkCssProvider: Compare GtkWidgetPath regions with css. 2010-12-04 15:37:08 +01:00
Carlos Garnacho
977a972358 GtkCssProvider: fix parsing of consecutive pseudo-classes.
Now either of foo{}, foo:first-child{}, foo:nth-child(even):insensitive or
foo:active{} will be correctly parsed.
2010-12-04 15:37:08 +01:00
Carlos Garnacho
0be4659c5d GtkCssProvider: move to next selector element on match or child combinator. 2010-12-04 15:37:08 +01:00
Carlos Garnacho
bc0af3208d GtkCssProvider: free selector path on parse_rule(). 2010-12-04 15:37:08 +01:00
Carlos Garnacho
07171d5f68 GtkCssProvider: Add named regions to selector path. 2010-12-04 15:37:08 +01:00
Carlos Garnacho
707d5ae99c GtkCssProvider: Parse named regions. 2010-12-04 15:37:07 +01:00
Carlos Garnacho
71949e05c4 Refurbish GtkWidgetPath API.
The foreach() function is now gone, there's now API to get
GTypes and names from the position in the path.
2010-12-04 15:37:07 +01:00
Carlos Garnacho
8c03503d16 GtkCssProvider: Add support for child/descendant combinators.
Now, selectors like:

  GtkWindow > GtkButton {}
  GtkNotebook > GtkLabel {}

will represent a direct parent/child relation between both elements, while

  GtkWindow GtkButton {}
  GtkNotebook GtkLabel {}

will allow intermediate children between these.
2010-12-04 15:37:06 +01:00
Carlos Garnacho
d691e79cbf GtkCssProvider: Fix typo freeing SelectorElements. 2010-12-04 15:37:05 +01:00
Carlos Garnacho
abbeb89b7c GtkCssProvider: Allow empty selector.
universal selector is implied, so things like this work:

:active {}
:insensitive{}
2010-12-04 15:37:05 +01:00
Carlos Garnacho
4c8353bcbf GtkCssProvider: Allow '*' selectors.
These would match a single widget of any type.
2010-12-04 15:37:04 +01:00
Carlos Garnacho
468f216b1c GtkCssProvider: Add state parsing.
Now state is now defined as a pseudoclass in the CSS format, selectors like:

GtkWidget:active { }
GtkButton:insensitive { }
GtkCalendar:prelight { } (also :hover is accepted)
...

define the style for the given state.
2010-12-04 15:37:03 +01:00
Carlos Garnacho
bccad0c65c Added GtkCssProvider.
GtkCssProvider is a GtkStyleProvider implementation which is able to read
CSS-like input to style widgets.

At the moment, only the basic parser features are available.
2010-12-04 15:37:02 +01:00