[10587] | 1 | /* $Id: win32class.h,v 1.18 2004-04-20 10:11:43 sandervl Exp $ */
|
---|
[2469] | 2 | /*
|
---|
| 3 | * Win32 Window Class Managment Code for OS/2
|
---|
| 4 | *
|
---|
| 5 | *
|
---|
| 6 | * Copyright 1998-1999 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
| 7 | * Copyright 1999 Daniela Engert (dani@ngrt.de)
|
---|
| 8 | *
|
---|
| 9 | */
|
---|
| 10 | #ifndef __WIN32CLASS_H__
|
---|
| 11 | #define __WIN32CLASS_H__
|
---|
| 12 |
|
---|
[21916] | 13 | #include "gen_object.h"
|
---|
[2469] | 14 |
|
---|
[5935] | 15 | #define RELEASE_CLASSOBJ(a) { a->release(); a = NULL; }
|
---|
| 16 |
|
---|
[9523] | 17 | typedef enum {
|
---|
| 18 | WNDCLASS_ASCII,
|
---|
| 19 | WNDCLASS_UNICODE
|
---|
| 20 | } WNDCLASS_TYPE;
|
---|
| 21 |
|
---|
| 22 | typedef enum {
|
---|
| 23 | WNDPROC_ASCII,
|
---|
| 24 | WNDPROC_UNICODE
|
---|
| 25 | } WNDPROC_TYPE;
|
---|
| 26 |
|
---|
[2469] | 27 | class Win32WndClass : public GenericObject
|
---|
| 28 | {
|
---|
| 29 | public:
|
---|
[9523] | 30 | Win32WndClass(WNDCLASSEXA *wndclass, WNDCLASS_TYPE fClassType = WNDCLASS_ASCII);
|
---|
[2469] | 31 | ~Win32WndClass();
|
---|
| 32 |
|
---|
[9568] | 33 | ULONG getClassLongA(int index, BOOL fUnicode = FALSE);
|
---|
[2469] | 34 | ULONG getClassLongW(int index)
|
---|
| 35 | {
|
---|
| 36 | return getClassLongA(index, TRUE);
|
---|
| 37 | };
|
---|
| 38 | WORD getClassWord(int index);
|
---|
| 39 |
|
---|
[9568] | 40 | ULONG setClassLongA(int index, LONG lNewVal, BOOL fUnicode = FALSE);
|
---|
[2469] | 41 | ULONG setClassLongW(int index, LONG lNewVal)
|
---|
| 42 | {
|
---|
| 43 | return setClassLongA(index, lNewVal, TRUE);
|
---|
| 44 | }
|
---|
| 45 | WORD setClassWord(int index, WORD wNewVal);
|
---|
| 46 |
|
---|
| 47 | ATOM getAtom() { return (ATOM) classAtom; };
|
---|
| 48 | BOOL getClassInfo(WNDCLASSEXA *wndclass);
|
---|
| 49 | BOOL getClassInfo(WNDCLASSEXW *wndclass);
|
---|
| 50 |
|
---|
| 51 | ULONG getClassName(LPSTR lpszClassName, ULONG cchClassName);
|
---|
| 52 | ULONG getClassName(LPWSTR lpszClassName, ULONG cchClassName);
|
---|
| 53 |
|
---|
[9523] | 54 | WNDPROC getWindowProc(WNDPROC_TYPE type);
|
---|
| 55 | //NOTE: Only to be used when a class has both ascii & unicode window procedures!
|
---|
| 56 | void setWindowProc(WNDPROC pfnWindowProc, WNDPROC_TYPE type);
|
---|
| 57 |
|
---|
[2469] | 58 | LPSTR getMenuNameA() { return menuNameA; };
|
---|
[5242] | 59 | DWORD getExtraWndBytes() { return nrExtraWindowBytes; };
|
---|
[2469] | 60 |
|
---|
| 61 | HICON getIcon() { return hIcon; };
|
---|
[3153] | 62 | HICON getIconSm() { return hIconSm; };
|
---|
[2469] | 63 | HCURSOR getCursor() { return hCursor; };
|
---|
| 64 |
|
---|
[2834] | 65 | HINSTANCE getInstance() { return hInstance; };
|
---|
| 66 |
|
---|
[2469] | 67 | HBRUSH getBackgroundBrush() { return backgroundBrush; };
|
---|
| 68 | ULONG getStyle() { return windowStyle; };
|
---|
| 69 |
|
---|
[2834] | 70 | HDC getClassDC() { return hdcClass; };
|
---|
[2672] | 71 |
|
---|
[2469] | 72 | void setMenuName(LPSTR newMenuName);
|
---|
| 73 |
|
---|
[9523] | 74 | BOOL hasClassName(LPSTR classname, BOOL fUnicode);
|
---|
[2469] | 75 |
|
---|
| 76 | BOOL isAppClass(ULONG curProcessId);
|
---|
| 77 |
|
---|
[5056] | 78 | static BOOL UnregisterClassA(HINSTANCE hinst, LPSTR id);
|
---|
[2469] | 79 |
|
---|
[5935] | 80 | //Locates class in linked list and increases reference count (if found)
|
---|
| 81 | //Class object must be unreferenced after usage
|
---|
[2469] | 82 | static Win32WndClass *FindClass(HINSTANCE hinst, LPSTR id);
|
---|
[3702] | 83 | static Win32WndClass *FindClass(HINSTANCE hinst, LPWSTR id);
|
---|
| 84 |
|
---|
[2469] | 85 | static void DestroyAll();
|
---|
| 86 |
|
---|
| 87 | private:
|
---|
[9523] | 88 | WNDCLASS_TYPE fClassType;
|
---|
[2469] | 89 |
|
---|
| 90 | //Standard class words/longs
|
---|
| 91 | ULONG windowStyle; //GCL_STYLE * must be offset 14h *
|
---|
[5242] | 92 | ULONG nrExtraClassBytes; //GCL_CBCLSEXTRA
|
---|
| 93 | ULONG nrExtraWindowBytes; //GCL_CBWNDEXTRA
|
---|
[2469] | 94 | HBRUSH backgroundBrush; //GCL_HBRBACKGROUND
|
---|
| 95 | HCURSOR hCursor; //GCL_HCURSOR
|
---|
| 96 | HICON hIcon; //GCL_HICON
|
---|
| 97 | HINSTANCE hInstance; //GCL_HMODULE
|
---|
| 98 | PCHAR menuNameA; //GCL_MENUNAME
|
---|
| 99 | WCHAR *menuNameW; //GCL_MENUNAME
|
---|
[9523] | 100 | WNDPROC pfnWindowProcA; //GCL_WNDPROC
|
---|
| 101 | WNDPROC pfnWindowProcW; //GCL_WNDPROC
|
---|
[2469] | 102 | ULONG classAtom; //GCW_ATOM
|
---|
| 103 |
|
---|
| 104 | PCHAR classNameA;
|
---|
| 105 | WCHAR *classNameW;
|
---|
[3153] | 106 | HICON hIconSm; //GCW_HICONSM
|
---|
[2672] | 107 | HDC hdcClass;
|
---|
[2469] | 108 |
|
---|
[5242] | 109 | //User data class bytse
|
---|
| 110 | char *userClassBytes;
|
---|
[2469] | 111 | ULONG processId;
|
---|
| 112 |
|
---|
| 113 | static GenericObject *wndclasses;
|
---|
[10587] | 114 | static VMutex critsect;
|
---|
[2469] | 115 | };
|
---|
| 116 |
|
---|
[9523] | 117 | ATOM WIN32API InternalRegisterClass(LPSTR lpszClassName, DWORD dwStyle,
|
---|
| 118 | WNDPROC pfnClassA, WNDPROC pfnClassW,
|
---|
| 119 | UINT cbExtraWindowWords, LPCSTR lpszCursor,
|
---|
| 120 | HBRUSH hBrush);
|
---|
| 121 |
|
---|
[2469] | 122 | #endif //__WIN32CLASS_H__
|
---|