]> git.saurik.com Git - wxWidgets.git/commitdiff
OS/2 updates and initial toolbar implementation
authorDavid Webster <Dave.Webster@bhmi.com>
Mon, 1 Jul 2002 22:22:13 +0000 (22:22 +0000)
committerDavid Webster <Dave.Webster@bhmi.com>
Mon, 1 Jul 2002 22:22:13 +0000 (22:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15996 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

14 files changed:
include/wx/os2/frame.h
include/wx/os2/slider.h
include/wx/os2/toolbar.h
src/os2/dc.cpp
src/os2/font.cpp
src/os2/fontutil.cpp
src/os2/frame.cpp
src/os2/makefile.va
src/os2/pen.cpp
src/os2/settings.cpp
src/os2/statbmp.cpp
src/os2/toolbar.cpp
src/os2/window.cpp
src/os2/wx23.def

index d05f166f99502d65a51684ab73a5dba9180c4cf0..5f1c971b076aab59579180aab8ecbe7d519596a9 100644 (file)
@@ -71,6 +71,10 @@ public:
                                      ,const wxString& rsName = wxToolBarNameStr
                                     );
 
+    virtual wxToolBar* OnCreateToolBar( long            lStyle
+                                       ,wxWindowID      vId
+                                       ,const wxString& rsName
+                                      );
     virtual void       PositionToolBar(void);
 #endif // wxUSE_TOOLBAR
 
index 887177c827ace0303dc197ee26fe32d57b0813ee..006158d7b88730cfd3e50d3d629f77683f29f1ca 100644 (file)
@@ -66,16 +66,13 @@ public:
          virtual int  GetValue(void) const ;
          virtual void SetValue(int);
 
-         virtual void DoGetSize( int* pnWidth
-                                ,int* pnHeight
-                               ) const;
                  void GetSize( int* pnX
                               ,int* pnY
                              ) const;
                  void GetPosition( int* pnX
                                   ,int* pnY
                                  ) const ;
-                 bool Show(bool bShow);
+                 bool Show(bool bShow = TRUE);
                  void SetRange( int nMinValue
                                ,int nMaxValue
                               );
@@ -148,6 +145,9 @@ protected:
     int                             m_nThumbLength;
     int                             m_nSizeFlags;
 
+    virtual void DoGetSize( int* pnWidth
+                           ,int* pnHeight
+                          ) const;
     virtual void DoSetSize( int  nX
                            ,int  nY
                            ,int  nWidth
index 12d177e51e18be785f9dc5f9294f322adc9f1134..5b3fb460c8e9cdaaa69c83d8a5d1eccc4fbdfd37 100644 (file)
@@ -28,10 +28,11 @@ public:
                      ,wxWindowID      vId
                      ,const wxPoint&  rPos = wxDefaultPosition
                      ,const wxSize&   rSize = wxDefaultSize
-                     ,long            lStyle = wxNO_BORDER|wxTB_HORIZONTAL
+                     ,long            lStyle = wxNO_BORDER | wxTB_HORIZONTAL
                      ,const wxString& rName = wxToolBarNameStr
                     )
     {
+        Init();
         Create( pParent
                ,vId
                ,rPos
@@ -40,77 +41,114 @@ public:
                ,rName
               );
     }
+    virtual ~wxToolBar();
+
     bool Create( wxWindow*       pParent
                 ,wxWindowID      vId
                 ,const wxPoint&  rPos = wxDefaultPosition
                 ,const wxSize&   rSize = wxDefaultSize
-                ,long            lStyle = wxNO_BORDER|wxTB_HORIZONTAL
+                ,long            lStyle = wxNO_BORDER | wxTB_HORIZONTAL
                 ,const wxString& rName = wxToolBarNameStr
                );
 
-    virtual ~wxToolBar();
 
-    // override/implement base class virtuals
-    virtual wxToolBarToolBase* FindToolForPosition( wxCoord x
-                                                   ,wxCoord y
+    //
+    // Override/implement base class virtuals
+    //
+    virtual wxToolBarToolBase* FindToolForPosition( wxCoord vX
+                                                   ,wxCoord vY
                                                   ) const;
+    virtual bool               Realize(void);
+    virtual void               SetRows(int nRows);
 
-    // The post-tool-addition call
-    virtual bool Realize(void);
-
-    virtual void SetToolBitmapSize(const wxSize& rSize);
-    virtual wxSize GetToolSize(void) const;
-
-    virtual void SetRows(int nRows);
-
-    // IMPLEMENTATION
-    virtual bool OS2Command( WXUINT uParam
-                            ,WXWORD wId
-                           );
-    virtual bool OS2OnNotify( int       nCtrl
-                             ,WXLPARAM  lParam
-                             ,WXLPARAM* pResult
-                            );
-    void OnMouseEvent(wxMouseEvent& rEvent);
-    void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
+    //
+    // Event handlers
+    //
+    void OnPaint(wxPaintEvent& event);
+    void OnSize(wxSizeEvent& event);
+    void OnMouseEvent(wxMouseEvent& event);
+    void OnKillFocus(wxFocusEvent& event);
 
 protected:
-    void Init(void);
-    // implement base class pure virtuals
-    virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
-    virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
-
-    virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
-    virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
-    virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
+    //
+    // Common part of all ctors
+    //
+    void Init();
+
+    //
+    // Implement base class pure virtuals
+    //
+    virtual wxToolBarToolBase* DoAddTool( int id
+                                         ,const wxString& label
+                                         ,const wxBitmap& bitmap
+                                         ,const wxBitmap& bmpDisabled
+                                         ,wxItemKind kind
+                                         ,const wxString& shortHelp = wxEmptyString
+                                         ,const wxString& longHelp = wxEmptyString
+                                         ,wxObject *clientData = NULL
+                                         ,wxCoord xPos = -1
+                                         ,wxCoord yPos = -1
+                                        );
+
+    virtual bool DoInsertTool( size_t             nPos
+                              ,wxToolBarToolBase* pTool
+                             );
+    virtual bool DoDeleteTool( size_t              nPos
+                              , wxToolBarToolBase* pTool
+                             );
+
+    virtual void DoEnableTool( wxToolBarToolBase* pTool
+                              ,bool               bEnable
+                             );
+    virtual void DoToggleTool( wxToolBarToolBase* pTool
+                              ,bool               bToggle
+                             );
+    virtual void DoSetToggle( wxToolBarToolBase* pTool
+                             ,bool               bToggle
+                            );
 
     virtual wxToolBarToolBase* CreateTool( int             vId
                                           ,const wxString& rsLabel
-                                          ,const wxBitmap& rBitmapNormal
-                                          ,const wxBitmap& rBitmapDisabled
-                                          ,wxItemKind      vKind
+                                          ,const wxBitmap& rBmpNormal
+                                          ,const wxBitmap& rBmpDisabled
+                                          ,wxItemKind      eKind
                                           ,wxObject*       pClientData
-                                          ,const wxString& rShortHelpString
-                                          ,const wxString& rLongHelpString
+                                          ,const wxString& rsShortHelp
+                                          ,const wxString& rsLongHelp
                                          );
     virtual wxToolBarToolBase* CreateTool(wxControl* pControl);
 
-    // should be called whenever the toolbar size changes
-    void UpdateSize(void);
+    //
+    // Helpers
+    //
+    void         DrawTool(wxToolBarToolBase *tool);
+    virtual void DrawTool( wxDC&              rDC
+                          ,wxToolBarToolBase* pTool
+                         );
+    virtual void SpringUpButton(int nIndex);
+
+    int                             m_nCurrentRowsOrColumns;
+    int                             m_nPressedTool;
+    int                             m_nCurrentTool;
+    wxCoord                         m_vLastX;
+    wxCoord                         m_vLastY;
+    wxCoord                         m_vMaxWidth;
+    wxCoord                         m_vMaxHeight;
+    wxCoord                         m_vXPos;
+    wxCoord                         m_vYPos;
+    wxCoord                         m_vTextX;
+    wxCoord                         m_vTextY;
 
-    // override WndProc to process WM_SIZE
-    virtual MRESULT OS2WindowProc( WXUINT   ulMsg
-                                  ,WXWPARAM wParam
-                                  ,WXLPARAM lParam
-                                 );
-
-    // the big bitmap containing all bitmaps of the toolbar buttons
-    WXHBITMAP                       m_hBitmap;
+private:
+    void LowerTool( wxToolBarToolBase* pTool
+                   ,bool               bLower = TRUE
+                  );
+    void RaiseTool( wxToolBarToolBase* pTool
+                   ,bool               bRaise = TRUE
+                  );
 
-    // the total number of toolbar elements
-    size_t                          m_nButtons;
+    static bool                     m_bInitialized;
 
-private:
     DECLARE_EVENT_TABLE()
     DECLARE_DYNAMIC_CLASS(wxToolBar)
 };
