+            if (lStyle & wxTB_TEXT)
+                nHeight = m_defaultHeight + m_vTextY;
+            else
+                nHeight = m_defaultHeight;
+        }
+    }
+    else
+    {
+        if (nHeight <= 0)
+        {
+            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
+        }
+    }
+    if (nX < 0)
+        nX = 0;
+    if (nY < 0)
+        nY = 0;
+
+    SetSize( nX
+            ,nY
+            ,nWidth
+            ,nHeight
+           );
+    return TRUE;
+} // end of wxToolBar::Create
+
+wxToolBar::~wxToolBar()
+{
+    if (m_pToolTip)
+    {
+        delete m_pToolTip;
+        m_pToolTip = NULL;
+    }
+} // end of wxToolBar::~wxToolBar
+
+bool wxToolBar::Realize()
+{
+    int                             nMaxToolWidth  = 0;
+    int                             nMaxToolHeight = 0;
+    int                             nX;
+    int                             nY;
+
+    m_nCurrentRowsOrColumns = 0;
+    m_vLastX               = m_xMargin;
+    m_vLastY               = m_yMargin;
+    m_vMaxWidth            = 0;
+    m_vMaxHeight           = 0;
+
+
+    //
+    // Find the maximum tool width and height
+    //
+    wxToolBarToolsList::Node*       pNode = m_tools.GetFirst();
+
+    while (pNode )
+    {
+        wxToolBarTool*              pTool = (wxToolBarTool *)pNode->GetData();
+
+        if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsEmpty())
+        {
+            //
+            // Set the height according to the font and the border size
+            //
+            if (pTool->GetWidth() > m_vTextX)
+                nMaxToolWidth = pTool->GetWidth() + 4;
+            else
+                nMaxToolWidth = m_vTextX;
+            if (pTool->GetHeight() + m_vTextY > nMaxToolHeight)
+                nMaxToolHeight = pTool->GetHeight() + m_vTextY;
+        }
+        else
+        {
+            if (pTool->GetWidth() > nMaxToolWidth )
+                nMaxToolWidth = pTool->GetWidth() + 4;
+            if (pTool->GetHeight() > nMaxToolHeight)
+                nMaxToolHeight = pTool->GetHeight();
+        }
+        pNode = pNode->GetNext();
+    }
+
+    wxCoord                         vTbWidth = 0L;
+    wxCoord                         vTbHeight = 0L;
+
+    GetSize( &vTbWidth
+            ,&vTbHeight
+           );
+    if (vTbHeight < nMaxToolHeight)
+    {
+        SetSize( -1L
+                ,-1L
+                ,vTbWidth
+                ,nMaxToolHeight + 4
+               );
+        if (GetParent()->IsKindOf(CLASSINFO(wxFrame)))
+        {
+            wxFrame*            pFrame = wxDynamicCast(GetParent(), wxFrame);
+
+            if (pFrame)
+                pFrame->PositionToolBar();
+        }
+    }
+
+    int                             nSeparatorSize = m_toolSeparation;
+
+    pNode = m_tools.GetFirst();
+    while (pNode)
+    {
+        wxToolBarTool*              pTool = (wxToolBarTool *)pNode->GetData();
+
+        if (pTool->IsSeparator())
+        {
+            if (GetWindowStyleFlag() & wxTB_HORIZONTAL)
+            {
+                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 * 4;
+            }
+            else
+            {
+                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 * 4;
+            }
+        }
+        else if (pTool->IsButton())
+        {
+            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
+            {
+                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++;