Commit Graph

55 Commits

Author SHA1 Message Date
Benjamin Otte
4d9eedafcd roundedbox: Add gtk_rounded_boxes_init_for_style()
Instead of making people intiialize a rectangle and then applying border
radius manually, provide a constructor that does it for them.
While doing that, also allow people to instead request the padding box
or the content box.

Refactor all relevant code to use this new constructor.
2016-12-20 18:01:12 +01:00
Benjamin Otte
95a2a5c54c gtk: Remove GtkJunctionSides 2016-12-20 18:01:12 +01:00
Benjamin Otte
9af468cdec gtk: Remove unused argument from function 2016-12-20 18:01:11 +01:00
Benjamin Otte
a9809e5d30 gsk: Add gsk_rounded_rect_shrink()
... and replace _gtk_rounded_box_grow() and _gtk_rounded_box_shrink()
with it.
2016-12-20 18:01:11 +01:00
Benjamin Otte
f96f16899d roundedbox: Remove _gtk_rounded_box_path()
Use gsk_rounded_rect_path() instead.

That's a private GSK function, be we can just include its header.
2016-12-20 18:01:10 +01:00
Benjamin Otte
e26f84fca0 gtk: Remove GtkRoundedBox struct
Use GskRoundedRect instead.
2016-12-20 18:01:10 +01:00
Benjamin Otte
6d012fb4ea gtk: Get rid of GtkCssCorner
We have GskCorner now which is identical.
2016-12-20 18:01:10 +01:00
Benjamin Otte
bcf70e3a03 API: Remove everything relating to "grip"
Grips have long been unused in GTK, so remove all support for them.
This removes the GTK_STYLE_CLASS_GRIP and the special
gtk_render_handle() code for drawing those grips.
2016-11-16 19:27:43 +01:00
Benjamin Otte
56e11f057c API: Remove gtk_render_extension()
This is long-gone drawing API.
2016-11-16 18:36:10 +01:00
Timm Bäder
ed184b3935 Remove GtkIconFactory
Move the icon size lookup API into gtkicontheme.c
2016-10-16 18:17:21 +02:00
Timm Bäder
f7e6385506 gtkrender: Remove superfluous cairo_save/restore calls
These were all surrounding functions that either call
cairo_save/cairo_restore themselves or don't need to.
2016-05-05 11:02:06 +02:00
Benjamin Otte
a72c4576b2 cssimagebuiltin: Remove icons that don't draw anything anymore 2016-05-03 12:59:13 +02:00
Matthias Clasen
5fd7b85d2b Add a function to get affected area for background
The new function, gtk_render_background_get_clip answers the
question: what pixels are affected if I call gtk_render_background ?

The long-term goal is to have APIs that answer this question for
all rendering primitives.
2016-01-20 09:41:01 -05:00
Christoph Reiter
f66191346c Mention GtkIconSize in all docs where the argument/return is annotated as taking an int instead of GtkIconSize
In https://bugzilla.gnome.org/show_bug.cgi?id=601425 the annotations
were changed to int as they not only take the predefined enum values
but also user defined values registered through gtk_icon_size_register()

As a result the typelib doesn't contain any information about
GtkIconSize for those arguments and the Python docstring only
shows the corresponding Python type "int".

This changes the argument docs to mention the type explicitly
so the Python doc generator can add a link to Gtk.IconSize
which contains the most useful predefined values.

https://bugzilla.gnome.org/show_bug.cgi?id=757411
2016-01-04 11:56:44 +01:00
Benjamin Otte
cf77c1695d iconhelper: Pass only the CssStyle when loading iconsets 2015-12-09 13:30:40 +01:00
Benjamin Otte
1b835fc7ce css: Leftover renaming gtk-image-effect => icon-effect
The previous renaming commit was incomplete, so here we go again.
2015-12-04 17:44:51 +01:00
Benjamin Otte
a37220109f render: Split out icon-effect apply function 2015-12-04 17:44:51 +01:00
Benjamin Otte
2396265523 css: Rename -gtk-image-effect to -gtk-icon-effect
This is a property for icons, so we should name it as such.
2015-12-02 00:29:31 +01:00
Phillip Wood
ce8b5b4586 Fix character entities
These are not supposed to be supported by gtk-doc¹

¹https://bugzilla.gnome.org/show_bug.cgi?id=758137

https://bugzilla.gnome.org/show_bug.cgi?id=758175
2015-11-19 14:54:57 -05:00
Matthias Clasen
78373eb9f7 Don't use a transient node in gtk_render_arrow()
It is not necessary for the users of this API, and causes things
to not work as intended. Without this transient node, styling
"notebook header tabs arrow" has the desired effect on notebook
arrows.
2015-11-08 21:08:38 -05:00
Emmanuele Bassi
f959b35064 docs: Clarify gtk_render_icon()'s behaviour
A GdkPixbuf has no scaling factor, so drawing directly from it can only
using a scale of 1, to avoid blurry, fuzzy icons.

You should be using gtk_render_icon_surface() anyway.
2015-11-04 11:45:41 +00:00
Matthias Clasen
6f829d4450 Silence another compiler warning
Again, our habit of comparing enum values against -1.
2015-03-22 15:20:43 -04:00
Benjamin Otte
99c4f2dd39 render: Make image effect not depend on state
Instead rely on -gtk-image-effect only. Adwaita should already work this
way.

