Ejemplo n.º 1
0
/**
 * gtk_shruler_get_position:
 * @ruler: a #GtkSHRuler
 *
 * Return value: the current position of the @ruler widget.
 *
 * Since: GTK 2.8
 **/
gdouble
gtk_shruler_get_position (GtkSHRuler *ruler)
{
    g_return_val_if_fail (GTK_IS_SHRULER (ruler), 0.0);

    return GTK_SHRULER_GET_PRIVATE (ruler)->position;
}
Ejemplo n.º 2
0
/**
 * gtk_shruler_set_range:
 * @ruler: a #GtkSHRuler
 * @lower: the lower limit of the ruler
 * @upper: the upper limit of the ruler
 * @max_size: the maximum size of the ruler used when calculating the space to
 * leave for the text
 *
 * This sets the range of the ruler.
 *
 * Since: GTK 2.8
 */
void
gtk_shruler_set_range (GtkSHRuler *ruler,
                       gdouble    lower,
                       gdouble    upper,
                       gdouble    max_size)
{
    GtkSHRulerPrivate *priv;

    g_return_if_fail (GTK_IS_SHRULER (ruler));

    priv = GTK_SHRULER_GET_PRIVATE (ruler);

    g_object_freeze_notify (G_OBJECT (ruler));
    if (priv->lower != lower)
    {
        priv->lower = lower;
        g_object_notify (G_OBJECT (ruler), "lower");
    }
    if (priv->upper != upper)
    {
        priv->upper = upper;
        g_object_notify (G_OBJECT (ruler), "upper");
    }
    if (priv->max_size != max_size)
    {
        priv->max_size = max_size;
        g_object_notify (G_OBJECT (ruler), "max-size");
    }
    g_object_thaw_notify (G_OBJECT (ruler));

    gtk_widget_queue_draw (GTK_WIDGET (ruler));
}
Ejemplo n.º 3
0
/**
 * gtk_shruler_get_unit:
 * @ruler: a #GtkSHRuler
 *
 * Return value: the unit currently used in the @ruler widget.
 *
 * Since: GTK 2.8
 **/
GtkCMUnit
gtk_shruler_get_unit (GtkSHRuler *ruler)
{
    g_return_val_if_fail (GTK_IS_SHRULER (ruler), 0);

    return GTK_SHRULER_GET_PRIVATE (ruler)->unit;
}
Ejemplo n.º 4
0
gint
gtk_shruler_get_start_pos(GtkSHRuler *ruler)
{
	g_return_val_if_fail (GTK_IS_SHRULER (ruler), 0);

	return ruler->start_pos;
}
Ejemplo n.º 5
0
void
gtk_shruler_set_start_pos(GtkSHRuler *ruler, gint pos)
{
	g_return_if_fail (GTK_IS_SHRULER (ruler));

	ruler->start_pos = pos;
}
Ejemplo n.º 6
0
/**
 * gtk_shruler_set_position:
 * @ruler: a #GtkSHRuler
 * @position: the position to set the ruler to
 *
 * This sets the position of the ruler.
 *
 * Since: GTK 2.8
 */
void
gtk_shruler_set_position (GtkSHRuler *ruler,
                          gdouble    position)
{
    GtkSHRulerPrivate *priv;

    g_return_if_fail (GTK_IS_SHRULER (ruler));

    priv = GTK_SHRULER_GET_PRIVATE (ruler);

    if (priv->position != position)
    {
        priv->position = position;
        g_object_notify (G_OBJECT (ruler), "position");
    }
}
Ejemplo n.º 7
0
/**
 * gtk_shruler_set_unit:
 * @ruler: a #GtkSHRuler
 * @unit:  the #GtkCMUnit to set the ruler to
 *
 * This sets the unit of the ruler.
 *
 * Since: GTK 2.8
 */
void
gtk_shruler_set_unit (GtkSHRuler *ruler,
                      GtkCMUnit  unit)
{
    GtkSHRulerPrivate *priv;

    g_return_if_fail (GTK_IS_SHRULER (ruler));

    priv = GTK_SHRULER_GET_PRIVATE (ruler);

    if (priv->unit != unit)
    {
        priv->unit = unit;
        g_object_notify (G_OBJECT (ruler), "unit");

        gtk_widget_queue_draw (GTK_WIDGET (ruler));
    }
}
Ejemplo n.º 8
0
/**
 * gtk_shruler_get_range:
 * @ruler: a #GtkSHRuler
 * @lower: location to store lower limit of the ruler, or %NULL
 * @upper: location to store upper limit of the ruler, or %NULL
 * @max_size: location to store the maximum size of the ruler used when
 *            calculating the space to leave for the text, or %NULL.
 *
 * Retrieves values indicating the range and current position of a #GtkSHRuler.
 * See gtk_shruler_set_range().
 *
 * Since: GTK 2.8
 **/
void
gtk_shruler_get_range (GtkSHRuler *ruler,
                       gdouble   *lower,
                       gdouble   *upper,
                       gdouble   *max_size)
{
    GtkSHRulerPrivate *priv;

    g_return_if_fail (GTK_IS_SHRULER (ruler));

    priv = GTK_SHRULER_GET_PRIVATE (ruler);

    if (lower)
        *lower = priv->lower;
    if (upper)
        *upper = priv->upper;
    if (max_size)
        *max_size = priv->max_size;
}