Commit Graph

66804 Commits

Author SHA1 Message Date
Vadim Zeitlin
59e9da28f5 Improve wxDataViewModel::Cleared() documentation
Explain that this method can be useful not only when the model is
cleared.
2019-09-12 23:43:42 +02:00
Vadim Zeitlin
54a8d1d8f3 Don't send events when changing model in wxGTK wxDataViewCtrl
Sending events from e.g. AssociateModel(NULL) made the GTK version
inconsistent with the other ones, neither of which sent any events in
this case, and could result in a lot of grief in the user code if it
didn't expect the event handler to be called at this moment (e.g. during
the destruction).

Make wxGTK compatible with the other ports and safer by always disabling
the selection changed events before calling gtk_tree_view_set_model().

Note that it's still incompatible with the other ports because they also
preserve the selection even after the change of model, but wxGTK loses
it. Ideally this would be fixed too, but for now live with this as the
lesser evil.
2019-09-12 23:36:20 +02:00
Vadim Zeitlin
063b6edf68 Add a check for resetting the associated model to the sample
Verify that resetting the model doesn't result in selection change
events.
2019-09-12 23:20:20 +02:00
Vadim Zeitlin
18594afe76 Remove checks for model stamp validity not needed any longer
The code setting the model stamp to 0 was removed in the last commit, so
also remove the code checking for stamp being 0.
2019-09-12 23:13:11 +02:00
Vadim Zeitlin
5403ec4e08 Make Cleared() behave consistently with the other ports in wxGTK
Instead of actually deleting all the items from the control, just
refresh it by resetting the model, as this is what Cleared() does in
both the generic and native macOS versions of wxDataViewCtrl, so calling
it there resulted in very different results from doing it under wxGTK,
where instead of refreshing the control contents it raelly cleared it.

The name of this method is unfortunately confusing, but it seems better
to change its behaviour in wxGTK, even if this doesn't match the name,
rather than change it in the other ports to make them do the same thing,
as this could break some currently working code.

Also, this change results in a welcome code simplification.
2019-09-12 23:08:10 +02:00
Vadim Zeitlin
0d005bdf02 Add wxEVT_DATAVIEW_SELECTION_CHANGED test handler to the sample
Verify that the sample is not invoked unexpectedly.
2019-09-12 23:00:14 +02:00
Vadim Zeitlin
f99b80612a Add a simple test of wxDataViewIndexListModel to the sample
This is useful to investigate inconsistencies in its behaviour between
the generic and the native GTK versions that can't be easily checked in
the automatic unit tests.
2019-09-12 18:51:36 +02:00
Vadim Zeitlin
eca006da06 Indent "case Page_VarHeight" properly
No real changes, just reindent the code.
2019-09-12 18:31:42 +02:00
Vadim Zeitlin
c715bb750b Use symbolic page numbers in the dataview sample
Make the code a bit more readable.

No real changes.
2019-09-12 18:24:03 +02:00
Robin Dunn
41b444e011
Merge pull request #1455 from wxWidgets/gradient-pen
Add support for gradients in wxGraphicsPen
2019-09-11 20:17:34 -07:00
Kvaz1r
3fffc0782c Make wxThread::OnExit() protected rather than private
This allows calling the base class version from the derived classes and
also, at least as importantly, make sure that the function is actually
documented as private functions are not extracted by Doxygen by default.

Closes #16749.

Closes https://github.com/wxWidgets/wxWidgets/pull/1543
2019-09-12 00:55:32 +02:00
Vadim Zeitlin
be53b3fb20 Fix infinite recursion if wxGrid is modified from event handler
Calling wxGrid::{Insert,Delete}{Rows,Cols}() from wxEVT_GRID_CELL_CHANGE
event handler resulted in infinite recursion because it tried to hide
the grid editor control again, which resulted in another CELL_CHANGE
event being generated and so on.

Break this infinite recursion in the usual way, i.e. by updating the
state of wxGrid before invoking the user-defined event handler.

This required separating SaveEditControlValue() in 2 functions, the main
one retaining IsCellEditControlEnabled() check for compatibility, and
the new DoSaveEditControlValue() that can be called even after disabling
the editor.

Closes #2287.

Closes https://github.com/wxWidgets/wxWidgets/pull/1540
2019-09-12 00:53:21 +02:00
Vadim Zeitlin
c1fdc717ae Merge branch 'multiline-enter-fix'
Fix handling Enter in multiline text controls in wxMSW.

And other improvements, notably don't send wxEVT_TEXT_ENTER for controls
without wxTE_PROCESS_ENTER style.

Closes #18491.

See https://github.com/wxWidgets/wxWidgets/pull/1539
2019-09-12 00:50:00 +02:00
Robin Dunn
1c2e71920a Remove commented-out asserts 2019-09-11 13:09:12 -07:00
Robin Dunn
b10c7a982f Remove misplaced wxOVERRIDE 2019-09-11 12:59:27 -07:00
Artur Wieczorek
163c7cf834 Fix checking WXUSINGDLL in conditional block
We have to check if WXUSINGDLL macro is defined instead of checking its value.
2019-09-10 22:52:23 +02:00
Ilya Sinitsyn
e2bd6ec8f7 Fix clearing selection in a grid with reordered columns
Since the changes of 04f7f1fd32 (frozen
rows/columns implementation), RefreshBlock() could call GetColPos() with
an invalid index. This didn't matter most of the time as the function
simply returned the same index as long as the columns were using their
natural order, but resulted in a crash due to an out of bound access to
m_colAt array as soon as they were reordered.

