It was previously available only in the generic version which was used
by wxGTK and wxUniv, add it to the other ports too as it's going to be
needed in the upcoming commit.
In wxMSW this required storing the accelerators, as it is simpler than
converting them back from the native HACCEL and more consistent with the
other ports that already did this.
Add the new function checking if a (key) event and wxAcceleratorEntry
correspond to the same key combination.
This was already used in the generic wxAccelerator implementation and
wxOSX and will be used in the other ports too soon, so move this code
into common function.
It can also be useful for the applications, so document it as well.
In wxMSW, single line read-only wxTextCtrl doesn't accept focus from
keyboard, so keyboard and screen reader users can't Tab to it and read
its contents.
Add wxWindow::EnableFocusFromKeyboard(), the counterpart of the existing
DisableFocusFromKeyboard(), to let the application allow this.
Update the documentation and add a wxMSW-only unit test.
Fixes#10760.
Closes#27054.
MSW cross-builds / wxMSW 64 bits not compatible (push) Canceled after 0s
MSW cross-builds / wxMSW/Univ (push) Canceled after 0s
MSW cross-builds / wxMSW 32 bits (push) Canceled after 0s
Code Checks / Check Spelling (push) Canceled after 0s
Code Checks / Check Whitespace (push) Canceled after 0s
Code Checks / Check Mixed EOL (push) Canceled after 0s
Code Checks / Check C++ Style (push) Canceled after 0s
Code Checks / Check All Headers In allheaders.h (push) Canceled after 0s
The generic collapsible header, used by wxCollapsiblePane and so by the
generic about dialog, had two problems for keyboard and screen reader
users under MSW:
- Pressing Enter on the header activated the default button of the
dialog. In wxAboutBox this closed the dialog. Enter now toggles the
header, the same as Space.
- Screen readers could not tell what the header was or if it was open.
It now reports itself as a button with an expanded or collapsed state,
sends a state change event when it toggles, and has a default action.
This also stops screen readers from reading the label twice.
Closes#27048.
When the generic wxInfoBar showed a message, screen readers said
nothing, so their users did not know it had appeared.
The info bar now has the alert accessible role with the message as its
name, and sends an alert event every time ShowMessage() is called. NVDA
reads the message when it is shown, and also when a new message is shown
while the bar is already visible.
Closes#27053.
The generic wxInfoBar was a plain wxControl, not a container, so Tab
gave focus to the info bar window itself and never moved to the close
button or other buttons inside it.
wxInfoBarGeneric now derives from wxNavigationEnabled, the same as
wxGenericCollapsiblePane, so Tab moves to the buttons inside it.
Closes#27052.
Buttons that show only a bitmap have no label, so screen readers only
announce them as "button". This affects, for example, the buttons of
wxEditableListBox and the close button of the generic wxInfoBar.
When a button has no label but has a tooltip, its tooltip is now used as
its accessible name. Buttons with a label are not changed.
Closes#27051.
Implement DoGetBestClientWidth() so that the control can compute the
appropriate width when its height is known, as is the case when it's
used as wxTreeBook controller: this prevents the appearance of ugly
and unnecessary horizontal scrollbar in this case.
Add a unit test checking that the best size is computed correctly.
Closes#26097.
Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>
Change wxRichTextEvent::m_char to be of type wxUniChar and not wxChar.
This is mildly backwards-incompatible but the break is arguably worth
not adding some new GetUnicodeCharacter().
wxChar can't hold all possible characters under MSW, so prefer using
wxUniChar even if it's not clear if this have any practical benefits in
this particular case.
Recombine the 2 WM_CHAR messages we receive for high and low surrogate
pair into a single Unicode character which can be retrieved using the
new wxKeyEvent::GetUnicodeChar() member function.
Update documentation and comments to recommend using the new function
instead of GetUnicodeKey().
Also update the keyboard sample to use it to be able to show events for
supplementary characters under MSW.
Closes#25135.
wxConvFileName may not be initialized yet and there is nothing we can do
about this because it has to remain a simple variable to allow setting
it.
However we can change wxConvFile and wxFNCONV to use wxGetFileNameConv()
accessor function which ensures that we initialize wxConvFileName before
using it at least via these functions.
Also update a couple of direct references to wxConvFileName in the code
which might conceivably be used at this stage.
Add wxWindow::UpdateInputMethodCursorRect() which can be used to let the
IME know where to place its window and use it in wxGrid to show it near
the cell being edited.
See #24558.
Implement it in wxMSW, wxGTK and wxOSX.
This will be used to prevent IME window from appearing for windows that
currently don't accept keyboard input even if they accept focus.
Iterate over the animation manually to find the frame we need.
Update the sample to allow showing individual animation frames.
Closes#27009.
Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>
Previously wxString::Format("%c", wxUniChar{0x1F600}) produced broken
"\uF600" under MSW because this was all that fit into a wchar_t there
which can only contain 16-bits. And using "%d" or "%x" was broken in the
same way, as wxArgNormalizer<wxUniChar> always used wx_truncate_cast()
to wchar_t which is not lossless when sizeof(wchar_t)==2.
Fix this with the following horrible/ingenuous/crazy (choose your own
adjective) hack: because we can't fit supplementary Unicode characters
into a wchar_t, don't even try doing it and instead inject the bytes
representing the character into the format string itself (suitable
padded/aligned depending on the formatting flags) and replace the
format specifier used for wxUniChar with "%.0d" and feed it 0, which
ensures that no output is produced for it.
This can be done with surprisingly little amount of changes and should
be completely transparent to any code not formatting wxUniChars outside
of the BMP -- while such code will now behave correctly, instead of
silently producing wrong output as before, under MSW too.
Note that we do this unconditionally, i.e. without preprocessor checks
for SIZEOF_WCHAR_T, even if old code worked when it was 4, because using
the same code under all platforms should make finding and fixing bugs in
it simpler and also because this code is already hairy enough to not
need any extra complications.
No real changes yet, just add a function with a name indicating that it
can do more than just validate the format string (because it will soon)
and call it instead of Validate().
The worker thread checked whether a watch was still used by looking it up
in wxFSWatcherImpl::m_watches, which is modified by the main thread in
Add(), Remove() and RemoveAll() without any locking. And even with the
locking added in wxIOCPService, the watch could still be removed between
checking for its removal and starting a new read for it, leaving a pending
read on a watch nobody uses any more.
Check whether the watch was scheduled for removal and start the new read
while holding the wxIOCPService lock, and complete the removal instead if
it was.
Also register the watch with wxIOCPService before starting the first read
for it, so that the worker thread can't get a completion for a watch it
doesn't know about yet.
Set custom painting mode for dark mode in MSWSetDarkOrLightMode()
because custom painting mode is not set in Create() when double
buffering.
Fixes#27004.
Closes#27007.
This was broken since f24b3d5483 (Save last wxSplitterWindow position
before it was unsplit, 2024-02-12) which accidentally used the wrong
lastSplitPos component when restoring.
Just use {Save,Restore}Coord() to restore the columns widths instead of
{Save,Restore}Value() to rescale the saved values if necessary.
Add a unit test checking that this works as expected.
Add support at wxPersistentWindow level for saving the DPI at which the
window coordinates were saved to allow rescaling the values by the ratio
of this DPI to the current one if the DPI has changed between saving and
restoring.
This allows keeping the same proportional size of the window after DPI
change on the platforms not using DPI-independent pixels (such as wxMSW)
too by just using the new {Save,Restore}Coord() functions instead of
{Save,Restore}Value() for any quantities that need to be scaled.
Do this for wxPersistentTLW to update the window size to remain
proportionally the same after DPI change.
The existing Flush() only called fflush() but this is not enough to
really flush the file to the disk.
We can't start calling fsync() from Flush() as this may significantly
slow down the existing code. We could add a separate Sync() but as it
almost always makes sense to flush the file before syncing it, add a new
function doing both at once instead.
Don't duplicate the same code in both classes, it has already diverged
in the past and could do it again, so extract it into a common function
and just call it from both places.
No real changes, this is just a refactor.
Copy the target attributes that are easy to copy and make sense to
preserve under Windows too instead of only doing it under Unix in
wxTemp{F,}File and do it in a new wxFileName::CopyAttributesFrom()
function instead of duplicating the same code in both classes.
The new function can be potentially useful on its own, so make it public
and document it.
Add a unit test verifying that the attributes are preserved after
overwriting the file with wxTemp{F,}File.
No real changes, just for consistency with the other classes, we add an
accessor that returns the actual Qt widget type used by wxFontDialog.
The base class already has m_fontData, so the unused member m_data was removed.