2017-02-03 23:19:25 +00:00
|
|
|
//=============================================================================
|
|
|
|
//
|
|
|
|
// base class for menu items
|
|
|
|
//
|
|
|
|
//=============================================================================
|
|
|
|
|
2017-03-05 13:03:27 +00:00
|
|
|
class MenuItemBase : Object native ui version("2.4")
|
2017-02-03 23:19:25 +00:00
|
|
|
{
|
2017-02-19 16:24:30 +00:00
|
|
|
protected native double mXpos, mYpos;
|
2017-02-10 23:36:53 +00:00
|
|
|
protected native Name mAction;
|
|
|
|
native bool mEnabled;
|
2017-02-03 23:19:25 +00:00
|
|
|
|
2017-02-19 16:24:30 +00:00
|
|
|
void Init(double xpos = 0, double ypos = 0, Name actionname = 'None')
|
2017-02-03 23:19:25 +00:00
|
|
|
{
|
|
|
|
mXpos = xpos;
|
|
|
|
mYpos = ypos;
|
|
|
|
mAction = actionname;
|
|
|
|
mEnabled = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool CheckCoordinate(int x, int y) { return false; }
|
|
|
|
virtual void Ticker() {}
|
|
|
|
virtual void Drawer(bool selected) {}
|
|
|
|
virtual bool Selectable() {return false; }
|
|
|
|
virtual bool Activate() { return false; }
|
|
|
|
virtual Name, int GetAction() { return mAction, 0; }
|
|
|
|
virtual bool SetString(int i, String s) { return false; }
|
|
|
|
virtual bool, String GetString(int i) { return false, ""; }
|
|
|
|
virtual bool SetValue(int i, int value) { return false; }
|
|
|
|
virtual bool, int GetValue(int i) { return false, 0; }
|
|
|
|
virtual void Enable(bool on) { mEnabled = on; }
|
2017-02-12 00:18:49 +00:00
|
|
|
virtual bool MenuEvent (int mkey, bool fromcontroller) { return false; }
|
2017-02-03 23:19:25 +00:00
|
|
|
virtual bool MouseEvent(int type, int x, int y) { return false; }
|
|
|
|
virtual bool CheckHotkey(int c) { return false; }
|
|
|
|
virtual int GetWidth() { return 0; }
|
2017-02-12 13:04:48 +00:00
|
|
|
virtual int GetIndent() { return 0; }
|
2017-02-11 20:28:48 +00:00
|
|
|
virtual int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected) { return indent; }
|
|
|
|
|
2017-02-19 16:24:30 +00:00
|
|
|
void OffsetPositionY(double ydelta) { mYpos += ydelta; }
|
|
|
|
double GetY() { return mYpos; }
|
|
|
|
double GetX() { return mXpos; }
|
|
|
|
void SetX(double x) { mXpos = x; }
|
2017-02-03 23:19:25 +00:00
|
|
|
}
|
|
|
|
|
2017-02-12 13:04:48 +00:00
|
|
|
// this is only used to parse font color ranges in MENUDEF
|
|
|
|
enum MenudefColorRange
|
|
|
|
{
|
|
|
|
NO_COLOR = -1
|
|
|
|
}
|