00001 #ifndef _CALENDAR_H_
00002 #define _CALENDAR_H_
00003
00004 #include <nds.h>
00005 #include "gadget.h"
00006 #include "gadgeteventhandler.h"
00007
00008 #define CALENDAR_ROWS 8
00009 #define CALENDAR_COLS 7
00010 #define CALENDAR_BODY_ROWS 6
00011
00012 namespace WoopsiUI {
00013
00014 class Button;
00015 class Label;
00016 class Date;
00017
00022 class Calendar : public Gadget, public GadgetEventHandler {
00023 public:
00024
00037 Calendar(s16 x, s16 y, u16 width, u16 height, u8 day, u8 month, u16 year, u32 flags, FontBase* font = NULL);
00038
00043 virtual void handleReleaseEvent(const GadgetEventArgs& e);
00044
00050 virtual void draw(Rect clipRect);
00051
00058 virtual void setDate(u8 day, u8 month, u16 year);
00059
00064 const u8 getDay() const;
00065
00070 const u8 getMonth() const;
00071
00076 const u16 getYear() const;
00077
00084 bool resize(u16 width, u16 height);
00085
00092 virtual void getPreferredDimensions(Rect& rect) const;
00093
00094 protected:
00095 Date* _date;
00096 Date* _visibleDate;
00097 Button* _selectedDayButton;
00098 Button* _leftArrow;
00099 Button* _rightArrow;
00100 Label* _monthLabel;
00105 virtual ~Calendar();
00106
00110 virtual void buildGUI();
00111
00116 virtual void populateGUI();
00117
00121 inline Calendar(const Calendar& calendar) : Gadget(calendar) { };
00122
00128 void calculateColumnWidths(s32 spaceWidth, u8* columnWidths);
00129
00135 void calculateColumnHeights(s32 spaceHeight, u8* columnHeights);
00136 };
00137 }
00138
00139 #endif