1 | /* $Id: win32class.h,v 1.15 2001-06-09 14:50:20 sandervl Exp $ */
|
---|
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 |
|
---|
13 | #include <gen_object.h>
|
---|
14 |
|
---|
15 | #define RELEASE_CLASSOBJ(a) { a->release(); a = NULL; }
|
---|
16 |
|
---|
17 | class Win32WndClass : public GenericObject
|
---|
18 | {
|
---|
19 | public:
|
---|
20 | Win32WndClass(WNDCLASSEXA *wndclass, BOOL fUnicode = FALSE);
|
---|
21 | ~Win32WndClass();
|
---|
22 |
|
---|
23 | ULONG getClassLongA(int index, BOOL fUnicode = FALSE);
|
---|
24 | ULONG getClassLongW(int index)
|
---|
25 | {
|
---|
26 | return getClassLongA(index, TRUE);
|
---|
27 | };
|
---|
28 | WORD getClassWord(int index);
|
---|
29 |
|
---|
30 | ULONG setClassLongA(int index, LONG lNewVal, BOOL fUnicode = FALSE);
|
---|
31 | ULONG setClassLongW(int index, LONG lNewVal)
|
---|
32 | {
|
---|
33 | return setClassLongA(index, lNewVal, TRUE);
|
---|
34 | }
|
---|
35 | WORD setClassWord(int index, WORD wNewVal);
|
---|
36 |
|
---|
37 | ATOM getAtom() { return (ATOM) classAtom; };
|
---|
38 | BOOL getClassInfo(WNDCLASSEXA *wndclass);
|
---|
39 | BOOL getClassInfo(WNDCLASSEXW *wndclass);
|
---|
40 |
|
---|
41 | ULONG getClassName(LPSTR lpszClassName, ULONG cchClassName);
|
---|
42 | ULONG getClassName(LPWSTR lpszClassName, ULONG cchClassName);
|
---|
43 |
|
---|
44 | WNDPROC getWindowProc() { return windowProc; };
|
---|
45 | LPSTR getMenuNameA() { return menuNameA; };
|
---|
46 | DWORD getExtraWndBytes() { return nrExtraWindowBytes; };
|
---|
47 |
|
---|
48 | HICON getIcon() { return hIcon; };
|
---|
49 | HICON getIconSm() { return hIconSm; };
|
---|
50 | HCURSOR getCursor() { return hCursor; };
|
---|
51 |
|
---|
52 | HINSTANCE getInstance() { return hInstance; };
|
---|
53 |
|
---|
54 | HBRUSH getBackgroundBrush() { return backgroundBrush; };
|
---|
55 | ULONG getStyle() { return windowStyle; };
|
---|
56 |
|
---|
57 | HDC getClassDC() { return hdcClass; };
|
---|
58 |
|
---|
59 | void setMenuName(LPSTR newMenuName);
|
---|
60 |
|
---|
61 | BOOL hasClassName(LPSTR classname, BOOL fUnicode = FALSE);
|
---|
62 |
|
---|
63 | BOOL isAppClass(ULONG curProcessId);
|
---|
64 |
|
---|
65 | static BOOL UnregisterClassA(HINSTANCE hinst, LPSTR id);
|
---|
66 |
|
---|
67 | //Locates class in linked list and increases reference count (if found)
|
---|
68 | //Class object must be unreferenced after usage
|
---|
69 | static Win32WndClass *FindClass(HINSTANCE hinst, LPSTR id);
|
---|
70 | static Win32WndClass *FindClass(HINSTANCE hinst, LPWSTR id);
|
---|
71 |
|
---|
72 | static void DestroyAll();
|
---|
73 |
|
---|
74 | private:
|
---|
75 | BOOL isUnicode;
|
---|
76 |
|
---|
77 | //Standard class words/longs
|
---|
78 | ULONG windowStyle; //GCL_STYLE * must be offset 14h *
|
---|
79 | ULONG nrExtraClassBytes; //GCL_CBCLSEXTRA
|
---|
80 | ULONG nrExtraWindowBytes; //GCL_CBWNDEXTRA
|
---|
81 | HBRUSH backgroundBrush; //GCL_HBRBACKGROUND
|
---|
82 | HCURSOR hCursor; //GCL_HCURSOR
|
---|
83 | HICON hIcon; //GCL_HICON
|
---|
84 | HINSTANCE hInstance; //GCL_HMODULE
|
---|
85 | PCHAR menuNameA; //GCL_MENUNAME
|
---|
86 | WCHAR *menuNameW; //GCL_MENUNAME
|
---|
87 | WNDPROC windowProc; //GCL_WNDPROC
|
---|
88 | ULONG classAtom; //GCW_ATOM
|
---|
89 |
|
---|
90 | PCHAR classNameA;
|
---|
91 | WCHAR *classNameW;
|
---|
92 | HICON hIconSm; //GCW_HICONSM
|
---|
93 | HDC hdcClass;
|
---|
94 |
|
---|
95 | //User data class bytse
|
---|
96 | char *userClassBytes;
|
---|
97 | ULONG processId;
|
---|
98 |
|
---|
99 | static GenericObject *wndclasses;
|
---|
100 | static CRITICAL_SECTION critsect;
|
---|
101 | };
|
---|
102 |
|
---|
103 | #endif //__WIN32CLASS_H__
|
---|