Woopsi 1.3
Nintendo DS Gui Framework
libwoopsi/include/calendar.h
00001 #ifndef _CALENDAR_H_
00002 #define _CALENDAR_H_
00003 
00004 #include <nds.h>
00005 #include "gadget.h"
00006 #include "gadgetstyle.h"
00007 #include "gadgeteventhandler.h"
00008 #include "stickybutton.h"
00009 
00010 #define CALENDAR_ROWS 8
00011 #define CALENDAR_COLS 7
00012 #define CALENDAR_BODY_ROWS 6
00013 
00014 namespace WoopsiUI {
00015 
00016     class Button;
00017     class Label;
00018     class Date;
00019 
00024     class Calendar : public Gadget, public GadgetEventHandler {
00025     public:
00026 
00041         Calendar(s16 x, s16 y, u16 width, u16 height, u8 day, u8 month, u16 year, GadgetStyle* style = NULL);
00042 
00047         virtual void handleReleaseEvent(const GadgetEventArgs& e);
00048 
00055         virtual void setDate(u8 day, u8 month, u16 year);
00056 
00061         const u8 getDay() const;
00062 
00067         const u8 getMonth() const;
00068 
00073         const u16 getYear() const;
00074 
00081         virtual void getPreferredDimensions(Rect& rect) const;
00082 
00083     protected:
00084         Date* _date;                            
00085         Date* _visibleDate;                     
00086         StickyButton* _selectedDayButton;       
00087         Button* _leftArrow;                     
00088         Button* _rightArrow;                    
00089         Label* _monthLabel;                     
00097         virtual void drawContents(GraphicsPort* port);
00098 
00105         virtual void drawBorder(GraphicsPort* port);
00106 
00112         void onResize(u16 width, u16 height);
00113 
00117         virtual ~Calendar();
00118 
00122         virtual void buildGUI();
00123 
00128         virtual void populateGUI();
00129 
00133         inline Calendar(const Calendar& calendar) : Gadget(calendar) { };
00134 
00141         void calculateColumnWidths(s32 spaceWidth, u8* columnWidths);
00142 
00149         void calculateColumnHeights(s32 spaceHeight, u8* columnHeights);
00150     };
00151 }
00152 
00153 #endif
 All Classes Functions Variables Enumerations Enumerator