soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SDateTimePicker Class Reference

DateTime Picker Control. More...

#include <SDateTimePicker.h>

Inheritance diagram for SDateTimePicker:
ISDropDownOwner

Public Types

enum  EnDateType {
  eDT_NULL = 0 , eDT_Year , eDT_Month , eDT_Day ,
  eDT_Hour , eDT_Minute , eDT_Second
}
 Enumeration for date types. More...
 

Public Member Functions

 SDateTimePicker ()
 Constructor.
 
 ~SDateTimePicker ()
 Destructor.
 
void SetTime (WORD wYear, WORD wMonth, WORD wDay, WORD wHour, WORD wMinute, WORD wSecond) OVERRIDE
 Set the time.
 
void GetTime (WORD *wYear, WORD *wMonth, WORD *wDay, WORD *wHour, WORD *wMinute, WORD *wSecond) SCONST OVERRIDE
 Get the time.
 
void CloseUp () OVERRIDE
 Close the dropdown.
 
void DropDown () OVERRIDE
 Drop down the list.
 
void Clear () OVERRIDE
 Clear the selected date and time.
 
SStringT GetWindowText (BOOL bRawText=FALSE)
 Get the window text.
 
void SetTime (const SYSTEMTIME &sysTime)
 Set the time using SYSTEMTIME structure.
 
void GetTime (SYSTEMTIME &sysTime)
 Get the time using SYSTEMTIME structure.
 

Protected Member Functions

virtual SWindowGetDropDownOwner ()
 Get the owner window for the dropdown.
 
virtual void OnCreateDropDown (SDropDownWnd *pDropDown)
 Handle creation of the dropdown window.
 
virtual void OnDestroyDropDown (SDropDownWnd *pDropDown)
 Handle destruction of the dropdown window.
 
EnDateType HitTest (CPoint pt)
 Hit test to determine the date type at a given point.
 
virtual BOOL CreateChildren (SXmlNode xmlNode)
 Create child controls.
 
BOOL OnDateChanged (EventCalendarExChanged *pEvt)
 Handle date change event.
 
BOOL OnDateCmd (EventCmd *pEvt)
 Handle date command event.
 
void GetDropBtnRect (LPRECT pBtnRc, LPRECT pSkinRc=NULL)
 Get the rectangle of the dropdown button.
 
SStringT ToFormatText (EnDateType eType, WORD wNum)
 Convert a number to formatted text based on the date type.
 
bool CalcPopupRect (int nHeight, CRect &rcPopup)
 Calculate the popup rectangle.
 
void Draw (EnDateType eType, IRenderTarget *pRT, WORD wNum, CRect &rcText)
 Draw the date/time component.
 
void OnPaint (IRenderTarget *pRT)
 Paint the control.
 
void OnLButtonDown (UINT nFlags, CPoint pt)
 Handle left mouse button down event.
 
void OnMouseMove (UINT nFlags, CPoint pt)
 Handle mouse move event.
 
void OnMouseLeave ()
 Handle mouse leave event.
 
BOOL OnMouseWheel (UINT nFlags, short zDelta, CPoint pt)
 Handle mouse wheel event.
 
void OnKeyDown (TCHAR nChar, UINT nRepCnt, UINT nFlags)
 Handle key down event.
 
void OnChar (UINT nChar, UINT nRepCnt, UINT nFlags)
 Handle character input event.
 
void OnDestroy ()
 Handle destroy event.
 
void OnSetFocus (SWND wndOld)
 Handle set focus event.
 
void OnKillFocus (SWND wndFocus)
 Handle kill focus event.
 
void TimeWheel (bool bUp)
 Handle time wheel event.
 
void CircluNum (bool bUp, WORD &wNum, WORD wMin, WORD wMax)
 Handle circular number increment/decrement.
 
HRESULT OnAttrCueText (const SStringW &strValue, BOOL bLoading)
 Handle custom attribute "cueText".
 
virtual HRESULT SetAttribute (const SNS::SStringW &amp;amp;amp;amp;strAttribName, const SNS::SStringW &amp;amp;amp;amp;strValue, BOOL bLoading=FALSE)
 

Protected Attributes

DWORD m_dwBtnState
 
SAutoRefPtr< ISkinObjm_pSkinBtn
 
SDropDownWndm_pDropDownWnd
 
EnDateType m_eSelDateType
 
int m_nNumWidth
 
int m_nNumHeight
 
int m_nCharWidth
 
COLORREF m_crSelBg
 
COLORREF m_crSelText
 
