Commit Graph

17623 Commits

Author SHA1 Message Date
Vadim Zeitlin
aaa9c80d66 Replace most of _WX_DEFINE_SORTED_TYPEARRAY_2 with template too
Add wxBaseSortedArray<> template instead of putting all the code inside
_WX_DEFINE_SORTED_TYPEARRAY_2 macro.

There should be no changes, but the code is now easier to read and
modify.
2018-06-03 17:12:12 +02:00
Vadim Zeitlin
b0d6b11ebe Always use wxVector<> for dynamic arrays implementation
Dramatically simplify dynamic array macros by keeping only the
implementation previously used in wxUSE_STD_CONTAINERS case and dropping
the other one, as we can use the std::vector-based implementation on top
of our own wxVector<>, which is available whether wxUSE_STD_CONTAINERS
is 0 or 1.

This allows to get rid of tons of ugly macro-based code without breaking
compatibility.
2018-06-02 13:56:06 +02:00
Vadim Zeitlin
9042a3fb16 Use shrink_to_fit() to implement Shrink() in C++11 build
If std::vector<> has shrink_to_fit() method, just use it instead of
using the swap-with-a-temporary hack.
2018-06-01 01:47:40 +02:00
Vadim Zeitlin
f9721266ae Replace 90% of _WX_DECLARE_BASEARRAY_2 with a template class
Use template class instead of a macro to make it easier to read and
modify this code.

No real changes.
2018-05-31 23:39:39 +02:00
Vadim Zeitlin
724409a10c Simplify wxSortedArray_SortFunction used in STL build
There is no need to pass the function type as the template parameter as
it's determined by the type of the objects being compared anyhow.
2018-05-31 19:47:08 +02:00
Vadim Zeitlin
a69cbd3d0c Merge branch 'wrap-gtk.h'
Add a wrapper for gtk/gtk.h allowing to avoid gcc 8 warnings when
including the GTK+ header directly.

See https://github.com/wxWidgets/wxWidgets/pull/814
2018-05-31 01:28:40 +02:00
Vadim Zeitlin
424f64f27d Fix invalid cast in wxMSW AutoHANDLE::InvalidHandle()
Somehow this compiled with the previous gcc versions (as well as MSVS),
but a static_cast from an integer wxUIntPtr type to a pointer HANDLE
type is obviously invalid and a reinterpret_cast is needed here.

This fixes compilation with g++ 8.
2018-05-27 22:56:05 +02:00
Vadim Zeitlin
6121b08b67 Compilation fix for wxGUIEventLoop in wxDFB
Rename YieldFor() to DoYieldFor() in the header too.

This was broken by f740cc3881
2018-05-23 17:20:39 +02:00
Maarten Bent
802c77b964 Fix building without precompiled headers on Windows 2018-05-22 17:04:42 +02:00
Vadim Zeitlin
7eef4a4549 Fix build with GTK+ < 2.20 due to undefined key code constants
Include gdk/gdkkeysyms.h from wx/gtk/private/gtk2-compat.h as it must be
included before it for the compatibility header to define the new names
for the key constants even when using old GTK+ versions.
2018-05-22 17:01:07 +02:00
Frédéric Bron
a195bf86a2 Make compilation with mingw-w64 possible with -std=c++17.
The definition of macros min and max in include/wx/msw/wrapgdip.h
b/include/wx/msw/wrapgdip.h was clashing with the new bessel functions
that use std::numeric_limits<T>::min/max.

So #include <cmath> before #include <gdiplus.h> and use using
declarations of std::min and max instead of macros.
2018-05-22 16:10:11 +02:00
Vadim Zeitlin
c0b0562533 Avoid many -Wparentheses warnings from gtk/gtk.h with gcc8
Add wx/gtk/private/wrapgtk.h wrapping gtk/gtk.h in pragmas disabling
these warnings and include it everywhere instead of directly including
gtk/gtk.h.

