Commit Graph

4084 Commits

Author SHA1 Message Date
Vadim Zeitlin
abcc31c6b2 Update wxCredentialEntryDialog to use wxWebCredentials
As a side effect, make wxWebCredentials default-constructible.

Also demonstrate using wxCredentialEntryDialog in the sample.
2021-01-10 21:27:15 +01:00
Vadim Zeitlin
1e6d6be8bb Add wxWebCredentials and use it in SetCredentials()
Prefer using a class encapsulating both the user name and the password
to using a pair of variables.
2021-01-10 21:27:15 +01:00
Gary Allen
027c1b8304 Update wxRibbonToolBar docs 2021-01-10 20:18:42 +02:00
Vadim Zeitlin
fe197d7527 Add small wxSecretString helper for wiping strings values
This is simpler and more robust than remembering to call WipeString()
manually.
2021-01-10 01:21:45 +01:00
Vadim Zeitlin
5d236edeed Ensure wxWebRequest is in idle state before starting it
Check that current state is State_Idle in wxWebRequest itself only once
instead of doing it in 2 (out of 3) wxWebRequestImpl implementations.

Also assert if this is not the case instead of silently doing nothing
which would surely be more difficult to debug.
2021-01-09 21:00:38 +01:00
Vadim Zeitlin
989cafe535 Take raw pointer and not wxSharedPtr<> in SetData()
Using shared pointer seems to be ill-advised here, the stream shouldn't
be shared as it's going to be used by wxWebRequest itself and can't be
used by the application code in parallel, so the ownership transfer
semantics is more appropriate.

We could take a wxScopedPtr<> instead, but wx API takes ownership of raw
pointers everywhere else, so do it here too.

Incidentally fix a bug with calling IsOk() on a possibly null pointer.
2021-01-04 01:57:36 +01:00
Vadim Zeitlin
b58ee58a7b Update copyright years to 2021
Just run misc/scripts/inc_year and commit the results.

See #18690.
2021-01-03 18:12:37 +01:00
Artur Wieczorek
e09c35efb5 Implement wxImageDataObject
Using this object we can put an wxImage on or retrieve it from the clipboard. wxImage is stored internally as a blob with either a PNG file (wxMSW, wxGTK) or a TIFF file (wxOSX) and therefore some its metadata (like resolution) is stored on the clipboard too (what is not the case for wxBitmap stored with wxBitmapDataObject). wxImages stored with wxImageDataObject can be used by native applications.

Closes #17631.
2020-12-31 12:49:06 +01:00
Artur Wieczorek
a27a7656ea Provide support for storing PNG files on the clipboard (wxMSW)
PNG is a custom clipboard format but images stored in this format are supported by e.g. MS Excel, MS PowerPoint, GIMP (including image transparency).

See #17631.
2020-12-31 12:14:08 +01:00
Vadim Zeitlin
50424cba2c Change wxWebRequest and related objects to hide ref counting
Don't force the application code to deal with wxObjectDataPtr<> or,
worse, calling {Inc,Dec}Ref() manually by hiding it inside the wx
objects themselves and giving the value-like semantics to them.

There should be no real changes in the behaviour, but the API does
change significantly. Notably, wxWebRequest is not a wxEvtHandler itself
any longer, as this would be incompatible with the value semantics, and
an event handler needs to be specified when creating it, so that it
could be notified about the request state changes.
2020-12-30 02:02:20 +01:00
Vadim Zeitlin
04bbb844ae Allow constructing/assigning wxObjectDataPtr from compatible type
Generalize copy ctor and assignment operators to allow implicit
conversions from wxObjectDataPtr<D> to wxObjectDataPtr<B> if D is
implicitly convertible to B (e.g. if B is the base class and D is a
class derived from it).

