/***************************************************************************
                          SIMPLY POWERFUL TOOLKIT (SPTK)
                          CDataControl.h  -  description
                             -------------------
    begin                : Tue Apr 4 2000
    copyright            : (C) 2000-2006 by Alexey S.Parshin
    email                : alexeyp@gmail.com
 ***************************************************************************/

/***************************************************************************
   This library is free software; you can redistribute it and/or modify it 
   under the terms of the GNU Library 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 Library
   General Public License for more details.

   You should have received a copy of the GNU Library 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.

   Please report all bugs and problems to "alexeyp@gmail.com"
 ***************************************************************************/

#ifndef __CDATACONTROL_H__
#define __CDATACONTROL_H__

#include <sptk3/sptk.h>

#include <FL/Fl_Group.H>
#include <FL/Fl_Box.H>
#include <FL/Fl_Input_.H>
#include <FL/Fl_Button.H>
#include <sptk3/CIntList.h>
#include <sptk3/CDateTime.h>
#include <sptk3/CInput.h>
#include <sptk3/CDatabase.h>
#include <sptk3/CQuery.h>
#include <sptk3/CControl.h>

namespace sptk {

   /// @addtogroup gui GUI Classes
   /// @{

	class CPopupWindow;
	class CPopupCalendar;
	class CDateControl;
	class CToggleTree;

   /// @brief Text input widget.
   ///
   /// Implements the simple single-line input box.
   /// While it can be used by itself, it's also a base class for
   /// several other SPTK widgets. As CControl descendant it's a
   /// layout client.
	class SP_EXPORT CInput : public CControl {

      /// Constructor initializer
		void ctor_init(bool autoCreate);

	protected:

      /// @brief Loads data from query
		virtual void load(CQuery *);

      /// @brief Saves data to query
		virtual void save(CQuery *);

      /// @brief Loads data from XML node
		virtual void load(const CXmlNode& node) { CControl::load(node); }

      /// @brief Loads data from XML node
		virtual void load(const CXmlNode* node) { CControl::load(node); }

      /// @brief Saves data to XML node
      /// @param node CXmlNode&, an XML node to unload information to
		virtual void save(CXmlNode& node) const { CControl::save(node); }

      /// @brief Saves data to XML node
		virtual void save(CXmlNode* node) const { CControl::save(node); }

      /// @brief Returns true if the input data is valid
		virtual bool valid() const { return true; }

      /// @brief Special internal constructor for derived classes
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
      /// @param autoCreate bool, if true CControl will create CInput_ widget and make it the main internal widget.
		CInput(const char *label,int layoutSize,CLayoutAlign layoutAlign,bool autoCreate);
	public:
      /// @brief Constructor in SPTK style 
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
		CInput(const char *label=0,int layoutSize=10,CLayoutAlign layoutAlign=SP_ALIGN_TOP);
#ifdef __COMPATIBILITY_MODE__    
      /// @brief Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label, const char * label
		CInput(int,int,int,int,const char * = 0,bool autoCreate=true);
#endif
      /// @brief Destructor
		virtual ~CInput();

      /// @brief Returns input widget input type
		int controlType() const;

      /// @brief Sets input widget input type
		void controlType(int type);

      /// @brief Universal data connection, returns data from control
		virtual CVariant data() const;

      /// @brief Universal data connection, sets data from control
		virtual void     data(const CVariant v);

      /// @brief Returns the control kind, SPTK-style RTTI
      /// @see CControlKind for more information
		virtual CControlKind kind() const { return DCV_STRING; }

      /// @brief Returns the control class name, SPTK-style RTTI
		virtual std::string className() const { return "CInput"; }

      /// @brief Returns the input text font type
		virtual Fl_Font  textFont() const;

      /// @brief Sets the input text font type
		virtual void     textFont(Fl_Font f);

      /// @brief Returns the input text font size
		virtual uchar    textSize() const;

      /// @brief Sets the input text font size
		virtual void     textSize(uchar s);

