/*------------------------------------------------------------------------------
 src/lib/djWidget/djWindow.h

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

#ifndef DJ_WINDOW_H
#define DJ_WINDOW_H
#include <djWidget.h>
#include <FL/Fl_Double_Window.H>

namespace dj {

// Window.
//
class Window : public Fl_Double_Window, public WidgetBase {
public:

  Window(const Str & title = Str());
  virtual ~Window();
  
  // Title.
  //
  void title(const Str &);
  const Str & title() const { return _title; }
  
  // Signals.
  //
  Signal<bool> & closeSig() { return _closeSig; }
  
  // Layout.
  //
  virtual void size(const Vec2i &);
  virtual void resize(int, int, int, int);
  virtual const Box2i geom() const { return _geom; }
  virtual int visible() const;
  
  // Widget.
  //
  virtual void fullscreen(bool);
  virtual bool fullscreen() const { return _fullscreen; }
  virtual int handle(int);
  
protected:

  virtual void layoutUpdate();

private:

  DJ_FL_WIDGET_CALLBACK(Window, closeCallback)

  Str _title;
  Box2i _geom, _geomTmp;
  bool _fullscreen;
  
  Signal<bool> _closeSig;
};

}

#endif
