mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-21 03:21:28 +00:00
Add graycheck to colorpicker
This commit is contained in:
parent
4273af8004
commit
cebf37b3fa
1 changed files with 14 additions and 2 deletions
|
@ -900,22 +900,24 @@ class OptionMenuItemSlider : OptionMenuSliderBase
|
|||
class OptionMenuItemColorPicker : OptionMenuItem
|
||||
{
|
||||
CVar mCVar;
|
||||
CVar mGrayCheck;
|
||||
|
||||
const CPF_RESET = 0x20001;
|
||||
|
||||
OptionMenuItemColorPicker Init(String label, Name command)
|
||||
OptionMenuItemColorPicker Init(String label, Name command, CVar graycheck = null)
|
||||
{
|
||||
Super.Init(label, command);
|
||||
CVar cv = CVar.FindCVar(command);
|
||||
if (cv != null && cv.GetRealType() != CVar.CVAR_Color) cv = null;
|
||||
mCVar = cv;
|
||||
mGrayCheck = graycheck;
|
||||
return self;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
override int Draw(OptionMenuDescriptor desc, int y, int indent, bool selected)
|
||||
{
|
||||
drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor);
|
||||
drawLabel(indent, y, selected? OptionMenuSettings.mFontColorSelection : OptionMenuSettings.mFontColor, isGrayed());
|
||||
|
||||
if (mCVar != null)
|
||||
{
|
||||
|
@ -963,6 +965,16 @@ class OptionMenuItemColorPicker : OptionMenuItem
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool IsGrayed(void)
|
||||
{
|
||||
return mGrayCheck != NULL && !mGrayCheck.GetInt();
|
||||
}
|
||||
|
||||
override bool Selectable()
|
||||
{
|
||||
return !isGrayed();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
|
Loading…
Reference in a new issue