Commit graph

21195 commits

Author SHA1 Message Date
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
Vadim Zeitlin
30c8c64e45 Allow changing wxWebViewBackendChromium data directory path
Use the value provided via wxWebViewConfiguration::SetDataPath() if any.
2024-01-06 03:20:50 +01:00
Vadim Zeitlin
416e241e6a Add wxWebViewConfigurationImplChromium scaffolding
It is perfectly useless for now, but provides place to add more things
in the upcoming commits.
2024-01-06 03:20:50 +01:00
Vadim Zeitlin
bddd46d343 Disable wxDeprecatedGUIConstants comparisons without 3.2 compat
Start preparing for removing these deprecated comparison operators.
2024-01-06 02:06:31 +01:00
Vadim Zeitlin
020f22de15 Define comparison and arithmetic operators as hidden friends
Change these operators in all the other classes to hidden friends too.
2024-01-06 02:06:31 +01:00
Vadim Zeitlin
09515ad4ce Make wxString and wxUniChar comparison operators friends too
Don't define them in the global scope to improve error messages.

Also move the rest of wxString operators into the class scope.
2024-01-06 02:06:31 +01:00
Vadim Zeitlin
acb24e7066 Don't define operators on common GDI classes in global scope
Use "hidden friend" idiom instead and define these operators as friend
functions inside the corresponding class scope, so that they're only
found using ADL and, in particular, don't appear as candidates when
looking for any operator.

In practice, this significantly reduces the error messages given if some
operator (e.g. "==") is applied to a type not defined it, as the
compiler doesn't need to consider converting this type to wxPoint,
wxRealPoint, wxRect, wxSize etc, nor to complain about failing to do it.
2024-01-06 01:29:24 +01:00
David Miguel Susano Pinto
68bef2fbf3 Add compound operators * and / to wxPoint and wxRealPoint
Also add unit tests for them as well as for the existing additive
compound operators.
2024-01-05 19:34:43 +01:00
David Miguel Susano Pinto
1300c56f0d Put wxRealPoint operators in the same order as wxPoint ones 2024-01-05 19:31:14 +01:00
David Miguel Susano Pinto
11c3034177 Implement unary minus for wxRealPoint, same as wxPoint. 2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
b9b0cce41b include/wx/gdicmn.h: reorder to match the order in interface/wx/gdicmn.h. 2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
66e7d0bce8 Implement + and - between wxRealPoint and wxSize.
These operators are part of the documented interface for wxRealPoint
but were never implemented.  This commit implements them.
2024-01-05 12:44:11 +00:00
David Miguel Susano Pinto
8ccbd7e95d Implement operator/=(int) and operator*=(int) for wxPoint and wxRealPoint.
These operators are part of the documented interface but were never
implemented.  This commit implements them.
2024-01-05 12:43:57 +00:00
David Miguel Susano Pinto
9a5d2ffade Correct names of variables in wxPoint and wxRealPoint arithmetic operators.
The arithmetic operators for wxPoint and wxRealPoint are quite
repetitive and were made by copy-paste from the wxSize operators.
Because of that, some of the names are a bit misleading which this
commit changes.  The changes are:

1. replace s/sz with p/pt for point variables (likely 's' comes from
   copied code used for wxSize variables)

2. replace 'i' with 'f' for floating point types (likely 'i' comes
   from copied code used for integer types)

3. replace 'factor' with 'divisor' for division operations (factors
   are the multiplication operands, not division)
2024-01-05 11:28:11 +00:00
Vadim Zeitlin
8655d7bb95 Add wxEVT_WEBVIEW_CHROMIUM_MESSAGE_RECEIVED
This allows to handle IPC messages from custom JS functions in the code
using wxWebViewChromium.
2024-01-05 01:43:32 +01:00
Vadim Zeitlin
3dde6bdeb0 Disable swap interval in GLX wxGLCanvas implementation too
We need to do it when using XWayland for the same reasons as we had to
do it in the EGL version when using either XWayland or Wayland directly:
without this, we can block for up to 1 second in glXSwapBuffers() if the
window is hidden, see #23512.

Closes #24163.

Closes #24165.
2024-01-05 01:05:30 +01:00
David Miguel Susano Pinto
11ebffe7b0 Add operator/(wxPoint, double) and operator/(wxRealPoint, double)
Do this for consistency with wxSize which already had this operator/()
overload and operator*() in these classes which was already overloaded
for double.

Closes #24185.

