forked from Mirrors/openclonk
Remove unused support for secondary menu command
parent
bddbc23354
commit
66d78fddab
|
@ -200,7 +200,6 @@ const BYTE
|
||||||
|
|
||||||
const BYTE
|
const BYTE
|
||||||
COM_MenuEnter = 38,
|
COM_MenuEnter = 38,
|
||||||
COM_MenuEnterAll = 39,
|
|
||||||
COM_MenuClose = 40,
|
COM_MenuClose = 40,
|
||||||
COM_MenuLeft = 52,
|
COM_MenuLeft = 52,
|
||||||
COM_MenuRight = 53,
|
COM_MenuRight = 53,
|
||||||
|
|
|
@ -288,12 +288,12 @@ void C4MainMenu::OnUserSelectItem(int32_t Player, int32_t iIndex)
|
||||||
SetSelection(iIndex, true, true);
|
SetSelection(iIndex, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4MainMenu::OnUserEnter(int32_t Player, int32_t iIndex, bool fRight)
|
void C4MainMenu::OnUserEnter(int32_t Player, int32_t iIndex)
|
||||||
{
|
{
|
||||||
// direct menu control
|
// direct menu control
|
||||||
// but ensure selection is Okay before
|
// but ensure selection is Okay before
|
||||||
SetSelection(iIndex, true, false);
|
SetSelection(iIndex, true, false);
|
||||||
Enter(fRight);
|
Enter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4MainMenu::OnUserClose()
|
void C4MainMenu::OnUserClose()
|
||||||
|
|
|
@ -64,7 +64,7 @@ protected:
|
||||||
|
|
||||||
virtual void OnSelectionChanged(int32_t iNewSelection);
|
virtual void OnSelectionChanged(int32_t iNewSelection);
|
||||||
virtual void OnUserSelectItem(int32_t Player, int32_t iIndex);
|
virtual void OnUserSelectItem(int32_t Player, int32_t iIndex);
|
||||||
virtual void OnUserEnter(int32_t Player, int32_t iIndex, bool fRight);
|
virtual void OnUserEnter(int32_t Player, int32_t iIndex);
|
||||||
virtual void OnUserClose();
|
virtual void OnUserClose();
|
||||||
virtual int32_t GetControllingPlayer() { return Player; }
|
virtual int32_t GetControllingPlayer() { return Player; }
|
||||||
|
|
||||||
|
|
|
@ -41,11 +41,10 @@ C4MenuItem::C4MenuItem(C4Menu *pMenu, int32_t iIndex, const char *szCaption,
|
||||||
: C4GUI::Element(), pSymbolGraphics(NULL), dwSymbolClr(0u), fSelected(false),
|
: C4GUI::Element(), pSymbolGraphics(NULL), dwSymbolClr(0u), fSelected(false),
|
||||||
iStyle(iStyle), pMenu(pMenu), iIndex(iIndex)
|
iStyle(iStyle), pMenu(pMenu), iIndex(iIndex)
|
||||||
{
|
{
|
||||||
*Caption=*Command=*Command2=*InfoCaption=0;
|
*Caption=*Command=*InfoCaption=0;
|
||||||
Symbol.Default();
|
Symbol.Default();
|
||||||
SCopy(szCaption,Caption,C4MaxTitle);
|
SCopy(szCaption,Caption,C4MaxTitle);
|
||||||
SCopy(szCommand,Command,_MAX_FNAME+30);
|
SCopy(szCommand,Command,_MAX_FNAME+30);
|
||||||
SCopy(szCommand2,Command2,_MAX_FNAME+30);
|
|
||||||
SCopy(szInfoCaption,InfoCaption,C4MaxTitle);
|
SCopy(szInfoCaption,InfoCaption,C4MaxTitle);
|
||||||
// some info caption corrections
|
// some info caption corrections
|
||||||
SReplaceChar(InfoCaption, 10, ' '); SReplaceChar(InfoCaption, 13, '|');
|
SReplaceChar(InfoCaption, 10, ' '); SReplaceChar(InfoCaption, 13, '|');
|
||||||
|
@ -105,16 +104,9 @@ void C4MenuItem::DrawElement(C4TargetFacet &cgo)
|
||||||
void C4MenuItem::MouseInput(C4GUI::CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
|
void C4MenuItem::MouseInput(C4GUI::CMouse &rMouse, int32_t iButton, int32_t iX, int32_t iY, DWORD dwKeyParam)
|
||||||
{
|
{
|
||||||
// clicky clicky!
|
// clicky clicky!
|
||||||
if (iButton == C4MC_Button_LeftUp)
|
if (iButton == C4MC_Button_LeftUp || iButton == C4MC_Button_RightUp)
|
||||||
{
|
{
|
||||||
// left-click performed
|
pMenu->UserEnter(::MouseControl.GetPlayer(), this);
|
||||||
pMenu->UserEnter(::MouseControl.GetPlayer(), this, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (iButton == C4MC_Button_RightUp)
|
|
||||||
{
|
|
||||||
// right-up: Alternative enter command
|
|
||||||
pMenu->UserEnter(::MouseControl.GetPlayer(), this, true);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// inherited; this is just setting some vars
|
// inherited; this is just setting some vars
|
||||||
|
@ -272,7 +264,6 @@ bool C4Menu::Control(BYTE byCom, int32_t iData)
|
||||||
switch (byCom)
|
switch (byCom)
|
||||||
{
|
{
|
||||||
case COM_MenuEnter: Enter(); break;
|
case COM_MenuEnter: Enter(); break;
|
||||||
case COM_MenuEnterAll: Enter(true); break;
|
|
||||||
case COM_MenuClose: TryClose(false, true); break;
|
case COM_MenuClose: TryClose(false, true); break;
|
||||||
|
|
||||||
// organize with nicer subfunction...
|
// organize with nicer subfunction...
|
||||||
|
@ -323,7 +314,7 @@ bool C4Menu::IsActive()
|
||||||
return fActive;
|
return fActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool C4Menu::Enter(bool fRight)
|
bool C4Menu::Enter()
|
||||||
{
|
{
|
||||||
// Not active
|
// Not active
|
||||||
if (!IsActive()) return false;
|
if (!IsActive()) return false;
|
||||||
|
@ -334,7 +325,6 @@ bool C4Menu::Enter(bool fRight)
|
||||||
// Copy command to buffer (menu might be cleared)
|
// Copy command to buffer (menu might be cleared)
|
||||||
char szCommand[_MAX_FNAME+30+1];
|
char szCommand[_MAX_FNAME+30+1];
|
||||||
SCopy(pItem->Command,szCommand);
|
SCopy(pItem->Command,szCommand);
|
||||||
if (fRight && pItem->Command2[0]) SCopy(pItem->Command2,szCommand);
|
|
||||||
|
|
||||||
// Close if not permanent
|
// Close if not permanent
|
||||||
if (!Permanent) { Close(true); fActive = false; }
|
if (!Permanent) { Close(true); fActive = false; }
|
||||||
|
@ -731,13 +721,13 @@ void C4Menu::UserSelectItem(int32_t Player, C4MenuItem *pItem)
|
||||||
OnUserSelectItem(Player, pItem->iIndex);
|
OnUserSelectItem(Player, pItem->iIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4Menu::UserEnter(int32_t Player, C4MenuItem *pItem, bool fRight)
|
void C4Menu::UserEnter(int32_t Player, C4MenuItem *pItem)
|
||||||
{
|
{
|
||||||
// not if user con't control anything
|
// not if user con't control anything
|
||||||
if (IsReadOnly()) return;
|
if (IsReadOnly()) return;
|
||||||
if (!pItem) return;
|
if (!pItem) return;
|
||||||
// queue or direct enter
|
// queue or direct enter
|
||||||
OnUserEnter(Player, pItem->iIndex, fRight);
|
OnUserEnter(Player, pItem->iIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4Menu::UserClose(bool fOK)
|
void C4Menu::UserClose(bool fOK)
|
||||||
|
|
|
@ -59,7 +59,6 @@ public:
|
||||||
protected:
|
protected:
|
||||||
char Caption[C4MaxTitle+1];
|
char Caption[C4MaxTitle+1];
|
||||||
char Command[_MAX_FNAME+30+1];
|
char Command[_MAX_FNAME+30+1];
|
||||||
char Command2[_MAX_FNAME+30+1];
|
|
||||||
char InfoCaption[2*C4MaxTitle+1];
|
char InfoCaption[2*C4MaxTitle+1];
|
||||||
C4FacetSurface Symbol;
|
C4FacetSurface Symbol;
|
||||||
C4DefGraphics* pSymbolGraphics; // drawn instead of symbol, if non-null
|
C4DefGraphics* pSymbolGraphics; // drawn instead of symbol, if non-null
|
||||||
|
@ -137,7 +136,7 @@ public:
|
||||||
bool SetSelection(int32_t iSelection, bool fAdjustPosition, bool fDoCalls);
|
bool SetSelection(int32_t iSelection, bool fAdjustPosition, bool fDoCalls);
|
||||||
bool SetPosition(int32_t iPosition);
|
bool SetPosition(int32_t iPosition);
|
||||||
void SetSize(int32_t iToWdt, int32_t iToHgt);
|
void SetSize(int32_t iToWdt, int32_t iToHgt);
|
||||||
bool Enter(bool fRight=false);
|
bool Enter();
|
||||||
bool IsActive();
|
bool IsActive();
|
||||||
bool Control(BYTE byCom, int32_t iData);
|
bool Control(BYTE byCom, int32_t iData);
|
||||||
bool KeyControl(BYTE byCom); // direct keyboard callback
|
bool KeyControl(BYTE byCom); // direct keyboard callback
|
||||||
|
@ -179,7 +178,7 @@ protected:
|
||||||
void InitSize();
|
void InitSize();
|
||||||
void UpdateScrollBar(); // call InitSize if a scroll bar is needed but not present or vice vera
|
void UpdateScrollBar(); // call InitSize if a scroll bar is needed but not present or vice vera
|
||||||
void UserSelectItem(int32_t Player, C4MenuItem *pItem); // select item (direct) or do control (object menus)
|
void UserSelectItem(int32_t Player, C4MenuItem *pItem); // select item (direct) or do control (object menus)
|
||||||
void UserEnter(int32_t Player, C4MenuItem *pItem, bool fRight); // enter on an item
|
void UserEnter(int32_t Player, C4MenuItem *pItem); // enter on an item
|
||||||
bool HasMouse(); // returns whether the controlling player has mouse control
|
bool HasMouse(); // returns whether the controlling player has mouse control
|
||||||
|
|
||||||
virtual bool DoRefillInternal(bool &rfRefilled) { return true; };
|
virtual bool DoRefillInternal(bool &rfRefilled) { return true; };
|
||||||
|
@ -187,7 +186,7 @@ protected:
|
||||||
virtual void OnSelectionChanged(int32_t iNewSelection) {} // do object callbacks if selection changed in user menus
|
virtual void OnSelectionChanged(int32_t iNewSelection) {} // do object callbacks if selection changed in user menus
|
||||||
virtual bool IsCloseDenied() { return false; } // do MenuQueryCancel-callbacks for user menus
|
virtual bool IsCloseDenied() { return false; } // do MenuQueryCancel-callbacks for user menus
|
||||||
virtual void OnUserSelectItem(int32_t Player, int32_t iIndex) {}
|
virtual void OnUserSelectItem(int32_t Player, int32_t iIndex) {}
|
||||||
virtual void OnUserEnter(int32_t Player, int32_t iIndex, bool fRight) {}
|
virtual void OnUserEnter(int32_t Player, int32_t iIndex) {}
|
||||||
virtual void OnUserClose() {};
|
virtual void OnUserClose() {};
|
||||||
virtual bool IsReadOnly() { return false; } // determine whether the menu is just viewed by an observer, and should not issue any calls
|
virtual bool IsReadOnly() { return false; } // determine whether the menu is just viewed by an observer, and should not issue any calls
|
||||||
virtual int32_t GetControllingPlayer() { return NO_OWNER; }
|
virtual int32_t GetControllingPlayer() { return NO_OWNER; }
|
||||||
|
|
Loading…
Reference in New Issue