spinbutton: Add some missing accessors

Add a setter and getter for the climb-rate property.
This commit is contained in:
Matthias Clasen 2020-10-03 13:02:38 -04:00
parent 9d0d4cef03
commit 60b1b4669e
3 changed files with 102 additions and 55 deletions

View File

@ -2786,24 +2786,26 @@ gtk_spin_button_new_with_range
gtk_spin_button_set_adjustment
gtk_spin_button_get_adjustment
gtk_spin_button_set_digits
gtk_spin_button_get_digits
gtk_spin_button_set_increments
gtk_spin_button_get_increments
gtk_spin_button_set_range
gtk_spin_button_get_range
gtk_spin_button_get_value_as_int
gtk_spin_button_set_value
gtk_spin_button_set_update_policy
gtk_spin_button_set_numeric
gtk_spin_button_spin
gtk_spin_button_set_wrap
gtk_spin_button_set_snap_to_ticks
gtk_spin_button_update
gtk_spin_button_get_digits
gtk_spin_button_get_increments
gtk_spin_button_get_numeric
gtk_spin_button_get_range
gtk_spin_button_get_snap_to_ticks
gtk_spin_button_get_update_policy
gtk_spin_button_get_value
gtk_spin_button_set_update_policy
gtk_spin_button_get_update_policy
gtk_spin_button_set_numeric
gtk_spin_button_get_numeric
gtk_spin_button_set_wrap
gtk_spin_button_get_wrap
gtk_spin_button_set_snap_to_ticks
gtk_spin_button_get_snap_to_ticks
gtk_spin_button_set_climb_rate
gtk_spin_button_get_climb_rate
gtk_spin_button_spin
gtk_spin_button_update
GTK_INPUT_ERROR
<SUBSECTION Standard>
GTK_SPIN_BUTTON

View File

