Commit Graph

64583 Commits

Author SHA1 Message Date
Vadim Zeitlin
71cef5f3be Stop using wxBU_AUTODRAW in wxWidgets code
This style bit is obsolete and doesn't do anything, so remove confusing
references to it.
2018-07-21 14:42:06 +02:00
Vadim Zeitlin
5b703b6a24 Always use default margins for wxBitmapButton under Mac
Previously this was only done when wxBU_AUTODRAW was specified, making
this the only place in wxWidgets where this style was actually used.

This was not ideal, as the same code, not using wxBU_AUTODRAW, worked
just fine under MSW and GTK, but created ugly-looking buttons under Mac,
so do the right thing by default and let people call SetMargins(0, 0) if
they really don't want to have any margins.

Closes #18170.
2018-07-21 14:38:31 +02:00
Vadim Zeitlin
c4c4fb46d9 Remove unnecessary SetMargins() calls from wxBitmapButton ctor
Margins are overwritten by Create() anyhow, so there is just no need to
set them in the default ctor.
2018-07-21 14:35:56 +02:00
Vadim Zeitlin
d605405ca1 Fix building wxMSW GDI+ graphics code in non-Unicode build
Use wc_str() with GDI+ function which always takes wide strings, even in
non-Unicode build.

Closes #18172.
2018-07-21 14:08:45 +02:00
Vadim Zeitlin
d390bee8a2 Allow comparing wxString with wide strings in non-Unicode build
This fixes a compilation error in wxMSW private fonts support
implementation, which compares wxString with a wide string but, unlike a
local fix there, makes sense more broadly and should reduce the
likelihood of similar errors in the future.

It also makes comparisons with narrow C strings more efficient in the
default, Unicode, build by using wxString::Cmp() method instead of
creating a temporary wxString, as was done before.

See #18172.
2018-07-21 14:08:45 +02:00
Vadim Zeitlin
2fc20abbdd Merge branch 'fix-infobar-gtk3'
Make wxInfoBar appear for GTK+ 3 version between 3.10 and 3.29.

Closes https://github.com/wxWidgets/wxWidgets/pull/855
2018-07-21 13:28:19 +02:00
Vadim Zeitlin
4a53b029de Mark WXSTRINGCAST and related macros as obsolete in a comment
Make it clear that these macros are defined for compatibility only and
shouldn't be used.

See https://github.com/wxWidgets/wxWidgets/pull/857
2018-07-21 13:25:44 +02:00
Vadim Zeitlin
040e897fdb Merge branch 'objarray-ptr-compat'
Restore using object array of pointers broken by recent changes.

Closes #18169.

See https://github.com/wxWidgets/wxWidgets/pull/856
2018-07-21 13:21:27 +02:00
Jouk
fd4d38e657 Always include wx/display.h (also when wxUSE_DISPLAY=0) 2018-07-19 09:52:44 +02:00
Jouk
1f8ccb7726 Avoid incompatible macro redefinition 2018-07-18 13:06:34 +02:00
Stefan Csomor
85c2877a6c Support or disable "insert" for drag/drop wxDataViewCtrl on OSX, missed one part
see #18167
2018-07-16 20:37:09 +02:00
Stefan Csomor
d3e8d3f271 Support or disable "insert" for drag/drop wxDataViewCtrl on OSX
see #18167
2018-07-16 19:42:35 +02:00
Stefan Csomor
b554cf0018 Always add set the DataObject when starting the drag, regardless whether the event does, fixes crash
see #18167
2018-07-16 19:25:40 +02:00
Vadim Zeitlin
c482c2cb64 Make wxInfoBar in the dialogs sample more readable
As usual, when changing the background colour, we need to change the
foreground as well, otherwise the text risks becoming unreadable with
some default text colour values -- as was the case under GTK+ 3 with its
default theme.
2018-07-15 20:52:10 +02:00
Vadim Zeitlin
3e27a53e95 Make wxInfoBar actually appear when using GTK+ 3
Due to https://bugzilla.gnome.org/show_bug.cgi?id=710888 GtkInfoBar
wasn't shown if it had been hidden before -- which is exactly what
wxInfoBar did.

