#pragma once
#include "skinnablewindow.h"
#include "textbox.h"
#include "skinnablebutton.h"
#include "skinnablelistbox.h"
#include "atlcomtime.h"


class TimeBox :
	public SkinnableWindow
{
public:
	TimeBox();
	~TimeBox();

	void Load(const char * base);
	virtual int Create(HWND parent = 0);

	// button handler
	void OnButton(HWND h);
	// list handler
	virtual void OnListSelect(HWND h, HWND hItem);
	// text box handler
	virtual void OnContentsChanged(WPARAM wParam, LPARAM lParam);

	void SetValue(COleDateTime& time);

	virtual HWND GetTabToTarget();
	virtual HWND GetTabFromTarget();
	virtual void SetTabTo(HWND h);
	virtual void SetTabFrom(HWND h);
	virtual void OnLoseFocus();

	TextBox hour; 
	TextBox minute;
	TextBox ampm;
	SkinnableButton hourButton;
	SkinnableButton minuteButton;
	SkinnableButton ampmButton;
	SkinnableListBox hours;
	SkinnableListBox minutes;
	SkinnableListBox ampms;

	Appearance ItemStyle;

	COleDateTime time;

private:
	HRGN VisibleRgn();
};