Closes #24187.
2024-01-05 00:45:57 +01:00
Paul Cornett
cd93c73900 Remove another reference to GLU
Should have been part of ce1d317768 (Remove GLU dependency, 2023-12-28)
2024-01-04 12:22:39 -08:00
Vadim Zeitlin
486865b446 Add wxFileConfig::MigrateLocalFile()
This can be useful for the existing applications switching to using
XDG-compliant config files location as they can just call this function
on startup to keep using the existing file.
2024-01-04 03:23:37 +01:00
Vadim Zeitlin
ebe0847932 Add wxHAS_CONFIG_AS_{REG,FILE}CONFIG symbols
Sometimes it's useful to have some code used only if wxConfig is defined
as wxRegConfig or only if it is defined as wxFileConfig and testing for
these symbols is more clear than testing for the platform (and more
correct, considering that setting wxUSE_CONFIG_NATIVE to 0 may result in
wxFileConfig being used even under Windows).
2024-01-04 02:55:05 +01:00
Vadim Zeitlin
3de2e479fc Add wxAuiTabCtrl::DoShowTab() helper
No real changes, just add a function ensuring that the tab is shown.

It's not really clear why the existing code sometimes calls
MakeTabVisible() after SetActivePage() and sometimes doesn't, and
perhaps it should actually always do it, in which case this function
could be merged with SetActivePage() to do everything at once, but for
now keep the changes minimal.
2024-01-03 19:05:51 +01:00
Vadim Zeitlin
3093d7ad4f Add wxCONFIG_USE_XDG to use with wxFileConfig
Using this style allows to tell wxFileConfig to use XDG-compliant
location for the user configuration file, even when not using XDG file
layout for wxStandardPaths, which can be convenient when modifying the
existing application using wxStandardPaths for other files locations
too.

And using it in combination with wxCONFIG_USE_SUBDIR allows to put the
config file in a XDG-compliant subdirectory, which wasn't easily
possible at all before.
2024-01-02 02:18:45 +01:00
Vadim Zeitlin
d1e223d531 Add [[nodiscard]] attribute to wxStandardPaths::AppendAppInfo()
It doesn't make sense to call this function and ignore its return value,
but it may happen accidentally as it might seem that it modifies its
parameter.
2024-01-02 02:16:05 +01:00
Vadim Zeitlin
d56cf71466 Add wxStandardPaths::Dir_Config
This allows using GetUserDir(Dir_Config) to retrieve XDG-compliant
location of the configuration files, independently of the file layout
used by the global wxStandardPaths object.

Recommend using this directory instead of GetUserDataDir() for multiple
configuration files under Unix.
2024-01-02 02:07:25 +01:00
Vadim Zeitlin
72c164f28c Make wxStandardPaths::AppendAppInfo() public
This function can be useful to the application code and will be used by
wxFileConfig in the upcoming commits.
2024-01-02 01:57:04 +01:00
Vadim Zeitlin
20845d85a5 Deprecate "encoding" parameter of wxXmlDocument ctor and Load()
This parameter wasn't used for anything as it specified the encoding of
the data contents in memory and not the encoding of the XML file as
might be believed, so it only created unnecessary confusion.

See #24167.
2024-01-01 22:08:28 +01:00
Vadim Zeitlin
0b049be4b7 Use unique_ptr<> in wxXmlDocument
Replace manual use of raw pointer with std::unique_ptr<>.

No real changes.
2024-01-01 20:54:08 +01:00
Vadim Zeitlin
2a5eac26f4 Remove unnecessary calls to wxDELETE()
Replace them with just calls to delete as it doesn't matter if the
pointer is null or not in all these cases and using just "delete" is
more clear.
2024-01-01 20:54:08 +01:00
Vadim Zeitlin
326876eb60 Initialize wxXmlDocument::m_docNode in its declaration too
Similar to the previous commit.
2024-01-01 20:54:08 +01:00
Vadim Zeitlin
08ef52671f Initialize wxXmlDocument::m_fileType and m_eol in declaration
This is simpler and more clear than calling SetFileType() from all
ctors.

Also m_eol
2024-01-01 20:53:53 +01:00
Martin Corino
6ee9056c16 Fix column reordering in wxHeaderCtrlSimple and related problems
Override required functions in wxHeaderCtrlSimple to avoid asserts if
its columns are reordered.

Also bring the code behaviour in agreement with the documentation by
calling UpdateColumn() after calling UpdateColumnVisibility().

Finally, only call UpdateColumnsOrder() if the corresponding event was
not processed as the application should use one xor the other mechanism
for reacting to columns reordering, but not both.