Fix this using the workaround proposed in the bug report, which makes
the info bar appear immediately, without any transition, which might be
not ideal, but markedly better than failing to show it at all.
2018-07-15 20:52:10 +02:00
Vadim Zeitlin
02ffdd16f6 Fix using WX_DECLARE_OBJARRAY() with pointer types
While this doesn't make, and never made, any sense (pointers should be
stored in a plain, non-object array), we still should continue to
support it for compatibility.

Fix the problem introduced by 97684a9267
by writing "T const&" instead of "const T&" as the latter didn't have
the same meaning when the macro parameter "T" expanded into "U*" as
"const" applied to "U", making this type incompatible with the actual
one.

Also extend the unit test to check for this.
2018-07-15 14:48:08 +02:00
Vadim Zeitlin
b227875f98 Remove CMPFUNC##T definition from WX_DECLARE_OBJARRAY macro
It is unnecessary and fails to compile when "T" is not an identifier
(but e.g. a pointer type).
2018-07-15 14:38:01 +02:00
Stefan Csomor
cc83925147 Factoring out common code, applying patch
Applying drag/drop result codes patch by dkulp see #18166, factoring out common code and adding proper setting of drop data in event.
2018-07-13 20:17:02 +02:00
Stefan Csomor
0e92eb13dc initializing m_ItemCell always 2018-07-13 18:22:45 +02:00
Vadim Zeitlin
61223ab32d Fix using radio buttons in wxDataViewToggleRenderer under macOS
Changing item cell in ShowAsRadio() was wrong as the item cell doesn't
exist when it is called and changing the column cell didn't seem to work
well, so just recreate the entire cell in it instead.

See https://github.com/wxWidgets/wxWidgets/pull/853
2018-07-13 18:16:16 +02:00
Stefan Csomor
6c6cc08975 Fixing drop on macos native dataview when wxNEEDS_UTF16_FOR_TEXT_DATAOBJ
see #18165
2018-07-13 10:44:44 +02:00
Stefan Csomor
24b8a2523d Undo change for notebook under 10.14, not needed under Beta 3 anymore
see #18146
2018-07-12 17:44:04 +02:00
pavel-t
82881d6b03 Use memcpy instead of strncpy in wxStrlcpy
Avoid stringop-overflow warning about strncpy size argument depending on source size.
Checking for null in src is not needed because it is already checked by strlen.
2018-07-12 12:19:07 +03:00
pavel-t
915b5212f8 Avoid unsafe casts to enum type 2018-07-12 11:18:12 +03:00
pavel-t
2171076e81 Avoid pointer overflow warning in wxPropertyGridPageState::DoRemoveFromSelection()
Looks like gcc8.1 think 'sel' can be empty after initialization. Avoid this by copying only the remaining entries.
2018-07-12 11:18:01 +03:00
Vadim Zeitlin
03a13591b9 Add wxDataViewToggleRenderer::ShowAsRadio()
This allows showing radio buttons in wxDataViewCtrl easily and natively.

