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 // Shutdown or reboot the PC
202 bool wxShutdown(wxShutdownFlags wFlags
)
208 // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
209 long wxGetFreeMemory()
211 void* pMemptr
= NULL
;
216 lMemFlags
= PAG_FREE
;
217 rc
= ::DosQueryMem(pMemptr
, &lSize
, &lMemFlags
);
223 // ----------------------------------------------------------------------------
225 // ----------------------------------------------------------------------------
227 bool wxGetEnv(const wxString
& var
, wxString
*value
)
229 // wxGetenv is defined as getenv()
230 wxChar
*p
= wxGetenv(var
);
242 bool wxSetEnv(const wxString
& variable
, const wxChar
*value
)
244 #if defined(HAVE_SETENV)
245 return setenv(variable
.mb_str(), value
? wxString(value
).mb_str().data()
246 : NULL
, 1 /* overwrite */) == 0;
247 #elif defined(HAVE_PUTENV)
248 wxString s
= variable
;
250 s
<< _T('=') << value
;
253 const char *p
= s
.mb_str();
255 // the string will be free()d by libc
256 char *buf
= (char *)malloc(strlen(p
) + 1);
259 return putenv(buf
) == 0;
260 #else // no way to set an env var
266 // Sleep for nSecs seconds. Attempt a Windows implementation using timers.
267 static bool inTimer
= FALSE
;
269 class wxSleepTimer
: public wxTimer
279 static wxTimer
* wxTheSleepTimer
= NULL
;
282 unsigned long ulMilliseconds
285 ::DosSleep(ulMilliseconds
/1000l);
292 ::DosSleep(1000 * nSecs
);
295 // Consume all events until no more left
301 #if WXWIN_COMPATIBILITY_2_2
303 // Output a debug mess., in a system dependent fashion.
305 const wxChar
* zFmt
...
309 static wxChar zBuffer
[512];
311 if (!wxTheApp
->GetWantDebugOutput())
314 sprintf(zBuffer
, zFmt
, vAp
) ;
318 // Non-fatal error: pop up message box and (possibly) continue
321 , const wxString
& rTitle
324 wxBuffer
= new wxChar
[256];
325 wxSprintf(wxBuffer
, "%s\nContinue?", WXSTRINGCAST rMsg
);
326 if (::WinMessageBox( HWND_DESKTOP
329 ,(PSZ
)WXSTRINGCAST rTitle
331 ,MB_ICONEXCLAMATION
| MB_YESNO
337 // Fatal error: pop up message box and abort
340 , const wxString
& rTitle
345 ulRc
= ::WinMessageBox( HWND_DESKTOP
352 DosExit(EXIT_PROCESS
, ulRc
);
355 #endif // WXWIN_COMPATIBILITY_2_2
360 DosBeep(1000,1000); // 1kHz during 1 sec.
363 // Chris Breeze 27/5/98: revised WIN32 code to
364 // detect WindowsNT correctly
370 ULONG ulSysInfo
[QSV_MAX
] = {0};
373 ulrc
= ::DosQuerySysInfo( 1L
376 ,sizeof(ULONG
) * QSV_MAX
380 *pMajorVsn
= ulSysInfo
[QSV_VERSION_MAJOR
];
381 *pMajorVsn
= *pMajorVsn
/10;
382 *pMinorVsn
= ulSysInfo
[QSV_VERSION_MINOR
];
383 return wxWINDOWS_OS2
;
385 return wxWINDOWS
; // error if we get here, return generic value
388 // Reading and writing resources (eg WIN.INI, .Xdefaults)
390 bool wxWriteResource(
391 const wxString
& rSection
392 , const wxString
& rEntry
393 , const wxString
& rValue
394 , const wxString
& rFile
402 hIni
= ::PrfOpenProfile(hab
, (PSZ
)WXSTRINGCAST rFile
);
405 return (::PrfWriteProfileString( hIni
406 ,(PSZ
)WXSTRINGCAST rSection
407 ,(PSZ
)WXSTRINGCAST rEntry
408 ,(PSZ
)WXSTRINGCAST rValue
413 return (::PrfWriteProfileString( HINI_PROFILE
414 ,(PSZ
)WXSTRINGCAST rSection
415 ,(PSZ
)WXSTRINGCAST rEntry
416 ,(PSZ
)WXSTRINGCAST rValue
421 bool wxWriteResource(
422 const wxString
& rSection
423 , const wxString
& rEntry
425 , const wxString
& rFile
430 wxSprintf(zBuf
, "%.4f", fValue
);
431 return wxWriteResource( rSection
438 bool wxWriteResource(
439 const wxString
& rSection
440 , const wxString
& rEntry
442 , const wxString
& rFile
447 wxSprintf(zBuf
, "%ld", lValue
);
448 return wxWriteResource( rSection
455 bool wxWriteResource(
456 const wxString
& rSection
457 , const wxString
& rEntry
459 , const wxString
& rFile
464 wxSprintf(zBuf
, "%d", lValue
);
465 return wxWriteResource( rSection
473 const wxString
& rSection
474 , const wxString
& rEntry
476 , const wxString
& rFile
481 wxChar zDefunkt
[] = _T("$$default");
486 hIni
= ::PrfOpenProfile(hab
, (PSZ
)WXSTRINGCAST rFile
);
489 ULONG n
= ::PrfQueryProfileString( hIni
490 ,(PSZ
)WXSTRINGCAST rSection
491 ,(PSZ
)WXSTRINGCAST rEntry
498 if (n
== 0L || wxStrcmp(zBuf
, zDefunkt
) == 0)
507 ULONG n
= ::PrfQueryProfileString( HINI_PROFILE
508 ,(PSZ
)WXSTRINGCAST rSection
509 ,(PSZ
)WXSTRINGCAST rEntry
516 if (n
== 0L || wxStrcmp(zBuf
, zDefunkt
) == 0)
520 strcpy((char*)*ppValue
, zBuf
);
525 const wxString
& rSection
526 , const wxString
& rEntry
528 , const wxString
& rFile
533 zStr
= new wxChar
[1000];
534 bool bSucc
= wxGetResource( rSection
542 *pValue
= (float)wxStrtod(zStr
, NULL
);
554 const wxString
& rSection
555 , const wxString
& rEntry
557 , const wxString
& rFile
562 zStr
= new wxChar
[1000];
563 bool bSucc
= wxGetResource( rSection
571 *pValue
= wxStrtol(zStr
, NULL
, 10);
583 const wxString
& rSection
584 , const wxString
& rEntry
586 , const wxString
& rFile
591 zStr
= new wxChar
[1000];
592 bool bSucc
= wxGetResource( rSection
600 *pValue
= (int)wxStrtol(zStr
, NULL
, 10);
610 #endif // wxUSE_RESOURCES
612 // ---------------------------------------------------------------------------
613 // helper functions for showing a "busy" cursor
614 // ---------------------------------------------------------------------------
616 HCURSOR gs_wxBusyCursor
= 0; // new, busy cursor
617 HCURSOR gs_wxBusyCursorOld
= 0; // old cursor
618 static int gs_wxBusyCursorCount
= 0;
620 // Set the cursor to the busy cursor for all windows
621 void wxBeginBusyCursor(
625 if ( gs_wxBusyCursorCount
++ == 0 )
627 gs_wxBusyCursor
= (HCURSOR
)pCursor
->GetHCURSOR();
628 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)gs_wxBusyCursor
);
630 //else: nothing to do, already set
633 // Restore cursor to normal
634 void wxEndBusyCursor()
636 wxCHECK_RET( gs_wxBusyCursorCount
> 0
637 ,_T("no matching wxBeginBusyCursor() for wxEndBusyCursor()")
640 if (--gs_wxBusyCursorCount
== 0)
642 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)gs_wxBusyCursorOld
);
643 gs_wxBusyCursorOld
= 0;
647 // TRUE if we're between the above two calls
650 return (gs_wxBusyCursorCount
> 0);
653 // ---------------------------------------------------------------------------
654 const wxChar
* wxGetHomeDir(
658 wxString
& rStrDir
= *pStr
;
660 // OS/2 has no idea about home,
661 // so use the working directory instead?
663 // 256 was taken from os2def.h
665 # define MAX_PATH 256
671 ::DosQueryCurrentDir(0, zDirName
, &ulDirLen
);
673 return rStrDir
.c_str();
677 wxChar
* wxGetUserHome (
678 const wxString
& rUser
682 wxString
sUser1(rUser
);
684 wxBuffer
= new wxChar
[256];
686 if (sUser1
!= _T(""))
690 if (wxGetUserId( zTmp
691 ,sizeof(zTmp
)/sizeof(char)
694 // Guests belong in the temp dir
695 if (wxStricmp(zTmp
, _T("annonymous")) == 0)
697 if ((zHome
= wxGetenv(_T("TMP"))) != NULL
||
698 (zHome
= wxGetenv(_T("TMPDIR"))) != NULL
||
699 (zHome
= wxGetenv(_T("TEMP"))) != NULL
)
701 return *zHome
? zHome
: (wxChar
*)_T("\\");
703 if (wxStricmp(zTmp
, WXSTRINGCAST sUser1
) == 0)
708 if (sUser1
== _T(""))
710 if ((zHome
= wxGetenv(_T("HOME"))) != NULL
)
712 wxStrcpy(wxBuffer
, zHome
);
713 Unix2DosFilename(wxBuffer
);
714 wxStrcpy(zHome
, wxBuffer
);
720 return NULL
; // No home known!
723 // Check whether this window wants to process messages, e.g. Stop button
724 // in long calculations.
725 bool wxCheckForInterrupt(
733 HWND hwndFilter
= NULLHANDLE
;
734 HWND hwndWin
= (HWND
) pWnd
->GetHWND();
736 while(::WinPeekMsg(hab
, &vMsg
, hwndFilter
, 0, 0, PM_REMOVE
))
738 ::WinDispatchMsg(hab
, &vMsg
);
740 return TRUE
;//*** temporary?
744 wxFAIL_MSG(_T("pWnd==NULL !!!"));
745 return FALSE
;//*** temporary?
749 void wxGetMousePosition(
756 ::WinQueryPointerPos(HWND_DESKTOP
, &vPt
);
761 // Return TRUE if we have a colour display
762 bool wxColourDisplay()
769 hpsScreen
= ::WinGetScreenPS(HWND_DESKTOP
);
770 hdcScreen
= ::GpiQueryDevice(hpsScreen
);
771 ::DevQueryCaps(hdcScreen
, CAPS_COLORS
, 1L, &lColors
);
772 return(lColors
> 1L);
774 // I don't see how the PM display could not be color. Besides, this
775 // was leaking DCs and PSs!!! MN
780 // Returns depth of screen
787 static LONG nDepth
= 0;
789 // The screen colordepth ain't gonna change. No reason to query
792 hpsScreen
= ::WinGetScreenPS(HWND_DESKTOP
);
793 hdcScreen
= ::GpiQueryDevice(hpsScreen
);
794 ::DevQueryCaps(hdcScreen
, CAPS_COLOR_PLANES
, 1L, &lPlanes
);
795 ::DevQueryCaps(hdcScreen
, CAPS_COLOR_BITCOUNT
, 1L, &lBitsPerPixel
);
797 nDepth
= (int)(lPlanes
* lBitsPerPixel
);
798 ::DevCloseDC(hdcScreen
);
799 ::WinReleasePS(hpsScreen
);
804 // Get size of display
812 static LONG lWidth
= 0;
813 static LONG lHeight
= 0;
815 // The screen size ain't gonna change either so just cache the values
817 hpsScreen
= ::WinGetScreenPS(HWND_DESKTOP
);
818 hdcScreen
= ::GpiQueryDevice(hpsScreen
);
819 ::DevQueryCaps(hdcScreen
, CAPS_WIDTH
, 1L, &lWidth
);
820 ::DevQueryCaps(hdcScreen
, CAPS_HEIGHT
, 1L, &lHeight
);
821 ::DevCloseDC(hdcScreen
);
822 ::WinReleasePS(hpsScreen
);
824 *pWidth
= (int)lWidth
;
825 *pHeight
= (int)lHeight
;
828 void wxDisplaySizeMM(
836 hpsScreen
= ::WinGetScreenPS(HWND_DESKTOP
);
837 hdcScreen
= ::GpiQueryDevice(hpsScreen
);
840 ::DevQueryCaps( hdcScreen
841 ,CAPS_HORIZONTAL_RESOLUTION
846 ::DevQueryCaps( hdcScreen
847 ,CAPS_VERTICAL_RESOLUTION
851 ::DevCloseDC(hdcScreen
);
852 ::WinReleasePS(hpsScreen
);
855 void wxClientDisplayRect(int *x
, int *y
, int *width
, int *height
)
857 // This is supposed to return desktop dimensions minus any window
858 // manager panels, menus, taskbars, etc. If there is a way to do that
859 // for this platform please fix this function, otherwise it defaults
860 // to the entire desktop.
863 wxDisplaySize(width
, height
);
871 return (::DosSetCurrentDir(WXSTRINGCAST rDir
));
874 // ---------------------------------------------------------------------------
875 // window information functions
876 // ---------------------------------------------------------------------------
878 wxString WXDLLEXPORT
wxGetWindowText(
883 long lLen
= ::WinQueryWindowTextLength((HWND
)hWnd
) + 1;
885 ::WinQueryWindowText((HWND
)hWnd
, lLen
, vStr
.GetWriteBuf((int)lLen
));
886 vStr
.UngetWriteBuf();
891 wxString WXDLLEXPORT
wxGetWindowClass(
896 int nLen
= 256; // some starting value
900 int nCount
= ::WinQueryClassName((HWND
)hWnd
, nLen
, vStr
.GetWriteBuf(nLen
));
902 vStr
.UngetWriteBuf();
905 // the class name might have been truncated, retry with larger
917 WXWORD WXDLLEXPORT
wxGetWindowId(
921 return ::WinQueryWindowUShort((HWND
)hWnd
, QWS_ID
);
924 wxString WXDLLEXPORT
wxPMErrorToStr(
931 // Remove the high order byte -- it is useless
933 vError
&= 0x0000ffff;
936 case PMERR_INVALID_HWND
:
937 sError
= wxT("Invalid window handle specified");
940 case PMERR_INVALID_FLAG
:
941 sError
= wxT("Invalid flag bit set");
944 case PMERR_NO_MSG_QUEUE
:
945 sError
= wxT("No message queue available");
948 case PMERR_INVALID_PARM
:
949 sError
= wxT("Parameter contained invalid data");
952 case PMERR_INVALID_PARAMETERS
:
953 sError
= wxT("Parameter value is out of range");
956 case PMERR_PARAMETER_OUT_OF_RANGE
:
957 sError
= wxT("Parameter value is out of range");
960 case PMERR_INVALID_INTEGER_ATOM
:
961 sError
= wxT("Not a valid atom");
964 case PMERR_INVALID_HATOMTBL
:
965 sError
= wxT("Atom table handle is invalid");
968 case PMERR_INVALID_ATOM_NAME
:
969 sError
= wxT("Not a valid atom name");
972 case PMERR_ATOM_NAME_NOT_FOUND
:
973 sError
= wxT("Valid name format, but cannot find name in atom table");
977 sError
= wxT("Unknown error");
980 } // end of wxPMErrorToStr
990 vPoint
[0].x
= rRect
.xLeft
;
991 vPoint
[0].y
= rRect
.yBottom
;
992 ::GpiMove(hPS
, &vPoint
[0]);
993 if (dwStyle
& wxSIMPLE_BORDER
||
994 dwStyle
& wxSTATIC_BORDER
)
996 vPoint
[1].x
= rRect
.xRight
- 1;
997 vPoint
[1].y
= rRect
.yTop
- 1;
1005 if (dwStyle
& wxSUNKEN_BORDER
)
1007 LINEBUNDLE vLineBundle
;
1009 vLineBundle
.lColor
= 0x00FFFFFF; // WHITE
1010 vLineBundle
.usMixMode
= FM_OVERPAINT
;
1011 vLineBundle
.fxWidth
= 2;
1012 vLineBundle
.lGeomWidth
= 2;
1013 vLineBundle
.usType
= LINETYPE_SOLID
;
1014 vLineBundle
.usEnd
= 0;
1015 vLineBundle
.usJoin
= 0;
1018 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
1022 vPoint
[1].x
= rRect
.xRight
- 1;
1023 vPoint
[1].y
= rRect
.yTop
- 1;
1030 vPoint
[0].x
= rRect
.xLeft
+ 1;
1031 vPoint
[0].y
= rRect
.yBottom
+ 1;
1032 ::GpiMove(hPS
, &vPoint
[0]);
1033 vPoint
[1].x
= rRect
.xRight
- 2;
1034 vPoint
[1].y
= rRect
.yTop
- 2;
1042 vLineBundle
.lColor
= 0x00000000; // BLACK
1043 vLineBundle
.usMixMode
= FM_OVERPAINT
;
1044 vLineBundle
.fxWidth
= 2;
1045 vLineBundle
.lGeomWidth
= 2;
1046 vLineBundle
.usType
= LINETYPE_SOLID
;
1047 vLineBundle
.usEnd
= 0;
1048 vLineBundle
.usJoin
= 0;
1051 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
1055 vPoint
[0].x
= rRect
.xLeft
+ 2;
1056 vPoint
[0].y
= rRect
.yBottom
+ 2;
1057 ::GpiMove(hPS
, &vPoint
[0]);
1058 vPoint
[1].x
= rRect
.xLeft
+ 2;
1059 vPoint
[1].y
= rRect
.yTop
- 3;
1060 ::GpiLine(hPS
, &vPoint
[1]);
1061 vPoint
[1].x
= rRect
.xRight
- 3;
1062 vPoint
[1].y
= rRect
.yTop
- 3;
1063 ::GpiLine(hPS
, &vPoint
[1]);
1065 vPoint
[0].x
= rRect
.xLeft
+ 3;
1066 vPoint
[0].y
= rRect
.yBottom
+ 3;
1067 ::GpiMove(hPS
, &vPoint
[0]);
1068 vPoint
[1].x
= rRect
.xLeft
+ 3;
1069 vPoint
[1].y
= rRect
.yTop
- 4;
1070 ::GpiLine(hPS
, &vPoint
[1]);
1071 vPoint
[1].x
= rRect
.xRight
- 4;
1072 vPoint
[1].y
= rRect
.yTop
- 4;
1073 ::GpiLine(hPS
, &vPoint
[1]);
1075 if (dwStyle
& wxDOUBLE_BORDER
)
1077 LINEBUNDLE vLineBundle
;
1079 vLineBundle
.lColor
= 0x00FFFFFF; // WHITE
1080 vLineBundle
.usMixMode
= FM_OVERPAINT
;
1081 vLineBundle
.fxWidth
= 2;
1082 vLineBundle
.lGeomWidth
= 2;
1083 vLineBundle
.usType
= LINETYPE_SOLID
;
1084 vLineBundle
.usEnd
= 0;
1085 vLineBundle
.usJoin
= 0;
1088 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
1092 vPoint
[1].x
= rRect
.xRight
- 1;
1093 vPoint
[1].y
= rRect
.yTop
- 1;
1100 vLineBundle
.lColor
= 0x00000000; // WHITE
1101 vLineBundle
.usMixMode
= FM_OVERPAINT
;
1102 vLineBundle
.fxWidth
= 2;
1103 vLineBundle
.lGeomWidth
= 2;
1104 vLineBundle
.usType
= LINETYPE_SOLID
;
1105 vLineBundle
.usEnd
= 0;
1106 vLineBundle
.usJoin
= 0;
1109 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
1113 vPoint
[0].x
= rRect
.xLeft
+ 2;
1114 vPoint
[0].y
= rRect
.yBottom
+ 2;
1115 ::GpiMove(hPS
, &vPoint
[0]);
1116 vPoint
[1].x
= rRect
.xRight
- 2;
1117 vPoint
[1].y
= rRect
.yTop
- 2;
1124 vLineBundle
.lColor
= 0x00FFFFFF; // BLACK
1125 vLineBundle
.usMixMode
= FM_OVERPAINT
;
1126 vLineBundle
.fxWidth
= 2;
1127 vLineBundle
.lGeomWidth
= 2;
1128 vLineBundle
.usType
= LINETYPE_SOLID
;
1129 vLineBundle
.usEnd
= 0;
1130 vLineBundle
.usJoin
= 0;
1133 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
1137 vPoint
[0].x
= rRect
.xLeft
+ 3;
1138 vPoint
[0].y
= rRect
.yBottom
+ 3;
1139 ::GpiMove(hPS
, &vPoint
[0]);
1140 vPoint
[1].x
= rRect
.xRight
- 3;
1141 vPoint
[1].y
= rRect
.yTop
- 3;
1149 if (dwStyle
& wxRAISED_BORDER
)
1151 LINEBUNDLE vLineBundle
;
1153 vLineBundle
.lColor
= 0x00000000; // BLACK
1154 vLineBundle
.usMixMode
= FM_OVERPAINT
;
1155 vLineBundle
.fxWidth
= 2;
1156 vLineBundle
.lGeomWidth
= 2;
1157 vLineBundle
.usType
= LINETYPE_SOLID
;
1158 vLineBundle
.usEnd
= 0;
1159 vLineBundle
.usJoin
= 0;
1162 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
1166 vPoint
[1].x
= rRect
.xRight
- 1;
1167 vPoint
[1].y
= rRect
.yTop
- 1;
1174 vPoint
[0].x
= rRect
.xLeft
+ 1;
1175 vPoint
[0].y
= rRect
.yBottom
+ 1;
1176 ::GpiMove(hPS
, &vPoint
[0]);
1177 vPoint
[1].x
= rRect
.xRight
- 2;
1178 vPoint
[1].y
= rRect
.yTop
- 2;
1186 vLineBundle
.lColor
= 0x00FFFFFF; // WHITE
1187 vLineBundle
.usMixMode
= FM_OVERPAINT
;
1188 vLineBundle
.fxWidth
= 2;
1189 vLineBundle
.lGeomWidth
= 2;
1190 vLineBundle
.usType
= LINETYPE_SOLID
;
1191 vLineBundle
.usEnd
= 0;
1192 vLineBundle
.usJoin
= 0;
1195 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
1199 vPoint
[0].x
= rRect
.xLeft
+ 2;
1200 vPoint
[0].y
= rRect
.yBottom
+ 2;
1201 ::GpiMove(hPS
, &vPoint
[0]);
1202 vPoint
[1].x
= rRect
.xLeft
+ 2;
1203 vPoint
[1].y
= rRect
.yTop
- 3;
1204 ::GpiLine(hPS
, &vPoint
[1]);
1205 vPoint
[1].x
= rRect
.xRight
- 3;
1206 vPoint
[1].y
= rRect
.yTop
- 3;
1207 ::GpiLine(hPS
, &vPoint
[1]);
1209 vPoint
[0].x
= rRect
.xLeft
+ 3;
1210 vPoint
[0].y
= rRect
.yBottom
+ 3;
1211 ::GpiMove(hPS
, &vPoint
[0]);
1212 vPoint
[1].x
= rRect
.xLeft
+ 3;
1213 vPoint
[1].y
= rRect
.yTop
- 4;
1214 ::GpiLine(hPS
, &vPoint
[1]);
1215 vPoint
[1].x
= rRect
.xRight
- 4;
1216 vPoint
[1].y
= rRect
.yTop
- 4;
1217 ::GpiLine(hPS
, &vPoint
[1]);
1219 } // end of wxDrawBorder
1223 , const wxFont
& rFont
1231 if (hWnd
== NULLHANDLE
)
1235 // The fonts available for Presentation Params are just three
1236 // outline fonts, the rest are available to the GPI, so we must
1237 // map the families to one of these three
1239 switch(rFont
.GetFamily())
1242 strcpy(zFacename
, "Script");
1247 strcpy(zFacename
,"Tms Rmn");
1251 strcpy(zFacename
, "Courier");
1255 strcpy(zFacename
, "System VIO");
1259 strcpy(zFacename
, "Helv");
1264 strcpy(zFacename
, "System VIO");
1268 switch(rFont
.GetWeight())
1277 case wxFONTWEIGHT_MAX
:
1278 strcpy(zWeight
, "Bold");
1282 switch(rFont
.GetStyle())
1286 strcpy(zStyle
, "Italic");
1293 sprintf(zFont
, "%d.%s", rFont
.GetPointSize(), zFacename
);
1294 if (zWeight
[0] != '\0')
1297 strcat(zFont
, zWeight
);
1299 if (zStyle
[0] != '\0')
1302 strcat(zFont
, zStyle
);
1304 ::WinSetPresParam(hWnd
, PP_FONTNAMESIZE
, strlen(zFont
) + 1, (PVOID
)zFont
);
1305 } // end of wxOS2SetFont