mirror of https://github.com/PCSX2/pcsx2.git
gui:windows: Fix tooltip wrapping
wxWidgets 3.0 now wraps tooltips automatically on Windows, so the custom tooltip wrapping functionality is no longer necessary.
This commit is contained in:
parent
31a505768d
commit
e2f1bafeef
|
@ -799,7 +799,6 @@ extern wxString pxGetAppName();
|
||||||
extern int pxGetCharHeight( const wxWindow* wind, int rows=1 );
|
extern int pxGetCharHeight( const wxWindow* wind, int rows=1 );
|
||||||
extern int pxGetCharHeight( const wxWindow& wind, int rows=1 );
|
extern int pxGetCharHeight( const wxWindow& wind, int rows=1 );
|
||||||
|
|
||||||
extern wxString pxFormatToolTipText( wxWindow* wind, const wxString& src );
|
|
||||||
extern void pxSetToolTip( wxWindow* wind, const wxString& src );
|
extern void pxSetToolTip( wxWindow* wind, const wxString& src );
|
||||||
extern void pxSetToolTip( wxWindow& wind, const wxString& src );
|
extern void pxSetToolTip( wxWindow& wind, const wxString& src );
|
||||||
extern wxFont pxGetFixedFont( int ptsize=8, int weight=wxNORMAL );
|
extern wxFont pxGetFixedFont( int ptsize=8, int weight=wxNORMAL );
|
||||||
|
|
|
@ -75,9 +75,8 @@ pxCheckBox& pxCheckBox::SetSubPadding( int pad )
|
||||||
// performs word wrapping on platforms that need it (eg mswindows).
|
// performs word wrapping on platforms that need it (eg mswindows).
|
||||||
pxCheckBox& pxCheckBox::SetToolTip( const wxString& tip )
|
pxCheckBox& pxCheckBox::SetToolTip( const wxString& tip )
|
||||||
{
|
{
|
||||||
const wxString wrapped( pxFormatToolTipText(this, tip) );
|
pxSetToolTip( m_checkbox, tip );
|
||||||
pxSetToolTip( m_checkbox, wrapped );
|
pxSetToolTip( m_subtext, tip );
|
||||||
pxSetToolTip( m_subtext, wrapped );
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,12 +107,11 @@ void pxRadioPanel::Realize()
|
||||||
|
|
||||||
void pxRadioPanel::_setToolTipImmediate( int idx, const wxString &tip )
|
void pxRadioPanel::_setToolTipImmediate( int idx, const wxString &tip )
|
||||||
{
|
{
|
||||||
const wxString wrapped( pxFormatToolTipText(this, tip) );
|
|
||||||
if( wxRadioButton* woot = m_objects[idx].LabelObj )
|
if( wxRadioButton* woot = m_objects[idx].LabelObj )
|
||||||
woot->SetToolTip( wrapped );
|
woot->SetToolTip(tip);
|
||||||
|
|
||||||
if( pxStaticText* woot = m_objects[idx].SubTextObj )
|
if( pxStaticText* woot = m_objects[idx].SubTextObj )
|
||||||
woot->SetToolTip( wrapped );
|
woot->SetToolTip(tip);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The SetToolTip API provided by this function applies the tooltip to both the radio
|
// The SetToolTip API provided by this function applies the tooltip to both the radio
|
||||||
|
|
|
@ -569,32 +569,16 @@ const wxCursor& MoreStockCursors::GetArrowWait()
|
||||||
MoreStockCursors StockCursors;
|
MoreStockCursors StockCursors;
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
// pxFormatToolTipText / pxSetToolTip
|
// pxSetToolTip
|
||||||
// --------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------
|
||||||
// This is the preferred way to assign tooltips to wxWindow-based objects, as it performs the
|
// This is the preferred way to assign tooltips to wxWidgets-based objects. On Windows it
|
||||||
// necessary text wrapping on platforms that need it. On windows tooltips are wrapped at 600
|
// extends the tooltip time to the maximum possible. GTK seems to have indefinite
|
||||||
// pixels, or 66% of the screen width, whichever is smaller. GTK and MAC perform internal
|
// tooltips, I don't know about OS X.
|
||||||
// wrapping, so this function does a regular assignment there.
|
|
||||||
|
|
||||||
wxString pxFormatToolTipText( wxWindow* wind, const wxString& src )
|
|
||||||
{
|
|
||||||
// Windows needs manual tooltip word wrapping (sigh).
|
|
||||||
// GTK and Mac are a wee bit more clever (except in GTK tooltips don't show at all
|
|
||||||
// half the time because of some other bug .. sigh)
|
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
|
||||||
if( wind == NULL ) return src; // Silently ignore nulls
|
|
||||||
int whee = wxGetDisplaySize().GetWidth() * 0.75;
|
|
||||||
return pxTextWrapper().Wrap( *wind, src, std::min( whee, 600 ) ).GetResult();
|
|
||||||
#else
|
|
||||||
return src;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void pxSetToolTip( wxWindow* wind, const wxString& src )
|
void pxSetToolTip( wxWindow* wind, const wxString& src )
|
||||||
{
|
{
|
||||||
if( wind == NULL ) return; // Silently ignore nulls
|
if( wind == NULL ) return; // Silently ignore nulls
|
||||||
wind->SetToolTip( pxFormatToolTipText(wind, src) );
|
wind->SetToolTip(src);
|
||||||
|
|
||||||
// Make tooltips show for as long as possible on Windows. Linux (GTK) can
|
// Make tooltips show for as long as possible on Windows. Linux (GTK) can
|
||||||
// show tooltips indefinitely.
|
// show tooltips indefinitely.
|
||||||
|
|
Loading…
Reference in New Issue