Commit graph

566 commits

Author SHA1 Message Date
Vadim Zeitlin
9550c37e29 Support inherited attributes in wxPropertyGrid XRC handler
Allow specifying recurse="1" to inherit the attribute, as this is much
nicer than having to specify it for all the children.

Also add support for this to wxPropertyGridPopulator, which is used by
the XRC handler.
2024-02-03 21:46:15 +01:00
Vadim Zeitlin
a5b9e6d3e7 Minimal changes to make wxPropertyGridXmlHandler compile again
Just rename wxPropertyGridState to wxPropertyGridPageState and add make
wxPropertyGridXmlHandler a friend of this class to allow it to use its
protected methods.

Also remove some preprocessor checks for non-existent symbols.
2024-01-30 01:55:56 +01:00
Vadim Zeitlin
99eca07ac5 Some minor spelling fixes in wxPropertyGrid documentation
Also fix a couple of things in the actual header for consistency with
the same fixes done in the documentation.

No real changes.
2024-01-30 01:55:14 +01:00
Vadim Zeitlin
a2f7a933e8 Merge branch 'no-global-ops'
Don't define operators for wx types in global scope.

This results in much better error messages when the compiler gives an
error about failing to resolve a call to some operator in user code
because it doesn't list all the wx-defined operators as candidates. In
practice, this cuts down error messages from 500 (!) lines to 2 with
gcc.

See #24190.
2024-01-12 18:42:39 +01:00
Vadim Zeitlin
09eff033d9 Hide operator<<() overloads used for wxVariant support too
Add new wxDECLARE_VARIANT_OBJECT_EXPORTED() macro defining these
operators as friend functions inside the class declaration and replace
all uses of DECLARE_VARIANT_OBJECT_EXPORTED() inside the core library
with the new macro to avoid defining any operator<<() overloads in the
global scope.

Also add wxIMPLEMENT_VARIANT_OBJECT() for consistency, even though it is
not really needed.
2024-01-06 23:06:02 +01:00
Artur Wieczorek
efa2870cb4 Rename wxPGKeyboardActions type to wxPGKeyboardAction
For regular enumeration singular name is more appropriate.
2024-01-06 22:42:55 +01:00
Artur Wieczorek
3cb3d62212 Use enum class to represent NumericType
This is for better type safety.
2024-01-06 22:42:49 +01:00
Artur Wieczorek
e7ab6a6d53 Use enum class to represent wxPGNumericValidationConstants
This is for better type safety.
2024-01-06 22:42:43 +01:00
Artur Wieczorek
ca3acd7a03 Use enum class to implement wxPGPropValFormatFlags as bitmask
This is for better type safety of the flags.
2024-01-06 22:42:38 +01:00
Artur Wieczorek
5725f0be41 Replace macro with inline function in wxPGPropertyGridIterator-related code
Replace wxPG_ITERATOR_CREATE_MASKS macro with inline function to ensure
type safety.
2023-12-25 15:10:14 +01:00
Artur Wieczorek
6a5b0667b5 Remove macro from wxPGPropertyGridIterator-related code
Remove simple wxPG_ITERATOR_PARENTEXMASK_TEST macro and use just the code
to increase code readability.
2023-12-25 15:10:08 +01:00
Artur Wieczorek
c8552aec0c Make wxPGPropertyFlags a bitmask
To improve type safety of flags.
2023-12-25 15:09:50 +01:00
Artur Wieczorek
6dd129049f Initialize array for wxPropertyGrid alphabetic mode only once
Array holding items to use in non-categoric mode should be created and
initially populated only once.

Closes #24145.
2023-12-23 18:57:38 +01:00
Artur Wieczorek
41109f64f0 Initialize member variables 2023-12-17 16:47:52 +01:00
Artur Wieczorek
a8f3e0da70 Get rid of of unsupported overloads of wxIntProperty::DoValidation()
wxIntProperty::DoValidation() overloads for wxLongLong_t and wxULongLong_t
parameters are not supported because for these types there are no direct
conversions to wxVariant.
Arguments of such types will be handled by overloads for wxLongLong
and wxULongLong.
2023-12-17 16:47:30 +01:00
Vadim Zeitlin
dede4b9326 Use "= default" for all trivial default ctors and dtors
Replace user-specified empty constructors and destructors with the
compiler-generated versions, which has a number of advantages for code
generation, in addition to being more clear.

Closes #22965.

Closes #24058.
2023-11-17 01:33:32 +01:00
Vadim Zeitlin
e43f913313 Remove all blank "Modified by:" lines from top comment blocks
Having this line is not useful at all as it doesn't contain any
information and shouldn't be filled in the future as git-shortlog can
provide the information about people who changed the given file more
more reliably than consulting the comments in any case.

