00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef INC_MGUI_COLOREDL_H
00024 #define INC_MGUI_COLOREDL_H
00025
00026 #ifndef INC_MGUI_CTRL_H
00027 #include <mgui/ctrl.h>
00028 #endif
00029
00030 #ifndef INC_MGUI_GRID_H
00031 #include <mgui/grid.h>
00032 #endif
00033
00034 #ifndef INC_MGUI_COLORSEL_H
00035 #include <mgui/colorsel.h>
00036 #endif
00037
00038 #ifndef INC_MI32_MILIST_H
00039 #include <mi32/milist.h>
00040 #endif
00041
00042
00043 namespace MGUI {
00044
00045
00046
00047
00048 class FORM_COLOR_EDIT_LIST : public MGUI::FORM {
00049 public:
00050
00051
00052 enum CAP {
00053 CAP_NoTransparent,
00054 CAP_AllowTransparent,
00055 CAP_AllowTransparency,
00056 CAP_FromForm
00057 };
00058
00059
00060 enum LAYOUT {
00061 LAYOUT_Vertical,
00062 LAYOUT_Horizontal
00063 };
00064
00065 class ITEM {
00066 public:
00067
00068
00069 ITEM (
00070 const char *name,
00071 const COLOR& color,
00072 CAP capability = CAP_FromForm
00073 );
00074
00075
00076 ITEM (
00077 const UNICODE *name,
00078 const COLOR& color,
00079 CAP capability = CAP_FromForm
00080 );
00081
00082
00083 ITEM (
00084 const char *name,
00085 UINT32 colorref,
00086 CAP capability = CAP_FromForm
00087 );
00088
00089
00090 ITEM (
00091 const UNICODE *name,
00092 UINT32 colorref,
00093 CAP capability = CAP_FromForm
00094 );
00095
00096 private:
00097 #ifndef GENERATING_DOXYGEN_OUTPUT
00098 MISTRING m_name;
00099 COLOR m_color;
00100 CAP m_cap;
00101
00102 friend class FORM_COLOR_EDIT_LIST;
00103 #endif // GENERATING_DOXYGEN_OUTPUT
00104 };
00105
00106
00107 FORM_COLOR_EDIT_LIST (
00108 );
00109
00110
00111 virtual ~FORM_COLOR_EDIT_LIST (
00112 );
00113
00114
00115
00116 int AddItem (
00117 const ITEM& item
00118 );
00119
00120
00121
00122
00123 void Create (
00124 MGUI::LAYOUT_PANE_BASE& ParentPane,
00125 int listrows,
00126 CAP capability = CAP_NoTransparent,
00127 LAYOUT layout = LAYOUT_Vertical
00128 );
00129
00130
00131
00132 const COLOR& GetItemColor (
00133 int itemid
00134 );
00135
00136
00137
00138 UINT32 GetItemColorRef (
00139 int itemid
00140 );
00141
00142
00143
00144 virtual bool IsCreated (
00145 ) const;
00146
00147
00148
00149 virtual bool IsEnabled (
00150 ) const;
00151
00152
00153 virtual void SetEnabled (
00154 bool enabled = true
00155 );
00156
00157
00158 void SetItemColor (
00159 int itemid,
00160 const COLOR& color,
00161 bool notify = true
00162 );
00163
00164
00165 virtual void SetVisible (
00166 bool visible = true
00167 );
00168
00169 protected:
00170
00171
00172 virtual void OnChangeItemColor (
00173 int itemid,
00174 const COLOR& color
00175 );
00176
00177 private:
00178 #ifndef GENERATING_DOXYGEN_OUTPUT
00179
00180 MILIST<ITEM> m_ItemList;
00181 CTRL_GRID_T<FORM_COLOR_EDIT_LIST> m_ColorList;
00182 FORM_COLORSELECTOR_T<FORM_COLOR_EDIT_LIST> m_ColorSel;
00183
00184 CAP m_cap;
00185
00186 ITEM* GetColorListItemPtr (int itemnum) {
00187 return (static_cast<ITEM*>(reinterpret_cast<void*>(m_ColorList.GetItemData(itemnum))));
00188 }
00189 int InsertItem (ITEM&);
00190 bool OnColorListItemDraw (MGUI::CTRL_GRID::CUSTOMDRAW&);
00191 void OnColorListItemSelect (int itemnum, int subitem);
00192 void OnColorSelChangeColor ();
00193 #endif // GENERATING_DOXYGEN_OUTPUT
00194 };
00195
00196
00197
00198 template <class _T> class FORM_COLOR_EDIT_LIST_T : public MGUI::FORM_COLOR_EDIT_LIST {
00199 public:
00200
00201
00202 FORM_COLOR_EDIT_LIST_T (
00203 ): m_pContainer(0), m_pfOnChangeItemColor(0) { }
00204
00205
00206 void Create (
00207 MGUI::LAYOUT_PANE& ParentPane,
00208 _T *pContainer,
00209 int listrows,
00210 CAP capability = CAP_NoTransparent,
00211 LAYOUT layout = LAYOUT_Vertical
00212 ) {
00213 m_pContainer = pContainer;
00214 FORM_COLOR_EDIT_LIST::Create(ParentPane,listrows,capability,layout);
00215 }
00216
00217
00218 void SetChangeItemColorFunc (
00219 void (_T::*pfChangeItemColor)(int itemnum, const COLOR& color)
00220 ) { m_pfChangeItemColor = pfChangeItemColor; }
00221
00222 private:
00223 #ifndef GENERATING_DOXYGEN_OUTPUT
00224 _T *m_pContainer;
00225 void (_T::*m_pfOnChangeItemColor)(int, const COLOR&);
00226
00227 virtual void OnChangeItemColor (
00228 int itemnum,
00229 const COLOR& color
00230 ) { if (pfOnChangeItem != 0) m_pContainer->*m_pfOnChangeItemColor)(itemnum,color); }
00231 #endif // GENERATING_DOXYGEN_OUTPUT
00232
00233 };
00234
00235 }
00236
00237 #endif // INC_MGUI_COLOREDL_H