Fix building wxPropertyGrid with v3.0 compatibility enabled

Closes #23369.
This commit is contained in:
Artur Wieczorek 2023-03-22 17:05:32 +01:00
parent eaa326a93d
commit 35a8d0f908
4 changed files with 15 additions and 29 deletions

View file

@ -104,11 +104,13 @@ public:
wxDEPRECATED_MSG("Use DrawCaptionSelectionRect(wxWindow*, wxDC&, ...) instead")
virtual void DrawCaptionSelectionRect( wxDC& dc,
int x, int y,
int w, int h ) const;
#else
int w, int h ) const
{
DrawCaptionSelectionRect(nullptr, dc, x, y, w, h);
}
#endif // WXWIN_COMPATIBILITY_3_0
virtual void DrawCaptionSelectionRect(wxWindow *win, wxDC& dc,
int x, int y, int w, int h) const;
#endif // WXWIN_COMPATIBILITY_3_0
// Utility to draw vertically centered text.
void DrawText( wxDC& dc,
@ -523,6 +525,9 @@ constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPG_PROP_AUTO_UNSPECIFIED;
#define wxPG_FILE_INITIAL_PATH wxS("InitialPath")
#if WXWIN_COMPATIBILITY_3_0
#ifdef WXBUILDING
#define wxPG_FILE_DIALOG_TITLE wxS("DialogTitle")
#else
#ifdef wxPG_MUST_DEPRECATE_MACRO_NAME
#pragma deprecated(wxPG_FILE_DIALOG_TITLE)
#endif
@ -530,6 +535,7 @@ constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPG_PROP_AUTO_UNSPECIFIED;
// Sets a specific title for the dir dialog.
#define wxPG_FILE_DIALOG_TITLE wxPG_DEPRECATED_MACRO_VALUE(wxS("DialogTitle"),\
"wxPG_FILE_DIALOG_TITLE is deprecated. Use wxPG_DIALOG_TITLE instead.")
#endif // WXBUILDING/!WXBUILDING
#endif // WXWIN_COMPATIBILITY_3_0
// Specific to wxFileProperty and derivatives, long, default is 0.
@ -537,6 +543,9 @@ constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPG_PROP_AUTO_UNSPECIFIED;
#define wxPG_FILE_DIALOG_STYLE wxS("DialogStyle")
#if WXWIN_COMPATIBILITY_3_0
#ifdef WXBUILDING
#define wxPG_DIR_DIALOG_MESSAGE wxS("DialogMessage")
#else
#ifdef wxPG_MUST_DEPRECATE_MACRO_NAME
#pragma deprecated(wxPG_DIR_DIALOG_MESSAGE)
#endif
@ -544,6 +553,7 @@ constexpr wxPGPropertyFlags wxPG_PROP_MAX = wxPG_PROP_AUTO_UNSPECIFIED;
// Sets a specific message for the dir dialog.
#define wxPG_DIR_DIALOG_MESSAGE wxPG_DEPRECATED_MACRO_VALUE(wxS("DialogMessage"),\
"wxPG_DIR_DIALOG_MESSAGE is deprecated. Use wxPG_DIALOG_TITLE instead.")
#endif // WXBUILDING/!WXBUILDING
#endif // WXWIN_COMPATIBILITY_3_0
// wxArrayStringProperty's string delimiter character. If this is

View file

@ -832,19 +832,14 @@ public:
// id - Property name or pointer.
// flags - Default is wxPGPropertyValuesFlags::DontRecurse which causes colour to be reset
// only for the property in question (for backward compatibility).
#if WXWIN_COMPATIBILITY_3_0
void SetPropertyColoursToDefault(wxPGPropArg id);
void SetPropertyColoursToDefault(wxPGPropArg id, int flags);
#else
#if WXWIN_COMPATIBILITY_3_2
#if WXWIN_COMPATIBILITY_3_0 || WXWIN_COMPATIBILITY_3_2
wxDEPRECATED_MSG("use SetPropertyColoursToDefault with flags argument as wxPGPropertyValuesFlags")
void SetPropertyColoursToDefault(wxPGPropArg id, int flags)
{
SetPropertyColoursToDefault(id, static_cast<wxPGPropertyValuesFlags>(flags));
}
#endif // WXWIN_COMPATIBILITY_3_2
#endif // WXWIN_COMPATIBILITY_3_0 || WXWIN_COMPATIBILITY_3_2
void SetPropertyColoursToDefault(wxPGPropArg id, wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse);
#endif // WXWIN_COMPATIBILITY_3_0
// Sets text colour of a property.
// id - Property name or pointer.

View file

@ -98,19 +98,11 @@ void wxPGCellRenderer::DrawEditorValue( wxDC& dc, const wxRect& rect,
}
}
#if WXWIN_COMPATIBILITY_3_0
void wxPGCellRenderer::DrawCaptionSelectionRect(wxDC& dc,
int x, int y, int w, int h) const
{
wxPGDrawFocusRect(nullptr, dc, x, y, w, h);
}
#else
void wxPGCellRenderer::DrawCaptionSelectionRect(wxWindow* win, wxDC& dc,
int x, int y, int w, int h) const
{
wxPGDrawFocusRect(win, dc, x, y, w, h);
}
#endif // WXWIN_COMPATIBILITY_3_0/!WXWIN_COMPATIBILITY_3_0
int wxPGCellRenderer::PreDrawCell( wxDC& dc, const wxRect& rect, const wxPropertyGrid* propGrid, const wxPGCell& cell, int flags ) const
{
@ -305,11 +297,7 @@ bool wxPGDefaultRenderer::Render( wxDC& dc, const wxRect& rect,
imageOffset += wxCC_CUSTOM_IMAGE_MARGIN2 + 4;
}
#if WXWIN_COMPATIBILITY_3_0
DrawCaptionSelectionRect( dc,
#else
DrawCaptionSelectionRect( const_cast<wxPropertyGrid*>(propertyGrid), dc,
#endif // WXWIN_COMPATIBILITY_3_0
rect.x+wxPG_XBEFORETEXT-wxPG_CAPRECTXMARGIN+imageOffset,
rect.y-wxPG_CAPRECTYMARGIN+1,
((wxPropertyCategory*)property)->GetTextExtent(propertyGrid,

View file

@ -698,13 +698,6 @@ void wxPropertyGridInterface::SetPropertyTextColour(wxPGPropArg id, const wxColo
// -----------------------------------------------------------------------
#if WXWIN_COMPATIBILITY_3_0
void wxPropertyGridInterface::SetPropertyColoursToDefault(wxPGPropArg id)
{
SetPropertyColoursToDefault(id, wxPGPropertyValuesFlags::DontRecurse);
}
#endif // WXWIN_COMPATIBILITY_3_0
void wxPropertyGridInterface::SetPropertyColoursToDefault(wxPGPropArg id, wxPGPropertyValuesFlags flags)
{
wxPG_PROP_ARG_CALL_PROLOG()