@ -2147,6 +2147,45 @@ gtk_spin_button_get_snap_to_ticks (GtkSpinButton *spin_button)
return spin_button->snap_to_ticks;
}
/**
* gtk_spin_button_set_climb_rate:
* @spin_button: a #GtkSpinButton
* @climb_rate: the rate of acceleration, must be >= 0
*
* Sets the acceleration rate for repeated changes when you
* hold down a button or key.
*/
void
gtk_spin_button_set_climb_rate (GtkSpinButton *spin_button,
double climb_rate)
{
g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
g_return_if_fail (0.0 <= climb_rate);
if (spin_button->climb_rate == climb_rate)
return;
spin_button->climb_rate = climb_rate;
g_object_notify_by_pspec (G_OBJECT (spin_button), spinbutton_props[PROP_CLIMB_RATE]);
}
/**
* gtk_spin_button_get_climb_rate:
* @spin_button: a #GtkSpinButton
*
* Returns the acceleration rate for repeated changes.
*
* Returns: the acceleration rate
*/
double
gtk_spin_button_get_climb_rate (GtkSpinButton *spin_button)
{
g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), 0.0);
return spin_button->climb_rate;
}
/**
* gtk_spin_button_spin:
* @spin_button: a #GtkSpinButton

View File

@ -11,7 +11,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
@ -96,98 +96,104 @@ typedef enum
typedef struct _GtkSpinButton GtkSpinButton;
GDK_AVAILABLE_IN_ALL
GType gtk_spin_button_get_type (void) G_GNUC_CONST;
GType gtk_spin_button_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_configure (GtkSpinButton *spin_button,
GtkAdjustment *adjustment,
double climb_rate,
guint digits);
void gtk_spin_button_configure (GtkSpinButton *spin_button,
GtkAdjustment *adjustment,
double climb_rate,
guint digits);
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_spin_button_new (GtkAdjustment *adjustment,
double climb_rate,
guint digits);
GtkWidget* gtk_spin_button_new (GtkAdjustment *adjustment,
double climb_rate,
guint digits);
GDK_AVAILABLE_IN_ALL
GtkWidget* gtk_spin_button_new_with_range (double min,
double max,
double step);
GtkWidget* gtk_spin_button_new_with_range (double min,
double max,
double step);
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_set_adjustment (GtkSpinButton *spin_button,
GtkAdjustment *adjustment);
void gtk_spin_button_set_adjustment (GtkSpinButton *spin_button,
GtkAdjustment *adjustment);
GDK_AVAILABLE_IN_ALL
GtkAdjustment* gtk_spin_button_get_adjustment (GtkSpinButton *spin_button);
GtkAdjustment* gtk_spin_button_get_adjustment (GtkSpinButton *spin_button);
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_set_digits (GtkSpinButton *spin_button,
guint digits);
void gtk_spin_button_set_digits (GtkSpinButton *spin_button,
guint digits);
GDK_AVAILABLE_IN_ALL
guint gtk_spin_button_get_digits (GtkSpinButton *spin_button);
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_set_increments (GtkSpinButton *spin_button,
double step,
double page);
void gtk_spin_button_set_increments (GtkSpinButton *spin_button,
double step,
double page);
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_get_increments (GtkSpinButton *spin_button,
double *step,
double *page);
double *step,
double *page);
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_set_range (GtkSpinButton *spin_button,
double min,
double max);
void gtk_spin_button_set_range (GtkSpinButton *spin_button,
double min,
double max);
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_get_range (GtkSpinButton *spin_button,
double *min,
double *max);
double *min,
double *max);
GDK_AVAILABLE_IN_ALL
double gtk_spin_button_get_value (GtkSpinButton *spin_button);
double gtk_spin_button_get_value (GtkSpinButton *spin_button);
GDK_AVAILABLE_IN_ALL
int gtk_spin_button_get_value_as_int (GtkSpinButton *spin_button);
int gtk_spin_button_get_value_as_int (GtkSpinButton *spin_button);
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_set_value (GtkSpinButton *spin_button,
double value);
void gtk_spin_button_set_value (GtkSpinButton *spin_button,
double value);
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_set_update_policy (GtkSpinButton *spin_button,
GtkSpinButtonUpdatePolicy policy);
void gtk_spin_button_set_update_policy (GtkSpinButton *spin_button,
GtkSpinButtonUpdatePolicy policy);
GDK_AVAILABLE_IN_ALL
GtkSpinButtonUpdatePolicy gtk_spin_button_get_update_policy (GtkSpinButton *spin_button);
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_set_numeric (GtkSpinButton *spin_button,
gboolean numeric);
void gtk_spin_button_set_numeric (GtkSpinButton *spin_button,
gboolean numeric);
GDK_AVAILABLE_IN_ALL
gboolean gtk_spin_button_get_numeric (GtkSpinButton *spin_button);
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_spin (GtkSpinButton *spin_button,
GtkSpinType direction,
double increment);
void gtk_spin_button_spin (GtkSpinButton *spin_button,
GtkSpinType direction,
double increment);
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_set_wrap (GtkSpinButton *spin_button,
gboolean wrap);
void gtk_spin_button_set_wrap (GtkSpinButton *spin_button,
gboolean wrap);
GDK_AVAILABLE_IN_ALL
gboolean gtk_spin_button_get_wrap (GtkSpinButton *spin_button);
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_set_snap_to_ticks (GtkSpinButton *spin_button,
gboolean snap_to_ticks);
void gtk_spin_button_set_snap_to_ticks (GtkSpinButton *spin_button,
gboolean snap_to_ticks);
GDK_AVAILABLE_IN_ALL
gboolean gtk_spin_button_get_snap_to_ticks (GtkSpinButton *spin_button);
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_set_climb_rate (GtkSpinButton *spin_button,
double climb_rate);
GDK_AVAILABLE_IN_ALL
double gtk_spin_button_get_climb_rate (GtkSpinButton *spin_button);
GDK_AVAILABLE_IN_ALL
void gtk_spin_button_update (GtkSpinButton *spin_button);
G_END_DECLS
#endif /* __GTK_SPIN_BUTTON_H__ */