Commit graph

21192 commits

Author SHA1 Message Date
Vadim Zeitlin
b03ce7711b Merge branch 'gtk-enter-leave-window'
Fixes for wxGTK enter/leave window events.

Closes #11848.

See #24339.
2024-02-29 03:01:38 +01:00
Alex Shvartzkop
b4f435cbe8 Fix linking errors related to android_wcsto* functions. 2024-02-25 17:35:21 +03:00
Alex Shvartzkop
e10bf0c344 Implement wxWindow::GetWindowBorderSize() in wxQt
This notably fixes the appearance of wxSearchCtrl in this port.

Closes #24318.
2024-02-24 23:10:55 +01:00
Vadim Zeitlin
e88e16a964 Allow reusing wxGTK window enter/leave callback
Refactor the existing callbacks to make it possible to call them from
other places than src/gtk/window.cpp.

No real changes yet.
2024-02-19 00:40:30 +01:00
Vadim Zeitlin
9205da74db Generate wxEVT_ENTER_WINDOW in icon part of wxSearchCtrl in wxGTK
Mouse motion events happening over GtkEntry icons are consumed by this
class "event" callback, which simply returns GDK_EVENT_STOP for them if
the icon is insensitive (which is the case for GtkSearchEntry) and so
our "enter-notify-event" callback is never called.

Fix this by handling "event" signal ourselves and generating
wxEVT_ENTER_WINDOW from it if necessary.

Doing this required adding a global pointer to the window currently
under mouse, which is also used for generating wxEVT_LEAVE_WINDOW if
necessary.

See #24245.
2024-02-19 00:40:30 +01:00
Vadim Zeitlin
ccce75f3cc Stop using wxCOMMON_CALLBACK_PROLOGUE macro in wxGTK callbacks
No real changes, just simplify the code and stop using a macro
unnecessarily when we can use a simple inline function instead.
2024-02-18 17:54:15 +01:00
Doukas Dergiades
f24b3d5483 Save last wxSplitterWindow position before it was unsplit
Use this position when the window is split again and also save and
restore it from persistent storage in wxPersistentSplitter.

Closes #24329.
2024-02-18 01:23:24 +01:00
Blake Madden
7150e6ecb3 Make recently added wxRibbonPage::GetPanelCount() const
Closes #24333.

Closes #24334.
2024-02-16 19:37:24 +01:00
Vadim Zeitlin
63a40637eb Make wxXmlNode::GetDepth() parameter const
There is no need to require a non-const pointer here.

Closes #24317.
2024-02-16 14:24:40 +01:00
Blake Madden
3f7e1e8414 Add GetPanel(), GetPanelById() and GetPanelCount() to ribbon page
This provides parity with the ribbon bar's GetPage() set of functions,
and adds an easy way to find a panel and show/hide it.

Also, add example and discussion about showing/hiding panels on a
ribbon.

Closes #24319.
2024-02-16 00:26:33 +01:00
Vadim Zeitlin
4a5de60fa9 Merge branch 'wxqt-2' of https://github.com/dsa-t/wxWidgets
More miscellaneous wxQt fixes.

See #24309.
2024-02-13 21:43:48 +01:00
Vadim Zeitlin
e00e6dcd81 Merge branch 'qt-msgdlg-ext'
Add support for extended messages and custom button labels to
wxMessageDialog in wxQt.

See #24243, #24299.
2024-02-13 21:38:43 +01:00
Vadim Zeitlin
01ffca369c Merge branch 'translation-lookup-fixes' of https://github.com/vslavik/wxWidgets
Restore correct translation language lookup taking into account message
IDs language correctly when it is present in the preferred UI languages
but is not the first language in them and other similar corner cases.

Also add unit tests verifying that this code logic, already changed many
times in the past, does behave correctly now.

See #24297.
2024-02-13 21:34:00 +01:00
Vadim Zeitlin
79ac049d74 Merge branch 'wxqt-1' of https://github.com/dsa-t/wxWidgets
Make wxGLCanvas work in wxQt and fix possible crashes in wxComboBox and
wxStatusBar in this port.

See #24200.
2024-02-13 21:29:24 +01:00
Václav Slavík
1030147aff Fix AddAvailableCatalog() API
Knowing msgIdLanguage is necessary for correct evaluation of preferred
languages order; without it, it would be possible to load undesirable
translation file.

