Commit Graph

69414 Commits

Author SHA1 Message Date
Vadim Zeitlin
712c2d4004 Add possibility to create "Close" bitmap button from XRC
This requires refactoring NewCloseButton() in order to extract
CreateCloseButton() from it, as XRC relies on being able to use two-step
creation which was previously impossible for this kind of buttons.

CreateCloseButton() is rather unusual, as it has to be declared in the
derived, platform-specific class, in order to be able to call its
Create(), but is defined only once in common, platform-independent,
code. However the only alternative seems to be to have a static
function, e.g. InitCloseButton(), which wouldn't be very pretty neither.

Closes https://github.com/wxWidgets/wxWidgets/pull/2118
2020-11-19 15:44:54 +01:00
Vadim Zeitlin
b4338a30e1 Fix IsEnabled() return value for wxMSW TLWs with native dialogs
IsEnabled() wrongly returned true even when the TLW was actually
disabled due to a native modal dialog using it as owner being currently
shown.

Fix this by trusting the actual HWND state, rather than our internal
m_isEnabled, except before the window is created.

Do it for TLWs only even if, in principle, we could check for
WS_DISABLED for the other windows too. However this would make
IsThisEnabled() inconsistent with the other platforms, where it returns
true when the window parent is disabled, but the window itself isn't,
which is currently also emulated by wxMSW, but wouldn't be the case if
we trusted WS_DISABLED presence. And while there might be other problems
due to lying about the actual window state in this function, it doesn't
seem to create any problems in practice, so for now leave the old logic
in place.

As a side effect, this makes wxWindowDisabler work correctly when a
message box is shown by another window when it's created, as it will now
correctly avoid re-enabling the message box parent in its dtor.

Closes https://github.com/wxWidgets/wxWidgets/pull/2117

See #11887.
2020-11-19 15:44:54 +01:00
Vadim Zeitlin
b92d194ac4 Add "default" and "bitmap" to wxCommandLinkButton XRC handler
Support the same buttons as in wxButton, as they also make sense here.

Closes https://github.com/wxWidgets/wxWidgets/pull/2116
2020-11-19 15:43:01 +01:00
Vadim Zeitlin
d67c7c485a Fix wxWindowDisabler compilation in wxOSX
Remove the duplicated version of the code in wxOSX sources which wasn't
updated in the parent commit.
2020-11-17 00:49:32 +01:00
Vadim Zeitlin
be570015bf Replace wxList with wxVector in wxWindowDisabler implementation
No real changes, just get rid of an unnecessary instance of
wxWindowList: this one can be safely replaced with a vector because it's
a private member and so changing its type doesn't affect compatibility.
2020-11-16 16:48:47 +01:00
Vadim Zeitlin
516066939a Add trivial wxVectorContains() helper
This is nicer than using std::find() when only a test for presence is
required.
2020-11-16 16:48:47 +01:00
Vadim Zeitlin
b021c3c938 Remove useless asserts from wxWeakRef implementation
No real changes, just remove asserts verifying that a pointer is
non-null right before dereferencing it, as they're perfectly useless for
all the usual reasons and just add extra code to relatively often used
functions.
2020-11-16 01:50:27 +01:00
Vadim Zeitlin
84409dfa0a Don't send wxEVT_ACTIVATE to half-destroyed windows in wxMSW
This resulted in a crash when WM_ACTIVATE was received from inside
wxWindow dtor, executed after wxTopLevelWindowMSW dtor, and passed to a
handler defined in wxTopLevelWindowMSW and using its already destroyed
members.

Perhaps we should avoid dispatching any messages when the window is
being destroyed, but it's not totally obvious that this is not going to
break something, so for now apply just this minimal fix.

Closes #18970.
2020-11-16 01:47:59 +01:00
Vadim Zeitlin
bd05aea6c1 Fix stretchable separators in vertical toolbars under MSW
This partially reverts 44d732b8a5 (Use TB_SETBUTTONINFO when updating
stretchable toolbar separators, 2019-02-24) and restores the behaviour
before this commit for the vertical toolbars only, as the new code
doesn't work for them, even though like it seems it should (and we don't
get any error when using it).

Still keep the simpler path for horizontal toolbars, as there doesn't
seem to be any problems with it in this case.
2020-11-15 01:02:09 +01:00
Vadim Zeitlin
f65caa3183 Fix wxDatePickerCtrl build in wxOSX after the previous commit
This should have been done there, as overriding OSXGenerateEvent() is
not necessary (and actively harmful in C++ mode) any more after its
changes.
2020-11-13 13:55:05 +01:00
Vadim Zeitlin
d319e70a7c Fix inheritance hierarchy of wxDatePickerCtrlGeneric too
This is very similar to 8a64b6acea (Fix inheritance hierarchy of
wxTimePickerCtrlGeneric, 2020-11-04) and is done for the same reasons
(avoid having to somehow implement MSW-specific virtual methods of the
native controls base class in the generic version) and suffers from the
same drawback (there is no common base class for the native and generic
version any more).

