[ROOT] minimum size for TG classes

From: Brett Viren (bv@bnl.gov)
Date: Fri Nov 09 2001 - 08:44:54 MET


Hello,

>From my experience with Gtk's set_usize() methods, I find it very
useful to be able to set the minimum size of some/all of the widgets
in an app.  This allows the app to never be resized so small as to
have widgets disappear or otherwise become unusable.  

I think TG classes would benifit from this idea, particularly classes
like TRootEmbeddedCanvas which emits warning messages if the canvas
size goes to zero.

As far as I have found, there is no such mechanism in TG (right?), but
I think it would be pretty easy to add.  It only needs a couple of
UInt_t's to hold the mins, some accessor methods and a copy of lines
in the Resize() related methods (unless I miss something).  Ie:

void TGFrame::SetMinSize(UInt_t minw, UInt_t minh)
{
    fMinWidth = minw;
    fMinHeight = minh;
}

void TGFrame::Resize(UInt_t w, UInt_t h)
{
   // Resize the frame.

   // Assure min size, but only check if fMinXxx is non-zero
   if (fMinWidth && w < fMinWidth) w = fMinWidth;
   if (fMinHeight && h < fMinHeight) h = fMinHeight;

   if (w != fWidth || h != fHeight) {
      TGWindow::Resize(w, h);
      fWidth = w; fHeight = h;
      Layout();
   }
}

void TGFrame::MoveResize(...)
{
    ... similar ...
}


-Brett.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:07 MET