summaryrefslogtreecommitdiff
path: root/ccss-gtk
diff options
context:
space:
mode:
authorRobert Staudinger <robsta@gnome.org>2008-11-24 20:29:29 +0100
committerRobert Staudinger <robsta@gnome.org>2008-11-24 20:29:29 +0100
commit71c21c74a6b09543d7131e3a5ecb64644753b5ae (patch)
treeefd8e1aee0bb6b53726e734bd93506de5306f5c0 /ccss-gtk
parent7aafb0e30d4a142ca180bdbaa0f43c5476570709 (diff)
* Makefile.am:
* ccss-cairo/Makefile.am: * ccss-cairo/ccss-background-parser.c (bg_attachment_parse), (bg_image_parse), (bg_position_parse), (bg_repeat_parse), (bg_size_parse), (background_factory), (background_attachment_new), (background_attachment_convert), (background_image_new), (background_image_convert), (background_position_new), (background_position_convert), (background_repeat_new), (background_repeat_convert), (background_size_new), (background_size_convert), (peek_property_class), (ccss_background_get_ptable): * ccss-cairo/ccss-background-parser.h: * ccss-cairo/ccss-background.c (create_pattern), (repeat), (repeat_x), (repeat_y), (no_repeat), (ccss_background_fill): * ccss-cairo/ccss-background.h: * ccss-cairo/ccss-border-image-parser.c (parse_tiling), (border_image_new), (border_image_convert), (peek_property_class), (ccss_border_image_get_ptable): * ccss-cairo/ccss-border-image-parser.h: * ccss-cairo/ccss-border-image.c (create_tile), (create_border), (create_middle), (paint), (ccss_border_image_draw): * ccss-cairo/ccss-border-image.h: * ccss-cairo/ccss-border-parser.c (match_style), (lookup_style), (parse_width), (parse_style), (parse_radius), (border_color_factory), (border_style_factory), (border_width_factory), (border_factory_impl), (border_factory), (border_left_factory), (border_top_factory), (border_right_factory), (border_bottom_factory), (border_radius_new), (border_radius_factory), (border_radius_convert), (border_style_new), (border_style_convert), (border_width_new), (border_width_convert), (peek_property_class), (ccss_border_get_ptable): * ccss-cairo/ccss-border-parser.h: * ccss-cairo/ccss-border.c (_pi), (line), (draw_none_line), (draw_dotted_line), (draw_dashed_line), (draw_solid_line), (get_line_draw_func), (join), (draw_none_join), (draw_solid_join), (get_join_draw_func), (ccss_border_clamp_radii), (border), (ccss_border_path), (ccss_border_draw): * ccss-cairo/ccss-border.h: * ccss-cairo/ccss-cairo-property.c (ccss_property_background_attachment), (ccss_property_background_color), (ccss_property_background_image), (ccss_property_background_position), (ccss_property_background_repeat), (ccss_property_background_size), (ccss_property_border_color), (ccss_property_border_style), (ccss_property_border_width), (ccss_property_border_bottom_color), (ccss_property_border_bottom_style), (ccss_property_border_bottom_width), (ccss_property_border_left_color), (ccss_property_border_left_style), (ccss_property_border_left_width), (ccss_property_border_right_color), (ccss_property_border_right_style), (ccss_property_border_right_width), (ccss_property_border_top_color), (ccss_property_border_top_style), (ccss_property_border_top_width), (ccss_property_border_radius), (ccss_property_border_top_left_radius), (ccss_property_border_top_right_radius), (ccss_property_border_bottom_right_radius), (ccss_property_border_bottom_left_radius), (ccss_property_color), (ccss_property_border_image): * ccss-cairo/ccss-cairo-property.h: * ccss-cairo/ccss-cairo-style-priv.h: * ccss-cairo/ccss-cairo-style.c (ccss_style_subsystem_init), (ccss_style_subsystem_shutdown), (lookup_property_r), (ccss_style_draw_line), (gather_stroke), (gather_join), (ccss_style_gather_outline), (ccss_style_gather_background), (ccss_style_draw_outline), (ccss_style_draw_rectangle), (ccss_style_draw_gap): * ccss-cairo/ccss-cairo-style.h: * ccss-cairo/ccss-cairo.c (ccss_cairo_init), (ccss_cairo_shutdown): * ccss-cairo/ccss-cairo.h: * ccss-cairo/ccss-cairo.sym: * ccss-cairo/ccss-color.c (parse_name), (hex), (parse_hex), (ccss_color_parse), (ccss_color_new), (ccss_color_free), (ccss_color_convert), (peek_property_class), (ccss_color_get_ptable): * ccss-cairo/ccss-color.h: * ccss-cairo/ccss-image.c (ccss_image_discard), (load_svg), (load_png), (load_image), (ccss_image_parse): * ccss-cairo/ccss-image.h: * ccss-cairo/ccss-position.c (ccss_position_parse), (ccss_position_get_pos), (ccss_position_get_size), (contain), (cover), (ccss_position_get_hsize), (ccss_position_get_vsize), (ccss_position_serialize): * ccss-cairo/ccss-position.h: * ccss-clutter/Makefile.am: * ccss-clutter/ccss-clutter.h: * ccss-clutter/example-1.c (main): * ccss-gtk/Makefile.am: * ccss-gtk/ccss-gtk-style.c: * ccss-gtk/ccss-gtk-style.h: * ccss-gtk/ccss-gtk.h: * ccss-gtk/ccss-gtk.sym.in: * ccss/Makefile.am: * ccss/ccss-background-parser.c: * ccss/ccss-background-parser.h: * ccss/ccss-background.c: * ccss/ccss-background.h: * ccss/ccss-block-priv.h: * ccss/ccss-block.c: * ccss/ccss-border-image-parser.c: * ccss/ccss-border-image-parser.h: * ccss/ccss-border-image.c: * ccss/ccss-border-image.h: * ccss/ccss-border-parser.c: * ccss/ccss-border-parser.h: * ccss/ccss-border.c: * ccss/ccss-border.h: * ccss/ccss-cairo-property.c: * ccss/ccss-cairo-property.h: * ccss/ccss-color.c: * ccss/ccss-color.h: * ccss/ccss-function-priv.h: * ccss/ccss-function.h: * ccss/ccss-image.c: * ccss/ccss-image.h: * ccss/ccss-parser.c: * ccss/ccss-position.c: * ccss/ccss-position.h: * ccss/ccss-priv.h: * ccss/ccss-property-priv.h: * ccss/ccss-property.c: * ccss/ccss-property.h: * ccss/ccss-style-priv.h: * ccss/ccss-style.c (ccss_style_get_double), (ccss_style_get_string): * ccss/ccss-style.h: * ccss/ccss.c (ccss_init), (ccss_shutdown): * ccss/ccss.sym: * configure.in: * libccss-gtk-1.pc.in: Split out the cairo-dependent code.
Diffstat (limited to 'ccss-gtk')
-rw-r--r--ccss-gtk/Makefile.am42
-rw-r--r--ccss-gtk/ccss-gtk-style.c293
-rw-r--r--ccss-gtk/ccss-gtk-style.h43
-rw-r--r--ccss-gtk/ccss-gtk.h27
-rw-r--r--ccss-gtk/ccss-gtk.sym.in2
5 files changed, 0 insertions, 407 deletions
diff --git a/ccss-gtk/Makefile.am b/ccss-gtk/Makefile.am
deleted file mode 100644
index 7fc387e..0000000
--- a/ccss-gtk/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-
-AM_CPPFLAGS = \
- $(CCSS_GTK_CFLAGS) \
- -I$(top_srcdir) \
- -I$(top_builddir)
-
-lib_LTLIBRARIES = libccss-gtk-1.la
-
-libccss_gtk_1_la_DEPENDENCIES = \
- ccss-gtk.sym \
- ../ccss/libccss-static.la
-
-libccss_gtk_1_la_LIBADD = \
- $(CCSS_GTK_LIBS) \
- ../ccss/libccss-static.la
-
-libccss_gtk_1_la_LDFLAGS = -no-undefined -version-info $(VERSION_INFO)
-
-if CCSS_DEBUG
-else
-libccss_gtk_1_la_LDFLAGS += -export-symbols ./ccss-gtk.sym
-endif
-
-headersdir = $(includedir)/libccss-1/ccss-gtk
-
-headers_DATA = \
- ccss-gtk.h \
- ccss-gtk-style.h
-
-libccss_gtk_1_la_SOURCES = \
- $(headers_DATA) \
- ccss-gtk-style.c
-
-CLEANFILES = \
- ccss-gtk.sym
-
-EXTRA_DIST = \
- ccss-gtk.sym.in
-
-ccss-gtk.sym: $(top_srcdir)/ccss/ccss.sym ccss-gtk.sym.in
- cat $^ > $@
-
diff --git a/ccss-gtk/ccss-gtk-style.c b/ccss-gtk/ccss-gtk-style.c
deleted file mode 100644
index 3dec62d..0000000
--- a/ccss-gtk/ccss-gtk-style.c
+++ /dev/null
@@ -1,293 +0,0 @@
-/* The Cairo CSS Drawing Library.
- * Copyright (C) 2008 Robert Staudinger
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-
-#include "ccss/ccss-style-priv.h"
-#include "ccss-gtk-style.h"
-
-/**
- * ccss_style_draw_gap:
- * @self: a ccss_style_t.
- * @cr: the target to draw onto.
- * @x: the starting x coordinate.
- * @y: the starting y coordinate.
- * @width: width of the outline to draw.
- * @height: height of the outline to draw.
- * @gap_side: side in which to leave the gap.
- * @gap_start: starting position of the gap.
- * @gap_width: width of the gap.
- *
- * Draw a rectangle with gap using this style instance.
- **/
-void
-ccss_style_draw_gap (ccss_style_t const *self,
- cairo_t *cr,
- int32_t x,
- int32_t y,
- int32_t width,
- int32_t height,
- GtkPositionType gap_side,
- int32_t gap_start,
- int32_t gap_width)
-{
- ccss_border_stroke_t bottom, left, right, top;
- ccss_border_join_t const *bl;
- ccss_border_join_t const *br;
- ccss_border_join_t const *tl;
- ccss_border_join_t const *tr;
-
- ccss_background_attachment_t const *bg_attachment;
- ccss_color_t const *bg_color;
- ccss_background_image_t const *bg_image;
- ccss_background_position_t const *bg_position;
- ccss_background_repeat_t const *bg_repeat;
- ccss_background_size_t const *bg_size;
-
- ccss_border_join_t bottom_left;
- ccss_border_join_t bottom_right;
- ccss_border_join_t top_left;
- ccss_border_join_t top_right;
- int32_t l, t, w, h;
-
- ccss_style_gather_outline (self, &bottom, &left, &right, &top,
- &bl, &br, &tl, &tr);
-
- ccss_style_gather_background (self, &bg_attachment, &bg_color, &bg_image,
- &bg_position, &bg_repeat, &bg_size);
-
-
- /* The rounding radii will have to be adjusted for certain gap
- * positions, so we work on a copied set of them. */
- bottom_left = *bl;
- bottom_right = *br;
- top_left = *tl;
- top_right = *tr;
-
- switch (gap_side) {
- case GTK_POS_LEFT:
- if (bottom_left.radius > height - gap_start - gap_width)
- bottom_left.radius = height - gap_start - gap_width;
- if (top_left.radius > gap_start)
- top_left.radius = gap_start;
- break;
- case GTK_POS_TOP:
- if (top_left.radius > gap_start)
- top_left.radius = gap_start;
- if (top_right.radius > width - gap_start - gap_width)
- top_right.radius = width - gap_start - gap_width;
- break;
- case GTK_POS_RIGHT:
- if (top_right.radius > gap_start)
- top_right.radius = gap_start;
- if (bottom_right.radius > height - gap_start - gap_width)
- bottom_right.radius = height - gap_start - gap_width;
- break;
- case GTK_POS_BOTTOM:
- if (bottom_left.radius > gap_start)
- bottom_left.radius = gap_start;
- if (bottom_right.radius > width - gap_start - gap_width)
- bottom_right.radius = width - gap_start - gap_width;
- break;
- default:
- g_assert_not_reached ();
- return; /* prevent error building without assertions */
- }
-
- if (top_left.radius < 0) top_left.radius = 0;
- if (top_right.radius < 0) top_right.radius = 0;
- if (bottom_right.radius < 0) bottom_right.radius = 0;
- if (bottom_left.radius < 0) bottom_left.radius = 0;
-
- ccss_border_clamp_radii (x, y, width, height,
- &top_left.radius, &top_right.radius,
- &bottom_right.radius, &bottom_left.radius);
-
- ccss_border_path (&left, &top_left,
- &top, &top_right,
- &right, &bottom_right,
- &bottom, &bottom_left,
- cr, x, y, width, height);
-
- /* FIXME: background size is calculated against allocation
- * when using `fixed'. */
- if (CCSS_BACKGROUND_FIXED == bg_attachment->attachment) {
- l = self->viewport_x;
- t = self->viewport_y;
- w = self->viewport_width;
- h = self->viewport_height;
- } else {
- l = x;
- t = y;
- w = width;
- h = height;
- }
-
- ccss_background_fill (bg_attachment, bg_color, bg_image, bg_position,
- bg_repeat, bg_size, cr, l, t, w, h);
-
- cairo_new_path (cr);
-
- /* Drawing functions start at bottom-left corder and
- * proceed clock-wise. */
- switch (gap_side) {
- case GTK_POS_LEFT:
- /* Draw gap only if it's not over the whole border. */
- if (gap_start > y || gap_width < height) {
- /* Rounding reaches until start of gap?
- * With Gtk+ the portion following the gap might not be visible. */
- if (bottom_left.radius < height - gap_start - gap_width &&
- gap_start + gap_width < height) {
- ccss_border_draw (&left, NULL, NULL, NULL,
- NULL, NULL, NULL, &bottom_left,
- CCSS_BORDER_VISIBILITY_HIDE_BOTTOM_LEFT |
- CCSS_BORDER_ROUNDING_UNRESTRICTED,
- cr, x, y + gap_start + gap_width - 1,
- 0, height - gap_start - gap_width);
- }
- /* Rounding reaches until start of gap? */
- if (top_left.radius < gap_start) {
- ccss_border_draw (&left, &top_left, NULL, NULL,
- NULL, NULL, NULL, NULL,
- CCSS_BORDER_VISIBILITY_HIDE_LEFT_TOP |
- CCSS_BORDER_ROUNDING_UNRESTRICTED,
- cr, x, y, 0, gap_start + 1);
- }
- }
- ccss_border_draw (&left, &top_left,
- &top, &top_right,
- &right, &bottom_right,
- &bottom, &bottom_left,
- CCSS_BORDER_VISIBILITY_HIDE_LEFT,
- cr, x, y, width, height);
- break;
- case GTK_POS_TOP:
- /* Draw gap only if it's not over the whole border. */
- if (gap_start > x || gap_width < width) {
- /* Rounding reaches until start of gap? */
- if (top_left.radius < gap_start) {
- ccss_border_draw (NULL, &top_left, &top, NULL,
- NULL, NULL, NULL, NULL,
- CCSS_BORDER_VISIBILITY_HIDE_LEFT_TOP |
- CCSS_BORDER_ROUNDING_UNRESTRICTED,
- cr, x, y, gap_start + 1, 0);
- }
- /* Rounding reaches until start of gap?
- * With Gtk+ the portion following the gap might not be visible. */
- if (top_right.radius < width - gap_start - gap_width &&
- gap_start + gap_width < width) {
- ccss_border_draw (NULL, NULL, &top, &top_right,
- NULL, NULL, NULL, NULL,
- CCSS_BORDER_VISIBILITY_HIDE_TOP_RIGHT |
- CCSS_BORDER_ROUNDING_UNRESTRICTED,
- cr, x + gap_start + gap_width - 1, y,
- width - gap_start - gap_width, 0);
- }
- }
- ccss_border_draw (&left, &top_left,
- &top, &top_right,
- &right, &bottom_right,
- &bottom, &bottom_left,
- CCSS_BORDER_VISIBILITY_HIDE_TOP,
- cr, x, y, width, height);
- break;
- case GTK_POS_RIGHT:
- /* Draw gap only if it's not over the whole border. */
- if (gap_start > y || gap_width < height) {
- /* Rounding reaches until start of gap? */
- if (top_right.radius < gap_start) {
- ccss_border_draw (NULL, NULL, NULL, &top_right,
- &right, NULL, NULL, NULL,
- CCSS_BORDER_VISIBILITY_HIDE_TOP_RIGHT |
- CCSS_BORDER_ROUNDING_UNRESTRICTED,
- cr, x + width, y, 0, gap_start + 1);
- }
- /* Rounding reaches until start of gap?
- * With Gtk+ the portion following the gap might not be visible. */
- if (bottom_right.radius < height - gap_start - gap_width &&
- gap_start + gap_width < height) {
- ccss_border_draw (NULL, NULL, NULL, NULL,
- &right, &bottom_right, NULL, NULL,
- CCSS_BORDER_VISIBILITY_HIDE_RIGHT_BOTTOM |
- CCSS_BORDER_ROUNDING_UNRESTRICTED,
- cr, x + width, y + gap_start + gap_width - 1,
- 0, height - gap_start - gap_width);
- }
- }
- ccss_border_draw (&left, &top_left,
- &top, &top_right,
- &right, &bottom_right,
- &bottom, &bottom_left,
- CCSS_BORDER_VISIBILITY_HIDE_RIGHT,
- cr, x, y, width, height);
- break;
- case GTK_POS_BOTTOM:
- /* Draw gap only if it's not over the whole border. */
- if (gap_start > x || gap_width < width) {
- /* Rounding reaches until start of gap? &&
- * With Gtk+ the portion following the gap might not be visible. */
- if (bottom_right.radius < width - gap_start - gap_width &&
- gap_start + gap_width < width) {
- ccss_border_draw (NULL, NULL, NULL, NULL,
- NULL, &bottom_right, &bottom, NULL,
- CCSS_BORDER_VISIBILITY_HIDE_RIGHT_BOTTOM |
- CCSS_BORDER_ROUNDING_UNRESTRICTED,
- cr, x + gap_start + gap_width - 1, y + height,
- width - gap_start - gap_width, 0);
- }
- /* Rounding reaches until start of gap? */
- if (bottom_left.radius < gap_start) {
- ccss_border_draw (NULL, NULL, NULL, NULL,
- NULL, NULL, &bottom, &bottom_left,
- CCSS_BORDER_VISIBILITY_HIDE_BOTTOM_LEFT |
- CCSS_BORDER_ROUNDING_UNRESTRICTED,
- cr, x, y + height, gap_start + 1, 0);
- }
- }
- ccss_border_draw (&left, &top_left,
- &top, &top_right,
- &right, &bottom_right,
- &bottom, &bottom_left,
- CCSS_BORDER_VISIBILITY_HIDE_BOTTOM,
- cr, x, y, width, height);
- break;
- default:
- g_assert_not_reached ();
- return; /* prevent error building without assertions */
- }
-}
-
-/**
- * ccss_style_draw_polygon:
- * @self: a ccss_style_t.
- * @cr: the target to draw onto.
- * @points: an array of #GdkPoint<!-- -->s.
- * @n_points: length of @points.
- * @fill: %true if the polygon should be filled.
- *
- * Draw a rectangle with gap using this style instance.
- **/
-void
-ccss_style_draw_polygon (ccss_style_t const *self,
- cairo_t *cr,
- GdkPoint *points,
- int32_t n_points,
- bool fill)
-{
-
-}
-
diff --git a/ccss-gtk/ccss-gtk-style.h b/ccss-gtk/ccss-gtk-style.h
deleted file mode 100644
index 9679bea..0000000
--- a/ccss-gtk/ccss-gtk-style.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* The Cairo CSS Drawing Library.
- * Copyright (C) 2008 Robert Staudinger
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-
-#ifndef CCSS_GTK_STYLE_H
-#define CCSS_GTK_STYLE_H
-
-#include <stdbool.h>
-#include <stdint.h>
-#include <cairo.h>
-#include <gtk/gtk.h>
-#include <ccss/ccss-features.h>
-#include <ccss/ccss-macros.h>
-#include <ccss/ccss-style.h>
-
-CCSS_BEGIN_DECLS
-
-void ccss_style_draw_gap (ccss_style_t const *self, cairo_t *cr,
- int32_t x, int32_t y, int32_t width, int32_t height,
- GtkPositionType gap_side, int32_t gap_x, int32_t gap_width);
-
-void ccss_style_draw_polygon (ccss_style_t const *self, cairo_t *cr,
- GdkPoint *points, int32_t n_points, bool fill);
-
-CCSS_END_DECLS
-
-#endif /* CCSS_GTK_STYLE_H */
-
diff --git a/ccss-gtk/ccss-gtk.h b/ccss-gtk/ccss-gtk.h
deleted file mode 100644
index 455c23d..0000000
--- a/ccss-gtk/ccss-gtk.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* The Cairo CSS Drawing Library.
- * Copyright (C) 2008 Robert Staudinger
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-
-#ifndef CCSS_GTK_H
-#define CCSS_GTK_H
-
-#include <ccss/ccss.h>
-#include <ccss-gtk/ccss-gtk-style.h>
-
-#endif /* CCSS_GTK_H */
-
diff --git a/ccss-gtk/ccss-gtk.sym.in b/ccss-gtk/ccss-gtk.sym.in
deleted file mode 100644
index f746473..0000000
--- a/ccss-gtk/ccss-gtk.sym.in
+++ /dev/null
@@ -1,2 +0,0 @@
-ccss_style_draw_gap
-ccss_style_draw_polygon