Commit Graph

585 Commits

Author SHA1 Message Date
Benjamin Otte
732e89e4f3 stylecontext: Always recompute font
This is necessary  because values in a GtkCssComputedValues can change
now. So if the font-size is inherited or animated, the cached value will
be outdated.

Fixes the fontchooser preview not updating.
2012-12-06 02:57:18 +01:00
Benjamin Otte
fc67f0d4f8 stylecontext: Remove unused private functions 2012-11-30 22:41:22 +01:00
Benjamin Otte
e0586e3680 stylecontext: Expose a function to get at the current changes 2012-11-30 20:36:57 +01:00
Benjamin Otte
4ccb8e5d33 stylecontext: Pass a bitmask to the changed values 2012-11-30 20:10:23 +01:00
Benjamin Otte
41486895d5 deprecations: Move files into deprecated/ dir 2012-11-25 04:16:43 +01:00
Benjamin Otte
fb643c1c12 symboliccolor: Deprecate
Symbolic colors are an implementation detail of the CSS engine and have
been superceded by GtkCssColorValue. We don't want them clobbering the
public API. In particular because the only use I could find in the
public API is people using it to shade colors.
2012-11-25 03:43:28 +01:00
Benjamin Otte
42dc0ea0fd styleprovider: Change function prototype
Make _gtk_style_provider_private_get_color() return a GtkCssValue (a
GtkCssColorValue to be exact) instead of GtkSymbolicColor.

With this, the symbolic color usage inside GTK is minimized.
2012-11-25 02:45:10 +01:00
Benjamin Otte
08ac1504d2 symboliccolor: Implement using GtkCssValue 2012-11-25 02:41:17 +01:00
Benjamin Otte
c3f3a82db9 stylecontext: Split out a function
The function is used in multiple places, so split it out. In particular
because I'm about to change it.
2012-11-18 21:55:43 +01:00
Benjamin Otte
6d3b4d9382 stylecontext: Add a flag to force style_updated() emission
This is used in gtk_widget_reset_style() (via GTK_CSS_CHANGE_ANY) now,
and that makes GtkSettings font related changes work again.
2012-11-14 13:25:44 +01:00
Alexander Larsson
55d65571f3 Exit early in gtk_style_context_update_cache codepaths
If lookup->missing is empty we don't need to continue looking.
We short circuit in several places as this can happen
after iteratively makeign lookup->missing smaller.
2012-11-09 10:15:23 +01:00
Benjamin Otte
947fed0961 stylecontext: Fix a memleak 2012-11-08 23:34:30 +01:00
Benjamin Otte
ba88174614 stylecontext: Remove unused function 2012-11-08 23:34:29 +01:00
Benjamin Otte
16677bb85a stylecontext: Don't use bg image in gtk_style_context_set_background()
Old code tried to use the "background-image" proeprty for setting the
default image background. While this used to work in the early days of
GTK3, today it is grossly misleading as the backgronud image may be
resized, repositioned and semi-translucent which causes very weird
artifacts when rendering.

So we use the background-color only instead.
2012-10-31 11:09:10 +01:00
Benjamin Otte
046d004725 gradient: Add a private header file 2012-10-02 14:16:36 +02:00
Benjamin Otte
4943cc4c12 stylecontext: Actually use superset matcher
... when looking up the needed changes.

This is what that matcher was actually written for, but it seems I never
hooked it in.
2012-10-01 14:23:15 +02:00
Benjamin Otte
1454ba15ba css: Huge refactoring to avoid computing wrong values
Here's the shortest description of the bug I can come up with:
When computing values, we have 3 kinds of dependencies:
(1) other properties ("currentColor" or em values)
(2) inherited properties ("inherit")
(3) generic things from the theme (@keyframes or @define-color)
Previously, we passed the GtkStyleContext as an argument, because it
provided these 3 things using:
(1) _gtk_style_context_peek_property()
(2) _gtk_style_context_peek_property(gtk_style_context_get_parent())
(3) context->priv->cascade

However, this makes it impossible to lookup values other than the ones
accessible via _gtk_style_context_peek_property(). And this is exactly
what we are doing in gtk_style_context_update_cache(). So when the cache
updates encountered case (1), they were looking up the values from the
wrong style data.

So this large patch essentially does nothing but replace the
context argument in all compute functions with new arguments for the 3
cases above:
(1) values
(2) parent_values
(3) provider

We apparently have a lot of computing code.
2012-09-28 18:27:49 +02:00
Benjamin Otte
0cc32eae62 symboliccolor: Change prototype of _gtk_symbolic_color_resolve_full()
We can juts pass a GtkStyleProviderPrivate, that one has the vfunc we
want already. So no need to pass vfuncs anymore.
2012-09-28 18:27:49 +02:00
Benjamin Otte
fbb4c61665 stylecontext: Rebuild cached styles with correct classes/regions
Previously, we were using the default classes and regions. That's
obviously wrong.
2012-09-28 18:27:48 +02:00
Benjamin Otte
d74e1b9ac9 stylecontext: Always create animations
Even when there is no current values, do create animations. This ensures
that animations do exist for unmapped widgets when they get mapped
later.
2012-09-17 20:40:01 +02:00
Benjamin Otte
4a281edc87 stylecontext: Only create transitions conditionally
While regular animations should always be created, transitions should
not. This patch allows to express this by passing NULL as the values to
transition from.

It also adds a gtk_style_context_should_create_transitions() function
that returns TRUE when transitions should be created.
2012-09-17 20:40:01 +02:00
Benjamin Otte
7712d41b5e stylecontext: Refactor the way animations are started and stopped
We now create animation objects unconditionally, but we only run the
animation loop when gtk_style_context_should_animate() return TRUE.
2012-09-17 20:40:01 +02:00
Benjamin Otte
13cbd22d17 stylecontext: Clear animations for values kept in cache 2012-09-17 20:40:01 +02:00
Benjamin Otte
37dac2a481 stylecontext: Remove leftover debugging
... that actually was both wrong, a performance failure and has been
there since the original checkin.

Updating the cached style data absolutely does not mean clearing all
cached style data first. There's nothing to update then.
2012-09-17 20:39:14 +02:00
Benjamin Otte
e2cc9f3afc csscomputedvalues: Handle starting animations differently 2012-09-17 20:39:14 +02:00
Benjamin Otte
a7ec3ba53f csscomputedvalues: Get rid of animated values
Merge the animated values code into the computed values code. This
should get rid of various bugs related to animated->computed updating.
2012-09-17 20:39:12 +02:00
Benjamin Otte
229b6fe17a css: Add animation support
This adds the GtkCssAnimation class and the code needed to hook it into
GtkStyleContext. It takes the values out of the CSS "animation"
properties and does animations. See
  http://dev.w3.org/csswg/css3-animations/
for details.

Note that the code for starting and stopping animations with widget
visibility doesn't work yet.
2012-09-17 20:39:12 +02:00
Benjamin Otte
554002028c stylecontext: Provide a function for getting the style provider
This will be necessary for creating the computed values for keyframes.
2012-09-17 20:39:12 +02:00
Cosimo Cecchi
f57778e71e stylecontext: fix a StyleData refleak
We were failing to unref the style data in some code paths.

