Exemple #1
0
/**
 * 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);
}
Exemple #2
0
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;
        }
      }
    }
}
Exemple #3
0
/**
 * st_scroll_view_get_vscroll_bar:
 * @scroll: a #StScrollView
 *
 * Gets the vertical scrollbar of the scrollbiew
 *
 * Return value: (transfer none): the vertical #StScrollbar
 */
ClutterActor *
st_scroll_view_get_vscroll_bar (StScrollView *scroll)
{
  g_return_val_if_fail (ST_IS_SCROLL_VIEW (scroll), NULL);

  return scroll->priv->vscroll;
}
Exemple #4
0
static void
vfade_setting_changed_cb (GSettings *settings, gchar *key, gpointer user_data)
{
    StWidget *widget = ST_WIDGET (user_data);
    g_return_if_fail (ST_IS_SCROLL_VIEW (widget));

    st_scroll_view_style_changed (widget);
}
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);
}
Exemple #6
0
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;
}
/**
 * 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;
}
/**
 * st_scroll_view_set_overlay_scrollbars:
 * @scroll: A #StScrollView
 * @enabled: Whether to enable overlay scrollbars
 *
 * Sets whether scrollbars are painted on top of the content.
 */
void
st_scroll_view_set_overlay_scrollbars (StScrollView *scroll,
                                       gboolean      enabled)
{
  StScrollViewPrivate *priv;

  g_return_if_fail (ST_IS_SCROLL_VIEW (scroll));

  priv = ST_SCROLL_VIEW (scroll)->priv;

  if (priv->overlay_scrollbars != enabled)
    {
      priv->overlay_scrollbars = enabled;
      g_object_notify (G_OBJECT (scroll), "overlay-scrollbars");
      clutter_actor_queue_relayout (CLUTTER_ACTOR (scroll));
    }
}
Exemple #9
0
void
st_scroll_view_set_mouse_scrolling (StScrollView *scroll,
                                    gboolean      enabled)
{
  StScrollViewPrivate *priv;

  g_return_if_fail (ST_IS_SCROLL_VIEW (scroll));

  priv = ST_SCROLL_VIEW (scroll)->priv;

  if (priv->mouse_scroll != enabled)
    {
      priv->mouse_scroll = enabled;

      /* make sure we can receive mouse wheel events */
      if (enabled)
        clutter_actor_set_reactive ((ClutterActor *) scroll, TRUE);
    }
}