2013-09-28 22:35:38 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../GuiComponent.h"
|
|
|
|
#include <boost/date_time.hpp>
|
2013-10-04 23:24:41 +00:00
|
|
|
#include "../resources/Font.h"
|
2013-09-28 22:35:38 +00:00
|
|
|
|
|
|
|
class DateTimeComponent : public GuiComponent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DateTimeComponent(Window* window);
|
|
|
|
|
|
|
|
void setValue(const std::string& val) override;
|
|
|
|
std::string getValue() const override;
|
|
|
|
|
|
|
|
bool input(InputConfig* config, Input input) override;
|
|
|
|
void update(int deltaTime) override;
|
|
|
|
void render(const Eigen::Affine3f& parentTrans) override;
|
|
|
|
|
|
|
|
enum DisplayMode
|
|
|
|
{
|
|
|
|
DISP_DATE,
|
|
|
|
DISP_DATE_TIME,
|
|
|
|
DISP_RELATIVE_TO_NOW
|
|
|
|
};
|
|
|
|
|
|
|
|
void setDisplayMode(DisplayMode mode);
|
|
|
|
|
2013-10-16 23:11:43 +00:00
|
|
|
void setColor(unsigned int color);
|
|
|
|
void setFont(std::shared_ptr<Font> font);
|
|
|
|
|
2013-09-28 22:35:38 +00:00
|
|
|
private:
|
|
|
|
std::shared_ptr<Font> getFont() const;
|
|
|
|
|
|
|
|
std::string getDisplayString(DisplayMode mode) const;
|
|
|
|
DisplayMode getCurrentDisplayMode() const;
|
|
|
|
|
|
|
|
void updateTextCache();
|
|
|
|
|
|
|
|
boost::posix_time::ptime mTime;
|
|
|
|
boost::posix_time::ptime mTimeBeforeEdit;
|
|
|
|
|
|
|
|
bool mEditing;
|
|
|
|
int mEditIndex;
|
|
|
|
DisplayMode mDisplayMode;
|
|
|
|
|
|
|
|
int mRelativeUpdateAccumulator;
|
|
|
|
|
|
|
|
std::unique_ptr<TextCache> mTextCache;
|
|
|
|
std::vector<Eigen::Vector4f> mCursorBoxes;
|
2013-10-16 23:11:43 +00:00
|
|
|
|
|
|
|
unsigned int mColor;
|
|
|
|
std::shared_ptr<Font> mFont;
|
2013-09-28 22:35:38 +00:00
|
|
|
};
|