Browse Subversion Repository
Contents of /trunk/CPopMenu.h
Parent Directory
| Revision Log
Revision 1 -
( show annotations)
( download)
( as text)
Sun Aug 15 01:53:13 2010 UTC
(13 years, 9 months ago)
by okadu
File MIME type: text/x-chdr
File size: 1862 byte(s)
| 1 |
#ifndef CPOPMENU_H_INCLUDED |
| 2 |
#define CPOPMENU_H_INCLUDED |
| 3 |
|
| 4 |
/* |
| 5 |
* メニューコマンドオブジェクト |
| 6 |
*/ |
| 7 |
class CMenuCommand{ |
| 8 |
public: |
| 9 |
virtual ~CMenuCommand(){} |
| 10 |
virtual void Exec() = 0; |
| 11 |
}; |
| 12 |
|
| 13 |
/* |
| 14 |
* ポップアップメニュー |
| 15 |
*/ |
| 16 |
class CPopMenu{ |
| 17 |
private: |
| 18 |
static CPopMenu *ms_ActiveMenu; // 使用中のメニュー |
| 19 |
int m_ChildNum; // 子数 |
| 20 |
int m_PosX, m_PosY; // 座標 |
| 21 |
int m_Width, m_Height; // メニューサイズ |
| 22 |
int m_Expand; // 展開方向 |
| 23 |
bool m_Enabled; // 有効フラグ |
| 24 |
string m_String; // 文字列 |
| 25 |
CMenuCommand *m_Command; // コマンド |
| 26 |
CPopMenu *m_Pointed; // ポイントした ID |
| 27 |
CPopMenu *m_Parent; // 親 |
| 28 |
CPopMenu *m_Brother; // 兄弟 |
| 29 |
CPopMenu *m_Child; // 子 |
| 30 |
public: |
| 31 |
static int ScanInputAll(); |
| 32 |
static void RenderAll(); |
| 33 |
static void ResetCurrentMenu(){ ms_ActiveMenu = NULL; } |
| 34 |
CPopMenu(char *, CPopMenu *); |
| 35 |
~CPopMenu(); |
| 36 |
void SetString(char *str){ m_String = str; } |
| 37 |
void InsertMenu(CPopMenu *); |
| 38 |
bool IsExpand(){ return m_Expand>=0; } |
| 39 |
bool IsEnabled(){ return m_Enabled; } |
| 40 |
void Enable(bool en){ m_Enabled = en; } |
| 41 |
bool IsInside(int, int); |
| 42 |
int HitTest(int, int); |
| 43 |
CPopMenu *GetMenu(int); |
| 44 |
void ClearCommand(){ DELETE_V(m_Command); } |
| 45 |
void SetCommand(CMenuCommand *cmd){ ClearCommand(); m_Command = cmd; } |
| 46 |
void Popup(int, int, int tw = 0, int th = 0, int dir = 3); |
| 47 |
int ScanInput(); |
| 48 |
void Render(); |
| 49 |
}; |
| 50 |
|
| 51 |
// コマンドタイプ |
| 52 |
typedef enum{ |
| 53 |
CMD_NONE = 0, // 不明 |
| 54 |
CMD_PITVELEM, // プラグインツリー |
| 55 |
CMD_PILVELEM, // プラグインリスト |
| 56 |
CMD_GROUP, // 編成 |
| 57 |
CMD_TRAIN, // 車輌 |
| 58 |
CMD_SCENE, // シーン |
| 59 |
CMD_GROUPTMP, // 編成テンプレート |
| 60 |
CMD_ROUTINE, // ダイヤルーチン |
| 61 |
CMD_FILE, // ファイル |
| 62 |
CMD_NETWORK, // ネットワーク |
| 63 |
} CMDTYPE; |
| 64 |
|
| 65 |
/* |
| 66 |
* メニューコマンダ |
| 67 |
*/ |
| 68 |
class CMenuCommander{ |
| 69 |
public: |
| 70 |
virtual CPopMenu *Dispatch(CMDTYPE, DWORD) = 0; |
| 71 |
virtual void DoubleClick(CMDTYPE, DWORD){} |
| 72 |
}; |
| 73 |
|
| 74 |
#endif |
| |