#ifndef NAVPAGE_H #define NAVPAGE_H #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "utils.h" class SimpleNavigator; class NavPage { public: // In a derived class, use this constructor to instantiate visual // components using CreateWindow. For example: // // anEdit = CreateWindow(_T("edit"), NULL, // WS_CHILD | WS_BORDER, // RECT_SCREEN.left, RECT_SCREEN.top, 30, 20, // g_hWnd, NULL, g_hInst, NULL); // // In order to listen to button clicks, they first need to be // registered here in the navigator like this: // // aButtonID=navigator->getID(); // // aButton = CreateWindow(_T("button"), L"Go", // WS_CHILD | BS_PUSHBUTTON, // RECT_SCREEN.right-30, RECT_SCREEN.top, 30, 20, // g_hWnd, registerID(goButtonID), g_hInst, NULL); NavPage(SimpleNavigator* navigator) { portrait = inPortraitMode(); this->navigator=navigator; }; // Destructor virtual ~NavPage() {}; // In the derived class, show all visual components here using // ShowWindow. For example: // // ShowWindow(anEdit,SW_SHOW); virtual void show() {}; // In the derived class, hide all visual components here using // ShowWindow. For example: // // ShowWindow(anEdit,SW_HIDE); virtual void hide() {}; // In the derived class, use this method to do all custom // painting, using methods from ApplicationInterface.cpp. Example: // // drawText(&RECT_SCREEN, L"Under construction"); virtual void paint() {}; // In the derived class, use this method to listen to buttons being // clicked. See the comment in the constructor on how to obtain the id virtual void buttonClicked(int id) {}; // In the derived class, use this method to listen to 'mouse clicks' // that do not occur inside visual components. virtual void userTap(int x, int y) {}; // In the derived class, use this method to listen to keys being pressed virtual void keyDown(WPARAM id, LPARAM lparam) {}; protected: SimpleNavigator* navigator; // Used to determine if the screen switched from portrait to landscape and visa versa. bool portrait; }; #endif