// This may look like C code, but it's really -*- C++ -*-
/*
 * Copyright (C) 2007 Koen Deforche, Kessel-Lo, Belgium.
 *
 * See the LICENSE file for terms of use.
 */
#ifndef WDATEPICKER_H_
#define WDATEPICKER_H_

#include <WCompositeWidget>
#include <WDate>
#include <set>

namespace Wt {

class WCalendar;
class WInteractWidget;
class WLineEdit;

/*! \class WDatePicker WDatePicker WDatePicker
 *  \brief A date picker.
 */
class WT_API WDatePicker : public WCompositeWidget
{
public:
  /*! \brief Create a new date picker.
   *
   * The displayWidget represents the button or image which much be clicked
   * to open the date picker. When activated, the date picker shows a
   * WCalendar widget in a popup window.
   *
   * The forEdit is the lineEdit which works in conjunction with the date
   * picker: a valid date from the lineEdit is reflected in the selected date
   * on the calendar, and vice-versa.
   *
   * i18n is passed to the WCalendar constructor.
   */
  WDatePicker(WInteractWidget *displayWidget,
	      WLineEdit *forEdit,
	      bool i18n = false, WContainerWidget *parent = 0);

  /*! \brief The calendar widget.
   */
  WCalendar *calendar() const { return calendar_; }

private:
  WInteractWidget  *displayWidget_;
  WLineEdit        *forEdit_;

  WContainerWidget *layout_;
  WContainerWidget *popup_;
  WCalendar        *calendar_;

  void setFromCalendar();
  void setFromLineEdit();
};

}

#endif // WDATEPICKER_H_
