![]() |
![]() |
![]() |
PHAT Reference Manual | ![]() |
---|---|---|---|---|
PhatFanSliderPhatFanSlider — a base class for PhatHFanSlider and PhatVFanSlider |
PhatFanSlider; void phat_fan_slider_set_value (PhatFanSlider *slider, double value); void phat_fan_slider_set_log (PhatFanSlider *slider, gboolean is_log); gboolean phat_fan_slider_is_log (PhatFanSlider *slider); double phat_fan_slider_get_value (PhatFanSlider *slider); void phat_fan_slider_set_range (PhatFanSlider *slider, double lower, double upper); void phat_fan_slider_get_range (PhatFanSlider *slider, double *lower, double *upper); void phat_fan_slider_set_adjustment (PhatFanSlider *slider, GtkAdjustment *adjustment); GtkAdjustment* phat_fan_slider_get_adjustment (PhatFanSlider *slider); void phat_fan_slider_set_inverted (PhatFanSlider *slider, gboolean inverted); gboolean phat_fan_slider_get_inverted (PhatFanSlider *slider); void phat_fan_slider_set_default_value (PhatFanSlider *slider, gdouble value);
GObject +----GInitiallyUnowned +----GtkObject +----GtkWidget +----PhatFanSlider +----PhatVFanSlider +----PhatHFanSlider
"changed" void user_function (PhatFanSlider *slider, gpointer user_data) : Run first / Action "value-changed" void user_function (PhatFanSlider *slider, gpointer user_data) : Run first / Action
The PhatFanSlider widget family provides a slider widget for retrieving floating point values from the user. The cool thing about fansliders is that the user can have a great amount of precision in a very small space. After depressing the left mouse button on a fanslider, the user can then drag the pointer away from the widget, causing a "fan" to popup which indicates the new scale they are working with. The farther out the pointer is drawn, the greater the size of the fan and the level of precision.
The fansliders work like most other numerical entry widgets; if you know how to use a GtkSpinbutton, you know how to use a PhatFanSlider. If not, check out the GTK+-2.0 tutorial.
You can change the colors that a given fanslider uses. Fansliders use widget->style->base_gc[GTK_STATE_SELECTED] for the foreground color, and widget->style->dark_gc[GTK_STATE_NORMAL] for the background color. Adjusting these elements of the widget's style will change the way the fanslider draws.
PhatFanSlider is an abstract base class, from which PhatHFanSlider and
PhatVFanSlider are derived. To create a new fanslider, call either
phat_vfanslider_new()
or phat_hfanslider_new()
.
typedef struct _PhatFanSlider PhatFanSlider;
The PhatFanSlider struct contains private data only, and should be accessed using the functions below.
void phat_fan_slider_set_value (PhatFanSlider *slider, double value);
Sets the current value of the slider. If the value is outside the
range of values allowed by slider
, it will be clamped to fit
within them. The slider emits the "value-changed" signal if the
value changes.
slider : |
a PhatFanSlider |
value : |
a new value for the slider |
void phat_fan_slider_set_log (PhatFanSlider *slider, gboolean is_log);
slider : |
|
is_log : |
gboolean phat_fan_slider_is_log (PhatFanSlider *slider);
slider : |
|
Returns : |
double phat_fan_slider_get_value (PhatFanSlider *slider);
Retrieves the current value of the slider.
slider : |
a PhatFanSlider |
Returns : | current value of the slider. |
void phat_fan_slider_set_range (PhatFanSlider *slider, double lower, double upper);
Sets the range of allowable values for the slider, and clamps the slider's
current value to be between lower
and upper
.
slider : |
a PhatFanSlider |
lower : |
lowest allowable value |
upper : |
highest allowable value |
void phat_fan_slider_get_range (PhatFanSlider *slider, double *lower, double *upper);
Places the range of allowable values for slider
into lower
and upper
. Either variable may be set to NULL
if you are not
interested in its value.
slider : |
a PhatFanSlider |
lower : |
retrieves lowest allowable value |
upper : |
retrieves highest allowable value |
void phat_fan_slider_set_adjustment (PhatFanSlider *slider, GtkAdjustment *adjustment);
Sets the adjustment used by slider
. Every PhatFanSlider uses an
adjustment to store its current value and its range of allowable
values. If adjustment
is NULL
, a new adjustment with a value of
zero and a range of [-1.0, 1.0] will be created.
slider : |
a PhatFanSlider |
adjustment : |
a GtkAdjustment |
GtkAdjustment* phat_fan_slider_get_adjustment (PhatFanSlider *slider);
Retrives the current adjustment in use by slider
.
slider : |
a PhatFanSlider |
Returns : | slider 's current GtkAdjustment
|
void phat_fan_slider_set_inverted (PhatFanSlider *slider, gboolean inverted);
Sets in which direction the fanslider should draw increasing
values. By default, horizontal fansliders draw low to high from
left to right, and vertical fansliders draw from bottom to top.
You can reverse this behavior by setting inverted
to TRUE
.
slider : |
a PhatFanSlider |
inverted : |
TRUE to invert the fanslider
|
gboolean phat_fan_slider_get_inverted (PhatFanSlider *slider);
Determines whether slider
is inverted or not.
slider : |
a PhatFanSlider |
Returns : | TRUE if slider is inverted
|
void phat_fan_slider_set_default_value (PhatFanSlider *slider, gdouble value);
Set default value of the slider. Slider is reset to this value when middle mouse button is pressed.
slider : |
a PhatFanSlider |
value : |
the default value |
void user_function (PhatFanSlider *slider, gpointer user_data) : Run first / Action
The "changed" signal is emitted when any parameter of the
slider's adjustment changes, except for the value
parameter.
slider : |
the object on which the signal was emitted |
user_data : |
user data set when the signal handler was connected. |
void user_function (PhatFanSlider *slider, gpointer user_data) : Run first / Action
The "value-changed" signal is emitted when the value of the slider's adjustment changes.
slider : |
the object on which the signal was emitted |
user_data : |
user data set when the signal handler was connected. |