      /// @brief Returns the input text maximum length, 0 - unlimited
		virtual int      maxLength() const;

      /// @brief Sets the input text maximum length, 0 - unlimited
		virtual void     maxLength(int);

      /// @brief Computes the optimal widget width
      /// @param w int&, input - width offered by the program, output - width required by widget
		virtual void preferredWidth(int& w) const;

      /// @brief Computes the optimal widget height
      /// @param h int&, input - height offered by the program, output - height required by widget
		virtual void preferredHeight(int& h) const;

      /// @brief Computes the optimal widget size
      /// @param w int&, input - width offered by the program, output - width required by widget
      /// @param h int&, input - height offered by the program, output - height required by widget
		virtual void preferredSize(int& w,int& h);
	};

   /// @brief Simple text editor
   ///
   /// Multiple line input box
	class SP_EXPORT CMemoInput : public CInput {
		typedef class CInput inherited;

      /// @brief Constructor initializer
		void ctor_init();

	public:

      /// @brief Constructor in SPTK style 
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
		CMemoInput(const char *label=0,int layoutSize=10,CLayoutAlign layoutAlign=SP_ALIGN_TOP);

#ifdef __COMPATIBILITY_MODE__    
      /// @brief Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label, const char * label
		CMemoInput(int x,int y,int w,int h,const char *label=0);
#endif    

      /// @brief Returns the control kind, SPTK-style RTTI
      /// @see CControlKind for more information
		virtual CControlKind kind() const { return DCV_MEMO; }

      /// @brief Returns the control class name, SPTK-style RTTI
		virtual std::string className() const { return "CMemoInput"; }

      /// @brief Universal data connection, returns data from control
		virtual CVariant data() const;

      /// @brief Universal data connection, sets data from control
		virtual void     data(const CVariant v);

      /// @brief Returns the input text font type
		virtual Fl_Font  textFont() const;

      /// @brief Sets the input text font type
		virtual void     textFont(Fl_Font f);

      /// @brief Returns the input text font size
		virtual uchar    textSize() const;

      /// @brief Sets the input text font size
		virtual void     textSize(uchar s);

      /// @brief Saves data to query
		virtual void save(CQuery *);

      /// @brief Computes the optimal widget size
      /// @param w int&, input - width offered by the program, output - width required by widget
      /// @param h int&, input - height offered by the program, output - height required by widget
		virtual void preferredSize(int& w,int& h);
	};

   /// @brief Simple text viewer
   ///
   /// Multiple line text box (read-only)
	class SP_EXPORT CBox : public CInput {
		typedef class CInput inherited;

      /// @brief Text to display in the box
		std::string m_text;

      /// @brief Constructor initializer
		void ctor_init(const char *label);

	public:

      /// @brief Constructor in SPTK style 
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
		CBox(const char * label=0,int layoutSize=10,CLayoutAlign layoutAlign=SP_ALIGN_TOP);

#ifdef __COMPATIBILITY_MODE__    
      /// @brief Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label, const char * label
		CBox(int x,int y,int w,int h,const char *label = 0);
#endif    

      /// @brief Universal data connection, returns data from control
		virtual CVariant data() const;

      /// @brief Universal data connection, sets data from control
		virtual void     data(const CVariant v);

      /// @brief Returns the control kind, SPTK-style RTTI
      /// @see CControlKind for more information
		virtual CControlKind kind() const { return DCV_BOX; }

      /// @brief Returns the control class name, SPTK-style RTTI
		virtual std::string className() const { return "CBox"; }

      /// @brief Returns the text font type
		virtual Fl_Font  textFont() const;

      /// @brief Sets the text font type
		virtual void     textFont(Fl_Font f);

      /// @brief Returns the text font size
		virtual uchar    textSize() const;

      /// @brief Sets the input text font size
		virtual void     textSize(uchar s);

      /// @brief Returns the text alignment. 
		virtual unsigned textAlign() const;

      /// @brief Sets the text alignment
		virtual void     textAlign(unsigned align);