https://bugzilla.gnome.org/show_bug.cgi?id=683627
2012-09-13 17:00:20 -04:00
Benjamin Otte
11d0f9e408 css: Make color lookup handle dependencies 2012-08-28 15:42:24 +02:00
Benjamin Otte
8ff08e7c5e stylecontext: Update computed values when dependencies change
This fixes the longstanding bug where GTK would not update styles when
parent styles would change.

https://bugzilla.gnome.org/show_bug.cgi?id=672046
2012-08-28 15:42:24 +02:00
Benjamin Otte
a770f0c3eb stylecontext: Refactor some code
This just changes the arguments passed to build_properties() and moves
that function around in the source file. No functional changes are
happening.
2012-08-28 15:42:24 +02:00
Benjamin Otte
1d7b23845f css: Pass relevant properties to css lookup code
This is not used yet in this patch.
2012-08-28 15:42:24 +02:00
Benjamin Otte
8874a06ba0 stylecontext: Compute correct changes
... in the case where no change of the DOM tree actually happened.

We don't do anything yet with that information, this patch just
correctly computes it.
2012-08-28 15:42:24 +02:00
Benjamin Otte
5d2acb1fe9 stylecontext: Split out a function for simplicity 2012-08-28 15:42:23 +02:00
Benjamin Otte
2cb9dac14c stylecontext: Pass the changes in the parent to validation function
This way, inherited properties can be updated.
2012-08-28 15:42:23 +02:00
Cosimo Cecchi
b80d935b95 stylecontext: pass down the requested change type to invalidation
<Company>: cosimoc: yes, that totally makes sense
<Company>: looks like a copy/paste error from when i factored out that
           function
2012-06-13 17:04:47 -04:00
Matthias Clasen
8742f6f09c Clarify the gtk_style_context_add_provider docs
https://bugzilla.gnome.org/show_bug.cgi?id=643490
2012-05-26 12:24:13 -04:00
Benjamin Otte
f51c9d4154 stylecontext: Make queue_invalidate() always work
Handle both the case where a widget is set and also the case where a
widget path is set.
2012-05-08 03:58:23 +02:00
Benjamin Otte
0743cef50d stylecontext: Disallow adding/removing GtkSettings style providers
Adding "system" providers like the GtkSettings object shouldn't be
allowed at all, so ensure that it indeed is not.
2012-05-02 17:04:49 +02:00
Benjamin Otte
793748eadd debug: Add GTK_DEBUG=no-css-cache
See inline comments for what it does. Its main use is figuring out if
something has been caused by GTK's caching of CSS properties or if it's
a different problem.
2012-05-02 02:00:11 +02:00
Benjamin Otte
b4195cb408 cssmatcher: Handle case of empty widget path
This is tested by the stylecontext test, but doesn't appear in practice.
2012-05-01 03:13:02 +02:00
Benjamin Otte
04c85a5b3b container: Redo style validation handling
Instead of using 1 global queue for both resizes and style validation,
use 2 queues. This makes the code a lot simpler and fixes a bug where we
could accidentally stop restylying for very delayed restyles.
2012-04-17 08:59:23 +02:00
Benjamin Otte
35e36b9fe5 stylecontext: Avoid style_context_save() calls
Introduce style_data_lookup_for_state() that does this.
2012-04-17 08:59:23 +02:00
Benjamin Otte
2179580c8e stylecontext: Pull all the animation code together
We now animate the core style information (see comment in
gtk_style_context_save()). A lot of widgets save + set custom style
classes/states during drawing and so can't be animated. It does work for
labels, menus and buttons though.
2012-04-17 08:59:23 +02:00
Benjamin Otte
60eff87d08 stylecontext: Shuffle around code
This has two goals:

1) Move invalidation code out of a nested if branch. Invalidation is
actually the most important thing this function does.

2) Have the changes bitmask available. It will needed for invalidate
calls to children later.
2012-04-17 08:59:22 +02:00
Benjamin Otte
42d2430498 stylecontext: Add style_info_set_data()
.. to take care of the refcounting properly.
2012-04-17 08:59:22 +02:00
Benjamin Otte
b8c72a0bdb stylecontext: Make StyleInfo keep the next pointer 2012-04-17 08:59:22 +02:00
Benjamin Otte
deefb64661 stylecontext: Make StyleData refcounted
This is needed for animations where we want to keep a custom StyleData
for animations.
2012-04-17 08:59:22 +02:00
Benjamin Otte
fe89e710ea stylecontext: Add public API to stop animations
... and use it.

Of course, there still are no animations, so we don't turn anything off
yet.
2012-04-17 08:59:22 +02:00
Benjamin Otte
a240808824 stylecontext: Add an animating framework
The design principles were:

- synchronized
If multiple style contexts are animating, they should all do an
animation step at the same time.

- degrades well
Even when there's thousands of style contexts all animating at the same
time, the animation steps don't starve the CPU. This is achieved by
making sure the timeout is really fast. It just sets a bunch of flags.

- no hidden bottlenecks
Turning animatability on or off on a style context is O(1).

So far it is unused.
2012-04-17 08:59:22 +02:00
Benjamin Otte
b6594d1ac9 stylecontext: Don't queue a resize when none is needed 2012-04-17 08:59:22 +02:00
Benjamin Otte
e2f89c0c6a stylecontext: Listen to the new changed signal 2012-04-17 08:59:21 +02:00
Benjamin Otte
29fbfcb8f5 stylecontext: Pass time to style_context_validate()
This way, we can ensure that every style context uses the same timestamp
for whatever they do.
2012-04-17 08:59:21 +02:00
Benjamin Otte
aaedc7b67f stylecontext: Compute if things changed before invalidating
This is only a small performance boost by itself, but it's necessary
for animations, so we need it.

Benchmark numbers for my Glade benchmark for interested people:
        GTK 3.4.0    last commit  this commit
Raleigh
  real  0m41.879s    0m10.176s    0m9.900s
  user  0m41.394s    0m9.895s     0m9.628s
  sys   0m0.111s     0m0.096s     0m0.102s

Adwaita                                        (*)
  real  0m51.049s    0m13.432s    0m14.848s    0m12.253s
  user  0m50.487s    0m13.034s    0m13.218s    0m11.927s
  sys   0m0.117s     0m0.151s     0m0.147s     0m0.107s

Ambiance (patched to not use private GTK APIs)
  real  0m52.167s    0m13.115s    0m13.117s    0m12.944s
  user  0m51.576s    0m12.739s    0m12.768s    0m12.651s
  sys   0m0.119s     0m0.137s     0m0.136s     0m0.118s

