1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: os2/utilsgui.cpp
3 // Purpose: Various utility functions only available in GUI
4 // Author: David Webster
6 // Created: 20.08.2003 (extracted from os2/utils.cpp)
8 // Copyright: (c) David Webster
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
31 #include "wx/cursor.h"
34 #include "wx/os2/private.h" // includes <windows.h>
36 // ============================================================================
38 // ============================================================================
40 // ----------------------------------------------------------------------------
41 // functions to work with .INI files
42 // ----------------------------------------------------------------------------
44 // Sleep for nSecs seconds. Attempt a Windows implementation using timers.
45 static bool inTimer
= FALSE
;
47 class wxSleepTimer
: public wxTimer
57 static wxTimer
* wxTheSleepTimer
= NULL
;
59 // Reading and writing resources (eg WIN.INI, .Xdefaults)
62 const wxString
& rSection
63 , const wxString
& rEntry
64 , const wxString
& rValue
65 , const wxString
& rFile
73 hIni
= ::PrfOpenProfile(hab
, (PSZ
)WXSTRINGCAST rFile
);
76 return (::PrfWriteProfileString( hIni
77 ,(PSZ
)WXSTRINGCAST rSection
78 ,(PSZ
)WXSTRINGCAST rEntry
79 ,(PSZ
)WXSTRINGCAST rValue
84 return (::PrfWriteProfileString( HINI_PROFILE
85 ,(PSZ
)WXSTRINGCAST rSection
86 ,(PSZ
)WXSTRINGCAST rEntry
87 ,(PSZ
)WXSTRINGCAST rValue
93 const wxString
& rSection
94 , const wxString
& rEntry
96 , const wxString
& rFile
101 wxSprintf(zBuf
, "%.4f", fValue
);
102 return wxWriteResource( rSection
109 bool wxWriteResource(
110 const wxString
& rSection
111 , const wxString
& rEntry
113 , const wxString
& rFile
118 wxSprintf(zBuf
, "%ld", lValue
);
119 return wxWriteResource( rSection
126 bool wxWriteResource(
127 const wxString
& rSection
128 , const wxString
& rEntry
130 , const wxString
& rFile
135 wxSprintf(zBuf
, "%d", lValue
);
136 return wxWriteResource( rSection
144 const wxString
& rSection
145 , const wxString
& rEntry
147 , const wxString
& rFile
152 wxChar zDefunkt
[] = _T("$$default");
157 hIni
= ::PrfOpenProfile(hab
, (PSZ
)WXSTRINGCAST rFile
);
160 ULONG n
= ::PrfQueryProfileString( hIni
161 ,(PSZ
)WXSTRINGCAST rSection
162 ,(PSZ
)WXSTRINGCAST rEntry
169 if (n
== 0L || wxStrcmp(zBuf
, zDefunkt
) == 0)
178 ULONG n
= ::PrfQueryProfileString( HINI_PROFILE
179 ,(PSZ
)WXSTRINGCAST rSection
180 ,(PSZ
)WXSTRINGCAST rEntry
187 if (n
== 0L || wxStrcmp(zBuf
, zDefunkt
) == 0)
191 strcpy((char*)*ppValue
, zBuf
);
196 const wxString
& rSection
197 , const wxString
& rEntry
199 , const wxString
& rFile
204 zStr
= new wxChar
[1000];
205 bool bSucc
= wxGetResource( rSection
213 *pValue
= (float)wxStrtod(zStr
, NULL
);
225 const wxString
& rSection
226 , const wxString
& rEntry
228 , const wxString
& rFile
233 zStr
= new wxChar
[1000];
234 bool bSucc
= wxGetResource( rSection
242 *pValue
= wxStrtol(zStr
, NULL
, 10);
254 const wxString
& rSection
255 , const wxString
& rEntry
257 , const wxString
& rFile
262 zStr
= new wxChar
[1000];
263 bool bSucc
= wxGetResource( rSection
271 *pValue
= (int)wxStrtol(zStr
, NULL
, 10);
281 #endif // wxUSE_RESOURCES
283 // ---------------------------------------------------------------------------
284 // helper functions for showing a "busy" cursor
285 // ---------------------------------------------------------------------------
287 HCURSOR gs_wxBusyCursor
= 0; // new, busy cursor
288 HCURSOR gs_wxBusyCursorOld
= 0; // old cursor
289 static int gs_wxBusyCursorCount
= 0;
291 // Set the cursor to the busy cursor for all windows
292 void wxBeginBusyCursor(
296 if ( gs_wxBusyCursorCount
++ == 0 )
298 gs_wxBusyCursor
= (HCURSOR
)pCursor
->GetHCURSOR();
299 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)gs_wxBusyCursor
);
301 //else: nothing to do, already set
304 // Restore cursor to normal
305 void wxEndBusyCursor()
307 wxCHECK_RET( gs_wxBusyCursorCount
> 0
308 ,_T("no matching wxBeginBusyCursor() for wxEndBusyCursor()")
311 if (--gs_wxBusyCursorCount
== 0)
313 ::WinSetPointer(HWND_DESKTOP
, (HPOINTER
)gs_wxBusyCursorOld
);
314 gs_wxBusyCursorOld
= 0;
318 // TRUE if we're between the above two calls
321 return (gs_wxBusyCursorCount
> 0);
324 // Check whether this window wants to process messages, e.g. Stop button
325 // in long calculations.
326 bool wxCheckForInterrupt(
334 HWND hwndFilter
= NULLHANDLE
;
335 HWND hwndWin
= (HWND
) pWnd
->GetHWND();
337 while(::WinPeekMsg(hab
, &vMsg
, hwndFilter
, 0, 0, PM_REMOVE
))
339 ::WinDispatchMsg(hab
, &vMsg
);
341 return TRUE
;//*** temporary?
345 wxFAIL_MSG(_T("pWnd==NULL !!!"));
346 return FALSE
;//*** temporary?
350 // ----------------------------------------------------------------------------
352 // ----------------------------------------------------------------------------
354 // See also the wxGetMousePosition in window.cpp
355 // Deprecated: use wxPoint wxGetMousePosition() instead
356 void wxGetMousePosition(
363 ::WinQueryPointerPos(HWND_DESKTOP
, &vPt
);
368 // Return TRUE if we have a colour display
369 bool wxColourDisplay()
376 hpsScreen
= ::WinGetScreenPS(HWND_DESKTOP
);
377 hdcScreen
= ::GpiQueryDevice(hpsScreen
);
378 ::DevQueryCaps(hdcScreen
, CAPS_COLORS
, 1L, &lColors
);
379 return(lColors
> 1L);
381 // I don't see how the PM display could not be color. Besides, this
382 // was leaking DCs and PSs!!! MN
387 // Returns depth of screen
394 static LONG nDepth
= 0;
396 // The screen colordepth ain't gonna change. No reason to query
399 hpsScreen
= ::WinGetScreenPS(HWND_DESKTOP
);
400 hdcScreen
= ::GpiQueryDevice(hpsScreen
);
401 ::DevQueryCaps(hdcScreen
, CAPS_COLOR_PLANES
, 1L, &lPlanes
);
402 ::DevQueryCaps(hdcScreen
, CAPS_COLOR_BITCOUNT
, 1L, &lBitsPerPixel
);
404 nDepth
= (int)(lPlanes
* lBitsPerPixel
);
405 ::DevCloseDC(hdcScreen
);
406 ::WinReleasePS(hpsScreen
);
411 // Get size of display
419 static LONG lWidth
= 0;
420 static LONG lHeight
= 0;
422 // The screen size ain't gonna change either so just cache the values
424 hpsScreen
= ::WinGetScreenPS(HWND_DESKTOP
);
425 hdcScreen
= ::GpiQueryDevice(hpsScreen
);
426 ::DevQueryCaps(hdcScreen
, CAPS_WIDTH
, 1L, &lWidth
);
427 ::DevQueryCaps(hdcScreen
, CAPS_HEIGHT
, 1L, &lHeight
);
428 ::DevCloseDC(hdcScreen
);
429 ::WinReleasePS(hpsScreen
);
431 *pWidth
= (int)lWidth
;
432 *pHeight
= (int)lHeight
;
435 void wxDisplaySizeMM(
443 hpsScreen
= ::WinGetScreenPS(HWND_DESKTOP
);
444 hdcScreen
= ::GpiQueryDevice(hpsScreen
);
447 ::DevQueryCaps( hdcScreen
448 ,CAPS_HORIZONTAL_RESOLUTION
453 ::DevQueryCaps( hdcScreen
454 ,CAPS_VERTICAL_RESOLUTION
458 ::DevCloseDC(hdcScreen
);
459 ::WinReleasePS(hpsScreen
);
462 void wxClientDisplayRect(int *x
, int *y
, int *width
, int *height
)
464 // This is supposed to return desktop dimensions minus any window
465 // manager panels, menus, taskbars, etc. If there is a way to do that
466 // for this platform please fix this function, otherwise it defaults
467 // to the entire desktop.
470 wxDisplaySize(width
, height
);
473 // ---------------------------------------------------------------------------
474 // window information functions
475 // ---------------------------------------------------------------------------
477 wxString WXDLLEXPORT
wxGetWindowText(
482 long lLen
= ::WinQueryWindowTextLength((HWND
)hWnd
) + 1;
484 ::WinQueryWindowText((HWND
)hWnd
, lLen
, vStr
.GetWriteBuf((int)lLen
));
485 vStr
.UngetWriteBuf();
490 wxString WXDLLEXPORT
wxGetWindowClass(
495 int nLen
= 256; // some starting value
499 int nCount
= ::WinQueryClassName((HWND
)hWnd
, nLen
, vStr
.GetWriteBuf(nLen
));
501 vStr
.UngetWriteBuf();
504 // the class name might have been truncated, retry with larger
516 WXWORD WXDLLEXPORT
wxGetWindowId(
520 return ::WinQueryWindowUShort((HWND
)hWnd
, QWS_ID
);
531 vPoint
[0].x
= rRect
.xLeft
;
532 vPoint
[0].y
= rRect
.yBottom
;
533 ::GpiMove(hPS
, &vPoint
[0]);
534 if (dwStyle
& wxSIMPLE_BORDER
||
535 dwStyle
& wxSTATIC_BORDER
)
537 vPoint
[1].x
= rRect
.xRight
- 1;
538 vPoint
[1].y
= rRect
.yTop
- 1;
546 if (dwStyle
& wxSUNKEN_BORDER
)
548 LINEBUNDLE vLineBundle
;
550 vLineBundle
.lColor
= 0x00FFFFFF; // WHITE
551 vLineBundle
.usMixMode
= FM_OVERPAINT
;
552 vLineBundle
.fxWidth
= 2;
553 vLineBundle
.lGeomWidth
= 2;
554 vLineBundle
.usType
= LINETYPE_SOLID
;
555 vLineBundle
.usEnd
= 0;
556 vLineBundle
.usJoin
= 0;
559 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
563 vPoint
[1].x
= rRect
.xRight
- 1;
564 vPoint
[1].y
= rRect
.yTop
- 1;
571 vPoint
[0].x
= rRect
.xLeft
+ 1;
572 vPoint
[0].y
= rRect
.yBottom
+ 1;
573 ::GpiMove(hPS
, &vPoint
[0]);
574 vPoint
[1].x
= rRect
.xRight
- 2;
575 vPoint
[1].y
= rRect
.yTop
- 2;
583 vLineBundle
.lColor
= 0x00000000; // BLACK
584 vLineBundle
.usMixMode
= FM_OVERPAINT
;
585 vLineBundle
.fxWidth
= 2;
586 vLineBundle
.lGeomWidth
= 2;
587 vLineBundle
.usType
= LINETYPE_SOLID
;
588 vLineBundle
.usEnd
= 0;
589 vLineBundle
.usJoin
= 0;
592 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
596 vPoint
[0].x
= rRect
.xLeft
+ 2;
597 vPoint
[0].y
= rRect
.yBottom
+ 2;
598 ::GpiMove(hPS
, &vPoint
[0]);
599 vPoint
[1].x
= rRect
.xLeft
+ 2;
600 vPoint
[1].y
= rRect
.yTop
- 3;
601 ::GpiLine(hPS
, &vPoint
[1]);
602 vPoint
[1].x
= rRect
.xRight
- 3;
603 vPoint
[1].y
= rRect
.yTop
- 3;
604 ::GpiLine(hPS
, &vPoint
[1]);
606 vPoint
[0].x
= rRect
.xLeft
+ 3;
607 vPoint
[0].y
= rRect
.yBottom
+ 3;
608 ::GpiMove(hPS
, &vPoint
[0]);
609 vPoint
[1].x
= rRect
.xLeft
+ 3;
610 vPoint
[1].y
= rRect
.yTop
- 4;
611 ::GpiLine(hPS
, &vPoint
[1]);
612 vPoint
[1].x
= rRect
.xRight
- 4;
613 vPoint
[1].y
= rRect
.yTop
- 4;
614 ::GpiLine(hPS
, &vPoint
[1]);
616 if (dwStyle
& wxDOUBLE_BORDER
)
618 LINEBUNDLE vLineBundle
;
620 vLineBundle
.lColor
= 0x00FFFFFF; // WHITE
621 vLineBundle
.usMixMode
= FM_OVERPAINT
;
622 vLineBundle
.fxWidth
= 2;
623 vLineBundle
.lGeomWidth
= 2;
624 vLineBundle
.usType
= LINETYPE_SOLID
;
625 vLineBundle
.usEnd
= 0;
626 vLineBundle
.usJoin
= 0;
629 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
633 vPoint
[1].x
= rRect
.xRight
- 1;
634 vPoint
[1].y
= rRect
.yTop
- 1;
641 vLineBundle
.lColor
= 0x00000000; // WHITE
642 vLineBundle
.usMixMode
= FM_OVERPAINT
;
643 vLineBundle
.fxWidth
= 2;
644 vLineBundle
.lGeomWidth
= 2;
645 vLineBundle
.usType
= LINETYPE_SOLID
;
646 vLineBundle
.usEnd
= 0;
647 vLineBundle
.usJoin
= 0;
650 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
654 vPoint
[0].x
= rRect
.xLeft
+ 2;
655 vPoint
[0].y
= rRect
.yBottom
+ 2;
656 ::GpiMove(hPS
, &vPoint
[0]);
657 vPoint
[1].x
= rRect
.xRight
- 2;
658 vPoint
[1].y
= rRect
.yTop
- 2;
665 vLineBundle
.lColor
= 0x00FFFFFF; // BLACK
666 vLineBundle
.usMixMode
= FM_OVERPAINT
;
667 vLineBundle
.fxWidth
= 2;
668 vLineBundle
.lGeomWidth
= 2;
669 vLineBundle
.usType
= LINETYPE_SOLID
;
670 vLineBundle
.usEnd
= 0;
671 vLineBundle
.usJoin
= 0;
674 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
678 vPoint
[0].x
= rRect
.xLeft
+ 3;
679 vPoint
[0].y
= rRect
.yBottom
+ 3;
680 ::GpiMove(hPS
, &vPoint
[0]);
681 vPoint
[1].x
= rRect
.xRight
- 3;
682 vPoint
[1].y
= rRect
.yTop
- 3;
690 if (dwStyle
& wxRAISED_BORDER
)
692 LINEBUNDLE vLineBundle
;
694 vLineBundle
.lColor
= 0x00000000; // BLACK
695 vLineBundle
.usMixMode
= FM_OVERPAINT
;
696 vLineBundle
.fxWidth
= 2;
697 vLineBundle
.lGeomWidth
= 2;
698 vLineBundle
.usType
= LINETYPE_SOLID
;
699 vLineBundle
.usEnd
= 0;
700 vLineBundle
.usJoin
= 0;
703 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
707 vPoint
[1].x
= rRect
.xRight
- 1;
708 vPoint
[1].y
= rRect
.yTop
- 1;
715 vPoint
[0].x
= rRect
.xLeft
+ 1;
716 vPoint
[0].y
= rRect
.yBottom
+ 1;
717 ::GpiMove(hPS
, &vPoint
[0]);
718 vPoint
[1].x
= rRect
.xRight
- 2;
719 vPoint
[1].y
= rRect
.yTop
- 2;
727 vLineBundle
.lColor
= 0x00FFFFFF; // WHITE
728 vLineBundle
.usMixMode
= FM_OVERPAINT
;
729 vLineBundle
.fxWidth
= 2;
730 vLineBundle
.lGeomWidth
= 2;
731 vLineBundle
.usType
= LINETYPE_SOLID
;
732 vLineBundle
.usEnd
= 0;
733 vLineBundle
.usJoin
= 0;
736 ,LBB_COLOR
| LBB_MIX_MODE
| LBB_WIDTH
| LBB_GEOM_WIDTH
| LBB_TYPE
740 vPoint
[0].x
= rRect
.xLeft
+ 2;
741 vPoint
[0].y
= rRect
.yBottom
+ 2;
742 ::GpiMove(hPS
, &vPoint
[0]);
743 vPoint
[1].x
= rRect
.xLeft
+ 2;
744 vPoint
[1].y
= rRect
.yTop
- 3;
745 ::GpiLine(hPS
, &vPoint
[1]);
746 vPoint
[1].x
= rRect
.xRight
- 3;
747 vPoint
[1].y
= rRect
.yTop
- 3;
748 ::GpiLine(hPS
, &vPoint
[1]);
750 vPoint
[0].x
= rRect
.xLeft
+ 3;
751 vPoint
[0].y
= rRect
.yBottom
+ 3;
752 ::GpiMove(hPS
, &vPoint
[0]);
753 vPoint
[1].x
= rRect
.xLeft
+ 3;
754 vPoint
[1].y
= rRect
.yTop
- 4;
755 ::GpiLine(hPS
, &vPoint
[1]);
756 vPoint
[1].x
= rRect
.xRight
- 4;
757 vPoint
[1].y
= rRect
.yTop
- 4;
758 ::GpiLine(hPS
, &vPoint
[1]);
760 } // end of wxDrawBorder
764 , const wxFont
& rFont
772 if (hWnd
== NULLHANDLE
)
776 // The fonts available for Presentation Params are just a few
777 // outline fonts, the rest are available to the GPI, so we must
778 // map the families to one of these three
780 switch(rFont
.GetFamily())
783 strcpy(zFacename
, "Script");
787 strcpy(zFacename
, "WarpSans");
791 strcpy(zFacename
,"Times New Roman");
795 strcpy(zFacename
, "Courier New");
799 strcpy(zFacename
, "Courier New");
805 strcpy(zFacename
, "Helvetica");
809 switch(rFont
.GetWeight())
818 case wxFONTWEIGHT_MAX
:
819 strcpy(zWeight
, "Bold");
823 switch(rFont
.GetStyle())
827 strcpy(zStyle
, "Italic");
834 sprintf(zFont
, "%d.%s", rFont
.GetPointSize(), zFacename
);
835 if (zWeight
[0] != '\0')
838 strcat(zFont
, zWeight
);
840 if (zStyle
[0] != '\0')
843 strcat(zFont
, zStyle
);
845 ::WinSetPresParam(hWnd
, PP_FONTNAMESIZE
, strlen(zFont
) + 1, (PVOID
)zFont
);
846 } // end of wxOS2SetFont
848 // ---------------------------------------------------------------------------
849 // Helper for taking a regular bitmap and giving it a disabled look
850 // ---------------------------------------------------------------------------
851 wxBitmap
wxDisableBitmap(
856 wxMask
* pMask
= rBmp
.GetMask();
859 return(wxNullBitmap
);
861 DEVOPENSTRUC vDop
= {0L, "DISPLAY", NULL
, 0L, 0L, 0L, 0L, 0L, 0L};
862 SIZEL vSize
= {0, 0};
863 HDC hDC
= ::DevOpenDC(vHabmain
, OD_MEMORY
, "*", 5L, (PDEVOPENDATA
)&vDop
, NULLHANDLE
);
864 HPS hPS
= ::GpiCreatePS(vHabmain
, hDC
, &vSize
, PU_PELS
| GPIA_ASSOC
);
865 BITMAPINFOHEADER2 vHeader
;
869 HBITMAP hBitmap
= (HBITMAP
)rBmp
.GetHBITMAP();
870 HBITMAP hOldBitmap
= NULLHANDLE
;
871 HBITMAP hOldMask
= NULLHANDLE
;
872 HBITMAP hMask
= (HBITMAP
)rBmp
.GetMask()->GetMaskBitmap();
873 unsigned char* pucBits
; // buffer that will contain the bitmap data
874 unsigned char* pucData
; // pointer to use to traverse bitmap data
875 unsigned char* pucBitsMask
; // buffer that will contain the mask data
876 unsigned char* pucDataMask
; // pointer to use to traverse mask data
879 bool bpp16
= (wxDisplayDepth() == 16);
881 memset(&vHeader
, '\0', 16);
884 memset(&vInfo
, '\0', 16);
886 vInfo
.cx
= (ULONG
)rBmp
.GetWidth();
887 vInfo
.cy
= (ULONG
)rBmp
.GetHeight();
889 vInfo
.cBitCount
= 24; // Set to desired count going in
892 // Create the buffers for data....all wxBitmaps are 24 bit internally
894 int nBytesPerLine
= rBmp
.GetWidth() * 3;
895 int nSizeDWORD
= sizeof(DWORD
);
896 int nLineBoundary
= nBytesPerLine
% nSizeDWORD
;
902 // Bitmap must be ina double-word alligned address so we may
903 // have some padding to worry about
905 if (nLineBoundary
> 0)
907 nPadding
= nSizeDWORD
- nLineBoundary
;
908 nBytesPerLine
+= nPadding
;
910 pucBits
= (unsigned char *)malloc(nBytesPerLine
* rBmp
.GetHeight());
911 memset(pucBits
, '\0', (nBytesPerLine
* rBmp
.GetHeight()));
912 pucBitsMask
= (unsigned char *)malloc(nBytesPerLine
* rBmp
.GetHeight());
913 memset(pucBitsMask
, '\0', (nBytesPerLine
* rBmp
.GetHeight()));
916 // Extract the bitmap and mask data
918 if ((hOldBitmap
= ::GpiSetBitmap(hPS
, hBitmap
)) == HBM_ERROR
)
920 vError
= ::WinGetLastError(vHabmain
);
921 sError
= wxPMErrorToStr(vError
);
923 ::GpiQueryBitmapInfoHeader(hBitmap
, &vHeader
);
924 vInfo
.cBitCount
= 24;
925 if ((lScans
= ::GpiQueryBitmapBits( hPS
927 ,(LONG
)rBmp
.GetHeight()
932 vError
= ::WinGetLastError(vHabmain
);
933 sError
= wxPMErrorToStr(vError
);
935 if ((hOldMask
= ::GpiSetBitmap(hPS
, hMask
)) == HBM_ERROR
)
937 vError
= ::WinGetLastError(vHabmain
);
938 sError
= wxPMErrorToStr(vError
);
940 ::GpiQueryBitmapInfoHeader(hMask
, &vHeader
);
941 vInfo
.cBitCount
= 24;
942 if ((lScans
= ::GpiQueryBitmapBits( hPS
944 ,(LONG
)rBmp
.GetHeight()
949 vError
= ::WinGetLastError(vHabmain
);
950 sError
= wxPMErrorToStr(vError
);
952 if (( hMask
= ::GpiSetBitmap(hPS
, hOldMask
)) == HBM_ERROR
)
954 vError
= ::WinGetLastError(vHabmain
);
955 sError
= wxPMErrorToStr(vError
);
958 pucDataMask
= pucBitsMask
;
961 // Get the mask value
963 for (i
= 0; i
< rBmp
.GetHeight(); i
++)
965 for (j
= 0; j
< rBmp
.GetWidth(); j
++)
968 if (bpp16
&& *pucDataMask
== 0xF8) // 16 bit display gobblygook
973 else if (*pucDataMask
== 0xFF) // set to grey
980 *pucData
= ((unsigned char)(lColor
>> 16));
985 if (bpp16
&& *(pucDataMask
+ 1) == 0xFC) // 16 bit display gobblygook
990 else if (*(pucDataMask
+ 1) == 0xFF) // set to grey
997 *pucData
= ((unsigned char)(lColor
>> 8));
1002 if (bpp16
&& *(pucDataMask
+ 2) == 0xF8) // 16 bit display gobblygook
1007 else if (*(pucDataMask
+ 2) == 0xFF) // set to grey
1014 *pucData
= ((unsigned char)lColor
);
1019 for (j
= 0; j
< nPadding
; j
++)
1027 // Create a new bitmap and set the modified bits
1029 wxBitmap
vNewBmp( rBmp
.GetWidth()
1033 HBITMAP hNewBmp
= (HBITMAP
)vNewBmp
.GetHBITMAP();
1035 if ((hOldBitmap
= ::GpiSetBitmap(hPS
, hNewBmp
)) == HBM_ERROR
)
1037 vError
= ::WinGetLastError(vHabmain
);
1038 sError
= wxPMErrorToStr(vError
);
1040 if ((lScansSet
= ::GpiSetBitmapBits( hPS
1042 ,(LONG
)rBmp
.GetHeight()
1048 vError
= ::WinGetLastError(vHabmain
);
1049 sError
= wxPMErrorToStr(vError
);
1053 pNewMask
= new wxMask(pMask
->GetMaskBitmap());
1054 vNewBmp
.SetMask(pNewMask
);
1056 ::GpiSetBitmap(hPS
, NULLHANDLE
);
1057 ::GpiDestroyPS(hPS
);
1061 return(wxNullBitmap
);
1062 } // end of wxDisableBitmap
1064 COLORREF
wxColourToRGB(
1065 const wxColour
& rColor
1068 return(OS2RGB(rColor
.Red(), rColor
.Green(), rColor
.Blue()));
1069 } // end of wxColourToRGB