Add wxFileDialog::GetCurrentlySelectedFilterIndex() similar to the
existing GetCurrentlySelectedFilename(), which can be used to retrieve
the index of the currently selected filter and update the state of the
extra controls in wxFileDialog accordingly.
Implement this for wxMSW only by updating the internally stored value
from the native CDN_TYPECHANGE notification and also generating a
wxEVT_UPDATE_UI event to allow the extra controls to update themselves.
Closes https://github.com/wxWidgets/wxWidgets/pull/1310
We need implement copy ctor and assignment operator because we are going to do a shallow copy of wxPGHashMapS2P data member and therefore we have to manually update reference counters of the objects being referenced in this map.
Notification about changes of column widths needs to be sent locally from wxPropertyGrid to wxPropertyGridManager (to update the header) so it would be good to use a dedicated non-public event type for these purposes.
The solution with specializing std::iter_swap() for wxString::iterator
was not conforming as the iterator was still not swappable, as it is
required to be.
Fix this by providing std::swap() overload for wxString::iterator, which
is correct and even simpler.
This allows std::reverse(s.begin(), s.end()) work with clang too and
incidentally avoids warnings about the code relying on non-conforming
extensions with MSVS 2017 which were due to the fact that iter_swap()
workaround wasn't enabled for it, while the new swap() overload is.
This attribute is used only internally in wxArrayStringProperty and thus can be considered as a built-in attribute which value can be stored in the local data member and not in the property's attribute store.
The scrollbar wasn't shown when the control became only slightly more
narrow than its contents, resulting in truncation of the rightmost part
of the strings shown in it.
Fix this by accounting for the check box explicitly in wxListBox
SetHorizontalExtent() method using the new MSWGetFullItemSize() helper
which is also used to avoid code duplication between wxCheckListBox
MSWOnMeasure() and DoGetBestClientSize() methods.
Closes#18377.
No real changes, just rename the members to use the standard prefix
which is more consistent with the rest of wxWidgets and also allows to
avoid both the hacks with "foo_" names for the arguments of some
functions that were used to avoid the conflicts with member "foo" and
at least one remaining shadowing warning for "exitcode".
__clang_analyzer__ is a constant that only is defined during analyze build, this helps avoiding false positives as long as there is no specific way to silence analyzer messages
Both attributes are used only in wxBoolProperty and wxFlagsProperty to set respective internal flags and don't have to be stored in the property's attribute store.
Provide a way to retrieve the name of the current system appearance
(mostly for diagnostic purposes) and check if it uses predominantly dark
colours.
Currently this class has a non-trivial (but still very simple)
implementation under macOS only and simply checks whether the default
text colour is brighter than the default background colour under the
other platforms, but other platform-specific implementations could be
added later.
Also update the drawing sample "system colours" page to show the system
appearance as well.
Send events from generic wxColourPickerCtrl when the currently selected
colour in the dialog shown by it changes and when this dialog is
cancelled.
Notice that currently this only works on wxMSW as it relies on
wxEVT_COLOUR_CHANGED support in wxColourDialog which is only available
there.
Based on work of Trylz, see https://github.com/wxWidgets/wxWidgets/pull/1219
Add support for a new event sent by wxColourDialog, currently only under
MSW, when the colour currently selected in it changes.
Based on work by Trylz, see https://github.com/wxWidgets/wxWidgets/pull/1219
The advantage of using this compiler builtin instead of our own platform
checks is that the compiler will warn us (if -Wunguarded-availability is
turned on for APIs introduced before 10.13 or by default for later ones)
if a check is forgotten, which is not the case for the manual checks.
Update the code to use WX_IS_MACOS_AVAILABLE() macro, which expands to
__builtin_available() when supported, and also use API_AVAILABLE() where
it makes sense to avoid having too many checks.
Commit 58d4b0e209 introduced a regression:
if a previous popup still existed when the new one was shown, dismissing
the second popup would result in the owner window losing its "active"
appearance.
This was due to the fact that ::GetActiveWindow() still returned the
former popup when it was about to be dismissed, so it was too early to
call it in WM_NCACTIVATE handler. Do it now in DismissOnDeactivate()
itself which is both simpler and more correct.
There were at least 2 problems when showing a transient popup while
another one was already shown in wxMSW, as could be seen by showing
several wxRichToolTips in a row from a timer event handler, for example:
First problem was that wxCurrentPopupWindow was incorrectly reset in
this case by the old popup window when it was hidden, even though it
should have been remaining set to the new popup window. Fix this by
checking that we only reset wxCurrentPopupWindow when hiding the popup
if it still points to this popup, but not if it has been changed to
point to another one in the meanwhile.
Second problem was more mysterious and resulted in simply not receiving
the activation events for the new popup when showing it resulted in
hiding the previous one. The working hypothesis is that hiding a window,
which changes activation on its own, from WM_NCACTIVATE handler in our
code confused ShowWindow(), which handles switching activation, which
didn't expect this to happen, so the fix is to avoid doing anything
immediately from this handler and wait until the next idle event to do
it instead.
These fixes ensure that showing several popups in a row works correctly,
i.e. hides the previous popup when a new one is shown and also keeps the
parent window appearing active during all the time and deactivates it if
the focus switches to another top level window at the end.
Information about display cached in wxDisplayFactory::m_impls and in
wxDisplayFactoryMSW::m_displays could get out of sync after removing a
display from the system, resulting in failures when calling various
wxDisplay functions later.
To fix this, reuse InvalidateCache() to invalidate the cache in
wxDisplayFactoryMSW too, making it virtual in order to allow overriding
it there. Also call InvalidateCache() from wxDisplayFactoryMSW itself
instead of doing it from wxWindow, as this works even when the
application isn't showing any windows (and also keeps all
display-related code together).
Closes https://github.com/wxWidgets/wxWidgets/pull/1246
This works around gcc -Wredundant-decls warning that was given (if
explicitly enabled) when both wx/vector.h and wx/utils.h were included.
The workaround is ugly, but it doesn't seem worth it to introduce a
separate wx/qsort.h header just for this single function, which seems to
be the only other way to fix this.
Closes https://github.com/wxWidgets/wxWidgets/pull/1271
In this case wx-specific RTTI is used and GetWxTypeId() method was
overridden without using wxOVERRIDE, which resulted in dozens of
warnings for each translation unit.
In wxMSW, a focused wxRadioButton is always checked, which meant that
checking a wxRadioButton while focus was not in the window containing it
and later giving the focus to that window could uncheck it by giving
focus to another wxRadioButton that had had it previously.
Fix this by adding WXSetPendingFocus() to wxMSW wxWindow and calling it
from wxRadioButton::SetValue() to ensure that when the focus is
regained, it goes to the newly checked radio button and not some other
one.
This replaces the previously used, for the same purpose, wxMSW-specific
wxTopLevelWindow::SetLastFocus(), so while this solution is not exactly
pretty, it's not worse than we had before, while being more generic.
Also add a unit test checking that things work correctly in the scenario
described above.
Closes https://github.com/wxWidgets/wxWidgets/pull/1257Closes#18341.
OnValidationFailure() in derived class wxEnumProperty has the same implementation (empty body) as the implementation in the base class wxPGProperty so overriding this function in derived class is not necessary.
- Remove duplicate wxConsoleAppTraits::CreateEventLoop()
It's already defined for Unix as well as Windows
- Remove wxEventLoop AddSourceForFD() "override"
the base version is static and therefore clearly not meant to be overridden
Encapsulate the logic for deciding whether we should show the labels for
the embedded controls or not in a small helper function, to make it
simpler to change it in the future if needed and also to have a single
place to explain why do we do what we do now.
No real changes.
It calls Append(void*), which calls the pure virtual CreateNode(), which will
crash, as the required override can't be called from the base class ctor.
These checks are already performed in wx/chkconf.h and don't need to be
redone here, especially incorrectly (testing for "!wxUSE_FILESYSTEM"
inside "#if wxUSE_FILESYSTEM" is useless).
It seems wrong to have this function in wxGraphicsContext only and not
in wxGraphicsRenderer, as this makes it impossible to create a context
associated with a non-default renderer while it doesn't cost us anything
to allow doing this.
The original drawing mechanism was generating lots of QWarning messages
when running samples (e.g. htlbox, caret, etc.) and in some cases was
not actually completely drawing every element of the sample. The issue
was that the QPicture was being shared incorrectly between wxWindow and
wxClientDC and attempts to start painting, update, etc. were generating
console warnings.
Closes https://github.com/wxWidgets/wxWidgets/pull/1152
To get access to the control used for editing items, we need to create
it ourselves, which involves defining our own factory for doing this,
but seems to be the only way of achieving our goal.
Closes https://github.com/wxWidgets/wxWidgets/pull/1204
Similarly to the previous commit, it doesn't seem to be worth it to
avoid including these simple and common headers from there and it
simplifies code and will allow making the converter functions inline.
Follow standard practice and include the header corresponding to the
source file from it explicitly.
Also include wx/gdicmn.h from the header itself, this is a pretty common
header and there is no real advantage in avoiding it there and including
it allows to avoid a bunch of forward declarations.
Harmonize events sent by wxNotebook::AddPage(): they are now sent only
when adding any page except the first one if it is selected in all
ports.
See https://github.com/wxWidgets/wxWidgets/pull/1192
No real changes, just clean up sources by removing trailing spaces from
all the non-generated files.
This should hopefully avoid future commits mixing significant changes
with insignificant whitespace ones.
Under some (not totally clear) circumstances, a TLW can remain inactive
after being shown, which is undesirable, as it prevents setting focus to
its children from working.
Work around this by calling activateWindow() explicitly if necessary.
Closes https://github.com/wxWidgets/wxWidgets/pull/1179
This uses the cursor variant (as opposed to the icon one) since these actually are cursors, the base class looks like cursors are meant to be used, and the icon thing looks like a hack.
Having this method didn't really help, it's simpler and more
straightforward to implement ChangeSelection() as a signal-blocking
wrapper around SetSelection() instead.
No real changes in behaviour, this is a pure refactoring.
We ended up not needing the underlying QMimeData-based implementation, as the classes sitting on top of it
bypassed it anyway. It now treats the hierarchy as a pure data storage mechanism, generating the
QMimeData when drag-drop is initiated.
Kept "mime type" and "id" conceptually separate in the interface in case they need to diverge later.
Got rid of the odd "wxChar *" variants and the QString one.
Implemented unimplemented "type" functions.
Implemented "!=" in terms of "==", to keep from having two places to keep in sync.
Several wxRadioBox-related improvements:
- Fix its minimum width calculation to take the title into account.
- Remove unused nor useful wxRA_LEFTTORIGHT and wxRA_TOPTOBOTTOM.
- Tidy up the radiobox page of the widgets sample.
See https://github.com/wxWidgets/wxWidgets/pull/1187
This restores the default behavior of a popup window in MSW to the
behavior it had before 56c4191168. The new
flag added by this commit can be used to give the popup window the
behavior from after that commit, i.e. choose the implementation using a
WS_POPUP window rather than the default one using a WS_CHILD of the
desktop.
The old behavior kept the popup from taking focus from its parent window
but left some controls not working. The new behavior has the popup take
focus and lets all controls work.
Closes https://github.com/wxWidgets/wxWidgets/pull/1123
Including <winsock.h> and <winsock2.h> is incompatible and if the
application wants to use the latter, it may be convenient to define
wxUSE_WINSOCK2 when building wxWidgets instead of having to work around
winsock.h implicit inclusion from include/wx/msw/wrapwin.h.
Closes https://github.com/wxWidgets/wxWidgets/pull/1122
This was only used in wxUniv, wxRA_SPECIFY_[COLS/ROWS] can be used instead.
Do not remove them from the definitions, to not break user code.
Closes#18100.
Update the actual tool tip used by Qt and not just the internal variable
when SetTip() is called.
Also implement wxToolTip::SetWindow().
Closes https://github.com/wxWidgets/wxWidgets/pull/1175
Use QEventLoop for wxEventLoop implementation in wxQt to fix several
issues with wxEventLoop, notably avoid "QApplication::exec is already
running" errors.
See https://github.com/wxWidgets/wxWidgets/pull/1165