1 {****************************************************************************
2 
3 
4     This file is part of the Free Pascal run time library.
5     Copyrigth (c) 2003 by Yuri Prokushev (prokushev@freemail.ru)
6 
7     OS/2 Presentation Manager Workplace functions and types.
8 
9     See the file COPYING.FPC, included in this distribution,
10     for details about the copyright.
11 
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 
16  ****************************************************************************}
17 unit pmwp;
18 
19 interface
20 
21 uses
22   os2def, pmwin;
23 
24 //*** Common types *******************************************************/
25 
26 type
27   HOBJECT=Cardinal;
28 
29 //*** Object management calls ********************************************/
30 
31 //*** Standard object classes *****************************************/
32 
33 const
34   CCHMAXCLASS            = 3;      // Length of a classname
35 
36   QC_First               = 0;      // Codes for OA_QueryContent
37   QC_Next                = 1;
38   QC_Last                = 2;
39 
40   LOCATION_DESKTOP = PChar($FFFF0001); // Current Desktop
41          // use instead of <WP_DESKTOP>
42 
43 //*** An object's appearance (icon or bitmap or outline) **************/
44 
45 type
46   OBJECTIMAGE=record     // oimg
47     hptrObject: Cardinal;
48   end;
49   POBJECTIMAGE=^OBJECTIMAGE;
50 
51 //*** Class info structure returned by WinEnumObjectClasses ***********/
52 type
53   POBJCLASS=^OBJCLASS;
54   OBJCLASS=record         // ocls
55     pNext: POBJCLASS;     // Null for the last structure..
56     pszClassName: PChar;  // Class name
57     pszModName: PChar;    // Module name
58   end;
59 
60 //*** Workplace object management functions ***************************/
61 
62 Function WinRegisterObjectClass(pszClassName,
63                                 pszModName: PChar): Longbool; cdecl;
64     external 'PMWP' index 200;
65 
66 Function WinDeRegisterObjectClass(pszClassName: PChar): Longbool; cdecl;
67     external 'PMWP' index 201;
68 
69 Function WinReplaceObjectClass(pszOldClassName,
70                                pszNewClassName: PChar;
71                                fReplace: Longbool): Longbool; cdecl;
72     external 'PMWP' index 219;
73 
74 Function WinEnumObjectClasses(VAR apObjClass: OBJCLASS;
75                               VAR pulSize: Cardinal): Longbool; cdecl;
76     external 'PMWP' index 205;
77 
78 Function WinCreateObject(pszClassName,
79                          pszTitle,
80                          pszSetupString,
81                          pszLocation: PChar;
82                          ulFlags: Cardinal): HObject; cdecl;
83     external 'PMWP' index 281;
84 
85 const
86   CO_FAILIFEXISTS    = 0;
87   CO_REPLACEIFEXISTS = 1;
88   CO_UPDATEIFEXISTS  = 2;
89 
90 Function WinSetObjectData(aobject: HOBJECT;
91                           pszSetupString: PChar): Longbool; cdecl;
92     external 'PMWP' index 250;
93 
94 Function WinDestroyObject(aobject: HOBJECT): Longbool; cdecl;
95     external 'PMWP' index 251;
96 
97 Function WinQueryObject(pszObjectID: PChar): HObject; cdecl;
98     external 'PMWP' index 252;
99 
100 Function WinSaveObject(ahObject: HOBJECT;
101                        fAsync: Longbool): Longbool; cdecl;
102     external 'PMWP' index 285;
103 
104 Function WinOpenObject(ahObject: HOBJECT;
105                        ulView: Cardinal;
106                        Flag: Longbool): Longbool; cdecl;
107     external 'PMWP' index 286;
108 
109 Function WinMoveObject(hObjectofObject: HOBJECT;
110                        hObjectofDest: HOBJECT;
111                        ulReserved: Cardinal): HObject; cdecl;
112     external 'PMWP' index 287;
113 
114 Function WinCopyObject(hObjectofObject: HOBJECT;
115                        hObjectofDest: HOBJECT;
116                        ulReserved: Cardinal): HObject; cdecl;
117     external 'PMWP' index 288;
118 
119 Function WinCreateShadow(hObjectofObject: HOBJECT;
120                          hObjectofDest: HOBJECT;
121                          ulReserved: Cardinal): HObject; cdecl;
122     external 'PMWP' index 289;
123 
124 Function WinQueryActiveDesktopPathname(pszPathName: PChar;
125                                        ulSize: Cardinal): Longbool; cdecl;
126     external 'PMWP' index 262;
127 
128 Function WinQueryObjectPath(ahobject: HOBJECT;
129                             pszPathName: PChar;
130                             ulSize: Cardinal): Longbool; cdecl;
131     external 'PMWP' index 263;
132 
133 Function WinRestartWPDServer(fState: Longbool): Cardinal; cdecl;
134     external 'PMWP' index 463;
135 
136 Function WinIsWPDServerReady: Longbool; cdecl;
137     external 'PMWP' index 465;
138 
139 Function WinRestartSOMDD(fState: Longbool): Cardinal; cdecl;
140     external 'PMWP' index 464;
141 
142 Function WinIsSOMDDReady: Longbool; cdecl;
143     external 'PMWP' index 480;
144 
145 //*** Object settings notebook page insertion structure ******************/
146 
147 type
148   PAGEINFO=record     // pginf
149     cb: Cardinal;
150     hwndPage: HWnd;
151     pfnwp: proc;
152     resid: Cardinal;
153     pCreateParams: Pointer;
154     dlgid: Word;
155     usPageStyleFlags: Word;
156     usPageInsertFlags: Word;
157     usSettingsFlags: Word;
158     pszName: PChar;
159     idDefaultHelpPanel: Word;
160     usReserved2: Word;
161     pszHelpLibraryName: PChar;
162     pHelpSubtable: ^Word;   // PHELPSUBTABLE when PMHELP.H is included
163     hmodHelpSubtable: Cardinal;
164     ulPageInsertId: Cardinal;
165   end;
166   PPAGEINFO=^PAGEINFO;
167 
168 const
169   SETTINGS_PAGE_NUMBERS   = $01;
170 
171 //*** Utility apis +******************************************************/
172 
173 type
174   ICONPOS=record     // icp
175     ptlIcon: POINTL;                    // Location
176     szIdentity: Array[0..1-1] of Char;  // Object identity string
177   end;
178   PICONPOS=^ICONPOS;
179 
180 //*********************************************************************/
181 Function WinSetFileIcon(pszFileName: PChar;
182                     var pIcon: ICONINFO): Longbool; cdecl;
183     external 'PMWP' index 210;
184 
185 Function WinFreeFileIcon(hptr: Cardinal): Longbool; cdecl;
186     external 'PMWP' index 216;
187 
188 Function WinLoadFileIcon(pszFileName: PChar;
189                          fPrivate: Longbool): Cardinal; cdecl;
190     external 'PMWP' index 209;
191 
192 Function WinStoreWindowPos(pszAppName,
193                            pszKeyName: PChar;
194                            ahwnd: HWND): Longbool; cdecl;
195     external 'PMWP' index 207;
196 
197 Function WinRestoreWindowPos(pszAppName,
198                              pszKeyName: PChar;
199                              ahwnd: HWND): Longbool; cdecl;
200     external 'PMWP' index 208;
201 
202 Function WinShutdownSystem(ahab: HAB;
203                            ahmq: HMQ): Longbool; cdecl;
204     external 'PMWP' index 149;
205 
206 implementation
207 
208 end.
209 {
210 // Not implemented/not documented APIs
211 WinShutdownAndReboot    PMWP     152 ?
212 WinShutdown             PMWP     153 ?
213 OldWinCreateObject      PMWP     202 ?
214 WinRestartWorkplace     PMWP     221 ?
215 ShlGetUserWordPtr       PMWP     224 ?
216 WinUnlockSystem         PMWP     282 ?
217 WinLockupSystem         PMWP     283 ?
218 WinNotebookButtonFromID PMWP     511 ?
219 WinWaitForShell         PMWP     512 ?
220 }
221 
222 {
223 // Not founded indexes
224 Function WinSetFileIconN(pszFileName: PChar
225                          pIcnInfo: PICONINFO;
226                          ulIconIndex: Cardinal): Longbool; cdecl;
227     external 'PMWP' index ???;
228 
229 Function WinLoadFileIconN(pszFileName: PChar;
230                           fPrivate: Longbool,
231                           ulIconIndex: Cardinal): Cardinal; cdecl;
232     external 'PMWP' index ???;
233 }
234 
235