Also include wx/gtk/private/gtk2-compat.h from this wrapper header as it
was included by 90% of the files including gtk/gtk.h itself and it seems
to be better and simpler to just always include it.
2018-05-21 12:34:04 +02:00
Jeff Bland
8b18bbb9c7 Fix uses of wxPalette without check for wxUSE_PALETTE 2018-05-18 18:49:05 -06:00
Jeff Bland
26715a1fe0 Fix warning with missing override 2018-05-18 18:49:00 -06:00
Vadim Zeitlin
610db240a8 Consider g++ ABI 1011 to be compatible with 1002 too
The changes between 1010 (which was already considered equivalent to
1002) and 1011 don't seem to affect wxWidgets and the library compiled
with g++6 can be used from the application built with g++7 without any
problems.
2018-05-17 04:00:59 +02:00
Vadim Zeitlin
822809ef78 Stop forwarding DoPopupMenu() to wxGenericListCtrl main window
There doesn't seem to be anything wrong with just showing the popup menu
in this window itself and this avoids the need to do any coordinate
adjustments, which didn't work correctly for the menus shown over the
header window after the previous commit (and hadn't worked correctly for
the menus shown over the non-header area before it).

See #18133.
2018-05-17 03:41:53 +02:00
Vadim Zeitlin
f53923dd31 Left-align wxSpinCtrl contents by default
The default alignment of the text in wxSpinCtrl was changed to "right"
in 7e4952db83, which added alignment
support (see #10621), but this made it inconsistent with the native
up-down control under MSW and, perhaps more importantly, with spin
controls created from XRC as the default style was never modified there
and did not include wxALIGN_RIGHT.

Resolve this inconsistency by reverting to left-aligning the text by
default.
2018-05-12 19:14:00 +02:00
Frédéric Bron
232d123f8d Remove the separator static line in wxGenericCollapsiblePane
The horizontal static line was added to separate the button from the
child window when visible, but this didn't seem very useful and looked
bad and was inconsistent with the native GTK+ implementation as well as
similar controls commonly used under MSW (wxOSX already disabled the
static line use).

Just remove it to make things simpler and better looking.

Closes https://github.com/wxWidgets/wxWidgets/pull/804
2018-05-12 19:10:28 +02:00
Paul Cornett
9bfa890480 Build fixes for __WXUNIVERSAL__==1 2018-05-11 10:16:49 -07:00
Vadim Zeitlin
2e8516c5fe Merge branch 'MoveOutsideShortInterval' of https://github.com/catalinr/wxWidgets
Allow using positions in the entire int range for window positions under
MSW, and not just those in (slightly less than) short range, that are
supported by the native API.

Closes #4262.

Closes https://github.com/wxWidgets/wxWidgets/pull/779
2018-05-02 23:19:11 +02:00
Maarten Bent
59c37cb5eb Show correct save path when using compressed debug report
The compressed report location could be set to a different location from
the one shown in the dialog.

Closes #17176.

Closes https://github.com/wxWidgets/wxWidgets/pull/797
2018-05-02 15:36:11 +02:00
Vadim Zeitlin
6ae7aa4443 Fix saving/restoring window position for maximized windows
Save both the normal window geometry and its maximized position instead
of saving just its current position. This fixes restoring geometry of
the maximized windows as previously they were always restored on the
primary monitor, as their original position was lost.

Use the native {Get,Set}WindowPlacement() functions for a MSW-specific
wxTLWGeometry implementation to achieve this.

Closes #16335.
2018-04-29 20:35:44 +02:00
Vadim Zeitlin
d97c055514 Introduce platform-dependent wxTLWGeometry class
Previously, TLW geometry was implicitly defined as just its position,
size and the maximized/iconized state by wxPersistentTLW code. This
already wasn't enough for wxGTK which added the decoration sizes to the
geometry being saved/restored, but this had to be done using conditional
compilation, which was not ideal. And it didn't allow using an entirely
different geometry representation as will be done for wxMSW soon.

Change the code to use wxTLWGeometry class defining the geometry, as
used by the current port, explicitly and move wxPersistentTLW logic into
it, as wxPersistentXXX classes are supposed to be very simple, which
wasn't really the case.

Also provide public SaveGeometry() and RestoreToGeometry() methods in
wxTopLevelWindow, which can be useful even to people not using
wxPersistentTLW for whatever reason.

There should be no changes in behaviour so far.
2018-04-29 19:51:10 +02:00
Vadim Zeitlin
f04a46364c Remove useless forward declaration of wxTopLevelWindowBase
This class is fully declared just below, so there is no need to
forward-declare it.
2018-04-29 19:43:22 +02:00
Cătălin Răceanu
578474526f fix window position under MSW when limited by short range 2018-04-18 20:19:45 +03:00
Jan Niklas Hasse
496da2e550 Remove trailing whitespace from several files
No real changes.

See https://github.com/wxWidgets/wxWidgets/pull/787
2018-04-18 15:45:42 +02:00
Jan Niklas Hasse
8d02384792 Use wxString() instead of "" for empty strings
This will allow this code to work even when implicit conversion from
"const char*" is disabled in wxString and is already marginally more
efficient even now.

See https://github.com/wxWidgets/wxWidgets/pull/782
2018-04-17 22:32:25 +02:00
Vadim Zeitlin
e38866d3a6 Merge branch 'lzma'
Add support for using externally available liblzma via new
wxLZMA{Input,Output}Stream classes.

Closes https://github.com/wxWidgets/wxWidgets/pull/771
2018-04-06 15:41:36 +02:00
Vadim Zeitlin
1cdb384d7b Add wxLZMAClassFactory for run-time LZMA stream creation
This should allow handling .xz files in wxFileSystem, for example.
2018-04-06 15:39:55 +02:00
Vadim Zeitlin
50b102ffd2 Add wxLZMAOutputStream for compressing data using LZMA
As liblzma API is similar to zlib API, this class is also close to
wxZlibOutputStream, except that it uses reusable functions instead of
repeating their code.
2018-04-06 15:39:55 +02:00
Vadim Zeitlin
e66ade1b84 Factor out reusable part of wxLZMAInputStream into wxLZMAData
No changes yet, this is a pure refactoring in preparation for adding
wxLZMAOutputStream.
2018-04-06 15:39:55 +02:00
Vadim Zeitlin
af7e2901fe Add wxLZMAInputStream for decompressing data in XZ format
No compression support yet.
2018-04-06 15:39:55 +02:00
Vadim Zeitlin
311b2aee5f Check for liblzma headers in configure too and add wxUSE_LIBLZMA
Prepare for using liblzma in wxWidgets code by adding the necessary
option and updating the configure check for it (which had been already
present due to libtiff possible dependency on liblzma).

No real changes yet.
2018-04-06 15:39:39 +02:00
Vadim Zeitlin
bee28c2730 Use wxVector<> for wxBookCtrlBase::m_pages array
Get rid of another macro-based array in favour of wxVector<>.

No real changes.
2018-03-31 01:45:10 +02:00
Vadim Zeitlin
02a92e23f3 Reuse wxBookCtrlBase::DoSetSelection() in wxTreebook too
Avoid duplicating base class DoSetSelection() implementation in
wxTreebook, just extend it slightly by using DoGetNonNullPage() to allow
using a (sub-)page if the page associated to the selected item is null
and reuse it.

Also get rid of wxTreebook::m_actualSelection, it seems completely
unnecessary to bother keeping and updating it when we can just find it
whenever we need (which actually seems to only have been the case in the
now removed DoSetSelection() implementation anyhow).

As a side effect of this, wxTreebook pages should now be sizer correctly
when switching to them as DoSetSelection() in the base class does call
SetSize() on the page before showing it, unlike the previously used
version in wxTreebook, which omitted this call for some reason.

There should be no other user-visible changes.

Closes #4379.
2018-03-31 01:45:06 +02:00
Vadim Zeitlin
af6a61e3a0 Update wxBookCtrlBase::m_selection outside UpdateSelectedPage()
Change m_selection in wxBookCtrlBase::DoSetSelection() itself instead of
requiring all the derived class overriding do it in their overridden
UpdateSelectedPage().

No real changes, this is just a small simplification.
2018-03-31 01:45:05 +02:00
Vadim Zeitlin
058c085b21 Use wxVector<> in wxTreebookPage implementation
No real changes, just replace the use of a macro-based array with
wxVector<>.
2018-03-31 01:45:01 +02:00
Vadim Zeitlin
bb492b99bd Don't include wx/treectrl.h from wx/treebook.h any more
Remove an unnecessary header dependency. This is not completely
backwards-compatible as it would break any code relying on getting e.g.
wxTextCtrl declaration after including wx/treebook.h, but, hopefully,
there shouldn't be that much such code out there and fixing it shouldn't
be difficult.

If either of these assumptions turns out to be false, this commit can
always be reverted later.
2018-03-31 01:45:00 +02:00
Vadim Zeitlin
b97ea90f4f Add default value for MakeConfigFileName() 2nd argument
Make it possible to call wxStandardPaths::MakeConfigFileName() without
explicitly specifying the convention to use, to make it conform to the
documentation (previously this only worked when calling the
wxStandardPathsBase version of the method).

Closes #18106.
2018-03-17 17:17:05 +01:00
Paul Cornett
05454e778c Build fix for GTK+ < 2.18
Broken by 986f61f33e
2018-03-12 10:06:23 -07:00
Vadim Zeitlin
e5a1a29e77 Fix wxGTK build with glib < 2.32 and streamline the code a bit
Define g_signal_handlers_disconnect_by_data() if it's not available,
i.e. when using glib older than 2.32 where it was added, to fix the
build under old systems such as CentOS 6 broken by the changes of
8278f7b618 (see #18084).

Also use it elsewhere instead of g_signal_handlers_disconnect_matched()
as it's more readable.

Closes https://github.com/wxWidgets/wxWidgets/pull/760
2018-03-11 22:22:45 +01:00
VZ
e183b6d382
Fix miscellaneous build warnings
See https://github.com/wxWidgets/wxWidgets/pull/755
2018-03-07 18:25:32 +01:00
Maarten Bent
3b9aeaeb2f More use of wxOVERRIDE 2018-03-06 23:31:01 +01:00
Vadim Zeitlin
1f7a8a82c3 Round, rather than truncate, in wxSize and wxPoint operations
It seems to make more sense to round the result to int rather than to
truncate it when scaling wxSize or wxPoint coordinates by a floating
point number.
2018-03-06 16:08:01 +01:00
Vadim Zeitlin
bec7c9a161 Don't truncate to int in wxRealPoint::operator*()
wxRealPoint uses double coordinates and it makes no sense to truncate
the result of scaling it to int -- this was almost certainly a
copy-and-paste error due to copying the code of the corresponding
wxPoint method.
2018-03-06 16:06:35 +01:00
Vadim Zeitlin
9774d92e91 Change wxSize::Scale() to take double, not float
There doesn't seem to be any reason to use float here when double is
used everywhere else.

Moreover, the (implicit) conversion of int to float is not always
lossless, and resulted in -Wconversion warnings from g++ 7, which
disappear when using doubles.
2018-03-06 16:01:45 +01:00
Vadim Zeitlin
1540361e75 Avoid warnings about conversion to wxUint16 in wxUniChar code
This conversion is intentional, so suppress the -Wconversion warning
given by g++ 7 (if this warning is enabled) with an explicit cast.
2018-03-06 16:00:47 +01:00
Stefan Csomor
0fc53016a9 making NSString conversion functions available in private.h 2018-02-28 21:08:27 +01:00
Stefan Csomor
6b3b05e5f7 fixing classname 2018-02-28 16:24:43 +01:00
Stefan Csomor
a7505356a4 supporting Window Menu as Carbon did 2018-02-28 16:10:33 +01:00