MyGUI  3.2.0
MyGUI_Colour.h
Go to the documentation of this file.
00001 
00006 /*
00007     This file is part of MyGUI.
00008 
00009     MyGUI is free software: you can redistribute it and/or modify
00010     it under the terms of the GNU Lesser General Public License as published by
00011     the Free Software Foundation, either version 3 of the License, or
00012     (at your option) any later version.
00013 
00014     MyGUI is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00021 */
00022 #ifndef __MYGUI_COLOUR_H__
00023 #define __MYGUI_COLOUR_H__
00024 
00025 #include "MyGUI_Prerequest.h"
00026 #include "MyGUI_Types.h"
00027 
00028 namespace MyGUI
00029 {
00030 
00031     struct MYGUI_EXPORT Colour
00032     {
00033     public:
00034         Colour();
00035         Colour(float _red, float _green, float _blue, float _alpha = 1);
00036         explicit Colour(const std::string& _value);
00037 
00038         Colour& operator = (Colour const& _value);
00039         bool operator == (Colour const& _value) const;
00040         bool operator != (Colour const& _value) const;
00041 
00042         void set(float _red, float _green, float _blue, float _alpha = 1);
00043 
00044         void clear();
00045 
00046         std::string print() const;
00047 
00048         static Colour parse(const std::string& _value);
00049 
00050         friend std::ostream& operator << (std::ostream& _stream, const Colour&  _value)
00051         {
00052             return operatorShiftLeft(_stream, _value);
00053         }
00054 
00055         friend std::istream& operator >> (std::istream& _stream, Colour&  _value)
00056         {
00057             return operatorShiftRight(_stream, _value);
00058         }
00059 
00060         static std::ostream& operatorShiftLeft(std::ostream& _stream, const Colour&  _value);
00061         static std::istream& operatorShiftRight(std::istream& _stream, Colour&  _value);
00062 
00063     public:
00064         float red;
00065         float green;
00066         float blue;
00067         float alpha;
00068 
00069         static const Colour Zero;
00070         static const Colour Black;
00071         static const Colour White;
00072         static const Colour Red;
00073         static const Colour Green;
00074         static const Colour Blue;
00075     };
00076 
00077 } // namespace MyGUI
00078 
00079 #endif // __MYGUI_COLOUR_H__