home *** CD-ROM | disk | FTP | other *** search
-
- #ifndef _COMCTLHD_H
- #define _COMCTLHD_H
-
- //control id's for dynamically created controls (CreateWindowEx)
- #define TREEVIEW_CONTROL_ID 3002
- #define STATUSBAR_CONTROL_ID 3003
-
-
- // ASSERT
- #ifndef _ASSERT
- #define _ASSERT
- #ifdef _DEBUG
- #define ASSERT(f) if(!(f)) DebugBreak();
- #else
- #define ASSERT(f)
- #endif // _DEBUG
- #endif // _ASSERT
-
- //structure used to pass TV_ITEM data member values to other routines
- struct TVDATA
- {
- int imgIndex; //TV_ITEM.iImage
- int imgIndexSelected; //TV_ITEM.iSelectedImage
- HTREEITEM hParent; //TV_INSERTSTRUCT.hParent
- };
-
- typedef TVDATA * LPTVDATA;
-
- //helper macro for setting structure element values
- #define SETTVDATA(tvdata, imgIx, imgIxSel, hParen) \
- {\
- (tvdata).imgIndex = imgIx; \
- (tvdata).imgIndexSelected = imgIxSel; \
- (tvdata).hParent = hParen; \
- }
-
- struct TVNODEINFO {
- DWORD dwAttributes; //file attributes (zero for root level ftp sites)
- BOOL enumflag; //has the directory been enumerated
- int index; //index location of root level node associated with this item
- int requestType; //application defined REQUEST_INTERNET* value
- int key; //random number generated as key value for retrieval
- TCHAR pszSite[MAX_PATH]; //site name - full URL
- TCHAR pszServer[80]; //server name
- TCHAR pszDir[MAX_PATH]; //full directory path
- TCHAR pszFile[MAX_PATH]; //filename - text of TreeView item
- TCHAR pszFileTarget[80]; //for Ftp get only - target filename
- //internet handles
- HINTERNET hConnect, hEnum, hFile;
- HTREEITEM hTreeItem;
- //pointer to other specific data - ended up as pointer to
- //WIN32_FIND_DATA structure
- LPVOID prequestResult;
- };
-
- typedef TVNODEINFO * LPTVNODEINFO;
-
- //helper macro for setting structure element values
- #define SETTVNODEINFO(tvnodei, dwAttr, enumbool, handle, strSite, indx, ihType, prq, strDir) \
- {\
- (tvnodei).dwAttributes = dwAttr;\
- (tvnodei).enumflag = enumbool;\
- (tvnodei).hConnect = handle;\
- lstrcpy((tvnodei).pszSite, strSite);\
- (tvnodei).index = indx;\
- (tvnodei).requestType = ihType;\
- (tvnodei).prequestResult = prq; \
- lstrcpy((tvnodei).pszDir, strDir); \
- }
-
- class Clist;
- class CDlg;
-
- class CCommonCtrl
- {
- friend CDlg;
- protected:
- HINSTANCE m_hInst;
- HWND m_hWndParent;
- HBITMAP m_hb[3]; //imagelist bitamps
- HIMAGELIST m_himg; //imagelist handle
- HWND m_hWndTV;
- //each root level ftp site in the treeview is represented by a
- //Clist object which manages the linked list of all its child
- //items
- Clist *m_prootlvl[10];
- int m_icount;
-
- //not really appropriate for CCommonCtrl class but these
- //variables are used with TVNODEINFO data
- WIN32_FIND_DATA m_FindData;
- HTREEITEM m_hTreeItem;
- public:
- BOOL ImageListInit();
- HTREEITEM TreeViewAdd(TCHAR *, LPTVDATA, LPTVNODEINFO, LPDWORD);
- HTREEITEM TreeViewParent(HTREEITEM, LPTV_ITEM, UINT, LPTSTR);
- BOOL TreeViewItem(HTREEITEM, LPTV_ITEM, UINT, LPTSTR);
- CCommonCtrl(HINSTANCE, HWND);
- ~CCommonCtrl();
-
- };
-
- #endif