Keep the non-blank lines for historical purposes.
2023-10-22 01:22:48 +02:00
Artur Wieczorek
2cdca2d744 Deprecate wxPGPropertyFlags that are intended for internal use 2023-09-22 23:39:53 +02:00
Artur Wieczorek
763ed589f5 Prevent from using wxPropertyGrid private header in the user code 2023-09-22 23:39:53 +02:00
Artur Wieczorek
11582b4082 Refactor wxFlagsProperty to simplify initialization 2023-09-22 23:39:53 +02:00
Artur Wieczorek
5a87cbdf3d Use enum class to represent wxPGKeyboardActions 2023-09-22 23:39:53 +02:00
Artur Wieczorek
9cb4d8fbbe Save keyboard actions as std::pair in wxPropertyGrid
Store two possible action codes in std::pair instead of packing them
into one int value with bitmasks. This reduces level of indirection
in accessing keyboard actions and make the code more maintainable.
2023-09-22 23:39:52 +02:00
Artur Wieczorek
87e86dee86 Fix wxPG_PROP_ACTIVE_BTN flag definition
wxPG_PROP_ACTIVE_BTN used in wxStringProperty is misinterpreted
as wxPG_PROP_PASSWORD so these flags they can't share the same value
(wxPG_PROP_CLASS_SPECIFIC_2).

Closes #23856.
2023-09-22 23:39:52 +02:00
Lauri Nurmi
3e4946fc31 Minor documentation syntax and orthography fixes
Closes #23759.
2023-08-22 19:20:33 +02:00
Ian McInerney
5d0c4066d8 Add operators for boolean conversions to wxPGGlobalVars
The old API allowed for users to directly test the variable and find if
it was null, so recreate that API with the new system to preserve
compatibility.

Closes #23445.
2023-06-03 21:07:40 +02:00
Artur Wieczorek
57a9247889 Fix wxPG_PROP_ACTIVE_BTN flag definition
wxPG_PROP_ACTIVE_BTN and wxPG_PROP_SHOW_FULL_FILENAME can be used together
(like e.g. in wxFileProperty) so they can't share the same value
(wxPG_PROP_CLASS_SPECIFIC_1).

Closes #23565.
2023-06-03 00:07:45 +02:00
Vadim Zeitlin
8435566dbb Use std::unordered_map<> in wxPGProperty
Replace a macro-based synonym with the standard container itself.
2023-04-18 00:54:12 +02:00
Vadim Zeitlin
1e9b84cd27 Remove unnecessary <numeric> inclusion from wxPropGrid header
This isn't needed any longer since the changes of 4c463c416d (Use
std::vector instead of wxVector in wxPropertyGrid, 2023-01-22).

No real changes.
2023-04-10 17:00:32 +01:00
Vadim Zeitlin
ff6201fe1d Fix compilation of propgrid.h included as first header
Forward declare wxTextCtrl used in this file.

Closes #23414.
2023-04-04 17:03:53 +02:00
Vadim Zeitlin
eb7257193e Simplify the use of wxPG_DEPRECATED_MACRO_VALUE
Move the check for WXBUILDING, needed to avoid the warnings in props.cpp
about the use of wxPG_DIR_DIALOG_MESSAGE and wxPG_FILE_DIALOG_TITLE when
WXWIN_COMPATIBILITY_3_0==1, inside wxPG_DEPRECATED_MACRO_VALUE itself
instead of doing it in both places where this macro was used.
2023-03-23 13:32:28 +01:00
Vadim Zeitlin
cb03ddf63f Restore compatibility with 3.0-like DrawCaptionSelectionRect()
This function was not called any longer after 35a8d0f908 (Fix building
wxPropertyGrid with v3.0 compatibility enabled, 2023-03-22), which
silently broke any applications resulting on this to happen, so call it
again, even if it's rather painful and ugly to do.

Also add wxDEPRECATED_BUT_USED_INTERNALLY_MSG() and use it instead of the
plain wxDEPRECATED_MSG() for the deprecated overload of this function to
avoid warnings when calling it from wxWidgets itself.