Relying on state was a leftover feature from the GTK 2 days.
2015-03-18 15:22:09 +01:00
Benjamin Otte
8c745088d5 render: Split icon surface rendering out
Just like normal icons, icon surfaces belong into gtkrendericon.c.
2015-01-20 06:30:20 +01:00
Benjamin Otte
f6d64f6591 render: Split icon rendering into its own file 2015-01-20 06:30:19 +01:00
Benjamin Otte
e697213b35 render: Remove spinner special-cases
The spinner is a regular builtin image now. There is no need to go
through the shadows code manually anymore as regular items do get
shadows automatically.

This also allows simplifying the actual spinner drawing code so that it
actually works.
2015-01-20 06:30:19 +01:00
Benjamin Otte
cc4d34e688 render: Render builtin images as regular CSS images
This not only reduces code, but also allows for builtin images to have
shadows or be transformed using -gtk-icon-transform.
2015-01-20 06:30:19 +01:00
Benjamin Otte
45541cbf10 render: Don't require passing CSS properties to builtin images
Instead, make the buiultin image get those properties itself in the
compute vfunc.
2015-01-20 06:30:19 +01:00
Benjamin Otte
fe028e2789 render: Only render 4 different arrows
Instead of supporting every angle, just support top, right, bottom and
left and round the angle to one of those directions.

Adwaita overrides arrows anyway and doesn't even look at the angle, so
this should not be a problem.
2015-01-20 06:30:19 +01:00
Benjamin Otte
118c887656 render: Don't pass junction sides to builtin image
Instead, split the grip into 8 different builtin images (one for each
side and corner).
2015-01-20 06:30:19 +01:00
Benjamin Otte
e6b228f12a render: Extend builtin images to account for states
We add to the enum to account for the images generated for different
states.
2015-01-20 06:30:19 +01:00
Benjamin Otte
1c3dd5d46b render: Move code for rendering builtin images
Also, make it have a generic entry point with
gtk_css_image_builtin_draw().

The only feature lost so is the drawing of shadows for spinners, but
that will come back later.
2015-01-20 06:30:19 +01:00
Benjamin Otte
8b6d419e02 render: Move border rendering into its own file
gtkrenderborder.c now contains the implementation for
  gtk_css_style_render_border
  gtk_css_style_render_outline
2015-01-20 06:30:19 +01:00
Benjamin Otte
5ec97f6144 render: Remove unused header 2015-01-20 06:30:19 +01:00
Benjamin Otte
717877dff2 render: Rename gtkborderimage.[ch]
I want the gtkrender prefix for all filenames about rendering.
2015-01-20 06:30:18 +01:00
Benjamin Otte
cb0ca9a804 render: Use a GtkCssStyle instead of GtkStyleContext for focus 2015-01-20 06:30:18 +01:00
Benjamin Otte
5cc0cae4b7 render: Rename gtkthemingbackground.[ch]
I want the gtkrender prefix for all filenames about rendering.
2015-01-20 06:30:18 +01:00
Benjamin Otte
d25b4105d6 render: Take a GtkCssStyle for rendering frames
... and move the whole function into gtkthemingbackground.c
2015-01-20 01:23:19 +01:00
Benjamin Otte
d0a12d477e borderimage: Use a GtkCssStyle instead of GtkStyleContext 2015-01-20 01:23:19 +01:00
Benjamin Otte
dd2202288a themingbackground: Use a GtkCssStyle instead of GtkStyleContext 2015-01-20 01:23:19 +01:00
Benjamin Otte
8d94140da9 roundedbox: Take a GtkCssStyle instead of a GtkStyleContext
This is in preparation for iusing GtkCssStyle instead of GtkStyleContext
in render functions.
2015-01-20 01:23:18 +01:00
Benjamin Otte
858c80f33e render: Replace gtk_style_context_get_border/padding()
Use _gtk_style_context_peek_property() instead.
2015-01-19 01:15:20 +01:00
Benjamin Otte
8b11e93a2d render: Get rid of gtk_style_context_get_color()
Use _gtk_style_context_peek_property() instead.
2015-01-19 01:15:19 +01:00
Benjamin Otte
8abc6e06b2 css: Add "-gtk-icon-source: builtin"
... and make it the default. This takes over the meaning from "none" for
this property in that it draws the fallback builtin image.
"none" now literally means no image will be drawn.
2014-10-21 05:53:19 +02:00
Benjamin Otte
57d24f173a render: We use CHECKED now, not ACTIVE
Update docs and custom rendering of checkmarks and radio buttons
2014-10-21 05:53:19 +02:00
Benjamin Otte
ccf6507f6a render: Fix uninitialized variables
Refactoring for performance in 39097ea2da
caused border_width to be uninitialized when rendering border images.

https://bugzilla.gnome.org/show_bug.cgi?id=738483
2014-10-15 02:16:24 +02:00
Benjamin Otte
39097ea2da render: Optimize the no-borders case to exit early 2014-10-10 00:27:46 +02:00
Benjamin Otte
05460f4982 render: Make rendering the background a single function 2014-10-08 05:20:30 +02:00
Benjamin Otte
3c50c0988a render: Overhaul gtk_render_handle()
The code did weird things with drawing backgrounds sometimes but not
really. Now it does this:

(1) render a background
(2) render a frame
(3) render an icon
    - if no icon exists, draw the generic handle icon
2014-10-08 05:20:30 +02:00
Benjamin Otte
c39bd623f6 colorswatch: Render background properly
We want to render a background *and* the current color (if there is
one).

This also adds a custom function gtk_render_add_content_path() which
adds the path of the current content area to a cairo_t.
2014-10-08 05:20:30 +02:00