/* 
 * © 2008-2009 Sun Microsystems, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */
#include "stdafx.h"

#include "mforms/sizegroup.h"

using namespace mforms;


SizeGroup::SizeGroup(bool w, bool h)
  : _same_width(w), _same_height(h)
{
}


void SizeGroup::add(View *v)
{
//  v->signal_resized().connect(sigc::mem_fun(this, &SizeGroup::resize));
  _views.push_back(v);
}

/*
void SizeGroup::resize()
{
  int max_w= 0, max_h= 0;
  
  for (std::vector<View*>::const_iterator iter= _views.begin();
       iter != _views.end(); ++iter)
  {
    max_w= std::max(max_w, (*iter)->get_width());
    max_h= std::max(max_h, (*iter)->get_height());
  }

  for (std::vector<View*>::const_iterator iter= _views.begin();
       iter != _views.end(); ++iter)
  {
    int w= -1, h= -1;
    if (_same_width)
      w= max_w;
    if (_same_height)
      h= max_h;

    if (w > 1 || h > 1)
      (*iter)->set_size(w, h);
  }
}

*/
