added UnsetToolTip() and use it in wxAUI code to fix wxX11 compilation [backport of r55269 from trunk

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@55514 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-09-07 17:09:38 +00:00
parent b8e40fb308
commit 3ba967c80b
3 changed files with 94 additions and 86 deletions

View File

@@ -1004,14 +1004,21 @@ public:
void SetToolTip( const wxString &tip );
// attach a tooltip to the window
void SetToolTip( wxToolTip *tip ) { DoSetToolTip(tip); }
#if wxABI_VERSION >= 20809
// more readable synonym for SetToolTip(NULL)
void UnsetToolTip() { SetToolTip(NULL); }
#endif // wxABI_VERSION >= 2.8.9
// get the associated tooltip or NULL if none
wxToolTip* GetToolTip() const { return m_tooltip; }
wxString GetToolTipText() const ;
#else
#else // !wxUSE_TOOLTIPS
// make it much easier to compile apps in an environment
// that doesn't support tooltips, such as PocketPC
inline void SetToolTip( const wxString & WXUNUSED(tip) ) {}
#endif // wxUSE_TOOLTIPS
void SetToolTip( const wxString & WXUNUSED(tip) ) {}
#if wxABI_VERSION >= 20809
void UnsetToolTip() { }
#endif // wxABI_VERSION >= 2.8.9
#endif // wxUSE_TOOLTIPS/!wxUSE_TOOLTIPS
// drag and drop
// -------------

View File

@@ -37,7 +37,9 @@
#include "wx/aui/framemanager.h"
#ifdef __WXMAC__
#include "wx/mac/carbon/private.h"
#include "wx/osx/private.h"
// for themeing support
#include <Carbon/Carbon.h>
#endif
#include "wx/arrimpl.cpp"
@@ -110,24 +112,22 @@ static wxBitmap MakeDisabledBitmap(wxBitmap& bmp)
static wxColor GetBaseColor()
{
#ifdef __WXMAC__
wxBrush toolbarbrush;
toolbarbrush.MacSetTheme( kThemeBrushToolbarBackground );
wxColor base_color = toolbarbrush.GetColour();
#if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON
wxColor base_colour = wxColour( wxMacCreateCGColorFromHITheme(kThemeBrushToolbarBackground));
#else
wxColor base_color = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
wxColor base_colour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
#endif
// the base_colour is too pale to use as our base colour,
// so darken it a bit --
if ((255-base_color.Red()) +
(255-base_color.Green()) +
(255-base_color.Blue()) < 60)
if ((255-base_colour.Red()) +
(255-base_colour.Green()) +
(255-base_colour.Blue()) < 60)
{
base_color = wxAuiStepColour(base_color, 92);
base_colour = wxAuiStepColour(base_colour, 92);
}
return base_color;
return base_colour;
}
@@ -165,7 +165,6 @@ const wxColour DISABLED_TEXT_COLOR(DISABLED_TEXT_GREY_HUE,
DISABLED_TEXT_GREY_HUE,
DISABLED_TEXT_GREY_HUE);
wxAuiDefaultToolBarArt::wxAuiDefaultToolBarArt()
{
m_base_colour = GetBaseColor();
@@ -210,7 +209,7 @@ wxAuiDefaultToolBarArt::~wxAuiDefaultToolBarArt()
wxAuiToolBarArt* wxAuiDefaultToolBarArt::Clone()
{
return wx_static_cast(wxAuiToolBarArt*, new wxAuiDefaultToolBarArt);
return static_cast<wxAuiToolBarArt*>(new wxAuiDefaultToolBarArt);
}
void wxAuiDefaultToolBarArt::SetFlags(unsigned int flags)
@@ -363,7 +362,7 @@ void wxAuiDefaultToolBarArt::DrawButton(
if (item.GetState() & wxAUI_BUTTON_STATE_DISABLED)
dc.SetTextForeground(DISABLED_TEXT_COLOR);
if ((m_flags & wxAUI_TB_TEXT) && item.GetLabel().Length() > 0)
if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() )
{
dc.DrawText(item.GetLabel(), text_x, text_y);
}
@@ -479,7 +478,7 @@ void wxAuiDefaultToolBarArt::DrawDropDownButton(
if (item.GetState() & wxAUI_BUTTON_STATE_DISABLED)
dc.SetTextForeground(DISABLED_TEXT_COLOR);
if ((m_flags & wxAUI_TB_TEXT) && item.GetLabel().Length() > 0)
if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() )
{
dc.DrawText(item.GetLabel(), text_x, text_y);
}
@@ -521,7 +520,7 @@ void wxAuiDefaultToolBarArt::DrawControlLabel(
text_x = rect.x + (rect.width/2) - (text_width/2) + 1;
text_y = rect.y + rect.height - text_height - 1;
if ((m_flags & wxAUI_TB_TEXT) && item.GetLabel().Length() > 0)
if ( (m_flags & wxAUI_TB_TEXT) && !item.GetLabel().empty() )
{
dc.DrawText(item.GetLabel(), text_x, text_y);
}
@@ -565,18 +564,19 @@ wxSize wxAuiDefaultToolBarArt::GetToolSize(
dc.GetTextExtent(wxT("ABCDHgj"), &tx, &ty);
height += ty;
if (item.GetLabel().Length() > 0)
if ( !item.GetLabel().empty() )
{
dc.GetTextExtent(item.GetLabel(), &tx, &ty);
width = wxMax(width, tx+6);
}
}
else if (m_text_orientation == wxAUI_TBTOOL_TEXT_RIGHT && item.GetLabel().Length() > 0)
else if ( m_text_orientation == wxAUI_TBTOOL_TEXT_RIGHT &&
!item.GetLabel().empty() )
{
width += 3; // space between left border and bitmap
width += 3; // space between bitmap and text
if (item.GetLabel().Length() > 0)
if ( !item.GetLabel().empty() )
{
dc.GetTextExtent(item.GetLabel(), &tx, &ty);
width += tx;
@@ -1786,11 +1786,11 @@ bool wxAuiToolBar::Realize()
vert_sizer->AddStretchSpacer(1);
ctrl_sizer_item = vert_sizer->Add(item.window, 0, wxEXPAND);
vert_sizer->AddStretchSpacer(1);
if ((m_style & wxAUI_TB_TEXT) &&
if ( (m_style & wxAUI_TB_TEXT) &&
m_tool_text_orientation == wxAUI_TBTOOL_TEXT_BOTTOM &&
item.label.Length() > 0)
!item.GetLabel().empty() )
{
wxSize s = GetLabelSize(item.label);
wxSize s = GetLabelSize(item.GetLabel());
vert_sizer->Add(1, s.y);
}
@@ -2364,7 +2364,7 @@ void wxAuiToolBar::OnLeftUp(wxMouseEvent& evt)
if (m_action_item && hit_item == m_action_item)
{
SetToolTip(NULL);
UnsetToolTip();
if (hit_item->kind == wxITEM_CHECK)
{
@@ -2538,7 +2538,7 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt)
m_action_pos != wxPoint(-1,-1) &&
abs(evt.m_x - m_action_pos.x) + abs(evt.m_y - m_action_pos.y) > 5)
{
SetToolTip(NULL);
UnsetToolTip();
m_dragging = true;
@@ -2573,15 +2573,15 @@ void wxAuiToolBar::OnMotion(wxMouseEvent& evt)
{
m_tip_item = packing_hit_item;
if (packing_hit_item->short_help.Length() > 0)
if ( !packing_hit_item->short_help.empty() )
SetToolTip(packing_hit_item->short_help);
else
SetToolTip(NULL);
UnsetToolTip();
}
}
else
{
SetToolTip(NULL);
UnsetToolTip();
m_tip_item = NULL;
}

View File

@@ -29,6 +29,7 @@
@WX_VERSION_TAG@.9 {
*wxAuiTabCtrl*OnCaptureLost*;
*wxAuiToolBar*;
*wxWindow*UnsetToolTip*;
};
@WX_VERSION_TAG@.8 {