See https://github.com/wxWidgets/wxWidgets/pull/2109
2020-11-13 01:19:52 +01:00
Vadim Zeitlin
cf4c6fca84 Fix spurious assert when dropping items is impossible in wxMSW
Use correct drop effect in DropCleanup helper added in f5548e399e (Fix
problem with dragged icon remaining on screen under MSW 10, 2020-01-11):
using the value of the input pdwEffect argument was wrong, as it could
be a combination of multiple DROPEFFECT_XXX flags, when we really need a
single one here.

This fixes a regression and the code should do exactly the same thing
now when OnDrop() does not throw as it had done before that commit.

See #18499.

Closes #18965.
2020-11-11 16:42:57 +01:00
Vadim Zeitlin
a8b7802d38 Merge branch 'listctrl-extend-rules-and-zebra'
Allow extending rules and zebra background in wxListCtrl to the whole
window.

See https://github.com/wxWidgets/wxWidgets/pull/2112
2020-11-10 14:08:23 +01:00
Vadim Zeitlin
b1a8ce8354 Test for wxHAVE_TCHAR_SUPPORT instead of individual _txxx()
This is more consistent and slightly simpler.

Testing for _tsystem() explicitly is not needed any more as _wsystem()
is supported since MinGW 3.4.5, i.e. certainly present in all supported
MinGW versions.

See #18958.
2020-11-10 14:06:18 +01:00
Vadim Zeitlin
7fe7ebd5e4 Fix problems with GetSelection() documentation
Move wxListBox-specific part to wxListBox documentation, it doesn't
apply to the other controls, such as wxRadioBox.

Also improve the documentation of wxRadioBox::GetSelection() to mention
that it always returns a valid value.

Closes #18968.
2020-11-10 13:12:37 +01:00
Vadim Zeitlin
a2ebe1928a Avoids asserts in the listctrl sample on pressing Ctrl-I
Calling InsertItemInReportView() with invalid index results in a series
of asserts, so avoid doing this.

Note that there seems to be an unrelated bug in wxGTK which results in
this code being executed at all, as normally the definition of a menu
item using Ctrl-I as an accelerator should have prevented this from
happening.
2020-11-09 00:40:43 +01:00
Vadim Zeitlin
5ae2a8ebb8 Simplify API for extending wxListCtrl background display
Replace SetListRulesAlternateColourOnBlank() taking 2 arguments, with
the second of them being used only when the first one is true, with a
simpler but still sufficient ExtendRulesAndAlternateColour(bool).

Make the new method virtual and define it as doing nothing in
wxListCtrlBase class, so that it's still available, even if currently
not implemented, in wxMSW.

Also simplify the implementation, fix style problems and other minor
improvements.
2020-11-09 00:37:55 +01:00
Marcos
584d1ae47d Allow showing rules and background on entire wxListCtrl window
Previously they were both limited to the part occupied by the items
only, add a new method allowing to extend them to the whole client
window area.

See https://github.com/wxWidgets/wxWidgets/pull/2106
2020-11-09 00:07:53 +01:00
Vadim Zeitlin
1cf7c47934 Add more wxRound() compatibility overloads and improve docs
Make the overloads added for compatibility available only when
WXWIN_COMPATIBILITY_3_0 is on and add two more of them, to cover all the
interer types (except char but, honestly, who rounds those?).

Also improve the documentation and make it clear that this function is
not needed at all in the new code.

Closes https://github.com/wxWidgets/wxWidgets/pull/2111
2020-11-08 23:19:28 +01:00
Vadim Zeitlin
52138fc1f1 Merge branch 'webview_edge_improvements' of https://github.com/TcT2k/wxWidgets
Various wxWebView Edge improvements.

See https://github.com/wxWidgets/wxWidgets/pull/2110
2020-11-06 14:33:05 +01:00
Tobias Taschner
46d123b953
WebViewEdge: Allow edge webview2 installation during runtime
Check if edge webview runtime is available in the call to
wxWebView::IsBackendAvailable() instead of only doing it during
process initialization. This allows an application to install
the Edge WebView2 Runtime during runtime and use the edge webview
afterwards without restarting the process.
2020-11-06 09:19:17 +01:00
Tobias Taschner
2d9c08e0cc
WebViewEdge: Forward window visibility to SDK
Tell the SDK controller if the control is shown or hidden.
This allows creating a hidden webview which will be shown later
and might fix other potential issues.
2020-11-06 09:19:12 +01:00
Tobias Taschner
412de05407
Allow settings modification before WebView Edge init
Setting EnableContextMenu and EnableAccessToDevTools where
ignored before the webview loaded content. This would often
be set directly after creation and work like this with other
backends.
2020-11-06 09:19:11 +01:00
Paul Cornett
c2e5f3520a Add a wxRound() overload for int
To avoid breaking any dumb code.
And add a long double overload as well, because pigs might fly.
2020-11-05 09:06:12 -08:00
Vadim Zeitlin
8d4b6ac8b8 Merge branch 'date-picker-blank'
Allow customizing text displayed in wxDatePickerCtrl without valid
value, notably not displaying anything in it in this case.