      /// @brief Computes totalHeight for the text inside
		virtual int      totalHeight(int ww=0) const;

      /// @brief Computes the optimal widget size
      /// @param w int&, input - width offered by the program, output - width required by widget
      /// @param h int&, input - height offered by the program, output - height required by widget
		virtual void     preferredSize(int& w,int& h);

      /// @brief Resizes the control and inside widgets. 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
		virtual void     resize(int x,int y,int w,int h);
	};

   /// @brief Simple HTML viewer
   ///
   /// Multiple line HTML text box (read-only)
	class SP_EXPORT CHtmlBox : public CInput {
		typedef class CInput inherited;

      /// @brief Constructor initializer
		void ctor_init(const char *label);

	public:

      /// @brief Constructor in SPTK style 
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
		CHtmlBox(const char * label=0,int layoutSize=10,CLayoutAlign layoutAlign=SP_ALIGN_TOP);

#ifdef __COMPATIBILITY_MODE__    
      /// @brief Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label, const char * label
		CHtmlBox(int,int,int,int,const char * = 0);
#endif    

      /// @brief Universal data connection, returns data from control
		virtual CVariant data() const;

      /// @brief Universal data connection, sets data from control
		virtual void     data(const CVariant v);

      /// @brief Returns the control kind, SPTK-style RTTI
      /// @see CControlKind for more information
		virtual CControlKind kind() const { return DCV_HTMLBOX; }

      /// @brief Returns the control class name, SPTK-style RTTI
		virtual std::string className() const { return "CHtmlBox"; }

      /// @brief Returns the input text font type
		virtual Fl_Font  textFont() const;

      /// @brief Sets the input text font type
		virtual void     textFont(Fl_Font f);

      /// @brief Returns the input text font size
		virtual uchar    textSize() const;

      /// @brief Sets the input text font size
		virtual void     textSize(uchar s);

      /// @brief Computes the total height of HTML text inside if the widgets height isn't limited
		int totalHeight() const;

      /// @brief Computes the optimal widget size
      /// @param w int&, input - width offered by the program, output - width required by widget
      /// @param h int&, input - height offered by the program, output - height required by widget
		virtual void preferredSize(int& w,int& h);
	};

   /// @brief Date interval input widget
   ///
   /// Masked date interval input with the drop-down calendar
	class SP_EXPORT CDateIntervalInput : public CInput {
		typedef class CInput inherited;

		CDateControl   *m_firstDateInput;	///< First date input widget
		CDateControl   *m_secondDateInput;	///< Second date input widget
		std::string     m_separator;			///< Separator to display
		CPopupCalendar *m_calendarWindow;	///< Pop-up calendar window

      /// @brief Constructor initializer
		void ctor_init();

      /// @brief Internal callback function
		static void intervalCalendarButtonPressed(Fl_Widget *btn,void *data);

	protected:

      /// @brief Shows drop-down calendar for the particular date input that owns the button btn
      /// @param btn Fl_Widget *, button of the date input widget
		void showCalendar(Fl_Widget *btn);

	public:

      /// @brief Constructor in SPTK style 
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
		CDateIntervalInput(const char *label=0,int layoutSize=10,CLayoutAlign layoutAlign=SP_ALIGN_TOP);

#ifdef __COMPATIBILITY_MODE__    
      /// @brief Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label, const char * label
		CDateIntervalInput(int x,int y,int w,int h,const char *label=0);
#endif    

      /// @brief Sets the separator to display between date inputs
      /// @param s std::string, separator value
		void separator(std::string s);

      /// @brief Returns the separator between date inputs
		std::string separator() { return m_separator; }

      /// @brief Returns the date from the first date input - the beginning of interval
		CDateTime beginOfInterval() const;

      /// @brief Sets the date in the first date input - the beginning of interval
      /// @param dt const CDateTime, date and time value for the first control
		void      beginOfInterval(const CDateTime dt);

      /// @brief Returns the date from the second date input - the end of interval
		CDateTime endOfInterval() const;