See 2af36e9560 for details.
2024-02-13 16:12:56 +01:00
Václav Slavík
2af36e9560 Partially revert "Add AddAvailableCatalog() and use it in AddStdCatalog()"
This commit partially reverts 94b1a17aeb.

The above commit changed translation lookup logic to differentiate
between msgid and "available" translations (the latter being loaded from
a file or resource). It first attempted to use available translations
and only felt back to msgid language as the last resort.

Unfortunately, doing that broke lookup in cases when the user had msgid
language as not-last preference in their UI languages list, or even when
a similar translation was available. For example:

- msgid=en, user preference [cs,en,fr], only fr.po available: fr would
  be used instead of en
- msgid=en_US or en, user preference [en], but en_GB.po available:
  British English would be used even for US users

This commit fixes this by restoring the previous behavior where msgid
language was treated as a first-class citizen in lookup, while
preserving the API that allows distinguishing between the two cases.

It also reimplements AddStdCatalog() in a more straightforward way that
doesn't rely on AddAvailableCatalog().
2024-02-13 16:12:38 +01:00
Alex Shvartzkop
afa4294ef1 Support SetLabel/GetLabel for wxRadioBox/wxRadioButton on wxQt. 2024-02-12 18:57:33 +03:00
Alex Shvartzkop
8730858eae Fix wxStatusBar crash when calling GetFieldRect early on wxQt. 2024-02-12 15:34:56 +03:00
Alex Shvartzkop
966b6e9460 Improve wxQt OpenGL canvas implementation:
- Support wxGLContext::SetCurrent.
- Pass GL canvas attributes via ParseAttribList to handle defaults.
- Remove OpenGL not implemented message.
- Prevent QGLWidget from changing OpenGL state before we paint.
- Set Qt::StrongFocus for wxQtGLWidget to allow keyboard input.
- Use QtCanPaintWithoutActivePainter to fix wxPaintDCImpl assert when using wxGLCanvas.
2024-02-12 15:34:56 +03:00
Vadim Zeitlin
d8d562ba1d Remove unnecessary QMessageBox forward declaration from header
This is not used at all.
2024-02-11 13:28:53 +01:00
AliKet
29c8bfc249 Use wxOverlay to show docking hint instead of transparent wxFrame
The main advantage of using wxOverlay over wxFrame, besides reduced
code complexity, is that the docking hint now works correctly under
Wayland which it didn't work before.

wxAUI_MGR_RECTANGLE_HINT now works everywhere (including wxGTK and wxOSX)

We simply use a bitmap to draw the venetian blinds hint instead of the
exotic and esoteric code using wxRegion.

wxGTK2 now uses graphics context for transparency. If not available, the hint
will be drawn using wxINVERT raster operation mode.
2024-02-09 23:26:36 +01:00
ali kettab
7491ac5b7a Make wxAUI and wxSplitterWindow work properly with wxOverlay under wxGTK2
This Workaround is needed because the DC used to draw on the wxOverlay clips
children by default under wxGTK2. This means that the sash will always appear
behind the sub-windows. making wxOverlay worthless under this platforms.

Notice that calling gdk_gc_set_subwindow() unconditionally in Destroy() is cheap
when DontClipSubWindows() has never been called.
2024-02-09 23:26:36 +01:00
ali kettab
a38175885c Use wxOverlay to show sash feedback in non-live resize mode in wxSplitterWindow
Make non-live resizing possible on all supported platforms thanks to wxOverlay.
Previously, live resizing was the only supported mode under these platforms:
wxMac, wxQt and wxGTK3 under Wayland.

Also remove no longer needed function AlwaysUsesLiveUpdate and its documentation.
2024-02-09 23:26:36 +01:00
ali kettab
fafc714057 Use wxOverlay to show sash feedback in non-live resize mode in wxAUI
Make non-live resizing possible on all supported platforms thanks to wxOverlay.
Previously, live resizing was the only supported mode under these platforms:
wxMac, wxQt and wxGTK3 under Wayland.
2024-02-09 23:26:35 +01:00
AliKet
7b75d0a256 Added per-pixel alpha blending capability to wxOverlay under wxMSW
By default, wxMSW overlay uses a constant alpha for the window's opacity which
can be changed by the added wxOverlay::SetOpacity() function. For some applications,
that's all they need. But for others, per-pixel alpha blending is a requirement.
This capability can be enabled by calling SetOpacity(-1) before initializing the
overlay. But the drawing must be done via a graphics context because the standard DC
under MSW does not support alpha drawing.

