00001 00029 #ifndef INC_MGUI_COLORSEL_H 00030 #define INC_MGUI_COLORSEL_H 00031 00032 #ifndef INC_MGUI_COLORBTN_H 00033 #include <mgui/colorbtn.h> 00034 #endif 00035 00036 #ifndef INC_MGUI_EDIT_H 00037 #include <mgui/edit.h> 00038 #endif 00039 00040 #ifndef INC_MGUI_CANVAS_H 00041 #include <mgui/canvas.h> 00042 #endif 00043 00044 00045 #ifndef GENERATING_DOXYGEN_OUTPUT 00046 // Forward declarations. 00047 class COLORPALETTE; 00048 namespace MGD { 00049 class CONTEXT; 00050 } 00051 #endif 00052 00053 namespace MGUI { 00054 00058 class FORM_COLORSELECTOR : public MGUI::FORM_COMPOSITE { 00059 public: 00060 00061 enum FORMSTYLE { 00062 FORMSTYLE_Default = 0x00, 00063 FORMSTYLE_EditTransparency = 0x01 00064 }; 00065 00067 FORM_COLORSELECTOR (); 00068 00070 virtual ~FORM_COLORSELECTOR (); 00071 00073 void Create ( 00074 MGUI::LAYOUT_PANE_BASE& ParentPane, 00075 FORMSTYLE formstyle = FORMSTYLE_Default 00076 ); 00077 00079 const COLOR& GetColor ( 00080 ) const { return (m_color); } 00081 00083 void SetDelegateOnChangeColor ( 00084 DELEGATE_VOID_NOPARMS delegate 00085 ) { m_DelegateOnChangeColor = delegate; } 00086 00088 void SetColor ( 00089 const COLOR& color, 00090 bool notify = true 00091 ); 00092 00094 void SetTransparency ( 00095 UINT8 transparency, 00096 bool notify = true 00097 ); 00098 00099 private: 00100 #ifndef GENERATING_DOXYGEN_OUTPUT 00101 00102 typedef FORM_COLORSELECTOR THISCLASS; 00103 00104 class CANVAS_PALETTE : public MGUI::CANVAS { 00105 public: 00106 CANVAS_PALETTE ( 00107 FORM_COLORSELECTOR& form 00108 ): m_form(form) { } 00109 private: 00110 FORM_COLORSELECTOR& m_form; 00111 virtual void v_OnPointerButtonDown (MGUI::POINT point, POINTERBUTTON button, KEYSTATE keystate); 00112 }; 00113 friend class CANVAS_PALETTE; 00114 00115 DELEGATE_VOID_NOPARMS m_DelegateOnChangeColor; 00116 COLOR m_color; 00117 int m_palindex; 00118 int m_cellsize; 00119 int m_x0; 00120 int m_y0; 00121 CANVAS_PALETTE m_PaletteCanvas; 00122 CTRL_PUSHBUTTON m_BtnPalette; 00123 FORM_COLORBUTTON m_ColorBtn; 00124 FORM_EDIT_NUMBER m_TransparencyEN; 00125 const COLORPALETTE *m_pColorPalette; 00126 00127 void DrawHighlight (int palindex, bool set); 00128 void DrawPalette (); 00129 void NotifyChangeColor (); 00130 void OnCmdColor (); 00131 void OnCmdPalette (); 00132 void OnEditTransparency (); 00133 void OnPaletteLeftDown (MGUI::POINT point); 00134 void OnPalettePaint (MGD::CONTEXT *gc); 00135 00136 FORM_COLORSELECTOR (const FORM_COLORSELECTOR&); 00137 FORM_COLORSELECTOR& operator= (const FORM_COLORSELECTOR&); 00138 #endif // GENERATING_DOXYGEN_OUTPUT 00139 }; 00140 00141 #ifndef GENERATING_DOXYGEN_OUTPUT 00142 DEFINE_ENUM_OP_BITWISE(FORM_COLORSELECTOR::FORMSTYLE) 00143 #endif 00144 00145 } // End of MGUI namespace 00146 00147 00148 #endif // INC_MGUI_COLORSEL_H
1.6.1