CMenu.h
上传用户:snevogroup
上传日期:2008-06-06
资源大小:432k
文件大小:3k
- #ifndef __CMENU_H
- #define __CMENU_H
- #include <w32std.h>
- const 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<TPoint, MenuItemSum> iMenuItemPos; // menu item position
- TFixedArray<HBufC*, MenuItemSum> iMenuItemTxt; // menu item text
- TFixedArray<HBufC*, SettingStr> iSettingStr;
- TFixedArray<TPoint, SettingItem> iSettingPos;
- TFixedArray<TPoint, MenuPageSum> 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<TInt, SettingItem> iSetting; // used for return
- };
- #endif