SYSTEMTIME m_sysTime
 
SStringT m_sKey
 
int m_nDropWidth
 
bool m_bTimeEnable
 
SCalendarm_pCalendar
 
WORD m_wCharNum
 
STrText m_strCue
 
COLORREF m_crCue
 

Detailed Description

DateTime Picker Control.

A DateTime picker control that allows users to select a date and optionally time.

Definition at line 17 of file SDateTimePicker.h.

Member Enumeration Documentation

◆ EnDateType

Enumeration for date types.

Definition at line 27 of file SDateTimePicker.h.

Constructor & Destructor Documentation

◆ SDateTimePicker()

SNSBEGIN SDateTimePicker::SDateTimePicker ( )

Constructor.

Definition at line 6 of file SDateTimePicker.cpp.

◆ ~SDateTimePicker()

SDateTimePicker::~SDateTimePicker ( )

Destructor.

Definition at line 34 of file SDateTimePicker.cpp.

Member Function Documentation

◆ CalcPopupRect()

bool SDateTimePicker::CalcPopupRect ( int nHeight,
CRect & rcPopup )
protected

Calculate the popup rectangle.

Parameters
nHeightHeight of the popup
rcPopupOutput rectangle for the popup
Returns
TRUE if successful, FALSE otherwise

Definition at line 288 of file SDateTimePicker.cpp.

◆ CircluNum()

void SDateTimePicker::CircluNum ( bool bUp,
WORD & wNum,
WORD wMin,
WORD wMax )
protected

Handle circular number increment/decrement.

Parameters
bUpWhether to increment
wNumCurrent number
wMinMinimum number
wMaxMaximum number

Definition at line 526 of file SDateTimePicker.cpp.

◆ Clear()

void SDateTimePicker::Clear ( )

Clear the selected date and time.

Definition at line 676 of file SDateTimePicker.cpp.

◆ CloseUp()

void SDateTimePicker::CloseUp ( )

Close the dropdown.

Definition at line 664 of file SDateTimePicker.cpp.

◆ CreateChildren()

BOOL SDateTimePicker::CreateChildren ( SXmlNode xmlNode)
protectedvirtual

Create child controls.

Parameters
xmlNodeXML node for the child controls
Returns
TRUE if successful, FALSE otherwise

Reimplemented from SWindow.

Definition at line 44 of file SDateTimePicker.cpp.

◆ Draw()

void SDateTimePicker::Draw ( EnDateType eType,
IRenderTarget * pRT,
WORD wNum,
CRect & rcText )
protected

Draw the date/time component.

Parameters
eTypeDate type
pRTRendering target handle
wNumNumber to draw
rcTextRectangle for the text

Definition at line 178 of file SDateTimePicker.cpp.

◆ DropDown()

void SDateTimePicker::DropDown ( )

Drop down the list.

Definition at line 690 of file SDateTimePicker.cpp.

◆ GetDropBtnRect()

void SDateTimePicker::GetDropBtnRect ( LPRECT pBtnRc,
LPRECT pSkinRc = NULL )
protected

Get the rectangle of the dropdown button.

Parameters
pBtnRcOutput rectangle for the button
pSkinRcOutput rectangle for the skin

Definition at line 121 of file SDateTimePicker.cpp.

◆ GetDropDownOwner()

SWindow * SDateTimePicker::GetDropDownOwner ( )
protectedvirtual

Get the owner window for the dropdown.

Returns
Owner window pointer

Implements ISDropDownOwner.

Definition at line 87 of file SDateTimePicker.cpp.

◆ GetTime() [1/2]

void SDateTimePicker::GetTime ( SYSTEMTIME & sysTime)

Get the time using SYSTEMTIME structure.

Parameters
sysTimeSYSTEMTIME structure

Definition at line 375 of file SDateTimePicker.cpp.

◆ GetTime() [2/2]

void SDateTimePicker::GetTime ( WORD * wYear,
WORD * wMonth,
WORD * wDay,
WORD * wHour,
WORD * wMinute,
WORD * wSecond )

Get the time.

Parameters
wYearOutput year
wMonthOutput month
wDayOutput day
wHourOutput hour
wMinuteOutput minute
wSecondOutput second

◆ GetWindowText()

SStringT SDateTimePicker::GetWindowText ( BOOL bRawText = FALSE)
virtual

Get the window text.

Parameters
bRawTextWhether to get raw text
Returns
Window text

Reimplemented from SWindow.

Definition at line 396 of file SDateTimePicker.cpp.