index 405ab5b9c251a35156198716ab979726594fe096..20d3f61a4ca0cd3750e1de978f2406dc8a38a1b1 100644 (file)
@@ -1392,9 +1392,9 @@ void wxDC::DoDrawBitmap(
                 //
                 if (IsKindOf(CLASSINFO(wxPaintDC)))
                 {
-                    wxPaintDC*              pPaintDC = wxDynamicCast(this, wxPaintDC);
+                    wxWindowDC*             pWindowDC = wxDynamicCast(this, wxWindowDC);
 
-                    lColor = pPaintDC->m_pCanvas->GetBackgroundColour().GetPixel();
+                    lColor = pWindowDC->m_pCanvas->GetBackgroundColour().GetPixel();
                 }
                 else if (GetBrush() != wxNullBrush)
                     lColor = GetBrush().GetColour().GetPixel();
index 747b3232f775cc9da96c47c406907eafc54272d5..49aaf4ccdc26f617a452184d56ccc8a718652cce 100644 (file)
@@ -371,6 +371,8 @@ bool wxFontRefData::Alloc(
     long                            lRc;
     short                           nIndex = 0;
     PFONTMETRICS                    pFM = NULL;
+    ERRORID                         vError;
+    wxString                        sError;
 
     if (!m_bNativeFontInfoOk)
     {
@@ -396,6 +398,8 @@ bool wxFontRefData::Alloc(
     }
     if (!m_hFont)
     {
+        vError = ::WinGetLastError(vHabmain);
+        sError = wxPMErrorToStr(vError);
         wxLogLastError("CreateFont");
     }
 
@@ -496,10 +500,6 @@ void wxFontRefData::Free()
 
     if ( m_hFont )
     {
-        if (!::GpiSetCharSet(m_hPS, LCID_DEFAULT))
-        {
-            wxLogLastError(wxT("DeleteObject(font)"));
-        }
         ::GpiDeleteSetId(m_hPS, 1L); /* delete the logical font          */
         m_nFontId = 0;
         m_hFont   = 0;
index bb4490f96c889aa31ed7c016c59184d992d52bc8..86f9063dfe0314e46837b54c893cd6fbe39a7b60 100644 (file)
@@ -361,6 +361,7 @@ void wxFillLogFont(
         STR8                        azNames[255];
         long                        alIds[255];
 
+        memset(alIds, 0, sizeof(long) * 255);
         if(!::GpiQuerySetIds( *phPS
                              ,lNumLids
                              ,alTypes
@@ -372,7 +373,8 @@ void wxFillLogFont(
                 ::WinReleasePS(*phPS);
             return;
         }
-
+        if (*pflId == 0L)
+            *pflId = 1L;
         for(unsigned long LCNum = 0; LCNum < lNumLids; LCNum++)
             if(alIds[LCNum] == *pflId)
                ++*pflId;
index 4c345bcea7f4924706e3f91e96b1a8de24b82455..646295e41179ad7a82a812cf69bfd9d0a071cdf1 100644 (file)
@@ -318,6 +318,29 @@ void wxFrame::PositionStatusBar()
 } // end of wxFrame::PositionStatusBar
 #endif // wxUSE_STATUSBAR
 
+#if wxUSE_TOOLBAR
+wxToolBar* wxFrame::OnCreateToolBar(
+  long                              lStyle
+, wxWindowID                        vId
+, const wxString&                   rsName
+)
+{
+    wxToolBar*                      pToolBar = wxFrameBase::OnCreateToolBar( lStyle
+                                                                            ,vId
+                                                                            ,rsName
+                                                                           );
+
+    ::WinSetParent( pToolBar->GetHWND()
+                   ,m_hFrame
+                   ,FALSE
+                  );
+    ::WinSetOwner( pToolBar->GetHWND()
+                  ,m_hFrame
+                 );
+    return pToolBar;
+} // end of WinGuiBase_CFrame::OnCreateToolBar
+#endif
+
 #if wxUSE_MENUS_NATIVE
 void wxFrame::DetachMenuBar()
 {
@@ -722,53 +745,59 @@ wxToolBar* wxFrame::CreateToolBar(
 
 void wxFrame::PositionToolBar()
 {
+    wxToolBar*                      pToolBar = GetToolBar();
+    wxCoord                         vWidth;
+    wxCoord                         vHeight;
+    wxCoord                         vTWidth;
+    wxCoord                         vTHeight;
+
+    if (!pToolBar)
+        return;
+
     HWND                            hWndClient;
     RECTL                           vRect;
+    RECTL                           vFRect;
+    SWP                             vSwp;
+    wxPoint                         vPos;
 
-    ::WinQueryWindowRect(GetHwnd(), &vRect);
+    ::WinQueryWindowRect(m_hFrame, &vRect);
+    vPos.y = (wxCoord)vRect.yTop;
+    ::WinMapWindowPoints(m_hFrame, HWND_DESKTOP, (PPOINTL)&vRect, 2);
+    vFRect = vRect;
+    ::WinCalcFrameRect(m_hFrame, &vRect, TRUE);
 
-#if wxUSE_STATUSBAR
-    if (GetStatusBar())
-    {
-        int                         nStatusX;
-        int                         nStatusY;
+    vPos.y = (wxCoord)(vFRect.yTop - vRect.yTop);
+    pToolBar->GetSize( &vTWidth
+                      ,&vTHeight
+                     );
 
-        GetStatusBar()->GetClientSize( &nStatusX
-                                      ,&nStatusY
-                                     );
-        // PM is backwards from windows
-        vRect.yBottom += nStatusY;
+    if (pToolBar->GetWindowStyleFlag() & wxTB_HORIZONTAL)
+    {
+        vWidth = (wxCoord)(vRect.xRight - vRect.xLeft);
+        pToolBar->SetSize( vRect.xLeft - vFRect.xLeft
+                          ,vPos.y
+                          ,vWidth
+                          ,vTHeight
+                         );
     }
-#endif // wxUSE_STATUSBAR
-
-    if ( m_frameToolBar )
+    else
     {
-        int                         nToolbarWidth;
-        int                         nToolbarHeight;
-
-        m_frameToolBar->GetSize( &nToolbarWidth
-                              ,&nToolbarHeight
-                             );
-
-        if (GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL)
-        {
-            nToolbarHeight = vRect.yBottom;
-        }
-        else
-        {
-            nToolbarWidth = vRect.xRight;
-        }
+        wxCoord                     vSwidth = 0;
+        wxCoord                     vSheight = 0;
 
-        //
-        // Use the 'real' PM position here
-        //
-        GetToolBar()->SetSize( 0
-                              ,0
-                              ,nToolbarWidth
-                              ,nToolbarHeight
-                              ,wxSIZE_NO_ADJUSTMENTS
-                             );
+        if (m_frameStatusBar)
+            m_frameStatusBar->GetSize( &vSwidth
+                                      ,&vSheight
+                                     );
+        vHeight = (wxCoord)(vRect.yTop - vRect.yBottom);
+        pToolBar->SetSize( vRect.xLeft - vFRect.xLeft
+                          ,vPos.y
+                          ,vTWidth
+                          ,vHeight - vSheight
+                         );
     }
+    if( ::WinIsWindowShowing(m_hFrame) )
+        ::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)~0, 0);
 } // end of wxFrame::PositionToolBar
 #endif // wxUSE_TOOLBAR
 
@@ -1133,10 +1162,12 @@ MRESULT EXPENTRY wxFrameMainWndProc(
                 int                 nItemCount;
                 int                 i;
                 PSWP                pSWP = NULL;
-                SWP                 vSwpStb;
                 RECTL               vRectl;
                 RECTL               vRstb;
-                int                 nHeight=0;
+                RECTL               vRtlb;
+                int                 nHeight = 0;
+                int                 nHeight2 = 0;
+                int                 nWidth = 0;
 
                 pSWP = (PSWP)PVOIDFROMMP(wParam);
                 nItemCount = SHORT1FROMMR(pWnd->m_fnOldWndProc(hWnd, ulMsg, wParam, lParam));
@@ -1144,18 +1175,11 @@ MRESULT EXPENTRY wxFrameMainWndProc(
                 {
                     ::WinQueryWindowRect(pWnd->m_frameStatusBar->GetHWND(), &vRstb);
                     pWnd->m_frameStatusBar->GetSize(NULL, &nHeight);
-                    ::WinQueryWindowRect(pWnd->m_hFrame, &vRectl);
-                    ::WinMapWindowPoints(pWnd->m_hFrame, HWND_DESKTOP, (PPOINTL)&vRectl, 2);
-                    vRstb = vRectl;
-                    ::WinCalcFrameRect(pWnd->m_hFrame, &vRectl, TRUE);
-
-                    vSwpStb.x                = vRectl.xLeft - vRstb.xLeft;
-                    vSwpStb.y                = vRectl.yBottom - vRstb.yBottom;
-                    vSwpStb.cx               = vRectl.xRight - vRectl.xLeft - 1; //?? -1 ??
-                    vSwpStb.cy               = nHeight;
-                    vSwpStb.fl               = SWP_SIZE |SWP_MOVE | SWP_SHOW;
-                    vSwpStb.hwnd             = pWnd->m_frameStatusBar->GetHWND();
-                    vSwpStb.hwndInsertBehind = HWND_TOP;
+                }
+                if(pWnd->m_frameToolBar)
+                {
+                    ::WinQueryWindowRect(pWnd->m_frameToolBar->GetHWND(), &vRtlb);
+                    pWnd->m_frameToolBar->GetSize(&nWidth, &nHeight2);
                 }
                 ::WinQueryWindowRect(pWnd->m_hFrame, &vRectl);
                 ::WinMapWindowPoints(pWnd->m_hFrame, HWND_DESKTOP, (PPOINTL)&vRectl, 2);
@@ -1165,10 +1189,20 @@ MRESULT EXPENTRY wxFrameMainWndProc(
                 {
                     if(pWnd->m_hWnd && pSWP[i].hwnd == pWnd->m_hWnd)
                     {
-                        pSWP[i].x    = vRectl.xLeft;
-                        pSWP[i].y    = vRectl.yBottom + nHeight;
-                        pSWP[i].cx   = vRectl.xRight - vRectl.xLeft;
-                        pSWP[i].cy   = vRectl.yTop - vRectl.yBottom - nHeight;
+                        if (pWnd->m_frameToolBar && pWnd->m_frameToolBar->GetWindowStyleFlag() & wxTB_HORIZONTAL)
+                        {
+                            pSWP[i].x    = vRectl.xLeft;
+                            pSWP[i].y    = vRectl.yBottom + nHeight;
+                            pSWP[i].cx   = vRectl.xRight - vRectl.xLeft;
+                            pSWP[i].cy   = vRectl.yTop - vRectl.yBottom - (nHeight + nHeight2);
+                        }
+                        else
+                        {
+                            pSWP[i].x    = vRectl.xLeft;
+                            pSWP[i].y    = vRectl.yBottom + nHeight;
+                            pSWP[i].cx   = vRectl.xRight - (vRectl.xLeft + nWidth);
+                            pSWP[i].cy   = vRectl.yTop - vRectl.yBottom - nHeight;
+                        }
                         pSWP[i].fl   = SWP_SIZE | SWP_MOVE | SWP_SHOW;
                         pSWP[i].hwndInsertBehind = HWND_TOP;
                     }
index e7e4ba90395c449d89bf399259e824ea60300b9e..46fd7ce9b00dc5076f3ac76b03205362ade6e726 100644 (file)
@@ -106,7 +106,6 @@ GENERICOBJS= \
   ..\generic\$D\dirdlgg.obj \
   ..\generic\$D\dirctrlg.obj \
   ..\generic\$D\dragimgg.obj \
-  ..\generic\$D\fontdlgg.obj \
   ..\generic\$D\fdrepdlg.obj \
   ..\generic\$D\grid.obj \
   ..\generic\$D\gridctrl.obj \
@@ -153,7 +152,6 @@ GENLIBOBJS= \
   dirdlgg.obj \
   dirctrlg.obj \
   dragimgg.obj \
-  fontdlgg.obj \
   fdrepdlg.obj \
   grid.obj \
   gridctrl.obj \
@@ -853,7 +851,6 @@ $(GENLIBOBJS):
   copy ..\generic\$D\dcpsg.obj
   copy ..\generic\$D\dirdlgg.obj
   copy ..\generic\$D\dirctrlg.obj
-  copy ..\generic\$D\fontdlgg.obj
   copy ..\generic\$D\fdrepdlg.obj
   copy ..\generic\$D\grid.obj
   copy ..\generic\$D\gridctrl.obj
index 58fc0fe2b04ea9e7b404a6988a6d5b91661ab882..b26c80e4aba225fc1483efad7c1ed4b8a6eeb953 100644 (file)
@@ -214,6 +214,8 @@ bool wxPen::RealizeResource()
             return FALSE;
         }
 
+        ULONG                           flAttrMask = 0L;
+        ULONG                           flDefMask = 0L;
         switch(M_PENDATA->m_nStyle)
         {
             case wxSTIPPLE:
@@ -224,41 +226,57 @@ bool wxPen::RealizeResource()
                 ::GpiSetPatternSet( M_PENDATA->m_hPen
                                    ,(USHORT)M_PENDATA->m_vStipple.GetId()
                                   );
+                flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SET | ABB_SYMBOL;
+                flDefMask = ABB_REF_POINT;
                 break;
 
             case wxBDIAGONAL_HATCH:
                 m_vAreaBundle.usSymbol = PATSYM_DIAG3;
                 m_vAreaBundle.usSet = LCID_DEFAULT;
+                flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SYMBOL;
+                flDefMask = ABB_SET | ABB_REF_POINT;
                 break;
 
             case wxCROSSDIAG_HATCH:
                 m_vAreaBundle.usSymbol = PATSYM_DIAGHATCH;
                 m_vAreaBundle.usSet = LCID_DEFAULT;
+                flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SYMBOL;
+                flDefMask = ABB_SET | ABB_REF_POINT;
                 break;
 
             case wxFDIAGONAL_HATCH:
                 m_vAreaBundle.usSymbol = PATSYM_DIAG1;
                 m_vAreaBundle.usSet = LCID_DEFAULT;
+                flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SYMBOL;
+                flDefMask = ABB_SET | ABB_REF_POINT;
                 break;
 
             case wxCROSS_HATCH:
                 m_vAreaBundle.usSymbol = PATSYM_HATCH;
                 m_vAreaBundle.usSet = LCID_DEFAULT;
+                flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SYMBOL;
+                flDefMask = ABB_SET | ABB_REF_POINT;
                 break;
 
             case wxHORIZONTAL_HATCH:
                 m_vAreaBundle.usSymbol = PATSYM_HORIZ;
                 m_vAreaBundle.usSet = LCID_DEFAULT;
+                flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SYMBOL;
+                flDefMask = ABB_SET | ABB_REF_POINT;
                 break;
 
             case wxVERTICAL_HATCH:
                 m_vAreaBundle.usSymbol = PATSYM_VERT;
                 m_vAreaBundle.usSet = LCID_DEFAULT;
+                flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SYMBOL;
+                flDefMask = ABB_SET | ABB_REF_POINT;
                 break;
 
             default:
                 m_vAreaBundle.usSymbol = PATSYM_SOLID;
                 m_vAreaBundle.usSet = LCID_DEFAULT;
+                flAttrMask = ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE | ABB_SYMBOL;
+                flDefMask = ABB_SET | ABB_REF_POINT;
                 break;
         }
 
@@ -269,9 +287,8 @@ bool wxPen::RealizeResource()
 
         bOk = ::GpiSetAttrs( M_PENDATA->m_hPen
                             ,PRIM_AREA
-                            ,ABB_COLOR | ABB_BACK_COLOR | ABB_MIX_MODE | ABB_BACK_MIX_MODE |
-                             ABB_SET | ABB_SYMBOL
-                            ,ABB_REF_POINT
+                            ,flAttrMask
+                            ,flDefMask
                             ,&m_vAreaBundle
                            );
         if (!bOk)
index 1dc15fcfac546e0ce737d7610d8dd54c6ea079e5..4c70221cb8ae57ea3e9b8766779fdc05bc6345fc 100644 (file)
@@ -149,6 +149,17 @@ wxColour wxSystemSettingsNative::GetColour(
                     );
             break;
 
+        case wxSYS_COLOUR_MENUBAR:
+            vRef = (ULONG)::WinQuerySysColor( HWND_DESKTOP
+                                             ,SYSCLR_MENU
+                                             ,0L
+                                            );
+            vCol.Set( GetRValue(vRef)
+                     ,GetGValue(vRef)
+                     ,GetBValue(vRef)
+                    );
+            break;
+
         //
         // We'll have to just give values to these
         //
index d06a109a0eadb887d5426915554fd09121007999..07856d8e84d92976df405df0c72092ba8c1ea70b 100644 (file)
@@ -71,13 +71,11 @@ bool wxStaticBitmap::Create(
 
     m_bIsIcon = rBitmap.IsKindOf(CLASSINFO(wxIcon));
 
-    // TODO: create static bitmap control
-    const wxChar*                   zClassname = wxT("WX_STATIC");
     int                             nWinstyle = m_bIsIcon ? SS_ICON : SS_BITMAP;
 
     m_hWnd = (WXHWND)::WinCreateWindow( pParent->GetHWND()
-                                       ,zClassname
-                                       ,wxT("")
+                                       ,WC_STATIC
+                                       ,rName.c_str()
                                        ,nWinstyle | WS_VISIBLE
                                        ,0,0,0,0
                                        ,pParent->GetHWND()
index 40f561de27a1cdad1d8e542326175c7ebec7c379..23729eaae8d230a98aa247af8056450c5a1107fc 100644 (file)
@@ -3,7 +3,7 @@
 // Purpose:     wxToolBar
 // Author:      David Webster
 // Modified by:
-// Created:     10/17/99
+// Created:     06/30/02
 // RCS-ID:      $Id$
 // Copyright:   (c) David Webster
 // Licence:     wxWindows licence
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE
+
 #ifndef WX_PRECOMP
-#include "wx/wx.h"
+    #include "wx/settings.h"
+    #include "wx/window.h"
+    #include "wx/dcclient.h"
+    #include "wx/dcmemory.h"
 #endif
 
-#if wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE
 #include "wx/toolbar.h"
 
-#include "malloc.h"
-#include "wx/os2/private.h"
-
-#include "wx/app.h"         // for GetComCtl32Version
-
-// ----------------------------------------------------------------------------
-// constants
-// ----------------------------------------------------------------------------
-
-// these standard constants are not always defined in compilers headers
-
-// Styles
-#ifndef TBSTYLE_FLAT
-    #define TBSTYLE_LIST            0x1000
-    #define TBSTYLE_FLAT            0x0800
-    #define TBSTYLE_TRANSPARENT     0x8000
-#endif
- // use TBSTYLE_TRANSPARENT if you use TBSTYLE_FLAT
-
-// Messages
-#ifndef TB_GETSTYLE
-    #define TB_SETSTYLE             (WM_USER + 56)
-    #define TB_GETSTYLE             (WM_USER + 57)
-#endif
+bool                                wxToolBar::m_bInitialized = FALSE;
 
-#ifndef TB_HITTEST
-    #define TB_HITTEST              (WM_USER + 69)
-#endif
+// ---------------------------------------------------------------------------
+// Helper for taking a regular bitmap and giving it a disabled look
+// ---------------------------------------------------------------------------
+wxBitmap wxDisableBitmap(
+  const wxBitmap&                   rBmp
+, long                              lColor
+)
+{
+    wxMask*                         pMask = rBmp.GetMask();
+
+    if (!pMask)
+        return(wxNullBitmap);
+
+    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);
+    BITMAPINFOHEADER2               vHeader;
+    BITMAPINFO2                     vInfo;
+    ERRORID                         vError;
+    wxString                        sError;
+    HBITMAP                         hBitmap =  (HBITMAP)rBmp.GetHBITMAP();
+    HBITMAP                         hOldBitmap = NULLHANDLE;
+    HBITMAP                         hOldMask   = NULLHANDLE;
+    HBITMAP                         hMask = (HBITMAP)rBmp.GetMask()->GetMaskBitmap();
+    unsigned char*                  pucBits;     // buffer that will contain the bitmap data
+    unsigned char*                  pucData;     // pointer to use to traverse bitmap data
+    unsigned char*                  pucBitsMask; // buffer that will contain the mask data
+    unsigned char*                  pucDataMask; // pointer to use to traverse mask data
+    LONG                            lScans = 0L;
+    LONG                            lScansSet = 0L;
+    bool                            bpp16 = (wxDisplayDepth() == 16);
+
+    memset(&vHeader, '\0', 16);
+    vHeader.cbFix           = 16;
+
+    memset(&vInfo, '\0', 16);
+    vInfo.cbFix           = 16;
+    vInfo.cx              = (ULONG)rBmp.GetWidth();
+    vInfo.cy              = (ULONG)rBmp.GetHeight();
+    vInfo.cPlanes         = 1;
+    vInfo.cBitCount       = 24; // Set to desired count going in
+
+    //
+    // Create the buffers for data....all wxBitmaps are 24 bit internally
+    //
+    int                             nBytesPerLine = rBmp.GetWidth() * 3;
+    int                             nSizeDWORD    = sizeof(DWORD);
+    int                             nLineBoundary = nBytesPerLine % nSizeDWORD;
+    int                             nPadding = 0;
+    int                             i;
+    int                             j;
+
+    //
+    // Bitmap must be ina double-word alligned address so we may
+    // have some padding to worry about
+    //
+    if (nLineBoundary > 0)
+    {
+        nPadding     = nSizeDWORD - nLineBoundary;
+        nBytesPerLine += nPadding;
+    }
+    pucBits = (unsigned char *)malloc(nBytesPerLine * rBmp.GetHeight());
+    memset(pucBits, '\0', (nBytesPerLine * rBmp.GetHeight()));
+    pucBitsMask = (unsigned char *)malloc(nBytesPerLine * rBmp.GetHeight());
+    memset(pucBitsMask, '\0', (nBytesPerLine * rBmp.GetHeight()));
+
+    //
+    // Extract the bitmap and mask data
+    //
+    if ((hOldBitmap = ::GpiSetBitmap(hPS, hBitmap)) == HBM_ERROR)
+    {
+        vError = ::WinGetLastError(vHabmain);
+        sError = wxPMErrorToStr(vError);
+    }
+    ::GpiQueryBitmapInfoHeader(hBitmap, &vHeader);
+    vInfo.cBitCount = 24;
+    if ((lScans = ::GpiQueryBitmapBits( hPS
+                                       ,0L
+                                       ,(LONG)rBmp.GetHeight()
+                                       ,(PBYTE)pucBits
+                                       ,&vInfo
+                                      )) == GPI_ALTERROR)
+    {
+        vError = ::WinGetLastError(vHabmain);
+        sError = wxPMErrorToStr(vError);
+    }
+    if ((hOldMask = ::GpiSetBitmap(hPS, hMask)) == HBM_ERROR)
+    {
+        vError = ::WinGetLastError(vHabmain);
+        sError = wxPMErrorToStr(vError);
+    }
+    ::GpiQueryBitmapInfoHeader(hMask, &vHeader);
+    vInfo.cBitCount = 24;
+    if ((lScans = ::GpiQueryBitmapBits( hPS
+                                       ,0L
+                                       ,(LONG)rBmp.GetHeight()
+                                       ,(PBYTE)pucBitsMask
+                                       ,&vInfo
+                                      )) == GPI_ALTERROR)
+    {
+        vError = ::WinGetLastError(vHabmain);
+        sError = wxPMErrorToStr(vError);
+    }
+    if (( hMask = ::GpiSetBitmap(hPS, hOldMask)) == HBM_ERROR)
+    {
+        vError = ::WinGetLastError(vHabmain);
+        sError = wxPMErrorToStr(vError);
+    }
+    pucData     = pucBits;
+    pucDataMask = pucBitsMask;
 
-// these values correspond to those used by comctl32.dll
-#define DEFAULTBITMAPX   16
-#define DEFAULTBITMAPY   15
-#define DEFAULTBUTTONX   24
-#define DEFAULTBUTTONY   24
-#define DEFAULTBARHEIGHT 27
+    //
+    // Get the mask value
+    //
+    for (i = 0; i < rBmp.GetHeight(); i++)
+    {
+        for (j = 0; j < rBmp.GetWidth(); j++)
+        {
+            // Byte 1
+            if (bpp16 && *pucDataMask == 0xF8) // 16 bit display gobblygook
+            {
+                *pucData = 0x7F;
+                pucData++;
+            }
+            else if (*pucDataMask == 0xFF) // set to grey
+            {
+                *pucData = 0x7F;
+                pucData++;
+            }
+            else
+            {
+                *pucData = ((unsigned char)(lColor >> 16));
+                pucData++;
+            }
 
-// ----------------------------------------------------------------------------
-// private function prototypes
-// ----------------------------------------------------------------------------
+            // Byte 2
+            if (bpp16 && *(pucDataMask + 1) == 0xFC) // 16 bit display gobblygook
+            {
+                *pucData = 0x7F;
+                pucData++;
+            }
+            else if (*(pucDataMask + 1) == 0xFF) // set to grey
+            {
+                *pucData = 0x7F;
+                pucData++;
+            }
+            else
+            {
+                *pucData = ((unsigned char)(lColor >> 8));
+                pucData++;
+            }
 
-static void wxMapBitmap( HBITMAP hBitmap
-                        ,int     nWidth
-                        ,int     nHeight
-                       );
+            // Byte 3
+            if (bpp16 && *(pucDataMask + 2) == 0xF8) // 16 bit display gobblygook
+            {
+                *pucData = 0x7F;
+                pucData++;
+            }
+            else if (*(pucDataMask + 2) == 0xFF) // set to grey
+            {
+                *pucData = 0x7F;
+                pucData++;
+            }
+            else
+            {
+                *pucData = ((unsigned char)lColor);
+                pucData++;
+            }
+            pucDataMask += 3;
+        }
+        for (j = 0; j < nPadding; j++)
+        {
+            pucData++;
+            pucDataMask++;
+        }
+    }
 
-// ----------------------------------------------------------------------------
-// wxWin macros
-// ----------------------------------------------------------------------------
+    //
+    // Create a new bitmap and set the modified bits
+    //
+    wxBitmap                        vNewBmp( rBmp.GetWidth()
+                                            ,rBmp.GetHeight()
+                                            ,24
+                                           );
+    HBITMAP                         hNewBmp = (HBITMAP)vNewBmp.GetHBITMAP();
 
-IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
+    if ((hOldBitmap = ::GpiSetBitmap(hPS, hNewBmp)) == HBM_ERROR)
+    {
+        vError = ::WinGetLastError(vHabmain);
+        sError = wxPMErrorToStr(vError);
+    }
+    if ((lScansSet = ::GpiSetBitmapBits( hPS
+                                        ,0L
+                                        ,(LONG)rBmp.GetHeight()
+                                        ,(PBYTE)pucBits
+                                        ,&vInfo
+                                       )) == GPI_ALTERROR)
 
-BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
-    EVT_MOUSE_EVENTS(wxToolBar::OnMouseEvent)
-    EVT_SYS_COLOUR_CHANGED(wxToolBar::OnSysColourChanged)
-END_EVENT_TABLE()
+    {
+        vError = ::WinGetLastError(vHabmain);
+        sError = wxPMErrorToStr(vError);
+    }
+    vNewBmp.SetMask(rBmp.GetMask());
+    free(pucBits);
+    ::GpiSetBitmap(hPS, NULLHANDLE);
+    ::GpiDestroyPS(hPS);
+    ::DevCloseDC(hDC);
+    if (vNewBmp.Ok())
+        return(vNewBmp);
+    return(wxNullBitmap);
+} // end of wxDisableBitmap
 
 // ----------------------------------------------------------------------------
 // private classes
@@ -89,8 +252,8 @@ public:
                          ,const wxBitmap& rBitmap2
                          ,wxItemKind      vKind
                          ,wxObject*       pClientData
-                         ,const wxString& rShortHelpString
-                         ,const wxString& rLongHelpString
+                         ,const wxString& rsShortHelpString
+                         ,const wxString& rsLongHelpString
                         ) : wxToolBarToolBase( pTbar
                                               ,vId
                                               ,rsLabel
@@ -98,11 +261,10 @@ public:
                                               ,rBitmap2
                                               ,vKind
                                               ,pClientData
-                                              ,rShortHelpString
-                                              ,rLongHelpString
+                                              ,rsShortHelpString
+                                              ,rsLongHelpString
                                              )
     {
-        m_nSepCount = 0;
     }
 
     inline wxToolBarTool( wxToolBar* pTbar
@@ -111,976 +273,966 @@ public:
                                               ,pControl
                                              )
     {
-        m_nSepCount = 1;
     }
 
-    // set/get the number of separators which we use to cover the space used by
-    // a control in the toolbar
-    inline void SetSeparatorsCount(size_t nCount) { m_nSepCount = nCount; }
-    inline size_t GetSeparatorsCount(void) const { return m_nSepCount; }
+    void SetSize(const wxSize& rSize)
+    {
+        m_vWidth = rSize.x;
+        m_vHeight = rSize.y;
+    }
+
+    wxCoord GetWidth(void) const { return m_vWidth; }
+    wxCoord GetHeight(void) const { return m_vHeight; }
 
-private:
-    size_t m_nSepCount;
-};
+    wxCoord                         m_vX;
+    wxCoord                         m_vY;
+    wxCoord                         m_vWidth;
+    wxCoord                         m_vHeight;
+}; // end of CLASS wxToolBarTool
 
+// ----------------------------------------------------------------------------
+// wxWin macros
+// ----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxToolBarBase)
+
+BEGIN_EVENT_TABLE(wxToolBar, wxToolBarBase)
+    EVT_SIZE(wxToolBar::OnSize)
+    EVT_PAINT(wxToolBar::OnPaint)
+    EVT_KILL_FOCUS(wxToolBar::OnKillFocus)
+    EVT_MOUSE_EVENTS(wxToolBar::OnMouseEvent)
+END_EVENT_TABLE()
 
 // ============================================================================
 // implementation
 // ============================================================================
 
 // ----------------------------------------------------------------------------
-// wxToolBarTool
+// tool bar tools creation
 // ----------------------------------------------------------------------------
 
 wxToolBarToolBase* wxToolBar::CreateTool(
   int                               nId
 , const wxString&                   rsLabel
-, const wxBitmap&                   rBitmap1
-, const wxBitmap&                   rBitmap2
-, wxItemKind                        vKind
+, const wxBitmap&                   rBmpNormal
+, const wxBitmap&                   rBmpDisabled
+, wxItemKind                        eKind
 , wxObject*                         pClientData
-, const wxString&                   rShortHelpString
-, const wxString&                   rLongHelpString
+, const wxString&                   rsShortHelp
+, const wxString&                   rsLongHelp
 )
 {
-    return(new wxToolBarTool( this
+    return new wxToolBarTool( this
                              ,nId
                              ,rsLabel
-                             ,rBitmap1
-                             ,rBitmap2
-                             ,vKind
+                             ,rBmpNormal
+                             ,rBmpDisabled
+                             ,eKind
                              ,pClientData
-                             ,rShortHelpString
-                             ,rLongHelpString
-                            ));
-}
+                             ,rsShortHelp
+                             ,rsLongHelp
+                            );
+} // end of wxToolBarSimple::CreateTool
 
-wxToolBarToolBasewxToolBar::CreateTool(
+wxToolBarToolBase *wxToolBar::CreateTool(
   wxControl*                        pControl
 )
 {
-    return(new wxToolBarTool( this
+    return new wxToolBarTool( this
                              ,pControl
-                            ));
-}
+                            );
+} // end of wxToolBarSimple::CreateTool
 
 // ----------------------------------------------------------------------------
-// wxToolBar construction
+// wxToolBarSimple creation
 // ----------------------------------------------------------------------------
 
 void wxToolBar::Init()
 {
-    m_hBitmap = 0;
-    m_nButtons = 0;
-    m_defaultWidth = DEFAULTBITMAPX;
-    m_defaultHeight = DEFAULTBITMAPY;
-}
+    m_nCurrentRowsOrColumns = 0;
 
-bool wxToolBar::Create(
-  wxWindow*                         pParent
-, wxWindowID                        vId
-, const wxPoint&                    rPos
-, const wxSize&                     rSize
-, long                              lStyle
-, const wxString&                   rName
-)
-{
-    // common initialisation
-    if (!CreateControl( pParent
-                       ,vId
-                       ,rPos
-                       ,rSize
-                       ,lStyle
-                      , wxDefaultValidator
-                       ,rName
-                      ))
-        return(FALSE);
-
-    // prepare flags
-    DWORD                           msflags = 0;      // WS_VISIBLE | WS_CHILD always included
-    // TODO
-    /*
-
-    if (lStyle & wxBORDER)
-        msflags |= WS_BORDER;
-    msflags |= TBSTYLE_TOOLTIPS;
-
-    if (style & wxTB_FLAT)
-    {
-        if (wxTheApp->GetComCtl32Version() > 400)
-            msflags |= TBSTYLE_FLAT;
-    }
+    m_vLastX = m_vLastY = 0;
+    m_vMaxWidth = m_vMaxHeight = 0;
+    m_nPressedTool = m_nCurrentTool = -1;
+    m_vXPos = m_vYPos = -1;
+    m_vTextX = m_vTextY = 0;
 
-    // MSW-specific initialisation
-    if ( !wxControl::MSWCreateControl(TOOLBARCLASSNAME, msflags) )
-        return FALSE;
+    m_toolPacking = 1;
+    m_toolSeparation = 5;
 
-    // toolbar-specific post initialisation
-    ::SendMessage(GetHwnd(), TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
+    m_defaultWidth = 16;
+    m_defaultHeight = 15;
+} // end of wxToolBar::Init
 
-    // set up the colors and fonts
-    wxRGBToColour(m_backgroundColour, GetSysColor(COLOR_BTNFACE));
-    m_foregroundColour = *wxBLACK;
+wxToolBarToolBase* wxToolBar::DoAddTool(
+  int                               vId
+, const wxString&                   rsLabel
+, const wxBitmap&                   rBitmap
+, const wxBitmap&                   rBmpDisabled
+, wxItemKind                        eKind
+, const wxString&                   rsShortHelp
+, const wxString&                   rsLongHelp
+, wxObject*                         pClientData
+, wxCoord                           vXPos
+, wxCoord                           vYPos
+)
+{
+    //
+    // Rememeber the position for DoInsertTool()
+    //
+    m_vXPos = vXPos;
+    m_vYPos = vYPos;
+
+    return wxToolBarBase::DoAddTool( vId
+                                    ,rsLabel
+                                    ,rBitmap
+                                    ,rBmpDisabled
+                                    ,eKind
+                                    ,rsShortHelp
+                                    ,rsLongHelp
+                                    ,pClientData
+                                    ,vXPos
+                                    ,vYPos
+                                   );
+} // end of wxToolBar::DoAddTool
 
-    SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
+bool wxToolBar::DoInsertTool(
+  size_t                            WXUNUSED(nPos)
+, wxToolBarToolBase*                pToolBase
+)
+{
+    wxToolBarTool*                  pTool = (wxToolBarTool *)pToolBase;
 
-    // position it
-    int x = pos.x;
-    int y = pos.y;
-    int width = size.x;
-    int height = size.y;
+    pTool->m_vX = m_vXPos;
+    if (pTool->m_vX == -1)
+        pTool->m_vX = m_xMargin;
 
-    if (width <= 0)
-        width = 100;
-    if (height <= 0)
-        height = m_defaultHeight;
-    if (x < 0)
-        x = 0;
-    if (y < 0)
-        y = 0;
+    pTool->m_vY = m_vYPos;
+    if (pTool->m_vY == -1)
+        pTool->m_vX = m_yMargin;
 
-    SetSize(x, y, width, height);
-    */
-    return(TRUE);
-}
+    pTool->SetSize(GetToolSize());
 
-wxToolBar::~wxToolBar()
-{
-    if (m_hBitmap)
+    if (pTool->IsButton())
     {
-        ::GpiDeleteBitmap((HBITMAP) m_hBitmap);
+        //
+        // Calculate reasonable max size in case Layout() not called
+        //
+        if ((pTool->m_vX + pTool->GetNormalBitmap().GetWidth() + m_xMargin) > m_vMaxWidth)
+            m_vMaxWidth = (wxCoord)((pTool->m_vX + pTool->GetWidth() + m_xMargin));
+
+        if ((pTool->m_vY + pTool->GetNormalBitmap().GetHeight() + m_yMargin) > m_vMaxHeight)
+            m_vMaxHeight = (wxCoord)((pTool->m_vY + pTool->GetHeight() + m_yMargin));
     }
-}
-
-// ----------------------------------------------------------------------------
-// adding/removing tools
-// ----------------------------------------------------------------------------
+    return TRUE;
+} // end of wxToolBar::DoInsertTool
 
-bool wxToolBar::DoInsertTool(
+bool wxToolBar::DoDeleteTool(
   size_t                            WXUNUSED(nPos)
 , wxToolBarToolBase*                pTool
 )
 {
-    // nothing special to do here - we really create the toolbar buttons in
-    // Realize() later
-    pTool->Attach(this);
-    return(TRUE);
-}
+    pTool->Detach();
+    Refresh();
+    return TRUE;
+} // end of wxToolBar::DoDeleteTool
 
-bool wxToolBar::DoDeleteTool(
-  size_t                            nPos
-, wxToolBarToolBase*                pTool
+bool wxToolBar::Create(
+  wxWindow*                         pParent
+, wxWindowID                        vId
+, const wxPoint&                    rPos
+, const wxSize&                     rSize
+, long                              lStyle
+, const wxString&                   rsName
 )
 {
-    // normally, we only delete one button, but we use several separators to
-    // cover the space used by one control sometimes (with old comctl32.dll)
-    size_t                          nButtonsToDelete = 1;
+    if ( !wxWindow::Create( pParent
+                           ,vId
+                           ,rPos
+                           ,rSize
+                           ,lStyle
+                           ,rsName
+                          ))
+        return FALSE;
 
-    // get the size of the button we're going to delete
-    RECTL                           vRect;
+    // Set it to grey (or other 3D face colour)
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_MENUBAR));
+    SetFont(*wxSMALL_FONT);
 
-    // TODO:
-    /*
-    if ( !::SendMessage(GetHwnd(), TB_GETITEMRECT, pos, (LPARAM)&r) )
+    if (GetWindowStyleFlag() & wxTB_VERTICAL)
     {
-        wxLogLastError(_T("TB_GETITEMRECT"));
-    }
+        m_vLastX = 7;
+        m_vLastY = 3;
 
-    int width = r.right - r.left;
+        m_maxRows = 32000;      // a lot
+        m_maxCols = 1;
+    }
+    else
+    {
+        m_vLastX = 3;
+        m_vLastY = 7;
 
-    if ( tool->IsControl() )
+        m_maxRows = 1;
+        m_maxCols = 32000;      // a lot
+    }
+    SetCursor(*wxSTANDARD_CURSOR);
+
+    //
+    // The toolbar's tools, if they have labels and the winTB_TEXT
+    // style is set, then we need to take into account the size of
+    // the text when drawing tool bitmaps and the text
+    //
+    if (HasFlag(wxTB_TEXT))
     {
-        nButtonsToDelete = ((wxToolBarTool *)tool)->GetSeparatorsCount();
+        wxClientDC                  vDC(this);
 
-        width *= nButtonsToDelete;
+        vDC.SetFont(GetFont());
+        vDC.GetTextExtent( "XXXX"
+                          ,&m_vTextX
+                          ,&m_vTextY
+                         );
     }
 
-    while ( nButtonsToDelete-- > 0 )
+    //
+    // Position it
+    //
+    int                             nX      = rPos.x;
+    int                             nY      = rPos.y;
+    int                             nWidth  = rSize.x;
+    int                             nHeight = rSize.y;
+    wxFrame*                        pFrame = wxDynamicCast(GetParent(), wxFrame);
+
+    if (lStyle & wxTB_HORIZONTAL)
     {
-        if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, pos, 0) )
+        if (nWidth <= 0)
         {
-            wxLogLastError("TB_DELETEBUTTON");
-
-            return FALSE;
+            nWidth = pParent->GetClientSize().x;
+        }
+        if (nHeight <= 0)
+        {
+            if (lStyle & wxTB_TEXT)
+                nHeight = m_defaultHeight + 18;
+            else
+                nHeight = m_defaultHeight;
         }
     }
-
-    tool->Detach();
-
-    m_nButtons -= nButtonsToDelete;
-
-    // reposition all the controls after this button
-    wxToolBarToolsList::Node *node = m_tools.Item(pos);
-    for ( node = node->GetNext(); node; node = node->GetNext() )
+    else
     {
-        wxToolBarToolBase *tool2 = node->GetData();
-        if ( tool2->IsControl() )
+        if (nHeight <= 0)
         {
-            int x;
-            wxControl *control = tool2->GetControl();
-            control->GetPosition(&x, NULL);
-            control->Move(x - width, -1);
+            nHeight = pParent->GetClientSize().y;
+        }
+        if (nWidth <= 0)
+        {
+            if (lStyle & wxTB_TEXT)
+                nWidth = m_vTextX + (int)(m_vTextX/2); // a little margin
+            else
+                nWidth = m_defaultWidth + (int)(m_defaultWidth/2); // a little margin
         }
     }
-    */
-    return(TRUE);
-}
+    if (nX < 0)
+        nX = 0;
+    if (nY < 0)
+        nY = 0;
+
+    SetSize( nX
+            ,nY
+            ,nWidth
+            ,nHeight
+           );
+    return TRUE;
+} // end of wxToolBar::Create
 
-bool wxToolBar::Realize()
+wxToolBar::~wxToolBar()
 {
-    size_t                          nTools = GetToolsCount();
+} // end of wxToolBar::~wxToolBar
 
-    if (nTools == 0)
-    {
-        // nothing to do
-        return(TRUE);
-    }
-
-    bool                            bIsVertical = (GetWindowStyle() & wxTB_VERTICAL) != 0;
+bool wxToolBar::Realize()
+{
+    int                             nMaxToolWidth  = 0;
+    int                             nMaxToolHeight = 0;
+    int                             nX;
+    int                             nY;
 
-    // TODO:
-    /*
-    // First, add the bitmap: we use one bitmap for all toolbar buttons
-    // ----------------------------------------------------------------
+    m_nCurrentRowsOrColumns = 0;
+    m_vLastX               = m_xMargin;
+    m_vLastY               = m_yMargin;
+    m_vMaxWidth            = 0;
+    m_vMaxHeight           = 0;
 
-    // if we already have a bitmap, we'll replace the existing one - otherwise
-    // we'll install a new one
-    HBITMAP oldToolBarBitmap = (HBITMAP)m_hBitmap;
 
-    int totalBitmapWidth = (int)(m_defaultWidth * nTools);
-    int totalBitmapHeight = (int)m_defaultHeight;
+    //
+    // Find the maximum tool width and height
+    //
+    wxToolBarToolsList::Node*       pNode = m_tools.GetFirst();
 
-    // Create a bitmap for all the tool bitmaps
-    HBITMAP hBitmap = ::CreateCompatibleBitmap(ScreenHDC(),
-                                               totalBitmapWidth,
-                                               totalBitmapHeight);
-    if ( !hBitmap )
+    while (pNode )
     {
-        wxLogLastError(_T("CreateCompatibleBitmap"));
+        wxToolBarTool*              pTool = (wxToolBarTool *)pNode->GetData();
 
-        return FALSE;
+        if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsEmpty())
+        {
+            //
+            // Set the height according to the font and the border size
+            //
+            nMaxToolWidth = m_vTextX;
+            if (pTool->GetHeight() + m_vTextY > nMaxToolHeight)
+                nMaxToolHeight = pTool->GetHeight() + m_vTextY;
+        }
+        else
+        {
+            if (pTool->GetWidth() > nMaxToolWidth )
+                nMaxToolWidth = pTool->GetWidth();
+            if (pTool->GetHeight() > nMaxToolHeight)
+                nMaxToolHeight = pTool->GetHeight();
+        }
+        pNode = pNode->GetNext();
     }
 
-    m_hBitmap = (WXHBITMAP)hBitmap;
-
-    // Now blit all the tools onto this bitmap
-    HDC memoryDC = ::CreateCompatibleDC(NULL);
-    HBITMAP oldBitmap = (HBITMAP) ::SelectObject(memoryDC, hBitmap);
+    int                             nSeparatorSize = m_toolSeparation;
 
-    HDC memoryDC2 = ::CreateCompatibleDC(NULL);
-
-    // the button position
-    wxCoord x = 0;
-
-    // the number of buttons (not separators)
-    int nButtons = 0;
-
-    wxToolBarToolsList::Node *node = m_tools.GetFirst();
-    while ( node )
+    pNode = m_tools.GetFirst();
+    while (pNode)
     {
-        wxToolBarToolBase *tool = node->GetData();
-        if ( tool->IsButton() )
+        wxToolBarTool*              pTool = (wxToolBarTool *)pNode->GetData();
+
+        if (pTool->IsSeparator())
         {
-            HBITMAP hbmp = GetHbitmapOf(tool->GetBitmap1());
-            if ( hbmp )
+            if (GetWindowStyleFlag() & wxTB_HORIZONTAL)
             {
-                HBITMAP oldBitmap2 = (HBITMAP)::SelectObject(memoryDC2, hbmp);
-                if ( !BitBlt(memoryDC, x, 0,  m_defaultWidth, m_defaultHeight,
-                             memoryDC2, 0, 0, SRCCOPY) )
-                {
-                    wxLogLastError("BitBlt");
-                }
-
-                ::SelectObject(memoryDC2, oldBitmap2);
+                pTool->m_vX = m_vLastX + nSeparatorSize;
+                pTool->m_vHeight = m_defaultHeight + m_vTextY;
+                if (m_nCurrentRowsOrColumns >= m_maxCols)
+                    m_vLastY += nSeparatorSize;
+                else
+                    m_vLastX += nSeparatorSize;
             }
             else
             {
-                wxFAIL_MSG( _T("invalid tool button bitmap") );
+                pTool->m_vY = m_vLastY + nSeparatorSize;
+                pTool->m_vHeight = m_defaultHeight + m_vTextY;
+                if (m_nCurrentRowsOrColumns >= m_maxRows)
+                    m_vLastX += nSeparatorSize;
+                else
+                    m_vLastY += nSeparatorSize;
             }
-
-            // still inc width and number of buttons because otherwise the
-            // subsequent buttons will all be shifted which is rather confusing
-            // (and like this you'd see immediately which bitmap was bad)
-            x += m_defaultWidth;
-            nButtons++;
         }
-
-        node = node->GetNext();
-    }
-
-    ::SelectObject(memoryDC, oldBitmap);
-    ::DeleteDC(memoryDC);
-    ::DeleteDC(memoryDC2);
-
-    // Map to system colours
-    wxMapBitmap(hBitmap, totalBitmapWidth, totalBitmapHeight);
-
-    if ( oldToolBarBitmap )
-    {
-        TBREPLACEBITMAP replaceBitmap;
-        replaceBitmap.hInstOld = NULL;
-        replaceBitmap.hInstNew = NULL;
-        replaceBitmap.nIDOld = (UINT) oldToolBarBitmap;
-        replaceBitmap.nIDNew = (UINT) hBitmap;
-        replaceBitmap.nButtons = nButtons;
-        if ( !::SendMessage(GetHwnd(), TB_REPLACEBITMAP,
-                            0, (LPARAM) &replaceBitmap) )
+        else if (pTool->IsButton())
         {
-            wxFAIL_MSG(wxT("Could not add bitmap to toolbar"));
-        }
-
-        ::DeleteObject(oldToolBarBitmap);
-
-        // Now delete all the buttons
-        for ( size_t pos = 0; pos < m_nButtons; pos++ )
-        {
-            if ( !::SendMessage(GetHwnd(), TB_DELETEBUTTON, 0, 0) )
+            if (GetWindowStyleFlag() & wxTB_HORIZONTAL)
+            {
+                if (m_nCurrentRowsOrColumns >= m_maxCols)
+                {
+                    m_nCurrentRowsOrColumns = 0;
+                    m_vLastX                = m_xMargin;
+                    m_vLastY               += nMaxToolHeight + m_toolPacking;
+                }
+                pTool->m_vX = m_vLastX + (nMaxToolWidth - ((int)(nMaxToolWidth/2) + (int)(pTool->GetWidth()/2)));
+                if (HasFlag(wxTB_TEXT))
+                    pTool->m_vY = m_vLastY + nSeparatorSize - 2; // just bit of adjustment
+                else
+                    pTool->m_vY = m_vLastY + (nMaxToolHeight - (int)(pTool->GetHeight()/2));
+                m_vLastX += nMaxToolWidth + m_toolPacking + m_toolSeparation;
+            }
+            else
             {
-                wxLogLastError("TB_DELETEBUTTON");
+                if (m_nCurrentRowsOrColumns >= m_maxRows)
+                {
+                    m_nCurrentRowsOrColumns = 0;
+                    m_vLastX               += (nMaxToolWidth + m_toolPacking);
+                    m_vLastY                = m_yMargin;
+                }
+                pTool->m_vX = m_vLastX + pTool->GetWidth();
+                if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsNull())
+                    pTool->m_vY = m_vLastY + (nMaxToolHeight - m_vTextY) + m_toolPacking;
+                else
+                    pTool->m_vY = m_vLastY + (nMaxToolHeight - (int)(pTool->GetHeight()/2));
+                m_vLastY += nMaxToolHeight + m_toolPacking + m_toolSeparation;
             }
+            m_nCurrentRowsOrColumns++;
         }
-    }
-    else // no old bitmap
-    {
-        TBADDBITMAP addBitmap;
-        addBitmap.hInst = 0;
-        addBitmap.nID = (UINT) hBitmap;
-        if ( ::SendMessage(GetHwnd(), TB_ADDBITMAP,
-                           (WPARAM) nButtons, (LPARAM)&addBitmap) == -1 )
+        else
         {
-            wxFAIL_MSG(wxT("Could not add bitmap to toolbar"));
+            // TODO: support the controls
         }
+
+        if (m_vLastX > m_maxWidth)
+            m_maxWidth = m_vLastX;
+        if (m_vLastY > m_maxHeight)
+            m_maxHeight = m_vLastY;
+
+        pNode = pNode->GetNext();
     }
 
-    // Next add the buttons and separators
-    // -----------------------------------
+    if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
+        m_maxWidth += nMaxToolWidth;
+    else
+        m_maxHeight += nMaxToolHeight;
 
-    TBBUTTON *buttons = new TBBUTTON[nTools];
+    m_maxWidth += m_xMargin;
+    m_maxHeight += m_yMargin;
+    return TRUE;
+} // end of wxToolBar::Realize
 
-    // this array will hold the indices of all controls in the toolbar
-    wxArrayInt controlIds;
+// ----------------------------------------------------------------------------
+// event handlers
+// ----------------------------------------------------------------------------
 
-    int i = 0;
-    int bitmapId = 0;
+void wxToolBar::OnPaint (
+  wxPaintEvent&                     WXUNUSED(rEvent)
+)
+{
+    wxPaintDC                       vDc(this);
 
-    for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
-    {
-        wxToolBarToolBase *tool = node->GetData();
+    PrepareDC(vDc);
 
-        // don't add separators to the vertical toolbar - looks ugly
-        if ( isVertical && tool->IsSeparator() )
-            continue;
+    static int                      nCount = 0;
 
-        TBBUTTON& button = buttons[i];
+    //
+    // Prevent reentry of OnPaint which would cause wxMemoryDC errors.
+    //
+    if (nCount > 0)
+        return;
+    nCount++;
 
-        wxZeroMemory(button);
+    for ( wxToolBarToolsList::Node* pNode = m_tools.GetFirst();
+          pNode;
+          pNode = pNode->GetNext() )
+    {
+        wxToolBarTool*              pTool = (wxToolBarTool*)pNode->GetData();
 
-        switch ( tool->GetStyle() )
+        if (pTool->IsButton() )
+            DrawTool(vDc, pTool);
+        if (pTool->IsSeparator())
         {
-            case wxTOOL_STYLE_CONTROL:
-                button.idCommand = tool->GetId();
-                // fall through: create just a separator too
+            wxPen                   vDarkGreyPen( wxColour(85, 85, 85)
+                                                 ,1
+                                                 ,wxSOLID
+                                                );
+            int                     nX;
+            int                     nY;
+            int                     nHeight;
+
+            vDc.SetPen(vDarkGreyPen);
+            if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsEmpty())
+            {
+                nX = pTool->m_vX;
+                nY = pTool->m_vY - (m_vTextY - 6);
+                nHeight = (m_vTextY - 2) + pTool->GetHeight();
+            }
+            else
+            {
+                nX = pTool->m_vX;
+                nY = pTool->m_vY;
+                nHeight = pTool->GetHeight() - 2;
+            }
+            vDc.DrawLine(nX, nY, nX, nY + nHeight);
+        }
+    }
+    nCount--;
+} // end of wxToolBar::OnPaint
 
-            case wxTOOL_STYLE_SEPARATOR:
-                button.fsState = TBSTATE_ENABLED;
-                button.fsStyle = TBSTYLE_SEP;
-                break;
+void wxToolBar::OnSize (
+  wxSizeEvent&                      WXUNUSED(rEvent)
+)
+{
+#if wxUSE_CONSTRAINTS
+    if (GetAutoLayout())
+        Layout();
+#endif
+} // end of wxToolBar::OnSize
 
-            case wxTOOL_STYLE_BUTTON:
-                button.iBitmap = bitmapId;
-                button.idCommand = tool->GetId();
+void wxToolBar::OnKillFocus(
+  wxFocusEvent&                     WXUNUSED(rEvent)
+)
+{
+    OnMouseEnter(m_nPressedTool = m_nCurrentTool = -1);
+} // end of wxToolBar::OnKillFocus
 
-                if ( tool->IsEnabled() )
-                    button.fsState |= TBSTATE_ENABLED;
-                if ( tool->IsToggled() )
-                    button.fsState |= TBSTATE_CHECKED;
+void wxToolBar::OnMouseEvent(
+  wxMouseEvent&                     rEvent
+)
+{
+    wxCoord                         vX;
+    wxCoord                         vY;
+    HPOINTER                        hPtr = ::WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE);
 
-                button.fsStyle = tool->CanBeToggled() ? TBSTYLE_CHECK
-                                                      : TBSTYLE_BUTTON;
+    ::WinSetPointer(HWND_DESKTOP, hPtr);
+    rEvent.GetPosition(&vX, &vY);
 
-                bitmapId++;
-                break;
-        }
+    wxToolBarTool*            pTool = (wxToolBarTool *)FindToolForPosition( vX
+                                                                           ,vY
+                                                                          );
 
-        i++;
+    if (rEvent.LeftDown())
+    {
+        CaptureMouse();
     }
-
-    if ( !::SendMessage(GetHwnd(), TB_ADDBUTTONS,
-                        (WPARAM)i, (LPARAM)buttons) )
+    if (rEvent.LeftUp())
     {
-        wxLogLastError("TB_ADDBUTTONS");
+        ReleaseMouse();
     }
 
-    delete [] buttons;
-
-    // Deal with the controls finally
-    // ------------------------------
-
-    // adjust the controls size to fit nicely in the toolbar
-    size_t index = 0;
-    for ( node = m_tools.GetFirst(); node; node = node->GetNext(), index++ )
+    if (!pTool)
     {
-        wxToolBarToolBase *tool = node->GetData();
-        if ( !tool->IsControl() )
-            continue;
-
-        wxControl *control = tool->GetControl();
-
-        wxSize size = control->GetSize();
-
-        // the position of the leftmost controls corner
-        int left = -1;
-
-        // note that we use TB_GETITEMRECT and not TB_GETRECT because the
-        // latter only appeared in v4.70 of comctl32.dll
-        RECT r;
-        if ( !SendMessage(GetHwnd(), TB_GETITEMRECT,
-                          index, (LPARAM)(LPRECT)&r) )
+        if (m_nCurrentTool > -1)
         {
-            wxLogLastError("TB_GETITEMRECT");
-        }
-
-        // TB_SETBUTTONINFO message is only supported by comctl32.dll 4.71+
-        #if defined(_WIN32_IE) && (_WIN32_IE >= 0x400 )
-            // available in headers, now check whether it is available now
-            // (during run-time)
-            if ( wxTheApp->GetComCtl32Version() >= 471 )
+            if (rEvent.LeftIsDown())
+                SpringUpButton(m_nCurrentTool);
+            pTool = (wxToolBarTool *)FindById(m_nCurrentTool);
+            if (pTool && pTool->IsToggled())
             {
-                // set the (underlying) separators width to be that of the
-                // control
-                TBBUTTONINFO tbbi;
-                tbbi.cbSize = sizeof(tbbi);
-                tbbi.dwMask = TBIF_SIZE;
-                tbbi.cx = size.x;
-                if ( !SendMessage(GetHwnd(), TB_SETBUTTONINFO,
-                                  tool->GetId(), (LPARAM)&tbbi) )
-                {
-                    // the id is probably invalid?
-                    wxLogLastError("TB_SETBUTTONINFO");
-                }
-
+                RaiseTool( pTool
+                          ,FALSE
+                         );
             }
-            else
-        #endif // comctl32.dll 4.71
-            // TB_SETBUTTONINFO unavailable
+            m_nCurrentTool = -1;
+            OnMouseEnter(-1);
+        }
+        return;
+    }
+    if (!rEvent.IsButton())
+    {
+        if (pTool->GetId() != m_nCurrentTool)
+        {
+            //
+            // If the left button is kept down and moved over buttons,
+            // press those buttons.
+            //
+            if (rEvent.LeftIsDown() && pTool->IsEnabled())
             {
-                // try adding several separators to fit the controls width
-                int widthSep = r.right - r.left;
-                left = r.left;
-
-                TBBUTTON tbb;
-                wxZeroMemory(tbb);
-                tbb.idCommand = 0;
-                tbb.fsState = TBSTATE_ENABLED;
-                tbb.fsStyle = TBSTYLE_SEP;
-
-                size_t nSeparators = size.x / widthSep;
-                for ( size_t nSep = 0; nSep < nSeparators; nSep++ )
+                SpringUpButton(m_nCurrentTool);
+                if (pTool->CanBeToggled())
                 {
-                    if ( !SendMessage(GetHwnd(), TB_INSERTBUTTON,
-                                      index, (LPARAM)&tbb) )
-                    {
-                        wxLogLastError("TB_INSERTBUTTON");
-                    }
-
-                    index++;
+                    pTool->Toggle();
                 }
-
-                // remember the number of separators we used - we'd have to
-                // delete all of them later
-                ((wxToolBarTool *)tool)->SetSeparatorsCount(nSeparators);
-
-                // adjust the controls width to exactly cover the separators
-                control->SetSize((nSeparators + 1)*widthSep, -1);
+                DrawTool(pTool);
             }
-
-        // and position the control itself correctly vertically
-        int height = r.bottom - r.top;
-        int diff = height - size.y;
-        if ( diff < 0 )
-        {
-            // the control is too high, resize to fit
-            control->SetSize(-1, height - 2);
-
-            diff = 2;
+            m_nCurrentTool = pTool->GetId();
+            OnMouseEnter(m_nCurrentTool);
+            if (!pTool->IsToggled())
+                RaiseTool(pTool);
         }
-
-        control->Move(left == -1 ? r.left : left, r.top + (diff + 1) / 2);
+        return;
     }
 
-    // the max index is the "real" number of buttons - i.e. counting even the
-    // separators which we added just for aligning the controls
-    m_nButtons = index;
-
-    if ( !isVertical )
+    // Left button pressed.
+    if (rEvent.LeftDown() && pTool->IsEnabled())
     {
-        if ( m_maxRows == 0 )
+        if (pTool->CanBeToggled())
         {
-            // if not set yet, only one row
-            SetRows(1);
+            pTool->Toggle();
         }
+        DrawTool(pTool);
+    }
+    else if (rEvent.RightDown())
+    {
+        OnRightClick( pTool->GetId()
+                     ,vX
+                     ,vY
+                    );
     }
-    else if ( m_nButtons > 0 ) // vertical non empty toolbar
+
+    //
+    // Left Button Released.  Only this action confirms selection.
+    // If the button is enabled and it is not a toggle tool and it is
+    // in the pressed state, then raise the button and call OnLeftClick.
+    //
+    if (rEvent.LeftUp() && pTool->IsEnabled() )
     {
-        if ( m_maxRows == 0 )
+        //
+        // Pass the OnLeftClick event to tool
+        //
+        if (!OnLeftClick( pTool->GetId()
+                         ,pTool->IsToggled()) &&
+                          pTool->CanBeToggled())
         {
-            // if not set yet, have one column
-            SetRows(m_nButtons);
+            //
+            // If it was a toggle, and OnLeftClick says No Toggle allowed,
+            // then change it back
+            //
+            pTool->Toggle();
         }
+        DrawTool(pTool);
     }
-    */
-    return TRUE;
-}
+} // end of wxToolBar::OnMouseEvent
 
 // ----------------------------------------------------------------------------
-// message handlers
+// drawing
 // ----------------------------------------------------------------------------
 
-bool wxToolBar::OS2Command(
-  WXUINT                            nCmd
-, WXWORD                            nId
+void wxToolBar::DrawTool(
+  wxToolBarToolBase*                pTool
 )
 {
-    wxToolBarToolBase*              pTool = FindById((int)nId);
-
-    if (!pTool)
-        return(FALSE);
-    // TODO:
-    /*
-    if (pTool->CanBeToggled())
-    {
-        LRESULT state = ::SendMessage(GetHwnd(), TB_GETSTATE, id, 0);
-        tool->SetToggle((state & TBSTATE_CHECKED) != 0);
-    }
+    wxClientDC                      vDc(this);
 
-    bool toggled = tool->IsToggled();
+    DrawTool( vDc
+             ,pTool
+            );
+} // end of wxToolBar::DrawTool
 
-    // OnLeftClick() can veto the button state change - for buttons which may
-    // be toggled only, of couse
-    if ( !OnLeftClick((int)id, toggled) && tool->CanBeToggled() )
-    {
-        // revert back
-        toggled = !toggled;
-        tool->SetToggle(toggled);
-
-        ::SendMessage(GetHwnd(), TB_CHECKBUTTON, id, MAKELONG(toggled, 0));
-    }
-    */
-    return(TRUE);
-}
-
-bool wxToolBar::OS2OnNotify(
-  int                               WXUNUSED(idCtrl)
-, WXLPARAM                          lParam
-, WXLPARAM*                         pResult
+void wxToolBar::DrawTool(
+  wxDC&                             rDc
+, wxToolBarToolBase*                pToolBase
 )
 {
-    // TODO:
-    /*
-    // First check if this applies to us
-    NMHDR *hdr = (NMHDR *)lParam;
-
-    // the tooltips control created by the toolbar is sometimes Unicode, even
-    // in an ANSI application - this seems to be a bug in comctl32.dll v5
-    int code = (int)hdr->code;
-    if ( (code != TTN_NEEDTEXTA) && (code != TTN_NEEDTEXTW) )
-        return FALSE;
-
-    HWND toolTipWnd = (HWND)::SendMessage((HWND)GetHWND(), TB_GETTOOLTIPS, 0, 0);
-    if ( toolTipWnd != hdr->hwndFrom )
-        return FALSE;
-
-    LPTOOLTIPTEXT ttText = (LPTOOLTIPTEXT)lParam;
-    int id = (int)ttText->hdr.idFrom;
+    wxToolBarTool*                  pTool = (wxToolBarTool *)pToolBase;
+    wxPen                           vDarkGreyPen( wxColour( 85,85,85 )
+                                                 ,1
+                                                 ,wxSOLID
+                                                );
+    wxPen                           vWhitePen( wxT("WHITE")
+                                              ,1
+                                              ,wxSOLID
+                                             );
+    wxPen                           vBlackPen( wxT("BLACK")
+                                              ,1
+                                              ,wxSOLID
+                                             );
+    wxBitmap                        vBitmap = pTool->GetNormalBitmap();
+    bool                            bUseMask = FALSE;
+    wxMask*                         pMask = NULL;
+    RECTL                           vRect;
 
-    wxToolBarToolBase *tool = FindById(id);
-    if ( !tool )
-        return FALSE;
+    PrepareDC(rDc);
 
-    const wxString& help = tool->GetShortHelp();
+    if (!vBitmap.Ok())
+        return;
+    if ((pMask = vBitmap.GetMask()) != NULL)
+        if (pMask->GetMaskBitmap() != NULLHANDLE)
+            bUseMask = TRUE;
 
-    if ( !help.IsEmpty() )
+    if (!pTool->IsToggled())
     {
-        if ( code == TTN_NEEDTEXTA )
+        LowerTool(pTool, FALSE);
+        if (!pTool->IsEnabled())
         {
-            ttText->lpszText = (wxChar *)help.c_str();
+            wxColour                vColor("GREY");
+
+            rDc.SetTextForeground(vColor);
+            if (!pTool->GetDisabledBitmap().Ok())
+                pTool->SetDisabledBitmap(wxDisableBitmap( vBitmap
+                                                         ,(long)GetBackgroundColour().GetPixel()
+                                                        ));
+            rDc.DrawBitmap( pTool->GetDisabledBitmap()
+                           ,pTool->m_vX
+                           ,pTool->m_vY
+                           ,bUseMask
+                          );
         }
-#if (_WIN32_IE >= 0x0300)
         else
         {
-            // FIXME this is a temp hack only until I understand better what
-            //       must be done in both ANSI and Unicode builds
-
-            size_t lenAnsi = help.Len();
-            #ifdef __MWERKS__
-                // MetroWerks doesn't like calling mbstowcs with NULL argument
-                size_t lenUnicode = 2*lenAnsi;
-            #else
-                size_t lenUnicode = mbstowcs(NULL, help, lenAnsi);
-            #endif
-
-            // using the pointer of right type avoids us doing all sorts of
-            // pointer arithmetics ourselves
-            wchar_t *dst = (wchar_t *)ttText->szText,
-                    *pwz = new wchar_t[lenUnicode + 1];
-            mbstowcs(pwz, help, lenAnsi + 1);
-            memcpy(dst, pwz, lenUnicode*sizeof(wchar_t));
-
-            // put the terminating _wide_ NUL
-            dst[lenUnicode] = 0;
-
-            delete [] pwz;
+            wxColour                vColor("BLACK");
+
+            rDc.SetTextForeground(vColor);
+            rDc.DrawBitmap( vBitmap
+                           ,pTool->m_vX
+                           ,pTool->m_vY
+                           ,bUseMask
+                          );
+        }
+        if (m_windowStyle & wxTB_3DBUTTONS)
+        {
+            RaiseTool(pTool);
+        }
+        if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsNull())
+        {
+            wxCoord                 vX;
+            wxCoord                 vY;
+            wxCoord                 vLeft = pTool->m_vX - (int)(pTool->GetWidth()/2);
+
+            rDc.SetFont(GetFont());
+            rDc.GetTextExtent( pTool->GetLabel()
+                              ,&vX
+                              ,&vY
+                             );
+            vLeft += (wxCoord)((m_vTextX - vX)/2);
+            rDc.DrawText( pTool->GetLabel()
+                         ,vLeft
+                         ,pTool->m_vY + m_vTextY + 4 // a bit of margin
+                        );
         }
-#endif // _WIN32_IE >= 0x0300
     }
-
-    // For backward compatibility...
-    OnMouseEnter(tool->GetId());
-    */
-    return(TRUE);
-}
+    else
+    {
+        wxColour                    vColor("GREY");
+
+        LowerTool(pTool);
+        rDc.SetTextForeground(vColor);
+        if (!pTool->GetDisabledBitmap().Ok())
+            pTool->SetDisabledBitmap(wxDisableBitmap( vBitmap
+                                                     ,(long)GetBackgroundColour().GetPixel()
+                                                    ));
+        rDc.DrawBitmap( pTool->GetDisabledBitmap()
+                       ,pTool->m_vX
+                       ,pTool->m_vY
+                       ,bUseMask
+                      );
+        if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsNull())
+        {
+            wxCoord                 vX;
+            wxCoord                 vY;
+            wxCoord                 vLeft = pTool->m_vX - (int)(pTool->GetWidth()/2);
+
+            rDc.SetFont(GetFont());
+            rDc.GetTextExtent( pTool->GetLabel()
+                              ,&vX
+                              ,&vY
+                             );
+            vLeft += (wxCoord)((m_vTextX - vX)/2);
+            rDc.DrawText( pTool->GetLabel()
+                         ,vLeft
+                         ,pTool->m_vY + m_vTextY + 4 // a bit of margin
+                        );
+        }
+    }
+} // end of wxToolBar::DrawTool
 
 // ----------------------------------------------------------------------------
 // toolbar geometry
 // ----------------------------------------------------------------------------
 
-void wxToolBar::SetToolBitmapSize(
-  const wxSize&                     rSize
-)
-{
-    wxToolBarBase::SetToolBitmapSize(rSize);
-
-    // ::SendMessage(GetHwnd(), TB_SETBITMAPSIZE, 0, MAKELONG(size.x, size.y));
-}
-
 void wxToolBar::SetRows(
   int                               nRows
 )
 {
-    if (nRows == m_maxRows)
-    {
-        // avoid resizing the frame uselessly
-        return;
-    }
-    // TODO:
-    /*
-    // TRUE in wParam means to create at least as many rows, FALSE -
-    // at most as many
-    RECT rect;
-    ::SendMessage(GetHwnd(), TB_SETROWS,
-                  MAKEWPARAM(nRows, !(GetWindowStyle() & wxTB_VERTICAL)),
-                  (LPARAM) &rect);
-
-    m_maxRows = nRows;
-
-    UpdateSize();
-    */
-}
-
-// The button size is bigger than the bitmap size
-wxSize wxToolBar::GetToolSize() const
-{
-    // TODO:
-    /*
-    // TB_GETBUTTONSIZE is supported from version 4.70
-#if defined(_WIN32_IE) && (_WIN32_IE >= 0x300 )
-    if ( wxTheApp->GetComCtl32Version() >= 470 )
-    {
-        DWORD dw = ::SendMessage(GetHwnd(), TB_GETBUTTONSIZE, 0, 0);
+    wxCHECK_RET( nRows != 0, _T("max number of rows must be > 0") );
 
-        return wxSize(LOWORD(dw), HIWORD(dw));
-    }
-    else
-#endif // comctl32.dll 4.70+
-    {
-        // defaults
-        return wxSize(m_defaultWidth + 8, m_defaultHeight + 7);
-    }
-    */
-    return wxSize(m_defaultWidth + 8, m_defaultHeight + 7);
-}
+    m_maxCols = (GetToolsCount() + nRows - 1) / nRows;
+    Refresh();
+} // end of wxToolBar::SetRows
 
-wxToolBarToolBase *wxToolBar::FindToolForPosition(
+wxToolBarToolBasewxToolBar::FindToolForPosition(
   wxCoord                           vX
 , wxCoord                           vY
 ) const
 {
-    POINTL                          vPt;
-
-    vPt.x = vX;
-    vPt.y = vY;
+    wxCoord                         vTextX = 0;
+    wxCoord                         vTextY = 0;
+    wxCoord                         vTBarHeight = 0;
 
-    int                             nIndex = 0; //(int)::SendMessage(GetHwnd(), TB_HITTEST, 0, (LPARAM)&pt);
-    if (nIndex < 0)
+    wxToolBarToolsList::Node* pNode = m_tools.GetFirst();
+    while (pNode)
     {
-        // it's a separator or there is no tool at all there
-        return (wxToolBarToolBase *)NULL;
-    }
-    return(m_tools.Item((size_t)nIndex)->GetData());
-}
-
-void wxToolBar::UpdateSize()
-{
-    // we must refresh the frame after the toolbar size (possibly) changed
-    wxFrame*                        pFrame = wxDynamicCast(GetParent(), wxFrame);
+        wxToolBarTool*              pTool = (wxToolBarTool *)pNode->GetData();
 
-    if (pFrame)
-    {
-        // don't change the size, we just need to generate a WM_SIZE
-        RECTL                       vR;
-        // TODO:
-        /*
-        if ( !GetWindowRect(GetHwndOf(frame), &r) )
+        if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsNull())
         {
-            wxLogLastError(_T("GetWindowRect"));
+            if ((vX >= (pTool->m_vX - ((wxCoord)(pTool->GetWidth()/2) - 2))) &&
+                (vY >= (pTool->m_vY - 2)) &&
+                (vX <= (pTool->m_vX + pTool->GetWidth())) &&
+                (vY <= (pTool->m_vY + pTool->GetHeight() + m_vTextY + 2)))
+            {
+                return pTool;
+            }
         }
-
-        (void)::SendMessage(GetHwndOf(frame), WM_SIZE, SIZE_RESTORED,
-                            MAKELPARAM(r.right - r.left, r.bottom - r.top));
-        */
+        else
+        {
+            if ((vX >= pTool->m_vX) &&
+                (vY >= pTool->m_vY) &&
+                (vX <= (pTool->m_vX + pTool->GetWidth())) &&
+                (vY <= (pTool->m_vY + pTool->GetHeight())))
+            {
+                return pTool;
+            }
+        }
+        pNode = pNode->GetNext();
     }
-}
+    return (wxToolBarToolBase *)NULL;
+} // end of wxToolBar::FindToolForPosition
 
 // ----------------------------------------------------------------------------
-// tool state
+// tool state change handlers
 // ----------------------------------------------------------------------------
 
 void wxToolBar::DoEnableTool(
   wxToolBarToolBase*                pTool
-, bool                              bEnable
+, bool                              WXUNUSED(bEnable)
 )
 {
-    // TODO:
-    /*
-    ::SendMessage(GetHwnd(), TB_ENABLEBUTTON,
-                  (WPARAM)tool->GetId(), (LPARAM)MAKELONG(enable, 0));
-    */
-}
+    DrawTool(pTool);
+} // end of wxToolBar::DoEnableTool
 
 void wxToolBar::DoToggleTool(
   wxToolBarToolBase*                pTool
-, bool                              bToggle
+, bool                              WXUNUSED(bToggle)
 )
 {
-    // TODO:
-    /*
-    ::SendMessage(GetHwnd(), TB_CHECKBUTTON,
-                  (WPARAM)tool->GetId(), (LPARAM)MAKELONG(toggle, 0));
-    */
-}
+    DrawTool(pTool);
+} // end of wxToolBar::DoToggleTool
 
 void wxToolBar::DoSetToggle(
-  wxToolBarToolBase*                pTool
-, bool                              bToggle
+  wxToolBarToolBase*                WXUNUSED(pTool)
+, bool                              WXUNUSED(bToggle)
+)
+{
+    // nothing to do
+} // end of wxToolBar::DoSetToggle
+
+//
+// Okay, so we've left the tool we're in ... we must check if the tool we're
+// leaving was a 'sprung push button' and if so, spring it back to the up
+// state.
+//
+void wxToolBar::SpringUpButton(
+  int                               vId
 )
 {
-    // VZ: AFAIK, the button has to be created either with TBSTYLE_CHECK or
-    //     without, so we really need to delete the button and recreate it here
-    wxFAIL_MSG( _T("not implemented") );
-}
+    wxToolBarToolBase*              pTool = FindById(vId);
+
+    if (pTool && pTool->CanBeToggled())
+    {
+        if (pTool->IsToggled())
+            pTool->Toggle();
+
+        DrawTool(pTool);
+    }
+} // end of wxToolBar::SpringUpButton
 
 // ----------------------------------------------------------------------------