Finally, document the change to DrawCaptionSelectionRect() as this
wasn't done back in c63b1604b3 (Use native renderer to draw rectangle
indicating that wxPG category property is selected., 2015-08-30) when
its signature was changed.
2023-03-23 13:29:30 +01:00
Artur Wieczorek
35a8d0f908 Fix building wxPropertyGrid with v3.0 compatibility enabled
Closes #23369.
2023-03-22 17:07:41 +01:00
Artur Wieczorek
8ad0f52da0 Include header with basic wxPGProperty classes in main wxPG header
This header shouldn't be included here but it was included here in
the previous versions of wxPG and user apps can be broken by removing it.
2023-03-15 19:10:02 +01:00
Artur Wieczorek
a07d17a8a4 Implement comparison operators for bitmasks with enum classes
Implementing bitmask-to-int comparison operators can help
in migrating from int-based bitfields to enum class bitmasks.
2023-03-15 19:02:29 +01:00
Artur Wieczorek
3142e028b2 Move wxPropertyGrid internal stuff to the separate private header 2023-03-10 23:57:43 +01:00
Artur Wieczorek
1e6b5c5927 Get rid of unnecessary headers
Since we can't use std::underlying_type_t<> its header is not needed.
2023-02-20 00:49:59 +01:00
Vadim Zeitlin
d40f0470da Don't use constexpr for operator|=(wxPGSetValueFlags)
g++ 4.8 doesn't support this and while we could make this constexpr
conditional on the compiler/language version, for now just don't make it
constexpr to fix the build quickly.
2023-02-20 00:35:18 +01:00
Vadim Zeitlin
ed362b62f6 Commit another file with std::underlying_type_t<> changes
This should have been part of the parent commit.
2023-02-20 00:28:42 +01:00
Vadim Zeitlin
08be6a74b3 Get rid of more std::underlying_type_t<> occurrences
See the previous commit.
2023-02-20 00:23:17 +01:00
Vadim Zeitlin
b77233bf43 Yet another build fix after recent wxPropertyGrid changes
Stop using std::underlying_type_t<>, it's C++14 and not provided by g++
4.8 that is still supposed to be supported.

Just use int instead, it's not like we need all this heavy and verbose
stuff anyhow for an enum declared using int as the underlying type just
a few lines above.
2023-02-20 00:03:33 +01:00
Vadim Zeitlin
b4ab8de248 Avoid deprecation warnings due to recent wxPropertyGrid changes
Rename the new overload of DoSetSplitterPosition() to use a different
name: not only this avoids deprecation warnings that broke all the CI
builds, but it also makes things more clear and simpler to use as all
the derived classes don't need to override both the deprecated overload
and the new one to avoid warnings about hiding a base class virtual
function and can just override the new one.

Also remove the default value "Refresh" for the flags which seems to be
inconsistent with the default value "Null" used elsewhere and prefer to
specify it explicitly.
2023-02-19 23:38:04 +01:00
Artur Wieczorek
74e599df7b Disable deprecation message 2023-02-19 23:36:59 +01:00
Artur Wieczorek
a22f5e97f9 Add missing header 2023-02-19 23:29:25 +01:00
Vadim Zeitlin
84ffb13c89 Fix compilation after last wxPropertyGrid change
Add missing "return" to deprecated HideProperty() overload to fix the
build with WXWIN_COMPATIBILITY_3_2 on after the changes of f1273ce152
(Use class enums to implement bitmask types, 2023-02-19).
2023-02-19 23:06:43 +01:00
Artur Wieczorek
c9934cbd83 Fix wxPGVIterator used in wxPropertyGridManager
Empty wxPropertyGridPages should be skipped when iterator is incremented
from the last wxPGProperty on one page to the first property on the next
page.
Empty pages should be skipped also when ierator is initially set
to point the first property.

Closes #23273.
2023-02-19 22:36:30 +01:00
Artur Wieczorek
f1273ce152 Use class enums to implement bitmask types
To improve type safety of flags.
2023-02-19 22:36:21 +01:00
Artur Wieczorek
dce28fe788 Mark deprecated variables as used internally
When v3.2 compatibility is enabled all deprecated variables are still
present and initialized.
2023-02-05 20:08:00 +01:00
Artur Wieczorek
159c3b1c6d Don't cache strings and variant values in wxPGGlobalVarsClass
Optimization gain is doubtful but complexity is high.
2023-02-05 19:07:25 +01:00
Vadim Zeitlin
0130282987 Create wxPGGlobalVars on demand and not on startup
This is slightly more efficient as it avoids allocating an object which
is possibly not ever going to be used on startup of any application
linking with the propgrid library (at the price of slower access to this
object, but this should never be done in performance-critical parts of
the code, hopefully) and avoids a problem with losing the previously
registered editors when re-initializing wx modules, as wxPython does.

Closes #23165.

See #23187.
2023-01-31 01:26:54 +01:00
Artur Wieczorek
e7b405ec08 Refactor internal flags in wxPropertyGrid
Move wxPropertyGrid and wxPropertyGridManager internal flags
from global namespace to the corresponding classes.
2023-01-22 20:18:40 +01:00