GtkAspectFrame fluff



Hi,

The following idiom occurs more than once in my code:

  aspect_frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, 0, TRUE);
  g_object_set (aspect_frame, "shadow-type", GTK_SHADOW_NONE, NULL);
  {
    GtkRcStyle *rcstyle = gtk_rc_style_new ();
    rcstyle->xthickness = 0;
    rcstyle->ythickness = 0;
    gtk_widget_modify_style (aspect_frame, rcstyle);
    gtk_rc_style_unref (rcstyle);
  }

In my mind, GtkAspectFrame is a weird package deal; I really don't see
how maintaining an aspect ratio has anything to do with frames.  Why
not GtkAspectButton or GtkAspectExpander?

Wouldn't it make sense to pull the aspect ratio logic out of
GtkAspectFrame and provide an aspect-ratio-preserving container that
does not try to draw labels or borders around your things, but just do
the aspect ratio part?

I can think of two designs that, in my limited knowledge of GTK+,
would make sense:

  a) Have a separate GtkAspect (or "GtkAspectBin"?) whose sole
     responsibility is to maintain an aspect ratio.  GtkAspectFrame
     would then be reduced to a simple composition of a GtkAspect and
     a GtkFrame.

  b) Make GtkAlignment aware of aspect ratios.

Of course, I might be -- no, I *probably* am -- missing some vital
aspect of this (pardon the pun).  However, I searched the mailing list
archives for prior discussion and all I found was a short mail [1]
from January 2001 containing the following, sic:

> I been looking at this, and I see GtkAspectFrame. Wouldn't it be
> better design to have a GtkAspect subclassing GtkBin and put a
> GtkFrame in that if so desired?  Or is there some other way ur meant
> to do what he wants

There's also Owen's original tutorial from 1997 [2] describing how to
use GtkAspectFrame and GtkPaned widgets, but that doesn't contain
anything like a design rationale.

I realize that the long-term goal is to build height-for-width layout
into the guts of GTK+, which would be awesome and probably render
irrelevant all that I've said so far.  Am I right in assuming that
such a thing would eliminate the need for Gtk*Aspect* anything?

Please excuse the pointlessness of this mail.


Thanks for your time,

-- 
Daniel Brockman
drlion deepwood net

[1] http://mail.gnome.org/archives/gtk-list/2001-January/msg00234.html
[2] http://mail.gnome.org/archives/gtk-list/1997-August/msg00171.html




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