#define DJ_DBG
#include "widgets.h"
#include <djWindow.h>
#include <djTabWidget.h>
#include <djMenuWidget.h>

myApp::myApp(int & argc, char ** argv) :
  App("widget", argc, argv),
  _window(0)
{
  _window = new Window(name());
  MenubarWidget * menubar = new MenubarWidget;
  menubar->add("&File/E&xit", FL_CTRL+'q', exitCallback, this);
  TabWidget * tabWidget = new TabWidget;
  tabWidget->tabAdd("Button", new ButtonTab);
  tabWidget->tabAdd("Input", new InputTab);
  tabWidget->tabAdd("Slider", new SliderTab);
  tabWidget->tabAdd("Vector", new VecTab);
  
  VLayout * layout = new VLayout(_window);
  layout->spacing(0);
  layout->margin(0);
  layout->add(menubar);
  layout->add(tabWidget);
  layout->stretch(tabWidget);
  
  //_window->size(_window->sizeHint());
  _window->show();

  //tabWidget->delTab(0);
  //tabWidget->delTab(0);
  
  valid(true);
}

myApp::~myApp()
{
  if (_window) delete _window;
}

void myApp::exitCallback()
{
  _window->hide();
}

int main(int argc, char ** argv)
{
  //DJ_DBG_LOG();
  return myApp(argc, argv).exec();
}
