#ifndef APPLICATIONINTERFACE_H #define APPLICATIONINTERFACE_H #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // This file contains a wrapper for the windows CE functions that are needed for the gui #define WIN32_LEAN_AND_MEAN #include #include "utils.h" #define setMenuSelected(hWndMB, idButton, checked) SendMessage((hWndMB), TB_CHECKBUTTON,\ (WPARAM)idButton, (LPARAM)MAKELONG(checked,0)); #define getMenu(hWndMB) (HMENU)SendMessage((hWndMB), SHCMBM_GETMENU, (WPARAM)0, (LPARAM)0); #define getSubMenu(hWndMB,ID_MENU) (HMENU)SendMessage((hWndMB), SHCMBM_GETSUBMENU, (WPARAM)0, (LPARAM)ID_MENU); #define setSubMenu(hWndMB,ID_MENU) (HMENU)SendMessage((hWndMB), SHCMBM_SETSUBMENU, (WPARAM)0, (LPARAM)ID_MENU); extern HDC hdc; // Only valid when painting extern HBRUSH background; extern HINSTANCE g_hInst; // The current instance extern HWND g_hWnd; // The main window extern HWND g_hwndCB; #define MENU_HEIGHT 26 #define MAX_LOADSTRING 100 #define FONT_DEFAULT 0 #define FONT_NAVIGATION 1 #define FONT_TEXT 2 #define NOCOLOR 0xFFFFFFFF void initApplicationInterface(); // load string from string table void loadString(UINT id, LPTSTR buffer); UString loadString(UINT id); // sets the main title void setTitle(UString title); // Refreshes the whole application screen void refreshScreen(); // Draws the text inside the rectangle inline void drawText(RECT* rt, const TCHAR* text, int length) { ExtTextOut(hdc, rt->left+2, rt->top+2, ETO_CLIPPED|ETO_OPAQUE, rt, text, length, 0); } void drawText(RECT* rt, UString text); // Draws the text right-aligned inside the rectangle inline void drawRText(RECT* rt, const TCHAR* text, int length) { SIZE textSize; GetTextExtentPoint(hdc,text,length,&textSize); ExtTextOut(hdc, rt->right-2-textSize.cx, rt->top+2, ETO_CLIPPED|ETO_OPAQUE, rt, text, length, 0); } void drawRText(RECT* rt, UString text); int drawVerseText(RECT* rt, UString text); // fill the rectangle with the original background color inline void clearRect(RECT* rt) { FillRect(hdc, rt, background); } // set the font void setFont(int id=FONT_DEFAULT); // set the background color inline void setBackground(COLORREF color=NOCOLOR) { if (color==NOCOLOR) SetBkColor(hdc,(COLORREF)GetSysColor(COLOR_WINDOW)); else SetBkColor(hdc,color); } void selectMenu(int mode); void addMenu(HMENU menu, int id, UString text); void checkMenu(HMENU menu, int id, bool checked); #endif