After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 683168 - Make spinbutton orientable
Make spinbutton orientable
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkSpinButton
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2012-09-01 19:14 UTC by Paolo Borelli
Modified: 2012-09-03 15:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Make spinbutton orientable (25.22 KB, patch)
2012-09-01 19:17 UTC, Cosimo Cecchi
none Details | Review
Make spinbutton orientable (25.79 KB, patch)
2012-09-01 20:22 UTC, Cosimo Cecchi
none Details | Review
screenshot (10.92 KB, image/png)
2012-09-01 20:30 UTC, Cosimo Cecchi
  Details
Make spinbutton orientable (25.71 KB, patch)
2012-09-02 23:17 UTC, Cosimo Cecchi
none Details | Review
entry: fix requisition width/height to use the current pango layout (6.48 KB, patch)
2012-09-02 23:18 UTC, Cosimo Cecchi
none Details | Review
Make spinbutton orientable (26.61 KB, patch)
2012-09-03 15:10 UTC, Cosimo Cecchi
committed Details | Review
entry: fix requisition width/height to use the current pango layout (6.48 KB, patch)
2012-09-03 15:10 UTC, Cosimo Cecchi
committed Details | Review

Description Paolo Borelli 2012-09-01 19:14:46 UTC
It would be cool if spinbutton could be oriented: by making it vertical you would get something like:


   +
 -----

  12

 -----
   -


which is better in some cases, especially when you need to input a "composite"  number made of more digits independently edited. In particular I would use it to enter hh:mm in a clock, but other cases come to mind (complex numbers, secret combination, etc)


A patch by me and Cosimo follows (he will attach it since he is the one who figured out the GtkEntry changes)
Comment 1 Cosimo Cecchi 2012-09-01 19:17:15 UTC
Created attachment 223154 [details] [review]
Make spinbutton orientable

In order to implement this, we also need to make the get_frame_size method of GtkEntry overridable from a subclass (like get_text_area_size).
Comment 2 Paolo Borelli 2012-09-01 19:21:50 UTC
Review of attachment 223154 [details] [review]:

::: gtk/gtkentry.h
@@ -115,2 +121,2 @@
   /* Padding for future expansion */
   void (*_gtk_reserved1)      (void);

we need to remove one of the padding slots

::: tests/testspinbutton.c
@@ -43,1 @@
 		GtkWidget *hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);

(we need to remove this quick hack)
Comment 3 Cosimo Cecchi 2012-09-01 20:22:51 UTC
Created attachment 223161 [details] [review]
Make spinbutton orientable

--

- adds correct nth-child support
- fixes some requisition/allocation bugs
- adds a separate window in the test for the vertical case
Comment 4 Cosimo Cecchi 2012-09-01 20:30:04 UTC
Created attachment 223162 [details]
screenshot

Screenshot with a patched theme
Comment 5 Cosimo Cecchi 2012-09-02 23:17:18 UTC
Created attachment 223228 [details] [review]
Make spinbutton orientable

--

Fix some compiler warnings
Comment 6 Cosimo Cecchi 2012-09-02 23:18:20 UTC
Created attachment 223229 [details] [review]
entry: fix requisition width/height to use the current pango layout

This way, we can ensure that width/height changes due to the use of
gtk_entry_set_attributes() are correctly reflected in the size request.

--

I think this patch is generally needed independently of this feature; right now entries or spinbuttons that are set custom pango attributes don't change the frame size.
Comment 7 Cosimo Cecchi 2012-09-03 15:10:26 UTC
Created attachment 223334 [details] [review]
Make spinbutton orientable

--

Some minor fixes
Comment 8 Cosimo Cecchi 2012-09-03 15:10:33 UTC
Created attachment 223335 [details] [review]
entry: fix requisition width/height to use the current pango layout

This way, we can ensure that width/height changes due to the use of
gtk_entry_set_attributes() are correctly reflected in the size request.
Comment 9 Matthias Clasen 2012-09-03 15:19:23 UTC
Review of attachment 223335 [details] [review]:

works fine in my testing
Comment 10 Matthias Clasen 2012-09-03 15:21:34 UTC
Review of attachment 223334 [details] [review]:

nice
Comment 11 Matthias Clasen 2012-09-03 15:23:36 UTC
Review of attachment 223334 [details] [review]:

nice
Comment 12 Cosimo Cecchi 2012-09-03 15:47:28 UTC
Attachment 223334 [details] pushed as afd99d3 - Make spinbutton orientable
Attachment 223335 [details] pushed as d05191a - entry: fix requisition width/height to use the current pango layout

Pushed to master, thanks!