Notice that this approach, adding an extra function to the existing
renderer class instead of creating some new wxDataViewRadioRenderer (see
https://github.com/wxWidgets/wxWidgets/pull/809), was finally chosen
because it is simpler to implement and, more importantly, because it
will be more natural to generalize if/when we also add a 3-state
check/radio renderer.

Closes https://github.com/wxWidgets/wxWidgets/pull/853
2018-07-11 23:48:14 +02:00
Vadim Zeitlin
58832ce8d7 Merge branch 'gtk1-fix'
Fix building wxGTK with GTK+ 1 after gtk/private/wrapgtk.h addition.

Closes https://github.com/wxWidgets/wxWidgets/pull/850
2018-07-11 19:26:16 +02:00
Vadim Zeitlin
3dd4fb3997 Document wxNO_UNSAFE_WXSTRING_CONV in wxString overview
Also add wxUSE_UNSAFE_WXSTRING_CONV to the list of wxUSE_XXX options
documentation and mention it in wxString overview as well.

See #11830.
2018-07-11 00:44:46 +02:00
Vadim Zeitlin
2034f6683b Disable use of wxSecretStore with wxGTK1
libsecret is for GTK+ 2+ only and can't be used with GTK+ 1.
2018-07-10 14:54:19 +02:00
Vadim Zeitlin
a74058a958 Fix wxGetKeyState() compilation with wxGTK 1
This was broken back in a73251a80d which
added check for GDK_WINDOWING_X11 which is not defined by GTK+ 1.

See #14469.
2018-07-10 14:54:19 +02:00
Vadim Zeitlin
8ebcfebc5c Fix wxGTK 1 build after gtk/gtk.h wrapper header addition
Changes of c0b0562533 to common code broke
wxGTK1 build, as wx/gtk/private/wrapgtk.h is for wxGTK 2+ only.

Fix this by handling wxGTK 1 separately and including gtk/gtk.h directly
for it.

Hopefully this code will be removed, together with the rest of wxGTK1
support, in some not so distant future.
2018-07-10 14:54:19 +02:00
Vadim Zeitlin
f54ac4e243 Merge branch 'searchctrl-improve'
Closes https://github.com/wxWidgets/wxWidgets/pull/851
2018-07-10 14:40:58 +02:00
Vadim Zeitlin
a0298f3149 Only drain all pending events when exiting outermost wxEventLoop
This is especially important under MSW, where the modality of the nested
event loops actually ends as soon as wxModalEventLoop::Exit() is called,
and so we must avoid dispatching any events in the current loop after it
happens or we risk reentering the same loop again, which could result in
e.g. parent modal dialog being closed before the child event loop
returns (because the event closing the former was dispatched from the
latter) and other unexpected sequences of events.

To prevent this from happening, only dispatch pending events after the
loop exit if it's the outermost loop, as there should be no danger in
doing it in this case. Conversely, we don't lose anything by not doing
this in nested event loops as the outer loop will take care of any
remaining pending events anyhow.

To make this work in an ABI-compatible way, add a global counter of the
currently existing event loops which is used to check if there is more
than one event loop currently running.

Closes #11273, #11573, #11269.
2018-07-10 14:40:05 +02:00
Vadim Zeitlin
cf966718e6 Add "hint" property support to XRC for wxComboBox too
It supports hints, as any/most wxTextEntry-derived classes.
2018-07-10 14:38:29 +02:00
Vadim Zeitlin
b6fde56e2e Allow "hint" property for wxSearchCtrl in the XRC schema
This should have been part of 652b4eb8ed
2018-07-10 14:37:31 +02:00
Vadim Zeitlin
a1e780f1b4 Remove mention of wxEVENTS_COMPATIBILITY_2_8 from the docs
This macro doesn't exist any more since almost 10 years (see commit
890d70ebea).
2018-07-10 12:42:51 +02:00
Anil
24820a5a67 Invalidate "hover" column index in wxHeaderCtrl if necessary
Don't leave "m_hover" invalid if the number of columns in wxHeaderCtrl
is reduced, as this would result in a crash later when it is used.

This notably fixes a crash after removing the last column from generic
wxDataViewCtrl.

Closes https://github.com/wxWidgets/wxWidgets/pull/852
2018-07-10 12:33:14 +02:00
Vadim Zeitlin
42ab122912 Shift the text control another pixel down in MSW wxSearchCtrl
It was too high otherwise, which was especially noticeable in high DPI.

This is still not perfect, as the default search bitmap is not centered
neither and is a couple of pixels too high, but better than before.
2018-07-09 20:50:48 +02:00
Vadim Zeitlin
4d4e95849a Fix size of wxSearchCtrl in the widgets sample in high DPI
Add missing FromDIP(), without it the control was too small.
2018-07-09 20:50:22 +02:00
Vadim Zeitlin
a38176c67a Make wxTextCtrl horizontal margins proportional to DPI
Add more FromDIP() calls.
2018-07-09 20:36:16 +02:00
Vadim Zeitlin
50aee9a0b3 Fix default size for wxSpinCtrl in high DPI
DEFAULT_ITEM_WIDTH is a constant, use FromDIP() around it to avoid
creating too narrow controls when using high DPI.
2018-07-09 20:35:42 +02:00
Vadim Zeitlin
9f04318720 Fix MSW EDIT_HEIGHT_FROM_CHAR_HEIGHT() for high DPI
Apply DPI scaling to the extra vertical margin added by this macro to
the font height.

