Pyrogenesis  trunk
CGUIColor.h
Go to the documentation of this file.
1 /* Copyright (C) 2021 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_GUICOLOR
19 #define INCLUDED_GUICOLOR
20 
21 #include "graphics/Color.h"
22 #include "ps/CStrForward.h"
23 
24 class CGUI;
25 
26 /**
27  * Same as the CColor class, but this one can also parse colors predefined in the GUI page (such as "yellow").
28  */
29 struct CGUIColor : CColor
30 {
31  // Take advantage of compiler warnings if unintentionally copying this
33 
34  // Defines move semantics so that the structs using the class can use it.
36 
37  CGUIColor() : CColor() {}
38 
39  CGUIColor(float r, float g, float b, float a) : CColor(r, g, b, a) {}
40 
41  /**
42  * Load color depending on current GUI page.
43  */
44  bool ParseString(const CGUI& pGUI, const CStr8& value, int defaultAlpha = 255);
45 
46  /**
47  * Ensure that all users check for predefined colors.
48  */
49  bool ParseString(const CStr8& value, int defaultAlpha = 255) = delete;
50 };
51 #endif // INCLUDED_GUICOLOR
float g
Definition: Color.h:95
CGUIColor(float r, float g, float b, float a)
Definition: CGUIColor.h:39
MOVABLE(CGUIColor)
Same as the CColor class, but this one can also parse colors predefined in the GUI page (such as "yel...
Definition: CGUIColor.h:29
Definition: Color.h:42
The main object that represents a whole GUI page.
Definition: CGUI.h:60
float b
Definition: Color.h:95
CGUIColor()
Definition: CGUIColor.h:37
float a
Definition: Color.h:95
NONCOPYABLE(CGUIColor)
bool ParseString(const CGUI &pGUI, const CStr8 &value, int defaultAlpha=255)
Load color depending on current GUI page.
float r
Definition: Color.h:95