Woopsi 1.0 GUI Framework for Nintendo DS Homebrew

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes

# 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, GadgetStyle *style=NULL)
virtual void | handleReleaseEvent (const GadgetEventArgs &e)
virtual void | setDate (u8 day, u8 month, u16 year)
const u8 | getDay () const
const u8 | getMonth () const
const u16 | getYear () const
virtual void | getPreferredDimensions (Rect &rect) const
## Protected Member Functions
virtual void | drawContents (GraphicsPort *port)
virtual void | drawBorder (GraphicsPort *port)
void | onResize (u16 width, u16 height)
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
StickyButton * | _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,
|  | GadgetStyle * | style = `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.
  style | The style that the gadget should use. If this is not specified, the gadget will use the values stored in the global defaultGadgetStyle object. The gadget will copy the properties of the style into its own internal style object.

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::drawBorder | ( | GraphicsPort * | port | ) | `[protected, virtual]`

Draw the area of this gadget that falls within the clipping region. Called by the redraw() function to draw all visible regions.

Parameters:

  port | The GraphicsPort to draw to.

See also:
  redraw()

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::Calendar::drawContents | ( | GraphicsPort * | port | ) | `[protected, virtual]`

Draw the area of this gadget that falls within the clipping region. Called by the redraw() function to draw all visible regions.

Parameters:

  port | The GraphicsPort to draw to.

See also:
  redraw()

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.

void WoopsiUI::Calendar::onResize | ( | u16 | width,
|  | u16 | height
| ) |  | `[protected, virtual]`

Resize the calendar to the new dimensions.

Parameters:

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

Reimplemented from WoopsiUI::Gadget.

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

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

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

StickyButton* 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:

- calendar.h