]> git.saurik.com Git - wxWidgets.git/commitdiff
Catching up to new common class interfaces.
authorDavid Webster <Dave.Webster@bhmi.com>
Fri, 5 Apr 2002 22:09:25 +0000 (22:09 +0000)
committerDavid Webster <Dave.Webster@bhmi.com>
Fri, 5 Apr 2002 22:09:25 +0000 (22:09 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14961 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

12 files changed:
include/wx/os2/toolbar.h
include/wx/os2/toplevel.h
include/wx/os2/window.h
src/os2/bitmap.cpp
src/os2/dataobj.cpp
src/os2/frame.cpp
src/os2/listbox.cpp
src/os2/makefile.va
src/os2/thread.cpp
src/os2/toolbar.cpp
src/os2/toplevel.cpp
src/os2/window.cpp

index 566bbb530a900ce6543110197d4d5170acc89b1d..12d177e51e18be785f9dc5f9294f322adc9f1134 100644 (file)
@@ -85,9 +85,10 @@ protected:
     virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
 
     virtual wxToolBarToolBase* CreateTool( int             vId
-                                          ,const wxBitmap& rBitmap1
-                                          ,const wxBitmap& rBitmap2
-                                          ,bool            bToggle
+                                          ,const wxString& rsLabel
+                                          ,const wxBitmap& rBitmapNormal
+                                          ,const wxBitmap& rBitmapDisabled
+                                          ,wxItemKind      vKind
                                           ,wxObject*       pClientData
                                           ,const wxString& rShortHelpString
                                           ,const wxString& rLongHelpString
index 4224ed63b716f44936d3bf89343acc44b26ec063..e9045aacf6bbacc029cc09a013d8db06f27a3d35 100644 (file)
@@ -67,7 +67,7 @@ public:
            virtual void Restore(void);
            virtual void SendSizeEvent(void);
            virtual void SetIcon(const wxIcon& rIcon);
-    inline virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); }
+           virtual void SetIcons(const wxIconBundle& rIcons);
 
            virtual bool Show(bool bShow = TRUE);
            virtual bool ShowFullScreen( bool bShow
index bffba1d0b3e52d85d3e9049e43cd4fe0d922e014..f225147eac1ecbfbef4bb46ed85969cb8950cfa1 100644 (file)
@@ -496,6 +496,7 @@ protected:
     bool                            m_bBackgroundTransparent:1;
     bool                            m_bMouseInWindow:1;
     bool                            m_bDoubleClickAllowed:1;
+    bool                            m_bLastKeydownProcessed:1;
     bool                            m_bWinCaptured:1;
     WXDWORD                         m_dwExStyle;
 
index 285a736eda2e9345453b4de5e3f9918f0b655977..1ca4781c1d2a54a25af34da727883dd9b0ba0132 100644 (file)
@@ -68,7 +68,7 @@ void wxBitmapRefData::Free()
 
     if (m_hBitmap)
     {
-        if ( !::GpiDeleteBitmap((HBITMAP)m_hBitmap) )
+        if (!::GpiDeleteBitmap((HBITMAP)m_hBitmap))
         {
             wxLogLastError("GpiDeleteBitmap(hbitmap)");
         }
@@ -85,10 +85,6 @@ void wxBitmapRefData::Free()
 // this function should be called from all wxBitmap ctors
 void wxBitmap::Init()
 {
-    // m_refData = NULL; done in the base class ctor
-
-    if (wxTheBitmapList)
-        wxTheBitmapList->AddBitmap(this);
 } // end of wxBitmap::Init
 
 bool wxBitmap::CopyFromIconOrCursor(
@@ -147,15 +143,13 @@ bool wxBitmap::CopyFromIcon(
 
 wxBitmap::~wxBitmap()
 {
-    if (wxTheBitmapList)
-        wxTheBitmapList->DeleteObject(this);
 } // end of wxBitmap::~wxBitmap
 
 wxBitmap::wxBitmap(
   const char                        zBits[]
-, int                               nTheWidth
-, int                               nTheHeight
-, int                               nNoBits
+, int                               nWidth
+, int                               nHeight
+, int                               nDepth
 )
 {
     Init();
@@ -167,48 +161,104 @@ wxBitmap::wxBitmap(
     HPS                             hPs;
     DEVOPENSTRUC                    vDop = { NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL };
     SIZEL                           vSize = {0, 0};
+    char*                           pzData;
 
     wxASSERT(vHabmain != NULL);
 
-    hDc = ::DevOpenDC(vHabmain, OD_MEMORY, (PSZ)"*", 1L, (PDEVOPENDATA)&vDop, 0L);
+    m_refData = pRefData;
 
-    vHeader.cbFix           = sizeof(vHeader);
-    vHeader.cx              = (USHORT)nTheWidth;
-    vHeader.cy              = (USHORT)nTheHeight;
-    vHeader.cPlanes         = 1L;
-    vHeader.cBitCount       = nNoBits;
-    vHeader.ulCompression   = BCA_UNCOMP;
-    vHeader.cxResolution    = 0;
-    vHeader.cyResolution    = 0;
-    vHeader.cclrUsed        = 0;
-    vHeader.cclrImportant   = 0;
-    vHeader.usUnits         = BRU_METRIC;
-    vHeader.usRecording     = BRA_BOTTOMUP;
-    vHeader.usRendering     = BRH_NOTHALFTONED;
-    vHeader.cSize1          = 0;
-    vHeader.cSize2          = 0;
-    vHeader.ulColorEncoding = 0;
-    vHeader.ulIdentifier    = 0;
+    pRefData->m_nWidth        = nWidth;
+    pRefData->m_nHeight       = nHeight;
+    pRefData->m_nDepth        = nDepth;
+    pRefData->m_nNumColors    = 0;
+    pRefData->m_pSelectedInto = NULL;
 
+    hDc = ::DevOpenDC(vHabmain, OD_MEMORY, (PSZ)"*", 1L, (PDEVOPENDATA)&vDop, 0L);
     hPs = ::GpiCreatePS(vHabmain, hDc, &vSize, GPIA_ASSOC | PU_PELS);
     if (hPs == 0)
     {
         wxLogLastError("GpiCreatePS Failure");
     }
 
-    m_refData = pRefData;
+    if (nDepth == 1)
+    {
+        //
+        // We assume that it is in XBM format which is not quite the same as
+        // the format CreateBitmap() wants because the order of bytes in the
+        // line is inversed!
+        //
+        const size_t                nBytesPerLine = (nWidth + 7) / 8;
+        const size_t                nPadding = nBytesPerLine % 2;
+        const size_t                nLen = nHeight * (nPadding + nBytesPerLine);
+        const char*                 pzSrc = zBits;
+        int                         nRows;
+        size_t                      nCols;
+
+        pzData = (char *)malloc(nLen);
+
+        char*                       pzDst = pzData;
+
+        for (nRows = 0; nRows < nHeight; nRows++)
+        {
+            for (nCols = 0; nCols < nBytesPerLine; nCols++)
+            {
+                unsigned char       ucVal = *pzSrc++;
+                unsigned char       ucReversed = 0;
+                int                 nBits;
 
-    pRefData->m_nWidth = nTheWidth;
-    pRefData->m_nHeight = nTheHeight;
-    pRefData->m_nDepth = nNoBits;
-    pRefData->m_nNumColors = 0;
-    pRefData->m_pSelectedInto = NULL;
+                for (nBits = 0; nBits < 8; nBits++)
+                {
+                    ucReversed <<= 1;
+                    ucReversed |= (ucVal & 0x01);
+                    ucVal >>= 1;
+                }
+                *pzDst++ = ucReversed;
+            }
+            if (nPadding)
+                *pzDst++ = 0;
+        }
+    }
+    else
+    {
+        //
+        // Bits should already be in Windows standard format
+        //
+        pzData = (char *)zBits;    // const_cast is harmless
+    }
+
+    memset(&vHeader, '\0', sizeof(BITMAPINFOHEADER2));
+    vHeader.cbFix           = sizeof(vHeader);
+    vHeader.cx              = (USHORT)nWidth;
+    vHeader.cy              = (USHORT)nHeight;
+    vHeader.cPlanes         = 1L;
+    vHeader.cBitCount       = nDepth;
+    vHeader.usReserved      = 0;
+    vHeader.ulCompression   = BCA_UNCOMP;
+    vHeader.usRecording     = BRA_BOTTOMUP;
+    vHeader.usRendering     = BRH_NOTHALFTONED;
+    vHeader.ulColorEncoding = BCE_RGB;
+    vHeader.ulIdentifier    = 0;
+
+    memset(&vInfo, '\0', sizeof(BITMAPINFO2));
+    vInfo.cbFix           = sizeof(vInfo);
+    vInfo.cx              = (USHORT)nWidth;
+    vInfo.cy              = (USHORT)nHeight;
+    vInfo.cPlanes         = 1L;
+    vInfo.cBitCount       = nDepth;
+    vInfo.usReserved      = 0;
+    vInfo.ulCompression   = BCA_UNCOMP;
+    vInfo.usRecording     = BRA_BOTTOMUP;
+    vInfo.usRendering     = BRH_NOTHALFTONED;
+    vInfo.ulColorEncoding = BCE_RGB;
+    vInfo.ulIdentifier    = 0;
+
+    HBITMAP                         hBmp = ::GpiCreateBitmap(hPs, &vHeader, CBM_INIT, (PBYTE)pzData, &vInfo);
 
-    HBITMAP hBmp = ::GpiCreateBitmap(hPs, &vHeader, 0L, NULL, &vInfo);
     if (!hBmp)
     {
         wxLogLastError("CreateBitmap");
     }
+    ::WinReleasePS(hPs);
     SetHBITMAP((WXHBITMAP)hBmp);
 } // end of wxBitmap::wxBitmap
 
@@ -460,335 +510,493 @@ bool wxBitmap::SaveFile(
 // wxImage-wxBitmap convertion
 // ----------------------------------------------------------------------------
 
-bool wxBitmap::CreateFromImage( const wxImage& image, int depth )
+bool wxBitmap::CreateFromImage (
+  const wxImage&                    rImage
+, int                               nDepth
+)
 {
-    wxCHECK_MSG( image.Ok(), FALSE, wxT("invalid image") )
-
-// TODO:
-/*
-    int sizeLimit = 1024*768*3;
-
-    // width and height of the device-dependent bitmap
-    int width = GetWidth();
-    int bmpHeight = GetHeight();
-
-    // calc the number of bytes per scanline and padding
-    int bytePerLine = width*3;
-    int sizeDWORD = sizeof( DWORD );
-    int lineBoundary = bytePerLine % sizeDWORD;
-    int padding = 0;
-    if( lineBoundary > 0 )
+    wxCHECK_MSG(rImage.Ok(), FALSE, wxT("invalid image"));
+
+    int                             nSizeLimit = 1024 * 768 * 3;
+    int                             nWidth = GetWidth();
+    int                             nBmpHeight = GetHeight();
+    int                             nBytePerLine = nWidth * 3;
+    int                             nSizeDWORD = sizeof(DWORD);
+    int                             nLineBoundary = nBytePerLine % nSizeDWORD;
+    int                             nPadding = 0;
+
+    if (nLineBoundary > 0)
     {
-        padding = sizeDWORD - lineBoundary;
-        bytePerLine += padding;
+        nPadding = nSizeDWORD - nLineBoundary;
+        nBytePerLine += nPadding;
     }
-    // calc the number of DIBs and heights of DIBs
-    int numDIB = 1;
-    int hRemain = 0;
-    int height = sizeLimit/bytePerLine;
-    if( height >= bmpHeight )
-        height = bmpHeight;
+
+    //
+    // Calc the number of DIBs and heights of DIBs
+    //
+    int                             nNumDIB = 1;
+    int                             nHRemain = 0;
+    int                             nHeight = nSizeLimit / nBytePerLine;
+
+    if (nHeight >= nBmpHeight)
+        nHeight = nBmpHeight;
     else
     {
-        numDIB =  bmpHeight / height;
-        hRemain = bmpHeight % height;
-        if( hRemain >0 )  numDIB++;
+        nNumDIB  = nBmpHeight / nHeight;
+        nHRemain = nBmpHeight % nHeight;
+        if (nHRemain > 0)
+            nNumDIB++;
     }
 
-    // set bitmap parameters
-    wxBitmap bitmap;
-    wxCHECK_MSG( Ok(), bitmap, wxT("invalid image") );
-    bitmap.SetWidth( width );
-    bitmap.SetHeight( bmpHeight );
-    bitmap.SetDepth( wxDisplayDepth() );
-
-    // create a DIB header
-    int headersize = sizeof(BITMAPINFOHEADER);
-    LPBITMAPINFO lpDIBh = (BITMAPINFO *) malloc( headersize );
-    wxCHECK_MSG( lpDIBh, bitmap, wxT("could not allocate memory for DIB header") );
+    //
+    // Set bitmap parameters
+    //
+    wxCHECK_MSG(rImage.Ok(), FALSE, wxT("invalid image"));
+    SetWidth(nWidth);
+    SetHeight(nBmpHeight);
+    if (nDepth == -1)
+        nDepth = wxDisplayDepth();
+    SetDepth(nDepth);
+
+#if wxUSE_PALETTE
+    //
+    // Copy the palette from the source image
+    //
+    SetPalette(rImage.GetPalette());
+#endif // wxUSE_PALETTE
+
+    //
+    // Create a DIB header
+    //
+    BITMAPINFOHEADER2               vHeader;
+
+    //
     // Fill in the DIB header
-    lpDIBh->bmiHeader.biSize = headersize;
-    lpDIBh->bmiHeader.biWidth = (DWORD)width;
-    lpDIBh->bmiHeader.biHeight = (DWORD)(-height);
-    lpDIBh->bmiHeader.biSizeImage = bytePerLine*height;
-    //   the general formula for biSizeImage:
-    //      ( ( ( ((DWORD)width*24) +31 ) & ~31 ) >> 3 ) * height;
-    lpDIBh->bmiHeader.biPlanes = 1;
-    lpDIBh->bmiHeader.biBitCount = 24;
-    lpDIBh->bmiHeader.biCompression = BI_RGB;
-    lpDIBh->bmiHeader.biClrUsed = 0;
+    //
+    memset(&vHeader, '\0', sizeof(BITMAPINFOHEADER2));
+    vHeader.cbFix           = sizeof(vHeader);
+    vHeader.cx              = (USHORT)nWidth;
+    vHeader.cy              = (USHORT)nHeight;
+    vHeader.cPlanes         = 1L;
+    vHeader.cBitCount       = 24;
+    vHeader.ulCompression   = BCA_UNCOMP;
+    vHeader.cbImage         = nBytePerLine * nHeight;
+    vHeader.cclrUsed        = 0;
+
+    //
     // These seem not really needed for our purpose here.
-    lpDIBh->bmiHeader.biClrImportant = 0;
-    lpDIBh->bmiHeader.biXPelsPerMeter = 0;
-    lpDIBh->bmiHeader.biYPelsPerMeter = 0;
-    // memory for DIB data
-    unsigned char *lpBits;
-    lpBits = (unsigned char *)malloc( lpDIBh->bmiHeader.biSizeImage );
-    if( !lpBits )
+    //
+    vHeader.cxResolution    = 0;
+    vHeader.cyResolution    = 0;
+    vHeader.cclrImportant   = 0;
+    vHeader.usUnits         = BRU_METRIC;
+    vHeader.usReserved      = 0;
+    vHeader.cSize1          = 0;
+    vHeader.cSize2          = 0;
+    vHeader.usRecording     = BRA_BOTTOMUP;
+    vHeader.usRendering     = BRH_NOTHALFTONED;
+    vHeader.ulColorEncoding = BCE_RGB;
+    vHeader.ulIdentifier    = 0;
+
+    //
+    // Memory for DIB data
+    //
+    unsigned char*                  pucBits;
+
+    pucBits = (unsigned char *)malloc(vHeader.cbImage);
+    if(!pucBits)
+    {
+        wxFAIL_MSG(wxT("could not allocate memory for DIB"));
+        return FALSE;
+    }
+
+    //
+    // Create and set the device-dependent bitmap
+    //
+    DEVOPENSTRUC                    vDop  = {0L, "DISPLAY", NULL, 0L, 0L, 0L, 0L, 0L, 0L};
+    SIZEL                           vSize = {0, 0};
+    HDC                             hDC   = ::DevOpenDC(vHabmain, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&vDop, NULLHANDLE);
+    HPS                             hPS   = ::GpiCreatePS(vHabmain, hDC, &vSize, PU_PELS | GPIA_ASSOC);
+    HBITMAP                         hBmp;
+    HBITMAP                         hBmpOld;
+
+    hBmp = ::GpiCreateBitmap( hPS
+                             ,&vHeader
+                             ,0L
+                             ,NULL
+                             ,NULL
+                            );
+    hBmpOld = ::GpiSetBitmap(hPS, hBmp);
+#if wxUSE_PALETTE
+    HPAL                            hOldPalette = NULLHANDLE;
+    if (rImage.GetPalette().Ok())
     {
-        wxFAIL_MSG( wxT("could not allocate memory for DIB") );
-        free( lpDIBh );
-        return bitmap;
+        hOldPalette = ::GpiSelectPalette(hPS, (HPAL)rImage.GetPalette().GetHPALETTE());
     }
+#endif // wxUSE_PALETTE
 
-    // create and set the device-dependent bitmap
-    HDC hdc = ::GetDC(NULL);
-    HDC memdc = ::CreateCompatibleDC( hdc );
-    HBITMAP hbitmap;
-    hbitmap = ::CreateCompatibleBitmap( hdc, width, bmpHeight );
-    ::SelectObject( memdc, hbitmap);
-
-    // copy image data into DIB data and then into DDB (in a loop)
-    unsigned char *data = GetData();
-    int i, j, n;
-    int origin = 0;
-    unsigned char *ptdata = data;
-    unsigned char *ptbits;
-
-    for( n=0; n<numDIB; n++ )
+    //
+    // Copy image data into DIB data and then into DDB (in a loop)
+    //
+    unsigned char*                  pData = rImage.GetData();
+    int                             i;
+    int                             j;
+    int                             n;
+    int                             nOrigin = 0;
+    unsigned char*                  ptdata = pData;
+    unsigned char*                  ptbits;
+
+    for (n = 0; n < nNumDIB; n++)
     {
-        if( numDIB > 1 && n == numDIB-1 && hRemain > 0 )
+        if (nNumDIB > 1 && n == nNumDIB - 1 && nHRemain > 0)
         {
-            // redefine height and size of the (possibly) last smaller DIB
+            //
+            // Redefine height and size of the (possibly) last smaller DIB
             // memory is not reallocated
-            height = hRemain;
-            lpDIBh->bmiHeader.biHeight = (DWORD)(-height);
-            lpDIBh->bmiHeader.biSizeImage = bytePerLine*height;
+            //
+            nHeight         = nHRemain;
+            vHeader.cy      = (DWORD)(nHeight);
+            vHeader.cbImage = nBytePerLine * nHeight;
         }
-        ptbits = lpBits;
-
-        for( j=0; j<height; j++ )
+        ptbits = pucBits;
+        for (j = 0; j < nHeight; j++)
         {
-            for( i=0; i<width; i++ )
+            for (i = 0; i < nWidth; i++)
             {
-                *(ptbits++) = *(ptdata+2);
-                *(ptbits++) = *(ptdata+1);
-                *(ptbits++) = *(ptdata  );
+                *(ptbits++) = *(ptdata + 2);
+                *(ptbits++) = *(ptdata + 1);
+                *(ptbits++) = *(ptdata);
                 ptdata += 3;
             }
-            for( i=0; i< padding; i++ )   *(ptbits++) = 0;
+            for (i = 0; i < nPadding; i++)
+                *(ptbits++) = 0;
         }
-        ::StretchDIBits( memdc, 0, origin, width, height,\
-            0, 0, width, height, lpBits, lpDIBh, DIB_RGB_COLORS, SRCCOPY);
-        origin += height;
-        // if numDIB = 1,  lines below can also be used
-        //    hbitmap = CreateDIBitmap( hdc, &(lpDIBh->bmiHeader), CBM_INIT, lpBits, lpDIBh, DIB_RGB_COLORS );
-        // The above line is equivalent to the following two lines.
-        //    hbitmap = ::CreateCompatibleBitmap( hdc, width, height );
-        //    ::SetDIBits( hdc, hbitmap, 0, height, lpBits, lpDIBh, DIB_RGB_COLORS);
-        // or the following lines
-        //    hbitmap = ::CreateCompatibleBitmap( hdc, width, height );
-        //    HDC memdc = ::CreateCompatibleDC( hdc );
-        //    ::SelectObject( memdc, hbitmap);
-        //    ::SetDIBitsToDevice( memdc, 0, 0, width, height,
-        //            0, 0, 0, height, (void *)lpBits, lpDIBh, DIB_RGB_COLORS);
-        //    ::SelectObject( memdc, 0 );
-        //    ::DeleteDC( memdc );
+
+        //
+        // Have to do something similar to WIN32's StretchDIBits, use GpiBitBlt
+        //
+        POINTL                      vPoint[4] = { 0, nOrigin,
+                                                  nWidth, nHeight,
+                                                  0, 0, nWidth, nHeight
+                                                };
+
+        ::GpiBitBlt( hPS
+                    ,hPS
+                    ,4
+                    ,vPoint
+                    ,ROP_SRCCOPY
+                    ,BBO_IGNORE
+                   );
+        nOrigin += nHeight;
     }
-    bitmap.SetHBITMAP( (WXHBITMAP) hbitmap );
+    SetHBITMAP((WXHBITMAP)hBmp);
+#if wxUSE_PALETTE
+    if (hOldPalette)
+        ::GpiSelectPalette(hPS, hOldPalette);
+#endif // wxUSE_PALETTE
 
-    // similarly, created an mono-bitmap for the possible mask
-    if( HasMask() )
+    //
+    // Similarly, created an mono-bitmap for the possible mask
+    //
+    if (rImage.HasMask())
     {
-        hbitmap = ::CreateBitmap( (WORD)width, (WORD)bmpHeight, 1, 1, NULL );
-        ::SelectObject( memdc, hbitmap);
-        if( numDIB == 1 )   height = bmpHeight;
-        else                height = sizeLimit/bytePerLine;
-        lpDIBh->bmiHeader.biHeight = (DWORD)(-height);
-        lpDIBh->bmiHeader.biSizeImage = bytePerLine*height;
-        origin = 0;
-        unsigned char r = GetMaskRed();
-        unsigned char g = GetMaskGreen();
-        unsigned char b = GetMaskBlue();
-        unsigned char zero = 0, one = 255;
-        ptdata = data;
-        for( n=0; n<numDIB; n++ )
+        memset(&vHeader, '\0', sizeof(BITMAPINFOHEADER2));
+        vHeader.cbFix     =  sizeof(BITMAPINFOHEADER2);
+        vHeader.cx        = nWidth;
+        vHeader.cy        = nHeight;
+        vHeader.cPlanes   = 1;
+        vHeader.cBitCount = 1;
+        hBmp = ::GpiCreateBitmap( hPS
+                                 ,&vHeader
+                                 ,0L
+                                 ,NULL
+                                 ,NULL
+                                );
+        hBmpOld = ::GpiSetBitmap(hPS, hBmp);
+        if (nNumDIB == 1)
+            nHeight = nBmpHeight;
+        else
+            nHeight = nSizeLimit / nBytePerLine;
+        vHeader.cy = (DWORD)(nHeight);
+        vHeader.cbImage = nBytePerLine * nHeight;
+        nOrigin = 0;
+
+        unsigned char               cRed   = rImage.GetMaskRed();
+        unsigned char               cGreen = rImage.GetMaskGreen();
+        unsigned char               cBlue  = rImage.GetMaskBlue();
+        unsigned char               cZero = 0;
+        unsigned char               cOne = 255;
+
+        ptdata = pData;
+        for (n = 0; n < nNumDIB; n++)
         {
-            if( numDIB > 1 && n == numDIB - 1 && hRemain > 0 )
+            if (nNumDIB > 1 && n == nNumDIB - 1 && nHRemain > 0)
             {
-                // redefine height and size of the (possibly) last smaller DIB
+                //
+                // Redefine height and size of the (possibly) last smaller DIB
                 // memory is not reallocated
-                height = hRemain;
-                lpDIBh->bmiHeader.biHeight = (DWORD)(-height);
-                lpDIBh->bmiHeader.biSizeImage = bytePerLine*height;
+                //
+                nHeight         = nHRemain;
+                vHeader.cy      = (DWORD)(nHeight);
+                vHeader.cbImage = nBytePerLine * nHeight;
             }
-            ptbits = lpBits;
-            for( int j=0; j<height; j++ )
+            ptbits = pucBits;
+            for (int j = 0; j < nHeight; j++)
             {
-                for(i=0; i<width; i++ )
+                for (i = 0; i < nWidth; i++)
                 {
-                    if( (*(ptdata++)!=r) | (*(ptdata++)!=g) | (*(ptdata++)!=b) )
+                    if ((*(ptdata++) != cRed) || (*(ptdata++) != cGreen) || (*(ptdata++) != cBlue))
                     {
-                        *(ptbits++) = one;
-                        *(ptbits++) = one;
-                        *(ptbits++) = one;
+                        *(ptbits++) = cOne;
+                        *(ptbits++) = cOne;
+                        *(ptbits++) = cOne;
                     }
                     else
                     {
-                        *(ptbits++) = zero;
-                        *(ptbits++) = zero;
-                        *(ptbits++) = zero;
+                        *(ptbits++) = cZero;
+                        *(ptbits++) = cZero;
+                        *(ptbits++) = cZero;
                     }
                 }
-                for( i=0; i< padding; i++ )   *(ptbits++) = zero;
+                for (i = 0; i < nPadding; i++)
+                    *(ptbits++) = cZero;
             }
-            ::StretchDIBits( memdc, 0, origin, width, height,\
-                0, 0, width, height, lpBits, lpDIBh, DIB_RGB_COLORS, SRCCOPY);
-            origin += height;
+            POINTL                  vPoint[4] = { 0, nOrigin,
+                                                  nWidth, nHeight,
+                                                  0, 0, nWidth, nHeight
+                                                };
+
+            ::GpiBitBlt( hPS
+                        ,hPS
+                        ,4
+                        ,vPoint
+                        ,ROP_SRCCOPY
+                        ,BBO_IGNORE
+                       );
+            nOrigin += nHeight;
         }
-        // create a wxMask object
-        wxMask *mask = new wxMask();
-        mask->SetMaskBitmap( (WXHBITMAP) hbitmap );
-        bitmap.SetMask( mask );
-    }
 
-    // free allocated resources
-    ::SelectObject( memdc, 0 );
-    ::DeleteDC( memdc );
-    ::ReleaseDC(NULL, hdc);
-    free(lpDIBh);
-    free(lpBits);
+        //
+        // Create a wxMask object
+        //
+        wxMask*                     pMask = new wxMask();
 
-    // check the wxBitmap object
-    if( bitmap.GetHBITMAP() )
-        bitmap.SetOk( TRUE );
-    else
-        bitmap.SetOk( FALSE );
-*/
+        pMask->SetMaskBitmap((WXHBITMAP)hBmp);
+        SetMask(pMask);
+        hBmpOld = ::GpiSetBitmap(hPS, hBmp);
+    }
 
+    //
+    // Free allocated resources
+    //
+    ::GpiSetBitmap(hPS, NULLHANDLE);
+    ::GpiDestroyPS(hPS);
+    ::DevCloseDC(hDC);
+    free(pucBits);
     return TRUE;
-}
+} // end of wxBitmap::CreateFromImage
 
 wxImage wxBitmap::ConvertToImage() const
 {
-    wxImage image;
+    wxImage                         vImage;
 
     wxCHECK_MSG( Ok(), wxNullImage, wxT("invalid bitmap") );
 
-    // create an wxImage object
-    int width = GetWidth();
-    int height = GetHeight();
-    image.Create( width, height );
-    unsigned char *data = image.GetData();
-    if( !data )
+    //
+    // Create an wxImage object
+    //
+    int                             nWidth        = GetWidth();
+    int                             nHeight       = GetHeight();
+    int                             nDevWidth;
+    int                             nDevHeight;
+    int                             nBytePerLine  = nWidth * 3;
+    int                             nSizeDWORD    = sizeof(DWORD);
+    int                             nLineBoundary = nBytePerLine % nSizeDWORD;
+    int                             nPadding = 0;
+    unsigned char*                  pData;
+    unsigned char*                  lpBits;
+    long                            lScans;
+    BITMAPINFOHEADER2               vDIBh;
+    BITMAPINFO2                     vDIBInfo;
+    HDC                             hDCMem;
+    PSZ                             pszData[4] = { "Display", NULL, NULL, NULL };
+    HPS                             hPSMem;
+    HPS                             hPS;
+    SIZEL                           vSizlPage = {0,0};
+    HBITMAP                         hBitmap;
+
+    vImage.Create( nWidth
+                  ,nHeight
+                 );
+    pData = vImage.GetData();
+    if(!pData)
     {
         wxFAIL_MSG( wxT("could not allocate data for image") );
         return wxNullImage;
     }
-
-    // calc the number of bytes per scanline and padding in the DIB
-    int bytePerLine = width*3;
-    int sizeDWORD = sizeof( DWORD );
-    int lineBoundary =  bytePerLine % sizeDWORD;
-    int padding = 0;
-    if( lineBoundary > 0 )
-    {
-        padding = sizeDWORD - lineBoundary;
-        bytePerLine += padding;
-    }
-// TODO:
-/*
-    // create a DIB header
-    int headersize = sizeof(BITMAPINFOHEADER);
-    LPBITMAPINFO lpDIBh = (BITMAPINFO *) malloc( headersize );
-    if( !lpDIBh )
+    if(nLineBoundary > 0)
     {
-        wxFAIL_MSG( wxT("could not allocate data for DIB header") );
-        free( data );
-        return;
+        nPadding     = nSizeDWORD - nLineBoundary;
+        nBytePerLine += nPadding;
     }
-    // Fill in the DIB header
-    lpDIBh->bmiHeader.biSize = headersize;
-    lpDIBh->bmiHeader.biWidth = width;
-    lpDIBh->bmiHeader.biHeight = -height;
-    lpDIBh->bmiHeader.biSizeImage = bytePerLine * height;
-    lpDIBh->bmiHeader.biPlanes = 1;
-    lpDIBh->bmiHeader.biBitCount = 24;
-    lpDIBh->bmiHeader.biCompression = BI_RGB;
-    lpDIBh->bmiHeader.biClrUsed = 0;
-    // These seem not really needed for our purpose here.
-    lpDIBh->bmiHeader.biClrImportant = 0;
-    lpDIBh->bmiHeader.biXPelsPerMeter = 0;
-    lpDIBh->bmiHeader.biYPelsPerMeter = 0;
-    // memory for DIB data
-    unsigned char *lpBits;
-    lpBits = (unsigned char *) malloc( lpDIBh->bmiHeader.biSizeImage );
-    if( !lpBits )
+    wxDisplaySize( &nDevWidth
+                  ,&nDevHeight
+                 );
+    //
+    // Create and fill a DIB header
+    //
+    memset(&vDIBh, '\0', sizeof(BITMAPINFOHEADER2));
+    vDIBh.cbFix     =  sizeof(BITMAPINFOHEADER2);
+    vDIBh.cx        = nWidth;
+    vDIBh.cy        = nHeight;
+    vDIBh.cPlanes   = 1;
+    vDIBh.cbImage   = nBytePerLine * nHeight;
+    vDIBh.cBitCount = 24;
+
+    memset(&vDIBInfo, '\0', sizeof(BITMAPINFO2));
+    vDIBInfo.cbFix           = sizeof(BITMAPINFO2);
+    vDIBInfo.cPlanes         = 1;
+    vDIBInfo.cBitCount       = 24;
+    vDIBInfo.ulCompression   = BCA_UNCOMP;
+    vDIBInfo.usReserved      = 0;
+    vDIBInfo.usRecording     = BRA_BOTTOMUP;
+    vDIBInfo.usRendering     = BRH_NOTHALFTONED;
+    vDIBInfo.ulColorEncoding = BCE_RGB;
+    vDIBInfo.ulIdentifier    = 0;
+
+    lpBits = (unsigned char *)malloc(vDIBh.cbImage);
+    if (!lpBits)
     {
-        wxFAIL_MSG( wxT("could not allocate data for DIB") );
-        free( data );
-        free( lpDIBh );
-        return;
+        wxFAIL_MSG(wxT("could not allocate data for DIB"));
+        free(pData);
+        return wxNullImage;
     }
 
-    // copy data from the device-dependent bitmap to the DIB
-    HDC hdc = ::GetDC(NULL);
-    HBITMAP hbitmap;
-    hbitmap = (HBITMAP) bitmap.GetHBITMAP();
-    ::GetDIBits( hdc, hbitmap, 0, height, lpBits, lpDIBh, DIB_RGB_COLORS );
-
-    // copy DIB data into the wxImage object
-    int i, j;
-    unsigned char *ptdata = data;
-    unsigned char *ptbits = lpBits;
-    for( i=0; i<height; i++ )
+    //
+    // Copy data from the device-dependent bitmap to the DIB
+    //
+    hDCMem = ::DevOpenDC( vHabmain
+                         ,OD_MEMORY
+                         ,"*"
+                         ,4
+                         ,(PDEVOPENDATA)pszData
+                         ,NULLHANDLE
+                        );
+    hPSMem = ::GpiCreatePS( vHabmain
+                           ,hDCMem
+                           ,&vSizlPage
+                           ,PU_PELS | GPIA_ASSOC | GPIT_MICRO
+                          );
+    hBitmap = ::GpiCreateBitmap( hPSMem
+                                ,&vDIBh
+                                ,0L
+                                ,NULL
+                                ,NULL
+                               );
+    lScans = ::GpiQueryBitmapBits( hPSMem
+                                  ,0L
+                                  ,(LONG)nHeight
+                                  ,(PBYTE)lpBits
+                                  ,&vDIBInfo
+                                 );
+
+    //
+    // Copy DIB data into the wxImage object
+    //
+    int                             i;
+    int                             j;
+    unsigned char*                  ptdata = pData;
+    unsigned char*                  ptbits = lpBits;
+
+    for (i = 0; i < nHeight; i++)
     {
-        for( j=0; j<width; j++ )
+        for (j = 0; j < nWidth; j++)
         {
             *(ptdata++) = *(ptbits+2);
             *(ptdata++) = *(ptbits+1);
             *(ptdata++) = *(ptbits  );
             ptbits += 3;
         }
-        ptbits += padding;
+        ptbits += nPadding;
     }
 
-    // similarly, set data according to the possible mask bitmap
-    if( bitmap.GetMask() && bitmap.GetMask()->GetMaskBitmap() )
+    //
+    // Similarly, set data according to the possible mask bitmap
+    //
+    if (GetMask() && GetMask()->GetMaskBitmap())
     {
-        hbitmap = (HBITMAP) bitmap.GetMask()->GetMaskBitmap();
-        // memory DC created, color set, data copied, and memory DC deleted
-        HDC memdc = ::CreateCompatibleDC( hdc );
-        ::SetTextColor( memdc, RGB( 0, 0, 0 ) );
-        ::SetBkColor( memdc, RGB( 255, 255, 255 ) );
-        ::GetDIBits( memdc, hbitmap, 0, height, lpBits, lpDIBh, DIB_RGB_COLORS );
-        ::DeleteDC( memdc );
-        // background color set to RGB(16,16,16) in consistent with wxGTK
-        unsigned char r=16, g=16, b=16;
-        ptdata = data;
+        hBitmap = (HBITMAP)GetMask()->GetMaskBitmap();
+
+        //
+        // Memory DC/PS created, color set, data copied, and memory DC/PS deleted
+        //
+        HDC                         hMemDC = ::DevOpenDC( vHabmain
+                                                         ,OD_MEMORY
+                                                         ,"*"
+                                                         ,4
+                                                         ,(PDEVOPENDATA)pszData
+                                                         ,NULLHANDLE
+                                                        );
+        HPS                         hMemPS = ::GpiCreatePS( vHabmain
+                                                           ,hMemDC
+                                                           ,&vSizlPage
+                                                           ,PU_PELS | GPIA_ASSOC | GPIT_MICRO
+                                                          );
+        ::GpiSetColor(hMemPS, OS2RGB(0, 0, 0));
+        ::GpiSetBackColor(hMemPS, OS2RGB(255, 255, 255) );
+        ::GpiQueryBitmapBits( hPSMem
+                             ,0L
+                             ,(LONG)nHeight
+                             ,(PBYTE)lpBits
+                             ,&vDIBInfo
+                            );
+        ::GpiDestroyPS(hMemPS);
+        ::DevCloseDC(hMemDC);
+
+        //
+        // Background color set to RGB(16,16,16) in consistent with wxGTK
+        //
+        unsigned char               ucRed = 16;
+        unsigned char               ucGreen = 16;
+        unsigned char               ucBlue = 16;
+
+        ptdata = pData;
         ptbits = lpBits;
-        for( i=0; i<height; i++ )
+        for (i = 0; i < nHeight; i++)
         {
-            for( j=0; j<width; j++ )
+            for (j = 0; j < nWidth; j++)
             {
-                if( *ptbits != 0 )
+                if (*ptbits != 0)
                     ptdata += 3;
                 else
                 {
-                    *(ptdata++)  = r;
-                    *(ptdata++)  = g;
-                    *(ptdata++)  = b;
+                    *(ptdata++)  = ucRed;
+                    *(ptdata++)  = ucGreen;
+                    *(ptdata++)  = ucBlue;
                 }
                 ptbits += 3;
             }
-            ptbits += padding;
+            ptbits += nPadding;
         }
-        SetMaskColour( r, g, b );
-        SetMask( TRUE );
+        vImage.SetMaskColour( ucRed
+                             ,ucGreen
+                             ,ucBlue
+                            );
+        vImage.SetMask(TRUE);
     }
     else
     {
-        SetMask( FALSE );
+        vImage.SetMask(FALSE);
     }
-    // free allocated resources
-    ::ReleaseDC(NULL, hdc);
-    free(lpDIBh);
-    free(lpBits);
-*/
-
-    return image;
-}
 
+    //
+    // Free allocated resources
+    //
+    ::GpiDestroyPS(hPSMem);
+    ::DevCloseDC(hDCMem);
+    free(lpBits);
+    return vImage;
+} // end of wxBitmap::ConvertToImage
 
 // ----------------------------------------------------------------------------
 // sub bitmap extraction
@@ -924,34 +1132,11 @@ void wxBitmap::SetMask(
     GetBitmapData()->m_pBitmapMask = pMask;
 } // end of wxBitmap::SetMask
 
-//
-// Will try something for OS/2 but not really sure how close
-// to the msw intent this is.
-//
 wxBitmap wxBitmap::GetBitmapForDC(
   wxDC&                             rDc
 ) const
 {
-    wxMemoryDC                      vMemDC;
-    wxBitmap                        vTmpBitmap( this->GetWidth()
-                                               ,this->GetHeight()
-                                               ,rDc.GetDepth()
-                                              );
-    WXHBITMAP                       vOldBitmap;
-    HPS                             hMemoryPS;
-    HPS                             hPs;
-    POINTL                          vPoint[4];
-    SIZEL                           vSize = {0,0};
-
-    hMemoryPS = ::GpiCreatePS(vHabmain, (HDC)vMemDC.GetHDC(), &vSize, PU_PELS | GPIT_MICRO | GPIA_ASSOC);
-    hPs       = ::GpiCreatePS(vHabmain, (HDC)rDc.GetHDC(), &vSize, PU_PELS | GPIT_MICRO | GPIA_ASSOC);
-
-    // TODO: Set the points
-
-    vOldBitmap = (WXHBITMAP)::GpiSetBitmap(hPs, (HBITMAP)vTmpBitmap.GetHBITMAP());
-    ::GpiBitBlt(hPs, hMemoryPS, 4L, vPoint, ROP_SRCCOPY, BBO_IGNORE);
-
-    return(vTmpBitmap);
+    return(*this);
 } // end of wxBitmap::GetBitmapForDC
 
 // ----------------------------------------------------------------------------
@@ -1361,3 +1546,4 @@ HBITMAP wxInvertMask(
 
     return hBmpInvMask;
 } // end of WxWinGdi_InvertMask
+
index 3763a035a12a02ab7752187a8c5b0a966d941b84..b6738a028d52d91da7128ac36f3f3dfded8f07ac 100644 (file)
@@ -323,7 +323,7 @@ bool wxBitmapDataObject::SetData(
         return FALSE;
     }
 
-    m_bitmap = vImage.ConvertToBitmap();
+    m_bitmap = wxBitmap(vImage);
 #endif //wxUSE_STREAMS
 
     return m_bitmap.Ok();
@@ -335,7 +335,7 @@ void wxBitmapDataObject::DoConvertToPng()
         return;
 
 #if wxUSE_STREAMS
-    wxImage                         vImage(m_bitmap);
+    wxImage                         vImage = m_bitmap.ConvertToImage();
     wxPNGHandler                    vHandler;
     wxCountingOutputStream          vCount;
 
index c2e3d87c8300c02d1109b5059bfd9b853a099e35..f0a4438e1653a9eaf3eab3eead15dfdc0d08dadc 100644 (file)
@@ -923,9 +923,10 @@ bool wxFrame::HandlePaint()
             //
             // Icons in PM are the same as "pointers"
             //
+            const wxIcon&           vIcon = GetIcon();
             HPOINTER                hIcon;
 
-            if (m_icon.Ok())
+            if (vIcon.Ok())
                 hIcon = (HPOINTER)::WinSendMsg(m_hFrame, WM_QUERYICON, 0L, 0L);
             else
                 hIcon = (HPOINTER)m_hDefaultIcon;
@@ -1379,9 +1380,10 @@ MRESULT wxFrame::OS2WindowProc(
 
         case CM_QUERYDRAGIMAGE:
             {
+                const wxIcon&           vIcon = GetIcon();
                 HPOINTER                hIcon;
 
-                if (m_icon.Ok())
+                if (vIcon.Ok())
                     hIcon = (HPOINTER)::WinSendMsg(GetHWND(), WM_QUERYICON, 0L, 0L);
                 else
                     hIcon = (HPOINTER)m_hDefaultIcon;
index 2e7ffc1757d4d611f6a27a41b4f722325716216c..d23bedc5125dbf0d97312db157f0250457a86cc6 100644 (file)
@@ -281,7 +281,7 @@ int wxListBox::DoAppend(
         wxOwnerDrawn*               pNewItem = CreateItem(nIndex); // dummy argument
 
         pNewItem->SetName(rsItem);
-        m_aItems.Add(pNewItem);
+        m_aItems.Insert(pNewItem, nIndex);
         ::WinSendMsg(GetHwnd(), LM_SETITEMHANDLE, (MPARAM)((SHORT)nIndex), MPFROMP(pNewItem));
         pNewItem->SetFont(GetFont());
     }
@@ -331,24 +331,18 @@ void wxListBox::DoSetItems(
         //
         // First delete old items
         //
-        size_t                      lUi = m_aItems.Count();
-
-        while (lUi-- != 0)
-        {
-            delete m_aItems[lUi];
-        }
-        m_aItems.Empty();
+        WX_CLEAR_ARRAY(m_aItems);
 
         //
         // Then create new ones
         //
-        for (lUi = 0; lUi < (size_t)m_nNumItems; lUi++)
+        for (size_t ui = 0; ui < (size_t)m_nNumItems; ui++)
         {
-            wxOwnerDrawn*           pNewItem = CreateItem(lUi);
+            wxOwnerDrawn*           pNewItem = CreateItem(ui);
 
-            pNewItem->SetName(raChoices[lUi]);
+            pNewItem->SetName(raChoices[ui]);
             m_aItems.Add(pNewItem);
-            ::WinSendMsg(GetHwnd(), LM_SETITEMHANDLE, MPFROMLONG(lUi), MPFROMP(pNewItem));
+            ::WinSendMsg(GetHwnd(), LM_SETITEMHANDLE, MPFROMLONG(ui), MPFROMP(pNewItem));
         }
     }
 #endif // wxUSE_OWNER_DRAWN
@@ -596,8 +590,25 @@ void wxListBox::DoInsertItems(
     int                             nItems = asItems.GetCount();
 
     for (int i = 0; i < nItems; i++)
-        ::WinSendMsg(GetHwnd(), LM_INSERTITEM, MPFROMLONG((LONG)(i + nPos)), (MPARAM)asItems[i].c_str());
-    m_nNumItems += nItems;
+    {
+        int                         nIndex = (int)::WinSendMsg( GetHwnd()
+                                                               ,LM_INSERTITEM
+                                                               ,MPFROMLONG((LONG)(i + nPos))
+                                                               ,(MPARAM)asItems[i].c_str()
+                                                              );
+
+        wxOwnerDrawn*               pNewItem = CreateItem(nIndex);
+
+        pNewItem->SetName(asItems[i]);
+        pNewItem->SetFont(GetFont());
+        m_aItems.Insert(pNewItem, nIndex);
+        ::WinSendMsg( GetHwnd()
+                     ,LM_SETITEMHANDLE
+                     ,(MPARAM)((SHORT)nIndex)
+                     ,MPFROMP(pNewItem)
+                    );
+        m_nNumItems += nItems;
+    }
 } // end of wxListBox::DoInsertItems
 
 void wxListBox::SetString(
index 7ea6679d1e30908b936cac809f88f5dccaacb086..003352d9492c633adb0beab413ab977a6eeb862b 100644 (file)
@@ -250,9 +250,11 @@ COMMONOBJS = \
   ..\common\$D\hashmap.obj \
   ..\common\$D\helpbase.obj \
   ..\common\$D\http.obj \
+  ..\common\$D\iconbndl.obj \
   ..\common\$D\imagall.obj \
   ..\common\$D\imagbmp.obj \
   ..\common\$D\image.obj \
+  ..\common\$D\imagfill.obj \
   ..\common\$D\imaggif.obj \
   ..\common\$D\imagiff.obj \
   ..\common\$D\imagjpeg.obj \
@@ -384,9 +386,11 @@ COMLIBOBJS2 = \
   hashmap.obj \
   helpbase.obj \
   http.obj \
+  iconbndl.obj \
   imagall.obj \
   imagbmp.obj \
   image.obj \
+  imagfill.obj \
   imaggif.obj \
   imagiff.obj \
   imagjpeg.obj \
@@ -410,11 +414,11 @@ COMLIBOBJS2 = \
   mstream.obj \
   nbkbase.obj \
   object.obj \
-  odbc.obj \
-  paper.obj \
-  popupcmn.obj
+  odbc.obj
 
 COMLIBOBJS3 = \
+  paper.obj \
+  popupcmn.obj \
   prntbase.obj \
   process.obj \
   protocol.obj \
@@ -752,9 +756,11 @@ $(COMLIBOBJS2):
   copy ..\common\$D\hashmap.obj
   copy ..\common\$D\helpbase.obj
   copy ..\common\$D\http.obj
+  copy ..\common\$D\iconbndl.obj
   copy ..\common\$D\imagall.obj
   copy ..\common\$D\imagbmp.obj
   copy ..\common\$D\image.obj
+  copy ..\common\$D\imagfill.obj
   copy ..\common\$D\imaggif.obj
   copy ..\common\$D\imagiff.obj
   copy ..\common\$D\imagjpeg.obj
@@ -779,10 +785,10 @@ $(COMLIBOBJS2):
   copy ..\common\$D\nbkbase.obj
   copy ..\common\$D\object.obj
   copy ..\common\$D\odbc.obj
-  copy ..\common\$D\paper.obj
-  copy ..\common\$D\popupcmn.obj
 
 $(COMLIBOBJS3):
+  copy ..\common\$D\paper.obj
+  copy ..\common\$D\popupcmn.obj
   copy ..\common\$D\prntbase.obj
   copy ..\common\$D\process.obj
   copy ..\common\$D\protocol.obj
index c8cd9a796878066bd20083feca23de9afcce9612..af2e0f7304c9a4911b38d0e7ad7a46a69f4b2501 100644 (file)
@@ -170,7 +170,7 @@ wxMutexError wxMutex::Unlock()
 class wxConditionInternal
 {
 public:
-    inline wxConditionInternal ()
+    inline wxConditionInternal (wxMutex& rMutex) : m_vMutex(rMutex)
     {
         ::DosCreateEventSem(NULL, &m_vEvent, DC_SEM_SHARED, FALSE);
         if (!m_vEvent)
@@ -208,14 +208,15 @@ public:
 
     HEV                             m_vEvent;
     int                             m_nWaiters;
+    wxMutex&                        m_vMutex;
 };
 
-wxCondition::wxCondition()
+wxCondition::wxCondition(wxMutex& rMutex)
 {
     APIRET                          ulrc;
     ULONG                           ulCount;
 
-    m_internal = new wxConditionInternal;
+    m_internal = new wxConditionInternal(rMutex);
     ulrc = ::DosCreateEventSem(NULL, &m_internal->m_vEvent, 0L, FALSE);
     if (ulrc != 0)
     {
@@ -239,10 +240,10 @@ void wxCondition::Wait()
 }
 
 bool wxCondition::Wait(
-  unsigned long                     lSec
-, unsigned long                     lNsec)
+  unsigned long                     lMilliSec
+)
 {
-    return m_internal->Wait(lSec*1000 + lNsec/1000000);
+    return m_internal->Wait(lMilliSec);
 }
 
 void wxCondition::Signal()
index 24a0aa8aff484df33a5195cfdaf1278685a5b2e3..40f561de27a1cdad1d8e542326175c7ebec7c379 100644 (file)
@@ -84,17 +84,19 @@ class wxToolBarTool : public wxToolBarToolBase
 public:
     inline wxToolBarTool( wxToolBar*      pTbar
                          ,int             vId
+                         ,const wxString& rsLabel
                          ,const wxBitmap& rBitmap1
                          ,const wxBitmap& rBitmap2
-                         ,bool            bToggle
+                         ,wxItemKind      vKind
                          ,wxObject*       pClientData
                          ,const wxString& rShortHelpString
                          ,const wxString& rLongHelpString
                         ) : wxToolBarToolBase( pTbar
                                               ,vId
+                                              ,rsLabel
                                               ,rBitmap1
                                               ,rBitmap2
-                                              ,bToggle
+                                              ,vKind
                                               ,pClientData
                                               ,rShortHelpString
                                               ,rLongHelpString
@@ -132,9 +134,10 @@ private:
 
 wxToolBarToolBase* wxToolBar::CreateTool(
   int                               nId
+, const wxString&                   rsLabel
 , const wxBitmap&                   rBitmap1
 , const wxBitmap&                   rBitmap2
-, bool                              bToggle
+, wxItemKind                        vKind
 , wxObject*                         pClientData
 , const wxString&                   rShortHelpString
 , const wxString&                   rLongHelpString
@@ -142,9 +145,10 @@ wxToolBarToolBase* wxToolBar::CreateTool(
 {
     return(new wxToolBarTool( this
                              ,nId
+                             ,rsLabel
                              ,rBitmap1
                              ,rBitmap2
-                             ,bToggle
+                             ,vKind
                              ,pClientData
                              ,rShortHelpString
                              ,rLongHelpString
index a77cb0a375a231ec79ffdd007bae7d0b7275f28d..82cc9d56292a858fcd6f5639246174826b44c995 100644 (file)
@@ -822,17 +822,26 @@ bool wxTopLevelWindowOS2::ShowFullScreen(
 void wxTopLevelWindowOS2::SetIcon(
   const wxIcon&                     rIcon
 )
+{
+    SetIcons(wxIconBundle(rIcon));
+} // end of wxTopLevelWindowOS2::SetIcon
+
+void wxTopLevelWindowOS2::SetIcons(
+  const wxIconBundle&               rIcons
+)
 {
     //
     // This sets m_icon
     //
-    wxTopLevelWindowBase::SetIcon(rIcon);
+    wxTopLevelWindowBase::SetIcons(rIcons);
+
+    const wxIcon&                   vIcon = rIcons.GetIcon(wxSize(32, 32));
 
-    if (m_icon.Ok())
+    if (vIcon.Ok() && vIcon.GetWidth() == 32 && vIcon.GetHeight() == 32)
     {
         ::WinSendMsg( m_hFrame
                      ,WM_SETICON
-                     ,(MPARAM)((HPOINTER)m_icon.GetHICON())
+                     ,(MPARAM)((HPOINTER)vIcon.GetHICON())
                      ,NULL
                     );
         ::WinSendMsg( m_hFrame
index fd71c44b76688b8d61a125ea9d0ff9d59673fb6d..c5000c0f476cc198af5bb4316941b6fa7b09c518 100644 (file)
@@ -278,10 +278,11 @@ void wxWindowOS2::Init()
     m_bDoubleClickAllowed = 0;
     m_bWinCaptured = FALSE;
 
-    m_isBeingDeleted = FALSE;
-    m_fnOldWndProc = 0;
-    m_bUseCtl3D = FALSE;
-    m_bMouseInWindow = FALSE;
+    m_isBeingDeleted        = FALSE;
+    m_fnOldWndProc          = 0;
+    m_bUseCtl3D             = FALSE;
+    m_bMouseInWindow        = FALSE;
+    m_bLastKeydownProcessed = FALSE;
 
     //
     // wxWnd
@@ -2705,12 +2706,14 @@ MRESULT wxWindowOS2::OS2WindowProc(
                 }
                 else // keydown event
                 {
+                    m_bLastKeydownProcessed = FALSE;
                     //
                     // If this has been processed by an event handler,
                     // return 0 now (we've handled it). DON't RETURN
                     // we still need to process further
                     //
                     HandleKeyDown((WXDWORD)wParam, lParam);
+                    m_bLastKeydownProcessed = TRUE;
                     if (uKeyFlags & KC_VIRTUALKEY)
                     {
                         USHORT          uVk = SHORT2FROMMP((MPARAM)lParam);
@@ -4014,6 +4017,16 @@ bool wxWindowOS2::HandleChar(
     bool                            bCtrlDown = FALSE;
     int                             vId;
 
+    if (m_bLastKeydownProcessed)
+    {
+        //
+        // The key was handled in the EVT_KEY_DOWN.  Handling a key in an
+        // EVT_KEY_DOWN handler is meant, by design, to prevent EVT_CHARs
+        // from happening, so just bail out at this point.
+        //
+        m_bLastKeydownProcessed = FALSE;
+        return TRUE;
+    }
     if (isASCII)
     {
         //