This makes sense and results in wxTextCtrl (and other controls, e.g.
wxSearchCtrl) having the same height as native ones when using high DPI
too.

Note that this required adding wxGetEditHeightFromCharHeight() function
as one of the existing uses of EDIT_HEIGHT_FROM_CHAR_HEIGHT() wasn't
inside a wxWindow-derived class method and also adding wxUSE_GUI guard
around these GUI-only definitions as a function, unlike a macro, can't
be compiled without full wxWindow declaration in scope.
2018-07-09 20:24:58 +02:00
Vadim Zeitlin
c713bee7ea Remove unnecessary wxSearchCtrl::DoMoveWindow() override
There is no need to override this virtual function, if the control size
changes, a wxEVT_SIZE event is generated in any case, resulting in a
call to LayoutControls() without explicitly calling it from here.
2018-07-09 17:54:09 +02:00
Vadim Zeitlin
67bceedfda Get rid of m_searchButtonVisible and m_cancelButtonVisible
There doesn't seem to be any reason to have these flags, which duplicate
the visibility state of m_searchButton and m_cancelButton respectively.

Also update the buttons visibility immediately in ShowSearchButton() and
ShowCancelButton() instead of doing it in LayoutControls() as before,
which was confusing as laying out is not supposed to show/hide anything.

Finally, return true, not false, from IsSearchButtonVisible() if the
button is actually visible because there is an associated menu, even if
ShowSearchButton(false) had been called. This seems more logical and
makes the code simpler, but we need to check whether the native Mac
version also behaves like this or not.

No other changes in behaviour.
2018-07-09 17:12:02 +02:00
Vadim Zeitlin
ed8ac7059c Use more descriptive symbolic constants in wxSearchCtrl code
Replace LIGHT_STEP macro and 20 magic number with
SEARCH_BITMAP_LIGHTNESS and CANCEL_BITMAP_LIGHTNESS constants which are
a bit more clear, hopefully.

No real changes.
2018-07-09 16:50:10 +02:00
Vadim Zeitlin
587e0d8e64 Fix search button height in generic wxSearchCtrl
Make this button of exactly the bitmap size instead of using the full
control height for it, even if/when the bitmap is smaller.

This fixes some random junk being shown in the bottom two pixels of the
search button sometimes: this was due to only redrawing the part covered
by the bitmap in wxSearchButton::OnPaint(), leaving the rest of the
button unpainted (because wxSearchButton uses wxBG_STYLE_PAINT).
2018-07-09 14:37:43 +02:00
Vadim Zeitlin
7f1d08d5bd Ignore all changes to g++ ABI version since 1002
Checking for the exact match of __GXX_ABI_VERSION created more problems
(including for both Fedora and Debian packagers, see
https://github.com/wxWidgets/wxWidgets/pull/828) than it solved
(approximately 0), so relax it and assume that future g++ versions will
remain broadly compatible with the current ABI, which seems like a safe
assumption so far.

It's not really clear if there is any value in having this ABI check at
all, or if we should remove CheckBuildOptions() and all the code calling
it entirely, as it seems that there is no way to trigger this check
during run-time without getting a link error first. But keep it for now,
just because it's simpler to keep it than to remove it.
2018-07-09 00:40:55 +02:00
Artur Wieczorek
42932d4670 Limit the scope of a temporary variable 2018-07-07 20:30:38 +02:00
Artur Wieczorek
54c5584c65 Don't set column title if wxPG header is going to be hidden
wxPropertyGridManager::SetColumnTitle() shouldn't be called when we going
to hide the header because it makes the header visible.
2018-07-07 20:29:37 +02:00
Artur Wieczorek
0ee25cce3a Don't use external flag to determine if wxPG header is visible
Check if wxPG header really exists and is visible prior to any operation.

Closes #18128.
2018-07-07 20:28:11 +02:00