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 304099 - Add an oriented box widget to gtk
Add an oriented box widget to gtk
Status: RESOLVED DUPLICATE of bug 553573
Product: gtk+
Classification: Platform
Component: Widget: Other
2.6.x
Other Linux
: Normal enhancement
: Medium API
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-05-13 19:20 UTC by Gabriel de Perthuis
Modified: 2008-10-02 03:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
C source (18.67 KB, text/plain)
2005-05-13 20:19 UTC, Gabriel de Perthuis
Details
The header (2.80 KB, text/plain)
2005-05-13 20:19 UTC, Gabriel de Perthuis
Details
C source (7.25 KB, text/plain)
2005-05-14 11:23 UTC, Gabriel de Perthuis
Details
C header (2.76 KB, text/plain)
2005-05-14 11:25 UTC, Gabriel de Perthuis
Details

Description Gabriel de Perthuis 2005-05-13 19:20:16 UTC
An oriented box is a box that can change its orientation, from a hbox to a vbox.
There is an implementation here:
http://cvs.gnome.org/viewcvs/gthumb/src/gtkorientationbox.h?rev=1.1&view=markup
http://cvs.gnome.org/viewcvs/gthumb/src/gtkorientationbox.c?rev=1.2&view=markup
(This implementation is missing an "orientation-changed" signal however.)

This widget is useful for things like panels.
I'd rather have it in gtk itself than doing copy-paste because I'm using the
OCaml language binding.
Comment 1 Gabriel de Perthuis 2005-05-13 20:19:13 UTC
Created attachment 46405 [details]
C source

The C source - the gthumb file above, with a property, a signal, and some name
changes for consistency with GtkToolbar.
Comment 2 Gabriel de Perthuis 2005-05-13 20:19:51 UTC
Created attachment 46406 [details]
The header
Comment 3 Gabriel de Perthuis 2005-05-13 20:25:50 UTC
It may be a good idea to move the code of gtk_{h,v}box_size_allocate into
another file, since it is duplicated in gtkorientationbox.c .
Comment 4 Owen Taylor 2005-05-13 20:38:11 UTC
If this is a useful addition, the right way to do it is to add 

 gtk_box_set_orientation()

Change Box to be non-abstract, and make GtkHBox and GtkVBox just
trivial subclasses with different default orientations.
Comment 5 Gabriel de Perthuis 2005-05-14 00:38:37 UTC
I prefer the first option (but I don't care that much).
I think GtkVBox and GtkHBox have a purpose as widgets that keep the same
orientation, so it would be better not to break that guarantee. There is no code
duplication either way, the subclasses of GtkBox all have a handful of methods.

As far as the use cases: for doing some layout like in a dialog box, use a HBox
or a VBox.
For doing a panel, or a dockable component, use an OrientableBox.

Comment 6 Gabriel de Perthuis 2005-05-14 11:23:15 UTC
Created attachment 46424 [details]
C source
Comment 7 Gabriel de Perthuis 2005-05-14 11:25:59 UTC
Created attachment 46425 [details]
C header

I've renamed the class to GtkOrientableBox, and removed the code duplication.
Comment 8 Matthias Clasen 2005-05-17 21:14:33 UTC
I believe owen is right. If we add something like this, GtkBox should just be
made orientable.
Comment 9 Matthias Clasen 2008-10-02 03:09:24 UTC

*** This bug has been marked as a duplicate of 553573 ***