Commit Graph

24116 Commits

Author SHA1 Message Date
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
2e8b1cd358 Gtk9Slice: Fix stretch case. 2010-12-04 15:38:20 +01:00
Carlos Garnacho
a65d0d00c0 GtkWidget: Store GtkStyleContext in private struct. 2010-12-04 15:38:19 +01:00
Carlos Garnacho
5bbab9872d GtkStyleContext: Cache style properties accross class/region changes. 2010-12-04 15:38:19 +01:00
Carlos Garnacho
88b78953b6 GtkContainer: Add method to get the GtkWidgetPath for a child.
This is now used throughout in order to have the full path for a given widget,
including intermediate named regions, the default implementation just returns
the GtkContainer's path copy, no intermediate regions between.
2010-12-04 15:38:19 +01:00
Carlos Garnacho
c575733eda GtkStyleContext: Fix animation framework to work with the new draw() semantics.
Invalidation region coalescing now happens recursively as draw() runs, and the
widget's x/y as now drawing coordinates are 0,0 based.
2010-12-04 15:38:18 +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
a1a90396b7 GtkThemingEngine: Do not return a const GtkThemingEngine on load() 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
5b11d14a49 GtkButton: Notify on prelight state change. 2010-12-04 15:38:17 +01:00
Carlos Garnacho
908babd8ae GtkThemingEngine: Implement animations between gradients/colors. 2010-12-04 15:38:17 +01:00
Carlos Garnacho
d8187b34bb GtkSymbolicColor: Use G_DEFINE_BOXED_TYPE 2010-12-04 15:38:17 +01:00
Carlos Garnacho
7583f31609 GtkStyleContext: Store animation region for a bunch of paint operations. 2010-12-04 15:38:17 +01:00
Carlos Garnacho
fecc079087 GtkStyleContext: Invalidate whole window if no invalidation region is obtained. 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
96e5a02148 GtkThemingEngine: Use border-image to render borders if an image is available. 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
f363e31a09 Register the border-image property
It will contain a 9-sliced image, so it can be rendered as rectangles with any
dimensions.
2010-12-04 15:38:16 +01:00
Carlos Garnacho
089f375cdb Add Gtk9Slice
This is a private boxed object to contain information about a border image
in order to render it in a size independent way.
2010-12-04 15:38:16 +01:00
Carlos Garnacho
cc68e62e24 GtkSettings: Add a new provider for the theme CSS file. 2010-12-04 15:38:16 +01:00
Carlos Garnacho
ac73a8f7a8 GtkStyleContext: Add gtk_style_context_reset_widgets()
This function recalculates the style for all widgets on a screen.
2010-12-04 15:38:15 +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
a07fe2c0e6 Add generic providers per-screen.
The providers are added as soon as gtk GtkSettings object for the screen
is created.
2010-12-04 15:38:15 +01:00
Carlos Garnacho
1e66155aec GtkStyleContext: invalidate context when setting the screen 2010-12-04 15:38:14 +01:00
Carlos Garnacho
8dfa0e03ea GtkWidget: Set style context's screen before the widget_path.
This is so the style context has all necessary information before
triggering a style change on setting the path.
2010-12-04 15:38:14 +01:00
Carlos Garnacho
49ac732a18 GtkStyleContext: Add gtk_style_context_[add|remove]_provider_for_screen()
These functions allow per-screen style providers. also, the changed signal
will be emitted whenever a style context changes.
2010-12-04 15:38:14 +01:00
Carlos Garnacho
f239704094 GtkWidget: Add gtk_widget_reset_style().
This function is analogous to gtk_widget_reset_rc_styles(),
updates style recursively on a widget.
2010-12-04 15:38:13 +01:00
Carlos Garnacho
3c390c9c8e GtkWidget: Add the style-updated signal
This signal is emitted whenever the widget's style changes.
2010-12-04 15:38:13 +01:00
Carlos Garnacho
77ccdfc94e GtkStyle: Protect against padding being NULL 2010-12-04 15:38:13 +01:00
Carlos Garnacho
9f84e101bf GtkStyleContext: Add gtk_style_context_invalidate().
This function will regenerate all styling information.
2010-12-04 15:38:12 +01:00
Carlos Garnacho
756bbf526f GtkStyleSet: Fix typo 2010-12-04 15:38:12 +01:00
Carlos Garnacho
58b6e538c9 GtkThemingEngine: use background-image in render_background() 2010-12-04 15:38:12 +01:00
Carlos Garnacho
2794e8d6dd GtkStyleSet: Register a "background-image" property.
Ironically, it currently just handles gradients, the name is to conform
to current CSS gradient implementation trends.
2010-12-04 15:38:12 +01:00
Carlos Garnacho
cf87923d1b GtkStyleSet: Handle GtkGradients as a replacement for cairo_pattern_t
The former will handle GtkSymbolicColors, which will be resolved and
cached at query time.
2010-12-04 15:38:12 +01:00
Carlos Garnacho
3fc5c87bcb GtkCssProvider: Add a parser for gradients. 2010-12-04 15:38:12 +01:00
Carlos Garnacho
142a72637d Add GtkGradient.
This type defines a gradient between 2 symbolic colors, with any number
of color stop between these. At the moment it has been put besides
GtkSymbolicColor, although should be completely private, it will likely
need extending in the future for radial gradients.

At some point, it maybe should also be used for images, so painting
both a gradient and an image is consistent.
2010-12-04 15:38:11 +01:00
Carlos Garnacho
74de1839a4 GtkStyleSet: Set an empty default_value if none is provided. 2010-12-04 15:38:11 +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
02a30118c6 Add a boxed type for cairo_pattern_t. 2010-12-04 15:38:11 +01:00
Carlos Garnacho
621a95f515 GtkSettings: implement GtkStyleProvider 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
643abe3127 GtkStyleSet: Register "margin" property. 2010-12-04 15:38:10 +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
846f67d805 GtkStyle: Allow GTK_ARROW_NONE. 2010-12-04 15:38:10 +01:00