[gtk+/wip/baedert/drawing: 83/128] spinbutton: Add accessors for (max-)width-chars



commit 0b684163322c1f29d13a60163b3c3749ac4a0539
Author: Timm Bäder <mail baedert org>
Date:   Sat May 6 17:05:58 2017 +0200

    spinbutton: Add accessors for (max-)width-chars

 docs/reference/gtk/gtk4-sections.txt |    4 +++
 gtk/gtkspinbutton.c                  |   45 ++++++++++++++++++++++++++++++++++
 gtk/gtkspinbutton.h                  |   12 +++++++++
 3 files changed, 61 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 05a460d..e2b62ea 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -2719,6 +2719,10 @@ gtk_spin_button_get_value
 gtk_spin_button_get_wrap
 gtk_spin_button_set_text
 gtk_spin_button_get_text
+gtk_spin_button_set_max_width_chars
+gtk_spin_button_get_max_width_chars
+gtk_spin_button_set_width_chars
+gtk_spin_button_get_width_chars
 GTK_INPUT_ERROR
 <SUBSECTION Standard>
 GTK_SPIN_BUTTON
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index 380c7a8..2ef793d 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -2309,3 +2309,48 @@ gtk_spin_button_set_text (GtkSpinButton *spin_button,
 
   g_object_notify (G_OBJECT (spin_button), "text");
 }
+
+int
+gtk_spin_button_get_max_width_chars (GtkSpinButton *spin_button)
+{
+  GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
+
+  g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), -1);
+
+  return gtk_entry_get_width_chars (GTK_ENTRY (priv->entry));
+}
+
+
+void
+gtk_spin_button_set_max_width_chars (GtkSpinButton *spin_button,
+                                    int            max_width_chars)
+{
+  GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
+
+  g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
+
+  gtk_entry_set_max_width_chars (GTK_ENTRY (priv->entry), max_width_chars);
+  g_object_notify (G_OBJECT (spin_button), "max-width-chars");
+}
+
+int
+gtk_spin_button_get_width_chars (GtkSpinButton *spin_button)
+{
+  GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
+
+  g_return_val_if_fail (GTK_IS_SPIN_BUTTON (spin_button), -1);
+
+  return gtk_entry_get_width_chars (GTK_ENTRY (priv->entry));
+}
+
+void
+gtk_spin_button_set_width_chars (GtkSpinButton *spin_button,
+                                 int            width_chars)
+{
+  GtkSpinButtonPrivate *priv = gtk_spin_button_get_instance_private (spin_button);
+
+  g_return_if_fail (GTK_IS_SPIN_BUTTON (spin_button));
+
+  gtk_entry_set_width_chars (GTK_ENTRY (priv->entry), width_chars);
+  g_object_notify (G_OBJECT (spin_button), "width-chars");
+}
diff --git a/gtk/gtkspinbutton.h b/gtk/gtkspinbutton.h
index 5dc3b7c..b811b5f 100644
--- a/gtk/gtkspinbutton.h
+++ b/gtk/gtkspinbutton.h
@@ -232,6 +232,18 @@ const char *    gtk_spin_button_get_text           (GtkSpinButton *spin_button);
 GDK_AVAILABLE_IN_3_92
 void            gtk_spin_button_set_text           (GtkSpinButton *spin_button,
                                                     const char    *text);
+GDK_AVAILABLE_IN_3_92
+int             gtk_spin_button_get_max_width_chars (GtkSpinButton *spin_button);
+GDK_AVAILABLE_IN_3_92
+void            gtk_spin_button_set_max_width_chars (GtkSpinButton *spin_button,
+                                                     int            max_width_chars);
+GDK_AVAILABLE_IN_3_92
+int             gtk_spin_button_get_width_chars     (GtkSpinButton *spin_button);
+GDK_AVAILABLE_IN_3_92
+void            gtk_spin_button_set_width_chars     (GtkSpinButton *spin_button,
+                                                     int            width_chars);
+
+
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]