Move wxPropertyGrid internal stuff to the separate private header

This commit is contained in:
Artur Wieczorek 2023-03-10 22:35:47 +01:00 committed by AW
parent 623591823d
commit 3142e028b2
19 changed files with 225 additions and 215 deletions

View file

@ -4006,6 +4006,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \
wx/propgrid/propgridiface.h \
wx/propgrid/propgridpagestate.h \
wx/propgrid/props.h \
wx/propgrid/private.h \
wx/ribbon/art.h \
wx/ribbon/art_internal.h \
wx/ribbon/bar.h \

View file

@ -3054,6 +3054,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/propgrid/propgridiface.h
wx/propgrid/propgridpagestate.h
wx/propgrid/props.h
wx/propgrid/private.h
</set>
<!-- ====================================================================== -->

View file

@ -2839,6 +2839,7 @@ set(PROPGRID_HDR
wx/propgrid/propgridiface.h
wx/propgrid/propgridpagestate.h
wx/propgrid/props.h
wx/propgrid/private.h
)
set(RICHTEXT_SRC

View file

@ -2775,6 +2775,7 @@ PROPGRID_HDR =
wx/propgrid/propgridiface.h
wx/propgrid/propgridpagestate.h
wx/propgrid/props.h
wx/propgrid/private.h
# wxRichTextCtrl

View file

@ -503,6 +503,7 @@
<ClInclude Include="..\..\include\wx\propgrid\propgridiface.h" />
<ClInclude Include="..\..\include\wx\propgrid\propgridpagestate.h" />
<ClInclude Include="..\..\include\wx\propgrid\props.h" />
<ClInclude Include="..\..\include\wx\propgrid\private.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View file

@ -83,6 +83,9 @@
<ClInclude Include="..\..\include\wx\propgrid\props.h">
<Filter>Common Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\wx\propgrid\private.h">
<Filter>Common Headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\include\wx\msw\setup.h">

View file

@ -0,0 +1,194 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/propgrid/private.h
// Purpose: Private wxPropertyGrid declarations
// Author: Artur Wieczorek, Jaakko Salli
// Created: 2023-03-10
// Copyright: (c) 2023 wxWidgets development team
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PROPGRID_PRIVATE_H_
#define _WX_PROPGRID_PRIVATE_H_
#include "wx/defs.h"
// -----------------------------------------------------------------------
// space between vertical sides of a custom image
#define wxPG_CUSTOM_IMAGE_SPACINGY 1
// space between caption and selection rectangle,
#define wxPG_CAPRECTXMARGIN 2
// horizontally and vertically
#define wxPG_CAPRECTYMARGIN 1
// -----------------------------------------------------------------------
//
// Here are some platform dependent defines
// NOTE: More in propertygrid.cpp
//
// NB: Only define wxPG_TEXTCTRLXADJUST for platforms that do not
// (yet) support wxTextEntry::SetMargins() for the left margin.
#if defined(__WXMSW__)
// space between vertical line and value text
#define wxPG_XBEFORETEXT 4
// space between vertical line and value editor control
#define wxPG_XBEFOREWIDGET 1
// left margin can be set with wxTextEntry::SetMargins()
#undef wxPG_TEXTCTRLXADJUST
// comment to use bitmap buttons
#define wxPG_ICON_WIDTH 9
// 1 if wxRendererNative should be employed
#define wxPG_USE_RENDERER_NATIVE 1
// width of optional bitmap/image in front of property
#define wxPG_CUSTOM_IMAGE_WIDTH 20
// 1 if splitter drag detect margin and control cannot overlap
#define wxPG_NO_CHILD_EVT_MOTION 0
#define wxPG_NAT_BUTTON_BORDER_ANY 1
#define wxPG_NAT_BUTTON_BORDER_X 1
#define wxPG_NAT_BUTTON_BORDER_Y 1
// If 1 then controls are refreshed explicitly in a few places
#define wxPG_REFRESH_CONTROLS 0
#elif defined(__WXGTK__)
// space between vertical line and value text
#define wxPG_XBEFORETEXT 5
// space between vertical line and value editor control
#define wxPG_XBEFOREWIDGET 1
// x position adjustment for wxTextCtrl (and like)
// left margin can be set with wxTextEntry::SetMargins()
#undef wxPG_TEXTCTRLXADJUST
// comment to use bitmap buttons
#define wxPG_ICON_WIDTH 9
// 1 if wxRendererNative should be employed
#define wxPG_USE_RENDERER_NATIVE 1
// width of optional bitmap/image in front of property
#define wxPG_CUSTOM_IMAGE_WIDTH 20
// 1 if splitter drag detect margin and control cannot overlap
#define wxPG_NO_CHILD_EVT_MOTION 1
#define wxPG_NAT_BUTTON_BORDER_ANY 1
#define wxPG_NAT_BUTTON_BORDER_X 1
#define wxPG_NAT_BUTTON_BORDER_Y 1
// If 1 then controls are refreshed after selected was drawn.
#define wxPG_REFRESH_CONTROLS 1
#elif defined(__WXMAC__)
// space between vertical line and value text
#define wxPG_XBEFORETEXT 4
// space between vertical line and value editor widget
#define wxPG_XBEFOREWIDGET 1
// x position adjustment for wxTextCtrl (and like)
// left margin cannot be set with wxTextEntry::SetMargins()
#define wxPG_TEXTCTRLXADJUST 1
// comment to use bitmap buttons
#define wxPG_ICON_WIDTH 11
// 1 if wxRendererNative should be employed
#define wxPG_USE_RENDERER_NATIVE 1
// width of optional bitmap/image in front of property
#define wxPG_CUSTOM_IMAGE_WIDTH 20
// 1 if splitter drag detect margin and control cannot overlap
#define wxPG_NO_CHILD_EVT_MOTION 0
#define wxPG_NAT_BUTTON_BORDER_ANY 0
#define wxPG_NAT_BUTTON_BORDER_X 0
#define wxPG_NAT_BUTTON_BORDER_Y 0
// If 1 then controls are refreshed after selected was drawn.
#define wxPG_REFRESH_CONTROLS 0
#else // defaults
// space between vertical line and value text
#define wxPG_XBEFORETEXT 5
// space between vertical line and value editor widget
#define wxPG_XBEFOREWIDGET 1
// x position adjustment for wxTextCtrl (and like)
// left margin cannot be set with wxTextEntry::SetMargins()
#define wxPG_TEXTCTRLXADJUST 3
// comment to use bitmap buttons
#define wxPG_ICON_WIDTH 9
// 1 if wxRendererNative should be employed
#define wxPG_USE_RENDERER_NATIVE 0
// width of optional bitmap/image in front of property
#define wxPG_CUSTOM_IMAGE_WIDTH 20
// 1 if splitter drag detect margin and control cannot overlap
#define wxPG_NO_CHILD_EVT_MOTION 1
#define wxPG_NAT_BUTTON_BORDER_ANY 0
#define wxPG_NAT_BUTTON_BORDER_X 0
#define wxPG_NAT_BUTTON_BORDER_Y 0
// If 1 then controls are refreshed after selected was drawn.
#define wxPG_REFRESH_CONTROLS 0
#endif // platform
#define wxPG_CONTROL_MARGIN 0 // space between splitter and control
#define wxCC_CUSTOM_IMAGE_MARGIN1 4 // before image
#define wxCC_CUSTOM_IMAGE_MARGIN2 5 // after image
#define DEFAULT_IMAGE_OFFSET_INCREMENT \
(wxCC_CUSTOM_IMAGE_MARGIN1 + wxCC_CUSTOM_IMAGE_MARGIN2)
#define wxPG_DRAG_MARGIN 30
#if wxPG_NO_CHILD_EVT_MOTION
#define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
#define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
#else
#define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
#define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
#endif
// Use this macro to generate standard custom image height from
#define wxPG_STD_CUST_IMAGE_HEIGHT(LINEHEIGHT) ((LINEHEIGHT)-3)
// Undefine wxPG_ICON_WIDTH to use supplied xpm bitmaps instead
// (for tree buttons)
//#undef wxPG_ICON_WIDTH
// -----------------------------------------------------------------------
// Events used only internally
wxDECLARE_EVENT(wxEVT_PG_HSCROLL, wxPropertyGridEvent);
wxDECLARE_EVENT(wxEVT_PG_COLS_RESIZED, wxPropertyGridEvent);
// -----------------------------------------------------------------------
// Flags used only internally
// wxBoolProperty, wxFlagsProperty specific flags
constexpr wxPGPropertyFlags wxPG_PROP_USE_CHECKBOX = wxPG_PROP_CLASS_SPECIFIC_1;
// DCC = Double Click Cycles
constexpr wxPGPropertyFlags wxPG_PROP_USE_DCC = wxPG_PROP_CLASS_SPECIFIC_2;
// wxStringProperty flag
constexpr wxPGPropertyFlags wxPG_PROP_PASSWORD = wxPG_PROP_CLASS_SPECIFIC_2;
#endif // _WX_PROPGRID_PRIVATE_H_

View file

@ -48,16 +48,6 @@ struct wxPGPaintData
};
// space between vertical sides of a custom image
#define wxPG_CUSTOM_IMAGE_SPACINGY 1
// space between caption and selection rectangle,
#define wxPG_CAPRECTXMARGIN 2
// horizontally and vertically
#define wxPG_CAPRECTYMARGIN 1
// Base class for wxPropertyGrid cell renderers.
class WXDLLIMPEXP_PROPGRID wxPGCellRenderer : public wxObjectRefData
{

View file

@ -468,11 +468,6 @@ enum wxPG_KEYBOARD_ACTIONS
// -----------------------------------------------------------------------
#if !defined(__wxPG_SOURCE_FILE__)
// Reduce compile time, but still include in user app
#include "wx/propgrid/props.h"
#endif
// -----------------------------------------------------------------------
// wxPropertyGrid is a specialized grid for editing properties
@ -1393,10 +1388,6 @@ protected:
virtual wxSize DoGetBestSize() const override;
virtual void DoEnable(bool enable) override;
#ifndef wxPG_ICON_WIDTH
wxBitmap m_expandbmp, m_collbmp;
#endif
wxCursor m_cursorSizeWE;
// wxWindow pointers to editor control(s).
@ -1449,12 +1440,9 @@ protected:
// This is also calculated in the gutter
int m_iconWidth;
#ifndef wxPG_ICON_WIDTH
// The image height of the [+] icon.
// This is calculated as minimal size and to align
int m_iconHeight;
#endif
// Current cursor id.
int m_curcursor;
@ -1875,9 +1863,6 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
wxEVT_PG_COL_DRAGGING, wxPropertyGridEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
wxEVT_PG_COL_END_DRAG, wxPropertyGridEvent );
// Events used only internally
wxDECLARE_EVENT(wxEVT_PG_HSCROLL, wxPropertyGridEvent);
wxDECLARE_EVENT(wxEVT_PG_COLS_RESIZED, wxPropertyGridEvent);
#else
enum {

View file

@ -29,155 +29,6 @@ class WXDLLIMPEXP_FWD_CORE wxFont;
// -----------------------------------------------------------------------
//
// Here are some platform dependent defines
// NOTE: More in propertygrid.cpp
//
// NB: Only define wxPG_TEXTCTRLXADJUST for platforms that do not
// (yet) support wxTextEntry::SetMargins() for the left margin.
#if defined(__WXMSW__)
// space between vertical line and value text
#define wxPG_XBEFORETEXT 4
// space between vertical line and value editor control
#define wxPG_XBEFOREWIDGET 1
// left margin can be set with wxTextEntry::SetMargins()
#undef wxPG_TEXTCTRLXADJUST
// comment to use bitmap buttons
#define wxPG_ICON_WIDTH 9
// 1 if wxRendererNative should be employed
#define wxPG_USE_RENDERER_NATIVE 1
// width of optional bitmap/image in front of property
#define wxPG_CUSTOM_IMAGE_WIDTH 20
// 1 if splitter drag detect margin and control cannot overlap
#define wxPG_NO_CHILD_EVT_MOTION 0
#define wxPG_NAT_BUTTON_BORDER_ANY 1
#define wxPG_NAT_BUTTON_BORDER_X 1
#define wxPG_NAT_BUTTON_BORDER_Y 1
// If 1 then controls are refreshed explicitly in a few places
#define wxPG_REFRESH_CONTROLS 0
#elif defined(__WXGTK__)
// space between vertical line and value text
#define wxPG_XBEFORETEXT 5
// space between vertical line and value editor control
#define wxPG_XBEFOREWIDGET 1
// x position adjustment for wxTextCtrl (and like)
// left margin can be set with wxTextEntry::SetMargins()
#undef wxPG_TEXTCTRLXADJUST
// comment to use bitmap buttons
#define wxPG_ICON_WIDTH 9
// 1 if wxRendererNative should be employed
#define wxPG_USE_RENDERER_NATIVE 1
// width of optional bitmap/image in front of property
#define wxPG_CUSTOM_IMAGE_WIDTH 20
// 1 if splitter drag detect margin and control cannot overlap
#define wxPG_NO_CHILD_EVT_MOTION 1
#define wxPG_NAT_BUTTON_BORDER_ANY 1
#define wxPG_NAT_BUTTON_BORDER_X 1
#define wxPG_NAT_BUTTON_BORDER_Y 1
// If 1 then controls are refreshed after selected was drawn.
#define wxPG_REFRESH_CONTROLS 1
#elif defined(__WXMAC__)
// space between vertical line and value text
#define wxPG_XBEFORETEXT 4
// space between vertical line and value editor widget
#define wxPG_XBEFOREWIDGET 1
// x position adjustment for wxTextCtrl (and like)
// left margin cannot be set with wxTextEntry::SetMargins()
#define wxPG_TEXTCTRLXADJUST 1
// comment to use bitmap buttons
#define wxPG_ICON_WIDTH 11
// 1 if wxRendererNative should be employed
#define wxPG_USE_RENDERER_NATIVE 1
// width of optional bitmap/image in front of property
#define wxPG_CUSTOM_IMAGE_WIDTH 20
// 1 if splitter drag detect margin and control cannot overlap
#define wxPG_NO_CHILD_EVT_MOTION 0
#define wxPG_NAT_BUTTON_BORDER_ANY 0
#define wxPG_NAT_BUTTON_BORDER_X 0
#define wxPG_NAT_BUTTON_BORDER_Y 0
// If 1 then controls are refreshed after selected was drawn.
#define wxPG_REFRESH_CONTROLS 0
#else // defaults
// space between vertical line and value text
#define wxPG_XBEFORETEXT 5
// space between vertical line and value editor widget
#define wxPG_XBEFOREWIDGET 1
// x position adjustment for wxTextCtrl (and like)
// left margin cannot be set with wxTextEntry::SetMargins()
#define wxPG_TEXTCTRLXADJUST 3
// comment to use bitmap buttons
#define wxPG_ICON_WIDTH 9
// 1 if wxRendererNative should be employed
#define wxPG_USE_RENDERER_NATIVE 0
// width of optional bitmap/image in front of property
#define wxPG_CUSTOM_IMAGE_WIDTH 20
// 1 if splitter drag detect margin and control cannot overlap
#define wxPG_NO_CHILD_EVT_MOTION 1
#define wxPG_NAT_BUTTON_BORDER_ANY 0
#define wxPG_NAT_BUTTON_BORDER_X 0
#define wxPG_NAT_BUTTON_BORDER_Y 0
// If 1 then controls are refreshed after selected was drawn.
#define wxPG_REFRESH_CONTROLS 0
#endif // platform
#define wxPG_CONTROL_MARGIN 0 // space between splitter and control
#define wxCC_CUSTOM_IMAGE_MARGIN1 4 // before image
#define wxCC_CUSTOM_IMAGE_MARGIN2 5 // after image
#define DEFAULT_IMAGE_OFFSET_INCREMENT \
(wxCC_CUSTOM_IMAGE_MARGIN1 + wxCC_CUSTOM_IMAGE_MARGIN2)
#define wxPG_DRAG_MARGIN 30
#if wxPG_NO_CHILD_EVT_MOTION
#define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
#define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
#else
#define wxPG_SPLITTERX_DETECTMARGIN1 3 // this much on left
#define wxPG_SPLITTERX_DETECTMARGIN2 2 // this much on right
#endif
// Use this macro to generate standard custom image height from
#define wxPG_STD_CUST_IMAGE_HEIGHT(LINEHEIGHT) ((LINEHEIGHT)-3)
// Undefine wxPG_ICON_WIDTH to use supplied xpm bitmaps instead
// (for tree buttons)
//#undef wxPG_ICON_WIDTH
// Set 1 to include advanced properties (wxFontProperty, wxColourProperty, etc.)
#ifndef wxPG_INCLUDE_ADVPROPS
#define wxPG_INCLUDE_ADVPROPS 1

View file

@ -88,8 +88,6 @@ private:
// Property classes
// -----------------------------------------------------------------------
constexpr wxPGPropertyFlags wxPG_PROP_PASSWORD = wxPG_PROP_CLASS_SPECIFIC_2;
// Basic property with string value.
// If value "<composed>" is set, then actual value is formed (or composed)
// from values of child properties.
@ -682,14 +680,6 @@ protected:
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) override;
};
// -----------------------------------------------------------------------
// wxBoolProperty, wxFlagsProperty specific flags
constexpr wxPGPropertyFlags wxPG_PROP_USE_CHECKBOX = wxPG_PROP_CLASS_SPECIFIC_1;
// DCC = Double Click Cycles
constexpr wxPGPropertyFlags wxPG_PROP_USE_DCC = wxPG_PROP_CLASS_SPECIFIC_2;
// -----------------------------------------------------------------------
// Property that manages a list of strings.

