MFC Grid manual

CEmbeddedDateTimeCtrl Class Reference

Datetime control that is optimized to work with date or time values. More...

#include <Dapfor/GUI/EmbeddedDateTimeCtrl.h>

List of all members.


Public Types

enum  Format {
  year = 0x1, short_year = 0x2, month = 0x4, day = 0x8,
  hour = 0x10, minute = 0x20, second = 0x40, millisec = 0x80,
  date = day | month | year, short_date = day | month | short_year, time = hour | minute | second
}
 Allowed formats. More...

Public Member Functions

 CEmbeddedDateTimeCtrl (UINT format=short_date|time)
 Constructor.
virtual ~CEmbeddedDateTimeCtrl ()
 Virtual destructor.
void AddSlot (const Slot &slot)
 Adds a new logical slot.
Slots & GetSlots () const
 Gets a list of logical slots.
void RemoveSlots ()
 Removes all slots.
void SetFormat (UINT format)
 Sets a new format.
bool ValueUp ()
 Increments value in the selected slot.
bool ValueDown ()
 Decrements value in the selected slot.
void SelectLeft ()
 Selects the next slot in order.
void SelectRight ()
 Selects the previous slot in order.
void SetCurrentSelection (int newSelection)
 Selects a slot with the specified index.
int GetCurrentSelection () const
 Gets an index of the selected slot.
void ApplyCalendar ()
 Closes a child calendar window and sets the value received from the calendar to the date-time control.
void CloseCalendar ()
 Closes a child calendar window.
bool HasCalendar () const
 Indicates whether this control has a child calendar window.
CRect GetSpinRect () const
 Gets bounds of the spin control (for time style).
CRect GetDropDownRect () const
 Gets bounds of the dropdown control (for date style).
bool SetDateTime (long dt)
 Sets new time represented by 32-bit value that is the number of seconds elapsed since midnight, January 1, 1970.
bool SetDateTime (__int64 dt)
 Sets new time represented by 64-bit value that is the number of 100-nanosecond intervals since January 1, 1601.
long GetDateTime () const
 Gets a time, represented by 32-bit value.
bool GetDateTime (__int64 &dt) const
 Gets a time, represented by 64-bit value.

Classes

struct  Slot
 Logical slot inside of the datetime control. More...

Detailed Description

Datetime control that is optimized to work with date or time values.

Version:
2.0.0 Initial version

Member Enumeration Documentation

enum Format

Allowed formats.

Enumerator:
year  yyyy
short_year  yy
month  mm 1..12
day  dd 1..31
hour  hh 0..23
minute  mm 0..59
second  ss 0..59
millisec  nnn 0..999
date  dd/mm/yyyy
short_date  dd/mm/yy
time  hh:mm:ss


Constructor & Destructor Documentation

CEmbeddedDateTimeCtrl ( UINT  format = short_date|time  ) 

Constructor.

Parameters:
[in] format Format of the control


Member Function Documentation

void AddSlot ( const Slot slot  ) 

Adds a new logical slot.

Parameters:
[in] slot A new logical slot to be added

CEmbeddedDateTimeCtrl::Slots & GetSlots (  )  const

Gets a list of logical slots.

Returns:
List of logical slots

void SetFormat ( UINT  format  ) 

Sets a new format.

Parameters:
[in] format A new format

void SetCurrentSelection ( int  newSelection  ) 

Selects a slot with the specified index.

Parameters:
[in] newSelection Zero-based index of logical slot

int GetCurrentSelection (  )  const

Gets an index of the selected slot.

Returns:
Zero-based index of the selected slot. If there is no selection, the function returns -1.

bool HasCalendar (  )  const

Indicates whether this control has a child calendar window.

Returns:
True, if the control has a child calendar. Otherwise false.

CRect GetSpinRect (  )  const

Gets bounds of the spin control (for time style).

Returns:
Bounds required to show the spin control

CRect GetDropDownRect (  )  const

Gets bounds of the dropdown control (for date style).

Returns:
Bounds required to show a drop down button

bool SetDateTime ( long  dt  ) 

Sets new time represented by 32-bit value that is the number of seconds elapsed since midnight, January 1, 1970.

Parameters:
[in] dt A new date or time, represented by 32-bit value
Returns:
True if the value has been successfully set.

bool SetDateTime ( __int64  dt  ) 

Sets new time represented by 64-bit value that is the number of 100-nanosecond intervals since January 1, 1601.

Parameters:
[in] dt A new date or time, represented by 64-bit value
Returns:
True if the value has been successfully set.

long GetDateTime (  )  const

Gets a time, represented by 32-bit value.

Returns:
32-bit datetime value.

bool GetDateTime ( __int64 &  dt  )  const

Gets a time, represented by 64-bit value.

Parameters:
[in,out] dt 64-bit datetime value.
Returns:
True if success. Otherwise false.