source: trunk/src/user32/win32class.h@ 10367

Last change on this file since 10367 was 9568, checked in by sandervl, 23 years ago

YD: Fixed regression in Set/GetClassLong. (default must be ascii; not unicode)

File size: 4.0 KB
Line 
1/* $Id: win32class.h,v 1.17 2002-12-30 15:49:00 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
17typedef enum {
18 WNDCLASS_ASCII,
19 WNDCLASS_UNICODE
20} WNDCLASS_TYPE;
21
22typedef enum {
23 WNDPROC_ASCII,
24 WNDPROC_UNICODE
25} WNDPROC_TYPE;
26
27class Win32WndClass : public GenericObject
28{
29public:
30 Win32WndClass(WNDCLASSEXA *wndclass, WNDCLASS_TYPE fClassType = WNDCLASS_ASCII);
31 ~Win32WndClass();
32
33 ULONG getClassLongA(int index, BOOL fUnicode = FALSE);
34 ULONG getClassLongW(int index)
35 {
36 return getClassLongA(index, TRUE);
37 };
38 WORD getClassWord(int index);
39
40 ULONG setClassLongA(int index, LONG lNewVal, BOOL fUnicode = FALSE);
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
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
58 LPSTR getMenuNameA() { return menuNameA; };
59 DWORD getExtraWndBytes() { return nrExtraWindowBytes; };
60
61 HICON getIcon() { return hIcon; };
62 HICON getIconSm() { return hIconSm; };
63 HCURSOR getCursor() { return hCursor; };
64
65 HINSTANCE getInstance() { return hInstance; };
66
67 HBRUSH getBackgroundBrush() { return backgroundBrush; };
68 ULONG getStyle() { return windowStyle; };
69
70 HDC getClassDC() { return hdcClass; };
71
72 void setMenuName(LPSTR newMenuName);
73
74 BOOL hasClassName(LPSTR classname, BOOL fUnicode);
75
76 BOOL isAppClass(ULONG curProcessId);
77
78 static BOOL UnregisterClassA(HINSTANCE hinst, LPSTR id);
79
80 //Locates class in linked list and increases reference count (if found)
81 //Class object must be unreferenced after usage
82 static Win32WndClass *FindClass(HINSTANCE hinst, LPSTR id);
83 static Win32WndClass *FindClass(HINSTANCE hinst, LPWSTR id);
84
85 static void DestroyAll();
86
87private:
88 WNDCLASS_TYPE fClassType;
89
90 //Standard class words/longs
91 ULONG windowStyle; //GCL_STYLE * must be offset 14h *
92 ULONG nrExtraClassBytes; //GCL_CBCLSEXTRA
93 ULONG nrExtraWindowBytes; //GCL_CBWNDEXTRA
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
100 WNDPROC pfnWindowProcA; //GCL_WNDPROC
101 WNDPROC pfnWindowProcW; //GCL_WNDPROC
102 ULONG classAtom; //GCW_ATOM
103
104 PCHAR classNameA;
105 WCHAR *classNameW;
106 HICON hIconSm; //GCW_HICONSM
107 HDC hdcClass;
108
109 //User data class bytse
110 char *userClassBytes;
111 ULONG processId;
112
113 static GenericObject *wndclasses;
114 static CRITICAL_SECTION critsect;
115};
116
117ATOM WIN32API InternalRegisterClass(LPSTR lpszClassName, DWORD dwStyle,
118 WNDPROC pfnClassA, WNDPROC pfnClassW,
119 UINT cbExtraWindowWords, LPCSTR lpszCursor,
120 HBRUSH hBrush);
121
122#endif //__WIN32CLASS_H__
Note: See TracBrowser for help on using the repository browser.