Support tooltips in wxPropertyGrid if support for tooltips enabled is globally

This commit is contained in:
Artur Wieczorek
2019-06-14 22:43:47 +02:00
parent 8c187ffc7a
commit d404ff02a1
3 changed files with 8 additions and 31 deletions

View File

@@ -2276,7 +2276,6 @@ protected:
#undef wxPG_FL_MOUSE_CAPTURED #undef wxPG_FL_MOUSE_CAPTURED
#undef wxPG_FL_INITIALIZED #undef wxPG_FL_INITIALIZED
#undef wxPG_FL_ACTIVATION_BY_CLICK #undef wxPG_FL_ACTIVATION_BY_CLICK
#undef wxPG_SUPPORT_TOOLTIPS
#undef wxPG_ICON_WIDTH #undef wxPG_ICON_WIDTH
#undef wxPG_USE_RENDERER_NATIVE #undef wxPG_USE_RENDERER_NATIVE
// Following are needed by the manager headers // Following are needed by the manager headers

View File

@@ -52,9 +52,6 @@
// 1 if wxRendererNative should be employed // 1 if wxRendererNative should be employed
#define wxPG_USE_RENDERER_NATIVE 1 #define wxPG_USE_RENDERER_NATIVE 1
// Enable tooltips
#define wxPG_SUPPORT_TOOLTIPS 1
// width of optional bitmap/image in front of property // width of optional bitmap/image in front of property
#define wxPG_CUSTOM_IMAGE_WIDTH 20 #define wxPG_CUSTOM_IMAGE_WIDTH 20
@@ -84,9 +81,6 @@
// 1 if wxRendererNative should be employed // 1 if wxRendererNative should be employed
#define wxPG_USE_RENDERER_NATIVE 1 #define wxPG_USE_RENDERER_NATIVE 1
// Enable tooltips
#define wxPG_SUPPORT_TOOLTIPS 1
// width of optional bitmap/image in front of property // width of optional bitmap/image in front of property
#define wxPG_CUSTOM_IMAGE_WIDTH 20 #define wxPG_CUSTOM_IMAGE_WIDTH 20
@@ -116,9 +110,6 @@
// 1 if wxRendererNative should be employed // 1 if wxRendererNative should be employed
#define wxPG_USE_RENDERER_NATIVE 1 #define wxPG_USE_RENDERER_NATIVE 1
// Enable tooltips
#define wxPG_SUPPORT_TOOLTIPS 1
// width of optional bitmap/image in front of property // width of optional bitmap/image in front of property
#define wxPG_CUSTOM_IMAGE_WIDTH 20 #define wxPG_CUSTOM_IMAGE_WIDTH 20
@@ -148,9 +139,6 @@
// 1 if wxRendererNative should be employed // 1 if wxRendererNative should be employed
#define wxPG_USE_RENDERER_NATIVE 0 #define wxPG_USE_RENDERER_NATIVE 0
// Enable tooltips
#define wxPG_SUPPORT_TOOLTIPS 0
// width of optional bitmap/image in front of property // width of optional bitmap/image in front of property
#define wxPG_CUSTOM_IMAGE_WIDTH 20 #define wxPG_CUSTOM_IMAGE_WIDTH 20
@@ -197,12 +185,6 @@
#define wxPG_COMPATIBILITY_1_4 0 #define wxPG_COMPATIBILITY_1_4 0
#endif #endif
// Need to force disable tooltips?
#if !wxUSE_TOOLTIPS
#undef wxPG_SUPPORT_TOOLTIPS
#define wxPG_SUPPORT_TOOLTIPS 0
#endif
// Set 1 to include advanced properties (wxFontProperty, wxColourProperty, etc.) // Set 1 to include advanced properties (wxFontProperty, wxColourProperty, etc.)
#ifndef wxPG_INCLUDE_ADVPROPS #ifndef wxPG_INCLUDE_ADVPROPS
#define wxPG_INCLUDE_ADVPROPS 1 #define wxPG_INCLUDE_ADVPROPS 1

View File

@@ -649,26 +649,22 @@ void wxPropertyGrid::SetWindowStyleFlag( long style )
else else
m_pState->m_itemsAdded = true; m_pState->m_itemsAdded = true;
} }
#if wxPG_SUPPORT_TOOLTIPS #if wxUSE_TOOLTIPS
if ( !(old_style & wxPG_TOOLTIPS) && (style & wxPG_TOOLTIPS) ) if ( !(old_style & wxPG_TOOLTIPS) && (style & wxPG_TOOLTIPS) )
{ {
// //
// Tooltips enabled // Tooltips enabled
// //
/* //wxToolTip::SetDelay(wxPG_TOOLTIP_DELAY);
wxToolTip* tooltip = new wxToolTip ( wxEmptyString );
SetToolTip ( tooltip );
tooltip->SetDelay ( wxPG_TOOLTIP_DELAY );
*/
} }
else if ( (old_style & wxPG_TOOLTIPS) && !(style & wxPG_TOOLTIPS) ) else if ( (old_style & wxPG_TOOLTIPS) && !(style & wxPG_TOOLTIPS) )
{ {
// //
// Tooltips disabled // Tooltips disabled
// //
SetToolTip( NULL ); UnsetToolTip();
} }
#endif #endif // wxUSE_TOOLTIPS
} }
wxControl::SetWindowStyleFlag ( style ); wxControl::SetWindowStyleFlag ( style );
@@ -4317,7 +4313,7 @@ bool wxPropertyGrid::DoSelectProperty( wxPGProperty* p, unsigned int flags )
} }
else else
{ {
#if wxPG_SUPPORT_TOOLTIPS #if wxUSE_TOOLTIPS
// //
// Show help as a tool tip on the editor control. // Show help as a tool tip on the editor control.
// //
@@ -4991,7 +4987,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y,
int ih = m_lineHeight; int ih = m_lineHeight;
int sy = y; int sy = y;
#if wxPG_SUPPORT_TOOLTIPS #if wxUSE_TOOLTIPS
wxPGProperty* prevHover = m_propHover; wxPGProperty* prevHover = m_propHover;
unsigned char prevSide = m_mouseSide; unsigned char prevSide = m_mouseSide;
#endif #endif
@@ -5012,7 +5008,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y,
SendEvent( wxEVT_PG_HIGHLIGHTED, m_propHover ); SendEvent( wxEVT_PG_HIGHLIGHTED, m_propHover );
} }
#if wxPG_SUPPORT_TOOLTIPS #if wxUSE_TOOLTIPS
// Store which side we are on // Store which side we are on
m_mouseSide = 0; m_mouseSide = 0;
if ( columnHit == 1 ) if ( columnHit == 1 )
@@ -5080,7 +5076,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y,
} }
} }
} }
#endif #endif // wxUSE_TOOLTIPS
if ( splitterHit == -1 || if ( splitterHit == -1 ||
!m_propHover || !m_propHover ||