View file

@ -21,8 +21,6 @@
#include "wx/wxcrtvararg.h"
#endif
#define __wxPG_SOURCE_FILE__
#include "wx/propgrid/propgrid.h"
#if wxPG_INCLUDE_ADVPROPS

View file

@ -22,12 +22,10 @@
#include "wx/dcbuffer.h"
#include "wx/odcombo.h"
// This define is necessary to prevent macro clearing
#define __wxPG_SOURCE_FILE__
#include "wx/propgrid/propgrid.h"
#include "wx/propgrid/editors.h"
#include "wx/propgrid/props.h"
#include "wx/propgrid/private.h"
#if wxPG_USE_RENDERER_NATIVE
#include "wx/renderer.h"

View file

@ -24,10 +24,8 @@
#include "wx/dcbuffer.h" // for wxALWAYS_NATIVE_DOUBLE_BUFFER
#include "wx/headerctrl.h" // for wxPGHeaderCtrl
// This define is necessary to prevent macro clearing
#define __wxPG_SOURCE_FILE__
#include "wx/propgrid/manager.h"
#include "wx/propgrid/private.h"
#define wxPG_MAN_ALTERNATE_BASE_ID 11249 // Needed for wxID_ANY madness

View file

@ -19,13 +19,11 @@
#include "wx/log.h"
#endif
// This define is necessary to prevent macro clearing
#define __wxPG_SOURCE_FILE__
#include "wx/propgrid/propgrid.h"
#include "wx/propgrid/property.h"
#include "wx/propgrid/props.h"
#include "wx/propgrid/editors.h"
#include "wx/propgrid/private.h"
#if wxPG_USE_RENDERER_NATIVE
#include "wx/renderer.h"

