mirror of
https://github.com/pocoproject/poco.git
synced 2025-11-25 06:36:37 +01:00
various fixes
This commit is contained in:
@@ -66,6 +66,13 @@ SubmitButton::SubmitButton(const std::type_info& type):
|
||||
}
|
||||
|
||||
|
||||
SubmitButton::SubmitButton(const std::string& name, const std::string& lbl):
|
||||
Button(name, typeid(SubmitButton), new SubmitButtonCell(this))
|
||||
{
|
||||
setText(lbl);
|
||||
}
|
||||
|
||||
|
||||
SubmitButton::SubmitButton(const std::string& name):
|
||||
Button(name, typeid(SubmitButton), new SubmitButtonCell(this))
|
||||
{
|
||||
|
||||
@@ -148,4 +148,10 @@ void TextField::fireTextChanged(void* pSender)
|
||||
}
|
||||
|
||||
|
||||
const std::string& TextField::getContent() const
|
||||
{
|
||||
return RefAnyCast<std::string>(this->getCell()->getValue());
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
||||
@@ -43,26 +43,34 @@ namespace WebWidgets {
|
||||
|
||||
|
||||
TimeField::TimeField(const std::string& name, const std::type_info& type):
|
||||
TextField(name, type, new TimeFieldCell(this))
|
||||
TextField(name, type, new TimeFieldCell(this)),
|
||||
_pMyCell(0)
|
||||
{
|
||||
_pMyCell = cell<TimeFieldCell>();
|
||||
}
|
||||
|
||||
|
||||
TimeField::TimeField(const std::type_info& type):
|
||||
TextField(type, new TimeFieldCell(this))
|
||||
TextField(type, new TimeFieldCell(this)),
|
||||
_pMyCell(0)
|
||||
{
|
||||
_pMyCell = cell<TimeFieldCell>();
|
||||
}
|
||||
|
||||
|
||||
TimeField::TimeField(const std::string& name):
|
||||
TextField(name, typeid(TimeField), new TimeFieldCell(this))
|
||||
TextField(name, typeid(TimeField), new TimeFieldCell(this)),
|
||||
_pMyCell(0)
|
||||
{
|
||||
_pMyCell = cell<TimeFieldCell>();
|
||||
}
|
||||
|
||||
|
||||
TimeField::TimeField():
|
||||
TextField(typeid(TimeField), new TimeFieldCell(this))
|
||||
TextField(typeid(TimeField), new TimeFieldCell(this)),
|
||||
_pMyCell(0)
|
||||
{
|
||||
_pMyCell = cell<TimeFieldCell>();
|
||||
}
|
||||
|
||||
|
||||
@@ -73,13 +81,25 @@ TimeField::~TimeField()
|
||||
|
||||
TimeField::Format TimeField::getFormat() const
|
||||
{
|
||||
return cell<TimeFieldCell>()->getFormat();
|
||||
return _pMyCell->getFormat();
|
||||
}
|
||||
|
||||
|
||||
void TimeField::setFormat(TimeField::Format fmt)
|
||||
{
|
||||
cell<TimeFieldCell>()->setFormat(fmt);
|
||||
_pMyCell->setFormat(fmt);
|
||||
}
|
||||
|
||||
|
||||
void TimeField::setTime(const Poco::DateTime& dt)
|
||||
{
|
||||
_pMyCell->setTime(dt);
|
||||
}
|
||||
|
||||
|
||||
const Poco::DateTime& TimeField::getTime() const
|
||||
{
|
||||
return _pMyCell->getTime();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
|
||||
#include "Poco/WebWidgets/TimeFieldCell.h"
|
||||
#include "Poco/WebWidgets/DateFormatter.h"
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -43,8 +44,10 @@ namespace WebWidgets {
|
||||
|
||||
TimeFieldCell::TimeFieldCell(View* pOwner):
|
||||
TextFieldCell(pOwner, typeid(TimeFieldCell)),
|
||||
_format("%h:%M %A"),
|
||||
_fmt(TimeField::FMT_AMPM)
|
||||
{
|
||||
setFormatter(new DateFormatter(_format));
|
||||
}
|
||||
|
||||
|
||||
@@ -53,4 +56,23 @@ TimeFieldCell::~TimeFieldCell()
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TimeFieldCell::setFormat(TimeField::Format fmt)
|
||||
{
|
||||
if (_fmt != fmt)
|
||||
{
|
||||
_fmt = fmt;
|
||||
if (_fmt == TimeField::FMT_AMPM)
|
||||
_format = "%h:%M %A";
|
||||
else if (_fmt == TimeField::FMT_24H)
|
||||
_format = "%H:%M";
|
||||
else if (_fmt == TimeField::FMT_AMPM_WITHSECONDS)
|
||||
_format = "%h:%M:%S %A";
|
||||
else if (_fmt == TimeField::FMT_24H_WITHSECONDS)
|
||||
_format = "%H:%M:%S";
|
||||
setFormatter(new DateFormatter(_format));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} } // namespace Poco::WebWidgets
|
||||
|
||||
Reference in New Issue
Block a user