/*------------------------------------------------------------------------------
 src/lib/djWidget/layoutItem.cxx

 Copyright (c) 2004-2006 Darby Johnston.
 All rights reserved.
 Use is subject to license terms.
------------------------------------------------------------------------------*/

//#define DJ_DBG
#include "djLayout.h"

namespace dj {

LayoutItem::LayoutItem(TYPE type) :
  _type(type),
  _parent(0)
{
  _sizePolicy[0] = _sizePolicy[1] = STRETCH;
  _alignPolicy[0] = _alignPolicy[1] = CENTER;
}

LayoutItem::~LayoutItem() {}

void LayoutItem::resize(int x, int y, int w, int h)
{
  _geom = Box2i(x, y, w, h);
}

void LayoutItem::sizePolicy(SIZE_POLICY h, SIZE_POLICY v)
{
  _sizePolicy[0] = h;
  _sizePolicy[1] = v;
}

void LayoutItem::alignPolicy(ALIGN_POLICY h, ALIGN_POLICY v)
{
  _alignPolicy[0] = h;
  _alignPolicy[1] = v;
}

void LayoutItem::parent(LayoutItem * in)
{
  _parent = in;
}

void LayoutItem::layoutUpdate()
{
  DJ_DBG_FNC("dj::LayoutItem::layoutUpdate");
  DJ_DBG_PRN("this = " << int(this));
  DJ_DBG_PRN("parent = " << int(_parent));
  
  if (_parent) _parent->layoutUpdate();
}

}
