Merge branch 'propgrid-xrc'

Add support for loading wxPropertyGrid from XRC.

See #24274.
This commit is contained in:
Vadim Zeitlin 2024-02-09 17:20:22 +01:00
commit 33ef342dcc
33 changed files with 1122 additions and 244 deletions

View file

@ -2102,7 +2102,8 @@ PROPGRIDDLL_OBJECTS = \
propgriddll_propgrid.o \
propgriddll_propgridiface.o \
propgriddll_propgridpagestate.o \
propgriddll_props.o
propgriddll_props.o \
propgriddll_xh_propgrid.o
PROPGRIDDLL_ODEP = $(_____pch_wxprec_propgriddll_wx_wxprec_h_gch___depname)
PROPGRIDLIB_CXXFLAGS = $(__propgridlib_PCH_INC) $(__INC_TIFF_BUILD_p) \
$(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \
@ -2118,7 +2119,8 @@ PROPGRIDLIB_OBJECTS = \
propgridlib_propgrid.o \
propgridlib_propgridiface.o \
propgridlib_propgridpagestate.o \
propgridlib_props.o
propgridlib_props.o \
propgridlib_xh_propgrid.o
PROPGRIDLIB_ODEP = $(_____pch_wxprec_propgridlib_wx_wxprec_h_gch___depname)
RICHTEXTDLL_CXXFLAGS = $(__richtextdll_PCH_INC) $(__INC_TIFF_BUILD_p) \
$(__INC_TIFF_p) $(__INC_JPEG_p) $(__INC_PNG_p) $(__INC_ZLIB_p) \
@ -4020,6 +4022,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \
wx/propgrid/propgridpagestate.h \
wx/propgrid/props.h \
wx/propgrid/private.h \
wx/xrc/xh_propgrid.h \
wx/ribbon/art.h \
wx/ribbon/art_internal.h \
wx/ribbon/bar.h \
@ -4339,6 +4342,7 @@ COND_USE_GUI_1___MONOLIB_GUI_SRC_OBJECTS = \
monodll_propgridiface.o \
monodll_propgridpagestate.o \
monodll_props.o \
monodll_xh_propgrid.o \
monodll_art_internal.o \
monodll_art_msw.o \
monodll_art_aui.o \
@ -6106,6 +6110,7 @@ COND_USE_GUI_1___MONOLIB_GUI_SRC_OBJECTS_1 = \
monolib_propgridiface.o \
monolib_propgridpagestate.o \
monolib_props.o \
monolib_xh_propgrid.o \
monolib_art_internal.o \
monolib_art_msw.o \
monolib_art_aui.o \
@ -16366,6 +16371,9 @@ monodll_propgridpagestate.o: $(srcdir)/src/propgrid/propgridpagestate.cpp $(MONO
monodll_props.o: $(srcdir)/src/propgrid/props.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/propgrid/props.cpp
monodll_xh_propgrid.o: $(srcdir)/src/xrc/xh_propgrid.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/xrc/xh_propgrid.cpp
monodll_art_internal.o: $(srcdir)/src/ribbon/art_internal.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/ribbon/art_internal.cpp
@ -21124,6 +21132,9 @@ monolib_propgridpagestate.o: $(srcdir)/src/propgrid/propgridpagestate.cpp $(MONO
monolib_props.o: $(srcdir)/src/propgrid/props.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/propgrid/props.cpp
monolib_xh_propgrid.o: $(srcdir)/src/xrc/xh_propgrid.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/xrc/xh_propgrid.cpp
monolib_art_internal.o: $(srcdir)/src/ribbon/art_internal.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/ribbon/art_internal.cpp
@ -33736,6 +33747,9 @@ propgriddll_propgridpagestate.o: $(srcdir)/src/propgrid/propgridpagestate.cpp $(
propgriddll_props.o: $(srcdir)/src/propgrid/props.cpp $(PROPGRIDDLL_ODEP)
$(CXXC) -c -o $@ $(PROPGRIDDLL_CXXFLAGS) $(srcdir)/src/propgrid/props.cpp
propgriddll_xh_propgrid.o: $(srcdir)/src/xrc/xh_propgrid.cpp $(PROPGRIDDLL_ODEP)
$(CXXC) -c -o $@ $(PROPGRIDDLL_CXXFLAGS) $(srcdir)/src/xrc/xh_propgrid.cpp
propgridlib_advprops.o: $(srcdir)/src/propgrid/advprops.cpp $(PROPGRIDLIB_ODEP)
$(CXXC) -c -o $@ $(PROPGRIDLIB_CXXFLAGS) $(srcdir)/src/propgrid/advprops.cpp
@ -33760,6 +33774,9 @@ propgridlib_propgridpagestate.o: $(srcdir)/src/propgrid/propgridpagestate.cpp $(
propgridlib_props.o: $(srcdir)/src/propgrid/props.cpp $(PROPGRIDLIB_ODEP)
$(CXXC) -c -o $@ $(PROPGRIDLIB_CXXFLAGS) $(srcdir)/src/propgrid/props.cpp
propgridlib_xh_propgrid.o: $(srcdir)/src/xrc/xh_propgrid.cpp $(PROPGRIDLIB_ODEP)
$(CXXC) -c -o $@ $(PROPGRIDLIB_CXXFLAGS) $(srcdir)/src/xrc/xh_propgrid.cpp
richtextdll_version_rc.o: $(srcdir)/src/msw/version.rc $(RICHTEXTDLL_ODEP)
$(WINDRES) -i$< -o$@ $(__INC_TIFF_BUILD_p_54) $(__INC_TIFF_p_54) $(__INC_JPEG_p_54) $(__INC_PNG_p_53) $(__INC_ZLIB_p_67) $(__INC_REGEX_p_65) $(__INC_EXPAT_p_65) --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_67) $(__DEBUG_DEFINE_p_67) $(__EXCEPTIONS_DEFINE_p_65) $(__RTTI_DEFINE_p_65) $(__THREAD_DEFINE_p_65) --define WXBUILDING --define WXDLLNAME=$(WXDLLNAMEPREFIXGUI)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_richtext$(WXCOMPILER)$(VENDORTAG)$(WXDLLVERSIONTAG) $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include --define WXUSINGDLL --define WXMAKINGDLL_RICHTEXT

View file

@ -3055,6 +3055,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/propgrid/propgridiface.cpp
src/propgrid/propgridpagestate.cpp
src/propgrid/props.cpp
src/xrc/xh_propgrid.cpp
</set>
<set var="PROPGRID_HDR" hints="files">
wx/propgrid/advprops.h
@ -3067,6 +3068,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/propgrid/propgridpagestate.h
wx/propgrid/props.h
wx/propgrid/private.h
wx/xrc/xh_propgrid.h
</set>
<!-- ====================================================================== -->

View file

@ -2848,6 +2848,7 @@ set(PROPGRID_SRC
src/propgrid/propgridiface.cpp
src/propgrid/propgridpagestate.cpp
src/propgrid/props.cpp
src/xrc/xh_propgrid.cpp
)
set(PROPGRID_HDR
@ -2861,6 +2862,7 @@ set(PROPGRID_HDR
wx/propgrid/propgridpagestate.h
wx/propgrid/props.h
wx/propgrid/private.h
wx/xrc/xh_propgrid.h
)
set(RICHTEXT_SRC

View file

@ -115,7 +115,7 @@ wx_add_sample(power)
wx_add_sample(preferences DEPENDS wxUSE_PREFERENCES_EDITOR)
wx_add_sample(printing printing.cpp printing.h DEPENDS wxUSE_PRINTING_ARCHITECTURE)
wx_add_sample(propgrid propgrid.cpp propgrid_minimal.cpp sampleprops.cpp
sampleprops.h propgrid.h LIBRARIES wxpropgrid NAME propgriddemo DEPENDS wxUSE_PROPGRID)
sampleprops.h propgrid.h LIBRARIES wxpropgrid wxxrc NAME propgriddemo DEPENDS wxUSE_PROPGRID)
wx_add_sample(render FOLDER render)
wx_add_sample(render DLL renddll.cpp NAME renddll FOLDER render)
wx_add_sample(ribbon ribbondemo.cpp LIBRARIES wxribbon NAME ribbondemo DEPENDS wxUSE_RIBBON)

View file

@ -2775,6 +2775,7 @@ PROPGRID_SRC =
src/propgrid/propgridiface.cpp
src/propgrid/propgridpagestate.cpp
src/propgrid/props.cpp
src/xrc/xh_propgrid.cpp
PROPGRID_HDR =
wx/propgrid/advprops.h
wx/propgrid/editors.h
@ -2786,6 +2787,7 @@ PROPGRID_HDR =
wx/propgrid/propgridpagestate.h
wx/propgrid/props.h
wx/propgrid/private.h
wx/xrc/xh_propgrid.h
# wxRichTextCtrl

View file

@ -1534,7 +1534,8 @@ PROPGRIDDLL_OBJECTS = \
$(OBJS)\propgriddll_propgrid.o \
$(OBJS)\propgriddll_propgridiface.o \
$(OBJS)\propgriddll_propgridpagestate.o \
$(OBJS)\propgriddll_props.o
$(OBJS)\propgriddll_props.o \
$(OBJS)\propgriddll_xh_propgrid.o
PROPGRIDLIB_CXXFLAGS = -I..\..\src\tiff\libtiff -I..\..\src\jpeg \
-I..\..\src\png -I..\..\src\zlib -I..\..\3rdparty\pcre\src\wx \
-I..\..\src\expat\expat\lib $(__DEBUGINFO) $(__OPTIMIZEFLAG) \
@ -1552,7 +1553,8 @@ PROPGRIDLIB_OBJECTS = \
$(OBJS)\propgridlib_propgrid.o \
$(OBJS)\propgridlib_propgridiface.o \
$(OBJS)\propgridlib_propgridpagestate.o \
$(OBJS)\propgridlib_props.o
$(OBJS)\propgridlib_props.o \
$(OBJS)\propgridlib_xh_propgrid.o
RICHTEXTDLL_CXXFLAGS = -I..\..\src\tiff\libtiff -I..\..\src\jpeg \
-I..\..\src\png -I..\..\src\zlib -I..\..\3rdparty\pcre\src\wx \
-I..\..\src\expat\expat\lib $(__DEBUGINFO) $(__OPTIMIZEFLAG) \
@ -1850,6 +1852,7 @@ ____MONOLIB_GUI_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_propgridiface.o \
$(OBJS)\monodll_propgridpagestate.o \
$(OBJS)\monodll_props.o \
$(OBJS)\monodll_xh_propgrid.o \
$(OBJS)\monodll_art_internal.o \
$(OBJS)\monodll_art_msw.o \
$(OBJS)\monodll_art_aui.o \
@ -2706,6 +2709,7 @@ ____MONOLIB_GUI_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_propgridiface.o \
$(OBJS)\monolib_propgridpagestate.o \
$(OBJS)\monolib_props.o \
$(OBJS)\monolib_xh_propgrid.o \
$(OBJS)\monolib_art_internal.o \
$(OBJS)\monolib_art_msw.o \
$(OBJS)\monolib_art_aui.o \
@ -8096,6 +8100,9 @@ $(OBJS)\monodll_propgridpagestate.o: ../../src/propgrid/propgridpagestate.cpp
$(OBJS)\monodll_props.o: ../../src/propgrid/props.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_xh_propgrid.o: ../../src/xrc/xh_propgrid.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_art_internal.o: ../../src/ribbon/art_internal.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@ -10693,6 +10700,9 @@ $(OBJS)\monolib_propgridpagestate.o: ../../src/propgrid/propgridpagestate.cpp
$(OBJS)\monolib_props.o: ../../src/propgrid/props.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monolib_xh_propgrid.o: ../../src/xrc/xh_propgrid.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monolib_art_internal.o: ../../src/ribbon/art_internal.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@ -17395,6 +17405,9 @@ $(OBJS)\propgriddll_propgridpagestate.o: ../../src/propgrid/propgridpagestate.cp
$(OBJS)\propgriddll_props.o: ../../src/propgrid/props.cpp
$(CXX) -c -o $@ $(PROPGRIDDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\propgriddll_xh_propgrid.o: ../../src/xrc/xh_propgrid.cpp
$(CXX) -c -o $@ $(PROPGRIDDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\propgridlib_dummy.o: ../../src/common/dummy.cpp
$(CXX) -c -o $@ $(PROPGRIDLIB_CXXFLAGS) $(CPPDEPS) $<
@ -17422,6 +17435,9 @@ $(OBJS)\propgridlib_propgridpagestate.o: ../../src/propgrid/propgridpagestate.cp
$(OBJS)\propgridlib_props.o: ../../src/propgrid/props.cpp
$(CXX) -c -o $@ $(PROPGRIDLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\propgridlib_xh_propgrid.o: ../../src/xrc/xh_propgrid.cpp
$(CXX) -c -o $@ $(PROPGRIDLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\richtextdll_dummy.o: ../../src/common/dummy.cpp
$(CXX) -c -o $@ $(RICHTEXTDLL_CXXFLAGS) $(CPPDEPS) $<

View file

@ -1707,7 +1707,8 @@ PROPGRIDDLL_OBJECTS = \
$(OBJS)\propgriddll_propgrid.obj \
$(OBJS)\propgriddll_propgridiface.obj \
$(OBJS)\propgriddll_propgridpagestate.obj \
$(OBJS)\propgriddll_props.obj
$(OBJS)\propgriddll_props.obj \
$(OBJS)\propgriddll_xh_propgrid.obj
PROPGRIDDLL_RESOURCES = \
$(OBJS)\propgriddll_version.res
PROPGRIDLIB_CXXFLAGS = /M$(__RUNTIME_LIBS_549)$(__DEBUGRUNTIME) /DWIN32 \
@ -1731,7 +1732,8 @@ PROPGRIDLIB_OBJECTS = \
$(OBJS)\propgridlib_propgrid.obj \
$(OBJS)\propgridlib_propgridiface.obj \
$(OBJS)\propgridlib_propgridpagestate.obj \
$(OBJS)\propgridlib_props.obj
$(OBJS)\propgridlib_props.obj \
$(OBJS)\propgridlib_xh_propgrid.obj
RICHTEXTDLL_CXXFLAGS = /M$(__RUNTIME_LIBS_565)$(__DEBUGRUNTIME) /DWIN32 \
/I..\..\src\tiff\libtiff /I..\..\src\jpeg /I..\..\src\png /I..\..\src\zlib \
/I..\..\3rdparty\pcre\src\wx /I..\..\src\expat\expat\lib $(__DEBUGINFO) \
@ -2196,6 +2198,7 @@ ____MONOLIB_GUI_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_propgridiface.obj \
$(OBJS)\monodll_propgridpagestate.obj \
$(OBJS)\monodll_props.obj \
$(OBJS)\monodll_xh_propgrid.obj \
$(OBJS)\monodll_art_internal.obj \
$(OBJS)\monodll_art_msw.obj \
$(OBJS)\monodll_art_aui.obj \
@ -3052,6 +3055,7 @@ ____MONOLIB_GUI_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_propgridiface.obj \
$(OBJS)\monolib_propgridpagestate.obj \
$(OBJS)\monolib_props.obj \
$(OBJS)\monolib_xh_propgrid.obj \
$(OBJS)\monolib_art_internal.obj \
$(OBJS)\monolib_art_msw.obj \
$(OBJS)\monolib_art_aui.obj \
@ -8565,6 +8569,9 @@ $(OBJS)\monodll_propgridpagestate.obj: ..\..\src\propgrid\propgridpagestate.cpp
$(OBJS)\monodll_props.obj: ..\..\src\propgrid\props.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\propgrid\props.cpp
$(OBJS)\monodll_xh_propgrid.obj: ..\..\src\xrc\xh_propgrid.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\xrc\xh_propgrid.cpp
$(OBJS)\monodll_art_internal.obj: ..\..\src\ribbon\art_internal.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\ribbon\art_internal.cpp
@ -11162,6 +11169,9 @@ $(OBJS)\monolib_propgridpagestate.obj: ..\..\src\propgrid\propgridpagestate.cpp
$(OBJS)\monolib_props.obj: ..\..\src\propgrid\props.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\propgrid\props.cpp
$(OBJS)\monolib_xh_propgrid.obj: ..\..\src\xrc\xh_propgrid.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\xrc\xh_propgrid.cpp
$(OBJS)\monolib_art_internal.obj: ..\..\src\ribbon\art_internal.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\ribbon\art_internal.cpp
@ -17864,6 +17874,9 @@ $(OBJS)\propgriddll_propgridpagestate.obj: ..\..\src\propgrid\propgridpagestate.
$(OBJS)\propgriddll_props.obj: ..\..\src\propgrid\props.cpp
$(CXX) /c /nologo /TP /Fo$@ $(PROPGRIDDLL_CXXFLAGS) ..\..\src\propgrid\props.cpp
$(OBJS)\propgriddll_xh_propgrid.obj: ..\..\src\xrc\xh_propgrid.cpp
$(CXX) /c /nologo /TP /Fo$@ $(PROPGRIDDLL_CXXFLAGS) ..\..\src\xrc\xh_propgrid.cpp
$(OBJS)\propgridlib_dummy.obj: ..\..\src\common\dummy.cpp
$(CXX) /c /nologo /TP /Fo$@ $(PROPGRIDLIB_CXXFLAGS) /Ycwx/wxprec.h ..\..\src\common\dummy.cpp
@ -17891,6 +17904,9 @@ $(OBJS)\propgridlib_propgridpagestate.obj: ..\..\src\propgrid\propgridpagestate.
$(OBJS)\propgridlib_props.obj: ..\..\src\propgrid\props.cpp
$(CXX) /c /nologo /TP /Fo$@ $(PROPGRIDLIB_CXXFLAGS) ..\..\src\propgrid\props.cpp
$(OBJS)\propgridlib_xh_propgrid.obj: ..\..\src\xrc\xh_propgrid.cpp
$(CXX) /c /nologo /TP /Fo$@ $(PROPGRIDLIB_CXXFLAGS) ..\..\src\xrc\xh_propgrid.cpp
$(OBJS)\richtextdll_dummy.obj: ..\..\src\common\dummy.cpp
$(CXX) /c /nologo /TP /Fo$@ $(RICHTEXTDLL_CXXFLAGS) /Ycwx/wxprec.h ..\..\src\common\dummy.cpp

View file

@ -464,6 +464,7 @@
<ClCompile Include="..\..\src\propgrid\propgridiface.cpp" />
<ClCompile Include="..\..\src\propgrid\propgridpagestate.cpp" />
<ClCompile Include="..\..\src\propgrid\props.cpp" />
<ClCompile Include="..\..\src\xrc\xh_propgrid.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\src\msw\version.rc">
@ -504,6 +505,7 @@
<ClInclude Include="..\..\include\wx\propgrid\propgridpagestate.h" />
<ClInclude Include="..\..\include\wx\propgrid\props.h" />
<ClInclude Include="..\..\include\wx\propgrid\private.h" />
<ClInclude Include="..\..\include\wx\xrc\xh_propgrid.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View file

@ -49,6 +49,9 @@
<ClCompile Include="..\..\src\propgrid\props.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\src\xrc\xh_propgrid.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\..\src\msw\version.rc">
@ -65,6 +68,9 @@
<ClInclude Include="..\..\include\wx\propgrid\manager.h">
<Filter>Common Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\wx\propgrid\private.h">
<Filter>Common Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\wx\propgrid\property.h">
<Filter>Common Headers</Filter>
</ClInclude>
@ -83,7 +89,7 @@
<ClInclude Include="..\..\include\wx\propgrid\props.h">
<Filter>Common Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\wx\propgrid\private.h">
<ClInclude Include="..\..\include\wx\xrc\xh_propgrid.h">
<Filter>Common Headers</Filter>
</ClInclude>
</ItemGroup>

View file

@ -578,9 +578,8 @@ in an arbitrary list of wxVariants.
@subsection propgrid_fromfile Loading Population from a Text-based Storage
Class wxPropertyGridPopulator may be helpful when writing code that
loads properties from a text-source. In fact, the wxPropertyGrid xrc-handler
(which may not be currently included in wxWidgets, but probably will be in
near future) uses it.
loads properties from a text-source. It is used by wxPropertyGrid XRC handler,
for example.
@subsection editablestate Saving and Restoring User-Editable State

View file

@ -298,6 +298,13 @@ DPI-dependent scaling, i.e. the format is just
and @c x and @c y are just integers which are not interpreted in any way.
@subsection overview_xrcformat_type_percent Integer or percent
This is a value which can be either a simple (unsigned) integer or a percent,
specified as `N%`, with a literal percent sign, of some other implicitly
specified length.
@subsection overview_xrcformat_type_text Text
String properties use several escape sequences that are translated according to
@ -1737,6 +1744,139 @@ wxPanel may have optional children: either exactly one
objects.
@subsubsection xrc_wxpropertygrid wxPropertyGrid
@beginTable
@hdr3col{property, type, description}
@row3col{virtualwidth, @ref overview_xrcformat_type_dimension,
Optional width passed to wxPropertyGrid::SetVirtualWidth().}
@endTable
A wxPropertyGrid may have @ref xrc_wxpropertygridproperty child objects.
Example:
@code
<object class="wxPropertyGrid">
<property class="wxStringProperty">
<label>Name</label>
<value>Now And Then</value>
</property>
<property class="wxIntProperty">
<label>Year</label>
<value>2023</value>
</property>
</object>
@endcode
Notice that wxPropertyGrid support in XRC is available in wxWidgets 3.3.0 and
later only and you need to explicitly register its handler using
@code
#include <wx/xrc/xh_propgrid.h>
AddHandler(new wxPropertyGridXmlHandler);
@endcode
to use it.
@subsubsection xrc_wxpropertygridmanager wxPropertyGridManager
@beginTable
@hdr3col{property, type, description}
@row3col{virtualwidth, @ref overview_xrcformat_type_dimension,
Optional width passed to wxPropertyGrid::SetVirtualWidth().}
@endTable
A wxPropertyGridManager contains one or more `page` elements each of which in
turn contains one of more @ref xrc_wxpropertygridproperty child objects.
Page elements may also have the following attributes:
@beginTable
@hdr3col{property, type, description}
@row3col{label, @ref overview_xrcformat_type_text,
Label used for the page.}
@row3col{columns, integer,
Optional column count passed to wxPropertyGridPageState::SetColumnCount().}
@row3col{splitterpos, @ref overview_xrcformat_type_percent,
Optional splitter position passed to wxPropertyGridPageState::DoSetSplitter().
The `pos` argument of this function may be specified as `index` attribute
of this element and defaults to 0 if not given.}
@row3col{choices, strings,
Space-separated list of double-quoted strings which can be used as choices
in a wxEnumProperty of this wxPropertyGridManager object by using the
`id` attribute of this element there.}
@endTable
Example:
@code
<object class="wxPropertyGridManager">
<page>
<property class="wxStringProperty">
<label>Name</label>
<value>Now And Then</value>
</property>
<property class="wxIntProperty">
<label>Year</label>
<value>2023</value>
</property>
</page>
<page>
<label>Reviews</label>
<choices id="stars">"1" "2" "3" "4" "5"</choices>
<property class="wxIntProperty">
<label>Metacritic</label>
<value>87</value>
</property>
<property class="wxEnumProperty">
<label>The Guardian</label>
<value>4</value>
<choices>@stars</choices>
</property>
</page>
</object>
@endcode
Notice that wxPropertyGrid support in XRC is available in wxWidgets 3.3.0 and
later only and you need to explicitly register its handler using
@code
#include <wx/xrc/xh_propgrid.h>
AddHandler(new wxPropertyGridXmlHandler);
@endcode
to use it.
@subsubsection xrc_wxpropertygridproperty wxPropertyGridProperty
@beginTable
@hdr3col{property, type, description}
@row3col{label, @ref overview_xrcformat_type_text,
Property label appearing in the property grid.}
@row3col{value, @ref overview_xrcformat_type_string,
Initial property value.}
@row3col{flags, @ref overview_xrcformat_type_style,
Combination of wxPGPropertyFlags values without the leading `wxPG_PROP_`
prefix. Only "COLLAPSED", "DISABLED", "HIDDEN" and "NOEDITOR" are currently
allowed. (default: 0).}
@row3col{tip, @ref overview_xrcformat_type_text,
Optional help string.}
@row3col{expanded, @ref overview_xrcformat_type_bool,
For a property with children, may be used to specify whether it should be
expanded by default.}
@row3col{choices, @ref overview_xrcformat_type_string,
Space-separated string containing the possible choices for the properties
using them, e.g. wxFlagsProperty or wxEnumProperty.}
@row3col{attribute, @ref overview_xrcformat_type_string,
Value for the property attribute with the name specified by the `name`
attribute of this element. Additional `recurse` attribute is supported and,
if specified with the value of `1`, results in the attribute being set for
this property and all its children recursively.}
@endTable
These elements define individual rows of @ref xrc_wxpropertygrid or @ref
xrc_wxpropertygridmanager. Notice that they may be nested: a property with the
class "wxPropertyCategory" will normally contain other properties inside it.
@subsubsection xrc_wxpropertysheetdialog wxPropertySheetDialog
@beginTable

View file

@ -526,7 +526,7 @@ constexpr wxPGKeyboardAction wxPG_ACTION_PRESS_BUTTON { wxPGKeyboardAction::Pres
// clicked on with right mouse button.
// EVT_PG_DOUBLE_CLICK(id, func)
// Respond to wxEVT_PG_DOUBLE_CLICK event, which occurs when property is
// double-clicked onwith left mouse button.
// double-clicked on with left mouse button.
// EVT_PG_ITEM_COLLAPSED(id, func)
// Respond to wxEVT_PG_ITEM_COLLAPSED event, generated when user collapses
// a property or category..
@ -603,7 +603,7 @@ public:
#endif // WXWIN_COMPATIBILITY_3_2
void AddActionTrigger(wxPGKeyboardAction action, int keycode, int modifiers = 0);
// Dedicates a specific keycode to wxPropertyGrid. This means that such
// Dedicates a specific key code to wxPropertyGrid. This means that such
// key presses will not be redirected to editor controls.
// Using this function allows, for example, navigation between
// properties using arrow keys even when the focus is in the editor
@ -659,7 +659,7 @@ public:
// Two step creation.
// Whenever the control is created without any parameters, use Create to
// actually create it. Don't access the control's public methods before
// this is called @see @link wndflags Additional Window Styles@endlink
// this is called.
bool Create( wxWindow *parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
@ -2002,11 +2002,11 @@ public:
return *m_validationInfo;
}
// Returns true if you can veto the action that the event is signaling.
// Returns true if you can veto the action that the event is signalling.
bool CanVeto() const { return m_canVeto; }
// Call this from your event handler to veto action that the event is
// signaling.
// signalling.
// You can only veto a shutdown if wxPropertyGridEvent::CanVeto returns
// true.
// Currently only wxEVT_PG_CHANGING supports vetoing.
@ -2157,7 +2157,8 @@ public:
// Empty string mean autodetect.
bool AddAttribute( const wxString& name,
const wxString& type,
const wxString& value );
const wxString& value,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse );
// Called once in AddChildren.
virtual void DoScanForChildren() = 0;
@ -2197,6 +2198,9 @@ protected:
// Tree-hierarchy of added properties (that can have children).
std::vector<wxPGProperty*> m_propHierarchy;
// Recursively set attributes.
std::unordered_map<wxString, wxVariant> m_inheritedAttributes;
// Hashmap for string-id to wxPGChoicesData mapping.
std::unordered_map<wxString, wxPGChoicesData*> m_dictIdChoices;
};

View file

@ -467,6 +467,7 @@ class WXDLLIMPEXP_PROPGRID wxPropertyGridPageState
friend class wxPGProperty;
friend class wxFlagsProperty;
friend class wxPropertyGridIteratorBase;
friend class wxPropertyGridXmlHandler;
public:
// Default constructor.

View file

@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_propgrid.h
// Purpose: XML resource handler for wxPropertyGrid
// Author: Jaakko Salli
// Modified by:
// Created: May-16-2007
// RCS-ID: $Id:
// Copyright: (c) Jaakko Salli
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_XRC_XH_PROPGRID_H_
#define _WX_XRC_XH_PROPGRID_H_
/*
NOTE: relevant source file, xh_propgrid.cpp is *not* included in the
wxPropertyGrid library (to prevent xrc-lib dependency). To use this
code, you will need to separately add src/xh_propgrid.cpp to your
application.
*/
#include "wx/xrc/xmlres.h"
#if wxUSE_XRC && wxUSE_PROPGRID
class WXDLLIMPEXP_FWD_PROPGRID wxPropertyGrid;
class WXDLLIMPEXP_FWD_PROPGRID wxPropertyGridManager;
class WXDLLIMPEXP_FWD_PROPGRID wxPropertyGridPageState;
class WXDLLIMPEXP_FWD_PROPGRID wxPropertyGridPopulator;
class WXDLLIMPEXP_PROPGRID wxPropertyGridXmlHandler : public wxXmlResourceHandler
{
friend class wxPropertyGridXrcPopulator;
DECLARE_DYNAMIC_CLASS(wxPropertyGridXmlHandler)
public:
wxPropertyGridXmlHandler();
wxObject *DoCreateResource() override;
bool CanHandle(wxXmlNode *node) override;
void InitPopulator();
void PopulatePage( wxPropertyGridPageState* state );
void DonePopulator();
void HandlePropertyGridParams();
private:
wxPropertyGridManager* m_manager = nullptr;
wxPropertyGrid* m_pg = nullptr;
wxPropertyGridPopulator* m_populator = nullptr;
};
#endif // wxUSE_XRC && wxUSE_PROPGRID
#endif // _WX_XRC_XH_PROPGRID_H_

View file

@ -507,12 +507,21 @@ public:
bool IsOfClass(wxXmlNode *node, const wxString& classname) const override;
bool IsObjectNode(const wxXmlNode *node) const override;
// Returns the name of the node, e.g. "object" or "sizeritem".
wxString GetNodeName(const wxXmlNode *node) const override;
// Returns the value of the given attribute under the node.
wxString GetNodeAttribute(const wxXmlNode *node,
const wxString& attrName,
const wxString& defaultValue) const override;
// Gets node content from wxXML_ENTITY_NODE
// The problem is, <tag>content<tag> is represented as
// wxXML_ENTITY_NODE name="tag", content=""
// |-- wxXML_TEXT_NODE or
// wxXML_CDATA_SECTION_NODE name="" content="content"
wxString GetNodeContent(const wxXmlNode *node) override;
wxString GetNodeContent(const wxXmlNode *node) const override;
wxXmlNode *GetNodeParent(const wxXmlNode *node) const override;
wxXmlNode *GetNodeNext(const wxXmlNode *node) const override;

View file

@ -61,7 +61,11 @@ public:
wxObject *instance) = 0;
virtual bool IsOfClass(wxXmlNode *node, const wxString& classname) const = 0;
virtual bool IsObjectNode(const wxXmlNode *node) const = 0;
virtual wxString GetNodeContent(const wxXmlNode *node) = 0;
virtual wxString GetNodeName(const wxXmlNode *node) const = 0;
virtual wxString GetNodeAttribute(const wxXmlNode *node,
const wxString& attrName,
const wxString& defaultValue) const = 0;
virtual wxString GetNodeContent(const wxXmlNode *node) const = 0;
virtual wxXmlNode *GetNodeParent(const wxXmlNode *node) const = 0;
virtual wxXmlNode *GetNodeNext(const wxXmlNode *node) const = 0;
virtual wxXmlNode *GetNodeChildren(const wxXmlNode *node) const = 0;
@ -240,7 +244,20 @@ protected:
{
return GetImpl()->IsObjectNode(node);
}
wxString GetNodeContent(const wxXmlNode *node)
wxString GetNodeName(const wxXmlNode *node) const
{
return GetImpl()->GetNodeName(node);
}
wxString GetNodeAttribute(const wxXmlNode *node,
const wxString& attrName,
const wxString& defaultValue = {}) const
{
return GetImpl()->GetNodeAttribute(node, attrName, defaultValue);
}
wxString GetNodeContent(const wxXmlNode *node) const
{
return GetImpl()->GetNodeContent(node);
}

View file

@ -355,7 +355,7 @@ public:
int GetPageByName( const wxString& name ) const;
/**
Returns index for a relevant propertygrid state.
Returns index for a relevant property grid state.
If no match is found, wxNOT_FOUND is returned.
*/
int GetPageByState( const wxPropertyGridPageState* pstate ) const;

View file

@ -433,8 +433,8 @@ enum class wxPGKeyboardAction
Call wxPropertyGrid::SetSortFunction() to set it.
Sort function should return a value greater than 0 if position of p1 is
after p2. So, for instance, when comparing property names, you can use
Sort function should return a value greater than 0 if position of @a p1 is
after @a p2. So, for instance, when comparing property names, you can use
following implementation:
@code
@ -525,9 +525,9 @@ public:
@param action
Which action to trigger. See @ref propgrid_keyboard_actions.
@param keycode
Which keycode triggers the action.
Which key triggers the action.
@param modifiers
Which key event modifiers, in addition to keycode, are needed to
Which key event modifiers, in addition to key code, are needed to
trigger the action.
*/
void AddActionTrigger(wxPGKeyboardAction action, int keycode, int modifiers = 0);
@ -627,7 +627,7 @@ public:
const wxString& name = wxPropertyGridNameStr );
/**
Dedicates a specific keycode to wxPropertyGrid. This means that such
Dedicates a specific key code to wxPropertyGrid. This means that such
key presses will not be redirected to editor controls.
Using this function allows, for example, navigation between
@ -676,7 +676,7 @@ public:
already fairly large.
Note that you can also get calculated column widths by calling
GetState->GetColumnWidth() immediately after this function
GetState()->GetColumnWidth() immediately after this function
returns.
*/
wxSize FitColumns();
@ -1061,7 +1061,7 @@ public:
@param sortFunction
The sorting function to be used. It should return a value greater
than 0 if position of p1 is after p2. So, for instance, when
than 0 if position of @a p1 is after @a p2. So, for instance, when
comparing property names, you can use following implementation:
@code
@ -1128,7 +1128,7 @@ public:
/**
Must be called in wxPGEditor::CreateControls() if primary editor window
is wxTextCtrl, just before textctrl is created.
is wxTextCtrl, just before the text control is created.
@param text
Initial text value of created wxTextCtrl.
*/
@ -1352,7 +1352,7 @@ public:
~wxPropertyGridEvent();
/**
Returns @true if you can veto the action that the event is signaling.
Returns @true if you can veto the action that the event is signalling.
*/
bool CanVeto() const;
@ -1438,7 +1438,7 @@ public:
/**
Call this from your event handler to veto action that the event is
signaling. You can only veto a shutdown if wxPropertyGridEvent::CanVeto()
signalling. You can only veto a shutdown if wxPropertyGridEvent::CanVeto()
returns @true.
@remarks Currently only @c wxEVT_PG_CHANGING supports vetoing.
@ -1534,10 +1534,16 @@ public:
@param value
Attribute value.
@param flags
Flags used when setting the attribute. Currently only
wxPGPropertyValuesFlags::Recurse is used here. This parameter is
only available since wxWidgets 3.3.0.
*/
bool AddAttribute( const wxString& name,
const wxString& type,
const wxString& value );
const wxString& value,
wxPGPropertyValuesFlags flags = wxPGPropertyValuesFlags::DontRecurse );
/**
Called once in AddChildren.

View file

@ -83,7 +83,7 @@ wxPG_SORT_TOP_LEVEL_ONLY = 0x00000200
- wxPropertyGridInterface's property operation member functions all accept
a special wxPGPropArg id argument, using which you can refer to properties
either by their pointer (for performance) or by their name (for conveniency).
either by their pointer (for performance) or by their name (for convenience).
@library{wxpropgrid}
@category{propgrid}
@ -472,7 +472,7 @@ public:
*/
wxVariant GetPropertyValue( wxPGPropArg id );
/** Return's property's value as wxArrayInt. */
/** Returns property's value as wxArrayInt. */
wxArrayInt GetPropertyValueAsArrayInt( wxPGPropArg id ) const;
/** Returns property's value as wxArrayString. */
@ -481,7 +481,7 @@ public:
/** Returns property's value as bool */
bool GetPropertyValueAsBool( wxPGPropArg id ) const;
/** Return's property's value as wxDateTime. */
/** Returns property's value as wxDateTime. */
wxDateTime GetPropertyValueAsDateTime( wxPGPropArg id ) const;
/** Returns property's value as double-precision floating point number. */
@ -813,7 +813,7 @@ public:
wxString SaveEditableState( int includedStates = AllStates ) const;
/**
Sets strings listed in the choice dropdown of a wxBoolProperty.
Sets strings listed in the choice drop-down of a wxBoolProperty.
Defaults are "True" and "False", so changing them to, say, "Yes" and
"No" may be useful in some less technical applications.
@ -824,7 +824,7 @@ public:
/**
Set proportion of an auto-stretchable column. wxPG_SPLITTER_AUTO_CENTER
window style needs to be used to indicate that columns are auto-
resizable.
resizeable.
@returns Returns @false on failure.
@ -985,7 +985,7 @@ public:
to wxPGPropertyValuesFlags::DontRecurse to prevent this.
@remarks
- This is mainly for use with textctrl editor. Only some other
- This is mainly for use with TextCtrl editor. Only some other
editors fully support it.
- Property is refreshed with new settings.
*/
@ -1194,8 +1194,8 @@ public:
/**
@remarks This function reselects the property and may cause
excess flicker, so to just call Refresh() on a rect
of single property, call DrawItem() instead.
excess flicker, so to just call Refresh() on a rectangle
of a single property, call DrawItem() instead.
*/
virtual void RefreshProperty( wxPGProperty* p ) = 0;
};

View file

@ -760,10 +760,31 @@ protected:
@since 3.1.0
*/
bool IsObjectNode(const wxXmlNode *node) const;
/**
Returns the node name.
Returns empty string if @a node is @NULL.
@since 3.3.0
*/
wxString GetNodeName(wxXmlNode* node) const;
/**
Gets the node attribute value.
If @a node is @NULL or the attribute is not present, returns @a defaultValue.
@since 3.3.0
*/
wxString GetNodeAttribute(const wxXmlNode *node,
const wxString& attrName,
const wxString& defaultValue = {}) const;
/**
Gets node content from wxXML_ENTITY_NODE.
*/
wxString GetNodeContent(wxXmlNode* node);
wxString GetNodeContent(wxXmlNode* node) const;
/**
Gets the parent of the node given.

View file

@ -202,6 +202,8 @@ builtinWindowClasses =
| wxNotebook
| wxOwnerDrawnComboBox
| wxPanel
| wxPropertyGrid
| wxPropertyGridManager
| wxPropertySheetDialog
| wxRadioButton
| wxRadioBox
@ -305,6 +307,8 @@ builtinClassesNames =
| "wxNotebook"
| "wxOwnerDrawnComboBox"
| "wxPanel"
| "wxPropertyGrid"
| "wxPropertyGridManager"
| "wxPropertySheetDialog"
| "wxRadioButton"
| "wxRadioBox"
@ -1276,6 +1280,62 @@ wxPanel =
}
wxPropertyGrid =
element object {
attribute class { "wxPropertyGrid" } &
stdObjectNodeAttributes &
stdWindowProperties &
[xrc:p="o"] element virtualwidth {_, t_integer }* &
(wxPropertyGridProperty | objectRef)*
}
wxPropertyGridManager =
element object {
attribute class { "wxPropertyGridManager" } &
stdObjectNodeAttributes &
stdWindowProperties &
[xrc:p="o"] element virtualwidth {_, t_integer }* &
(wxPropertyGridPage | objectRef)*
}
wxPropertyGridPage =
element page {
[xrc:p="o"] element label {_, t_text }* &
[xrc:p="o"] element columns {_, t_integer}* &
[xrc:p="o"] element splitterpos {
attribute index { t_integer }* &
# Too lax: it should be t_integer with optional "%", not text.
t_text
}* &
[xrc:p="o"] element choices {
attribute id { t_identifier } &
t_text
}* &
(wxPropertyGridProperty | objectRef)*
}
wxPropertyGridProperty =
element property {
attribute class { t_identifier } &
[xrc:p="o"] element label {_, t_text }* &
[xrc:p="o"] element value {_, t_text }* &
[xrc:p="o"] element attribute{
attribute name { t_identifier } &
t_text
}* &
# Too lax: choices should either have an id attribute or start with "@"
# referencing an ID defined elsewhere.
[xrc:p="o"] element choices {
attribute id { t_identifier }* &
t_text
}* &
[xrc:p="o"] element tip {_, t_text }* &
[xrc:p="o"] element expanded {_, t_bool }* &
[xrc:p="o"] element flags {_, t_text }* &
(wxPropertyGridProperty | objectRef)*
}
wxPropertySheetDialog =
element object {
attribute class { "wxPropertySheetDialog" } &

View file

@ -31,6 +31,7 @@ TOOLKIT_VERSION = @TOOLKIT_VERSION@
TOOLCHAIN_FULLNAME = @TOOLCHAIN_FULLNAME@
EXTRALIBS = @EXTRALIBS@
EXTRALIBS_XML = @EXTRALIBS_XML@
EXTRALIBS_HTML = @EXTRALIBS_HTML@
EXTRALIBS_GUI = @EXTRALIBS_GUI@
WX_CPPFLAGS = @WX_CPPFLAGS@
WX_CXXFLAGS = @WX_CXXFLAGS@
@ -107,9 +108,18 @@ COND_PLATFORM_OS2_1___propgrid___os2_emxbindcmd = $(NM) propgrid$(EXEEXT) | if \
COND_MONOLITHIC_0___WXLIB_PROPGRID_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_propgrid-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_PROPGRID_p = $(COND_MONOLITHIC_0___WXLIB_PROPGRID_p)
COND_MONOLITHIC_0___WXLIB_XRC_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xrc-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_XRC_p = $(COND_MONOLITHIC_0___WXLIB_XRC_p)
COND_MONOLITHIC_0___WXLIB_HTML_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_html-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_HTML_p = $(COND_MONOLITHIC_0___WXLIB_HTML_p)
COND_MONOLITHIC_0___WXLIB_CORE_p = \
-lwx_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_CORE_p = $(COND_MONOLITHIC_0___WXLIB_CORE_p)
COND_MONOLITHIC_0___WXLIB_XML_p = \
-lwx_base$(WXBASEPORT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_XML_p = $(COND_MONOLITHIC_0___WXLIB_XML_p)
COND_MONOLITHIC_0___WXLIB_BASE_p = \
-lwx_base$(WXBASEPORT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)-$(WX_RELEASE)$(HOST_SUFFIX)
@COND_MONOLITHIC_0@__WXLIB_BASE_p = $(COND_MONOLITHIC_0___WXLIB_BASE_p)
@ -141,7 +151,7 @@ COND_MONOLITHIC_1___WXLIB_MONO_p = \
### Targets: ###
all: propgrid$(EXEEXT) $(__propgrid_bundle___depname)
all: propgrid$(EXEEXT) $(__propgrid_bundle___depname) data
install:
@ -159,7 +169,7 @@ distclean: clean
rm -f config.cache config.log config.status bk-deps bk-make-pch Makefile
propgrid$(EXEEXT): $(PROPGRID_OBJECTS) $(__propgrid___win32rc)
$(CXX) -o $@ $(PROPGRID_OBJECTS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_PROPGRID_p) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
$(CXX) -o $@ $(PROPGRID_OBJECTS) -L$(LIBDIRNAME) $(LDFLAGS_GUI) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_PROPGRID_p) $(__WXLIB_XRC_p) $(__WXLIB_HTML_p) $(EXTRALIBS_HTML) $(__WXLIB_CORE_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS)
$(__propgrid___os2_emxbindcmd)
@COND_PLATFORM_MACOSX_1@propgrid.app/Contents/PkgInfo: propgrid$(EXEEXT) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns
@ -189,6 +199,18 @@ propgrid$(EXEEXT): $(PROPGRID_OBJECTS) $(__propgrid___win32rc)
@COND_PLATFORM_MACOSX_1@propgrid_bundle: $(____propgrid_BUNDLE_TGT_REF_DEP)
data:
@mkdir -p .
@for f in propgrid.xrc; do \
if test ! -f ./$$f -a ! -d ./$$f ; \
then x=yep ; \
else x=`find $(srcdir)/$$f -newer ./$$f -print` ; \
fi; \
case "$$x" in ?*) \
cp -pRf $(srcdir)/$$f . ;; \
esac; \
done
propgrid_sample_rc.o: $(srcdir)/../../samples/sample.rc
$(WINDRES) -i$< -o$@ --define __WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) --include-dir $(srcdir) $(__DLLFLAG_p_1) $(__WIN32_DPI_MANIFEST_p) --include-dir $(srcdir)/../../samples $(__RCDEFDIR_p) --include-dir $(top_srcdir)/include
@ -205,4 +227,4 @@ propgrid_sampleprops.o: $(srcdir)/sampleprops.cpp
# Include dependency info, if present:
@IF_GNU_MAKE@-include ./.deps/*.d
.PHONY: all install uninstall clean distclean propgrid_bundle
.PHONY: all install uninstall clean distclean propgrid_bundle data

View file

@ -135,10 +135,22 @@ __WXLIB_PROPGRID_p = \
-lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_propgrid
endif
ifeq ($(MONOLITHIC),0)
__WXLIB_XRC_p = \
-lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xrc
endif
ifeq ($(MONOLITHIC),0)
__WXLIB_HTML_p = \
-lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_html
endif
ifeq ($(MONOLITHIC),0)
__WXLIB_CORE_p = \
-lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core
endif
ifeq ($(MONOLITHIC),0)
__WXLIB_XML_p = \
-lwxbase$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml
endif
ifeq ($(MONOLITHIC),0)
__WXLIB_BASE_p = -lwxbase$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)
endif
ifeq ($(MONOLITHIC),1)
@ -203,7 +215,7 @@ $(OBJS):
### Targets: ###
all: $(OBJS)\propgrid.exe
all: $(OBJS)\propgrid.exe data
clean:
-if exist $(OBJS)\*.o del $(OBJS)\*.o
@ -213,9 +225,13 @@ clean:
$(OBJS)\propgrid.exe: $(PROPGRID_OBJECTS) $(OBJS)\propgrid_sample_rc.o
$(foreach f,$(subst \,/,$(PROPGRID_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp))
@move /y $@.rsp.tmp $@.rsp >nul
$(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) $(__WXLIB_PROPGRID_p) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme
$(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) -Wl,--subsystem,windows -mwindows $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) $(__WXLIB_PROPGRID_p) $(__WXLIB_XRC_p) $(__WXLIB_HTML_p) $(__WXLIB_CORE_p) $(__WXLIB_XML_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme
@-del $@.rsp
data:
if not exist $(OBJS) mkdir $(OBJS)
for %%f in (propgrid.xrc) do if not exist $(OBJS)\%%f copy .\%%f $(OBJS)
$(OBJS)\propgrid_sample_rc.o: ./../../samples/sample.rc
$(WINDRES) -i$< -o$@ --define __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) --include-dir $(SETUPHDIR) --include-dir ./../../include $(__CAIRO_INCLUDEDIR_p) --include-dir . $(__DLLFLAG_p_1) --define wxUSE_DPI_AWARE_MANIFEST=$(USE_DPI_AWARE_MANIFEST) --include-dir ./../../samples --define NOPCH
@ -228,7 +244,7 @@ $(OBJS)\propgrid_propgrid_minimal.o: ./propgrid_minimal.cpp
$(OBJS)\propgrid_sampleprops.o: ./sampleprops.cpp
$(CXX) -c -o $@ $(PROPGRID_CXXFLAGS) $(CPPDEPS) $<
.PHONY: all clean
.PHONY: all clean data
SHELL := $(COMSPEC)

View file

@ -90,7 +90,7 @@ test_for_selected_wxbuild:
@$(WX_CONFIG) $(WX_CONFIG_FLAGS)
propgrid: $(PROPGRID_OBJECTS)
$(CXX) -o $@ $(PROPGRID_OBJECTS) $(LDFLAGS) `$(WX_CONFIG) $(WX_CONFIG_FLAGS) --libs propgrid,core,base`
$(CXX) -o $@ $(PROPGRID_OBJECTS) $(LDFLAGS) `$(WX_CONFIG) $(WX_CONFIG_FLAGS) --libs propgrid,xrc,html,core,xml,base`
propgrid_propgrid.o: ./propgrid.cpp
$(CXX) -c -o $@ $(PROPGRID_CXXFLAGS) $(CPPDEPS) $<

View file

@ -366,10 +366,22 @@ __WXLIB_PROPGRID_p = \
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_propgrid.lib
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_XRC_p = \
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xrc.lib
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_HTML_p = \
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_html.lib
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_CORE_p = \
wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_core.lib
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_XML_p = \
wxbase$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_xml.lib
!endif
!if "$(MONOLITHIC)" == "0"
__WXLIB_BASE_p = \
wxbase$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR).lib
!endif
@ -409,7 +421,7 @@ $(OBJS):
### Targets: ###
all: $(OBJS)\propgrid.exe
all: $(OBJS)\propgrid.exe data
clean:
-if exist $(OBJS)\*.obj del $(OBJS)\*.obj
@ -421,9 +433,13 @@ clean:
$(OBJS)\propgrid.exe: $(PROPGRID_OBJECTS) $(OBJS)\propgrid_sample.res
link /NOLOGO /OUT:$@ $(__DEBUGINFO_1) /pdb:"$(OBJS)\propgrid.pdb" $(__DEBUGINFO_2) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:WINDOWS $(____CAIRO_LIBDIR_FILENAMES_p) $(LDFLAGS) @<<
$(PROPGRID_OBJECTS) $(PROPGRID_RESOURCES) $(__WXLIB_PROPGRID_p) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib
$(PROPGRID_OBJECTS) $(PROPGRID_RESOURCES) $(__WXLIB_PROPGRID_p) $(__WXLIB_XRC_p) $(__WXLIB_HTML_p) $(__WXLIB_CORE_p) $(__WXLIB_XML_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_LEXILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib
<<
data:
if not exist $(OBJS) mkdir $(OBJS)
for %f in (propgrid.xrc) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
$(OBJS)\propgrid_sample.res: .\..\..\samples\sample.rc
rc /fo$@ /d WIN32 $(____DEBUGRUNTIME_3_p_1) /d _CRT_SECURE_NO_DEPRECATE=1 /d _CRT_NON_CONFORMING_SWPRINTFS=1 /d _SCL_SECURE_NO_WARNINGS=1 $(__NO_VC_CRTDBG_p_1) $(__TARGET_CPU_COMPFLAG_p_1) /d __WXMSW__ $(__WXUNIV_DEFINE_p_1) $(__DEBUG_DEFINE_p_1) $(__NDEBUG_DEFINE_p_1) $(__EXCEPTIONS_DEFINE_p_1) $(__RTTI_DEFINE_p_1) $(__THREAD_DEFINE_p_1) /i $(SETUPHDIR) /i .\..\..\include $(____CAIRO_INCLUDEDIR_FILENAMES_1_p) /i . $(__DLLFLAG_p_1) /d _WINDOWS /i .\..\..\samples /d NOPCH .\..\..\samples\sample.rc

View file

@ -14,8 +14,14 @@
propgrid.h
</headers>
<wx-lib>propgrid</wx-lib>
<wx-lib>xrc</wx-lib>
<wx-lib>html</wx-lib>
<wx-lib>core</wx-lib>
<wx-lib>xml</wx-lib>
<wx-lib>base</wx-lib>
</exe>
<wx-data id="data">
<files>propgrid.xrc</files>
</wx-data>
</makefile>

File diff suppressed because it is too large Load diff

View file

@ -100,7 +100,7 @@ public:
FormMain(const wxString& title);
~FormMain();
wxPropertyGridManager* m_pPropGridManager;
wxPropertyGridManager* m_propGridManager;
wxPropertyGrid* m_propGrid;
wxTextCtrl* m_tcPropLabel;
@ -111,7 +111,7 @@ public:
wxLogWindow* m_logWindow;
#endif
wxPGEditor* m_pSampleMultiButtonEditor;
wxPGEditor* m_sampleMultiButtonEditor;
wxPGChoices m_combinedFlags;
wxMenuItem* m_itemCatColours;

View file

@ -0,0 +1,101 @@
<?xml version="1.0"?>
<resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.5.3.0">
<object class="wxFrame" name="propgrid">
<title>wxPropertyGrid XRC Demo</title>
<object class="wxBoxSizer">
<object class="sizeritem">
<option>1</option>
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxPropertyGridManager">
<style>wxPG_AUTO_SORT|wxPG_TOOLTIPS|wxPG_TOOLBAR</style>
<exstyle>wxPG_EX_MODE_BUTTONS|wxPG_EX_HELP_AS_TOOLTIPS</exstyle>
<virtualwidth>0</virtualwidth>
<page>
<label>Sample Page 1</label>
<property class="wxPropertyCategory">
<label>Appearance</label>
<property class="wxSystemColourProperty">
<label>Cell Colour</label>
<value>(255,255,255)</value>
<tip>Sample help string</tip>
</property>
<property class="wxSystemColourProperty">
<label>Cell Text Colour</label>
<value>(0,0,0)</value>
</property>
<property class="wxFlagsProperty">
<label>Window Styles</label>
<!-- List of supported flags: COLLAPSED, DISABLED, HIDDEN, NOEDITOR -->
<flags>EXPANDED</flags>
<choices id="WindowStyles">"wxSIMPLE_BORDER"=0x0001 "wxDOUBLE_BORDER"=0x0002
"wxSUNKEN_BORDER"=0x0004 "wxRAISED_BORDER"=0x0008
"wxNO_BORDER"=0x0010 "wxTRANSPARENT_WINDOW"=0x0020
"wxTAB_TRAVERSAL"=0x0040 "wxWANTS_CHARS"=0x0080
"wxCAPTION"=0x0100 "wxMINIMIZE"=0x0200
"wxMAXIMIZE"=0x0400 "wxCLOSE_BOX"=0x0800
"wxSTAY_ON_TOP"=0x1000 "wxSYSTEM_MENU"=0x2000
"wxRESIZE_BORDER"=0x4000 "wxFRAME_TOOL_WINDOW"=0x8000
</choices>
<value>wxTAB__TRAVERSAL, wxCAPTION, wxCLOSE__BOX, wxSYSTEM__MENU, wxRESIZE__BORDER</value>
<tip>NB: These window style values are not genuine!</tip>
</property>
<property class="wxCursorProperty">
<label>Cursor</label>
<value>Default</value>
</property>
<property class="wxFontProperty">
<label>Font</label>
<value>10; Swiss; Abadi MT Condensed Extra Bold; Normal; Normal; False</value>
<expanded>1</expanded>
</property>
<property class="wxStringProperty">
<label>Label</label>
<value>wxPropertyGrid Sample</value>
</property>
</property>
<property class="wxPropertyCategory">
<label>Miscellaneous</label>
<property class="wxFileProperty">
<label>File Property</label>
<value>samples.xrc</value>
<attribute name="Wildcard">XRC files (*.xrc)|*.xrc</attribute>
<attribute name="ShowFullPath">true</attribute>
<attribute name="DialogTitle">This is custom dialog title</attribute>
</property>
</property>
</page>
<page>
<label>Sample Page 2</label>
<columns>3</columns>
<!-- NB: Regardless that choices must be defined on page-level, they are global. -->
<choices id="EnterpriseCrew">"Picard" "Riker" "Data" "LaForge" "Worf" "Crusher" "Troi"
</choices>
<splitterpos>30%</splitterpos>
<splitterpos index="1">90%</splitterpos>
<property class="wxEnumProperty">
<label>Enum Property 1</label>
<value>Riker</value>
<choices>@EnterpriseCrew</choices>
</property>
<property class="wxEnumProperty">
<label>Enum Property 2</label>
<value>Data</value>
<choices>@EnterpriseCrew</choices>
</property>
<property class="wxEnumProperty">
<label>Enum Property 3</label>
<value>Picard</value>
<!-- NB: Since choices with given id has already been defined, it
is used instead of this new list. -->
<choices id="EnterpriseCrew">"Kirk" "Spock" "McCoy"
</choices>
</property>
</page>
</object>
</object>
</object>
</object>
</resource>

View file

@ -54,7 +54,7 @@ MyFrame::MyFrame(wxWindow* parent)
pg->Append( new wxIntProperty("Int Property", wxPG_LABEL) );
pg->Append( new wxBoolProperty("Bool Property", wxPG_LABEL) );
SetSize(400, 600);
SetClientSize(FromDIP(wxSize(400, 300)));
}
void MyFrame::OnPropertyGridChange(wxPropertyGridEvent &event)

View file

@ -6416,9 +6416,22 @@ wxPGProperty* wxPropertyGridPopulator::Add( const wxString& propClass,
void wxPropertyGridPopulator::AddChildren( wxPGProperty* property )
{
// Preserve inherited attributes to be able to restore them later:
// attributes recursively set for the children of this property shouldn't
// be inherited by its siblings.
const auto inheritedAttributesOrig = m_inheritedAttributes;
// Apply inherited attributes to the property.
for ( const auto& it : m_inheritedAttributes )
{
property->SetAttribute(it.first, it.second);
}
m_propHierarchy.push_back(property);
DoScanForChildren();
m_propHierarchy.pop_back();
m_inheritedAttributes = std::move(inheritedAttributesOrig);
}
// -----------------------------------------------------------------------
@ -6540,7 +6553,8 @@ bool wxPropertyGridPopulator::ToLongPCT( const wxString& s, long* pval, long max
bool wxPropertyGridPopulator::AddAttribute( const wxString& name,
const wxString& type,
const wxString& value )
const wxString& value,
wxPGPropertyValuesFlags flags )
{
if ( m_propHierarchy.empty() )
return false;
@ -6589,6 +6603,11 @@ bool wxPropertyGridPopulator::AddAttribute( const wxString& name,
}
}
if ( !!(flags & wxPGPropertyValuesFlags::Recurse) )
{
m_inheritedAttributes[name] = variant;
}
p->SetAttribute( name, variant );
return true;

295
src/xrc/xh_propgrid.cpp Normal file
View file

@ -0,0 +1,295 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_propgrid.cpp
// Purpose: XRC resource for wxPropertyGrid
// Author: Jaakko Salli
// Created: May-16-2007
// Copyright: (c) 2007 Jaakko Salli
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#if wxUSE_XRC && wxUSE_PROPGRID
#include "wx/xrc/xh_propgrid.h"
#include "wx/propgrid/manager.h"
#include "wx/propgrid/propgrid.h"
#ifndef WX_PRECOMP
#include "wx/intl.h"
#endif
IMPLEMENT_DYNAMIC_CLASS(wxPropertyGridXmlHandler, wxXmlResourceHandler)
wxPropertyGridXmlHandler::wxPropertyGridXmlHandler()
:wxXmlResourceHandler()
{
XRC_ADD_STYLE(wxTAB_TRAVERSAL);
XRC_ADD_STYLE(wxPG_AUTO_SORT);
XRC_ADD_STYLE(wxPG_HIDE_CATEGORIES);
XRC_ADD_STYLE(wxPG_BOLD_MODIFIED);
XRC_ADD_STYLE(wxPG_SPLITTER_AUTO_CENTER);
XRC_ADD_STYLE(wxPG_TOOLTIPS);
XRC_ADD_STYLE(wxPG_HIDE_MARGIN);
XRC_ADD_STYLE(wxPG_STATIC_SPLITTER);
XRC_ADD_STYLE(wxPG_LIMITED_EDITING);
XRC_ADD_STYLE(wxPG_TOOLBAR);
XRC_ADD_STYLE(wxPG_DESCRIPTION);
XRC_ADD_STYLE(wxPG_EX_INIT_NOCAT);
XRC_ADD_STYLE(wxPG_EX_HELP_AS_TOOLTIPS);
XRC_ADD_STYLE(wxPG_EX_AUTO_UNSPECIFIED_VALUES);
XRC_ADD_STYLE(wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES);
XRC_ADD_STYLE(wxPG_EX_NO_FLAT_TOOLBAR);
XRC_ADD_STYLE(wxPG_EX_MODE_BUTTONS);
AddWindowStyles();
}
class wxPropertyGridXrcPopulator : public wxPropertyGridPopulator
{
public:
wxPropertyGridXrcPopulator( wxPropertyGridXmlHandler* handler )
: wxPropertyGridPopulator()
{
m_xrcHandler = handler;
m_prevPopulator = m_xrcHandler->m_populator;
}
~wxPropertyGridXrcPopulator() override
{
m_xrcHandler->m_populator = m_prevPopulator;
}
void DoScanForChildren() override
{
m_xrcHandler->CreateChildrenPrivately(m_pg, nullptr);
}
protected:
wxPropertyGridXmlHandler* m_xrcHandler;
wxPropertyGridPopulator* m_prevPopulator;
};
void wxPropertyGridXmlHandler::InitPopulator()
{
wxPropertyGridXrcPopulator* populator
= new wxPropertyGridXrcPopulator(this);
m_populator = populator;
}
void wxPropertyGridXmlHandler::PopulatePage( wxPropertyGridPageState* state )
{
wxString sColumns(wxT("columns"));
if ( HasParam(sColumns) )
state->SetColumnCount( GetLong(sColumns) );
m_populator->SetState( state );
m_populator->AddChildren( state->DoGetRoot() );
}
void wxPropertyGridXmlHandler::DonePopulator()
{
delete m_populator;
}
void wxPropertyGridXmlHandler::HandlePropertyGridParams()
{
wxString sVW(wxT("virtualwidth"));
if ( HasParam(sVW) )
{
m_pg->SetVirtualWidth(GetDimension(sVW));
}
}
wxObject *wxPropertyGridXmlHandler::DoCreateResource()
{
const wxXmlNode* node = m_node;
wxString nodeName = GetNodeName(node);
if ( nodeName == wxT("property") )
{
// property
wxString clas = GetNodeAttribute(node, "class");
wxString label;
wxString sLabel(wxT("label"));
if ( HasParam(sLabel) )
label = GetText(sLabel);
wxString name;
wxString sName(wxT("name"));
if ( HasParam(sName) )
name = GetText(sName);
else
name = label;
wxString sValue(wxT("value"));
wxString value;
wxString* pValue = nullptr;
if ( HasParam(sValue) )
{
value = GetText(sValue);
pValue = &value;
}
wxXmlNode* choicesNode = GetParamNode(wxT("choices"));
wxPGChoices choices;
if ( choicesNode )
{
choices = m_populator->ParseChoices( GetNodeContent(choicesNode),
GetNodeAttribute(choicesNode, "id"));
}
wxPGProperty* property = m_populator->Add( clas, label, name, pValue, &choices );
if ( !property )
return nullptr;
wxString sFlags(wxT("flags"));
wxString flags;
if ( HasParam(sFlags) )
property->SetFlagsFromString( GetText(sFlags) );
wxString sTip(wxT("tip"));
if ( HasParam(sTip) )
property->SetHelpString(GetText(sTip));
if ( property->GetChildCount() )
{
wxString sExpanded(wxT("expanded"));
if ( HasParam(sExpanded) )
property->SetExpanded(GetBool(sExpanded));
}
// Need to call AddChildren even for non-parent properties for attributes and such
m_populator->AddChildren(property);
}
else if ( nodeName == wxT("attribute") )
{
// attribute
wxString s1 = GetNodeAttribute(node, "name");
if ( s1.length() )
{
wxPGPropertyValuesFlags flags = GetNodeAttribute(node, "recurse") == "1"
? wxPGPropertyValuesFlags::Recurse
: wxPGPropertyValuesFlags::DontRecurse;
m_populator->AddAttribute( s1, GetNodeAttribute(node, "type"),
GetNodeContent(node), flags );
}
}
else if( m_class == wxT("wxPropertyGrid"))
{
XRC_MAKE_INSTANCE(control, wxPropertyGrid)
control->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(),
GetName());
m_pg = control;
HandlePropertyGridParams();
InitPopulator();
PopulatePage(control->GetState());
DonePopulator();
SetupWindow(control);
return control;
}
else if ( nodeName == wxT("choices") )
{
// choices
//
// Add choices list outside of a property
m_populator->ParseChoices( GetNodeContent(node),
GetNodeAttribute(node, "id"));
}
else if ( nodeName == wxT("splitterpos") )
{
// splitterpos
wxASSERT(m_populator);
wxString sIndex = GetNodeAttribute(node, "index");
long index;
if ( !sIndex.ToLong(&index, 10) )
index = 0;
wxString s = GetNodeContent(node);
long pos;
if ( wxPropertyGridPopulator::ToLongPCT(s, &pos, m_pg->GetClientSize().x) )
m_populator->GetState()->DoSetSplitter( pos, index );
}
else if ( nodeName == wxT("page") )
{
// page
wxASSERT(m_manager);
wxString label;
wxString sLabel(wxT("label"));
if ( HasParam(sLabel) )
label = GetText(sLabel);
else
label = wxString::Format(_("Page %i"),(int)(m_manager->GetPageCount()+1));
m_manager->AddPage(label);
wxPropertyGridPageState* state = m_manager->GetPage(m_manager->GetPageCount()-1);
PopulatePage(state);
}
else if( m_class == wxT("wxPropertyGridManager"))
{
XRC_MAKE_INSTANCE(control, wxPropertyGridManager)
control->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(),
GetName());
wxPropertyGridManager* oldManager = m_manager;
m_manager = control;
m_pg = control->GetGrid();
HandlePropertyGridParams();
InitPopulator();
CreateChildrenPrivately(control, nullptr);
DonePopulator();
m_manager = oldManager;
SetupWindow(control);
return control;
}
else
{
wxFAIL_MSG( "unreachable" );
}
return nullptr;
}
bool wxPropertyGridXmlHandler::CanHandle(wxXmlNode *node)
{
const wxString name = GetNodeName(node);
return (
(
m_populator && ( name == wxT("property") ||
name == wxT("attribute") ||
name == wxT("choices") ||
name == wxT("splitterpos")
)
) ||
(m_manager && name == wxT("page")) ||
(!m_populator && IsOfClass(node, wxT("wxPropertyGrid"))) ||
(!m_populator && IsOfClass(node, wxT("wxPropertyGridManager")))
);
}
#endif // wxUSE_XRC && wxUSE_PROPGRID

View file

@ -2260,20 +2260,22 @@ bool wxXmlResourceHandlerImpl::IsObjectNode(const wxXmlNode *node) const
node->GetName() == wxS("object_ref"));
}
wxString wxXmlResourceHandlerImpl::GetNodeContent(const wxXmlNode *node)
wxString wxXmlResourceHandlerImpl::GetNodeName(const wxXmlNode *node) const
{
const wxXmlNode *n = node;
if (n == nullptr) return wxEmptyString;
n = n->GetChildren();
return node ? node->GetName() : wxString{};
}
while (n)
{
if (n->GetType() == wxXML_TEXT_NODE ||
n->GetType() == wxXML_CDATA_SECTION_NODE)
return n->GetContent();
n = n->GetNext();
}
return wxEmptyString;
wxString
wxXmlResourceHandlerImpl::GetNodeAttribute(const wxXmlNode *node,
const wxString& attrName,
const wxString& defaultValue) const
{
return node ? node->GetAttribute(attrName, defaultValue) : defaultValue;
}
wxString wxXmlResourceHandlerImpl::GetNodeContent(const wxXmlNode *node) const
{
return node ? node->GetNodeContent() : wxString{};
}
wxXmlNode *wxXmlResourceHandlerImpl::GetNodeParent(const wxXmlNode *node) const