Also request that the overlay window be positioned below any floating windows
on the target (if any).
2024-02-09 23:26:35 +01:00
Paul Cornett
d8c5a87fe3 Partial fix for wxSearchCtrl mouse enter/leave events
The events only occur for part of the widget area,
but it's better than the previous nothing.
See #24245
2024-02-09 12:52:30 -08:00
Vadim Zeitlin
82cb7d1074 Merge branch 'generic-listctrl-center-label'
Fix centering of item label in generic wxListCtrl

See #2340, #24292.
2024-02-09 18:36:53 +01:00
Vadim Zeitlin
33ef342dcc Merge branch 'propgrid-xrc'
Add support for loading wxPropertyGrid from XRC.

See #24274.
2024-02-09 17:20:22 +01:00
Blake Madden
7555bba1bf Modernize ribbon code
The only real change in this commit is the use of wxRound() instead of
truncating cast to int when rescaling icons.

The rest consists of just some cleanup:

- Initialize (mostly) pointer member variables in their declaration.
- Remove wxT() from strings.
- Replace checks for __WXMAC__ with checks for __WXOSX__.
- Replace macros with lambda functions.
- Add "explicit"
- Replace wxString::IsEmpty() with empty().
- Use wxNOT_FOUND instead of -1.
- Use static_cast<> instead of C-style casts.

Closes #24261.
2024-02-09 17:04:43 +01:00
taler21
82b5f85418 Fix centering of item label in generic wxListCtrl
The item label was not centered if the icon is wider than the label.
2024-02-08 08:44:20 +01:00
Maarten Bent
c72f4efc9c Fix crash when closing a wxColourDialog under MSW
Check that ms_pfnSetThreadDpiAwarenessContext function pointer was
initialized before using it.

This fixes a regression introduced in 9befda5c26 (Only use
AutoSystemDpiAware when displays have different DPI, 2023-12-10).

See #24121, #24196.

Closes #24288.
2024-02-06 19:07:46 +01:00
Vadim Zeitlin
e20a994b1f Merge branch 'really-fix-cleanup'
Really fix logging during app cleanup.

See #24272.
2024-02-03 21:53:24 +01:00
Vadim Zeitlin
fe599e4757 Add wxXmlResourceHandler::GetNodeAttribute()
Add another helper function that can be used in XRC handlers without
using wxXmlNode directly.
2024-02-03 21:46:15 +01:00
Vadim Zeitlin
921018cfc8 Add wxXmlResourceHandler::GetNodeName()
This allows to get the name of the node which is needed for XRC handlers
using specific elements instead of using the object elements with
specific name attribute.
2024-02-03 21:46:15 +01:00
Vadim Zeitlin
9ab62c02fd Make wxXmlResourceHandlerImpl::GetNodeContent() const
There doesn't seem to be any reason not to and it's more consistent with
the other similar functions.
2024-02-03 21:46:15 +01:00
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
f513c08876 Add DLL export declaration to wxPropertyGridXmlHandler 2024-02-03 21:46:15 +01:00
Vadim Zeitlin
c965c87290 wxX11: don't call CleanUp() from wxApp::Exit()
This is not done in any other ports and shouldn't be necessary in this
one neither, CleanUp() will be called from wxEntryCleanup() later
anyhow.
2024-01-30 20:36:41 +01:00
Vadim Zeitlin
fb8d7b7de0 Take C string in wxLogger::MaybeStore() to simplify
We don't need to take wxString here, when we only ever call this
function ourselves with ASCII strings only.

This should result in slightly shorter generated code too, as the
conversion from C string to wxString now happens only in a single place
inside MaybeStore() instead of being done in all places calling
wxLogSysError() or wxLogStatus().
2024-01-30 18:47:06 +01:00
Vadim Zeitlin
10f235b43c Avoid implicit wxString conversions in wxLog{Status,SysError}()
They don't compile when wxNO_IMPLICIT_WXSTRING_ENCODING is defined.