-// event handlers
+// private helpers
 // ----------------------------------------------------------------------------
 
-// Responds to colour changes, and passes event on to children.
-void wxToolBar::OnSysColourChanged(
-  wxSysColourChangedEvent&          rEvent
+void wxToolBar::LowerTool (
+  wxToolBarToolBase*                pToolBase
+, bool                              bLower
 )
 {
-    // TODO:
-    /*
-    m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)),
-          GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE)));
-    */
+    wxToolBarTool*                  pTool = (wxToolBarTool*)pToolBase;
+    wxCoord                         vX;
+    wxCoord                         vY;
+    wxCoord                         vWidth;
+    wxCoord                         vHeight;
+    wxPen                           vDarkGreyPen( wxColour(85, 85, 85)
+                                                 ,1
+                                                 ,wxSOLID
+                                                );
+    wxPen                           vWhitePen( "WHITE"
+                                              ,1
+                                              ,wxSOLID
+                                             );
+    wxPen                           vClearPen( GetBackgroundColour()
+                                              ,1
+                                              ,wxSOLID
+                                             );
+    wxClientDC                      vDC(this);
 
-    // Remap the buttons
-    Realize();
+    if (!pTool)
+        return;
 
-    Refresh();
+    if (pTool->IsSeparator())
+        return;
 
-    // Propagate the event to the non-top-level children
-    wxWindow::OnSysColourChanged(rEvent);
-}
+    //
+    // We only do this for flat toolbars
+    //
+    if (!HasFlag(wxTB_FLAT))
+        return;
 
-void wxToolBar::OnMouseEvent(
-  wxMouseEvent&                     rEvent
-)
-{
-    if (rEvent.RightDown())
+    if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsEmpty())
     {
-        // For now, we don't have an id. Later we could
-        // try finding the tool.
-        OnRightClick( (int)-1
-                     ,rEvent.GetX()
-                     ,rEvent.GetY()
-                    );
+        vX = pTool->m_vX - (wxCoord)(pTool->GetWidth()/2);
+        vY = pTool->m_vY - 2;
+        vWidth = m_vTextX + 4;
+        vHeight = pTool->GetHeight() + m_vTextY + 2;
     }
     else
     {
-        rEvent.Skip();
+        vX = pTool->m_vX;
+        vY = pTool->m_vY - 2;
+        vWidth = pTool->GetWidth() + 4;
+        vHeight = pTool->GetHeight() + 4;
     }
-}
+    if (bLower)
+    {
+        vDC.SetPen(vWhitePen);
+        vDC.DrawLine(vX + vWidth, vY + vHeight, vX, vY + vHeight);
+        vDC.DrawLine(vX + vWidth, vY, vX + vWidth, vY + vHeight);
+        vDC.SetPen(vDarkGreyPen);
+        vDC.DrawLine(vX, vY, vX + vWidth, vY);
+        vDC.DrawLine(vX, vY + vHeight, vX, vY);
+    }
+    else
+    {
+        vDC.SetPen(vClearPen);
+        vDC.DrawLine(vX + vWidth, vY + vHeight, vX, vY + vHeight);
+        vDC.DrawLine(vX + vWidth, vY, vX + vWidth, vY + vHeight);
+        vDC.DrawLine(vX, vY, vX + vWidth, vY);
+        vDC.DrawLine(vX, vY + vHeight, vX, vY);
+    }
+} // end of WinGuiBase_CToolBarTool::LowerTool
 
