00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _CCLICENSELOCATIONWND_H_
00028 #define _CCLICENSELOCATIONWND_H_
00029
00031 #define UM_LICENSEMOVED (WM_USER + 0x3F1)
00032
00036 class CCLicenseLocationWnd
00037 {
00038 public:
00039
00045 CCLicenseLocationWnd(SIZE szPage, RECT rectLocation) : m_hWnd(NULL), m_szPage(szPage), m_rectLocation(rectLocation), m_bDragging(false), m_hBmp(NULL) {};
00046
00048 ~CCLicenseLocationWnd();
00049
00050 protected:
00051
00053 HWND m_hWnd;
00055 SIZE m_szPage;
00057 RECT m_rectLocation;
00059 RECT m_rectPageView;
00061 RECT m_rectLicenseView;
00063 HBITMAP m_hBmp;
00065 SIZE m_szBitmap;
00066
00067
00069 bool m_bDragging;
00071 SIZE m_szOffset;
00072
00073
00075 static ATOM m_aClass;
00077 static int m_nCount;
00078
00079
00080 public:
00081
00083 BOOL CreateWnd(LPCTSTR lpName, DWORD dwStyle, const RECT& rect, HWND hParent);
00088 POINT GetLicenseLocation() const {POINT pt; pt.x = XtoPercent(m_rectLocation.left); pt.y = YtoPercent(m_rectLocation.top); return pt;};
00089
00090 LONG XtoPercent (LONG x) const;
00091 LONG XfromPercent (LONG x) const;
00092 LONG YtoPercent (LONG x) const;
00093 LONG YfromPercent (LONG x) const;
00094
00096 void SetXLocation(UINT uX);
00098 void SetYLocation(UINT uY);
00099
00100 protected:
00101
00103 static bool RegisterWindowClass();
00105 static void UnregisterWindowClass();
00107 static void UnregisterWindowClassNow();
00108
00109
00111 void CalcLicenseViewLocation();
00113 void MoveLicense(POINT pt);
00115 void SendLicenseLocationMsg();
00117 void UpdateLocation();
00118
00119
00121 virtual LRESULT ProcessMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
00125 virtual void PostDestroy() {};
00126
00127
00129 static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
00130 };
00131
00132 #endif //#define _CCLICENSELOCATIONWND_H_