gtk-css-engine r183 - in trunk: . src
- From: robsta svn gnome org
- To: svn-commits-list gnome org
- Subject: gtk-css-engine r183 - in trunk: . src
- Date: Thu, 6 Nov 2008 15:27:25 +0000 (UTC)
Author: robsta
Date: Thu Nov 6 15:27:25 2008
New Revision: 183
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=183&view=rev
Log:
* src/gce-maps.c (gce_maps_match_role):
* src/gce-maps.h:
* src/gce-style.c (draw_hline), (draw_vline), (draw_shadow),
(draw_box), (draw_flat_box), (draw_check), (draw_option),
(draw_shadow_gap), (draw_box_gap), (draw_extension), (draw_slider),
(draw_handle), (draw_resize_grip), (draw_focus), (draw_expander),
(draw_diamond), (draw_arrow), (draw_tab):
Basic support for `sub-widget roles'.
Modified:
trunk/ChangeLog
trunk/src/gce-maps.c
trunk/src/gce-maps.h
trunk/src/gce-style.c
Modified: trunk/src/gce-maps.c
==============================================================================
--- trunk/src/gce-maps.c (original)
+++ trunk/src/gce-maps.c Thu Nov 6 15:27:25 2008
@@ -89,7 +89,7 @@
"tree-view-drop-indicator-middle", NULL };
static const struct {
- char const *type;
+ char const *type_name;
char const *primitive;
char const *role;
int shadow;
@@ -122,25 +122,26 @@
char const *
gce_maps_match_role (GtkWidget *widget,
char const *primitive,
- GtkShadowType shadow_type,
+ int shadow,
char const *detail,
gint x,
gint y,
gint width,
gint height)
{
- char const *type;
- int shadow;
+ char const *type_name;
gboolean had_match;
- g_return_val_if_fail (widget, NULL);
+ if (!widget) {
+ /* That's ok, we just can't determine any role. */
+ return NULL;
+ }
- type = G_OBJECT_CLASS_NAME (widget);
- shadow = shadow_type;
+ type_name = G_OBJECT_TYPE_NAME (G_OBJECT (widget));
had_match = FALSE;
for (unsigned int i = 0; i < G_N_ELEMENTS (_widgets); i++) {
- if (0 == g_strcmp0 (type, _widgets[i].type)) {
+ if (0 == g_strcmp0 (type_name, _widgets[i].type_name)) {
had_match = TRUE;
if (0 == g_strcmp0 (primitive, _widgets[i].primitive)) {
if (_widgets[i].shadow > -1) {
@@ -160,7 +161,7 @@
}
return NULL;
} else {
- /* No further match. */
+ /* No further match required. */
return _widgets[i].role;
}
}
Modified: trunk/src/gce-maps.h
==============================================================================
--- trunk/src/gce-maps.h (original)
+++ trunk/src/gce-maps.h Thu Nov 6 15:27:25 2008
@@ -25,15 +25,14 @@
G_BEGIN_DECLS
-char const *
-gce_maps_match_role (GtkWidget *widget,
- char const *primitive,
- GtkShadowType shadow_type,
- char const *detail,
- gint x,
- gint y,
- gint width,
- gint height);
+char const * gce_maps_match_role (GtkWidget *widget,
+ char const *primitive,
+ int shadow,
+ char const *detail,
+ gint x,
+ gint y,
+ gint width,
+ gint height);
char const * gce_maps_match_detail (char const *gce_detail);
char const * gce_maps_get_detail (char const *gtk_detail);
Modified: trunk/src/gce-style.c
==============================================================================
--- trunk/src/gce-style.c (original)
+++ trunk/src/gce-style.c Thu Nov 6 15:27:25 2008
@@ -173,10 +173,14 @@
gint x2,
gint y)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "hline", -1, detail, x1, y, x2 - x1, -1);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
NULL, NULL, NULL, NULL, NULL,
"hline");
@@ -197,10 +201,14 @@
gint y2,
gint x)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "vline", -1, detail, x, y1, -1, y2 - y1);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
NULL, NULL, NULL, NULL, NULL,
"vline");
@@ -224,10 +232,14 @@
gint width,
gint height)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "shadow", shadow, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
gce_maps_get_shadow (shadow),
NULL, NULL, NULL, NULL,
@@ -252,10 +264,14 @@
gint width,
gint height)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "box", shadow, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
gce_maps_get_shadow (shadow),
NULL, NULL, NULL, NULL,
@@ -280,10 +296,14 @@
gint width,
gint height)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "flat-box", shadow, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
gce_maps_get_shadow (shadow),
NULL, NULL, NULL, NULL,
@@ -308,10 +328,14 @@
gint width,
gint height)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "check", shadow, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
gce_maps_get_shadow (shadow),
NULL, NULL, NULL, NULL,
@@ -336,10 +360,14 @@
gint width,
gint height)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "option", shadow, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
gce_maps_get_shadow (shadow),
NULL, NULL, NULL, NULL,
@@ -367,10 +395,14 @@
gint gap_start,
gint gap_width)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "shadow-gap", shadow, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
gce_maps_get_shadow (shadow),
NULL, gce_maps_get_position (gap_side), NULL, NULL,
@@ -398,10 +430,14 @@
gint gap_start,
gint gap_width)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "box-gap", shadow, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
gce_maps_get_shadow (shadow),
NULL, gce_maps_get_position (gap_side), NULL, NULL,
@@ -427,11 +463,15 @@
gint height,
GtkPositionType gap_side)
{
- GceNode *node;
- gint gap_width;
+ GceNode *node;
+ char const *role;
+ gint gap_width;
+
+ role = gce_maps_match_role (widget, "extension", shadow, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
gce_maps_get_shadow (shadow),
NULL, gce_maps_get_position (gap_side), NULL, NULL,
@@ -468,10 +508,14 @@
gint height,
GtkOrientation orientation)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "slider", shadow, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
gce_maps_get_shadow (shadow),
gce_maps_get_orientation (orientation),
@@ -498,10 +542,14 @@
gint height,
GtkOrientation orientation)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "handle", shadow, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
gce_maps_get_shadow (shadow),
gce_maps_get_orientation (orientation),
@@ -527,10 +575,14 @@
gint width,
gint height)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "resize-grip", -1, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
NULL, NULL, NULL, gce_maps_get_window_edge (edge), NULL,
"resizegrip");
@@ -553,10 +605,14 @@
gint width,
gint height)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "focus", -1, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
NULL, NULL, NULL, NULL, NULL,
"focus");
@@ -579,8 +635,12 @@
GtkExpanderStyle style)
{
#define DEFAULT_EXPANDER_SIZE 12
- GceNode *node;
- gint expander_size;
+ GceNode *node;
+ char const *role;
+ gint expander_size;
+
+ role = gce_maps_match_role (widget, "expander", -1, detail, x, y, -1, -1);
+ detail = gce_maps_get_detail (detail);
if (widget &&
gtk_widget_class_find_style_property (GTK_WIDGET_GET_CLASS (widget),
@@ -593,7 +653,7 @@
}
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
NULL, NULL, NULL, NULL, gce_maps_get_expander_style (style),
"expander");
@@ -618,10 +678,14 @@
gint width,
gint height)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "diamond", shadow, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
gce_maps_get_shadow (shadow),
NULL, NULL, NULL, NULL,
@@ -651,10 +715,14 @@
gint width,
gint height)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "arrow", shadow, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
gce_maps_get_shadow (shadow),
gce_maps_get_arrow (arrow),
@@ -680,10 +748,14 @@
gint width,
gint height)
{
- GceNode *node;
+ GceNode *node;
+ char const *role;
+
+ role = gce_maps_match_role (widget, "tab", shadow, detail, x, y, width, height);
+ detail = gce_maps_get_detail (detail);
node = gce_node_cache_fetch_node (widget,
- gce_maps_get_detail (detail),
+ role ? role : detail,
gce_maps_get_state (state),
gce_maps_get_shadow (shadow),
NULL, NULL, NULL, NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]