00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #pragma once
00017 #include "maxheap.h"
00018 #include "coreexp.h"
00019 #include <WTypes.h>
00020 #include "acolor.h"
00021 #include "ipoint2.h"
00022 #include "baseinterface.h"
00023 #include "strbasic.h"
00024
00025 #define MAXCOLORS 16
00026
00027
00028
00029
00030
00035 #pragma warning(push)
00036 #pragma warning(disable:4100)
00037
00038 class HSVCallback : public MaxHeapOperators {
00039 public:
00041 virtual ~HSVCallback() {;}
00045 virtual void ButtonDown() {}
00053 virtual void ButtonUp(BOOL accept) {}
00062 virtual void ColorChanged(DWORD col, BOOL buttonUp) {}
00071 virtual void ColorChanged(AColor col, BOOL ButtonUp) {}
00076 virtual void BeingDestroyed(IPoint2 pos)=0;
00081 CoreExport virtual void OnOK();
00086 CoreExport virtual void OnCancel();
00087 };
00088
00089
00110 extern CoreExport INT_PTR HSVDlg_Do(
00111 HWND hwndOwner,
00112 DWORD* lpc,
00113 IPoint2* spos,
00114 HSVCallback* callBack,
00115 MCHAR* name
00116 );
00117
00118
00136 extern CoreExport INT_PTR HSVDlg_Do(
00137 HWND hwndOwner,
00138 AColor *lpc,
00139 IPoint2 *spos,
00140 HSVCallback *callBack,
00141 MCHAR *name
00142 );
00143
00144 CoreExport void RGBtoHSV (DWORD rgb, int *ho, int *so, int *vo);
00145 CoreExport DWORD HSVtoRGB (int H, int S, int V);
00146 CoreExport void HSVtoHWBt (int h, int s, int v, int *ho, int *w, int *bt);
00147 CoreExport void HWBttoHSV (int h, int w, int bt, int *ho, int *s, int *v);
00148
00149
00150 class Color;
00151 CoreExport Color RGBtoHSV(Color rgb);
00152 CoreExport Color HSVtoRGB(Color hsv);
00153
00154
00155
00165 class ColorPicker : public InterfaceServer {
00166 protected:
00168 ~ColorPicker() {}
00169 public:
00171 ColorPicker() {}
00177 virtual void ModifyColor (DWORD color)=0;
00184 virtual void SetNewColor (DWORD color, MCHAR *name)=0;
00186 virtual DWORD GetColor()=0;
00189 virtual IPoint2 GetPosition()=0;
00191 virtual void Destroy()=0;
00201 virtual void InstallNewCB(DWORD col, HSVCallback *pcb, MCHAR *name)=0;
00205 virtual void RefreshUI() {}
00206
00207
00208
00214 virtual void ModifyColor(AColor color){}
00215
00222 virtual void SetNewColor(AColor, MCHAR * name){}
00223
00226 virtual AColor GetAColor(){return AColor(0,0,0,0);}
00227
00237 virtual void InstallNewCB(AColor col, HSVCallback *pcb, MCHAR *name){}
00238
00239
00242 CoreExport virtual RECT GetRect()const;
00243
00250 CoreExport virtual bool IsColorSamplerMode()const;
00251 };
00252
00253
00272 CoreExport ColorPicker *CreateColorPicker(HWND hwndOwner, DWORD initColor,
00273 IPoint2* spos, HSVCallback *pcallback, MCHAR *name, int objClr=0);
00274
00275
00276
00277
00278 CoreExport ColorPicker *CreateColorPicker(HWND hwndOwner, AColor initColor,
00279 IPoint2* spos, HSVCallback *pcallback, MCHAR *name, int objClr=0);
00280
00285 CoreExport void SetCPInitPos(IPoint2 &pos);
00289 CoreExport IPoint2 GetCPInitPos(void);
00290
00291 #define WM_ADD_COLOR (WM_USER+2321) // wParam = color
00292
00293
00294
00295
00296
00297
00310 class ColPick : public InterfaceServer {
00311 public:
00312
00313 virtual INT_PTR ModalColorPicker(
00314 HWND hwndOwner,
00315 DWORD *lpc,
00316 IPoint2 *spos,
00317 HSVCallback *callBack,
00318 MCHAR *name
00319 )=0;
00335 virtual INT_PTR ModalColorPicker(
00336 HWND hwndOwner,
00337 AColor *lpc,
00338 IPoint2 *spos,
00339 HSVCallback *callBack,
00340 MCHAR *name
00341 ){return 0;}
00342
00343
00361 virtual ColorPicker *CreateColorPicker(
00362 HWND hwndOwner,
00363 DWORD initColor,
00364 IPoint2* spos,
00365 HSVCallback *pcallback,
00366 MCHAR *name,
00367 BOOL isObjectColor=FALSE)=0;
00368
00385 virtual ColorPicker *CreateColorPicker(
00386 HWND hwndOwner,
00387 AColor initColor,
00388 IPoint2* spos,
00389 HSVCallback *pcallback,
00390 MCHAR *name,
00391 BOOL isObjectColor=FALSE){return NULL;}
00392
00395 virtual const MCHAR* ClassName()=0;
00398 virtual Class_ID ClassID()=0;
00400 virtual void DeleteThis()=0;
00402 virtual INT_PTR Execute(int cmd, ULONG_PTR arg1=0, ULONG_PTR arg2=0, ULONG_PTR arg3=0)=0;
00403 };
00404
00405 #pragma warning(pop)
00406
00407
00408
00409 #define DEFAULT_COLPICK_CLASS_ID 1
00410
00411
00412
00413
00421 CoreExport ColPick *SetCurColPick(ColPick *colpick);
00424 CoreExport ColPick *GetCurColPick();
00425
00426
00427
00428
00429