forked from AuroraMiddleware/gtk
levelbar: Implement snapshot()
This commit is contained in:
parent
96a94fc21d
commit
edf8ffecdf
@ -331,35 +331,35 @@ gtk_level_bar_get_real_inverted (GtkLevelBar *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_level_bar_draw_fill_continuous (GtkLevelBar *self,
|
gtk_level_bar_snapshot_fill_continuous (GtkLevelBar *self,
|
||||||
cairo_t *cr)
|
GtkSnapshot *snapshot)
|
||||||
{
|
{
|
||||||
gboolean inverted;
|
gboolean inverted;
|
||||||
|
|
||||||
inverted = gtk_level_bar_get_real_inverted (self);
|
inverted = gtk_level_bar_get_real_inverted (self);
|
||||||
|
|
||||||
/* render the empty (unfilled) part */
|
/* render the empty (unfilled) part */
|
||||||
gtk_css_gadget_draw (self->priv->block_gadget[inverted ? 0 : 1], cr);
|
gtk_css_gadget_snapshot (self->priv->block_gadget[inverted ? 0 : 1], snapshot);
|
||||||
|
|
||||||
/* now render the filled part on top of it */
|
/* now render the filled part on top of it */
|
||||||
gtk_css_gadget_draw (self->priv->block_gadget[inverted ? 1 : 0], cr);
|
gtk_css_gadget_snapshot (self->priv->block_gadget[inverted ? 1 : 0], snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_level_bar_draw_fill_discrete (GtkLevelBar *self,
|
gtk_level_bar_snapshot_fill_discrete (GtkLevelBar *self,
|
||||||
cairo_t *cr)
|
GtkSnapshot *snapshot)
|
||||||
{
|
{
|
||||||
gint num_blocks, i;
|
gint num_blocks, i;
|
||||||
|
|
||||||
num_blocks = gtk_level_bar_get_num_blocks (self);
|
num_blocks = gtk_level_bar_get_num_blocks (self);
|
||||||
|
|
||||||
for (i = 0; i < num_blocks; i++)
|
for (i = 0; i < num_blocks; i++)
|
||||||
gtk_css_gadget_draw (self->priv->block_gadget[i], cr);
|
gtk_css_gadget_snapshot (self->priv->block_gadget[i], snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_level_bar_render_trough (GtkCssGadget *gadget,
|
gtk_level_bar_render_trough (GtkCssGadget *gadget,
|
||||||
cairo_t *cr,
|
GtkSnapshot *snapshot,
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
int width,
|
int width,
|
||||||
@ -370,22 +370,20 @@ gtk_level_bar_render_trough (GtkCssGadget *gadget,
|
|||||||
GtkLevelBar *self = GTK_LEVEL_BAR (widget);
|
GtkLevelBar *self = GTK_LEVEL_BAR (widget);
|
||||||
|
|
||||||
if (self->priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
|
if (self->priv->bar_mode == GTK_LEVEL_BAR_MODE_CONTINUOUS)
|
||||||
gtk_level_bar_draw_fill_continuous (self, cr);
|
gtk_level_bar_snapshot_fill_continuous (self, snapshot);
|
||||||
else
|
else
|
||||||
gtk_level_bar_draw_fill_discrete (self, cr);
|
gtk_level_bar_snapshot_fill_discrete (self, snapshot);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
gtk_level_bar_draw (GtkWidget *widget,
|
gtk_level_bar_snapshot (GtkWidget *widget,
|
||||||
cairo_t *cr)
|
GtkSnapshot *snapshot)
|
||||||
{
|
{
|
||||||
GtkLevelBar *self = GTK_LEVEL_BAR (widget);
|
GtkLevelBar *self = GTK_LEVEL_BAR (widget);
|
||||||
|
|
||||||
gtk_css_gadget_draw (self->priv->trough_gadget, cr);
|
gtk_css_gadget_snapshot (self->priv->trough_gadget, snapshot);
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -963,7 +961,7 @@ gtk_level_bar_class_init (GtkLevelBarClass *klass)
|
|||||||
oclass->set_property = gtk_level_bar_set_property;
|
oclass->set_property = gtk_level_bar_set_property;
|
||||||
oclass->finalize = gtk_level_bar_finalize;
|
oclass->finalize = gtk_level_bar_finalize;
|
||||||
|
|
||||||
wclass->draw = gtk_level_bar_draw;
|
wclass->snapshot = gtk_level_bar_snapshot;
|
||||||
wclass->size_allocate = gtk_level_bar_size_allocate;
|
wclass->size_allocate = gtk_level_bar_size_allocate;
|
||||||
wclass->measure = gtk_level_bar_measure;
|
wclass->measure = gtk_level_bar_measure;
|
||||||
wclass->state_flags_changed = gtk_level_bar_state_flags_changed;
|
wclass->state_flags_changed = gtk_level_bar_state_flags_changed;
|
||||||
@ -1109,8 +1107,8 @@ gtk_level_bar_init (GtkLevelBar *self)
|
|||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
gtk_level_bar_measure_trough,
|
gtk_level_bar_measure_trough,
|
||||||
gtk_level_bar_allocate_trough,
|
gtk_level_bar_allocate_trough,
|
||||||
gtk_level_bar_render_trough,
|
|
||||||
NULL,
|
NULL,
|
||||||
|
gtk_level_bar_render_trough,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
trough_node = gtk_css_gadget_get_node (priv->trough_gadget);
|
trough_node = gtk_css_gadget_get_node (priv->trough_gadget);
|
||||||
gtk_css_node_set_parent (trough_node, widget_node);
|
gtk_css_node_set_parent (trough_node, widget_node);
|
||||||
|
Loading…
Reference in New Issue
Block a user