A single line MSW wxTextCtrl created with a value too long to fit into
it continued showing the value only partially even if its size was
subsequently increased to allow the entire value to be shown.
This apparently happens because changing the native EDIT control size
doesn't affect its (horizontal) scroll offset. Moreover, there doesn't
seem to be any way to explicitly tell the control to update it neither,
except for changing its text.
So do change its text every time its width changes, as long as it is not
visible (because visible jumps in the visible text position could be an
even worse problem than the one we're trying to solve here). This fixes
the originally reported bug at the cost of a bunch of extra calls to
DoWriteText() which should hopefully be not too expensive for single
line controls that don't typically contain that much text.
Closes#18268.
There is no reason to only make it protected for gcc and clang, recent
MSVS versions can also give a warning (C5204, which is disabled by
default, but makes sense to enable) otherwise.
Also remove the comment about obsolete gcc 3.4.5.
Closes#19011.
Co-Authored-By: Vadim Zeitlin <vadim@wxwidgets.org>
It was unexpected that using wxSizerFlags().Right().CentreVertical()
didn't right-align the item because CentreVertical() reset the alignment
in the horizontal direction rather than just setting it in the vertical
one, so change this, document the new behaviour explicitly and add a new
unit test checking for it.
Closes#18989.
As we still support C++98, don't use G_VALUE_INIT as the initializer:
it's a braced-init-list, which is only allowed in C++11.
Co-Authored-By: Paul Cornett <paulcor@users.noreply.github.com>
Get rid of ms_isInitialized as it must be kept synchronized with
ms_loaderDll.IsLoaded() anyhow, and it's simpler to not have it at all
rather than ensuring this.
Also ensure that calling Initialize() again, after doing it first
unsuccessfully, doesn't assert because ms_loaderDll is already loaded,
by only leaving it with a valid handle if the initialization succeeded.
Closes#19041.
wxGtkValue class was added back in 3f84cb17ca (Add wxActivityIndicator
control., 2015-03-06), but somehow never used. Start using it now
(better late than never...) as it makes the code simpler, shorter and
more robust.
No real changes.
This macro replaces the deprecated __Verify_noErr defined in the SDK.
It is different from assert, as the expression given to the macro is
always evaluated and then, if the result is not zero, and asserts are
on, an assert containing a human readable message with the description
of the error code is triggered.
Closes https://github.com/wxWidgets/wxWidgets/pull/1973
Co-authored-by: Vadim Zeitlin <vadim@wxwidgets.org>
The changes of 1065e61ab7 (Merge branch 'log-ms', 2021-01-16) broke
logging when timestamps were disabled as they still tried to format the
timestamp in this case, using empty timestamp, which resulted in an
assert.
Fix this and also make new code more similar to the existing one by
adding wxLog::TimeStampMS() helper parallel to the already existing
TimeStamp() and write it in the same way -- which notably ensures that
it does nothing when the timestamp is empty.
See #13059.
This event was processed in a worker thread, which was different from
all the other events and also almost surely not thread-safe, so change
this and queue it for processing in the main thread instead.
Use wxMemoryBuffer instead of non-owning pointer in wxWebRequestEvent
and reset the buffer used internally every time to ensure the data is
still available by the time the event is processed.
Also increase the amount of data downloaded in the "advanced" page of
the sample as it has to be greater than wxWEBREQUEST_BUFFER_SIZE, which
is currently 64KiB, to have a chance of seeing the value actually
change, otherwise all the data arrives in a single event. As it is,
using the maximal size supported by the httpbin service, we only get 2
events.
Revert 8535cde836 (Remove apparently unnecessary m_hasExplicitFont,
2020-07-14) and make 9cd3ab5ebd (Improve wxGenericTreeCtrl colours/fonts
updating on theme change, 2020-07-14) really work as expected by using
not only m_hasExplicitFont, but also m_hasExplicit{Fg,Bg}Col in order to
ensure that we only update the attributes if they hadn't been explicitly
set.
This is necessary because the hack with reusing m_has{Fg,Bg}Col didn't
work under Mac where the colour wasn't used at all when they were false.
This still seems to be a problem as the behaviour is different from that
of the other ports, but fixing this in wxOSX doesn't seem to be simple,
so don't rely on this working and use separate variables instead.
Closes#18940.
Remove a lot of Mac-specific code from wxStatusBarMac in favour of using
shared wxStatusBarGeneric:
- Now that wxFRAME_EX_METAL aka NSWindowStyleMaskTexturedBackground
doesn’t affect text placement, there’s no reason for customized
DrawFieldText(). As a side effect of this removal, ellipsizing fields
is now supported.
- Remove customized DoUpdateStatusText() code that is no longer needed.
See https://github.com/wxWidgets/wxWidgets/pull/2160#pullrequestreview-563916013
Semantics of this function wasn't really clear and it was used only
once, so just inline it at the point of use and define better what
happens for various states there.
Also use a switch rather than testing for individual states to make sure
this code is updated if another state is added in the future.
No real changes.
Under MSW, don't set the state to State_Cancelled as soon as Cancel()
was called, as the request was still used from the other threads
afterwards, resulting in race conditions and crashes.
Fix this by just removing the SetState(State_Cancelled) call from the
main thread, as it was redundant anyhow. This also makes the behaviour
correspond to the documentation, which indicates that Cancel() works
asynchronously.
Also ensure, for all backends, that we actually cancel the request only
once, even if public Cancel() is called multiple times. This required
renaming the existing wxWebRequestImpl::Cancel() to DoCancel().
It's better not to have this method in the public class, even if it
means that we need to pass a wxWebSessionImpl object to wxWebRequestImpl
ctor explicitly now.
No real changes.
No real changes, just use the same name as in the other backends for
consistency (we could also rename m_sessionImpl in the other ones to
m_sessionCURL and m_sessionURLSession respectively, but this would have
been more work and the latter name is really not great).
Although this was supposed to work, specifying "%l" in wxLog time stamp
format actually didn't because wxLog timestamps were stored as seconds.
Fix this by storing them as milliseconds and add a simple test (not
executed by default) showing that "%l" works correctly now.
Still keep the old wxLogRecordInfo::timestamp field for compatibility,
as it was documented.
See #13059.
It's up to the application code to decide how it handles the HTTP status
codes it gets back from server, there is no need to have a special
method for handling them in wxWebRequest itself.
We also shouldn't skip downloading the response body just because it was
unsuccessful, we may still need it (e.g. it's very common to return the
detailed error description in a JSON object in the message body when
returning some 4xx error), so don't do it in wxMSW implementation and
add a test verifying that we still get the expected body even for an
error status.
Also improve wxWebRequest::State values documentation.
This is helpful when trying to understand what is going on, especially
because CFNETWORK_DIAGNOSTICS, which is supposed to do the same thing at
native level, doesn't seem to work (at least under 10.14).
If wxBitmap with mask is added to wxImageList that doesn't support masks
we need to convert a bitmap mask to alpha channel values prior to adding
bitmap to the list to preserve bitmap transparency.
If wxBitmap with mask is added to wxImageList that doesn't support masks
we need to convert a bitmap mask to alpha channel values prior to adding
bitmap to the native list to preserve bitmap transparency.
Closes#19036.
This is shorter and doesn't imply that just the name (and not the full
path) is being returned.
Also rename wxWebResponse::GetFileName() to GetDataFile() for the same
reasons and for consistency. And document this previously undocumented
method.
There doesn't seem to be any reason to have this constant, so don't
define it and just interpret empty value of backend as meaning to choose
the default one in wxWebSession::New().
Also use critical section instead of a mutex, as this is more efficient
under MSW.
Main purpose of this commit is to make it clear that this mutex/critical
section is only used together with the data from the same struct.
No real changes.
This allows to write the code using this class without peppering it with
wxUSE_SECRETSTORE checks that would otherwise be necessary to support
Unix builds on system without libsecret.
No real changes.