Exemple #1
0
static void
scroll_frame_set_property (GObject      *object,
			   guint         prop_id,
			   const GValue *value,
			   GParamSpec   *pspec)
{
  ScrollFrame *frame = SCROLL_FRAME (object);

  switch (prop_id) {
  case PROP_HADJUST:
    scrollable_set_adjustments (TIDY_SCROLLABLE (object),
				g_value_get_object (value),
				frame->priv->vadj);
    break;

  case PROP_VADJUST:
    scrollable_set_adjustments (TIDY_SCROLLABLE (object),
				frame->priv->hadj,
				g_value_get_object (value));
    break;

  default:
    break;
  }
}
static void
st_box_layout_set_property (GObject      *object,
                            guint         property_id,
                            const GValue *value,
                            GParamSpec   *pspec)
{
  StBoxLayout *box = ST_BOX_LAYOUT (object);

  switch (property_id)
    {
    case PROP_VERTICAL:
      st_box_layout_set_vertical (box, g_value_get_boolean (value));
      break;

    case PROP_PACK_START:
      st_box_layout_set_pack_start (box, g_value_get_boolean (value));
      break;

    case PROP_HADJUST:
      scrollable_set_adjustments (ST_SCROLLABLE (object),
                                  g_value_get_object (value),
                                  box->priv->vadjustment);
      break;

    case PROP_VADJUST:
      scrollable_set_adjustments (ST_SCROLLABLE (object),
                                  box->priv->hadjustment,
                                  g_value_get_object (value));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
    }
}
static void
scrollable_get_adjustments (MxScrollable  *scrollable,
                            MxAdjustment **hadjustment,
                            MxAdjustment **vadjustment)
{
  MxViewportPrivate *priv;

  g_return_if_fail (MX_IS_VIEWPORT (scrollable));

  priv = ((MxViewport *) scrollable)->priv;

  if (hadjustment)
    {
      if (priv->hadjustment)
        *hadjustment = priv->hadjustment;
      else
        {
          MxAdjustment *adjustment;

          /* create an initial adjustment. this is filled with correct values
           * as soon as allocate() is called */

          adjustment = mx_adjustment_new ();

          scrollable_set_adjustments (scrollable,
                                      adjustment,
                                      priv->vadjustment);

          g_object_unref (adjustment);

          *hadjustment = adjustment;
        }
    }

  if (vadjustment)
    {
      if (priv->vadjustment)
        *vadjustment = priv->vadjustment;
      else
        {
          MxAdjustment *adjustment;

          /* create an initial adjustment. this is filled with correct values
           * as soon as allocate() is called */

          adjustment = mx_adjustment_new ();

          scrollable_set_adjustments (scrollable,
                                      priv->hadjustment,
                                      adjustment);

          g_object_unref (adjustment);

          *vadjustment = adjustment;
        }
    }
}
static void
mx_viewport_set_property (GObject      *object,
                          guint         prop_id,
                          const GValue *value,
                          GParamSpec   *pspec)
{
  MxViewport *viewport = MX_VIEWPORT (object);
  MxViewportPrivate *priv = viewport->priv;

  switch (prop_id)
    {
    case PROP_X_ORIGIN:
      mx_viewport_set_origin (viewport,
                              g_value_get_float (value),
                              priv->y,
                              priv->z);
      break;

    case PROP_Y_ORIGIN:
      mx_viewport_set_origin (viewport,
                              priv->x,
                              g_value_get_float (value),
                              priv->z);
      break;

    case PROP_Z_ORIGIN:
      mx_viewport_set_origin (viewport,
                              priv->x,
                              priv->y,
                              g_value_get_float (value));
      break;

    case PROP_HADJUST:
      scrollable_set_adjustments (MX_SCROLLABLE (object),
                                  g_value_get_object (value),
                                  priv->vadjustment);
      break;

    case PROP_VADJUST:
      scrollable_set_adjustments (MX_SCROLLABLE (object),
                                  priv->hadjustment,
                                  g_value_get_object (value));
      break;

    case PROP_SYNC_ADJUST:
      mx_viewport_set_sync_adjustments (viewport, g_value_get_boolean (value));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}
Exemple #5
0
static void
scrollable_get_adjustments (TidyScrollable  *scrollable,
			    TidyAdjustment **hadjustment,
			    TidyAdjustment **vadjustment)
{
  ScrollFramePrivate *priv = SCROLL_FRAME (scrollable)->priv;

  if (hadjustment) {
    if (priv->hadj) {
      *hadjustment = priv->hadj;
    } else {
      TidyAdjustment *adjustment = tidy_adjustment_newx (0, 0, 0, 0, 0, 0);
      double value, lower, upper, step, page_inc, page_size;

      webkit_adjustment_get_values (priv->wk_hadj, &value, &lower, &upper,
				    &step, &page_inc, &page_size);
      tidy_adjustment_set_values (adjustment, value, lower, upper, step,
				  page_inc, page_size);

      scrollable_set_adjustments (scrollable, adjustment, priv->vadj);
      *hadjustment = adjustment;
    }

    g_signal_connect (priv->wk_hadj, "notify::value",
		      G_CALLBACK (hadj_wk_value_changed), scrollable);
    g_signal_connect (priv->wk_hadj, "changed",
		      G_CALLBACK (hadj_wk_changed), scrollable);
  }

  if (vadjustment) {
    if (priv->vadj) {
      *vadjustment = priv->vadj;
    } else {
      TidyAdjustment *adjustment = tidy_adjustment_newx (0, 0, 0, 0, 0, 0);
      double value, lower, upper, step, page_inc, page_size;

      webkit_adjustment_get_values (priv->wk_vadj, &value, &lower, &upper,
				    &step, &page_inc, &page_size);
      tidy_adjustment_set_values (adjustment, value, lower, upper, step,
				  page_inc, page_size);

      scrollable_set_adjustments (scrollable, priv->hadj, adjustment);
      *vadjustment = adjustment;
    }

    g_signal_connect (priv->wk_vadj, "notify::value",
		      G_CALLBACK (vadj_wk_value_changed), scrollable);
    g_signal_connect (priv->wk_vadj, "changed",
		      G_CALLBACK (vadj_wk_changed), scrollable);
  }
}