(*) Adwaita and unico currently use custom properties, and
_gtk_css_value_compare() for custom properties always returns FALSE,
which makes this optimization never trigger. So I modified
_gtk_css_value_compare() to return TRUE for these properties instead and
reran the benchmark. Those are the numbers.
2012-04-17 08:59:21 +02:00
Benjamin Otte
33f111a47c widget: Don't cache widget paths all the time
Add an internal API that allows GtkStyleContext to create a widget path
for the widget and with that bypassing gtk_widget_get_path() and that
  function caching the path.
2012-04-17 08:59:21 +02:00
Benjamin Otte
6ac754cdd1 stylecontext: Remove theming_engine cache variable
Instead, look up the variable upon use. This is more correct (for when
the engine changes due to save/restore() shenanigans.

And it removes code that doesn't use the standard code paths.
2012-04-17 08:59:21 +02:00
Benjamin Otte
3ddb104302 stylecontext: Split out a function 2012-04-17 08:59:20 +02:00
Benjamin Otte
0111b9d507 symboliccolor: Treat it as a CssValue
.. now that it is one.
2012-04-17 08:59:20 +02:00
Benjamin Otte
83be7e5dbd symboliccolor: Pass the current color to the resolve function
This way, we can resolve things like
  mix (currentColor, &otherColor);
and therefore parse currentColor as a regular color.
2012-04-17 08:59:19 +02:00
Benjamin Otte
04c5fdaca6 css: Remove old animation code
Deprecate public API where appropriate and make it no-ops.
Remove all calls to it.
Get rid of the 'transition' css property.

For now, this means spinners don't animate anymore.
2012-04-17 08:59:19 +02:00
Benjamin Otte
f785f7177c cssvalue: Add a custom value for repeats
In particular, that's background-repeat and border-image-repeat.

Also, fix up the border-image shorthand to allow any order.
2012-04-17 08:59:18 +02:00
Benjamin Otte
580b5e4a83 stylecontext: Don't queue_resize() all the time
When a parent style context exists, there's no need to queue_resize() on
the widget, because the parent widget will call
gtk_style_context_validate() on us and _then_ we can call queue_resize()
if we have to.
2012-04-17 08:59:17 +02:00
Benjamin Otte
a360e77a7b css: Remove _gtk_css_computed_values_get_value_by_name()
Now that we use an enum for the IDs, we don't need that function
anymore.
2012-04-17 08:59:16 +02:00
Benjamin Otte
31565139ba stylecontext: Convert _gtk_style_context_peek_property()
Take the property id instead of the name.
2012-04-17 08:59:15 +02:00
Benjamin Otte
40982eabbb stylecontext: Keep the main style data around until revalidation 2012-04-17 08:59:15 +02:00
Benjamin Otte
751187aa0c stylecontext: Keep per-styleinfo data
Instead of having one global data structure, keep it per style info.
This means that we can do special tricks on the "global" style data.
2012-04-17 08:59:14 +02:00
Benjamin Otte
a737adadf8 stylecontext: Make style_data_lookup() not take a state anymore
Instead, use the current state of the style context.
2012-04-17 08:59:14 +02:00
Benjamin Otte
58b6d492b8 cssvalue: Add a custom RGBA value
Note: custom CSS properties still use the default GtkCssValue and always
will.
So there is a difference in css values used between those, even though
they both carry a GdkRGBA payload.
2012-04-17 08:59:14 +02:00
Benjamin Otte
a33df2d1d6 cssvalue: Split number values into their own class 2012-04-17 08:59:13 +02:00
Benjamin Otte
5ac9ba714a styleproperty: Make _gtk_style_property_query() take a GValue
... and don't make it return a GtkCssValue. We want to use this for
compat with the old GValue APIs after all...
2012-04-17 08:59:11 +02:00
Benjamin Otte
d5a2392cc7 stylecontext: Don't clear cache when only state changes
This takes more memory, but changes to backdrop or active state are
quite expensive otherwise.
2012-04-17 08:59:11 +02:00
Benjamin Otte
585a1fae4f stylecontext: Really queue style changes
Instead of instantly applying a new style, just mark the context as
invalid. Only apply the new style at layout time.
2012-04-17 08:59:10 +02:00
Benjamin Otte
eb537b60f4 stylecontext: Optimize the common case of "style didn't change" 2012-04-17 08:59:10 +02:00
Benjamin Otte
198cf93f0f stylecontext: On failure, exit the loop, don't try again
Because we will fail again. And then we try again. And then we fail
again. Ad infinitum.
2012-04-17 08:59:09 +02:00
Benjamin Otte
15be680540 stylecontext: Invalidate when setting classes/state/regions
... and nobody has called style_context_save().
2012-04-17 08:59:09 +02:00
Benjamin Otte
44d49c900d stylecontext: Use _gtk_style_context_queue_invalidate() on self 2012-04-17 08:59:09 +02:00
Benjamin Otte
39ff874a11 stylecontext: Introduce _gtk_style_context_queue_invalidate()
This is for only queueing invalidations instead of doing a full
invalidation cycle.
2012-04-17 08:59:09 +02:00
Benjamin Otte
1a51ea3ea3 stylecontext: Keep track of children 2012-04-17 08:59:09 +02:00
Benjamin Otte
7f511f2b33 widget: Don't set widget path on style context
Instead, make the style context use the widget's path. Saves a bunch of
memory.
2012-04-17 08:59:09 +02:00
Benjamin Otte
e5ab48ac59 stylecontext: Notify widget directly of changes
This way, we don't need to g_signal_connect(), which saves a bunch of
memory and performance.
2012-04-17 08:59:08 +02:00
Benjamin Otte
1aa4a196dc stylecontext: Add setter for widget
... and actually set the widget on the style context. Note that this
function does not take a reference on the widget, which is a very good
reason to keep it private.
2012-04-17 08:59:08 +02:00
Benjamin Otte
a94b85d375 css: Make the style provider take a matcher as an input argument 2012-04-17 08:59:07 +02:00
Benjamin Otte
a2ded8b72a styleprovider: Add a custom object for a list of style providers
This way, we don't have to do magic inside GtkStyleContext, but have a
real API.
As a cute bonus, this object implements GtkStyleProvider itself. So we
can just pretend there's only one provider.
2012-04-17 08:59:07 +02:00
Benjamin Otte
015e3a768f stylecontext: Stop querying style providers for icon factories
Nobody implements this feature and I don't wanna maintain it. If it
turns out somebody is using it, we gotta invent something.
2012-04-17 08:59:07 +02:00
Benjamin Otte
461803e407 gtk: Get gtkwidgetpath.h includes out of the public headers
and include them in the C files instead.
2012-03-19 02:26:16 +01:00
Benjamin Otte
f9727ee1bf stylecontext: Get rid of unused parameter
It was always FALSE
2012-03-16 17:53:57 +01:00
Alexander Larsson
616cc5b96d Use GtkCssValue in symbolic color resolving
We now store the symbolic colors as a GtkCssValue which means that
we can reuse the color when resolving and storing the color in
the computed values in the style context.

Additionally we keep a last_resolved GtkCssValue cache in the
GtkSymbolicColor, and if resolving the color returns the same as
last time we reuse the old value. This further increases sharing
of Css Values.
2012-03-08 14:52:10 +01:00
Alexander Larsson
7603e6e473 css: Use GtkCssValues instead of GValue in the css machinery
Also, in places where we're computing a new CssValue based on an
old one, make sure that if nothing changes we're returning a reference
to the old one, rather than creating a new identical instance.
2012-03-08 11:03:57 +01:00
Benjamin Otte
7844e8089c types: Clean up gtkwidget.h includes
In particular gtksettings.h and gtkstylecontext.h needed to be included
in lots of places now.

Also, I order the includes alphabetically in a bunch of headers.
2012-03-03 19:45:03 +01:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Paolo Borelli
f73ff748db Add a deprecation mark to draw_insertion_cursor
This function has been replaced with gtk_render_insertion_cursor, but we
forgot to mark it as deprecated.
2012-02-27 17:48:37 +01:00
Cosimo Cecchi
4e37d56d51 themingengine: move _gtk_theming_engine_set_context to private header
Where it belongs.
2012-02-14 16:36:56 -05:00
Benjamin Otte
a63ff72406 css: Convert border-radius to GtkCssNumber
We can do % now, wohoo!
2012-02-02 03:14:00 +01:00
Benjamin Otte
82c2dad178 themingengine: Add a private function to query lengths 2012-02-02 03:14:00 +01:00
Benjamin Otte
581cc59945 stylecontext: Don't unref animation description
We get it without a ref since 6962b49a99
2012-01-12 01:10:26 +01:00
Benjamin Otte
a815f10299 API: Add gtk_style_context_get_section()
This API allows querying the location where style properties were
defined. An example implementation will be committed soon.
2012-01-11 15:48:54 +01:00
Benjamin Otte
6962b49a99 css: Introduce GtkCssComputedValues
To be used for storing computed values. Is the replacement for
GtkStyleProperties, which is now legacy code.
2012-01-11 15:48:54 +01:00
Benjamin Otte
694a9114af stylecontext: Simplify even more code 2012-01-11 15:48:54 +01:00
Benjamin Otte
f27f8db2d8 stylecontext: Use our own color resolve function
... instead of using the StyleProperties.
2012-01-11 15:48:54 +01:00
Benjamin Otte
abcae0cea4 stylecontext: Simplify function
Also, make it easier to port to what I want to do next. ;)
2012-01-11 15:48:54 +01:00
Benjamin Otte
aa98aca45f styleproperties: Remove color set function
Now that we do resolvage with the style context directly, this is no
longer needed.
2012-01-11 15:48:53 +01:00
Matthias Clasen
2dc10600ea Fix doc markup 2012-01-09 14:13:44 -05:00
Benjamin Otte
2c5a8420b5 Set border-width to 0 in compute function
This reverts commit c276f53796 and
implements the same feature using the compute function.
A nice side effect is that gtk_style_property_get_border() and
gtk_style_property_get("border") to the same thing now.
2012-01-09 18:37:58 +01:00
Benjamin Otte
84d294ee7f stylecontext: NMake safe to call into during lookup
When resolving a lookup, we may want to query the current style context,
as in the next patch. This works now.
2012-01-09 18:37:57 +01:00
Benjamin Otte
2c8ef919ae stylecontext: Add _gtk_style_context_peek_property()
This allows peeking at the computed value for a property. This is useful
for looking at GtkCssImage.
2012-01-09 18:37:56 +01:00
Benjamin Otte
9181282d88 style: Remove GtkStylePropertyContext again
We need to solve this differently. I have no idea yet how, but I'll
invent something later.