This makes wxObjectDataPtr<> more like standard smart pointer classes
and more useful.
2020-12-30 01:02:47 +01:00
Vadim Zeitlin
87d94819a1 Merge branch 'add-ribbonBar-coord-functions' of https://github.com/STgithub64/wxWidgets
Add wxRibbonToolBar GetToolByPos() and GetToolRect().

See https://github.com/wxWidgets/wxWidgets/pull/2152
2020-12-29 17:13:58 +01:00
VZ
9160181bcc Minor simplifications and code style fixes
No real changes.
2020-12-29 17:00:08 +01:00
Vadim Zeitlin
23c7805742 Document that wxTE_READONLY can't be used with wxTextEntryDialog
This style doesn't make any sense here, but using it is confusing
because it has the same value as wxCANCEL and is interpreted as it,
rather than as expected by users.

We can't do much about this, but at least document that this flag
doesn't work to prevent people from wasting time trying to use it.
2020-12-27 18:32:10 +01:00
Vadim Zeitlin
71d5729171 Make wxWebSessionFactory private
Having wxWebSessionFactory part of the public API implies keeping
compatibility with the possible ways of implementing it which is too
restrictive for no good reason, so move this class to the private header
and don't document it nor wxWebSession::RegisterFactory() (which is now
private).
2020-12-27 01:03:08 +01:00
Gary Allen
ae9a62d5a2 Add wxRibbonToolBar GetToolPos and GetToolRect coord functions 2020-12-23 20:08:39 +02:00
Tobias Taschner
10398b8f72 macOS: Document missing wxWebView features and don't test for them 2020-12-14 13:40:32 +01:00
Tobias Taschner
4df334cec4 macOS/iOS: Use WKWebView for wxWebView Implementation
WKWebView replaces
WebView on macOS (available since 10.10, deprecated since 10.14) and
UIWebView on iOS (available since 8.0 deprecated since 10.0).
Using WKWebView ensures future compatiblity and unifies the interface
used for iOS and macOS.
2020-12-14 10:18:01 +01:00
Tobias Taschner
6d7f35090d Removed macOS only wxWebKitCtrl
This macOS only class duplicated functionality and code of wxWebView.
2020-12-14 10:17:35 +01:00
Vadim Zeitlin
b37c7417f6 Don't make wxWebRequest::SplitParameters() public
They're not necessary to use this class and we may consider exporting
them later, possibly with a better API and more tests, if really needed.

Also do change their API slightly by leaving only a single function and
returning the value instead of using an out parameter for it to make it
simpler to use.
2020-12-13 02:41:01 +01:00
Vadim Zeitlin
1c61fe6baf Remove wxWebResponse::AsString() conversion parameter
It doesn't make much sense to specify the conversion here, it would
ideally be taken from the response Content-Type header itself and
currently is just assumed to be UTF-8 anyhow.

Also implement fallback to Latin-1 to avoid losing the data entirely if
it's not in UTF-8.
2020-12-13 01:16:41 +01:00
Vadim Zeitlin
89946d1fc7 Update version in @since comments for wxWebRequest to 3.1.5
Hopefully this is the last update.
2020-12-13 00:50:03 +01:00
Vadim Zeitlin
0c9f4ababa Document wxWebResponse pointers as being non-owning
wxWebResponse objects belong to wxWebRequest itself.
2020-12-13 00:47:53 +01:00
Vadim Zeitlin
3a5f5006fb Fix typo in wxWebRequest documentation 2020-12-13 00:43:36 +01:00
Vadim Zeitlin
727b590814 Pass wxSharedPtr argument of RegisterFactory() by const reference
Avoid extra copies from passing it by value.
2020-12-13 00:19:03 +01:00
Vadim Zeitlin
e3382b6e93 Minor improvements to wxCredentialEntryDialog documentation
Add Create() description and, more importantly, explain why could
SetXXX() be useful.
2020-12-13 00:18:27 +01:00
Vadim Zeitlin
64a3801160 Tweaks to wxWebRequest::SetData() overload taking stream
Check that the stream is valid, if specified at all, and return false if
it isn't -- or if no size was specified and determining stream size
failed.