Closes #24267.
2024-01-30 18:45:13 +01:00
Vadim Zeitlin
336a36e618 Initialize wxPropertyGridXmlHandler members in declaration
Ensure that m_pg is initialized to nullptr too.
2024-01-30 01:55:56 +01:00
Vadim Zeitlin
97762f854d Use forward declarations in wx/xrc/xh_propgrid.h
Only include the headers where they're really needed.
2024-01-30 01:55:56 +01:00
Vadim Zeitlin
d8d1fe2920 Use consistent name for the header guard
No real changes.
2024-01-30 01:55:56 +01:00
Vadim Zeitlin
cb36cb5e53 Add wxUSE_PROPGRID checks around wxPropertyGridXmlHandler
This is needed now that it's part of wx where it won't be always
compiled in.
2024-01-30 01:55:56 +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
194acf347f Add original wxPropertyGridXmlHandler code
This code was included in wxPropertyGrid standalone library before it
had been included in wxWidgets itself.

It doesn't compile yet, but will soon.
2024-01-30 01:55:14 +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
Bill Su
74f88f9131 Add wxRadioButton group support to wxGenericValidator
Enable wxGenericValidator(int*) to work with wxRadioButton groups
when applied to the first element of the group.  The value will be
the index of the selected button within the group.

Closes #24264.
2024-01-30 01:52:59 +01:00
oneeyeman1
91de9867ee Add wxStandardPaths::GetSharedLibrariesDir()
This function returns the directory with the application's shared
libraries, which is different from the plugins directory under Mac.

Closes #24052.
2024-01-28 18:41:20 +01:00
Scott Talbert
fc35ad92bb Remove unnecessary empty destructors
These cause a problem for GCC 14 which detects that there are no
corresponding copy constructors and assignment operators and gives
-Wdeprecated-copy-dtor due to their presence, e.g.

/home/fedora/swt2c/wxWidgets/bld/bk-deps g++ -c -o test_allheaders_allheaders.o  -I/home/fedora/swt2c/wxWidgets/bld/lib/wx/include/gtk3-unicode-3.3 -I../../include -D_FILE_OFFSET_BITS=64 -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/atk-1.0 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/at-spi2-atk/2.0 -I/usr/include/cloudproviders -I/usr/include/webp -I/usr/include/blkid -I/usr/include/at-spi-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/pixman-1 -I/usr/include/libxml2 -I/usr/include/fribidi -I/usr/include/sysprof-6 -pthread -I/usr/include/libpng16 -DWITH_GZFILEOP  -D__WXGTK__      -I../../tests -DWXUSINGDLL -I../../tests/../samples -I../../3rdparty/catch/single_include -pthread -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -O2 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libmount -I/usr/include/libxml2 -I/usr/include/sysprof-6 -I/usr/include/libpng16 -DWITH_GZFILEOP -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/webp -I/usr/include/gtk-3.0/unix-print -I/usr/include/gtk-3.0 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/cloudproviders -I/usr/include/at-spi-2.0 -I/usr/include/gio-unix-2.0  -fvisibility=hidden -fvisibility-inlines-hidden -fPIC -DPIC   ../../tests/allheaders.cpp
In file included from ../../include/wx/evtloop.h:13,
                 from ../../tests/testprec.h:5,
                 from ../../tests/allheaders.cpp:369:
../../include/wx/event.h: In copy constructor ‘wxSetCursorEvent::wxSetCursorEvent(const wxSetCursorEvent&)’:
../../include/wx/event.h:1943:11: error: implicitly-declared ‘wxCursor::wxCursor(const wxCursor&)’ is deprecated [-Werror=deprecated-copy-dtor]
 1943 |           m_cursor(event.m_cursor)
      |           ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../include/wx/cursor.h:51,
                 from ../../include/wx/event.h:21:
../../include/wx/gtk/cursor.h:37:13: note: because ‘wxCursor’ has user-provided ‘virtual wxCursor::~wxCursor()’
   37 |     virtual ~wxCursor();
      |             ^
../../include/wx/event.h: In member function ‘void wxSetCursorEvent::SetCursor(const wxCursor&)’:
../../include/wx/event.h:1949:57: error: implicitly-declared ‘wxCursor& wxCursor::operator=(const wxCursor&)’ is deprecated [-Werror=deprecated-copy-dtor]
 1949 |     void SetCursor(const wxCursor& cursor) { m_cursor = cursor; }
      |                                                         ^~~~~~
../../include/wx/gtk/cursor.h:37:13: note: because ‘wxCursor’ has user-provided ‘virtual wxCursor::~wxCursor()’
   37 |     virtual ~wxCursor();
      |             ^

Fixes #24248.

Closes #24255.
2024-01-28 18:16:07 +01:00