+ GetSize( NULL
+ ,&vTBarHeight
+ );
+ vY = vTBarHeight - vY;
+ wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
+ while (node)
+ {
+ wxToolBarTool* pTool = (wxToolBarTool *)node->GetData();
+
+ if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().IsNull())
+ {
+ 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;
+ }
+ }
+ else
+ {
+ if ((vX >= pTool->m_vX) &&
+ (vY >= pTool->m_vY) &&
+ (vX <= (pTool->m_vX + pTool->GetWidth())) &&
+ (vY <= (pTool->m_vY + pTool->GetHeight())))
+ {
+ return pTool;
+ }
+ }
+ node = node->GetNext();
+ }
+ return (wxToolBarToolBase *)NULL;
+} // end of wxToolBar::FindToolForPosition
+
+// ----------------------------------------------------------------------------
+// tool state change handlers
+// ----------------------------------------------------------------------------
+
+void wxToolBar::DoEnableTool(
+ wxToolBarToolBase* pTool
+, bool WXUNUSED(bEnable)
+)
+{
+ DrawTool(pTool);
+} // end of wxToolBar::DoEnableTool
+
+void wxToolBar::DoToggleTool(
+ wxToolBarToolBase* pTool
+, bool WXUNUSED(bToggle)
+)
+{
+ DrawTool(pTool);
+} // end of wxToolBar::DoToggleTool
+
+void wxToolBar::DoSetToggle(
+ 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
+)
+{
+ wxToolBarToolBase* pTool = FindById(vId);
+
+ if (pTool && pTool->CanBeToggled())
+ {
+ if (pTool->IsToggled())
+ pTool->Toggle();
+
+ DrawTool(pTool);
+ }
+} // end of wxToolBar::SpringUpButton
+
+// ----------------------------------------------------------------------------
+// private helpers
+// ----------------------------------------------------------------------------
+
+void wxToolBar::LowerTool ( wxToolBarToolBase* pToolBase,
+ bool bLower )
+{
+ wxToolBarTool* pTool = (wxToolBarTool*)pToolBase;
+ wxCoord vX;
+ wxCoord vY;
+ wxCoord vWidth;
+ wxCoord vHeight;
+ wxColour gray85( 85,85,85 );
+ wxPen vDarkGreyPen( gray85, 1, wxSOLID );
+ wxPen vClearPen( GetBackgroundColour(), 1, wxSOLID );
+ wxClientDC vDC(this);
+
+ if (!pTool)
+ return;
+
+ if (pTool->IsSeparator())
+ return;
+
+ //
+ // We only do this for flat toolbars
+ //
+ if (!HasFlag(wxTB_FLAT))
+ return;
+
+ if (HasFlag(wxTB_TEXT) && !pTool->GetLabel().empty())
+ {
+ if (pTool->GetWidth() > m_vTextX)
+ {
+ vX = pTool->m_vX - 2;
+ vWidth = pTool->GetWidth() + 4;
+ }
+ else
+ {
+ vX = pTool->m_vX - (wxCoord)(pTool->GetWidth()/2);
+ vWidth = m_vTextX + 4;
+ }
+ vY = pTool->m_vY - 2;
+ vHeight = pTool->GetHeight() + m_vTextY + 2;
+ }
+ else
+ {
+ vX = pTool->m_vX - 2;
+ vY = pTool->m_vY - 2;
+ vWidth = pTool->GetWidth() + 4;
+ vHeight = pTool->GetHeight() + 4;
+ }
+ if (bLower)
+ {
+ vDC.SetPen(*wxWHITE_PEN);
+ 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