This only affects win32 theming and that's broken anyway.
2012-01-09 18:37:56 +01:00
Benjamin Otte
4576653006 stylecontext: Export _gtk_style_context_resolve_color()
We'll need it soon.
2012-01-09 18:37:55 +01:00
Benjamin Otte
f2dc63cc6a css: Pass the real context to the CSS lookup
This will be necessary soon.
2012-01-09 18:37:55 +01:00
Benjamin Otte
242893a031 css: Pass the parent context to _gtk_css_lookup_resolve()
This way, we can resolve inherit properties.
2012-01-09 18:37:50 +01:00
Benjamin Otte
b50d2b74d7 API: Add GtkStyleContext::parent
We need this for proper support of CSS inherit.
2012-01-09 18:37:50 +01:00
Benjamin Otte
ba5e7012b1 css: Redo StyleProvider interface
We now use the GtkStleProviderPrivate interface, which hopefully is
faster and more conformant to CSS. Long term, it definitely should be
both.

I would have liked to split this up into multiple commits, but couldn't
find a way.
2012-01-09 18:37:50 +01:00
Benjamin Otte
899a381d31 stylecontext: Separate properties by states
We don't want to mix states the wrong way. And the current approach does
that.
2012-01-09 18:37:49 +01:00
Benjamin Otte
a488d2184a stylecontext: Pass state to style data lookup function 2012-01-09 18:37:49 +01:00
Javier Jardón
d005b01319 gtk/*: Use g_list_free_full() convenience function 2012-01-05 04:22:43 +01:00
Cosimo Cecchi
d80ff7b5f1 stylecontext: always add the ARROW style class when rendering an arrow
When gtk_render_arrow() is called, always add an ARROW style class to
the GtkStyleContext before rendering, so themes can specify a different
color for it.

https://bugzilla.gnome.org/show_bug.cgi?id=665420
2011-12-05 09:37:21 -05:00
Paolo Borelli
2ef5844bac Introduce gtk_render_insertion_cursor
The new function provides an API that takes the PangoLayout and index
as input params, this way it handles strong and weak cursors internally
factoring out all code duplicated in the widgets that need to render
cursors.

https://bugzilla.gnome.org/show_bug.cgi?id=640317
2011-12-01 01:22:39 +01:00
Alexander Larsson
c276f53796 Make computed value of border-width 0 if border-style none
From the css docs at http://www.w3.org/TR/CSS2/box.html:

    8.5.1 Border width: 'border-top-width', 'border-right-width', 'border-bottom-width',
    'border-left-width', and 'border-width'

    Computed value:  	absolute length; '0' if the border style is 'none' or 'hidden'
2011-11-25 15:36:08 +01:00
Alexander Larsson
c09148ca09 Add GtkStylePropertyContext and use it in when getting style properties
At the toplevel we have _gtk_theming_engine_get, which lets us pass
in a property context with (atm) the size to get the property for.
Then there is a lot of plumbing to push this down into the lower
layers of the style property code until finally hitting
the property resolvers.

I need this because I will be adding a property resolver for win32
theme parts, and they render differently depending on the size
(i.e. they don't scale linearly). The idea is that the code
to get the background properties will pass in the final size
and we will resolve the theme part specification to that particular
size.

If the old non-context calls are used we just hardcode a size
of 100x100.
2011-11-17 12:27:22 +01:00
Matthias Clasen
98db3dd5dd Move gtk_draw_insertion_cursor out of gtkstyle.[hc]
This function does not use GtkStyle at all and is not deprecated.
2011-11-01 23:51:18 -04:00
Cosimo Cecchi
8d3f7e3a4a stylecontext: add style classes for top/bottom/right/left areas
This is useful to e.g. theme notebook tabs differently according to
their position directly from the CSS sheet.

GtkNotebook support in a separate commit.

https://bugzilla.gnome.org/show_bug.cgi?id=659777
2011-09-27 13:43:21 -04:00
Matthias Clasen
21275a1636 Correct the documentation of gtk_render_arrow() x,y arguments
As pointed out in bug 655631, these are the origin, not
the center of the area.
2011-09-04 23:09:57 -04:00
Cosimo Cecchi
7e22b46c1f combobox: add a "combobox-entry" style class for comboboxes with entries
This way themes can use GtkComboBox.combobox-entry to match that
specific case, and GtkComboBox.combobox-entry .button to match the
button/arrow side of the widget.
2011-08-09 16:08:00 +02:00
Benjamin Otte
a2dbfaf43d stylecontext: #include <math.h> when using math functions 2011-07-05 16:08:10 -04:00
Matthias Clasen
1164ceb4fc GtkStyleContext: add some aux. a11y api
This function translates the fg/bg color into atk attributes.
2011-07-05 16:08:07 -04:00
Matthias Clasen
c2449763ce Fix up docs for predefined style classes.
The table was incomplete and out of date. Instead, just
put a list of links in that place, and move all the extra
documentation to the macros. Bug 653785
2011-06-30 19:18:26 -04:00
Matthias Clasen
0725e417c5 Fix css syntax in example 2011-06-18 11:11:47 -04:00
Benjamin Otte
0d253b67f4 css: Make font property a shorthand
... and implement the CSS font properties:
- font-size
- font-style
- font-family
- font-weight
- font-variant

This is the second try at this. The first was backed out previously due
to bugginess. Let's hope this one survives a bit longer.

Also makes the font-family CSS test work again.
2011-06-15 12:52:53 +02:00
Javier Jardón
bf0d8402f5 gtk: Use const instead G_CONST_RETURN 2011-06-10 13:07:54 +01:00
Cosimo Cecchi
514e77581a stylecontext: add gtk_render_icon() 2011-06-09 23:17:09 +02:00
Benjamin Otte
2e6bb2a0c9 Revert "css: Make font property a shorthand"
The hack in gtk_style_context_get_font() was causing segfaults in
combobox code. This is not acceptable and I'm not awake enough to fix
it, so just reverting until it's fixed sanely is easiest.

This reverts commit cf6bfbdb17.
2011-06-02 02:31:44 +02:00
Benjamin Otte
abeaad6166 stylecontext: Implement the color getters using the regular API
Has two benefits:
1) Less code
2) I can refactor things
2011-06-02 02:03:52 +02:00
Benjamin Otte
cf6bfbdb17 css: Make font property a shorthand
... and implement the CSS font properties:
- font-size
- font-style
- font-family
- font-weight
- font-variant
2011-06-02 02:03:52 +02:00
Benjamin Otte
940cdb4a7f stylecontext: Don't crash when colors are "none"
Instead, use their default value (pink).
2011-06-02 02:03:51 +02:00
Benjamin Otte
21236cf270 style: Make margin a shorthand
... and add the real properties:
- margin-top
- margin-left
- margin-bottom
- margin-right
2011-05-22 05:56:12 +02:00
Benjamin Otte
a35aa96149 style: Make padding a shorthand
... and add the real properties:
- padding-top
- padding-left
- padding-bottom
- padding-right
2011-05-22 05:56:12 +02:00
Benjamin Otte
f5c7cefcca style: Convert border-width to a shorthand
Add the corresponding properties it refers to, too:
- border-top-width
- border-left-width
- border-bottom-width
- border-right-width
2011-05-22 05:56:11 +02:00
Benjamin Otte
5f5cc79623 styleproperties: Adapt _gtk_style_properties_peek_property()
Optionally return the GtkStyleProperty that was looked up. This feature
isn't used yet, but will soon be.
2011-05-21 22:49:43 +02:00
Matthias Clasen
7629ee7ad0 GtkStyleContextPrivate: Improve struct packing 2011-04-12 12:45:51 -04:00
Benjamin Otte
3f491f7157 style: Move private function into private header
The function wasn't exported, so everybody using it would have gotten
linking failures.
2011-03-17 11:59:17 +01:00
Ignacio Casal Quinteiro
0a03e81224 Fix conversion from GdkColor to GdkRGBA 2011-03-06 11:17:06 +01:00
Matthias Clasen
9707d8a3e6 Don't assert on zero width/height in render functions
We can just silently ignore those rendering calls.
https://bugzilla.gnome.org/show_bug.cgi?id=643041
2011-02-28 07:52:59 -05:00
Murray Cumming
8d54fa7102 More tiny documentation typo fixes. 2011-02-23 11:09:20 +01:00
Matthias Clasen
f04504ac94 Allow custom icon size in gtk_render_icon_pixbuf()
Pointed out in bug 642213.
2011-02-14 13:22:28 -05:00
Benjamin Otte
ccc3679a62 stylecontext: Use the common approach for priate pointers
Has two advantages:
1) consistency
2) "print *context->priv" actually works in gdb
2011-02-11 23:21:11 +01:00
Carlos Garnacho
15fdf90265 doc: Add a note about prioritization of GtkStyleProviders
It was unclear in the docs what happened if
gtk_style_context_add_provider() and
gtk_style_context_add_provider_for_screen()
were used with the same priority.
2011-02-08 04:17:56 +01:00
Matthias Clasen
208974636f Set the correct initial value for the direction property 2011-02-07 20:36:46 -05:00
Carlos Garnacho
2be692687f Fix color style properties lookup when the color resolution fails
The cached GValue ended up with a GtkSymbolicColor type, so
the contained value was bogus. Noticed by Mitch.
2011-02-07 19:56:17 +01:00
Carlos Garnacho
217d3fd796 GtkStyleContext is meant to have a GdkScreen
It is used to get the default providers, without them
the style context can't do much. A check for NULL screen
is done before any sensitive call to
gtk_style_context_set_screen(), in the hope that any widget
will open the display before doing anything related to
styling. Fixes bug #641429, reported by Bastien Nocera.
2011-02-06 11:21:42 +01:00
Matthias Clasen
4dc9b294d8 Don't assume a screen exists before realize()
Fix for https://bugzilla.gnome.org/show_bug.cgi?id=641429
2011-02-04 22:03:11 -05:00
Paolo Borelli
001697a22a Move the get_cursor_color in GtkStyleContext
Move the private get_cursor_color method belongs to StyleContext. Change
the api so that retrieving both primary and secondary color is possible.
I left the method private for now, though it should probably be public
as all the other getters.
2011-01-29 13:13:42 +01:00
Matthias Clasen
d9fcc4c630 Silence new gcc warnings
gcc 4.6.0 has started to warn about set-but-unused variables.
So don't do that, then.
2011-01-23 21:51:38 -05:00
Matthias Clasen
a12dad75a2 Split out private style context api into a private header 2011-01-23 18:29:28 -05:00
Pavel Holejsovsky
2f0d40335b [GI] Add missing (transfer) annotations 2011-01-20 13:57:18 +01:00
Pavel Holejsovsky
3c8fc21e9b [GI] Fixes of existing incorrect annotations 2011-01-20 13:56:06 +01:00
Carlos Garnacho
0b7496558d Make GtkCssProvider deal with widget types not being in plain CamelCase
Fixes bug #Bug 639754, reported by Kjell Ahlstedt. gtkmm doesn't
use plain CamelCase for its widget type names, so in order to
distinguish widget type names from regions in the CSS parser,
the following checks are now done:

* if it contains an uppercase letter -> widget class (that should
  also work for gtkmm)

* if it's a string compound by lowercase letters and '-' -> it's
  a region, checks have been added in gtk_style_context_add_region()
  and gtk_widget_path_iter_add_region() to ensure this.
2011-01-19 04:28:49 +01:00
Carlos Garnacho
f482d4dc89 Ensure harder a GtkStyleContext has a theming engine anytime 2011-01-17 04:43:42 +01:00
Matthias Clasen
867dc0bd0d Avoid a critical warning during tab DND
https://bugzilla.gnome.org/show_bug.cgi?id=639380
2011-01-14 21:15:06 -05:00
Benjamin Otte
2b0b08a861 stylecontext: Protect the cairo contexts with cairo_save/cairo_restore()
We don't want theme engines to mess up the context we are currently
drawing with.
2011-01-12 11:40:09 +01:00
Milan Bouchet-Valat
44da5a0094 Improve docs about GtkStyleContext padding/border/margin
GTK_STYLE_PROPERTY_BORDER_WIDTH is of style GtkBorder, not gint.

Also make it clearer what the definition and ordering of these 3
properties is. Reorder them in the header to be more logical.
2011-01-11 12:28:54 +01:00
Carlos Garnacho
d5b0ccacce GtkStyleContext: Do not cancel possibly unstarted transitions
It might happen that this overcautious check is done on an animation
that didn't have time to gather invalidation rectangles.
2011-01-10 23:52:21 +01:00
Carlos Garnacho
de36dda925 Add gtk_style_context_scroll_animations()
This function will be needed in widgets like GtkTreeView,
since gdk_window_scroll() doesn't trigger the usual
mechanisms to update the invalidation area, this function
is needed together with it.
2011-01-10 20:49:41 +01:00
Carlos Garnacho
e6277d3b82 Add gtk_style_context_cancel_animations()
This function takes a region ID and cancels all animations
on or beneath that region (as in push/pop_animatable_region).

First user of this is GtkWidget itself, so unmapped widgets
have looping animations cancelled. Fixes bug #638119, reported
by Jesse van den Kieboom.
2011-01-10 03:50:01 +01:00
Carlos Garnacho
2bd221d215 Bug 637910 - GtkSpinner - does not animate
Fix widget-to-window coordinates translation in the
style context animation code.
2010-12-24 19:37:49 +01:00
Carlos Garnacho
ac0353e08a Make gtk_style_context_get_* functions more robust
Even if the default CSS contains values for these, handle non-existing
values as queries might happen on an incomplete style.
2010-12-21 14:44:49 +01:00
Cosimo Cecchi
b792a31995 widgetpath: allow GTypes non-derived from GTK_TYPE_WIDGET
This makes things like GtkCellRenderer or GtkNumerableIcon more easily
themeable.

https://bugzilla.gnome.org/show_bug.cgi?id=637169
2010-12-17 18:30:57 +01:00
Diego Escalante Urrelo
02f92f29d5 gtkstylecontext: fix typos in annotations
Fixes Bug #637256
2010-12-15 00:46:25 +00:00
Carlos Garnacho
99f59d8266 Fix coalescing of state animation areas for multiple window widgets.
Coordinates needed to be translated relative to the window position
in within the widget.
2010-12-13 22:31:27 +01:00
Paolo Borelli
f285a84bd6 Add convenience function for the font description. 2010-12-13 22:31:27 +01:00
Benjamin Otte
3070d6e3d5 Revert "docs: Reinstate pixbufs section in GDK docs"
I committed my whole working tee instead of just one file. Ooops.
This reverts commit ded14b2562.
2010-12-09 23:55:33 +01:00
Benjamin Otte
ded14b2562 docs: Reinstate pixbufs section in GDK docs
It was accidentally removed in 0775b0a858
2010-12-09 11:14:21 +01:00
Carlos Garnacho
4cca7554b8 GtkStyleContext: warn on meaningless coords in gtk_render_* calls 2010-12-05 20:19:55 +01:00
Matthias Clasen
d5df33c75f Fix abi check after recent merges 2010-12-05 12:18:30 -05:00
Carlos Garcia Campos
f261d56da3 GtkStyleContext: invalidate icon caches when resetting widgets 2010-12-04 15:39:56 +01:00
Carlos Garnacho
bacb7906f2 Add helper API for getting colors/borders in GtkStyleContext/GtkThemingEngine 2010-12-04 15:39:55 +01:00
Carlos Garnacho
066f35bf28 Parse user CSS from $XDG_CONFIG_HOME/gtk-3.0/gtk.css 2010-12-04 15:39:53 +01:00
Carlos Garnacho
297fa7a3dd GtkStyleProvider: Add GtkStateFlags parameter to get_style_property().
Widget style properties can now have different values depending on the
current state.
2010-12-04 15:39:51 +01:00
Carlos Garnacho
2ca905db5e GtkStyleContext: Handle directionality when picking next provider. 2010-12-04 15:39:50 +01:00
Carlos Garcia Campos
4aaf193602 docs: gtk_style_context_get_screen() always returns a valid screen 2010-12-04 15:39:49 +01:00
Carlos Garcia Campos
7a5a622998 Check screen really changed before notifying it and invalidating the context 2010-12-04 15:39:49 +01:00
Carlos Garcia Campos
7abf76fbc1 Initialize screen of GtkStyleContext to default screen 2010-12-04 15:39:48 +01:00
Matthias Clasen
ca143b1303 Add list of classes and regions to the docs 2010-12-04 15:39:48 +01:00
Matthias Clasen
e598f17871 Some header cleanups
Move GtkGradient to their own files, also move GtkBorder out of
gtkstyle.h, so that header can be all deprecated.
2010-12-04 15:39:47 +01:00
Carlos Garnacho
62e9188ff3 GtkStyleContext: store layout extents for animation purposes. 2010-12-04 15:39:43 +01:00
Carlos Garnacho
818aca5aee GtkStyleContext: Only allow looping transitions for states being turned on. 2010-12-04 15:39:43 +01:00
Carlos Garnacho
ad6da0cdb8 GtkStyleContext: Stop animations if the window is gone. 2010-12-04 15:39:43 +01:00
Matthias Clasen
0f98b15090 Add illustration to gtk_render_handle docs 2010-12-04 15:39:42 +01:00
Matthias Clasen
3ddee2561b Small doc addition 2010-12-04 15:39:42 +01:00
Matthias Clasen
d1f1af202b Add a frame-gap illustration 2010-12-04 15:39:42 +01:00
Carlos Garnacho
037c982824 GtkStyleContext: Handle empty areas when coalescing invalidation regions. 2010-12-04 15:39:41 +01:00
Matthias Clasen
e57e0e978d Illustrate extension rendering 2010-12-04 15:39:39 +01:00
Matthias Clasen
8589c5c65e Add slider illustration 2010-12-04 15:39:38 +01:00
Matthias Clasen
7e96a51953 Add examples for frame rendering 2010-12-04 15:39:38 +01:00
Matthias Clasen
e522381183 Add a background example to the docs 2010-12-04 15:39:38 +01:00
Matthias Clasen
f13f315312 Some more images for gtk_render docs 2010-12-04 15:39:37 +01:00
Matthias Clasen
a5e10e9b26 Improve some gtk_render_ docs
With pictures !!
2010-12-04 15:39:36 +01:00
Matthias Clasen
a260059c7f Fix doc formatting 2010-12-04 15:39:35 +01:00
Matthias Clasen
fea567bb9f More documentation reshuffling 2010-12-04 15:39:31 +01:00
Matthias Clasen
7d6fb7b7e7 Add some images to the docs
Add graphs for the transition functions and gradient examples.
2010-12-04 15:39:28 +01:00
Matthias Clasen
077270142f GtkStyleContext documentation tweaks 2010-12-04 15:39:27 +01:00
Carlos Garnacho
11480c57f0 GtkStyleContext: Use correct type for animation duration. 2010-12-04 15:39:26 +01:00
Matthias Clasen
e2f91f7201 Documentation improvements
This patch adds more detail to the explanation of CSS, and also
adds documentation about which files are read.

We also make :focus an alternative to :focused (since :focus is
a standard CSS pseudo-class).
2010-12-04 15:39:22 +01:00
Carlos Garnacho
198bb314c7 GtkStyleContext: preserve state on save(). 2010-12-04 15:39:18 +01:00
Matthias Clasen
4e778d7371 Fix a typo 2010-12-04 15:39:14 +01:00
Carlos Garnacho
c9dc09e980 GtkStyleProvider: Pass a GParamSpec in get_style_property().
This is so we can know the owner type of the property, and matching
with the stored strings in GtkCssProvider is direct.
2010-12-04 15:39:13 +01:00
Carlos Garnacho
b613f1f1f2 GtkStyleContext: Also use screen providers for widget style properties. 2010-12-04 15:39:13 +01:00
Carlos Garnacho
bcf81a0e23 Handle looping transition animations. 2010-12-04 15:39:05 +01:00
Carlos Garnacho
c57fdf4c75 GtkStyleContext: Resolve symbolic colors for widget style properties. 2010-12-04 15:39:04 +01:00
Carlos Garnacho
1487b34679 Remove GTK_STATE_LAST.
It didn't turn out to be that useful, nor widely used.
2010-12-04 15:38:56 +01:00
Carlos Garnacho
3f12fc2bd8 GtkStyleContext: Add gtk_style_context_set_background().
This function replaces gtk_style_set_background().
2010-12-04 15:38:54 +01:00
Carlos Garnacho
661a13fe4d GtkStyleContext: Fix check for GtkIconSize in render_icon_pixbuf(). 2010-12-04 15:38:46 +01:00
Carlos Garnacho
405f2f306a GtkStyleContext: restore widget state too in restore(). 2010-12-04 15:38:45 +01:00
Carlos Garnacho
a23863211b GtkStyleContext: Add gtk_render_icon_pixbuf()
This function is similar to gtk_style_render_icon(), which is now
implemented on top of this one.
2010-12-04 15:38:38 +01:00
Carlos Garnacho
80e74d79bb GtkStyleContext: Fix merging of local and global providers. 2010-12-04 15:38:35 +01:00
Carlos Garnacho
2efa2947be Document gtk_render_* functions. 2010-12-04 15:38:34 +01:00
Carlos Garnacho
ebf5bd390f Add gtk_render_activity()
This method will render progress bars and spinners, these should
handle active and inconsistent states' animation progress in order
to perform animations.
2010-12-04 15:38:33 +01:00
Carlos Garnacho
4acc20abc1 s/GtkStyleSet/GtkStyleProperties/
The former name had oddities such as gtk_style_set_set() and such,
so the new name is nicer in that regard and not much longer.
2010-12-04 15:38:29 +01:00
Carlos Garnacho
4e02218f52 Use GdkRGBA all around in GtkStyleContext. 2010-12-04 15:38:25 +01:00
Carlos Garnacho
c9a3da5025 GtkStyleContext: s/set/add/ and s/unset/remove/ for classes/regions.
Several classes and regions may be set to GtkStyleContext, so rename
the functions to be more intuitive.
2010-12-04 15:38:24 +01:00
Carlos Garnacho
d0f681e898 GtkStyleContext: Add gtk_style_context_new(). 2010-12-04 15:38:22 +01:00
Carlos Garnacho
68bfb94f69 Change semantics of the methods to check whether an animation is running.
It actually messed up with the state being actually set, and having a
transition animation running for it. Now this dichotomy is removed, and
gtk_style_context_state_is_running() only checks whether an animation is
running, leaving state checking to flags & GTK_STATE_FLAG_*.
2010-12-04 15:38:22 +01:00
Carlos Garnacho
96c16e246c GtkStyleContext: Actually store region ID when starting an animation. 2010-12-04 15:38:21 +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
Carlos Garnacho
59b0fa8133 Remove GtkOrientation parameter from gtk_render_handle().
The case for paned can be guessed out from the height and width,
for handlebox the orientation parameter doesn't make much sense,
and this way it could also be used for resize grips.
2010-12-04 15:38:21 +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
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
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
1e66155aec GtkStyleContext: invalidate context when setting the screen 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
9f84e101bf GtkStyleContext: Add gtk_style_context_invalidate().
This function will regenerate all styling information.
2010-12-04 15:38:12 +01:00
Carlos Garnacho
f058359182 Replace GdkRegion and GdkRectangle with their cairo counterparts. 2010-12-04 15:38:09 +01:00
Carlos Garnacho
c9d626523d Remove gtkalias from style context code. 2010-12-04 15:38:09 +01:00
Carlos Garnacho
0ce649e965 Plug a bunch of leaks. 2010-12-04 15:38:09 +01:00
Carlos Garnacho
61a0544b8b GtkStyleContext: Add animation machinery.
Animation regions are confined through gtk_style_context_[push|pop]_animatable_region,
anything that's painted between these calls will be invalidated if an animation starts
for any of the regions in the stack.

gtk_style_context_notify_state_change() may be called from widgets to indicate a
change for a given GtkStateType, in that case an animation will be started if there
is an animation description for the widget/state.
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
2c7c4d9a51 GtkStyleContext: Return insertion position if not found when matching classes/regions 2010-12-04 15:37:37 +01:00
Carlos Garnacho
27c91622f6 Set classes info in GtkWidgetPath. 2010-12-04 15:37:36 +01:00
Carlos Garnacho
2dabf20cfd GtkStyleContext: Add gtk_style_context_list_classes(). 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
198d75bea5 GtkStyleContext: Rename internal struct.
GtkStyleRegion has been renamed to GtkStyleInfo, as it doesn't really
have much to do with regions itself, the information it contains does.
This struct is used in save/restore.
2010-12-04 15:37:35 +01:00
Carlos Garnacho
9108739c9b GtkStyleContext: Add gtk_style_context_[gs]et_junction_sides().
These functions will help widgets specify how does one element being painted
relate to other contiguous elements.
2010-12-04 15:37:31 +01:00
Carlos Garnacho
143c4b3b60 GtkStyleContext: Add gtk_style_context_lookup_color().
gtk_style_lookup_color() now uses this function internally.
2010-12-04 15:37:30 +01:00
Carlos Garnacho
dc216ffb00 GtkStyleContext: Add gtk_style_context_[gs]et_direction(). 2010-12-04 15:37:27 +01:00
Carlos Garnacho
c712480912 GtkStyleContext: Add varargs functions for getting widget style properties. 2010-12-04 15:37:23 +01:00
Carlos Garnacho
5f2e8bc0d1 GtkStyleContext: Ensure style rebuilds after adding/removing classes. 2010-12-04 15:37:23 +01:00
Carlos Garnacho
7748b1d2de GtkStyleContext: ensure class lookup return the correct insertion position if not found. 2010-12-04 15:37:22 +01:00
Carlos Garnacho
27f5257d49 GtkStyleContext: Don crash on empty class sets. 2010-12-04 15:37:19 +01:00
Carlos Garnacho
475f0fc266 GtkStyleContext: Add gtk_style_context_save/restore().
This API will be used to have savepoints when adding and removing
style classes information.
2010-12-04 15:37:18 +01:00
Carlos Garnacho
758c3e18cc GtkStyleContext: Add gtk_style_context_[gs]et_screen() 2010-12-04 15:37:17 +01:00
Carlos Garnacho
41650933fd GtkStyleContext: Add priv pointer to object struct. 2010-12-04 15:37:17 +01:00
Carlos Garnacho
a256171d34 GtkStyleContext: Add gtk_style_context_lookup_icon_set(). 2010-12-04 15:37:16 +01:00
Carlos Garnacho
03370c6e0c GtkStyleContext: Add methods to get style property values. 2010-12-04 15:37:13 +01:00
Carlos Garnacho
814957021f Fix compile warning. 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
bd9bd1310b GtkStyleContext: Fix compiler warning. 2010-12-04 15:37:09 +01:00
Carlos Garnacho
cf27f6f1cf GtkStyleContext: fix typos in code.
The wrong list was being modified in gtk_style_context_set_child_class(),
and gtk_style_context_has_child_class() was checking for *flags != 0, not
flags != NULL.
2010-12-04 15:37:09 +01:00
Carlos Garnacho
104caa74f0 GtkStyleContext: Add gtk_style_context_list_child_classes(). 2010-12-04 15:37:09 +01:00
Carlos Garnacho
7c5c4d86ae Add GtkWidgetPath parameter to gtk_style_provider_get_style(). 2010-12-04 15:37:02 +01:00
Carlos Garnacho
fdcda4b356 GtkStyleContext: allow late set_path() calls.
Now the properties will only be regenerated whenever there's a GtkWidgetPath
to query about.
2010-12-04 15:37:00 +01:00
Carlos Garnacho
bdadcb568c GtkStyleContext: Fix compiler warning. 2010-12-04 15:37:00 +01:00
Carlos Garnacho
f984c39e93 GtkStyleContext: Fix typo. 2010-12-04 15:37:00 +01:00
Carlos Garnacho
f8c74ae54b GtkStyleContext: Add gtk_render_handle(). 2010-12-04 15:36:59 +01:00
Carlos Garnacho
160821042c GtkStyleContext: Add gtk_render_extension(). 2010-12-04 15:36:59 +01:00
Carlos Garnacho
88492a50d6 GtkStyleContext: Add gtk_render_frame_gap(). 2010-12-04 15:36:58 +01:00
Carlos Garnacho
6a1b54f8bf GtkStyleContext: Add gtk_render_slider(). 2010-12-04 15:36:57 +01:00
Carlos Garnacho
86727adc4d GtkStyleContext: Add gtk_render_line(). 2010-12-04 15:36:57 +01:00
Carlos Garnacho
f80fbbd829 GtkStyleContext: Add gtk_render_layout(). 2010-12-04 15:36:56 +01:00
Carlos Garnacho
0486f5bbc0 GtkStyleContext: Add gtk_render_focus(). 2010-12-04 15:36:56 +01:00
Carlos Garnacho
9c3b079c1c GtkStyleContext: Add gtk_render_expander(). 2010-12-04 15:36:55 +01:00
Carlos Garnacho
b4c8eba480 GtkStyleContext: Add gtk_render_frame(). 2010-12-04 15:36:55 +01:00
Carlos Garnacho
25488633ec GtkStyleContext: Add gtk_render_background(). 2010-12-04 15:36:54 +01:00
Carlos Garnacho
01a8e06842 GtkStyleContext: Add gtk_render_arrow(). 2010-12-04 15:36:54 +01:00
Carlos Garnacho
1c15b140a9 GtkStyleContext: Add gtk_render_option(). 2010-12-04 15:36:53 +01:00
Carlos Garnacho
401625b8b3 GtkStyleContext: Add gtk_render_check(). 2010-12-04 15:36:53 +01:00
Carlos Garnacho
1d2aa61407 GtkStyleContext: Add child style classes.
Child style classes are like style classes, but with additional positional
information. This would be usually set by the parent container.
2010-12-04 15:36:52 +01:00
Carlos Garnacho
9a76d1a332 GtkStyleContext: Add style classes.
Style classes are the replacement of detail strings.
2010-12-04 15:36:52 +01:00
Carlos Garnacho
bd3b97d82b GtkStyleContext: Relate to a GtkThemingEngine. 2010-12-04 15:36:52 +01:00
Carlos Garnacho
b7e6ae3983 GtkStyleContext: Add gtk_style_context_[gs]et_path()
This relates a GtkStyleContext with a widget path, so
all style querying would happen based on it.
2010-12-04 15:36:52 +01:00
Carlos Garnacho
835cc7049c GtkStyleContext: Add getters and setter for state. 2010-12-04 15:36:51 +01:00
Carlos Garnacho
b82355c76e GtkStyleContext: Fix typo. 2010-12-04 15:36:50 +01:00
Carlos Garnacho
1a3d964615 GtkStyleContext: Add methods to query composed style. 2010-12-04 15:36:49 +01:00
Carlos Garnacho
2b425d89c8 Add GtkStyleContext.
GtkStyleContext will conglomerate the information of several
GtkStyleProviders for widgets and theme engines to query it.
2010-12-04 15:36:48 +01:00