View file

@ -46,12 +46,9 @@
#include "wx/settings.h"
#endif
// This define is necessary to prevent macro clearing
#define __wxPG_SOURCE_FILE__
#include "wx/propgrid/propgrid.h"
#include "wx/propgrid/editors.h"
#include "wx/propgrid/private.h"
#if wxPG_USE_RENDERER_NATIVE
#include "wx/renderer.h"
@ -69,7 +66,7 @@
// recommended to use either custom or native rendering).
// If you want them, get wxTreeMultiCtrl by Jorgen Bodde,
// and copy xpm files from archive to wxPropertyGrid src directory
// (and also comment/undef wxPG_ICON_WIDTH in propGrid.h
// (and also comment/undef wxPG_ICON_WIDTH in private.h
// and set wxPG_USE_RENDERER_NATIVE to 0).
#ifndef wxPG_ICON_WIDTH
#if defined(__WXMAC__)
@ -93,10 +90,6 @@
#define wxPG_DEFAULT_CURSOR wxNullCursor
#define wxPG_PIXELS_PER_UNIT m_lineHeight
#ifdef wxPG_ICON_WIDTH
#define m_iconHeight m_iconWidth
#endif
//#define wxPG_TOOLTIP_DELAY 1000
// This is the number of pixels the expander button inside
@ -253,6 +246,15 @@ void wxPropertyGridInitGlobalsIfNeeded()
// wxPropertyGrid
// -----------------------------------------------------------------------
#ifndef wxPG_ICON_WIDTH
namespace
{
// create two bitmap nodes for drawing
static wxBitmap s_expandbmp(expand_xpm);
static wxBitmap s_collbmp(collapse_xpm);
}
#endif
wxIMPLEMENT_DYNAMIC_CLASS(wxPropertyGrid, wxControl);
wxBEGIN_EVENT_TABLE(wxPropertyGrid, wxControl)
@ -387,6 +389,7 @@ void wxPropertyGrid::Init1()
m_iconHeight = 11;
#else
m_iconWidth = wxPG_ICON_WIDTH;
m_iconHeight = wxPG_ICON_WIDTH;
#endif
m_gutterWidth = wxPG_GUTTER_MIN;
@ -444,14 +447,10 @@ void wxPropertyGrid::Init2()
GetClientSize(&m_width,&m_height);
#ifndef wxPG_ICON_WIDTH
// create two bitmap nodes for drawing
m_expandbmp = wxBitmap(expand_xpm);
m_collbmp = wxBitmap(collapse_xpm);
// calculate average font height for bitmap centering
m_iconWidth = m_expandbmp.GetWidth();
m_iconHeight = m_expandbmp.GetHeight();
m_iconWidth = s_expandbmp.GetWidth();
m_iconHeight = s_expandbmp.GetHeight();
#endif
m_curcursor = wxCURSOR_ARROW;
@ -1961,7 +1960,7 @@ void wxPropertyGrid::DrawExpanderButton( wxDC& dc, const wxRect& rect,
#elif wxPG_ICON_WIDTH
//
#else
bmp = m_collbmp;
bmp = s_collbmp;
#endif
}
@ -1978,7 +1977,7 @@ void wxPropertyGrid::DrawExpanderButton( wxDC& dc, const wxRect& rect,
int _x = r.x+(m_iconWidth/2);
dc.DrawLine(_x,r.y+2,_x,r.y+m_iconWidth-2);
#else
bmp = m_expandbmp;
bmp = s_expandbmp;
#endif
}

View file

@ -19,6 +19,7 @@
#include "wx/colour.h"
#include "wx/font.h"
#include "wx/log.h"
#include "wx/textctrl.h"
#include "wx/validate.h"
#endif

View file

@ -25,11 +25,9 @@
#include "wx/validate.h"
#endif
// This define is necessary to prevent macro clearing
#define __wxPG_SOURCE_FILE__
#include "wx/propgrid/propgridpagestate.h"
#include "wx/propgrid/propgrid.h"
#include "wx/propgrid/private.h"
#include <numeric>

View file

@ -26,6 +26,8 @@
#include "wx/propgrid/propgrid.h"
#include "wx/propgrid/editors.h"
#include "wx/propgrid/props.h"
#include "wx/propgrid/private.h"
#include <limits>