/***************************************************************************
                          SIMPLY POWERFUL TOOLKIT (SPTK)
                          CDataControl.h  -  description
                             -------------------
    begin                : Tue Apr 4 2000
    copyright            : (C) 2000-2005 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>

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

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

/// @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:

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

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

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

   /// 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:
   /// 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__    
   /// 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
   /// Destructor
   virtual ~CInput();

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

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

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

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

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

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

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

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

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

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

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

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

   /// 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;

   /// 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;

   /// 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;

   /// Constructor initializer
   void ctor_init();

public:

   /// 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__    
   /// 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    

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

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

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

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

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

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

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

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

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

   /// 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;

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

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

public:

   /// 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__    
   /// 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    

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

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

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

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

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

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

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

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

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

   /// 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);

   /// 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;

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

public:

   /// 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__    
   /// 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    

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

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

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

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


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

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

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

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

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

   /// 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

   /// Constructor initializer
   void ctor_init();

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

protected:

   /// 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:

   /// 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__    
   /// 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    

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

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

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

   /// 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);

   /// 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);

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

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

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

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

   /// 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);

   /// 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;

   /// Constructor initializer
   void ctor_init();

public:

   /// 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__    
   /// 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    

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

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

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

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

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

   /// 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;

   /// Minimum value (optional)
   int        m_minValue;

   /// Maximum value (optional)
   int        m_maxValue;

protected:

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

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

public:

   /// 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__    
   /// 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    

   /// 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);

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

   /// 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;

   /// Minimum value (optional)
   double   m_minValue;

   /// Maximum value (optional)
   double   m_maxValue;

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

protected:

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

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

public:

   /// 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__    
   /// 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    

   /// 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);

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

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

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

   /// 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:

   /// 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__    
   /// 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;

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

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

   /// Constructor initializer
   void ctor_init();

protected:

   /// Popup calendar window
   CPopupCalendar      *m_calendarWindow;

   /// Date input control
   CDateControl        *m_dateInput;

   /// Time input control
   CInput_             *m_timeInput;

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

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

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

   /// 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);

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

#ifdef __COMPATIBILITY_MODE__    
   /// 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    

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

public:

   /// 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));

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

   /// 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 {
   /// Constructor initializer
   void ctor_init();
public:

   /// 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__    
   /// 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();

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

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

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

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

   /// 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:

   /// 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__    
   /// 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    

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

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

   /// 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 {

   /// Constructor initializer
   void ctor_init();

public:

   /// 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__    
   /// 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    

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

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

   /// 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);

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

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

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

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

/// @}

#endif