◆ HitTest()

SDateTimePicker::EnDateType SDateTimePicker::HitTest ( CPoint pt)
protected

Hit test to determine the date type at a given point.

Parameters
ptMouse coordinates
Returns
Date type at the point

Definition at line 322 of file SDateTimePicker.cpp.

◆ OnAttrCueText()

HRESULT SDateTimePicker::OnAttrCueText ( const SStringW & strValue,
BOOL bLoading )
protected

Handle custom attribute "cueText".

Parameters
strValueAttribute value
bLoadingLoading flag
Returns
HRESULT

Definition at line 682 of file SDateTimePicker.cpp.

◆ OnChar()

void SDateTimePicker::OnChar ( UINT nChar,
UINT nRepCnt,
UINT nFlags )
protected

Handle character input event.

Parameters
nCharCharacter code
nRepCntRepeat count
nFlagsFlags

Definition at line 570 of file SDateTimePicker.cpp.

◆ OnCreateDropDown()

void SDateTimePicker::OnCreateDropDown ( SDropDownWnd * pDropDown)
protectedvirtual

Handle creation of the dropdown window.

Parameters
pDropDownDropdown window pointer

Implements ISDropDownOwner.

Definition at line 92 of file SDateTimePicker.cpp.

◆ OnDateChanged()

BOOL SDateTimePicker::OnDateChanged ( EventCalendarExChanged * pEvt)
protected

Handle date change event.

Parameters
pEvtEvent object
Returns
TRUE if handled, FALSE otherwise

Definition at line 63 of file SDateTimePicker.cpp.

◆ OnDateCmd()

BOOL SDateTimePicker::OnDateCmd ( EventCmd * pEvt)
protected

Handle date command event.

Parameters
pEvtEvent object
Returns
TRUE if handled, FALSE otherwise

Definition at line 81 of file SDateTimePicker.cpp.

◆ OnDestroy()

void SDateTimePicker::OnDestroy ( )
protected

Handle destroy event.

Definition at line 641 of file SDateTimePicker.cpp.

◆ OnDestroyDropDown()

void SDateTimePicker::OnDestroyDropDown ( SDropDownWnd * pDropDown)
protectedvirtual

Handle destruction of the dropdown window.

Parameters
pDropDownDropdown window pointer

Implements ISDropDownOwner.

Definition at line 110 of file SDateTimePicker.cpp.

◆ OnKeyDown()

void SDateTimePicker::OnKeyDown ( TCHAR nChar,
UINT nRepCnt,
UINT nFlags )
protected

Handle key down event.

Parameters
nCharKey code
nRepCntRepeat count
nFlagsFlags

Definition at line 544 of file SDateTimePicker.cpp.

◆ OnKillFocus()

void SDateTimePicker::OnKillFocus ( SWND wndFocus)
protected

Handle kill focus event.

Parameters
wndFocusNew focus window handle

Definition at line 652 of file SDateTimePicker.cpp.

◆ OnLButtonDown()

void SDateTimePicker::OnLButtonDown ( UINT nFlags,
CPoint pt )
protected

Handle left mouse button down event.

Parameters
nFlagsFlags
ptMouse coordinates

Definition at line 407 of file SDateTimePicker.cpp.

◆ OnMouseLeave()

void SDateTimePicker::OnMouseLeave ( )
protected

Handle mouse leave event.

Definition at line 455 of file SDateTimePicker.cpp.

◆ OnMouseMove()

void SDateTimePicker::OnMouseMove ( UINT nFlags,
CPoint pt )
protected

Handle mouse move event.

Parameters
nFlagsFlags
ptMouse coordinates

Definition at line 433 of file SDateTimePicker.cpp.

◆ OnMouseWheel()

BOOL SDateTimePicker::OnMouseWheel ( UINT nFlags,
short zDelta,
CPoint pt )
protected

Handle mouse wheel event.

Parameters
nFlagsFlags
zDeltaWheel delta
ptMouse coordinates
Returns
TRUE if handled, FALSE otherwise

Definition at line 473 of file SDateTimePicker.cpp.

◆ OnPaint()

void SDateTimePicker::OnPaint ( IRenderTarget * pRT)
protected

Paint the control.

Parameters
pRTRendering target handle

Definition at line 196 of file SDateTimePicker.cpp.

◆ OnSetFocus()

void SDateTimePicker::OnSetFocus ( SWND wndOld)
protected

Handle set focus event.

Parameters
wndOldPrevious focus window handle

