# WoopsiUI::Calendar Class Reference

`#include <calendar.h>`

Inheritance diagram for WoopsiUI::Calendar:

List of all members.

## Public Member Functions
| Calendar (s16 x, s16 y, u16 width, u16 height, u8 day, u8 month, u16 year, u32 flags, FontBase *font=NULL)
virtual void | handleReleaseEvent (const GadgetEventArgs &e)
virtual void | draw (Rect clipRect)
virtual void | setDate (u8 day, u8 month, u16 year)
const u8 | getDay () const
const u8 | getMonth () const
const u16 | getYear () const
bool | resize (u16 width, u16 height)
virtual void | getPreferredDimensions (Rect &rect) const
## Protected Member Functions
virtual | ~Calendar ()
virtual void | buildGUI ()
virtual void | populateGUI ()
| Calendar (const Calendar &calendar)
void | calculateColumnWidths (s32 spaceWidth, u8 *columnWidths)
void | calculateColumnHeights (s32 spaceHeight, u8 *columnHeights)
## Protected Attributes
Date * | _date
Date * | _visibleDate
Button * | _selectedDayButton
Button * | _leftArrow
Button * | _rightArrow
Label * | _monthLabel

## Detailed Description

Class providing a calendar/date picker. Raises an EVENT_ACTION event when a new date is clicked.

## Constructor & Destructor Documentation

WoopsiUI::Calendar::Calendar | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | u8 | day,
|  | u8 | month,
|  | u16 | year,
|  | u32 | flags,
|  | FontBase * | font = `NULL` |
| ) |  |  |

Constructor.

Parameters:

  | x | The x co-ordinate of the calendar.
  | y | The y co-ordinate of the calendar.
  | width | The width of the calendar.
  | height | The height of the calendar.
  | day | The default day to display.
  | month | The default month to display.
  | year | The default year to display.
  | flags | Standard flags.
  | font | Optional font to use for text output.

virtual WoopsiUI::Calendar::~Calendar | ( |  | ) | `[protected, virtual]`

Destructor.

WoopsiUI::Calendar::Calendar | ( | const Calendar & | calendar | ) | `[inline, protected]`

Copy constructor is protected to prevent usage.

## Member Function Documentation

virtual void WoopsiUI::Calendar::buildGUI | ( |  | ) | `[protected, virtual]`

Creates all gadgets but leaves them textless.

void WoopsiUI::Calendar::calculateColumnHeights | ( | s32 | spaceHeight,
|  | u8 * | columnHeights |
| ) |  |  | `[protected]`

Calculate the heights of the columns in the calendar.

Parameters:

  | spaceHeight | Width of the space to fill.
  | columnHeights | Array large enough to contain the heights of the columns.

void WoopsiUI::Calendar::calculateColumnWidths | ( | s32 | spaceWidth,
|  | u8 * | columnWidths |
| ) |  |  | `[protected]`

Calculate the widths of the columns in the calendar.

Parameters:

  | spaceWidth | Width of the space to fill.
  | columnWidths | Array large enough to contain the widths of the columns.

virtual void WoopsiUI::Calendar::draw | ( | Rect | clipRect | ) | `[virtual]`

Draw the region of the calendar within the clipping rect. Should not be called directly.

Parameters:

  | clipRect | The clipping rect to limit drawing to.

Reimplemented from WoopsiUI::Gadget.

const u8 WoopsiUI::Calendar::getDay | ( |  | ) | const

Get the day displayed in the calendar.

Returns:
  The day.

const u8 WoopsiUI::Calendar::getMonth | ( |  | ) | const

Get the month displayed in the calendar.

Returns:
  The month.

virtual void WoopsiUI::Calendar::getPreferredDimensions | ( | Rect & | rect | ) | const`[virtual]`

Insert the dimensions that this gadget wants to have into the rect passed in as a parameter. All co-ordinates are relative to the gadget's parent.

Parameters:

  | rect | Reference to a rect to populate with data.

Reimplemented from WoopsiUI::Gadget.

const u16 WoopsiUI::Calendar::getYear | ( |  | ) | const

Get the year displayed in the calendar.

Returns:
  The year.

virtual void WoopsiUI::Calendar::handleReleaseEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handles events raised by its sub-gadgets.

Parameters:

  | e | Event data to process.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::Calendar::populateGUI | ( |  | ) | `[protected, virtual]`

Populates the previously-created gadget layout with correct text based on current date objects.

bool WoopsiUI::Calendar::resize | ( | u16 | width,
|  | u16 | height |
| ) |  |  | `[virtual]`

Resize the calendar to the new dimensions.

Parameters:

  | width | The new width.
  | height | The new height.

Returns:
  True if the resize was successful.

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::Calendar::setDate | ( | u8 | day,
|  | u8 | month,
|  | u16 | year |
| ) |  |  | `[virtual]`

Set the date displayed in the calendar.

Parameters:

  | day | The new day.
  | month | The new month.
  | year | The new year.

## Member Data Documentation

Date* WoopsiUI::Calendar::_date`[protected]`

Calendar working date

Button* WoopsiUI::Calendar::_leftArrow`[protected]`

Pointer to the left arrow

Label* WoopsiUI::Calendar::_monthLabel`[protected]`

Pointer to the month label

Button* WoopsiUI::Calendar::_rightArrow`[protected]`

Pointer to the right arrow

Button* WoopsiUI::Calendar::_selectedDayButton`[protected]`

Pointer to the selected day button

Date* WoopsiUI::Calendar::_visibleDate`[protected]`

Date displayed in the UI

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

- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.40/Woopsi/libwoopsi/include/calendar.h