-MRESULT wxToolBar::OS2WindowProc(
-  WXUINT                            ulMsg
-, MPARAM                            wParam
-, MPARAM                            lParam
+void wxToolBar::RaiseTool (
+  wxToolBarToolBase*                pToolBase
+, bool                              bRaise
 )
 {
-    // TODO:
-    /*
-    if (nMsg == WM_SIZE)
-    {
-        // calculate our minor dimenstion ourselves - we're confusing the
-        // standard logic (TB_AUTOSIZE) with our horizontal toolbars and other
-        // hacks
-        RECT r;
-        if ( ::SendMessage(GetHwnd(), TB_GETITEMRECT, 0, (LPARAM)&r) )
-        {
-            int w, h;
-
-            if ( GetWindowStyle() & wxTB_VERTICAL )
-            {
-                w = r.right - r.left;
-                if ( m_maxRows )
-                {
-                    w *= (m_nButtons + m_maxRows - 1)/m_maxRows;
-                }
-                h = HIWORD(lParam);
-            }
-            else
-            {
-                w = LOWORD(lParam);
-                h = r.bottom - r.top;
-                if ( m_maxRows )
-                {
-                    h += 6; // FIXME: this is the separator line height...
-                    h *= m_maxRows;
-                }
-            }
+    wxToolBarTool*                  pTool = (wxToolBarTool*)pToolBase;
+    wxCoord                         vX;
+    wxCoord                         vY;
+    wxCoord                         vWidth;
+    wxCoord                         vHeight;
+    wxPen                           vDarkGreyPen( wxColour(85, 85, 85)
+                                                 ,1
+                                                 ,wxSOLID
+                                                );
+    wxPen                           vWhitePen( "WHITE"
+                                              ,1
+                                              ,wxSOLID
+                                             );
+    wxPen                           vClearPen( GetBackgroundColour()
+                                              ,1
+                                              ,wxSOLID
+                                             );
+    wxClientDC                      vDC(this);
 
-            if ( MAKELPARAM(w, h) != lParam )
-            {
-                // size really changed
-                SetSize(w, h);
-            }
+    if (!pTool)
+        return;
 
-            // message processed
-            return 0;
-        }
-    }
+    if (pTool->IsSeparator())
+        return;
 
-    return wxControl::MSWWindowProc(nMsg, wParam, lParam);
-    */
-    return((MRESULT)0);
-}
+    if (!pTool->IsEnabled())
+        return;
 
-// ----------------------------------------------------------------------------
-// private functions
-// ----------------------------------------------------------------------------
+    //
+    // We only do this for flat toolbars
+    //
+    if (!HasFlag(wxTB_FLAT))
+        return;
 
-// These are the default colors used to map the bitmap colors to the current
-// system colors. Note that they are in BGR format because this is what Windows
-// wants (and not RGB)
-
-#define BGR_BUTTONTEXT      (RGB(000,000,000))  // black
-#define BGR_BUTTONSHADOW    (RGB(128,128,128))  // dark grey
-#define BGR_BUTTONFACE      (RGB(192,192,192))  // bright grey
-#define BGR_BUTTONHILIGHT   (RGB(255,255,255))  // white
-#define BGR_BACKGROUNDSEL   (RGB(255,000,000))  // blue
-#define BGR_BACKGROUND      (RGB(255,000,255))  // magenta
-
-void wxMapBitmap(
-  HBITMAP                           hBitmap
-, int                               nWidth
-, int                               nHeight
-)
-{
-  // TODO:
-  /*
-  COLORMAP ColorMap[] =
-  {
-    {BGR_BUTTONTEXT,    COLOR_BTNTEXT},     // black
-    {BGR_BUTTONSHADOW,  COLOR_BTNSHADOW},   // dark grey
-    {BGR_BUTTONFACE,    COLOR_BTNFACE},     // bright grey
-    {BGR_BUTTONHILIGHT, COLOR_BTNHIGHLIGHT},// white
-    {BGR_BACKGROUNDSEL, COLOR_HIGHLIGHT},   // blue
-    {BGR_BACKGROUND,    COLOR_WINDOW}       // magenta
-  };
-
-  int NUM_MAPS = (sizeof(ColorMap)/sizeof(COLORMAP));
-  int n;
-  for ( n = 0; n < NUM_MAPS; n++)
-  {
-    ColorMap[n].to = ::GetSysColor(ColorMap[n].to);
-  }
-
-  HBITMAP hbmOld;
-  HDC hdcMem = CreateCompatibleDC(NULL);
-
-  if (hdcMem)
-  {
-    hbmOld = (HBITMAP) SelectObject(hdcMem, hBitmap);
-
-    int i, j, k;
-    for ( i = 0; i < width; i++)
+    if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsEmpty())
     {
-        for ( j = 0; j < height; j++)
-        {
-            COLORREF pixel = ::GetPixel(hdcMem, i, j);
-//
-//            BYTE red = GetRValue(pixel);
-//            BYTE green = GetGValue(pixel);
-//            BYTE blue = GetBValue(pixel);
-//
-
-            for ( k = 0; k < NUM_MAPS; k ++)
-            {
-                if ( ColorMap[k].from == pixel )
-                {
-                    // COLORREF actualPixel =  ::SetPixel(hdcMem, i, j, ColorMap[k].to);
-                    break;
-                }
-            }
-        }
+        vX = pTool->m_vX - (wxCoord)(pTool->GetWidth()/2);
+        vY = pTool->m_vY - 2;
+        vWidth = m_vTextX + 4;
+        vHeight = pTool->GetHeight() + m_vTextY + 2;
     }
+    else
+    {
+        vX = pTool->m_vX;
+        vY = pTool->m_vY - 2;
+        vWidth = pTool->GetWidth() + 4;
+        vHeight = pTool->GetHeight() + 4;
+    }
+    if (bRaise)
+    {
+        vDC.SetPen(vDarkGreyPen);
+        vDC.DrawLine(vX + vWidth, vY + vHeight, vX, vY + vHeight);
+        vDC.DrawLine(vX + vWidth, vY, vX + vWidth, vY + vHeight);
+        vDC.SetPen(vWhitePen);
+        vDC.DrawLine(vX, vY, vX + vWidth, vY);
+        vDC.DrawLine(vX, vY + vHeight, vX, vY);
+    }
+    else
+    {
+        vDC.SetPen(vClearPen);
+        vDC.DrawLine(vX + vWidth, vY + vHeight, vX, vY + vHeight);
+        vDC.DrawLine(vX + vWidth, vY, vX + vWidth, vY + vHeight);
+        vDC.DrawLine(vX, vY, vX + vWidth, vY);
+        vDC.DrawLine(vX, vY + vHeight, vX, vY);
+    }
+} // end of wxToolBar::RaiseTool
 
-
-    SelectObject(hdcMem, hbmOld);
-    DeleteObject(hdcMem);
-  }
-  */
-}
-
-// Some experiments...
-#if 0
-  // What we want to do is create another bitmap which has a depth of 4,
-  // and set the bits. So probably we want to convert this HBITMAP into a
-  // DIB, then call SetDIBits.
-  // AAAGH. The stupid thing is that if newBitmap has a depth of 4 (less than that of
-  // the screen), then SetDIBits fails.
-  HBITMAP newBitmap = ::CreateBitmap(totalBitmapWidth, totalBitmapHeight, 1, 4, NULL);
-  HANDLE newDIB = ::BitmapToDIB((HBITMAP) m_hBitmap, NULL);
-  LPBITMAPINFOHEADER lpbmi = (LPBITMAPINFOHEADER) GlobalLock(newDIB);
-
-  dc = ::GetDC(NULL);
-//  LPBITMAPINFOHEADER lpbmi = (LPBITMAPINFOHEADER) newDIB;
-
-  int result = ::SetDIBits(dc, newBitmap, 0, lpbmi->biHeight, FindDIBBits((LPSTR)lpbmi), (LPBITMAPINFO)lpbmi,
-    DIB_PAL_COLORS);
-  DWORD err = GetLastError();
-
-  ::ReleaseDC(NULL, dc);
-
-  // Delete the DIB
-  GlobalUnlock (newDIB);
-  GlobalFree (newDIB);
-
-//  WXHBITMAP hBitmap2 = wxCreateMappedBitmap((WXHINSTANCE) wxGetInstance(), (WXHBITMAP) m_hBitmap);
-  // Substitute our new bitmap for the old one
-  ::DeleteObject((HBITMAP) m_hBitmap);
-  m_hBitmap = (WXHBITMAP) newBitmap;
-#endif
-
-#endif
+#endif // ndef for wxUSE_TOOLBAR && wxUSE_TOOLBAR_NATIVE
index 318aeb93ec81c2d78744afee426767fe36f1a8b7..610628a79ab645875131295c75f6814547b25482 100644 (file)
@@ -3069,31 +3069,27 @@ bool wxWindowOS2::OS2GetCreateWindowCoords(
 ) const
 {
     bool                            bNonDefault = FALSE;
+    static const int                DEFAULT_Y = 200;
+    static const int                DEFAULT_H = 250;
 
     if (rPos.x == -1)
     {
-        //
-        // If set x to CW_USEDEFAULT, y parameter is ignored anyhow so we can
-        // just as well set it to CW_USEDEFAULT as well
         rnX = rnY = CW_USEDEFAULT;
     }
     else
     {
         rnX = rPos.x;
-        rnY = rPos.y == -1 ? CW_USEDEFAULT : rPos.y;
+        rnY = rPos.y == -1 ? DEFAULT_Y : rPos.y;
         bNonDefault = TRUE;
     }
     if (rSize.x == -1)
     {
-        //
-        // As abobe, h is not used at all in this case anyhow
-        //
         rnWidth = rnHeight = CW_USEDEFAULT;
     }
     else
     {
         rnWidth  = rSize.x;
-        rnHeight = rSize.y == -1 ? CW_USEDEFAULT : rSize.y;
+        rnHeight = rSize.y == -1 ? DEFAULT_H : rSize.y;
         bNonDefault = TRUE;
     }
     return bNonDefault;
index 01915f23b40ea8dc1d13ffa808d4976a82c97d0e..fc4c8f05b921a25eae17a908fb1bbd7f07f764ae 100644 (file)
@@ -7388,8 +7388,8 @@ EXPORTS
       GetEventTable__14wxYearSpinCtrlCFv
       ;wxCalendarCtrl::GetDateCoord(const wxDateTime&,int*,int*) const
       GetDateCoord__14wxCalendarCtrlCFRC10wxDateTimePiT2
-      ;wxCalendarCtrl::OnYearChange(wxSpinEvent&)
-      OnYearChange__14wxCalendarCtrlFR11wxSpinEvent
+      ;wxCalendarCtrl::OnPaint(wxPaintEvent&)
+      OnPaint__14wxCalendarCtrlFR12wxPaintEvent
       wxEVT_CALENDAR_DAY_CHANGED
       ;wxYearSpinCtrl::sm_eventTable
       sm_eventTable__14wxYearSpinCtrl
@@ -7402,8 +7402,6 @@ EXPORTS
       ;wxCalendarCtrl::sm_classwxCalendarCtrl
       sm_classwxCalendarCtrl__14wxCalendarCtrl
       __vft14wxCalendarCtrl8wxObject
-      ;wxCalendarCtrl::OnPaint(wxPaintEvent&)
-      OnPaint__14wxCalendarCtrlFR12wxPaintEvent
       ;wxCalendarCtrl::IsDateInRange(const wxDateTime&) const
       IsDateInRange__14wxCalendarCtrlCFRC10wxDateTime
       ;wxCalendarCtrl::HitTest(const wxPoint&,wxDateTime*,wxDateTime::WeekDay*)
@@ -7432,10 +7430,12 @@ EXPORTS
       __vft15wxMonthComboBox15wxItemContainer
       ;wxCalendarCtrl::GetStartDate() const
       GetStartDate__14wxCalendarCtrlCFv
-      ;wxMonthComboBox::wxMonthComboBox(wxCalendarCtrl*)
-      __ct__15wxMonthComboBoxFP14wxCalendarCtrl
+      ;wxCalendarCtrl::OnYearChange(wxCommandEvent&)
+      OnYearChange__14wxCalendarCtrlFR14wxCommandEvent
       ;wxMonthComboBox::sm_eventTable
       sm_eventTable__15wxMonthComboBox
+      ;wxMonthComboBox::wxMonthComboBox(wxCalendarCtrl*)
+      __ct__15wxMonthComboBoxFP14wxCalendarCtrl
       ;wxYearSpinCtrl::wxYearSpinCtrl(wxCalendarCtrl*)
       __ct__14wxYearSpinCtrlFP14wxCalendarCtrl
       ;wxCalendarCtrl::HighlightRange(wxPaintDC*,const wxDateTime&,const wxDateTime&,wxPen*,wxBrush*)
@@ -7918,58 +7918,6 @@ EXPORTS
       ;wxGenericDirCtrl::ExtractWildcard(const wxString&,int,wxString&,wxString&)
       ExtractWildcard__16wxGenericDirCtrlFRC8wxStringiR8wxStringT3
   ;From object file:  ..\generic\dragimgg.cpp
-  ;From object file:  ..\generic\fontdlgg.cpp
-    ;PUBDEFs (Symbols available from object file):
-      ;wxGenericFontDialog::OnCloseWindow(wxCloseEvent&)
-      OnCloseWindow__19wxGenericFontDialogFR12wxCloseEvent
-      ;wxGenericFontDialog::wxGenericFontDialog(wxWindow*,const wxFontData&)
-      __ct__19wxGenericFontDialogFP8wxWindowRC10wxFontData
-      ;wxFontStyleIntToString(int)
-      wxFontStyleIntToString__Fi
-      ;wxGenericFontDialog::GetEventTable() const
-      GetEventTable__19wxGenericFontDialogCFv
-      ;wxFontPreviewer::sm_eventTable
-      sm_eventTable__15wxFontPreviewer
-      ;wxGenericFontDialog::~wxGenericFontDialog()
-      __dt__19wxGenericFontDialogFv
-      ;wxFontWeightStringToInt(char*)
-      wxFontWeightStringToInt__FPc
-      __vft15wxFontPreviewer8wxObject
-      __vft19wxGenericFontDialog8wxObject
-      ;wxFontFamilyIntToString(int)
-      wxFontFamilyIntToString__Fi
-      ;wxFontPreviewer::OnPaint(wxPaintEvent&)
-      OnPaint__15wxFontPreviewerFR12wxPaintEvent
-      ;wxGenericFontDialog::OnChangeFont(wxCommandEvent&)
-      OnChangeFont__19wxGenericFontDialogFR14wxCommandEvent
-      ;wxGenericFontDialog::Create(wxWindow*,const wxFontData&)
-      Create__19wxGenericFontDialogFP8wxWindowRC10wxFontData
-      ;wxGenericFontDialog::ShowModal()
-      ShowModal__19wxGenericFontDialogFv
-      ;wxGenericFontDialog::sm_eventTableEntries
-      sm_eventTableEntries__19wxGenericFontDialog
-      ;wxGenericFontDialog::sm_eventTable
-      sm_eventTable__19wxGenericFontDialog
-      ;wxFontWeightIntToString(int)
-      wxFontWeightIntToString__Fi
-      ;wxFontPreviewer::GetEventTable() const
-      GetEventTable__15wxFontPreviewerCFv
-      ;wxConstructorForwxGenericFontDialog()
-      wxConstructorForwxGenericFontDialog__Fv
-      ;wxFontFamilyStringToInt(char*)
-      wxFontFamilyStringToInt__FPc
-      ;wxFontStyleStringToInt(char*)
-      wxFontStyleStringToInt__FPc
-      ;wxGenericFontDialog::wxGenericFontDialog()
-      __ct__19wxGenericFontDialogFv
-      ;wxFontPreviewer::sm_eventTableEntries
-      sm_eventTableEntries__15wxFontPreviewer
-      ;wxGenericFontDialog::InitializeFont()
-      InitializeFont__19wxGenericFontDialogFv
-      ;wxGenericFontDialog::CreateWidgets()
-      CreateWidgets__19wxGenericFontDialogFv
-      ;wxGenericFontDialog::sm_classwxGenericFontDialog
-      sm_classwxGenericFontDialog__19wxGenericFontDialog
   ;From object file:  ..\generic\fdrepdlg.cpp
     ;PUBDEFs (Symbols available from object file):
       ;wxFindReplaceDialog::OnFind(wxCommandEvent&)
@@ -10343,6 +10291,8 @@ EXPORTS
     ;PUBDEFs (Symbols available from object file):
       ;wxTextEntryDialog::OnOK(wxCommandEvent&)
       OnOK__17wxTextEntryDialogFR14wxCommandEvent
+      ;wxTextEntryDialog::SetTextValidator(long)
+      SetTextValidator__17wxTextEntryDialogFl
       ;wxTextEntryDialog::sm_classwxTextEntryDialog
       sm_classwxTextEntryDialog__17wxTextEntryDialog
       ;wxTextEntryDialog::SetValue(const wxString&)
@@ -10354,6 +10304,8 @@ EXPORTS
       ;wxTextEntryDialog::wxTextEntryDialog(wxWindow*,const wxString&,const wxString&,const wxString&,long,const wxPoint&)
       __ct__17wxTextEntryDialogFP8wxWindowRC8wxStringN22lRC7wxPoint
       __vft17wxTextEntryDialog8wxObject
+      ;wxTextEntryDialog::SetTextValidator(wxTextValidator&)
+      SetTextValidator__17wxTextEntryDialogFR15wxTextValidator
       ;wxTextEntryDialog::sm_eventTable
       sm_eventTable__17wxTextEntryDialog
   ;From object file:  ..\generic\tipdlg.cpp
@@ -10684,6 +10636,8 @@ EXPORTS
       DisplaySection__20wxHtmlHelpControllerFi
       ;wxHtmlHelpController::DestroyHelpWindow()
       DestroyHelpWindow__20wxHtmlHelpControllerFv
+      ;wxHtmlHelpController::AddGrabIfNeeded()
+      AddGrabIfNeeded__20wxHtmlHelpControllerFv
       ;wxHtmlHelpController::AddBook(const wxString&,unsigned long)
       AddBook__20wxHtmlHelpControllerFRC8wxStringUl
       __vft20wxHtmlHelpController8wxObject
@@ -10693,8 +10647,14 @@ EXPORTS
       Quit__20wxHtmlHelpControllerFv
       ;wxHtmlHelpController::ReadCustomization(wxConfigBase*,const wxString&)
       ReadCustomization__20wxHtmlHelpControllerFP12wxConfigBaseRC8wxString
+      ;wxHtmlHelpController::KeywordSearch(const wxString&)
+      KeywordSearch__20wxHtmlHelpControllerFRC8wxString
+      ;wxHtmlHelpController::Display(int)
+      Display__20wxHtmlHelpControllerFi
       ;wxHtmlHelpController::sm_classwxHtmlHelpController
       sm_classwxHtmlHelpController__20wxHtmlHelpController
+      ;wxHtmlHelpController::Display(const wxString&)
+      Display__20wxHtmlHelpControllerFRC8wxString
       ;wxHtmlHelpController::WriteCustomization(wxConfigBase*,const wxString&)
       WriteCustomization__20wxHtmlHelpControllerFP12wxConfigBaseRC8wxString
       ;wxHtmlHelpController::UseConfig(wxConfigBase*,const wxString&)
@@ -10711,6 +10671,10 @@ EXPORTS
       OnCloseFrame__20wxHtmlHelpControllerFR12wxCloseEvent
       ;wxHtmlHelpController::wxHtmlHelpController(int)
       __ct__20wxHtmlHelpControllerFi
+      ;wxHtmlHelpController::DisplayContents()
+      DisplayContents__20wxHtmlHelpControllerFv
+      ;wxHtmlHelpController::DisplayIndex()
+      DisplayIndex__20wxHtmlHelpControllerFv
       ;wxHtmlHelpController::SetTitleFormat(const wxString&)
       SetTitleFormat__20wxHtmlHelpControllerFRC8wxString
       ;wxHtmlHelpController::LoadFile(const wxString&)
@@ -10821,12 +10785,12 @@ EXPORTS
       OnIndexAll__15wxHtmlHelpFrameFR14wxCommandEvent
       ;wxHtmlHelpFrame::wxHtmlHelpFrame(wxWindow*,int,const wxString&,int,wxHtmlHelpData*)
       __ct__15wxHtmlHelpFrameFP8wxWindowiRC8wxStringT2P14wxHtmlHelpData
-      ;wxHtmlHelpFrame::DisplayContents()
-      DisplayContents__15wxHtmlHelpFrameFv
-      ;wxHtmlHelpFrame::OptionsDialog()
-      OptionsDialog__15wxHtmlHelpFrameFv
       ;wxHtmlHelpFrame::Create(wxWindow*,int,const wxString&,int)
       Create__15wxHtmlHelpFrameFP8wxWindowiRC8wxStringT2
+      ;wxHtmlHelpFrame::OptionsDialog()
+      OptionsDialog__15wxHtmlHelpFrameFv
+      ;wxHtmlHelpFrame::DisplayContents()
+      DisplayContents__15wxHtmlHelpFrameFv
       ;wxHtmlHelpFrame::CreateIndex()
       CreateIndex__15wxHtmlHelpFrameFv
       ;wxHtmlHelpFrameOptionsDialog::sm_eventTableEntries
@@ -10837,18 +10801,18 @@ EXPORTS
       OnSearch__15wxHtmlHelpFrameFR14wxCommandEvent
       ;wxHtmlHelpFrame::Init(wxHtmlHelpData*)
       Init__15wxHtmlHelpFrameFP14wxHtmlHelpData
-      ;wxHtmlHelpFrame::DisplayIndex()
-      DisplayIndex__15wxHtmlHelpFrameFv
+      ;wxHtmlHelpFrame::NotifyPageChanged()
+      NotifyPageChanged__15wxHtmlHelpFrameFv
       ;wxConstructorForwxHtmlHelpFrame()
       wxConstructorForwxHtmlHelpFrame__Fv
       ;wxHtmlHelpFrame::~wxHtmlHelpFrame()
       __dt__15wxHtmlHelpFrameFv
-      ;wxHtmlHelpFrame::NotifyPageChanged()
-      NotifyPageChanged__15wxHtmlHelpFrameFv
       ;wxHtmlHelpFrameOptionsDialog::GetEventTable() const
       GetEventTable__28wxHtmlHelpFrameOptionsDialogCFv
       ;wxHtmlHelpFrame::GetEventTable() const
       GetEventTable__15wxHtmlHelpFrameCFv
+      ;wxHtmlHelpFrame::DisplayIndex()
+      DisplayIndex__15wxHtmlHelpFrameFv
       ;wxHtmlHelpFrame::CreateSearch()
       CreateSearch__15wxHtmlHelpFrameFv
       ;wxHtmlHelpFrame::ReadCustomization(wxConfigBase*,const wxString&)
@@ -12894,8 +12858,10 @@ EXPORTS
       GetEventTable__7wxFrameCFv
       ;wxFrame::DetachMenuBar()
       DetachMenuBar__7wxFrameFv
-      wxFrameMainWndProc
+      ;wxFrame::OnCreateToolBar(long,int,const wxString&)
+      OnCreateToolBar__7wxFrameFliRC8wxString
       wxFrameWndProc
+      wxFrameMainWndProc
       ;wxFrame::SetClient(wxWindow*)
       SetClient__7wxFrameFP8wxWindow
   ;From object file:  ..\os2\gauge.cpp
@@ -14751,16 +14717,18 @@ EXPORTS
       CreateTool__9wxToolBarFP9wxControl
       ;wxToolBar::DoToggleTool(wxToolBarToolBase*,unsigned long)
       DoToggleTool__9wxToolBarFP17wxToolBarToolBaseUl
+      ;wxToolBar::SpringUpButton(int)
+      SpringUpButton__9wxToolBarFi
       ;wxToolBar::Init()
       Init__9wxToolBarFv
       ;wxToolBar::sm_eventTable
       sm_eventTable__9wxToolBar
-      ;wxToolBar::GetToolSize() const
-      GetToolSize__9wxToolBarCFv
       ;wxToolBar::Create(wxWindow*,int,const wxPoint&,const wxSize&,long,const wxString&)
       Create__9wxToolBarFP8wxWindowiRC7wxPointRC6wxSizelRC8wxString
-      ;wxToolBar::OS2Command(unsigned int,unsigned short)
-      OS2Command__9wxToolBarFUiUs
+      ;wxToolBar::OnKillFocus(wxFocusEvent&)
+      OnKillFocus__9wxToolBarFR12wxFocusEvent
+      ;wxToolBar::LowerTool(wxToolBarToolBase*,unsigned long)
+      LowerTool__9wxToolBarFP17wxToolBarToolBaseUl
       ;wxToolBar::DoInsertTool(unsigned int,wxToolBarToolBase*)
       DoInsertTool__9wxToolBarFUiP17wxToolBarToolBase
       ;wxToolBar::Realize()
@@ -14769,37 +14737,43 @@ EXPORTS
       sm_eventTableEntries__9wxToolBar
       ;wxToolBar::sm_classwxToolBar
       sm_classwxToolBar__9wxToolBar
+      ;wxToolBar::OnPaint(wxPaintEvent&)
+      OnPaint__9wxToolBarFR12wxPaintEvent
       __vft9wxToolBar8wxObject
-      ;wxToolBar::SetToolBitmapSize(const wxSize&)
-      SetToolBitmapSize__9wxToolBarFRC6wxSize
-      ;wxToolBar::DoEnableTool(wxToolBarToolBase*,unsigned long)
-      DoEnableTool__9wxToolBarFP17wxToolBarToolBaseUl
+      ;wxToolBar::RaiseTool(wxToolBarToolBase*,unsigned long)
+      RaiseTool__9wxToolBarFP17wxToolBarToolBaseUl
+      ;wxToolBar::DrawTool(wxDC&,wxToolBarToolBase*)
+      DrawTool__9wxToolBarFR4wxDCP17wxToolBarToolBase
+      ;wxToolBar::OnSize(wxSizeEvent&)
+      OnSize__9wxToolBarFR11wxSizeEvent
       ;wxToolBar::OnMouseEvent(wxMouseEvent&)
       OnMouseEvent__9wxToolBarFR12wxMouseEvent
       ;wxToolBar::DoSetToggle(wxToolBarToolBase*,unsigned long)
       DoSetToggle__9wxToolBarFP17wxToolBarToolBaseUl
-      ;wxToolBar::DoDeleteTool(unsigned int,wxToolBarToolBase*)
-      DoDeleteTool__9wxToolBarFUiP17wxToolBarToolBase
+      ;wxToolBar::DoEnableTool(wxToolBarToolBase*,unsigned long)
+      DoEnableTool__9wxToolBarFP17wxToolBarToolBaseUl
+      ;wxToolBar::DoAddTool(int,const wxString&,const wxBitmap&,const wxBitmap&,wxItemKind,const wxString&,const wxString&,wxObject*,int,int)
+      DoAddTool__9wxToolBarFiRC8wxStringRC8wxBitmapT310wxItemKindN22P8wxObjectN21
       ;wxToolBar::SetRows(int)
       SetRows__9wxToolBarFi
       ;wxToolBar::FindToolForPosition(int,int) const
       FindToolForPosition__9wxToolBarCFiT1
+      ;wxToolBar::DrawTool(wxToolBarToolBase*)
+      DrawTool__9wxToolBarFP17wxToolBarToolBase
+      ;wxToolBar::DoDeleteTool(unsigned int,wxToolBarToolBase*)
+      DoDeleteTool__9wxToolBarFUiP17wxToolBarToolBase
       ;wxToolBar::GetEventTable() const
       GetEventTable__9wxToolBarCFv
-      ;wxToolBar::OS2WindowProc(unsigned int,void*,void*)
-      OS2WindowProc__9wxToolBarFUiPvT2
       ;wxToolBar::CreateTool(int,const wxString&,const wxBitmap&,const wxBitmap&,wxItemKind,wxObject*,const wxString&,const wxString&)
       CreateTool__9wxToolBarFiRC8wxStringRC8wxBitmapT310wxItemKindP8wxObjectN22
-      ;wxToolBar::OnSysColourChanged(wxSysColourChangedEvent&)
-      OnSysColourChanged__9wxToolBarFR23wxSysColourChangedEvent
+      ;wxDisableBitmap(const wxBitmap&,long)
+      wxDisableBitmap__FRC8wxBitmapl
       ;wxConstructorForwxToolBar()
       wxConstructorForwxToolBar__Fv
+      ;wxToolBar::m_bInitialized
+      m_bInitialized__9wxToolBar
       ;wxToolBar::~wxToolBar()
       __dt__9wxToolBarFv
-      ;wxToolBar::UpdateSize()
-      UpdateSize__9wxToolBarFv
-      ;wxToolBar::OS2OnNotify(int,void*,void**)
-      OS2OnNotify__9wxToolBarFiPvPPv
   ;From object file:  ..\os2\tooltip.cpp
     ;PUBDEFs (Symbols available from object file):
       ;wxToolTip::wxToolTip(const wxString&)