#include "ApplicationInterface.h" #include "NavNumbers.h" #include "SimpleNavigator.h" //RECT RECT_SCREEN = {0,0,240,294}; #define MAXHORIZONTAL 10 #define MAXNUMBERS (getMaxRows()*MAXHORIZONTAL) #define ROW0 5 #define LASTROW ROW0+getMaxRows()*(BUTTON_HEIGHT+PADDING_HEIGHT) NavNumbers::NavNumbers(SimpleNavigator* navigator):NavPage(navigator) { } NavNumbers::~NavNumbers() { } void NavNumbers::show() { start=1; } void NavNumbers::paint() { RECT rt; memset(&rt,0,sizeof(rt)); RECT_SCREEN.bottom = GetSystemMetrics(SM_CYSCREEN) - 2*MENU_HEIGHT; RECT_SCREEN.right = GetSystemMetrics(SM_CXSCREEN); 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")); //setBackground(); // below simply padded the top of the screen downwards and displayed the string // rt.bottom=ROW0; // clearRect(&rt); // 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; // left of first buttons rt.right=rt.left+PADDING_WIDTH; rt.top=rt.bottom; rt.bottom=LASTROW; clearRect(&rt); while ((current<=maxNumber)&&(current0) { int horizontal=(x/(PADDING_WIDTH+BUTTON_WIDTH_NM)); if (horizontal=PADDING_WIDTH)&&(y>=PADDING_HEIGHT)) { int current=horizontal*getMaxRows()+vertical+start; if (current<=maxNumber) return current; } } else if (vertical==getMaxRows()) { // The 'more' button is here y=y-vertical*(PADDING_HEIGHT+BUTTON_HEIGHT); if (y>=PADDING_HEIGHT) { x=x+horizontal*(PADDING_HEIGHT+BUTTON_HEIGHT); //undo 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; }