Add slider illustration
This commit is contained in:
committed by
Carlos Garnacho
parent
8d951476bf
commit
8589c5c65e
@ -347,7 +347,8 @@ HTML_IMAGES = \
|
|||||||
$(srcdir)/images/arrows.png \
|
$(srcdir)/images/arrows.png \
|
||||||
$(srcdir)/images/expanders.png \
|
$(srcdir)/images/expanders.png \
|
||||||
$(srcdir)/images/background.png \
|
$(srcdir)/images/background.png \
|
||||||
$(srcdir)/images/frames.png
|
$(srcdir)/images/frames.png \
|
||||||
|
$(srcdir)/images/sliders.png
|
||||||
|
|
||||||
# Extra options to supply to gtkdoc-fixref
|
# Extra options to supply to gtkdoc-fixref
|
||||||
FIXXREF_OPTIONS=--extra-dir=../gdk/html \
|
FIXXREF_OPTIONS=--extra-dir=../gdk/html \
|
||||||
|
|||||||
BIN
docs/reference/gtk/images/sliders.png
Normal file
BIN
docs/reference/gtk/images/sliders.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 470 B |
@ -3265,6 +3265,11 @@ gtk_render_line (GtkStyleContext *context,
|
|||||||
* @width, @height. @orientation defines whether the slider is vertical
|
* @width, @height. @orientation defines whether the slider is vertical
|
||||||
* or horizontal.
|
* or horizontal.
|
||||||
*
|
*
|
||||||
|
* <example>
|
||||||
|
* <title>Typical slider rendering</title>
|
||||||
|
* <inlinegraphic fileref="sliders.png" format="PNG"/>
|
||||||
|
* </example>
|
||||||
|
*
|
||||||
* Since: 3.0
|
* Since: 3.0
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
|
|||||||
@ -177,21 +177,56 @@ static gboolean
|
|||||||
draw_cb_activity (GtkWidget *widget, cairo_t *cr)
|
draw_cb_activity (GtkWidget *widget, cairo_t *cr)
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
GtkStyleContext *context;
|
||||||
|
GtkWidgetPath *path;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
gtk_style_context_notify_state_change (context,
|
||||||
|
gtk_widget_get_window (widget),
|
||||||
|
NULL,
|
||||||
|
GTK_STATE_FLAG_ACTIVE,
|
||||||
|
TRUE);
|
||||||
|
|
||||||
gtk_style_context_save (context);
|
gtk_style_context_save (context);
|
||||||
|
|
||||||
gtk_style_context_add_class (context, "spinner");
|
path = gtk_widget_path_new ();
|
||||||
gtk_style_context_set_state (context, 0);
|
gtk_widget_path_append_type (path, GTK_TYPE_SPINNER);
|
||||||
|
gtk_widget_path_iter_add_class (path, 0, "spinner");
|
||||||
|
gtk_style_context_set_path (context, path);
|
||||||
|
gtk_widget_path_free (path);
|
||||||
|
|
||||||
|
gtk_style_context_set_state (context, GTK_STATE_FLAG_ACTIVE);
|
||||||
gtk_render_activity (context, cr, 12, 12, 12, 12);
|
gtk_render_activity (context, cr, 12, 12, 12, 12);
|
||||||
gtk_style_context_set_state (context, GTK_STATE_FLAG_INSENSITIVE);
|
|
||||||
gtk_render_activity (context, cr, 36, 12, 12, 12);
|
|
||||||
|
|
||||||
gtk_style_context_restore (context);
|
gtk_style_context_restore (context);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
draw_cb_slider (GtkWidget *widget, cairo_t *cr)
|
||||||
|
{
|
||||||
|
GtkStyleContext *context;
|
||||||
|
GtkWidgetPath *path;
|
||||||
|
|
||||||
|
context = gtk_widget_get_style_context (widget);
|
||||||
|
gtk_style_context_save (context);
|
||||||
|
|
||||||
|
path = gtk_widget_path_new ();
|
||||||
|
gtk_widget_path_append_type (path, GTK_TYPE_SCALE);
|
||||||
|
gtk_widget_path_iter_add_class (path, 0, "slider");
|
||||||
|
gtk_widget_path_iter_add_class (path, 0, "scale");
|
||||||
|
gtk_style_context_set_path (context, path);
|
||||||
|
gtk_widget_path_free (path);
|
||||||
|
|
||||||
|
gtk_render_slider (context, cr, 12, 22, 30, 10, GTK_ORIENTATION_HORIZONTAL);
|
||||||
|
gtk_render_slider (context, cr, 54, 12, 10, 30, GTK_ORIENTATION_VERTICAL);
|
||||||
|
|
||||||
|
gtk_style_context_restore (context);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static char *what;
|
static char *what;
|
||||||
|
|
||||||
@ -212,6 +247,8 @@ draw_cb (GtkWidget *widget, cairo_t *cr)
|
|||||||
return draw_cb_frame (widget, cr);
|
return draw_cb_frame (widget, cr);
|
||||||
else if (strcmp (what, "activity") == 0)
|
else if (strcmp (what, "activity") == 0)
|
||||||
return draw_cb_activity (widget, cr);
|
return draw_cb_activity (widget, cr);
|
||||||
|
else if (strcmp (what, "slider") == 0)
|
||||||
|
return draw_cb_slider (widget, cr);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user