Check for SetData() success in the test to provide better diagnostics in
case the file it uses is not found (as is the case when running the test
from another directory, for example).

Also pass wxSharedPtr<> by const reference instead of by value to avoid
unnecessary copies.
2020-12-12 18:46:28 +01:00
Vadim Zeitlin
6bdab7b3c8 Merge branch 'master' into web-request
Merge with the latest master in preparation for merging into master.

Rebake to resolve conflicts in generated files.
2020-12-12 18:12:25 +01:00
Vadim Zeitlin
15c3ce6710 Add wxPlatformInfo::GetCpuArchitectureName()
This provides the same information as wxGetCpuArchitectureName(), but is
consistent with the other wxPlatformInfo accessors, which also
correspond to the existing wxGetXXX() functions, and makes it more
convenient to use this information in the application code as now
everything is available via wxPlatformInfo instead of having to use
different functions for different pieces.
2020-12-12 15:23:17 +01:00
Vadim Zeitlin
5c4461a154 Return "" and not "Unknown" from wxMSW wxGetCpuArchitectureName()
This is more consistent with the Unix version, and easier to test for
in the application code.
2020-12-12 15:18:29 +01:00
Satya Das
86a3578a11 Fix syntax error in interface headers
Although these headers are not supposed to be compiled, it's still
better to avoid at least the obvious typos in them.

Closes https://github.com/wxWidgets/wxWidgets/pull/2140
2020-12-10 22:53:11 +01:00
Vadim Zeitlin
b4e1da1d6a Add wxWindow::GetAutoLayout() documentation
This function is not really useful for the application developers, but
should still be documented.

Closes #18917.
2020-12-08 18:47:38 +01:00
Vadim Zeitlin
d47fa718cd Add wxDataViewCtrl::ExpandChildren()
This convenient method allows to expand all children of the item
recursively.

This is directly supported by both native implementations, so it makes
sense to have this in wxDataViewCtrl itself, even if it could be also
(less efficiently) implemented in the user code.
2020-12-05 16:37:13 +01:00
Lauri Nurmi
b74702543b Rename wxPlatformInfo::*Arch* to *Bitness*, deprecate old names 2020-11-21 19:16:21 +02:00
Lauri Nurmi
68ea3c59f1 Explain in wxPlatformInfo docs that it means bitness when it says architecture
In the context of wxPlatformInfo, 'architecture' means either '32 bit' or
'64 bit'. Anywhere outside the context of wxPlatformInfo, this concept is
known as 'bitness'.

For the rest of the world, 'architecture' generally refers to the CPU
instruction set architecture, i.e. something like x86, x86_64, arm64, whereas
'operating system architecture' refers to the design of separating kernel
space, user space, etc.
2020-11-21 18:17:18 +02:00
Lauri Nurmi
493cc3571e Add wxGetCpuArchitectureName() for finding out CPU architecture
The returned value is OS-dependent and can be something
like: "x86_64", "x86", "arm64".

Closes https://github.com/wxWidgets/wxWidgets/pull/2121
2020-11-19 23:32:34 +01:00
Vadim Zeitlin
4bd0cd40f4 Merge branch 'persistent-combobox'
Add wxPersistentComboBox class and fix persistent classes compilation
when wxString implicit conversions are disabled.

See https://github.com/wxWidgets/wxWidgets/pull/2123
2020-11-19 23:30:51 +01:00
Vadim Zeitlin
4b375971b1 Add version information to wxPersistentComboBox documentation
Just add the previously forgotten "@since" tag.
2020-11-19 23:30:13 +01:00
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
7f5d45b9b4 Add wxPersistentComboBox for saving and restoring combobox items
This allows to preserve the history of user input.
2020-11-19 13:06:37 +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
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
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
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
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
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
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
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