      /// Sets the date from the second date input - the end of interval
      /// @param dt const CDateTime, date and time value for the second control
		void      endOfInterval(const CDateTime dt);

      /// @brief Returns the control kind, SPTK-style RTTI
      /// @see CControlKind for more information
		virtual CControlKind kind() const { return DCV_DATEINTERVAL; }

      /// @brief Returns the control class name, SPTK-style RTTI
		virtual std::string className() const { return "CDateIntervalInput"; }

      /// @brief Universal data connection, returns data from control
		virtual CVariant data() const;

      /// @brief Universal data connection, sets data from control
		virtual void     data(const CVariant v);

      /// @brief Resizes the control and inside widgets. 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
		virtual void     resize(int x,int y,int w,int h);

      /// @brief Returns true if the control state is valid, and the data is inside the limits
      /// if applicable
		virtual bool     valid() const;
	};

   /// @brief Phone number input widget
   ///
   /// Phone number input with two input boxes - area code and phone number.
	class SP_EXPORT CPhoneNumberInput : public CInput {
		typedef class CInput inherited;

      /// @brief Constructor initializer
		void ctor_init();

	public:

      /// @brief Constructor in SPTK style 
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
		CPhoneNumberInput(const char * label=0,int layoutSize=10,CLayoutAlign layoutAlign=SP_ALIGN_TOP);

#ifdef __COMPATIBILITY_MODE__    
      /// @brief Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label, const char * label
		CPhoneNumberInput(int x,int y,int w,int h,const char *label=0);
#endif    

      /// @brief Returns the control kind, SPTK-style RTTI
      /// @see CControlKind for more information
		virtual CControlKind kind() const { return DCV_PHONE; }

      /// @brief Returns the control class name, SPTK-style RTTI
		virtual std::string className() const { return "CPhoneNumberInput"; }

      /// @brief Universal data connection, returns data from control
		virtual CVariant data() const;

      /// @brief Universal data connection, sets data from control
		virtual void     data(const CVariant v);

      /// @brief Returns true if the input data is valid
		virtual bool valid() const;

      /// @brief Computes the optimal widget width
      /// @param w int&, input - width offered by the program, output - width required by widget
		virtual void     preferredWidth(int& w) const;
	};

   /// @brief Integer value input widget. 
   ///
   /// Allows to input only integers, and you can also define the input value range for the valid().
	class SP_EXPORT CIntegerInput : public CInput {
		typedef class CInput inherited;

      /// @brief Minimum value (optional)
		int        m_minValue;

      /// @brief Maximum value (optional)
		int        m_maxValue;

	protected:

      /// @brief Saves data to query
		virtual void save(CQuery *);

      /// @brief Returns true if the input data is valid
		virtual bool valid() const;

	public:

      /// @brief Constructor in SPTK style 
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
		CIntegerInput(const char * label=0,int layoutSize=10,CLayoutAlign layoutAlign=SP_ALIGN_TOP);

#ifdef __COMPATIBILITY_MODE__    
      /// @brief Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label, const char * label
		CIntegerInput(int x,int y,int w,int h,const char *label=0);
#endif    

      /// @brief Sets limits for the value inside
      /// @param limited bool, true if use the limits
      /// @param min int, minimum value
      /// @param max int, maximum value
		void             setLimits(bool limited,int min=0,int max=0);

      /// @brief Returns the control kind, SPTK-style RTTI
      /// @see CControlKind for more information
		virtual CControlKind kind() const { return DCV_INTEGER; }

      /// @brief Returns the control class name, SPTK-style RTTI
		virtual std::string className() const { return "CIntegerInput"; }
	};

   /// @brief Floating point value input widget. 
   ///
   /// Allows to input only Floating point numbers, and you can also define the input value range for the valid().
	class SP_EXPORT CFloatInput : public CInput {
		typedef class CInput inherited;

      /// @brief Minimum value (optional)
		double   m_minValue;

      /// @brief Maximum value (optional)
		double   m_maxValue;

      /// @brief Number of decimal places to show
		int      m_decimalPlaces;

	protected:

      /// @brief Saves data to query
		virtual void save(CQuery *);

      /// @brief Returns true if the input data is valid
		virtual bool valid() const;

	public:

      /// @brief Constructor in SPTK style 
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
		CFloatInput(const char * label=0,int layoutSize=10,CLayoutAlign layoutAlign=SP_ALIGN_TOP);

#ifdef __COMPATIBILITY_MODE__    
      /// @brief Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label, const char * label
		CFloatInput(int,int,int,int,const char * = 0);
#endif    

      /// @brief Sets limits for the value inside
      /// @param limited bool, true if use the limits
      /// @param min double, minimum value
      /// @param max double, maximum value
		void setLimits(bool limited,double min=0,double max=0);

      /// @brief Returns the number of decimal places
		int     decimalPlaces() const { return m_decimalPlaces; }

      /// @brief Sets the number of decimal places to show
		void    decimalPlaces(int dp) { m_decimalPlaces = dp; }

      /// @brief Returns the control kind, SPTK-style RTTI
      /// @see CControlKind for more information
		virtual CControlKind kind() const { return DCV_FLOAT; }

      /// @brief Returns the control class name, SPTK-style RTTI
		virtual std::string className() const { return "CFloatInput"; }
	};

   /// @brief Password input widget.
   ///
   /// The extended version of Fl_SecretInput.
   /// Displays '*' for the text inside
	class SP_EXPORT CPasswordInput : public CInput {
		typedef class CInput inherited;
	public:

      /// @brief Constructor in SPTK style 
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
		CPasswordInput(const char * label=0,int layoutSize=10,CLayoutAlign layoutAlign=SP_ALIGN_TOP);

#ifdef __COMPATIBILITY_MODE__    
      /// @brief Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label, const char * label
		CPasswordInput(int x,int y,int w,int h,const char * label=0);
#endif    
	};

   /// @brief Base date and time input widget
   ///
   /// Base class for most of the date and time inputs (except fot CDateIntervalInput)
	class SP_EXPORT CDateTimeBaseInput : public CInput {
		typedef class CInput inherited;

      /// @brief Mininmum date and time value to check in valid()
		CDateTime            m_minValue;

      /// @brief Maximum date and time value to check in valid()
		CDateTime            m_maxValue;

      /// @brief Constructor initializer
		void ctor_init();

	protected:

      /// @brief Popup calendar window
		CPopupCalendar      *m_calendarWindow;

      /// @brief Date input control
		CDateControl        *m_dateInput;

      /// @brief Time input control
		CInput_             *m_timeInput;

      /// @brief Loads data from query
		virtual void load(CQuery *);

      /// @brief Saves data to query
		virtual void save(CQuery *);

      /// @brief Returns true if the input data is valid
		virtual bool valid() const;

      /// @brief Constructor in SPTK style 
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
      /// @param autoCreate bool, auto create CInput_ widget. Internal.
		CDateTimeBaseInput(const char * label,int layoutSize,CLayoutAlign layoutAlign,bool autoCreate);

      /// @brief Internal callback function
		static void calendarButtonPressed(Fl_Widget *btn,void *data);

#ifdef __COMPATIBILITY_MODE__    
      /// @brief Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label, const char * label
		CDateTimeBaseInput(int x,int y,int w,int h,const char * label,bool autoCreate);
#endif    

      /// @brief Shows drop-down calendar
		bool showCalendar(Fl_Widget *btn);

	public:

      /// @brief Sets limits for the value inside
      /// @param limited bool, true if use the limits
      /// @param min CDateTime, minimum value
      /// @param max CDateTime, maximum value
		void setLimits(bool limited,CDateTime min=double(0),CDateTime max=double(0));

      /// @brief Returns widget date or time  value
		virtual CDateTime dateTimeValue() const;

      /// @brief Sets widget date or time value
		virtual void     dateTimeValue(CDateTime dt);
	};

	class CTimeInput;