Definition at line 647 of file SDateTimePicker.cpp.

◆ SetAttribute()

virtual HRESULT SDateTimePicker::SetAttribute ( const SNS::SStringW &amp;amp;amp;amp; strAttribName,
const SNS::SStringW &amp;amp;amp;amp; strValue,
BOOL bLoading = FALSE )
inlineprotectedvirtual

Reimplemented from SWindow.

Definition at line 279 of file SDateTimePicker.h.

◆ SetTime() [1/2]

void SDateTimePicker::SetTime ( const SYSTEMTIME & sysTime)

Set the time using SYSTEMTIME structure.

Parameters
sysTimeSYSTEMTIME structure

Definition at line 358 of file SDateTimePicker.cpp.

◆ SetTime() [2/2]

void SDateTimePicker::SetTime ( WORD wYear,
WORD wMonth,
WORD wDay,
WORD wHour,
WORD wMinute,
WORD wSecond )

Set the time.

Parameters
wYearYear
wMonthMonth
wDayDay
wHourHour
wMinuteMinute
wSecondSecond

Definition at line 364 of file SDateTimePicker.cpp.

◆ TimeWheel()

void SDateTimePicker::TimeWheel ( bool bUp)
protected

Handle time wheel event.

Parameters
bUpWhether the wheel is scrolled up

Definition at line 479 of file SDateTimePicker.cpp.

◆ ToFormatText()

SStringT SDateTimePicker::ToFormatText ( EnDateType eType,
WORD wNum )
protected

Convert a number to formatted text based on the date type.

Parameters
eTypeDate type
wNumNumber to format
Returns
Formatted text

Definition at line 139 of file SDateTimePicker.cpp.

Member Data Documentation

◆ m_bTimeEnable

bool SDateTimePicker::m_bTimeEnable
protected

Whether time (hour, minute, second) is enabled

Definition at line 314 of file SDateTimePicker.h.

◆ m_crCue

COLORREF SDateTimePicker::m_crCue
protected

Cue text color

Definition at line 318 of file SDateTimePicker.h.

◆ m_crSelBg

COLORREF SDateTimePicker::m_crSelBg
protected

Selection background color

Definition at line 308 of file SDateTimePicker.h.

◆ m_crSelText

COLORREF SDateTimePicker::m_crSelText
protected

Selection text color

Definition at line 309 of file SDateTimePicker.h.

◆ m_dwBtnState

DWORD SDateTimePicker::m_dwBtnState
protected

Button state

Definition at line 301 of file SDateTimePicker.h.

◆ m_eSelDateType

EnDateType SDateTimePicker::m_eSelDateType
protected

Selected date type

Definition at line 304 of file SDateTimePicker.h.

◆ m_nCharWidth

int SDateTimePicker::m_nCharWidth
protected

Width of character display

Definition at line 307 of file SDateTimePicker.h.

◆ m_nDropWidth

int SDateTimePicker::m_nDropWidth
protected

Dropdown width

Definition at line 313 of file SDateTimePicker.h.

◆ m_nNumHeight

int SDateTimePicker::m_nNumHeight
protected

Height of number display

Definition at line 306 of file SDateTimePicker.h.

◆ m_nNumWidth

int SDateTimePicker::m_nNumWidth
protected

Width of number display

Definition at line 305 of file SDateTimePicker.h.

◆ m_pCalendar

SCalendar* SDateTimePicker::m_pCalendar
protected

Calendar pointer

Definition at line 315 of file SDateTimePicker.h.

◆ m_pDropDownWnd

SDropDownWnd* SDateTimePicker::m_pDropDownWnd
protected

Dropdown window pointer

Definition at line 303 of file SDateTimePicker.h.

◆ m_pSkinBtn

SAutoRefPtr<ISkinObj> SDateTimePicker::m_pSkinBtn
protected

Button skin object

Definition at line 302 of file SDateTimePicker.h.

◆ m_sKey

SStringT SDateTimePicker::m_sKey
protected

Key string

Definition at line 311 of file SDateTimePicker.h.

◆ m_strCue

STrText SDateTimePicker::m_strCue
protected

Cue text

Definition at line 317 of file SDateTimePicker.h.

◆ m_sysTime

SYSTEMTIME SDateTimePicker::m_sysTime
protected

System time

Definition at line 310 of file SDateTimePicker.h.

◆ m_wCharNum

WORD SDateTimePicker::m_wCharNum
protected

Character number

Definition at line 316 of file SDateTimePicker.h.


The documentation for this class was generated from the following files: