rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Gadgets Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvDateField Class Reference

Gadget class. More...

#include <ilviews/gadgets/datfield.h>

Inheritance diagram for IlvDateField:
IlvTextField IlvGadget IlvSimpleGraphic IlvGraphic

List of all members.

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.

Detailed Description

Gadget class.

Library: ilvadvgdt

IlvDateField defines a specialized text field gadget for editing a date.

IlvDateFielda.gif


- A Date Field -

See also:
IlvNumberField, IlvPasswordField.

Member Enumeration Documentation

This enumeration defines the various formats that date elements can have. These formats will be used to convert a date to a string.

See also:
IlvDateField::setFormat
Enumerator:
df_day 

Writes the day as a number with no leading zero.

df_Day 

Writes the day as a number with a leading zero, if necessary.

df_month 

Writes the month as a number with no leading zero.

df_Month 

Writes the month as a number with a leading zero, if necessary.

df_month_text 

Writes the month name. If the month names below appear in the language database, the corresponding name is taken from it. Otherwise, the character `&' is removed. Month names: &January, &February, &March, &April, &May, &June, &July, &August, &September, &October, &November, &December.

df_abbrev_month 

Writes the abbreviated month name. If the abbreviated month names below appear in the language database, the corresponding name is taken from it. Otherwise, the abbreviated month name is taken with the character `&' removed. Abbreviated month names: &january, &february, &march, &april, &may, &june, &july, &august, &september, &october, &november, &december.

df_year 

Writes the last two digits of the year.

df_Year 

Writes the full year.


Constructor & Destructor Documentation

IlvDateField::IlvDateField ( IlvDisplay display,
const IlvRect rect,
IlUShort  thickness = IlvDefaultGadgetThickness,
IlvPalette palette = 0 
)

Constructor.

Initializes a new instance of the class IlvDatefield.

Parameters:
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.

Parameters:
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.

Member Function Documentation

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).

Parameters:
character The ASCII code of the character.
Returns:
The new label of the text field.
See also:
setLabel

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.

Returns:
The base century used by the class IlvDateField.
See also:
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.

Returns:
The century threshold set for the class IlvDateField.
See also:
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.

Parameters:
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.
See also:
setFormat, IlvDateFieldFormat.
IlBoolean IlvDateField::getValue ( IlUShort day,
IlUShort month,
IlUShort year 
) const

Returns the date stored in the date field.

Parameters:
day The returned day.
month The returned month.
year The returned year.
Returns:
IlTrue if the field represents a valid date. Otherwise, it returns IlFalse.
See also:
setValue(IlUShort, IlUShort, IlUShort), getValue(struct tm*)
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.

Parameters:
date The returned date.
Returns:
IlTrue if the field represents a valid date. Otherwise, it returns IlFalse.
See also:
setValue(struct tm*), getValue(IlUShort&, IlUShort&, IlUShort&)
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.

Parameters:
century The new base century. The default value is 1900.
See also:
GetBaseCentury, SetCenturyThreshold
static void IlvDateField::SetCenturyThreshold ( int  threshold  )  [static]

Sets the century threshold used by the IlvDateField class.

For details, see IlvDateField::SetBaseCentury.

Parameters:
threshold The new century threshold.
See also:
SetBaseCentury, GetCenturyThreshold
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.

Parameters:
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.
See also:
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.

Parameters:
day The new day.
month The new month.
year The new year.
redraw A Boolean value specifying whether the date field should be redrawn.
See also:
getValue(IlUShort&, IlUShort&, IlUShort&), setValue(struct tm*)
void IlvDateField::setValue ( struct tm *  date,
IlBoolean  redraw = IlFalse 
)

Sets the date of the date field.

The date is converted to a string using the date field format.

Parameters:
date The new date.
redraw A Boolean value specifying whether the date field should be redrawn.
See also:
getValue(struct tm*), setValue(IlUShort, IlUShort, IlUShort, IlBoolean), setFormat
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.

See also:
getChangeFocusOnValidation, IlvGraphicHolder::setFocus

Reimplemented from IlvTextField.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© 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.