Beispiel #1
0
void Container::ResizeTimeOut(void *data, XtIntervalId * /*id*/)
{
   Container *obj = (Container *)data;
   int h4 = obj->Parent()->Height();
   Dimension h1, h2, h3;

   if (obj->NumChildren())
    {
      Dimension max_height;
      MotifUI **children = (MotifUI **)obj->Children();
      int i;
      XtWidgetGeometry preferred;

      max_height = 0;
      for (i = 0; i < obj->NumChildren(); i++)
       {
	 if (XtIsManaged(children[i]->BaseWidget()))
	  {
            XtQueryGeometry(children[i]->BaseWidget(), NULL, &preferred);
            if ((h1 = preferred.height) > max_height)
	     {
	       max_height = h1;
	       break;
	     }
	  }
       }
      Position y;
      if (max_height)
         XtVaGetValues(children[0]->BaseWidget(), XmNy, &y, NULL);
      else
	 y = 0;
      h1 = max_height + (2 * y);
    }
   else
      XtVaGetValues(obj->_workArea, XmNheight, &h1, NULL);
   XtVaGetValues(obj->_clipWidget, XmNheight, &h2, NULL);
   XtVaGetValues(obj->_w, XmNheight, &h3, NULL);
   h3 = h3 - h2 + h1;
   if (h2 != h1)
    {
      if (h4 > (int)h3)
         h3 = h4;
      else if (obj->NumChildren() == 0)
         return;
      h4 = h3;
    }
   else if (h4 <= (int)h3)
      return;
   XtVaSetValues(obj->_w, XmNheight, h4, NULL);
   obj->Refresh();
   XtVaGetValues(obj->_w, XmNheight, &h3, NULL);
   if (h3 != h4)
      XtAppAddTimeOut(obj->appContext, 500, ResizeTimeOut, obj);
}