| 1 | /* $Id: CCBase.h,v 1.13 2001-05-22 09:32:27 sandervl Exp $ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * COMCTL32 Base Functions and Macros for all Controls | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright 2000 Christoph Bratschi (cbratschi@datacomm.ch) | 
|---|
| 6 | */ | 
|---|
| 7 | #ifndef __CCBASE_H | 
|---|
| 8 | #define __CCBASE_H | 
|---|
| 9 |  | 
|---|
| 10 | #include <heapstring.h> | 
|---|
| 11 |  | 
|---|
| 12 | #define getInfoPtr(hwnd) ((COMCTL32_HEADER*)GetWindowLongA(hwnd,0)) | 
|---|
| 13 | #define setInfoPtr(hwnd,infoPtr) (SetWindowLongA(hwnd,0,(DWORD)infoPtr)) | 
|---|
| 14 |  | 
|---|
| 15 | typedef struct | 
|---|
| 16 | { | 
|---|
| 17 | DWORD dwSize;        //whole structure size | 
|---|
| 18 | INT   iVersion;      //version | 
|---|
| 19 | BOOL  fUnicode;      //Unicode flag | 
|---|
| 20 | UINT  uNotifyFormat; //notify format | 
|---|
| 21 | HWND  hwndNotify;    //notify window | 
|---|
| 22 | } COMCTL32_HEADER; | 
|---|
| 23 |  | 
|---|
| 24 | #ifdef __cplusplus | 
|---|
| 25 | extern "C" { | 
|---|
| 26 | #endif | 
|---|
| 27 |  | 
|---|
| 28 | PVOID initControl(HWND hwnd,DWORD dwSize); | 
|---|
| 29 | VOID doneControl(HWND hwnd); | 
|---|
| 30 |  | 
|---|
| 31 | LRESULT defComCtl32ProcA(HWND hwnd,UINT Msg,WPARAM wParam,LPARAM lParam); | 
|---|
| 32 | LRESULT defComCtl32ProcW(HWND hwnd,UINT Msg,WPARAM wParam,LPARAM lParam); | 
|---|
| 33 |  | 
|---|
| 34 | #ifdef __cplusplus | 
|---|
| 35 | } | 
|---|
| 36 | #endif | 
|---|
| 37 |  | 
|---|
| 38 | BOOL isUnicodeNotify(COMCTL32_HEADER *infoPtr); | 
|---|
| 39 | #ifdef __cplusplus | 
|---|
| 40 | BOOL isUnicodeNotify(HWND hwnd); | 
|---|
| 41 | #endif | 
|---|
| 42 |  | 
|---|
| 43 | HWND getNotifyWindow(COMCTL32_HEADER *infoPtr); | 
|---|
| 44 |  | 
|---|
| 45 | LRESULT sendNotify(HWND hwnd,UINT code); | 
|---|
| 46 | #ifdef __cplusplus | 
|---|
| 47 | LRESULT sendNotify(HWND hwndFrom,HWND hwndTo,UINT code); | 
|---|
| 48 | LRESULT sendNotify(HWND hwnd,UINT code,LPNMHDR nmhdr); | 
|---|
| 49 | LRESULT sendNotify(HWND hwndFrom,HWND hwndTo,UINT code,LPNMHDR nmhdr); | 
|---|
| 50 | #endif | 
|---|
| 51 | LRESULT sendNotifyFormat(HWND hwnd,HWND hwndFrom,LPARAM command); | 
|---|
| 52 | LRESULT sendCommand(HWND hwnd,UINT wNotifyCode); | 
|---|
| 53 | LRESULT sendHScroll(HWND hwnd,UINT wNotifyCode); | 
|---|
| 54 | LRESULT sendVScroll(HWND hwnd,UINT wNotifyCode); | 
|---|
| 55 |  | 
|---|
| 56 | #ifdef __cplusplus | 
|---|
| 57 | extern "C" { | 
|---|
| 58 | #endif | 
|---|
| 59 | HWND createToolTip(HWND hwnd,UINT flags,BOOL addtool); | 
|---|
| 60 | VOID destroyToolTip(HWND hwndToolTip); | 
|---|
| 61 | #ifdef __cplusplus | 
|---|
| 62 | } | 
|---|
| 63 | #endif | 
|---|
| 64 |  | 
|---|
| 65 | VOID drawStubControl(HWND hwnd,HDC hdc); | 
|---|
| 66 |  | 
|---|
| 67 | #define lstrlenAW(text,unicode) (unicode ? lstrlenW((WCHAR*)text):lstrlenA((CHAR*)text)) | 
|---|
| 68 |  | 
|---|
| 69 | #define lstrcpyAW(textA,unicodeA,textB,unicodeB) (unicodeA ? (unicodeB ? lstrcpyW((WCHAR*)textA,(WCHAR*)textB):lstrcpyAtoW((WCHAR*)textA,(CHAR*)textB)):(unicodeB ? lstrcpyWtoA((CHAR*)textA,(WCHAR*)textB):lstrcpyA((CHAR*)textA,(CHAR*)textB))) | 
|---|
| 70 |  | 
|---|
| 71 | INT lstrcmpAtoW(CHAR *textA,WCHAR *textW); | 
|---|
| 72 | INT lstrcmpAW(WCHAR *textA,BOOL textaunicode,WCHAR *textB,BOOL textbunicode); | 
|---|
| 73 |  | 
|---|
| 74 |  | 
|---|
| 75 | //read note in CCBase.cpp!! | 
|---|
| 76 | INT lstrcmpniA(CHAR *textA,CHAR *textB,INT len); | 
|---|
| 77 | INT lstrcmpniAtoW(CHAR *textA,WCHAR* textB,INT len); | 
|---|
| 78 | ////INT lstrcmpniW(WCHAR *textA,WCHAR *textB,INT len); | 
|---|
| 79 | INT lstrcmpniAW(WCHAR *textA,BOOL unicodeA,WCHAR *textB,BOOL unicodeB,INT len); | 
|---|
| 80 |  | 
|---|
| 81 | CHAR*  lstrstrA(CHAR *text,CHAR *subtext); | 
|---|
| 82 | WCHAR* lstrstrW(WCHAR *text,WCHAR *subtext); | 
|---|
| 83 | CHAR*  lstrstrAtoW(CHAR *text,WCHAR *subtext); | 
|---|
| 84 | WCHAR* lstrstrWtoA(WCHAR *text,CHAR *subtext); | 
|---|
| 85 | WCHAR* lstrstrAW(WCHAR *text,BOOL textunicode,WCHAR *subtext,BOOL subtextunicode); | 
|---|
| 86 |  | 
|---|
| 87 | #define TICKDIFF(start,end) ((end > start) ? (end-start):(0xFFFFFFFF-start+end)) | 
|---|
| 88 |  | 
|---|
| 89 |  | 
|---|
| 90 | #endif | 
|---|