mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-24 02:34:04 +00:00
Introduce CGUIColor type inheriting Color type and switch the GUI to exclusively use that.
The type differs from the Color type, because contrary to Color, it can
be created from a color predefined in the GUI page (such as "yellow").
Move this predefined color check to the new class instead of hardcoding
it in FromJSVal / ToJSVal, GUIUtil, JSInterface_IGUIObject and to
straighten the latter.
Delete fov_wedge_color from Minimap, unused since introduction in
5275dc862b.
This was SVN commit r22558.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2015 Wildfire Games.
|
||||
/* Copyright (C) 2019 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -131,31 +131,31 @@ void IGUIButtonBehavior::HandleMessage(SGUIMessage& Message)
|
||||
}
|
||||
}
|
||||
|
||||
CColor IGUIButtonBehavior::ChooseColor()
|
||||
CGUIColor IGUIButtonBehavior::ChooseColor()
|
||||
{
|
||||
CColor color, color2;
|
||||
CGUIColor color, color2;
|
||||
|
||||
// Yes, the object must possess these settings. They are standard
|
||||
GUI<CColor>::GetSetting(this, "textcolor", color);
|
||||
GUI<CGUIColor>::GetSetting(this, "textcolor", color);
|
||||
|
||||
bool enabled;
|
||||
GUI<bool>::GetSetting(this, "enabled", enabled);
|
||||
|
||||
if (!enabled)
|
||||
{
|
||||
GUI<CColor>::GetSetting(this, "textcolor_disabled", color2);
|
||||
GUI<CGUIColor>::GetSetting(this, "textcolor_disabled", color2);
|
||||
return GUI<>::FallBackColor(color2, color);
|
||||
}
|
||||
else if (m_MouseHovering)
|
||||
{
|
||||
if (m_Pressed)
|
||||
{
|
||||
GUI<CColor>::GetSetting(this, "textcolor_pressed", color2);
|
||||
GUI<CGUIColor>::GetSetting(this, "textcolor_pressed", color2);
|
||||
return GUI<>::FallBackColor(color2, color);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI<CColor>::GetSetting(this, "textcolor_over", color2);
|
||||
GUI<CGUIColor>::GetSetting(this, "textcolor_over", color2);
|
||||
return GUI<>::FallBackColor(color2, color);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user