Fix this by avoiding using invalid indices in RefreshBlock() and, more
generally, improving its precondition check and making the assumptions
about the input parameters more clear. Also add a defensive check to
GetColPos() itself.

Finally, add a unit test exercising this code.

Closes https://github.com/wxWidgets/wxWidgets/pull/1536
2019-09-10 19:41:45 +02:00
Vadim Zeitlin
fbdc55ee0a Test multiline text control in the "Enter" testing dialogs
Add another test control to the dialogs sample.
2019-09-10 18:48:20 +02:00
Vadim Zeitlin
9bab9d8da8 Don't activate default button on Enter in multiline wxTextCtrl
Restore behaviour until c43e0fa123 and let
Enter presses in multiline text controls perform their default function
in the control instead of closing the dialog.

Make the unit test more discerning to check for this.
2019-09-10 18:48:20 +02:00
Vadim Zeitlin
84f29ce472 Don't send EVT_TEXT_ENTER to controls without wxTE_PROCESS_ENTER
wxMSW always sent this event to multiline text controls, even when they
didn't have wxTE_PROCESS_ENTER style, contrary to what was documented.

Avoid sending this event unless wxTE_PROCESS_ENTER is used and add unit
tests checking that multiline text controls don't get it without this
style (but still do get it with it).
2019-09-10 18:48:20 +02:00
Vadim Zeitlin
4c075c2128 Replace Bind() call with an event table in Enter handling tests
For once, using the event table macros is preferable because this
bypasses the (generally helpful, but not here) test done by Bind()
verifying that wxEVT_TEXT_ENTER handler is bound to a window with
wxTE_PROCESS_ENTER style.

Doing it like this will allow to check that controls without this style
really do not receive the corresponding event.
2019-09-10 18:48:20 +02:00
Vadim Zeitlin
e85b5e5261 Replace a single function with a class in Enter processing tests
No real changes yet, this is a pure refactoring before the upcoming
changes.
2019-09-10 18:48:20 +02:00
Vadim Zeitlin
ba2ea837de Actually make wxTE_PROCESS_ENTER example in dialogs sample work
This didn't work any more since the changes done in the branch merged by
fb2c17c193 as using wxTE_PROCESS_ENTER
without actually handling the resulting event doesn't prevent Enter from
activating the default button any longer.
2019-09-10 18:48:20 +02:00
Kvaz1r
16b08c6ef9 Allow updating wxBusyInfo text while it's shown
Add UpdateText() and UpdateLabel() updating the text (i.e. possibly
containing markup) or the label (just plain text) shown in the window.

Closes #14743.

Closes https://github.com/Kvaz1r/wxWidgets.git BusyInfoUpdateText14743
2019-09-08 23:13:00 +02:00
Vadim Zeitlin
5f635db3bf Minor cleanup of a dialog in the dialogs sample
Use wxSizerFlags()-based API for clarity high DPI-friendliness, i.e.
don't hard code 5px as border/margin sizes.

No real changes.
2019-09-08 22:18:19 +02:00
Vadim Zeitlin
32eb6f1a2c Remove explicit "ProgramDataBaseFileName" from test MSVS projects
This is not really necessary and triggers a bug with a spurious error
C2859 when building the project with MSVS 2019, see

https://developercommunity.visualstudio.com/content/problem/592262/error-c2859-is-not-the-pdb-file-that-was-used-when.html

(which was closed as "not a bug", after acknowledging the bug...).
2019-09-08 22:17:55 +02:00
Vadim Zeitlin
7811d1a833 Merge branch 'per-monitor-dpi-aware-controls-1' of https://github.com/MaartenBent/wxWidgets
Update the font of some buddy controls when the DPI changes. Fix the
position of the statusbar after a DPI change. Add some changes that were
suggested in https://github.com/wxWidgets/wxWidgets/pull/1499 but left
out from it.

Some sizes are cached to improve the speed of the library. These sizes
become incorrect when the DPI changes. And are incorrect when a window
is created on a display with a different DPI. Fix this by checking if
the current DPI is the same as the DPI that was used when calculating
the size, otherwise recalculate the size.

