static void
gtk_spin_button_map (GtkWidget *widget)
{
- if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_MAPPED (widget))
+ if (GTK_WIDGET_REALIZED (widget) && !gtk_widget_get_mapped (widget))
{
GTK_WIDGET_CLASS (gtk_spin_button_parent_class)->map (widget);
gdk_window_show (GTK_SPIN_BUTTON (widget)->panel);
static void
gtk_spin_button_unmap (GtkWidget *widget)
{
- if (GTK_WIDGET_MAPPED (widget))
+ if (gtk_widget_get_mapped (widget))
{
gtk_spin_button_stop_spinning (GTK_SPIN_BUTTON (widget));
{
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
- if (GTK_WIDGET_DRAWABLE (widget))
+ if (gtk_widget_is_drawable (widget))
{
if (event->window == spin->panel)
{
widget = GTK_WIDGET (spin_button);
- if (GTK_WIDGET_DRAWABLE (widget))
+ if (gtk_widget_is_drawable (widget))
{
width = spin_button_get_arrow_size (spin_button) + 2 * widget->style->xthickness;
{
GtkSpinButton *spin = GTK_SPIN_BUTTON (widget);
- if (!GTK_WIDGET_IS_SENSITIVE (widget))
+ if (!gtk_widget_is_sensitive (widget))
{
gtk_spin_button_stop_spinning (spin);
gtk_widget_queue_draw (GTK_WIDGET (spin));
if (event->direction == GDK_SCROLL_UP)
{
- if (!GTK_WIDGET_HAS_FOCUS (widget))
+ if (!gtk_widget_has_focus (widget))
gtk_widget_grab_focus (widget);
gtk_spin_button_real_spin (spin, spin->adjustment->step_increment);
}
else if (event->direction == GDK_SCROLL_DOWN)
{
- if (!GTK_WIDGET_HAS_FOCUS (widget))
+ if (!gtk_widget_has_focus (widget))
gtk_widget_grab_focus (widget);
gtk_spin_button_real_spin (spin, -spin->adjustment->step_increment);
}
{
if (event->window == spin->panel)
{
- if (!GTK_WIDGET_HAS_FOCUS (widget))
+ if (!gtk_widget_has_focus (widget))
gtk_widget_grab_focus (widget);
spin->button = event->button;
GdkWChar pos_sign;
GdkWChar neg_sign;
gint entry_length;
+ const gchar *entry_text;
- entry_length = entry->text_length;
+ entry_length = gtk_entry_get_text_length (entry);
+ entry_text = gtk_entry_get_text (entry);
lc = localeconv ();
#endif
for (sign=0, i=0; i<entry_length; i++)
- if ((entry->text[i] == neg_sign) ||
- (entry->text[i] == pos_sign))
+ if ((entry_text[i] == neg_sign) ||
+ (entry_text[i] == pos_sign))
{
sign = 1;
break;
return;
for (dotpos=-1, i=0; i<entry_length; i++)
- if (entry->text[i] == *(lc->decimal_point))
+ if (entry_text[i] == *(lc->decimal_point))
{
dotpos = i;
break;
***********************************************************/
+/**
+ * gtk_spin_button_configure:
+ * @spin_button: a #GtkSpinButton
+ * @adjustment: (allow-none): a #GtkAdjustment.
+ * @climb_rate: the new climb rate.
+ * @digits: the number of decimal places to display in the spin button.
+ *
+ * Changes the properties of an existing spin button. The adjustment, climb rate,
+ * and number of decimal places are all changed accordingly, after this function call.
+ */
void
gtk_spin_button_configure (GtkSpinButton *spin_button,
GtkAdjustment *adjustment,
return GTK_WIDGET (spin);
}
+static void
+warn_nonzero_page_size (GtkAdjustment *adjustment)
+{
+ if (gtk_adjustment_get_page_size (adjustment) != 0.0)
+ g_warning ("GtkSpinButton: setting an adjustment with non-zero page size is deprecated");
+}
+
/* Callback used when the spin button's adjustment changes. We need to redraw
* the arrows when the adjustment's range changes, and reevaluate our size request.
*/
spin_button = GTK_SPIN_BUTTON (data);
spin_button->timer_step = spin_button->adjustment->step_increment;
+ warn_nonzero_page_size (adjustment);
gtk_widget_queue_resize (GTK_WIDGET (spin_button));
}
G_CALLBACK (adjustment_changed_cb),
spin_button);
spin_button->timer_step = spin_button->adjustment->step_increment;
+ warn_nonzero_page_size (adjustment);
}
gtk_widget_queue_resize (GTK_WIDGET (spin_button));
/**
* gtk_spin_button_get_increments:
* @spin_button: a #GtkSpinButton
- * @step: location to store step increment, or %NULL
- * @page: location to store page increment, or %NULL
+ * @step: (allow-none): location to store step increment, or %NULL
+ * @page: (allow-none): location to store page increment, or %NULL
*
* Gets the current step and page the increments used by @spin_button. See
* gtk_spin_button_set_increments().
/**
* gtk_spin_button_get_range:
* @spin_button: a #GtkSpinButton
- * @min: location to store minimum allowed value, or %NULL
- * @max: location to store maximum allowed value, or %NULL
+ * @min: (allow-none): location to store minimum allowed value, or %NULL
+ * @max: (allow-none): location to store maximum allowed value, or %NULL
*
* Gets the range allowed for @spin_button. See
* gtk_spin_button_set_range().