www.pudn.com > 1.rar > I2BaseWB.h


// BaseWB.h: interface for the CBaseWB class. 
#ifndef _IASP2WHITEBOARDBASEWHITEBOARDINCLUDEFILE_H_ 
#define _IASP2WHITEBOARDBASEWHITEBOARDINCLUDEFILE_H_ 
#include "iaspwb.h" 
 
#include "I2BaseCtrl.h" 
#include "I2BaseCSet.h" 
 
#define WB32CLASSNAME "iaspwb32" 
#define MAX_WBNAME           64 
 
//change selected rect 
//for resizehandle 
#define RH_NONE                0 
#define RH_TOP                 1 
#define RH_BOTTOM              2 
#define RH_LEFT                3 
#define RH_RIGHT               4 
#define RH_TOPLEFT             5 
#define RH_TOPRIGHT            6 
#define RH_BOTTOMLEFT          7 
#define RH_BOTTOMRIGHT         8 
 
//for selected rect's status 
#define RS_NONE                0 
#define RS_NORMAL              1 
#define RS_MOVE                2 
#define RS_MOVING              3 
#define RS_RESIZING            4 
 
//size of hot area radius(pixel) 
#define HOTSIZER               5 
#define RCMINSIZE              1 
 
 
//control state 
#define CTRLSTATE_NORMAL    0x00 
#define CTRLSTATE_SELECT    0x01 
#define CTRLSTATE_LOCKED    0x02 
 
typedef enum tagWhiteBoardState 
{ 
wbsNone, 
wbsDragControl, 
wbsRangeSelect, 
wbsControlTrackPoint, 
wbsWBTrackPoint, 
wbsControlTrackRect, 
wbsWBTrackRect, 
wbsControlTrackClick, 
wbsWBTrackClick, 
wbsInplaceEditorActive, 
wbsCreateControl 
}WhiteBoardState; 
 
