www.pudn.com > Tetris.rar > CMenu.h
#ifndef __CMENU_H #define __CMENU_H #includeconst TInt MenuItemSum = 19; const TInt MenuPageSum = 7; const TInt SettingStr = 17; const TInt SettingItem = 6; enum TMenuItem { EStart = 0, EOptions, ECredit, EHighScore, EQuit, EOptions_Sound, EOptions_Difficulty, EOptions_RotateDir, EOptions_Back, ESound_Sounds, ESound_Music, ESound_Volume, ESound_Done, EDifficulty_StartLines, EDifficulty_AddBrick, EDifficulty_Done, EPause_Continue, EPause_Sound, EPause_EndGame, ENoneItem }; enum TMenuState { EMainPage = 0, EOptionsPage, ESoundPage, EDifficultyPage, EPausePage, ECreditPage, EHighScorePage, ENonePage }; class CMenu : public CBase { // Construct and destruct public: static CMenu* NewL(CFbsBitGc* aFbsBitGc); ~CMenu(); private: void ConstructL(); CMenu(CFbsBitGc* aFbsBitGc); ////////////////////////////////////////////////////////////////////// // Other Method public: // draw the menu void Draw(); // handel command TInt32 Command(TInt aCommand); private: // set the frame contains the text // Dymamic modify the frame's position if possible void SetFrameDynamic(TInt aMenuItem); // don't modify it's position void SetFrame(TInt aMenuItem); void ResetPos(); void DrawPage(TInt aItemForm, TInt aItemTo); void DrawBg(); // Init menu positon and Txt void LoadResL(); // Index TInt Index(TInt aMenuItem); ///////////////////////////////////////////////////////////////////// // Data private: CFbsBitGc* iGc; // graphic context TInt iMenuItem; // current menu item TInt iPrevItem; TMenuState iMenuState; // current menu page TMenuState iPrevPage; TFixedArray iMenuItemPos; // menu item position TFixedArray iMenuItemTxt; // menu item text TFixedArray iSettingStr; TFixedArray iSettingPos; TFixedArray iMenuPagePos; // Menu Page start&end menuItem num CFbsBitmap* iBitmap; TPoint iPos; // used for background TPoint iPointList[12]; // 12 points form a frame TPoint iCurrentMenuItemPos[MenuItemSum]; TInt iBlink; // used for blink menu TInt iSpeed; // used for showing menu TBool iSelect; // used for highlight menu one time when selected //CEikLabel* iLabel; public: TFixedArray iSetting; // used for return }; #endif