Closes https://github.com/wxWidgets/wxWidgets/pull/1530
2019-09-07 14:57:54 +02:00
Maarten Bent
462f2a4686 Add optional wxWindow parameter to wxButtonBase::GetDefaultSize()
When per-monitor DPI is used, the default button size depends on the DPI of the
display. Use the window to determine this DPI.
2019-09-06 20:59:59 +02:00
Maarten Bent
fa2242a0a6 Reset static sizes when DPI changes 2019-09-06 20:59:59 +02:00
Maarten Bent
e312569b94 Fix wxStatusBar font and position after DPI changes
Update the font of the associated wxDC so ellipsization uses the correct font
size.
2019-09-06 20:59:56 +02:00
Dan-Korn
b82f7f1c0e Fix wxPOPUP_WINDOW to work as documented (Cocoa): (#1535)
Ensure that wxPOPUP_WINDOW on Mac always sets the window level
to NSPopupWindowLevel, regardless of the wxSTAY_ON_TOP and
wxFRAME_TOOL_WINDOW flags.

As the comment for wxPOPUP_WINDOW in defs.h says,
"set this flag to create a special popup window:
it will be always shown on top of other windows"

So, that should *always* be true, even in relation to other
Windows with wxSTAY_ON_TOP, since NSPopUpMenuWindowLevel
is greater (higher) than NSModalPanelWindowLevel.

It should also *always* be true even if the window has both
wxPOPUP_WINDOW and wxFRAME_TOOL_WINDOW styles, since there's
no reason why we can't have a panel with NSUtilityWindowMask
and NSPopUpMenuWindowLevel.
2019-09-06 08:58:33 +02:00
Robin Dunn
53d3888180 Add another missed wxOVERRIDE 2019-09-05 17:51:51 -07:00
Robin Dunn
f705cb3087 Another typo fix 2019-09-05 17:47:33 -07:00
Artur Wieczorek
a7cc686853 Initialize flag with actual value
There is no need to pre-initialize alpha flag with default value.
2019-09-06 00:15:38 +02:00
Artur Wieczorek
f5a589180f Fix converting wxImage with mask to wxBitmap with alpha channel
For wxImage having both mask and alpha channel (it is technically possible), mask cannot be converted to alpha values and in this case resulting wxBitmap will also have both mask and alpha channel.
2019-09-06 00:15:23 +02:00
Vadim Zeitlin
c12b0e8509 Merge branch 'grid-fixes'
Fixes for wxGrid when using native header control.

Closes https://github.com/wxWidgets/wxWidgets/pull/1529
2019-09-05 23:36:50 +02:00
Maarten Bent
4713301cf5 Fix font and thumb size of wxSlider after DPI change 2019-09-05 23:14:25 +02:00
Maarten Bent
587f894f96 Fix font of wxRadioBox after DPI change 2019-09-05 23:14:25 +02:00
Maarten Bent
13cb9d41d8 Require wxWindow parameter for wxNativeFontInfo constructor in MSW
Use the DPI of the window to determine the correct font pointSize.

To not break user code, add a default argument when not building the library.
2019-09-05 23:14:25 +02:00
Robin Dunn
a8a19e25ee Various typo and coding style fixes 2019-09-05 13:33:15 -07:00
Ilya Sinitsyn
120b33746a Implement scrolling for MSW wxHeaderCtrl correctly
Due to lack of support for horizontal scrolling in the native control,
scrolling it was implementing by offsetting the entire control window.
However this didn't work correctly when the window was not positioned
at the leftmost border of its parent window, as the part of it that was
scrolled off could still be visible in this case, and this is exactly
what happened when the native header was used in wxGrid: scrolling it
overwrote the corner part of wxGrid.

Fix this by embedding the actual native control inside an outer wxWindow,
to ensure that the scrolled off part is clipped by the parent window.

Note that this commit is best viewed with "git show --color-moved" as
most of the code was just moved from the header into the implementation
file and is not really new.
2019-09-05 20:11:09 +02:00
Ilya Sinitsyn
e5d59c6b7f Respect minimum grid column width when using native header too
Override wxHeaderColumn::GetMinWidth() to return the actual minimum
width instead of just returning 0.

Add a unit test verifying that this works as intended.
2019-09-05 20:11:09 +02:00
Ilya Sinitsyn
2290d97453 Fix dragging grid columns when using scrolled native header
Drag-resizing the columns didn't work correctly when using the native
header and scrolling it horizontally, as the wrong offset was used in
this case.

Fix the offset in wxGrid code and add a unit test checking that this
works as intended (at least under MSW, as wxUIActionSimulator just
doesn't work reliably enough to test for this under the other platforms,
and, besides, only MSW has the native header control implementation
anyhow).
2019-09-05 20:11:09 +02:00
Robin Dunn
1afb4afe25 Fix typo 2019-09-04 15:01:22 -07:00
Robin Dunn
df31204f98 Add example of using a gradient pen to the drawing sample 2019-09-04 14:21:30 -07:00
Robin Dunn
699f019c76 Add notes about gradient pens and gradient transforms to changes.txt 2019-09-04 14:21:30 -07:00
Robin Dunn
61a39165b8 documentation tweaks 2019-09-04 14:19:24 -07:00
Robin Dunn
f7896d4dff Use new parameter names in the existing CreateRadialGradientBrush methods too 2019-09-04 14:19:24 -07:00
Robin Dunn
c79085b54d (blind) compilation fix for wxQtGraphicsRenderer gradient brush methods 2019-09-04 14:19:24 -07:00
Robin Dunn
30dfe45759 undo incorrect search/replace 2019-09-04 14:19:24 -07:00