本文整理汇总了C++中ST_SCROLL_VIEW函数的典型用法代码示例。如果您正苦于以下问题:C++ ST_SCROLL_VIEW函数的具体用法?C++ ST_SCROLL_VIEW怎么用?C++ ST_SCROLL_VIEW使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ST_SCROLL_VIEW函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: st_scroll_view_fade_paint_target
static void
st_scroll_view_fade_paint_target (ClutterOffscreenEffect *effect)
{
StScrollViewFade *self = ST_SCROLL_VIEW_FADE (effect);
ClutterOffscreenEffectClass *parent;
CoglHandle material;
gdouble value, lower, upper, page_size;
ClutterActor *vscroll = st_scroll_view_get_vscroll_bar (ST_SCROLL_VIEW (self->actor));
ClutterActor *hscroll = st_scroll_view_get_hscroll_bar (ST_SCROLL_VIEW (self->actor));
gboolean h_scroll_visible, v_scroll_visible;
g_object_get (ST_SCROLL_VIEW (self->actor),
"hscrollbar-visible", &h_scroll_visible,
"vscrollbar-visible", &v_scroll_visible,
NULL);
if (self->program == COGL_INVALID_HANDLE)
goto out;
st_adjustment_get_values (self->vadjustment, &value, &lower, &upper, NULL, NULL, &page_size);
if (self->offset_top_uniform > -1) {
if (value > lower + 0.1)
cogl_program_set_uniform_1f (self->program, self->offset_top_uniform, self->fade_offset);
else
cogl_program_set_uniform_1f (self->program, self->offset_top_uniform, 0.0f);
}
if (self->offset_bottom_uniform > -1) {
if (value < upper - page_size - 0.1)
cogl_program_set_uniform_1f (self->program, self->offset_bottom_uniform, self->fade_offset);
else
cogl_program_set_uniform_1f (self->program, self->offset_bottom_uniform, 0.0f);
}
if (self->tex_uniform > -1)
cogl_program_set_uniform_1i (self->program, self->tex_uniform, 0);
if (self->height_uniform > -1)
cogl_program_set_uniform_1f (self->program, self->height_uniform, clutter_actor_get_height (self->actor));
if (self->width_uniform > -1)
cogl_program_set_uniform_1f (self->program, self->width_uniform, clutter_actor_get_width (self->actor));
if (self->scrollbar_width_uniform > -1)
cogl_program_set_uniform_1f (self->program, self->scrollbar_width_uniform, v_scroll_visible ? clutter_actor_get_width (vscroll) : 0);
if (self->scrollbar_height_uniform > -1)
cogl_program_set_uniform_1f (self->program, self->scrollbar_height_uniform, h_scroll_visible ? clutter_actor_get_height (hscroll) : 0);
if (self->rtl_uniform > -1)
cogl_program_set_uniform_1i (self->program, self->rtl_uniform, (st_widget_get_direction (ST_WIDGET (self->actor)) == ST_TEXT_DIRECTION_RTL));
material = clutter_offscreen_effect_get_target (effect);
cogl_material_set_user_program (material, self->program);
out:
parent = CLUTTER_OFFSCREEN_EFFECT_CLASS (st_scroll_view_fade_parent_class);
parent->paint_target (effect);
}
示例2: st_scroll_view_get_preferred_width
static void
st_scroll_view_get_preferred_width (ClutterActor *actor,
gfloat for_height,
gfloat *min_width_p,
gfloat *natural_width_p)
{
StScrollViewPrivate *priv = ST_SCROLL_VIEW (actor)->priv;
StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
gfloat min_width = 0, natural_width;
gfloat child_min_width, child_natural_width;
if (!priv->child)
return;
st_theme_node_adjust_for_height (theme_node, &for_height);
clutter_actor_get_preferred_width (priv->child, -1,
&child_min_width, &child_natural_width);
natural_width = child_natural_width;
switch (priv->hscrollbar_policy)
{
case GTK_POLICY_NEVER:
min_width = child_min_width;
break;
case GTK_POLICY_ALWAYS:
case GTK_POLICY_AUTOMATIC:
case GTK_POLICY_EXTERNAL:
/* Should theoretically use the min width of the hscrollbar,
* but that's not cleanly defined at the moment */
min_width = 0;
break;
default:
g_warn_if_reached();
break;
}
if (priv->vscrollbar_policy != GTK_POLICY_NEVER)
{
float sb_width = get_scrollbar_width (ST_SCROLL_VIEW (actor), for_height);
min_width += sb_width;
natural_width += sb_width;
}
if (min_width_p)
*min_width_p = min_width;
if (natural_width_p)
*natural_width_p = natural_width;
st_theme_node_adjust_preferred_width (theme_node, min_width_p, natural_width_p);
}
示例3: st_scroll_view_set_auto_scrolling
void
st_scroll_view_set_auto_scrolling (StScrollView *scroll,
gboolean enabled)
{
StScrollViewPrivate *priv;
g_return_if_fail (ST_IS_SCROLL_VIEW (scroll));
priv = ST_SCROLL_VIEW (scroll)->priv;
if (priv->auto_scroll != enabled)
{
priv->auto_scroll = enabled;
/* make sure we can receive mouse wheel events */
if (enabled) {
clutter_actor_set_reactive ((ClutterActor *) scroll, TRUE);
g_signal_connect (scroll, "motion-event",
G_CALLBACK (motion_event_cb), scroll);
} else {
g_signal_handlers_disconnect_by_func (scroll, motion_event_cb, scroll);
if (priv->auto_scroll_timeout_id > 0) {
g_source_remove (priv->auto_scroll_timeout_id);
priv->auto_scroll_timeout_id = 0;
}
}
}
}
示例4: st_scroll_view_update_vfade_effect
/**
* st_scroll_view_update_vfade_effect:
* @self: a #StScrollView
* @fade_offset: The length of the fade effect, in pixels.
*
* Sets the height of the fade area area in pixels. A value of 0
* disables the effect.
*/
static void
st_scroll_view_update_vfade_effect (StScrollView *self,
float fade_offset)
{
StScrollViewPrivate *priv = ST_SCROLL_VIEW (self)->priv;
/* A fade amount of more than 0 enables the effect. */
if (fade_offset > 0.)
{
if (priv->vfade_effect == NULL) {
priv->vfade_effect = g_object_new (ST_TYPE_SCROLL_VIEW_FADE, NULL);
clutter_actor_add_effect_with_name (CLUTTER_ACTOR (self), "vfade",
CLUTTER_EFFECT (priv->vfade_effect));
}
g_object_set (priv->vfade_effect,
"fade-offset", fade_offset,
NULL);
}
else
{
if (priv->vfade_effect != NULL) {
clutter_actor_remove_effect (CLUTTER_ACTOR (self), CLUTTER_EFFECT (priv->vfade_effect));
priv->vfade_effect = NULL;
}
}
clutter_actor_queue_redraw (CLUTTER_ACTOR (self));
}
示例5: st_scroll_view_remove
static void
st_scroll_view_remove (ClutterContainer *container,
ClutterActor *actor)
{
StScrollView *self = ST_SCROLL_VIEW (container);
StScrollViewPrivate *priv = self->priv;
if (actor == priv->child)
{
g_object_ref (priv->child);
/* chain up to StBin::remove() */
st_scroll_view_parent_iface->remove (container, actor);
st_scrollable_set_adjustments (ST_SCROLLABLE (priv->child),
NULL, NULL);
g_object_unref (priv->child);
priv->child = NULL;
}
else
{
if (actor == priv->vscroll)
priv->vscroll = NULL;
else if (actor == priv->hscroll)
priv->hscroll = NULL;
else
g_assert ("Unknown child removed from StScrollView");
clutter_actor_unparent (actor);
}
}
示例6: calculate_and_scroll
static void
calculate_and_scroll (ClutterActor *self,
gint mouse_x,
gint mouse_y,
gfloat box_x,
gfloat box_y,
gfloat width,
gfloat height)
{
StScrollViewPrivate *priv = ST_SCROLL_VIEW (self)->priv;
gboolean up;
gint sub_region;
gdouble delta, vvalue;
up = get_sub_region_y (mouse_y, box_y, height, &sub_region);
if (up)
delta = sub_region * -1.0 / AUTO_SCROLL_SPEED_DIVISOR;
else
delta = sub_region / AUTO_SCROLL_SPEED_DIVISOR;
g_object_get (priv->vadjustment,
"value", &vvalue,
NULL);
st_adjustment_set_value (priv->vadjustment, vvalue + delta);
}
示例7: st_scroll_view_set_property
static void
st_scroll_view_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
StScrollView *self = ST_SCROLL_VIEW (object);
StScrollViewPrivate *priv = self->priv;
switch (property_id)
{
case PROP_MOUSE_SCROLL:
st_scroll_view_set_mouse_scrolling (self,
g_value_get_boolean (value));
break;
case PROP_HSCROLLBAR_POLICY:
st_scroll_view_set_policy (self,
g_value_get_enum (value),
priv->vscrollbar_policy);
break;
case PROP_VSCROLLBAR_POLICY:
st_scroll_view_set_policy (self,
priv->hscrollbar_policy,
g_value_get_enum (value));
break;
case PROP_AUTO_SCROLL:
st_scroll_view_set_auto_scrolling (self,
g_value_get_boolean (value));
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
示例8: st_scroll_view_add
static void
st_scroll_view_add (ClutterContainer *container,
ClutterActor *actor)
{
StScrollView *self = ST_SCROLL_VIEW (container);
StScrollViewPrivate *priv = self->priv;
if (ST_IS_SCROLLABLE (actor))
{
priv->child = actor;
/* chain up to StBin::add() */
st_scroll_view_parent_iface->add (container, actor);
st_scrollable_set_adjustments (ST_SCROLLABLE (actor),
priv->hadjustment, priv->vadjustment);
}
else
{
g_warning ("Attempting to add an actor of type %s to "
"a StScrollView, but the actor does "
"not implement StScrollable.",
g_type_name (G_OBJECT_TYPE (actor)));
}
}
示例9: st_scroll_view_set_policy
/**
* st_scroll_view_set_policy:
* @scroll: A #StScrollView
* @hscroll: Whether to enable horizontal scrolling
* @vscroll: Whether to enable vertical scrolling
*
* Set the scroll policy.
*/
void
st_scroll_view_set_policy (StScrollView *scroll,
GtkPolicyType hscroll,
GtkPolicyType vscroll)
{
StScrollViewPrivate *priv;
g_return_if_fail (ST_IS_SCROLL_VIEW (scroll));
priv = ST_SCROLL_VIEW (scroll)->priv;
if (priv->hscrollbar_policy == hscroll && priv->vscrollbar_policy == vscroll)
return;
g_object_freeze_notify ((GObject *) scroll);
if (priv->hscrollbar_policy != hscroll)
{
priv->hscrollbar_policy = hscroll;
g_object_notify ((GObject *) scroll, "hscrollbar-policy");
}
if (priv->vscrollbar_policy != vscroll)
{
priv->vscrollbar_policy = vscroll;
g_object_notify ((GObject *) scroll, "vscrollbar-policy");
}
clutter_actor_queue_relayout (CLUTTER_ACTOR (scroll));
g_object_thaw_notify ((GObject *) scroll);
}
示例10: st_scroll_view_scroll_event
static gboolean
st_scroll_view_scroll_event (ClutterActor *self,
ClutterScrollEvent *event)
{
StScrollViewPrivate *priv = ST_SCROLL_VIEW (self)->priv;
/* don't handle scroll events if requested not to */
if (!priv->mouse_scroll)
return FALSE;
if (clutter_event_is_pointer_emulated ((ClutterEvent *) event))
return TRUE;
switch (event->direction)
{
case CLUTTER_SCROLL_SMOOTH:
{
gdouble delta_x, delta_y;
clutter_event_get_scroll_delta ((ClutterEvent *)event, &delta_x, &delta_y);
st_adjustment_adjust_for_scroll_event (priv->hadjustment, delta_x);
st_adjustment_adjust_for_scroll_event (priv->vadjustment, delta_y);
}
break;
case CLUTTER_SCROLL_UP:
case CLUTTER_SCROLL_DOWN:
adjust_with_direction (priv->vadjustment, event->direction);
break;
case CLUTTER_SCROLL_LEFT:
case CLUTTER_SCROLL_RIGHT:
adjust_with_direction (priv->hadjustment, event->direction);
break;
}
return TRUE;
}
示例11: st_scroll_view_dispose
static void
st_scroll_view_dispose (GObject *object)
{
StScrollViewPrivate *priv = ST_SCROLL_VIEW (object)->priv;
if (priv->vfade_effect)
{
clutter_actor_remove_effect (CLUTTER_ACTOR (object), CLUTTER_EFFECT (priv->vfade_effect));
priv->vfade_effect = NULL;
}
if (priv->vscroll)
clutter_actor_destroy (priv->vscroll);
if (priv->hscroll)
clutter_actor_destroy (priv->hscroll);
/* For most reliable freeing of memory, an object with signals
* like StAdjustment should be explicitly disposed. Since we own
* the adjustments, we take care of that. This also disconnects
* the signal handlers that we established on creation.
*/
if (priv->hadjustment)
{
g_object_run_dispose (G_OBJECT (priv->hadjustment));
g_object_unref (priv->hadjustment);
priv->hadjustment = NULL;
}
if (priv->vadjustment)
{
g_object_run_dispose (G_OBJECT (priv->vadjustment));
g_object_unref (priv->vadjustment);
priv->vadjustment = NULL;
}
if (priv->setting_connect_id > 0) {
g_signal_handler_disconnect (priv->settings, priv->setting_connect_id);
priv->setting_connect_id = 0;
}
g_signal_handlers_disconnect_by_func (ST_SCROLL_VIEW (object), motion_event_cb, ST_SCROLL_VIEW (object));
G_OBJECT_CLASS (st_scroll_view_parent_class)->dispose (object);
}
示例12: st_scroll_view_fade_set_actor
static void
st_scroll_view_fade_set_actor (ClutterActorMeta *meta,
ClutterActor *actor)
{
StScrollViewFade *self = ST_SCROLL_VIEW_FADE (meta);
ClutterActorMetaClass *parent;
g_return_if_fail (actor == NULL || ST_IS_SCROLL_VIEW (actor));
if (self->shader == COGL_INVALID_HANDLE)
{
clutter_actor_meta_set_enabled (meta, FALSE);
return;
}
if (self->vadjustment)
{
g_signal_handlers_disconnect_by_func (self->vadjustment,
(gpointer)on_adjustment_changed,
self);
self->vadjustment = NULL;
}
if (self->hadjustment)
{
g_signal_handlers_disconnect_by_func (self->hadjustment,
(gpointer)on_adjustment_changed,
self);
self->hadjustment = NULL;
}
if (actor)
{
StScrollView *scroll_view = ST_SCROLL_VIEW (actor);
StScrollBar *vscroll = ST_SCROLL_BAR (st_scroll_view_get_vscroll_bar (scroll_view));
StScrollBar *hscroll = ST_SCROLL_BAR (st_scroll_view_get_hscroll_bar (scroll_view));
self->vadjustment = ST_ADJUSTMENT (st_scroll_bar_get_adjustment (vscroll));
self->hadjustment = ST_ADJUSTMENT (st_scroll_bar_get_adjustment (hscroll));
g_signal_connect (self->vadjustment, "changed",
G_CALLBACK (on_adjustment_changed),
self);
g_signal_connect (self->hadjustment, "changed",
G_CALLBACK (on_adjustment_changed),
self);
on_adjustment_changed (NULL, CLUTTER_EFFECT (self));
}
parent = CLUTTER_ACTOR_META_CLASS (st_scroll_view_fade_parent_class);
parent->set_actor (meta, actor);
/* we keep a back pointer here, to avoid going through the ActorMeta */
self->actor = clutter_actor_meta_get_actor (meta);
}
示例13: st_scroll_view_get_overlay_scrollbars
/**
* st_scroll_view_get_overlay_scrollbars:
* @scroll: A #StScrollView
*
* Gets the value set by st_scroll_view_set_overlay_scrollbars().
*/
gboolean
st_scroll_view_get_overlay_scrollbars (StScrollView *scroll)
{
StScrollViewPrivate *priv;
g_return_val_if_fail (ST_IS_SCROLL_VIEW (scroll), FALSE);
priv = ST_SCROLL_VIEW (scroll)->priv;
return priv->overlay_scrollbars;
}
示例14: st_scroll_view_get_auto_scrolling
gboolean
st_scroll_view_get_auto_scrolling (StScrollView *scroll)
{
StScrollViewPrivate *priv;
g_return_val_if_fail (ST_IS_SCROLL_VIEW (scroll), FALSE);
priv = ST_SCROLL_VIEW (scroll)->priv;
return priv->auto_scroll;
}
示例15: st_scroll_view_paint
static void
st_scroll_view_paint (ClutterActor *actor)
{
StScrollViewPrivate *priv = ST_SCROLL_VIEW (actor)->priv;
st_widget_paint_background (ST_WIDGET (actor));
if (priv->child)
clutter_actor_paint (priv->child);
if (priv->hscrollbar_visible)
clutter_actor_paint (priv->hscroll);
if (priv->vscrollbar_visible)
clutter_actor_paint (priv->vscroll);
}