Rogue Wave Views 5.5.1 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Gadget class. More...
#include <ilviews/gadgets/datfield.h>
Public Types | |
enum | IlvDateFieldFormat { df_day, df_Day, df_month, df_Month, df_month_text, df_abbrev_month, df_year, df_Year } |
This enumeration defines the various formats that date elements can have. These formats will be used to convert a date to a string. More... | |
Public Member Functions | |
IlvDateField (IlvDisplay *display, const IlvPoint &point, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
IlvDateField (IlvDisplay *display, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
virtual const char * | check (IlUShort ch) |
Is called by the interactor for each key down event that corresponds to a regular character. | |
void | getFormat (IlvDateFieldFormat &first, IlvDateFieldFormat &middle, IlvDateFieldFormat &last, char &separator) const |
Returns the format of the date field. | |
IlBoolean | getValue (IlUShort &day, IlUShort &month, IlUShort &year) const |
Returns the date stored in the date field. | |
IlBoolean | getValue (struct tm *date) const |
Returns the date stored in the date field into a struct tm object. | |
IlBoolean | setFormat (IlvDateFieldFormat first, IlvDateFieldFormat middle, IlvDateFieldFormat last, char separator, IlBoolean redraw=IlFalse) |
Sets the format of the date field. | |
void | setValue (IlUShort day, IlUShort month, IlUShort year, IlBoolean redraw=IlFalse) |
Sets the date of the date field. | |
void | setValue (struct tm *date, IlBoolean redraw=IlFalse) |
Sets the date of the date field. | |
virtual void | validate () |
Is called by the interactor when the user presses the Return or the Enter key. | |
Static Public Member Functions | |
static int | GetBaseCentury () |
Returns the base century used by the class IlvDateField . | |
static int | GetCenturyThreshold () |
Returns the century threshold set for the class IlvDateField . | |
static void | SetBaseCentury (int century) |
Sets the base century used by the class IlvDateField . | |
static void | SetCenturyThreshold (int threshold) |
Sets the century threshold used by the IlvDateField class. |
Gadget class.
Library: ilvadvgdt
IlvDateField
defines a specialized text field gadget for editing a date.
- A Date Field -
IlvNumberField
, IlvPasswordField
. This enumeration defines the various formats that date elements can have. These formats will be used to convert a date to a string.
IlvDateField::setFormat
IlvDateField::IlvDateField | ( | IlvDisplay * | display, | |
const IlvRect & | rect, | |||
IlUShort | thickness = IlvDefaultGadgetThickness , |
|||
IlvPalette * | palette = 0 | |||
) |
Constructor.
Initializes a new instance of the class IlvDatefield
.
display | The connection to the display. | |
rect | The size and position of the date field. | |
thickness | The thickness of the date field. | |
palette | The palette used by the date field. |
IlvDateField::IlvDateField | ( | IlvDisplay * | display, | |
const IlvPoint & | point, | |||
IlUShort | thickness = IlvDefaultGadgetThickness , |
|||
IlvPalette * | palette = 0 | |||
) |
Constructor.
Initializes a new instance of the class IlvDatefield
. The height of the text field is computed using palette. Its width is 0
, which means that you have to resize it.
display | The connection to the display. | |
point | The position of the date field. | |
thickness | The thickness of the date field. | |
palette | The palette used by the date field. |
virtual const char* IlvDateField::check | ( | IlUShort | character | ) | [virtual] |
Is called by the interactor for each key down event that corresponds to a regular character.
The default implementation inserts character in the text field (erasing the selection if there is one).
character | The ASCII code of the character. |
Reimplemented from IlvTextField.
static int IlvDateField::GetBaseCentury | ( | ) | [static] |
Returns the base century used by the class IlvDateField
.
This value is relevant only if the year format is df_year
, that is, when the date is represented by two characters only. For details, see IlvDateField::SetBaseCentury
.
IlvDateField
. SetBaseCentury
, GetCenturyThreshold
. static int IlvDateField::GetCenturyThreshold | ( | ) | [static] |
Returns the century threshold set for the class IlvDateField
.
The default value is 30
. For details, see IlvDateField::SetBaseCentury
.
IlvDateField
. SetBaseCentury
, SetCenturyThreshold
. void IlvDateField::getFormat | ( | IlvDateFieldFormat & | first, | |
IlvDateFieldFormat & | middle, | |||
IlvDateFieldFormat & | last, | |||
char & | separator | |||
) | const |
Returns the format of the date field.
A date is composed of three elements divided by separation characters.
first | The first element of the date. | |
middle | The middle element of the date. | |
last | The last element of the date. | |
separator | The character used to separate each element of the date. |
setFormat
, IlvDateFieldFormat
. Returns the date stored in the date field.
day | The returned day. | |
month | The returned month. | |
year | The returned year. |
IlTrue
if the field represents a valid date. Otherwise, it returns IlFalse
. IlBoolean IlvDateField::getValue | ( | struct tm * | date | ) | const |
Returns the date stored in the date field into a struct tm
object.
The type struct tm
is defined in the system include file time.h
.
date | The returned date. |
IlTrue
if the field represents a valid date. Otherwise, it returns IlFalse
. static void IlvDateField::SetBaseCentury | ( | int | century | ) | [static] |
Sets the base century used by the class IlvDateField
.
If you use a two-digit value for the year element of the date ( df_year
), the full year will be recomputed from this base century and a century threshold (see IlvDateField::GetCenturyThreshold
). The base century indicates the century to be used when a two-digit year is entered, and whether this value is less than a specified threshold. For compatibility reasons, the default value for the base century is 1900
. The century threshold indicates the value under which the century number will be incremented. For compatibility reasons, the default value of the century threshold is 0
. If you set the base century to 1900
and the century threshold to 30
, a value of 10
for the year is converted to 2010
, a value of 30
is converted to 1930
, and a value of 50
is converted to 1950
.
century | The new base century. The default value is 1900 . |
static void IlvDateField::SetCenturyThreshold | ( | int | threshold | ) | [static] |
Sets the century threshold used by the IlvDateField
class.
For details, see IlvDateField::SetBaseCentury
.
threshold | The new century threshold. |
IlBoolean IlvDateField::setFormat | ( | IlvDateFieldFormat | first, | |
IlvDateFieldFormat | middle, | |||
IlvDateFieldFormat | last, | |||
char | separator, | |||
IlBoolean | redraw = IlFalse | |||
) |
Sets the format of the date field.
A date is composed of three elements divided by separation characters. This member function specifies which element represents the day, the month, or the year and which separator to use. The default value is: 12/31/1995
(df_Month
, df_Day
, df_Year
, see below). The formats are defined by the enumeration type IlvDateFieldFormat
. If you change the format when the field contains a value, this value is applied the new format. Note the following:
Only a single day, year, or month format can be passed to this member function. Otherwise, the function returns IlFalse
and the format remains unchanged.
first | The first element of the date. | |
middle | The middle element of the date. | |
last | The last element of the date. | |
separator | The character used to separate each element of the date. | |
redraw | A Boolean value specifying whether the date field should be redrawn. |
getFormat
, IlvDateFieldFormat
. void IlvDateField::setValue | ( | IlUShort | day, | |
IlUShort | month, | |||
IlUShort | year, | |||
IlBoolean | redraw = IlFalse | |||
) |
Sets the date of the date field.
The date is converted to a string using the date field format.
day | The new day. | |
month | The new month. | |
year | The new year. | |
redraw | A Boolean value specifying whether the date field should be redrawn. |
void IlvDateField::setValue | ( | struct tm * | date, | |
IlBoolean | redraw = IlFalse | |||
) |
virtual void IlvDateField::validate | ( | ) | [virtual] |
Is called by the interactor when the user presses the Return or the Enter key.
The default implementation invokes the main callback of the text field. If the method IlvTextField::getChangeFocusOnValidation
returns IlTrue
, the keyboard focus moves to the next gadget in the focus chain.
Reimplemented from IlvTextField.
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.