2011-05-26 01:50:53 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 2011 Benjamin Otte <otte@gnome.org>
|
|
|
|
*
|
|
|
|
* 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
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2011-05-26 01:50:53 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GTK_CSS_TYPES_PRIVATE_H__
|
|
|
|
#define __GTK_CSS_TYPES_PRIVATE_H__
|
|
|
|
|
|
|
|
#include <glib-object.h>
|
2012-01-13 22:48:42 +00:00
|
|
|
#include <gtk/gtkstylecontext.h>
|
2011-05-26 01:50:53 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2011-12-29 01:27:54 +00:00
|
|
|
typedef enum {
|
|
|
|
GTK_CSS_INHERIT,
|
2012-01-14 01:38:42 +00:00
|
|
|
GTK_CSS_INITIAL
|
2011-12-29 01:27:54 +00:00
|
|
|
} GtkCssSpecialValue;
|
|
|
|
|
2012-01-05 01:48:32 +00:00
|
|
|
/* We encode horizontal and vertical repeat in one enum value.
|
|
|
|
* This eases parsing and storage, but you need to be aware that
|
|
|
|
* you have to "unpack" this value.
|
|
|
|
*/
|
|
|
|
#define GTK_CSS_BACKGROUND_REPEAT_SHIFT (8)
|
|
|
|
#define GTK_CSS_BACKGROUND_REPEAT_MASK ((1 << GTK_CSS_BACKGROUND_REPEAT_SHIFT) - 1)
|
|
|
|
#define GTK_CSS_BACKGROUND_HORIZONTAL(repeat) ((repeat) & GTK_CSS_BACKGROUND_REPEAT_MASK)
|
|
|
|
#define GTK_CSS_BACKGROUND_VERTICAL(repeat) (((repeat) >> GTK_CSS_BACKGROUND_REPEAT_SHIFT) & GTK_CSS_BACKGROUND_REPEAT_MASK)
|
|
|
|
typedef enum /*< enum >*/
|
|
|
|
{
|
|
|
|
GTK_CSS_BACKGROUND_INVALID, /*< skip >*/
|
|
|
|
GTK_CSS_BACKGROUND_REPEAT, /* start at one so we know if a value has been set */
|
|
|
|
GTK_CSS_BACKGROUND_SPACE,
|
|
|
|
GTK_CSS_BACKGROUND_ROUND,
|
2012-01-04 15:31:04 +00:00
|
|
|
GTK_CSS_BACKGROUND_NO_REPEAT,
|
2012-01-05 01:48:32 +00:00
|
|
|
/* need to hardcode the numer or glib-mkenums makes us into a flags type */
|
|
|
|
GTK_CSS_BACKGROUND_REPEAT_X = 1025,
|
|
|
|
GTK_CSS_BACKGROUND_REPEAT_Y = 260
|
2012-01-04 15:31:04 +00:00
|
|
|
} GtkCssBackgroundRepeat;
|
2011-11-06 18:33:05 +00:00
|
|
|
|
2011-06-05 20:49:54 +00:00
|
|
|
typedef enum {
|
2011-11-25 14:30:10 +00:00
|
|
|
GTK_CSS_REPEAT_STYLE_STRETCH,
|
2011-06-05 20:49:54 +00:00
|
|
|
GTK_CSS_REPEAT_STYLE_REPEAT,
|
|
|
|
GTK_CSS_REPEAT_STYLE_ROUND,
|
|
|
|
GTK_CSS_REPEAT_STYLE_SPACE
|
2011-11-07 23:10:13 +00:00
|
|
|
} GtkCssBorderRepeatStyle;
|
2011-06-05 20:49:54 +00:00
|
|
|
|
2011-11-24 19:57:02 +00:00
|
|
|
typedef enum {
|
|
|
|
GTK_CSS_AREA_BORDER_BOX,
|
|
|
|
GTK_CSS_AREA_PADDING_BOX,
|
|
|
|
GTK_CSS_AREA_CONTENT_BOX
|
|
|
|
} GtkCssArea;
|
|
|
|
|
2012-01-07 21:20:51 +00:00
|
|
|
/* for the order in arrays */
|
|
|
|
typedef enum /*< skip >*/ {
|
|
|
|
GTK_CSS_TOP,
|
|
|
|
GTK_CSS_RIGHT,
|
|
|
|
GTK_CSS_BOTTOM,
|
|
|
|
GTK_CSS_LEFT
|
|
|
|
} GtkCssSide;
|
|
|
|
|
2012-01-07 21:40:17 +00:00
|
|
|
typedef enum /*< skip >*/ {
|
|
|
|
GTK_CSS_TOP_LEFT,
|
|
|
|
GTK_CSS_TOP_RIGHT,
|
|
|
|
GTK_CSS_BOTTOM_RIGHT,
|
|
|
|
GTK_CSS_BOTTOM_LEFT
|
|
|
|
} GtkCssCorner;
|
|
|
|
|
2012-01-13 22:48:42 +00:00
|
|
|
typedef enum /*< skip >*/ {
|
|
|
|
/* CSS term: <number> */
|
|
|
|
GTK_CSS_NUMBER,
|
|
|
|
/* CSS term: <percentage> */
|
|
|
|
GTK_CSS_PERCENT,
|
|
|
|
/* CSS term: <length> */
|
|
|
|
GTK_CSS_PX,
|
|
|
|
GTK_CSS_PT,
|
|
|
|
GTK_CSS_EM,
|
|
|
|
GTK_CSS_EX,
|
|
|
|
GTK_CSS_PC,
|
|
|
|
GTK_CSS_IN,
|
|
|
|
GTK_CSS_CM,
|
2012-01-15 16:51:58 +00:00
|
|
|
GTK_CSS_MM,
|
|
|
|
/* CSS term: <angle> */
|
|
|
|
GTK_CSS_RAD,
|
|
|
|
GTK_CSS_DEG,
|
|
|
|
GTK_CSS_GRAD,
|
|
|
|
GTK_CSS_TURN
|
2012-01-13 22:48:42 +00:00
|
|
|
} GtkCssUnit;
|
|
|
|
|
|
|
|
typedef struct _GtkCssNumber GtkCssNumber;
|
2012-01-17 14:11:48 +00:00
|
|
|
typedef struct _GtkCssBackgroundSize GtkCssBackgroundSize;
|
2011-05-26 01:50:53 +00:00
|
|
|
typedef struct _GtkCssBorderCornerRadius GtkCssBorderCornerRadius;
|
2011-06-05 20:49:54 +00:00
|
|
|
typedef struct _GtkCssBorderImageRepeat GtkCssBorderImageRepeat;
|
2011-05-26 01:50:53 +00:00
|
|
|
|
2012-01-13 22:48:42 +00:00
|
|
|
struct _GtkCssNumber {
|
|
|
|
gdouble value;
|
|
|
|
GtkCssUnit unit;
|
|
|
|
};
|
|
|
|
|
2012-01-17 14:11:48 +00:00
|
|
|
struct _GtkCssBackgroundSize {
|
|
|
|
GtkCssNumber width; /* 0 means auto here */
|
|
|
|
GtkCssNumber height; /* 0 means auto here */
|
|
|
|
guint cover :1;
|
|
|
|
guint contain :1;
|
|
|
|
};
|
|
|
|
|
2011-05-26 01:50:53 +00:00
|
|
|
struct _GtkCssBorderCornerRadius {
|
2012-01-15 05:26:08 +00:00
|
|
|
GtkCssNumber horizontal;
|
|
|
|
GtkCssNumber vertical;
|
2011-05-26 01:50:53 +00:00
|
|
|
};
|
|
|
|
|
2011-06-05 20:49:54 +00:00
|
|
|
struct _GtkCssBorderImageRepeat {
|
2011-11-07 23:10:13 +00:00
|
|
|
GtkCssBorderRepeatStyle vrepeat;
|
|
|
|
GtkCssBorderRepeatStyle hrepeat;
|
2011-06-05 20:49:54 +00:00
|
|
|
};
|
|
|
|
|
2012-01-17 14:11:48 +00:00
|
|
|
#define GTK_TYPE_CSS_BACKGROUND_SIZE _gtk_css_background_size_get_type ()
|
2011-05-26 01:50:53 +00:00
|
|
|
#define GTK_TYPE_CSS_BORDER_CORNER_RADIUS _gtk_css_border_corner_radius_get_type ()
|
2011-06-05 20:49:54 +00:00
|
|
|
#define GTK_TYPE_CSS_BORDER_IMAGE_REPEAT _gtk_css_border_image_repeat_get_type ()
|
2012-01-13 22:48:42 +00:00
|
|
|
#define GTK_TYPE_CSS_NUMBER _gtk_css_number_get_type ()
|
2011-05-26 01:50:53 +00:00
|
|
|
|
2012-01-17 14:11:48 +00:00
|
|
|
GType _gtk_css_background_size_get_type (void);
|
2011-05-26 01:50:53 +00:00
|
|
|
GType _gtk_css_border_corner_radius_get_type (void);
|
2011-06-05 20:49:54 +00:00
|
|
|
GType _gtk_css_border_image_repeat_get_type (void);
|
2012-01-13 22:48:42 +00:00
|
|
|
GType _gtk_css_number_get_type (void);
|
|
|
|
|
|
|
|
#define GTK_CSS_NUMBER_INIT(_value,_unit) { (_value), (_unit) }
|
|
|
|
void _gtk_css_number_init (GtkCssNumber *number,
|
|
|
|
double value,
|
|
|
|
GtkCssUnit unit);
|
2012-01-15 05:26:08 +00:00
|
|
|
gboolean _gtk_css_number_equal (const GtkCssNumber *one,
|
|
|
|
const GtkCssNumber *two);
|
|
|
|
double _gtk_css_number_get (const GtkCssNumber *number,
|
|
|
|
double one_hundred_percent);
|
2012-01-13 22:48:42 +00:00
|
|
|
void _gtk_css_number_compute (GtkCssNumber *dest,
|
|
|
|
const GtkCssNumber *src,
|
|
|
|
GtkStyleContext *context);
|
|
|
|
void _gtk_css_number_print (const GtkCssNumber *number,
|
|
|
|
GString *string);
|
|
|
|
|
2011-05-26 01:50:53 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GTK_CSS_TYPES_PRIVATE_H__ */
|