static void child_size_allocate (GtkWidget *child, GdkRectangle *allocation, gpointer user_data) { GtkStyleContext *context; context = gtk_widget_get_style_context (child); g_print ("Child %p\nHas left? %d\nHas right? %d\nHas top? %d\nHas bottom? %d\n", child, gtk_style_context_has_class (context, "left"), gtk_style_context_has_class (context, "right"), gtk_style_context_has_class (context, "top"), gtk_style_context_has_class (context, "bottom")); }
static void gtk_do_render_handle (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height) { GtkCssImageBuiltinType type; gtk_render_background (context, cr, x, y, width, height); gtk_render_frame (context, cr, x, y, width, height); if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_GRIP)) { GtkJunctionSides sides = gtk_style_context_get_junction_sides (context); /* order is important here for when too many (or too few) sides are set */ if ((sides & GTK_JUNCTION_CORNER_BOTTOMRIGHT) == GTK_JUNCTION_CORNER_BOTTOMRIGHT) type = GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMRIGHT; else if ((sides & GTK_JUNCTION_CORNER_TOPRIGHT) == GTK_JUNCTION_CORNER_TOPRIGHT) type = GTK_CSS_IMAGE_BUILTIN_GRIP_TOPRIGHT; else if ((sides & GTK_JUNCTION_CORNER_BOTTOMLEFT) == GTK_JUNCTION_CORNER_BOTTOMLEFT) type = GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMLEFT; else if ((sides & GTK_JUNCTION_CORNER_TOPLEFT) == GTK_JUNCTION_CORNER_TOPLEFT) type = GTK_CSS_IMAGE_BUILTIN_GRIP_TOPLEFT; else if (sides & GTK_JUNCTION_RIGHT) type = GTK_CSS_IMAGE_BUILTIN_GRIP_RIGHT; else if (sides & GTK_JUNCTION_BOTTOM) type = GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOM; else if (sides & GTK_JUNCTION_TOP) type = GTK_CSS_IMAGE_BUILTIN_GRIP_TOP; else if (sides & GTK_JUNCTION_LEFT) type = GTK_CSS_IMAGE_BUILTIN_GRIP_LEFT; else type = GTK_CSS_IMAGE_BUILTIN_GRIP_BOTTOMRIGHT; } else if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_PANE_SEPARATOR)) { type = GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR; } else { type = GTK_CSS_IMAGE_BUILTIN_HANDLE; } gtk_css_style_render_icon (gtk_style_context_lookup_style (context), cr, x, y, width, height, type); }
static void gd_main_toolbar_clear (GdMainToolbar *self) { GtkStyleContext *context; /* reset labels */ gtk_label_set_text (GTK_LABEL (self->priv->title_label), ""); gtk_label_set_text (GTK_LABEL (self->priv->detail_label), ""); /* clear all on the left, except the back button */ gtk_widget_hide (self->priv->back); gtk_container_foreach (GTK_CONTAINER (self->priv->left_grid), on_left_grid_clear, self); /* clear all on the right */ gtk_container_foreach (GTK_CONTAINER (self->priv->right_grid), (GtkCallback) gtk_widget_destroy, self); context = gtk_widget_get_style_context (GTK_WIDGET (self)); if (gtk_style_context_has_class (context, "documents-selection-mode")) { gtk_style_context_remove_class (context, "documents-selection-mode"); gtk_widget_reset_style (GTK_WIDGET (self)); } g_signal_emit (self, signals[CLEAR_REQUEST], 0); }
void cc_class_add(GtkWidget*w,gchar*classname) { GtkStyleContext*context = gtk_widget_get_style_context (w); if(!gtk_style_context_has_class(context,classname)){ gtk_style_context_add_class (context, classname); } g_object_unref(context); }
/** * gtk_button_get_relief: * @button: The #GtkButton you want the #GtkReliefStyle from. * * Returns the current relief style of the given #GtkButton. * * Returns: The current #GtkReliefStyle */ GtkReliefStyle gtk_button_get_relief (GtkButton *button) { GtkStyleContext *context; g_return_val_if_fail (GTK_IS_BUTTON (button), GTK_RELIEF_NORMAL); context = gtk_widget_get_style_context (GTK_WIDGET (button)); if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_FLAT)) return GTK_RELIEF_NONE; else return GTK_RELIEF_NORMAL; }
static void nemo_window_pane_set_active_style (NemoWindowPane *pane, gboolean is_active) { GtkStyleContext *style; gboolean has_inactive; style = gtk_widget_get_style_context (GTK_WIDGET (pane)); has_inactive = gtk_style_context_has_class (style, "nemo-inactive-pane"); if (has_inactive == !is_active) { return; } if (is_active) { gtk_style_context_remove_class (style, "nemo-inactive-pane"); } else { gtk_style_context_add_class (style, "nemo-inactive-pane"); } gtk_widget_reset_style (GTK_WIDGET (pane)); }
static void gtk_do_render_expander (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height) { GtkCssImageBuiltinType image_type; GtkStateFlags state; state = gtk_style_context_get_state (context); if (gtk_style_context_has_class (context, "horizontal")) { if (state & GTK_STATE_FLAG_DIR_RTL) image_type = (state & GTK_STATE_FLAG_CHECKED) ? GTK_CSS_IMAGE_BUILTIN_EXPANDER_HORIZONTAL_RIGHT_EXPANDED : GTK_CSS_IMAGE_BUILTIN_EXPANDER_HORIZONTAL_RIGHT; else image_type = (state & GTK_STATE_FLAG_CHECKED) ? GTK_CSS_IMAGE_BUILTIN_EXPANDER_HORIZONTAL_LEFT_EXPANDED : GTK_CSS_IMAGE_BUILTIN_EXPANDER_HORIZONTAL_LEFT; } else { if (state & GTK_STATE_FLAG_DIR_RTL) image_type = (state & GTK_STATE_FLAG_CHECKED) ? GTK_CSS_IMAGE_BUILTIN_EXPANDER_VERTICAL_RIGHT_EXPANDED : GTK_CSS_IMAGE_BUILTIN_EXPANDER_VERTICAL_RIGHT; else image_type = (state & GTK_STATE_FLAG_CHECKED) ? GTK_CSS_IMAGE_BUILTIN_EXPANDER_VERTICAL_LEFT_EXPANDED : GTK_CSS_IMAGE_BUILTIN_EXPANDER_VERTICAL_LEFT; } gtk_css_style_render_icon (gtk_style_context_lookup_style (context), cr, x, y, width, height, image_type); }
JNIEXPORT jboolean JNICALL Java_org_gnome_gtk_GtkStyleContext_gtk_1style_1context_1has_1class ( JNIEnv* env, jclass cls, jlong _self, jstring _className ) { gboolean result; jboolean _result; GtkStyleContext* self; const gchar* className; // convert parameter self self = (GtkStyleContext*) _self; // convert parameter className className = (const gchar*) bindings_java_getString(env, _className); if (className == NULL) { return JNI_FALSE; // Java Exception already thrown } // call function result = gtk_style_context_has_class(self, className); // cleanup parameter self // cleanup parameter className bindings_java_releaseString(className); // translate return value to JNI type _result = (jboolean) result; // and finally return _result; }
static void gtk_do_render_handle (GtkStyleContext *context, cairo_t *cr, gdouble x, gdouble y, gdouble width, gdouble height) { GtkCssImageBuiltinType type; gtk_render_background (context, cr, x, y, width, height); gtk_render_frame (context, cr, x, y, width, height); if (gtk_style_context_has_class (context, GTK_STYLE_CLASS_PANE_SEPARATOR)) { type = GTK_CSS_IMAGE_BUILTIN_PANE_SEPARATOR; } else { type = GTK_CSS_IMAGE_BUILTIN_HANDLE; } gtk_css_style_render_icon (gtk_style_context_lookup_style (context), cr, x, y, width, height, type); }