   /// @brief Date input widget
   ///
   /// Masked date input with the drop-down calendar
	class SP_EXPORT CDateInput : public CDateTimeBaseInput {
      /// @brief Constructor initializer
		void ctor_init();
	public:

      /// @brief Constructor in SPTK style 
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
		CDateInput(const char * label=0,int layoutSize=10,CLayoutAlign layoutAlign=SP_ALIGN_TOP);

#ifdef __COMPATIBILITY_MODE__    
      /// @brief Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label, const char * label
		CDateInput(int x,int y,int w,int h,const char * label=0);
#endif    
		~CDateInput();

      /// @brief Returns the control kind, SPTK-style RTTI
      /// @see CControlKind for more information
		virtual CControlKind kind() const { return DCV_DATE; }

      /// @brief Returns the control class name, SPTK-style RTTI
		virtual std::string className() const { return "CDateInput"; }

      /// @brief Universal data connection, returns data from date control.
      /// Data is returned as VAR_DATE.
		virtual CVariant data() const;

      /// @brief Universal data connection, sets data to date control
		virtual void     data(const CVariant v);

      /// @brief Resizes the control and inside widgets. 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
		virtual void resize(int x,int y,int w,int h);

      /// Computes the optimal widget height
      /// @param h int&, input - height offered by the program, output - height required by widget
		virtual void preferredHeight(int& h) const;
	};

   /// @brief Time input widget
   ///
   /// Masked time input
	class SP_EXPORT CTimeInput : public CDateTimeBaseInput {
	public:

      /// @brief Constructor in SPTK style 
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
		CTimeInput(const char * label=0,int layoutSize=10,CLayoutAlign layoutAlign=SP_ALIGN_TOP);

#ifdef __COMPATIBILITY_MODE__    
      /// @brief Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label, const char * label
		CTimeInput(int x,int y,int w,int h,const char * label=0);
#endif    

      /// @brief Returns the control kind, SPTK-style RTTI
      /// @see CControlKind for more information
		virtual CControlKind kind() const { return DCV_TIME; }

      /// @brief Returns the control class name, SPTK-style RTTI
		virtual std::string className() const { return "CTimeInput"; }

      /// @brief Computes the optimal widget width
      /// @param w int&, input - width offered by the program, output - width required by widget
		virtual void preferredWidth(int& w) const;
	};

   /// @brief Date and time input widget.
   ///
   /// Combines date and time input widgets. Includes two input boxes and the drop-down calendar
   /// for the date input.
	class SP_EXPORT CDateTimeInput : public CDateTimeBaseInput {

      /// @brief Constructor initializer
		void ctor_init();

	public:

      /// @brief Constructor in SPTK style 
      /// @param label const char *, label
      /// @param layoutSize int, widget align in layout
      /// @param layoutAlign CLayoutAlign, widget align in layout
		CDateTimeInput(const char * label=0,int layoutSize=10,CLayoutAlign layoutAlign=SP_ALIGN_TOP);

#ifdef __COMPATIBILITY_MODE__    
      /// @brief Constructor in FLTK style 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
      /// @param label, const char * label
		CDateTimeInput(int x,int y,int w,int h,const char * label=0);
#endif    

      /// @brief Returns the control kind, SPTK-style RTTI
      /// @see CControlKind for more information
		virtual CControlKind kind() const { return DCV_DATETIME; }

      /// @brief Returns the control class name, SPTK-style RTTI
		virtual std::string className() const { return "CDateTimeInput"; }

      /// @brief Resizes the control and inside widgets. 
      /// @param x int, x-position
      /// @param y int, y-position
      /// @param w int, width
      /// @param h int, height
		virtual void resize(int x,int y,int w,int h);

      /// @brief Returns widget date or time  value
		virtual CDateTime dateTimeValue() const;

      /// @brief Sets widget date or time value
		virtual void     dateTimeValue(CDateTime dt);

      /// @brief Universal data connection, returns data from control
		virtual CVariant data() const;

      /// @brief Universal data connection, sets data from control
		virtual void     data(const CVariant v);
	};
   /// @}
}
#endif
