00001 00023 #ifndef INC_MI32_COLORPAL_H 00024 #define INC_MI32_COLORPAL_H 00025 00026 #ifndef INC_MI32_COLOR_H 00027 #include <mi32/color.h> 00028 #endif 00029 00030 #ifndef INC_MI32_MISTRING_H 00031 #include <mi32/mistring.h> 00032 #endif 00033 00034 #ifndef INC_MI32_MILIST_H 00035 #include <mi32/milist.h> 00036 #endif 00037 00038 #ifndef INC_MI32_SIMPLEAR_H 00039 #include <mi32/simplear.h> 00040 #endif 00041 00042 class FILEPATH; 00043 class XMLNODE; 00044 00048 class COLOREXT { 00049 public: 00050 00052 COLOREXT ( 00053 ) { } 00054 00056 void AddColor ( 00057 const COLOR& color 00058 ); 00059 00061 ERRVALUE Create ( 00062 const XMLNODE *xmlnode 00063 ); 00064 00067 const COLOR& GetColor ( 00068 COLOR::MODEL model = COLOR::MODEL_COUNT 00069 ) const; 00070 00072 const MILIST<COLOR>& GetColorList ( 00073 ) const { return (m_colors); } 00074 00076 const MISTRING& GetName ( 00077 ) const { return (m_name); } 00078 00079 private: 00080 #ifndef GENERATING_DOXYGEN_OUTPUT 00081 00082 MISTRING m_name; 00083 MILIST<COLOR> m_colors; 00084 #endif // GENERATING_DOXYGEN_OUTPUT 00085 }; 00086 00087 00092 class COLORPALETTE { 00093 public: 00094 00096 COLORPALETTE (); 00097 00099 COLORPALETTE (const COLORPALETTE&); 00100 00102 ~COLORPALETTE (); 00103 00105 COLORPALETTE& operator= (const COLORPALETTE&); 00106 00108 void ComputeGridFromIndex ( 00109 int index, 00110 int& x, 00111 int& y 00112 ) const; 00113 00115 int ComputeIndexFromGrid ( 00116 int x, 00117 int y 00118 ) const; 00119 00122 int FindColor ( 00123 const COLOR& color 00124 ) const; 00125 00127 int GetGridHeight ( 00128 ) const { return (m_GridHeight); } 00129 00131 int GetGridWidth ( 00132 ) const { return (m_GridWidth); } 00133 00135 const COLOREXT& GetItem ( 00136 int index 00137 ) const; 00138 00141 const MISTRING& GetItemName ( 00142 int index 00143 ) const { return (GetItem(index).GetName()); } 00144 00147 const COLOR& GetItemColor ( 00148 int index, 00149 COLOR::MODEL model = COLOR::MODEL_COUNT 00150 ) const { return (GetItem(index).GetColor(model)); } 00151 00153 const SIMPLE_ARRAY<WPOINT2D>& GetLayout ( 00154 ) const { return (m_Layout); } 00155 00157 const MISTRING& GetName ( 00158 ) const; 00159 00161 int GetNumItems ( 00162 ) const; 00163 00165 ERRVALUE Load ( 00166 const FILEPATH& filepath 00167 ); 00168 00169 private: 00170 #ifndef GENERATING_DOXYGEN_OUTPUT 00171 00172 MISTRING m_Name; 00173 SIMPLE_ARRAY<WPOINT2D> m_Layout; 00174 COLOREXT *m_Items; 00175 int m_NumItems; 00176 int m_GridWidth; 00177 int m_GridHeight; 00178 00179 void Clear (); 00180 void CreateMicroImagesDefault (); 00181 00182 friend class COLORPALETTEMGR; 00183 #endif // GENERATING_DOXYGEN_OUTPUT 00184 }; 00185 typedef MILIST<COLORPALETTE> COLORPALETTELIST; 00186 00187 00191 class COLORPALETTEMGR { 00192 public: 00193 00195 static const COLORPALETTELIST& GetPaletteList (); 00196 00197 private: 00198 #ifndef GENERATING_DOXYGEN_OUTPUT 00199 00200 static const COLORPALETTEMGR& GetCommon (); 00201 00202 COLORPALETTELIST m_PaletteList; 00203 00204 COLORPALETTEMGR (); 00205 00206 void AddPaletteFiles (const FILEPATH&); 00207 00208 COLORPALETTEMGR (const COLORPALETTEMGR&); 00209 COLORPALETTEMGR& operator= (const COLORPALETTEMGR&); 00210 #endif // GENERATING_DOXYGEN_OUTPUT 00211 }; 00212 00213 00214 #endif
1.6.1