#ifndef DateTimeFieldElements_h
#define DateTimeFieldElements_h
#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
#include "core/html/shadow/DateTimeNumericFieldElement.h"
#include "core/html/shadow/DateTimeSymbolicFieldElement.h"
namespace WebCore {
class DateTimeAMPMFieldElement FINAL : public DateTimeSymbolicFieldElement {
WTF_MAKE_NONCOPYABLE(DateTimeAMPMFieldElement);
public:
static PassRefPtr<DateTimeAMPMFieldElement> create(Document&, FieldOwner&, const Vector<String>&);
private:
DateTimeAMPMFieldElement(Document&, FieldOwner&, const Vector<String>&);
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE;
virtual void setValueAsDate(const DateComponents&) OVERRIDE;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&) OVERRIDE;
};
class DateTimeDayFieldElement FINAL : public DateTimeNumericFieldElement {
WTF_MAKE_NONCOPYABLE(DateTimeDayFieldElement);
public:
static PassRefPtr<DateTimeDayFieldElement> create(Document&, FieldOwner&, const String& placeholder, const Range&);
private:
DateTimeDayFieldElement(Document&, FieldOwner&, const String& placeholder, const Range&);
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE;
virtual void setValueAsDate(const DateComponents&) OVERRIDE;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&) OVERRIDE;
};
class DateTimeHourFieldElementBase : public DateTimeNumericFieldElement {
WTF_MAKE_NONCOPYABLE(DateTimeHourFieldElementBase);
protected:
DateTimeHourFieldElementBase(Document&, FieldOwner&, const Range&, const Range& hardLimits, const Step&);
void initialize();
private:
virtual void setValueAsDate(const DateComponents&) OVERRIDE;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&) OVERRIDE;
};
class DateTimeHour11FieldElement FINAL : public DateTimeHourFieldElementBase {
WTF_MAKE_NONCOPYABLE(DateTimeHour11FieldElement);
public:
static PassRefPtr<DateTimeHour11FieldElement> create(Document&, FieldOwner&, const Range&, const Step&);
private:
DateTimeHour11FieldElement(Document&, FieldOwner&, const Range& hour23Range, const Step&);
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE;
virtual void setValueAsInteger(int, EventBehavior = DispatchNoEvent) OVERRIDE;
};
class DateTimeHour12FieldElement FINAL : public DateTimeHourFieldElementBase {
WTF_MAKE_NONCOPYABLE(DateTimeHour12FieldElement);
public:
static PassRefPtr<DateTimeHour12FieldElement> create(Document&, FieldOwner&, const Range&, const Step&);
private:
DateTimeHour12FieldElement(Document&, FieldOwner&, const Range& hour23Range, const Step&);
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE;
virtual void setValueAsInteger(int, EventBehavior = DispatchNoEvent) OVERRIDE;
};
class DateTimeHour23FieldElement FINAL : public DateTimeHourFieldElementBase {
WTF_MAKE_NONCOPYABLE(DateTimeHour23FieldElement);
public:
static PassRefPtr<DateTimeHour23FieldElement> create(Document&, FieldOwner&, const Range&, const Step&);
private:
DateTimeHour23FieldElement(Document&, FieldOwner&, const Range& hour23Range, const Step&);
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE;
virtual void setValueAsInteger(int, EventBehavior = DispatchNoEvent) OVERRIDE;
};
class DateTimeHour24FieldElement FINAL : public DateTimeHourFieldElementBase {
WTF_MAKE_NONCOPYABLE(DateTimeHour24FieldElement);
public:
static PassRefPtr<DateTimeHour24FieldElement> create(Document&, FieldOwner&, const Range&, const Step&);
private:
DateTimeHour24FieldElement(Document&, FieldOwner&, const Range& hour23Range, const Step&);
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE;
virtual void setValueAsInteger(int, EventBehavior = DispatchNoEvent) OVERRIDE;
};
class DateTimeMillisecondFieldElement FINAL : public DateTimeNumericFieldElement {
WTF_MAKE_NONCOPYABLE(DateTimeMillisecondFieldElement);
public:
static PassRefPtr<DateTimeMillisecondFieldElement> create(Document&, FieldOwner&, const Range&, const Step&);
private:
DateTimeMillisecondFieldElement(Document&, FieldOwner&, const Range&, const Step&);
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE;
virtual void setValueAsDate(const DateComponents&) OVERRIDE;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&) OVERRIDE;
};
class DateTimeMinuteFieldElement FINAL : public DateTimeNumericFieldElement {
WTF_MAKE_NONCOPYABLE(DateTimeMinuteFieldElement);
public:
static PassRefPtr<DateTimeMinuteFieldElement> create(Document&, FieldOwner&, const Range&, const Step&);
private:
DateTimeMinuteFieldElement(Document&, FieldOwner&, const Range&, const Step&);
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE;
virtual void setValueAsDate(const DateComponents&) OVERRIDE;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&) OVERRIDE;
};
class DateTimeMonthFieldElement FINAL : public DateTimeNumericFieldElement {
WTF_MAKE_NONCOPYABLE(DateTimeMonthFieldElement);
public:
static PassRefPtr<DateTimeMonthFieldElement> create(Document&, FieldOwner&, const String& placeholder, const Range&);
private:
DateTimeMonthFieldElement(Document&, FieldOwner&, const String& placeholder, const Range&);
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE;
virtual void setValueAsDate(const DateComponents&) OVERRIDE;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&) OVERRIDE;
};
class DateTimeSecondFieldElement FINAL : public DateTimeNumericFieldElement {
WTF_MAKE_NONCOPYABLE(DateTimeSecondFieldElement);
public:
static PassRefPtr<DateTimeSecondFieldElement> create(Document&, FieldOwner&, const Range&, const Step&);
private:
DateTimeSecondFieldElement(Document&, FieldOwner&, const Range&, const Step&);
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE;
virtual void setValueAsDate(const DateComponents&) OVERRIDE;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&) OVERRIDE;
};
class DateTimeSymbolicMonthFieldElement FINAL : public DateTimeSymbolicFieldElement {
WTF_MAKE_NONCOPYABLE(DateTimeSymbolicMonthFieldElement);
public:
static PassRefPtr<DateTimeSymbolicMonthFieldElement> create(Document&, FieldOwner&, const Vector<String>&, int minimum, int maximum);
private:
DateTimeSymbolicMonthFieldElement(Document&, FieldOwner&, const Vector<String>&, int minimum, int maximum);
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE;
virtual void setValueAsDate(const DateComponents&) OVERRIDE;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&) OVERRIDE;
};
class DateTimeWeekFieldElement FINAL : public DateTimeNumericFieldElement {
WTF_MAKE_NONCOPYABLE(DateTimeWeekFieldElement);
public:
static PassRefPtr<DateTimeWeekFieldElement> create(Document&, FieldOwner&, const Range&);
private:
DateTimeWeekFieldElement(Document&, FieldOwner&, const Range&);
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE;
virtual void setValueAsDate(const DateComponents&) OVERRIDE;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&) OVERRIDE;
};
class DateTimeYearFieldElement FINAL : public DateTimeNumericFieldElement {
WTF_MAKE_NONCOPYABLE(DateTimeYearFieldElement);
public:
struct Parameters {
int minimumYear;
int maximumYear;
bool minIsSpecified;
bool maxIsSpecified;
String placeholder;
Parameters()
: minimumYear(-1)
, maximumYear(-1)
, minIsSpecified(false)
, maxIsSpecified(false)
{
}
};
static PassRefPtr<DateTimeYearFieldElement> create(Document&, FieldOwner&, const Parameters&);
private:
DateTimeYearFieldElement(Document&, FieldOwner&, const Parameters&);
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE;
virtual void setValueAsDate(const DateComponents&) OVERRIDE;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&) OVERRIDE;
virtual int defaultValueForStepDown() const OVERRIDE;
virtual int defaultValueForStepUp() const OVERRIDE;
bool m_minIsSpecified;
bool m_maxIsSpecified;
};
}
#endif
#endif