See https://github.com/wxWidgets/wxWidgets/pull/2109
2020-11-05 16:27:13 +01:00
Vadim Zeitlin
e550b0e46d Merge branch 'grid-date-format'
Fixes for using custom wxGrid date format.

See https://github.com/wxWidgets/wxWidgets/pull/2108

Closes #18876.
2020-11-05 16:12:28 +01:00
Vadim Zeitlin
9bc6c3c234 Add support for wxDatePickerCtrl::SetNullText() to XRC
Recognize null-text element.
2020-11-05 14:22:05 +01:00
Vadim Zeitlin
02f1ee3987 Add wxDateTimePickerCtrl::SetNullText()
This allows to customize the string shown when there is no valid date
under MSW (only, for now) and can be notably used to suppress the
unused date completely, which can be useful to lighten up the display
when there are many controls.

Add UI elements to the widgets sample allowing to test the new function.
2020-11-05 14:22:05 +01:00
Vadim Zeitlin
6d4ce92c20 Fix assert failures with wxDP_ALLOWNONE in the widgets sample
DatePickerWidgetsPage::OnDateChanged() must check whether the wxDateTime
value received from the control or event is valid before formatting it,
as this may not be the case when wxDP_ALLOWNONE is on, and trying to
format an invalid date results in assertion failures (and random junk in
the output).
2020-11-05 00:34:10 +01:00
Vadim Zeitlin
8a64b6acea Fix inheritance hierarchy of wxTimePickerCtrlGeneric
This class must not derive from the native wxDatePickerCtrl, as it
doesn't make much sense and resulted in the need for an ugly hack with
either overriding unused and inapplicable pure virtual methods in this
class itself, as was originally done in 569c7d8ccb (Add wxTimePickerCtrl
class., 2011-09-29) when it was introduced, or not making these methods
pure virtual in the first place, as was done in d0da5061ce (Dirty hack
to allow generic wxDatePickerCtrl to compile under MSW., 2011-10-20),
but didn't really fix the problem.

Do fix it now by using different hierarchies for the native and generic
classes. The main disadvantage of doing it is that there is no common
base class for wxTimePickerCtrl and wxTimePickerCtrlGeneric providing
SetTime() and GetTime() methods any more, but this seems like a
relatively small price to pay because real applications won't be using
these two classes simultaneously, as the calendar sample does, anyhow.
2020-11-05 00:34:10 +01:00
Andy Robinson
c2a488ca42 Fix scroll position after following a link in wxHtmlWindow
When not using an anchor, new page must be shown starting from its
origin in the top-left corner, instead of remaining at the current
scroll position, as it did before.

Closes #18922.
2020-11-04 17:44:02 +01:00
Vadim Zeitlin
ce0f10c377 Get dates directly from table in wxGridCellDateEditor if possible
Unlike wxGridCellDateRenderer, which already did it, the editor class
always got the cell value from the table as a string, even if the table
supported returning the dates directly.

Fix this by using the same code in the editor as in the renderer, which
required a further refactoring in order to make it reusable: the helper
TryParseDate() was replaced with TryGetValueAsDate() and DateParseParams
was added to allow overriding the arguments passed to it in the
overridden wxGridCellDateTimeRenderer::GetDateParseParams().
2020-11-03 17:30:54 +01:00
Vadim Zeitlin
9311dc8ffb Remove redundant wxGridCellDateTimeRenderer::SetParameters() docs
This function is inherited from wxGridCellDateRenderer since the changes
of 659ab78c6d (Add support for editing dates (without time) to wxGrid,
2018-09-06), so there is no need to document it separately.
2020-11-03 03:14:43 +01:00
Vadim Zeitlin
cced297b26 Remove unused wxGridCellDateTimeRenderer::m_dateDef
This has apparently never been really used ever since it was added in
d10f4bf950 (applied tons of wxGrid patches, 2001-05-27).
2020-11-03 03:09:17 +01:00
Vadim Zeitlin
705006615f Add support for date format to wxGridCellDateEditor too
This is needed to allow editing the cells using wxGridCellDateRenderer
with a custom format, otherwise the editor might parse the contents of
the cell differently from what is actually shown.

