GwyAdjustBar — Compact adjustment visualisation and modification
GtkWidget * | gwy_adjust_bar_new () |
void | gwy_adjust_bar_set_adjustment () |
GtkAdjustment * | gwy_adjust_bar_get_adjustment () |
void | gwy_adjust_bar_set_snap_to_ticks () |
gboolean | gwy_adjust_bar_get_snap_to_ticks () |
void | gwy_adjust_bar_set_mapping () |
GwyScaleMappingType | gwy_adjust_bar_get_mapping () |
void | gwy_adjust_bar_set_has_check_button () |
gboolean | gwy_adjust_bar_get_has_check_button () |
void | gwy_adjust_bar_set_bar_sensitive () |
gboolean | gwy_adjust_bar_get_bar_sensitive () |
GtkWidget * | gwy_adjust_bar_get_label () |
GtkWidget * | gwy_adjust_bar_get_check_button () |
GtkAdjustment * | adjustment | Read / Write |
gboolean | has-check-button | Read / Write |
GwyScaleMappingType | mapping | Read / Write |
gboolean | snap-to-ticks | Read / Write |
void | change-value | Action |
enum | GwyScaleMappingType |
struct | GwyAdjustBar |
struct | GwyAdjustBarClass |
GObject ╰── GInitiallyUnowned ╰── GtkObject ╰── GtkWidget ╰── GtkContainer ╰── GtkBin ╰── GwyAdjustBar
GwyAdjustBar implements AtkImplementorIface and GtkBuildable.
#include <libgwydgets/gwydgets.h>
GwyAdjustBar is a compact widget for visualisation and modification of the value of an GtkAdjustment. It can contains a label with an overlaid bar that can be clicked, dragged or modified by the scroll-wheel by the user. Since the widget does not take keyboard focus, it should be paired with a GtkSpinButton, sharing the same adjustment. This spin button would also be the typical mnemonic widget for the adjustment bar.
GwyAdjustBar supports several different types of mapping between screen positions and values of the underlying
adjustment. Nevertheless, the default mapping (signed square root, GWY_SCALE_MAPPING_SQRT
) should fit most
situations.
GtkWidget * gwy_adjust_bar_new (GtkAdjustment *adjustment
,const gchar *label
);
Creates a new adjustment bar.
The label text, if any, is set with mnemonic enabled. However, you still need to assign it to a widget (presumably
a GtkSpinButton) using gtk_label_set_mnemonic_widget()
.
adjustment |
The adjustment the adjust bar should use, or |
|
label |
Text of the adjustment bar label, or |
A new adjustment bar.
Since: 2.49
void gwy_adjust_bar_set_adjustment (GwyAdjustBar *adjbar
,GtkAdjustment *adjustment
);
Sets the adjustment that an adjustment bar visualises.
adjbar |
An adjustment bar. |
|
adjustment |
Adjustment to use for the value. |
Since: 2.49
GtkAdjustment *
gwy_adjust_bar_get_adjustment (GwyAdjustBar *adjbar
);
Obtains the adjustment that an adjustment bar visualises.
adjbar |
An adjustment bar. |
The adjustment used by adjbar
. If no adjustment was set and the default one is used, function returns
NULL
.
Since: 2.49
void gwy_adjust_bar_set_snap_to_ticks (GwyAdjustBar *adjbar
,gboolean setting
);
Sets the snapping behaviour of an adjustment bar.
Note the ‘multiples of step size’ condition in fact applies to the difference from the minimum value. The maximum
adjustment value is always permissible, even if it does not satisfy this condition. Values modified by the user
(i.e. emission of signal "change-value") are snapped, however, values set explicitly gtk_adjustment_set_value()
are kept intact.
Setting this option to TRUE
immediately causes an adjustment value change if it does not satisfy the condition.
It is usually a poor idea to enable snapping for non-linear mappings.
adjbar |
An adjustment bar. |
|
setting |
|
Since: 2.49
gboolean
gwy_adjust_bar_get_snap_to_ticks (GwyAdjustBar *adjbar
);
Sets the snapping behaviour of an adjustment bar.
adjbar |
An adjustment bar. |
TRUE
if values are restricted to multiples of step size.
Since: 2.49
void gwy_adjust_bar_set_mapping (GwyAdjustBar *adjbar
,GwyScaleMappingType mapping
);
Sets the mapping function type for an adjustment bar.
adjbar |
An adjustment bar. |
|
mapping |
Mapping function type between values and screen positions in the adjustment bar. |
Since: 2.49
GwyScaleMappingType
gwy_adjust_bar_get_mapping (GwyAdjustBar *adjbar
);
Gets the mapping function type of an adjustment bar.
adjbar |
An adjustment bar. |
The type of mapping function between values and screen positions.
Since: 2.49
void gwy_adjust_bar_set_has_check_button (GwyAdjustBar *adjbar
,gboolean setting
);
Sets whether an adjustment bar has a check button.
adjbar |
An adjustment bar. |
|
setting |
|
Since: 2.49
gboolean
gwy_adjust_bar_get_has_check_button (GwyAdjustBar *adjbar
);
Reports whether an adjustment bar has a check button.
adjbar |
An adjustment bar. |
TRUE
if the adjustment bar has a check button.
Since: 2.49
void gwy_adjust_bar_set_bar_sensitive (GwyAdjustBar *adjbar
,gboolean sensitive
);
Sets the sensitivity of an adjustment bar.
The bar's sensitivity can be controlled separately. This is useful when adjbar
has a check button because
otherwise the bar is the entire widget and the function is not different from gtk_widget_set_sensitive()
. However,
if you want to enable and disable the adjustment bar via the check button, use this function instead of
gtk_widget_set_sensitive()
which would make insensitive also the check button.
adjbar |
An adjustment bar. |
|
sensitive |
|
Since: 2.49
gboolean
gwy_adjust_bar_get_bar_sensitive (GwyAdjustBar *adjbar
);
Reports whether an adjustment bar is sensitive.
See gwy_adjust_bar_set_bar_sensitive()
for discussion.
adjbar |
An adjustment bar. |
TRUE
if the widget's bar is sensitive.
Since: 2.49
GtkWidget *
gwy_adjust_bar_get_label (GwyAdjustBar *adjbar
);
Gets the label widget inside an adjustment bar.
Use gtk_label_set_mnemonic_widget()
to set the mnemonic widget for the label or change the label text.
adjbar |
An adjustment bar. |
The label widget.
Since: 2.49
GtkWidget *
gwy_adjust_bar_get_check_button (GwyAdjustBar *adjbar
);
Gets the check button of an adjustment bar.
Connect to the "toggled" signal of the check button. Modifying it is not recommended.
adjbar |
An adjustment bar. |
The check button widget, or NULL
if there is none.
Since: 2.49
Type of adjustment bar mapping functions.
Linear mapping between values and screen positions. This recommended for signed additive quantities of a limited range. |
||
Screen positions correspond to ‘signed square roots’ of the value. This is the recommended general-purpose default mapping type as it works with both signed and usigned quantities and offers good sensitivity for both large and small values. |
||
Screen positions correspond to logarithms of values. The adjustment range must contain only
positive values. For quantities of extreme ranges this mapping may be preferred to
|
||
Screen positions correspond to logarithms of values with 1 added fist. The adjustment range must contain only non-negative values. This mapping may be preferred for integer quantities with extreme ranges which also include zero. (Since 2.62) |
Since: 2.49
struct GwyAdjustBar;
Adjustment bar widget visualising an adjustment.
The GwyAdjustBar struct contains private data only and should be accessed using the functions below.
Since: 2.49
struct GwyAdjustBarClass { };
Class of adjustment bars visualising adjustments.
Since: 2.49
“adjustment”
property“adjustment” GtkAdjustment *
Adjustment representing the value.
Owner: GwyAdjustBar
Flags: Read / Write
“has-check-button”
property“has-check-button” gboolean
Whether the adjust bar has a check button.
Owner: GwyAdjustBar
Flags: Read / Write
Default value: FALSE
“mapping”
property“mapping” GwyScaleMappingType
Mapping function between values and screen positions.
Owner: GwyAdjustBar
Flags: Read / Write
Default value: GWY_SCALE_MAPPING_SQRT
“snap-to-ticks”
property“snap-to-ticks” gboolean
Whether only values that are multiples of step size are allowed.
Owner: GwyAdjustBar
Flags: Read / Write
Default value: FALSE
“change-value”
signalvoid user_function (GwyAdjustBar *gwyadjustbar, double arg1, gpointer user_data)
The ::change-value signal is emitted when the user interactively changes the value.
It is an action signal.
gwyadjustbar |
The GwyAdjustBar which received the signal. |
|
arg1 |
New value for |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action