1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Various utilities
4 // Author: David Webster
8 // Copyright: (c) David Webster
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
19 #include "wx/cursor.h"
22 #include "wx/os2/private.h"
49 static const wxChar WX_SECTION
[] = _T("wxWindows");
50 static const wxChar eHOSTNAME
[] = _T("HostName");
51 static const wxChar eUSERID
[] = _T("UserId");
52 static const wxChar eUSERNAME
[] = _T("UserName");
54 // For the following functions we SHOULD fill in support
55 // for Windows-NT (which I don't know) as I assume it begin
56 // a POSIX Unix (so claims MS) that it has some special
57 // functions beyond those provided by WinSock
59 // Get full hostname (eg. DoDo.BSn-Germany.crg.de)
68 unsigned long ulLevel
= 0;
69 unsigned char* zBuffer
= NULL
;
70 unsigned long ulBuffer
= 256;
71 unsigned long* pulTotalAvail
= NULL
;
73 NetBios32GetInfo( (const unsigned char*)zServer
74 ,(const unsigned char*)zComputer
80 strcpy(zBuf
, zServer
);
83 const wxChar
* zDefaultHost
= _T("noname");
85 if ((zSysname
= wxGetenv(_T("SYSTEM_NAME"))) == NULL
)
87 ULONG n
= ::PrfQueryProfileString( HINI_PROFILE
96 wxStrncpy(zBuf
, zSysname
, nMaxSize
- 1);
97 zBuf
[nMaxSize
] = _T('\0');
99 return *zBuf
? TRUE
: FALSE
;
102 // Get user ID e.g. jacs
108 #if defined(__VISAGECPP__)
110 // UPM procs return 0 on success
111 lrc
= U32ELOCU((unsigned char*)zBuf
, (unsigned long *)&nType
);
112 if (lrc
== 0) return TRUE
;
127 wxStrncpy(zBuf
, _T("Unknown User"), nMaxSize
);
135 , wxKillError
* peError
138 return((int)::DosKillProcess(0, (PID
)lPid
));
142 // Execute a program in an Interactive Shell
145 const wxString
& rCommand
148 wxChar
* zShell
= _T("CMD.EXE");
151 STARTDATA SData
= {0};
152 PSZ PgmTitle
= "Command Shell";
156 UCHAR achObjBuf
[256] = {0}; //error data if DosStart fails
159 SData
.Length
= sizeof(STARTDATA
);
160 SData
.Related
= SSF_RELATED_INDEPENDENT
;
161 SData
.FgBg
= SSF_FGBG_FORE
;
162 SData
.TraceOpt
= SSF_TRACEOPT_NONE
;
163 SData
.PgmTitle
= PgmTitle
;
164 SData
.PgmName
= zShell
;
166 sInputs
= "/C " + rCommand
;
167 SData
.PgmInputs
= (BYTE
*)sInputs
.c_str();
169 SData
.Environment
= 0;
170 SData
.InheritOpt
= SSF_INHERTOPT_SHELL
;
171 SData
.SessionType
= SSF_TYPE_WINDOWABLEVIO
;
174 SData
.PgmControl
= SSF_CONTROL_VISIBLE
| SSF_CONTROL_MAXIMIZE
;
177 SData
.InitXSize
= 200;
178 SData
.InitYSize
= 140;
180 SData
.ObjectBuffer
= (char*)achObjBuf
;
181 SData
.ObjectBuffLen
= (ULONG
)sizeof(achObjBuf
);
183 rc
= ::DosStartSession(&SData
, &ulSessID
, &vPid
);
184 if (rc
== 0 || rc
== 457) // NO_ERROR or SMG_START_IN_BACKGROUND
189 ::DosGetInfoBlocks(&ptib
, &ppib
);
191 ::DosWaitChild( DCWA_PROCESS
201 // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
202 long wxGetFreeMemory()
204 void* pMemptr
= NULL
;
209 lMemFlags
= PAG_FREE
;
210 rc
= ::DosQueryMem(pMemptr
, &lSize
, &lMemFlags
);
216 // ----------------------------------------------------------------------------
218 // ----------------------------------------------------------------------------
220 bool wxGetEnv(const wxString
& var
, wxString
*value
)
222 // wxGetenv is defined as getenv()
223 wxChar
*p
= wxGetenv(var
);
235 bool wxSetEnv(const wxString
& variable
, const wxChar
*value
)
237 #if defined(HAVE_SETENV)
238 return setenv(variable
.mb_str(), value
? wxString(value
).mb_str().data()
239 : NULL
, 1 /* overwrite */) == 0;
240 #elif defined(HAVE_PUTENV)
241 wxString s
= variable
;
243 s
<< _T('=') << value
;
246 const char *p
= s
.mb_str();
248 // the string will be free()d by libc
249 char *buf
= (char *)malloc(strlen(p
) + 1);
252 return putenv(buf
) == 0;
253 #else // no way to set an env var
259 // Sleep for nSecs seconds. Attempt a Windows implementation using timers.
260 static bool inTimer
= FALSE
;
262 class wxSleepTimer
: public wxTimer
272 static wxTimer
* wxTheSleepTimer
= NULL
;
275 unsigned long ulMilliseconds
278 ::DosSleep(ulMilliseconds
/1000l);
285 ::DosSleep(1000 * nSecs
);
288 // Consume all events until no more left
294 #if WXWIN_COMPATIBILITY_2_2
296 // Output a debug mess., in a system dependent fashion.
298 const wxChar
* zFmt
...
302 static wxChar zBuffer
[512];
304 if (!wxTheApp
->GetWantDebugOutput())
307 sprintf(zBuffer
, zFmt
, vAp
) ;
311 // Non-fatal error: pop up message box and (possibly) continue
314 , const wxString
& rTitle
317 wxBuffer
= new wxChar
[256];
318 wxSprintf(wxBuffer
, "%s\nContinue?", WXSTRINGCAST rMsg
);
319 if (::WinMessageBox( HWND_DESKTOP
322 ,(PSZ
)WXSTRINGCAST rTitle
324 ,MB_ICONEXCLAMATION
| MB_YESNO
330 // Fatal error: pop up message box and abort
333 , const wxString
& rTitle
338 ulRc
= ::WinMessageBox( HWND_DESKTOP
345 DosExit(EXIT_PROCESS
, ulRc
);
348 #endif // WXWIN_COMPATIBILITY_2_2
353 DosBeep(1000,1000); // 1kHz during 1 sec.
356 // Chris Breeze 27/5/98: revised WIN32 code to
357 // detect WindowsNT correctly
363 ULONG ulSysInfo
[QSV_MAX
] = {0};
366 ulrc
= ::DosQuerySysInfo( 1L
369 ,sizeof(ULONG
) * QSV_MAX
373 *pMajorVsn
= ulSysInfo
[QSV_VERSION_MAJOR
];
374 *pMajorVsn
= *pMajorVsn
/10;
375 *pMinorVsn
= ulSysInfo
[QSV_VERSION_MINOR
];
376 return wxWINDOWS_OS2
;
378 return wxWINDOWS
; // error if we get here, return generic value
381 // Reading and writing resources (eg WIN.INI, .Xdefaults)
383 bool wxWriteResource(
384 const wxString
& rSection
385 , const wxString
& rEntry
386 , const wxString
& rValue
387 , const wxString
& rFile
395 hIni
= ::PrfOpenProfile(hab
, (PSZ
)WXSTRINGCAST rFile
);
398 return (::PrfWriteProfileString( hIni
399 ,(PSZ
)WXSTRINGCAST rSection
400 ,(PSZ
)WXSTRINGCAST rEntry
401 ,(PSZ
)WXSTRINGCAST rValue
406 return (::PrfWriteProfileString( HINI_PROFILE
407 ,(PSZ
)WXSTRINGCAST rSection
408 ,(PSZ
)WXSTRINGCAST rEntry
409 ,(PSZ
)WXSTRINGCAST rValue
414 bool wxWriteResource(
415 const wxString
& rSection
416 , const wxString
& rEntry
418 , const wxString
& rFile
423 wxSprintf(zBuf
, "%.4f", fValue
);
424 return wxWriteResource( rSection
431 bool wxWriteResource(
432 const wxString
& rSection
433 , const wxString
& rEntry
435 , const wxString
& rFile
440 wxSprintf(zBuf
, "%ld", lValue
);
441 return wxWriteResource( rSection
448 bool wxWriteResource(
449 const wxString
& rSection
450 , const wxString
& rEntry
452 , const wxString
& rFile
457 wxSprintf(zBuf
, "%d", lValue
);
458 return wxWriteResource( rSection
466 const wxString
& rSection
467 , const wxString
& rEntry
469 , const wxString
& rFile
474 wxChar zDefunkt
[] = _T("$$default");
479 hIni
= ::PrfOpenProfile(hab
, (PSZ
)WXSTRINGCAST rFile
);
482 ULONG n
= ::PrfQueryProfileString( hIni
483 ,(PSZ
)WXSTRINGCAST rSection
484 ,(PSZ
)WXSTRINGCAST rEntry
491 if (n
== 0L || wxStrcmp(zBuf
, zDefunkt
) == 0)
500 ULONG n
= ::PrfQueryProfileString( HINI_PROFILE
501 ,(PSZ
)WXSTRINGCAST rSection
502 ,(PSZ
)WXSTRINGCAST rEntry
509 if (n
== 0L || wxStrcmp(zBuf
, zDefunkt
) == 0)
513 strcpy((char*)*ppValue
, zBuf
);
518 const wxString
& rSection
519 , const wxString
& rEntry
521 , const wxString
& rFile
526 zStr
= new wxChar
[1000];
527 bool bSucc
= wxGetResource( rSection
535 *pValue
= (float)wxStrtod(zStr
, NULL
);
547 const wxString
& rSection
548 , const wxString
& rEntry
550 , const wxString
& rFile
555 zStr
= new wxChar
[1000];
556 bool bSucc
= wxGetResource( rSection
564 *pValue
= wxStrtol(zStr
, NULL
, 10);
576 const wxString
& rSection
577 , const wxString
& rEntry
579 , const wxString
& rFile
584 zStr
= new wxChar
[1000];
585 bool bSucc
= wxGetResource( rSection
593 *pValue
= (int)wxStrtol(zStr
, NULL
, 10);
603 #endif // wxUSE_RESOURCES
605 // ---------------------------------------------------------------------------
606 // helper functions for showing a "busy" cursor
607 // ---------------------------------------------------------------------------
609 HCURSOR gs_wxBusyCursor
= 0; // new, busy cursor
610 HCURSOR gs_wxBusyCursorOld
= 0; // old cursor
611 static int gs_wxBusyCursorCount
= 0;
613 // Set the cursor to the busy cursor for all windows
614 void wxBeginBusyCursor(
618 if ( gs_wxBusyCursorCount
++ == 0 )
620 gs_wxBusyCursor
= (HCURSOR
)pCursor
->GetHCURSOR();
621 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)gs_wxBusyCursor
);
623 //else: nothing to do, already set
626 // Restore cursor to normal
627 void wxEndBusyCursor()
629 wxCHECK_RET( gs_wxBusyCursorCount
> 0
630 ,_T("no matching wxBeginBusyCursor() for wxEndBusyCursor()")
633 if (--gs_wxBusyCursorCount
== 0)
635 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)gs_wxBusyCursorOld
);
636 gs_wxBusyCursorOld
= 0;
640 // TRUE if we're between the above two calls
643 return (gs_wxBusyCursorCount
> 0);
646 // ---------------------------------------------------------------------------
647 const wxChar
* wxGetHomeDir(
651 wxString
& rStrDir
= *pStr
;
653 // OS/2 has no idea about home,
654 // so use the working directory instead?
656 // 256 was taken from os2def.h
658 # define MAX_PATH 256
664 ::DosQueryCurrentDir(0, zDirName
, &ulDirLen
);
666 return rStrDir
.c_str();
670 wxChar
* wxGetUserHome (
671 const wxString
& rUser
675 wxString
sUser1(rUser
);
677 wxBuffer
= new wxChar
[256];
679 if (sUser1
!= _T(""))
683 if (wxGetUserId( zTmp
684 ,sizeof(zTmp
)/sizeof(char)
687 // Guests belong in the temp dir
688 if (wxStricmp(zTmp
, _T("annonymous")) == 0)
690 if ((zHome
= wxGetenv(_T("TMP"))) != NULL
||
691 (zHome
= wxGetenv(_T("TMPDIR"))) != NULL
||
692 (zHome
= wxGetenv(_T("TEMP"))) != NULL
)
694 return *zHome
? zHome
: (wxChar
*)_T("\\");
696 if (wxStricmp(zTmp
, WXSTRINGCAST sUser1
) == 0)
701 if (sUser1
== _T(""))
703 if ((zHome
= wxGetenv(_T("HOME"))) != NULL
)
705 wxStrcpy(wxBuffer
, zHome
);
706 Unix2DosFilename(wxBuffer
);
707 wxStrcpy(zHome
, wxBuffer
);
713 return NULL
; // No home known!
716 // Check whether this window wants to process messages, e.g. Stop button
717 // in long calculations.
718 bool wxCheckForInterrupt(
726 HWND hwndFilter
= NULLHANDLE
;
727 HWND hwndWin
= (HWND
) pWnd
->GetHWND();
729 while(::WinPeekMsg(hab
, &vMsg
, hwndFilter
, 0, 0, PM_REMOVE
))
731 ::WinDispatchMsg(hab
, &vMsg
);
733 return TRUE
;//*** temporary?
737 wxFAIL_MSG(_T("pWnd==NULL !!!"));
738 return FALSE
;//*** temporary?
742 void wxGetMousePosition(
749 ::WinQueryPointerPos(HWND_DESKTOP
, &vPt
);
754 // Return TRUE if we have a colour display
755 bool wxColourDisplay()
762 hpsScreen
= ::WinGetScreenPS(HWND_DESKTOP
);
763 hdcScreen
= ::GpiQueryDevice(hpsScreen
);
764 ::DevQueryCaps(hdcScreen
, CAPS_COLORS
, 1L, &lColors
);
765 return(lColors
> 1L);
767 // I don't see how the PM display could not be color. Besides, this
768 // was leaking DCs and PSs!!! MN
773 // Returns depth of screen
780 static LONG nDepth
= 0;
782 // The screen colordepth ain't gonna change. No reason to query
785 hpsScreen
= ::WinGetScreenPS(HWND_DESKTOP
);
786 hdcScreen
= ::GpiQueryDevice(hpsScreen
);
787 ::DevQueryCaps(hdcScreen
, CAPS_COLOR_PLANES
, 1L, &lPlanes
);
788 ::DevQueryCaps(hdcScreen
, CAPS_COLOR_BITCOUNT
, 1L, &lBitsPerPixel
);
790 nDepth
= (int)(lPlanes
* lBitsPerPixel
);
791 ::DevCloseDC(hdcScreen
);
792 ::WinReleasePS(hpsScreen
);
797 // Get size of display
805 static LONG lWidth
= 0;
806 static LONG lHeight
= 0;
808 // The screen size ain't gonna change either so just cache the values
810 hpsScreen
= ::WinGetScreenPS(HWND_DESKTOP
);
811 hdcScreen
= ::GpiQueryDevice(hpsScreen
);
812 ::DevQueryCaps(hdcScreen
, CAPS_WIDTH
, 1L, &lWidth
);
813 ::DevQueryCaps(hdcScreen
, CAPS_HEIGHT
, 1L, &lHeight
);
814 ::DevCloseDC(hdcScreen
);
815 ::WinReleasePS(hpsScreen
);
817 *pWidth
= (int)lWidth
;
818 *pHeight
= (int)lHeight
;
821 void wxDisplaySizeMM(
829 hpsScreen
= ::WinGetScreenPS(HWND_DESKTOP
);
830 hdcScreen
= ::GpiQueryDevice(hpsScreen
);
833 ::DevQueryCaps( hdcScreen
834 ,CAPS_HORIZONTAL_RESOLUTION
839 ::DevQueryCaps( hdcScreen
840 ,CAPS_VERTICAL_RESOLUTION
844 ::DevCloseDC(hdcScreen
);
845 ::WinReleasePS(hpsScreen
);
848 void wxClientDisplayRect(int *x
, int *y
, int *width
, int *height
)
850 // This is supposed to return desktop dimensions minus any window
851 // manager panels, menus, taskbars, etc. If there is a way to do that
852 // for this platform please fix this function, otherwise it defaults
853 // to the entire desktop.
856 wxDisplaySize(width
, height
);
864 return (::DosSetCurrentDir(WXSTRINGCAST rDir
));
867 // ---------------------------------------------------------------------------
868 // window information functions
869 // ---------------------------------------------------------------------------
871 wxString WXDLLEXPORT
wxGetWindowText(
876 long lLen
= ::WinQueryWindowTextLength((HWND
)hWnd
) + 1;
878 ::WinQueryWindowText((HWND
)hWnd
, lLen
, vStr
.GetWriteBuf((int)lLen
));
879 vStr
.UngetWriteBuf();
884 wxString WXDLLEXPORT
wxGetWindowClass(
889 int nLen
= 256; // some starting value
893 int nCount
= ::WinQueryClassName((HWND
)hWnd
, nLen
, vStr
.GetWriteBuf(nLen
));
895 vStr
.UngetWriteBuf();
898 // the class name might have been truncated, retry with larger
910 WXWORD WXDLLEXPORT
wxGetWindowId(
914 return ::WinQueryWindowUShort((HWND
)hWnd
, QWS_ID
);
917 wxString WXDLLEXPORT
wxPMErrorToStr(
924 // Remove the high order byte -- it is useless
926 vError
&= 0x0000ffff;
929 case PMERR_INVALID_HWND
:
930 sError
= wxT("Invalid window handle specified");
933 case PMERR_INVALID_FLAG
:
934 sError
= wxT("Invalid flag bit set");
937 case PMERR_NO_MSG_QUEUE
:
938 sError
= wxT("No message queue available");
941 case PMERR_INVALID_PARM
:
942 sError
= wxT("Parameter contained invalid data");
945 case PMERR_INVALID_PARAMETERS
:
946 sError
= wxT("Parameter value is out of range");
949 case PMERR_PARAMETER_OUT_OF_RANGE
:
950 sError
= wxT("Parameter value is out of range");
953 case PMERR_INVALID_INTEGER_ATOM
:
954 sError
= wxT("Not a valid atom");
957 case PMERR_INVALID_HATOMTBL
:
958 sError
= wxT("Atom table handle is invalid");
961 case PMERR_INVALID_ATOM_NAME
:
962 sError
= wxT("Not a valid atom name");
965 case PMERR_ATOM_NAME_NOT_FOUND
:
966 sError
= wxT("Valid name format, but cannot find name in atom table");
970 sError
= wxT("Unknown error");
973 } // end of wxPMErrorToStr
983 vPoint
[0].x
= rRect
.xLeft
;
984 vPoint
[0].y
= rRect
.yBottom
;
985 ::GpiMove(hPS
, &vPoint
[0]);
986 if (dwStyle
& wxSIMPLE_BORDER
||
987 dwStyle
& wxSTATIC_BORDER
)
989 vPoint
[1].x
= rRect
.xRight
- 1;
990 vPoint
[1].y
= rRect
.yTop
- 1;
998 if (dwStyle
& wxSUNKEN_BORDER
)
1000 LINEBUNDLE vLineBundle
;
1002 vLineBundle
.lColor
= 0x00FFFFFF; // WHITE
1003 vLineBundle
.usMixMode
= FM_OVERPAINT
;
1004 vLineBundle
.fxWidth
= 2;
1005 vLineBundle
.lGeomWidth
= 2;
1006 vLineBundle
.usType
= LINETYPE_SOLID
;
1007 vLineBundle
.usEnd
= 0;
1008 vLineBundle
.usJoin
= 0;
1011 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
1015 vPoint
[1].x
= rRect
.xRight
- 1;
1016 vPoint
[1].y
= rRect
.yTop
- 1;
1023 vPoint
[0].x
= rRect
.xLeft
+ 1;
1024 vPoint
[0].y
= rRect
.yBottom
+ 1;
1025 ::GpiMove(hPS
, &vPoint
[0]);
1026 vPoint
[1].x
= rRect
.xRight
- 2;
1027 vPoint
[1].y
= rRect
.yTop
- 2;
1035 vLineBundle
.lColor
= 0x00000000; // BLACK
1036 vLineBundle
.usMixMode
= FM_OVERPAINT
;
1037 vLineBundle
.fxWidth
= 2;
1038 vLineBundle
.lGeomWidth
= 2;
1039 vLineBundle
.usType
= LINETYPE_SOLID
;
1040 vLineBundle
.usEnd
= 0;
1041 vLineBundle
.usJoin
= 0;
1044 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
1048 vPoint
[0].x
= rRect
.xLeft
+ 2;
1049 vPoint
[0].y
= rRect
.yBottom
+ 2;
1050 ::GpiMove(hPS
, &vPoint
[0]);
1051 vPoint
[1].x
= rRect
.xLeft
+ 2;
1052 vPoint
[1].y
= rRect
.yTop
- 3;
1053 ::GpiLine(hPS
, &vPoint
[1]);
1054 vPoint
[1].x
= rRect
.xRight
- 3;
1055 vPoint
[1].y
= rRect
.yTop
- 3;
1056 ::GpiLine(hPS
, &vPoint
[1]);
1058 vPoint
[0].x
= rRect
.xLeft
+ 3;
1059 vPoint
[0].y
= rRect
.yBottom
+ 3;
1060 ::GpiMove(hPS
, &vPoint
[0]);
1061 vPoint
[1].x
= rRect
.xLeft
+ 3;
1062 vPoint
[1].y
= rRect
.yTop
- 4;
1063 ::GpiLine(hPS
, &vPoint
[1]);
1064 vPoint
[1].x
= rRect
.xRight
- 4;
1065 vPoint
[1].y
= rRect
.yTop
- 4;
1066 ::GpiLine(hPS
, &vPoint
[1]);
1068 if (dwStyle
& wxDOUBLE_BORDER
)
1070 LINEBUNDLE vLineBundle
;
1072 vLineBundle
.lColor
= 0x00FFFFFF; // WHITE
1073 vLineBundle
.usMixMode
= FM_OVERPAINT
;
1074 vLineBundle
.fxWidth
= 2;
1075 vLineBundle
.lGeomWidth
= 2;
1076 vLineBundle
.usType
= LINETYPE_SOLID
;
1077 vLineBundle
.usEnd
= 0;
1078 vLineBundle
.usJoin
= 0;
1081 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
1085 vPoint
[1].x
= rRect
.xRight
- 1;
1086 vPoint
[1].y
= rRect
.yTop
- 1;
1093 vLineBundle
.lColor
= 0x00000000; // WHITE
1094 vLineBundle
.usMixMode
= FM_OVERPAINT
;
1095 vLineBundle
.fxWidth
= 2;
1096 vLineBundle
.lGeomWidth
= 2;
1097 vLineBundle
.usType
= LINETYPE_SOLID
;
1098 vLineBundle
.usEnd
= 0;
1099 vLineBundle
.usJoin
= 0;
1102 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
1106 vPoint
[0].x
= rRect
.xLeft
+ 2;
1107 vPoint
[0].y
= rRect
.yBottom
+ 2;
1108 ::GpiMove(hPS
, &vPoint
[0]);
1109 vPoint
[1].x
= rRect
.xRight
- 2;
1110 vPoint
[1].y
= rRect
.yTop
- 2;
1117 vLineBundle
.lColor
= 0x00FFFFFF; // BLACK
1118 vLineBundle
.usMixMode
= FM_OVERPAINT
;
1119 vLineBundle
.fxWidth
= 2;
1120 vLineBundle
.lGeomWidth
= 2;
1121 vLineBundle
.usType
= LINETYPE_SOLID
;
1122 vLineBundle
.usEnd
= 0;
1123 vLineBundle
.usJoin
= 0;
1126 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
1130 vPoint
[0].x
= rRect
.xLeft
+ 3;
1131 vPoint
[0].y
= rRect
.yBottom
+ 3;
1132 ::GpiMove(hPS
, &vPoint
[0]);
1133 vPoint
[1].x
= rRect
.xRight
- 3;
1134 vPoint
[1].y
= rRect
.yTop
- 3;
1142 if (dwStyle
& wxRAISED_BORDER
)
1144 LINEBUNDLE vLineBundle
;
1146 vLineBundle
.lColor
= 0x00000000; // BLACK
1147 vLineBundle
.usMixMode
= FM_OVERPAINT
;
1148 vLineBundle
.fxWidth
= 2;
1149 vLineBundle
.lGeomWidth
= 2;
1150 vLineBundle
.usType
= LINETYPE_SOLID
;
1151 vLineBundle
.usEnd
= 0;
1152 vLineBundle
.usJoin
= 0;
1155 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
1159 vPoint
[1].x
= rRect
.xRight
- 1;
1160 vPoint
[1].y
= rRect
.yTop
- 1;
1167 vPoint
[0].x
= rRect
.xLeft
+ 1;
1168 vPoint
[0].y
= rRect
.yBottom
+ 1;
1169 ::GpiMove(hPS
, &vPoint
[0]);
1170 vPoint
[1].x
= rRect
.xRight
- 2;
1171 vPoint
[1].y
= rRect
.yTop
- 2;
1179 vLineBundle
.lColor
= 0x00FFFFFF; // WHITE
1180 vLineBundle
.usMixMode
= FM_OVERPAINT
;
1181 vLineBundle
.fxWidth
= 2;
1182 vLineBundle
.lGeomWidth
= 2;
1183 vLineBundle
.usType
= LINETYPE_SOLID
;
1184 vLineBundle
.usEnd
= 0;
1185 vLineBundle
.usJoin
= 0;
1188 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
1192 vPoint
[0].x
= rRect
.xLeft
+ 2;
1193 vPoint
[0].y
= rRect
.yBottom
+ 2;
1194 ::GpiMove(hPS
, &vPoint
[0]);
1195 vPoint
[1].x
= rRect
.xLeft
+ 2;
1196 vPoint
[1].y
= rRect
.yTop
- 3;
1197 ::GpiLine(hPS
, &vPoint
[1]);
1198 vPoint
[1].x
= rRect
.xRight
- 3;
1199 vPoint
[1].y
= rRect
.yTop
- 3;
1200 ::GpiLine(hPS
, &vPoint
[1]);
1202 vPoint
[0].x
= rRect
.xLeft
+ 3;
1203 vPoint
[0].y
= rRect
.yBottom
+ 3;
1204 ::GpiMove(hPS
, &vPoint
[0]);
1205 vPoint
[1].x
= rRect
.xLeft
+ 3;
1206 vPoint
[1].y
= rRect
.yTop
- 4;
1207 ::GpiLine(hPS
, &vPoint
[1]);
1208 vPoint
[1].x
= rRect
.xRight
- 4;
1209 vPoint
[1].y
= rRect
.yTop
- 4;
1210 ::GpiLine(hPS
, &vPoint
[1]);
1212 } // end of wxDrawBorder
1216 , const wxFont
& rFont
1224 if (hWnd
== NULLHANDLE
)
1228 // The fonts available for Presentation Params are just three
1229 // outline fonts, the rest are available to the GPI, so we must
1230 // map the families to one of these three
1232 switch(rFont
.GetFamily())
1235 strcpy(zFacename
, "Script");
1240 strcpy(zFacename
,"Tms Rmn");
1244 strcpy(zFacename
, "Courier");
1248 strcpy(zFacename
, "System VIO");
1252 strcpy(zFacename
, "Helv");
1257 strcpy(zFacename
, "System VIO");
1261 switch(rFont
.GetWeight())
1270 case wxFONTWEIGHT_MAX
:
1271 strcpy(zWeight
, "Bold");
1275 switch(rFont
.GetStyle())
1279 strcpy(zStyle
, "Italic");
1286 sprintf(zFont
, "%d.%s", rFont
.GetPointSize(), zFacename
);
1287 if (zWeight
[0] != '\0')
1290 strcat(zFont
, zWeight
);
1292 if (zStyle
[0] != '\0')
1295 strcat(zFont
, zStyle
);
1297 ::WinSetPresParam(hWnd
, PP_FONTNAMESIZE
, strlen(zFont
) + 1, (PVOID
)zFont
);
1298 } // end of wxOS2SetFont