In particular, this ensures that using "date:%d.%m.%y" (or any other
custom format) as "cell type" works correctly, which wasn't the case
before.
2020-11-03 02:57:22 +01:00
Vadim Zeitlin
56ec476a3a Refactor wxGridCellDateRenderer::Parse() to make it reusable
No real changes, just create TryParseDate() helper in order to allow
reusing it from wxGridCellDateEditor too in the upcoming commit.
2020-11-03 02:50:31 +01:00
Vadim Zeitlin
eda11b8755 Use specified format in wxGridCellDateRenderer if possible
For the tables that store dates as strings, we must use the specified
format for interpreting the table data, as otherwise we could confuse
the user by showing it incorrectly: for example, if "%d.%m.%y" format is
used, "01.03.02" should really mean 2002-03-01, but it was parsed as
0002-01-03 by ParseDate() which had no choice but to guess the order of
data components.
2020-11-03 02:37:02 +01:00
Vadim Zeitlin
bd8c74f368 Fix positioning of bottom-aligned checkboxes in wxGrid
This fixes a bug due to a typo in ab02d36e10 (Account for vertical
alignment in wxGetGridCheckBoxRect() too, 2019-11-22) which used the
vertical component of a wrong object and so didn't actually offset the
checkbox by its size from the bottom of the cell rectangle, as it should
have done.

Closes #18907.
2020-11-02 00:55:47 +01:00
Vadim Zeitlin
2b0dd6dfe3 Don't claim that Enter sends wxEVT_SPINCTRLDOUBLE in wxSpinCtrl
This isn't actually true and doesn't seem to make much sense, so simply
remove the fragment claiming this from the documentation.

Closes #18900.
2020-11-02 00:40:15 +01:00
Vadim Zeitlin
a8efad16f1 Fix size of toolbar realized before being set in wxMSW
Use the best size and not the actual size of the toolbar in
wxFrame::PositionToolBar(), called from SetToolBar(), as for a toolbar
which had been previously realized its size could have been set to the
entire client area size -- as is normal for any non-special child
window, and before being associated with the frame using SetToolBar() a
toolbar is not special too.

Using the current size was probably a workaround for GetBestSize() not
returning correct results in wxMSW and so shouldn't be needed any longer
after the changes of 1a79610361 (Rewrite wxToolBar resizing logic in
wxMSW, 2019-02-24) and now just results in using wrong size for toolbars
not created using CreateToolBar().

Closes #18954.
2020-11-01 23:12:24 +01:00
Vadim Zeitlin
683b71e642 Merge branch 'grid-select-none'
Add wxGrid::wxGridSelectNone selection mode.

Closes https://github.com/wxWidgets/wxWidgets/pull/2100
2020-10-31 17:16:34 +01:00
Vadim Zeitlin
f765c06f1a Show new wxGridSelectNone mode in the grid sample
Allow testing the new selection mode interactively.
2020-10-31 17:13:06 +01:00
Gary Allen
095d1e317c Add wxGridSelectNone selection mode
In this mode the user can't select any cells at all in wxGrid.
2020-10-31 17:01:36 +01:00
Vadim Zeitlin
a64348f3e4 Merge branch 'misc-changes' of https://github.com/MaartenBent/wxWidgets
Update CMake with recent changes, remove more Borland checks.

See https://github.com/wxWidgets/wxWidgets/pull/2098
2020-10-31 16:30:29 +01:00
Vadim Zeitlin
312a760029 Merge branch 'dvc-fix-item-added'
Fix adding items to generic wxDVC again.

See https://github.com/wxWidgets/wxWidgets/pull/2095
2020-10-31 16:29:02 +01:00
Paul Cornett
50c7b4278f Ignore invalid file notification events
See #18953
2020-10-30 10:12:55 -07:00
Paul Cornett
d59b68c9eb Add some additional values to wxImage::RGBtoHSV test 2020-10-30 09:36:37 -07:00
Stefan Brüns
c3873ea313 Use proper rounding when casting RGB values to int
When doing an RGB->HSV->RGB roundtrip, the original value should be
restored (HSV, being double, has sufficient precision).

For e.g. `RGBValue(1,2,3)`, the equivalent resulting code for blue is
`trunc(int * 255.0 / 255.0)` (cast from double to int truncates).
At least with x87 FP math and its immediate 80bit extended precision
the resulting value is ~trunc(2.9999..), i.e. 2, similar problems may
exist on other architectures with other values.

Using proper rounding avoids the error magnification.

Closes https://github.com/wxWidgets/wxWidgets/pull/2078
2020-10-30 09:32:32 -07:00
Paul Cornett
a3f14b2fc2 Remove redundant code
Should have been done in
533bedbf30 (fix aui crash related to SF bug 1531361, 2006-10-31)
2020-10-29 06:13:29 -07:00
Paul Cornett
0cae4399bd Make awk script compatible with default Solaris /usr/bin/awk
See #18950
2020-10-25 23:31:47 -07:00