Closes #24108.

Closes #24172.
2023-12-31 17:57:19 +01:00
Paul Cornett
ce1d317768 Remove GLU dependency
See #23721
2023-12-28 14:49:42 -08:00
Paul Cornett
fc8a780932 Avoid applying "no-window" mouse coordinate conversion to generic wxWindow
For a wxPizza widget in a GtkScrolledWindow, the coordinates are already correct.
2023-12-28 12:32:59 -08:00
Vadim Zeitlin
a942fb1774 Merge remote-tracking branch 'MaartenBent/chromium' into webview-chromium
Fix CMake support.
2023-12-28 18:57:07 +01:00
Vadim Zeitlin
7a306c4a42 Merge branch 'qt-fixes' of https://github.com/AliKet/wxWidgets
Many wxQt improvements and simplifications.

See #24135.
2023-12-27 02:57:14 +01:00
ali kettab
aa562ea2fb Get rid of QtCreateControl() from wxQt code base
If possible, all windows should call wxWindow::Create() on creation now,
because among other things:
- It manages generic and non-generic windows uniformly and transparently
- It ensures an appropriate initial size for the window
- AddChild() and PostCreation() are automatically called
- Scrollbar policies are set in one place.
2023-12-26 22:50:59 +01:00
Vadim Zeitlin
3e32e0fa67 Allow using non-live resize in wxAUI with wxGTK3/X11
In this case we can still use wxClientDC, so let people do it if they
really want to for consistency with wxSplitterWindow and because it
doesn't really cost us anything.
2023-12-26 19:27:50 +01:00
Vadim Zeitlin
1d328aa4e1 Add wxSplitterWindow::AlwaysUsesLiveUpdate()
This is similar to wxAuiManager::AlwaysUsesLiveResize() and does the
same thing, i.e. returns true if live update is always used, whether
wxSP_LIVE_UPDATE is enabled or not.

Use the new function in the sample to disable the menu item in the
environments where it doesn't do anything, as it was confusing to have
it under e.g. Wayland.
2023-12-26 19:27:50 +01:00
Vadim Zeitlin
24fd54ed31 Add wxClientDC::CanBeUsedForDrawing()
This function can be used to check if drawing on wxClientDC actually
works. This has to be a run-time, rather than compile-time, check
because in wxGTK3 this depends on the backend being used: wxClientDC
only doesn't work with Wayland, but does work with X11 (and, less
importantly, Win32) backend(s).

Currently the wxWindow parameter of this function is not used but it
could be useful in the future and it will be simpler to allow not
specifying it (by defaulting it to nullptr) than to add it later, so it
seems better to have it.
2023-12-26 19:27:50 +01:00
ali kettab
69ec562f16 Update outdated comments under wxQt
There is no longer a QtGetContainer() function name. wxQtEventForwarder was renamed
to wxQtEventSignalHandler. And QtGetScrollBarContainer() was just removed in previous
commits.
2023-12-26 12:45:52 +01:00
ali kettab
840d362a70 Keep forward declarations of Qt classes in alphabetical order 2023-12-26 12:45:52 +01:00
ali kettab
31aac5fac4 Get rid of QtGetScrollBarsContainer() from wxWindow API under wxQt
Because It is simpler to initialize (the inherited) m_qtContainer member
directly in derived classes during construction process, and make the API
a little bit cleaner.
2023-12-26 12:45:52 +01:00
ali kettab
5fb8a54e14 Change the return type of QtGetScrollBarsContainer() under wxQt
Neither QListWidget nor QTextEdit derive from QScrollArea and the cast to it is
just UB. Instead, using the common base class QAbstractScrollArea is safer and
eliminates the need to these dangerous and insidious crosscast'ings.
2023-12-26 12:45:52 +01:00
ali kettab
484785fb88 Override {Set,Is}DoubleBuffered() under wxQt
Closes #24136.
2023-12-26 12:45:52 +01:00
ali kettab
d44408d448 Fix wxScrollWindow not scrolling by mouse dragging under wxQt
Get rid of wxQtInternalScrollBar and use QScrollArea's scrollbars instead.
2023-12-26 12:45:52 +01:00
ali kettab
6a76e7a610 Fix wxPaintDC under wxQt after the last commits
The {menu,tool,status} bars will not be painted correctly otherwise.
2023-12-26 12:45:52 +01:00
ali kettab
1a7f1ccc85 Add missing override to wxQtEventSignalHandler 2023-12-26 12:45:52 +01:00