// NavNumbers.cpp: implementation of the NavNumbers class. // ////////////////////////////////////////////////////////////////////// #include "ApplicationInterface.h" #include "NavNumbers.h" #include "Navigator.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// //RECT RECT_SCREEN = {0,0,240,294}; #define BUTTON_WIDTH 20 #define BUTTON_HEIGHT 17 #define PADDING_WIDTH 3 #define PADDING_HEIGHT 3 #define MAXHORIZONTAL 10 #define MAXVERTICAL 10 #define MAXNUMBERS (MAXVERTICAL*MAXHORIZONTAL) #define ROW0 15 #define ROW1 30 #define ROW2 45 #define LASTROW 240 NavNumbers::NavNumbers(Navigator* navigator) { this->navigator=navigator; } NavNumbers::~NavNumbers() { } void NavNumbers::show(int maxNumber, UString command) { this->maxNumber=maxNumber; this->command=command; start=1; } void NavNumbers::paint() { RECT rt; memset(&rt,0,sizeof(rt)); rt.right=RECT_SCREEN.right; //to see if the whole screen gets filled //rt.bottom=RECT_SCREEN.bottom; //setBackground(0x00000000); //drawText(&rt,UString(L"test")); //resetBackground(); // rt.bottom=ROW0; clearRect(&rt); rt.top=ROW0; rt.bottom=ROW1; drawText(&rt,command); rt.top=ROW1; rt.bottom=ROW2; clearRect(&rt); TCHAR buttonText[4]; setBackground(BUTTON_BACKGROUND); setFont(FONT_NAVIGATION); int current=start; while ((current<=maxNumber)&&(current0) { int vertical=(y/(PADDING_HEIGHT+BUTTON_HEIGHT)); if (vertical=PADDING_WIDTH)&&(y<=BUTTON_HEIGHT)) { int current=vertical*MAXHORIZONTAL+horizontal+start; if (current<=maxNumber) return current; } } } else if (vertical==MAXVERTICAL) { // The 'more' button is here y=y-vertical*(PADDING_HEIGHT+BUTTON_HEIGHT); if (y<=BUTTON_HEIGHT) { if (((2*x)>=(RECT_SCREEN.right-x))&&((2*(RECT_SCREEN.right-x))>=x)) { if ((start+MAXNUMBERS)>maxNumber) start=1; else start=start+MAXNUMBERS; refreshScreen(); } } } } return -1; }