//-----CCtrlList-----// 
template class I2List; 
class CCtrlList:public I2List 
{ 
public: 
//CCtrlList():I2List(&_g_i2wbheapallocate){}; 
INT IndexOf(VOID* p) 
{ 
INT i; 
for(i=0;iCI2WBBaseWB is the class for the digital white board.   
@It provides functions to handle white board controls

@@ */ class CI2WBBaseWB : public I2Wnd { #define CLASSNAME_CI2WBBASEWB "CI2WBBaseWB" public: INT m_width; INT m_height; WhiteBoardState m_wbs; //del white board,close property dialog BOOL m_dlgexist; //if show a control's property dialog box, set 1 I2Dialog* m_propdlg; //if m_dlgexist=1, pointer of dialog object /**function @@Remarks @use processMessage to process white board window message. @@ */ virtual BOOL processMessage(UINT uMsg,WPARAM wParam,LPARAM lParam); /**function @@Remarks @use fillClassInfo to register white board window class. @@ */ virtual void fillClassInfo(LPWNDCLASSEX pwcx); /**function @@Remarks @use recv to process white board data from server. @called by CI2WBBaseWBSet::recv(); @@ */ void recv(VOID *p,INT len); /**function @@Remarks @use unlock to unlock white board control. @called by CI2WBBaseWBSet::unlock(); @@ */ void unlock(); /**function @@Remarks @use lock to lock white board control. @called by CI2WBBaseWBSet::lock(); @@ */ void lock(); /**function @@Remarks @use sendToBack to set selected white board control to bottom. @called by CI2WBBaseWBSet::sendToBack(); @@ */ void sendToBack(); /**function @@Remarks @use bringToFront to set selected white board control to top. @called by CI2WBBaseWBSet::bringToFront(); @@ */ void bringToFront(); /**function @@Remarks @use deleteControl to delete selected white board controls. @called by CI2WBBaseWBSet::del(); @@ */ void deleteControl(); /**function @@Remarks @use OnAttribChange to delete selected white board controls. @called by CI2WBBaseWBSet::del(); @@ */ VOID OnAttribChange(INT type); VOID get_LineWidth(INT* Value); VOID get_LineStyle(INT* Value); VOID get_Color(COLORREF* Value); VOID get_BKColor(COLORREF* Value); VOID get_Font(LPWB32FONT Value,INT mask); VOID get_Name(CHAR* value); VOID set_Name(CHAR* value); BOOL get_Sync(); VOID set_Sync(BOOL value); VOID cut(); VOID copy(); VOID paste(); VOID copyWb(); VOID pasteWb(); VOID drawIndicate(INT x,INT y,BOOL fchanged,BOOL fsend); VOID getStateControlList(I2List& l,DWORD state); HFONT createWBFont(LPWB32FONT pwbfont); VOID OnCSIDChange(GUID oldcsid,GUID newcsid); VOID OnDragFile(const I2String& filename,I2Point p); VOID save(I2MemoryFileStream& stm); VOID load(SHORT x,SHORT y,VOID* p,INT len,bool grouped); VOID closeInplaceEditor(VOID); CI2WBBaseWB(VOID* wbset); ~CI2WBBaseWB(); //inherit from I2Wnd EMPTY_I2OBJECT_IMPLEMENT(CI2WBBaseWB,CLASSNAME_CI2WBBASEWB,I2Wnd) char* toString(void) { return strdup("iasp2 white board object"); } protected: VOID OnLButtonDown(DWORD fwKeys,SHORT x,SHORT y); VOID OnLButtonUp(DWORD fwKeys,SHORT x,SHORT y); VOID OnMouseMove(DWORD fwKeys,SHORT x,SHORT y); VOID OnRButtonDown(DWORD fwKeys,SHORT x,SHORT y); VOID OnRButtonUp(DWORD fwKeys,SHORT x,SHORT y); VOID OnLButtonDBLCLK(DWORD fwKeys,SHORT x,SHORT y); VOID OnPaint(HDC hdc); BOOL createWBControl(CI2WBBaseCSet* pawcs,INT cid,CI2WBBaseCtrl** ppawc,LPSTR name,LPSTR grpname); BOOL dealWithClickControl(DWORD fwKeys,INT x,INT y); BOOL unselectAllControl(VOID); VOID drawDragBorders(HDC hdc,INT sx,INT sy,INT cx,INT cy); VOID OnDragControl(INT offsetx,INT offsety); VOID beginWBTrackRect(INT x,INT y); VOID WBTrackRect(INT x,INT y); VOID endWBTrackRect(VOID); VOID OnRangeSelect(RECT* r); VOID drawSelectedRect(HDC hdc,RECT* r,INT grouped); VOID drawLockedRect(HDC hdc,RECT* r); VOID getUniqueName(LPSTR buf); INT bin2asc(UCHAR *pBin,INT iLen,UCHAR *pAsc); VOID writeHeader(I2MemoryFileStream *stm,DWORD datacode,INT count,INT attrib); VOID drawRemotePoint(HDC hdc,INT x,INT y); VOID adjustPoints(SHORT* x,SHORT* y); BOOL nameIs(const I2String& name1,const I2String& name2); BOOL dealWithEditorControl(INT x,INT y); VOID openInplaceEditor(LPWB32FONT pfont,POINT pos,LPSTR text,CI2WBBaseCtrl* editoruser); VOID calculateEditSize(INT* width,INT* height); VOID OnCommand(WORD wNotifyCode,WORD wID,HWND hwndCtl); VOID dragRectMM(SHORT x,SHORT y); VOID dragRectLD(SHORT x,SHORT y,INT i); VOID dragRectLU(SHORT x,SHORT y); VOID OnLoseCapture(); VOID CancelCurrectState(INT x,INT y); POINT m_pttrackstart; VOID* m_wbset; CCtrlList m_controllist; CI2WBBaseCtrl* m_curcontrol; BOOL m_existeditor; CI2WBBaseCtrl* m_editoruser; HWND m_heditwnd; HFONT m_heditfont; char m_wbname[MAX_WBNAME]; BOOL m_sync; // HDC m_tmphdc; // HPEN m_tmphpen; // HBRUSH m_tmphbrush; INT m_tmpstartx,m_tmpstarty,m_tmpoldx,m_tmpoldy; INT iResizeHandle; //which resizehandle is select INT iRectStatus; //what is the selected rect's status LPCTSTR lpMouseStatus; POINT pPrevPos; RECT rcTempPrev; I2Rect m_rect; }; #endif