Commit Graph

18093 Commits

Author SHA1 Message Date
Vadim Zeitlin
39e540edb7 Fix HeightCache DLL export declaration
Use CORE, not ADV, which doesn't exist any more.
2018-12-07 04:17:16 +01:00
Vadim Zeitlin
090491cdbc Minor style and formatting clean up of the new code
Fix typos in comments and indent them.

Wrap over-long lines.

Remove useless top-level const.
2018-12-07 04:17:16 +01:00
Vadim Zeitlin
9eea5cae23 Make RowRanges::GetSize() inline
No real changes.
2018-12-07 04:05:19 +01:00
jensgoe
d6a137b730 Improve wxDataViewCtrl performance with wxDV_VARIABLE_LINE_HEIGHT
Store the line heights in a cache to make the (generic) wxDataViewCtrl
usable with this style.
2018-12-07 04:05:16 +01:00
Vadim Zeitlin
1ca3e264be Merge branch 'qt-listbox'
Closes https://github.com/wxWidgets/wxWidgets/pull/1049
2018-12-07 00:33:09 +01:00
Liam Treacy
10381cb94e Deselect all items in wxQt wxListBox::SetSelection(wxNOT_FOUND)
Follow wxWidgets API convention in wxQt too.
2018-12-07 00:33:01 +01:00
Vadim Zeitlin
507e331eb1 Improve creating wxGCDC from an existing wxGraphicsContext
Avoid creating a default wxGraphicsContext unnecessarily, only to
immediately delete it and replace it with the provided one.

This was at best unnecessary and at worst resulted in a crash if the
default context couldn't be created, as happened on a headless system
(where wxImage-based wxGraphicsContext can still be created
successfully).
2018-12-06 03:40:49 +01:00
Vadim Zeitlin
54e9150157 Remove redundant wxDFBDCImpl::m_mm_to_pix_[xy] members
The base class already has exactly the same members, so just use them
instead.

No real changes, just avoid (or at least reduce) confusion.
2018-12-06 03:30:55 +01:00
Vadim Zeitlin
3dc16a7419 Compute wxDCImpl::m_mm_to_pix_[xy] on demand
If nothing else, this avoids 2 calls to each of wxGetDisplaySize() and
wxGetDisplaySizeMM() on each and every wxGCDC construction which are
completely unnecessary as wxGCDCImpl uses its own hardcoded resolution
of 72 DPI, as do some other classes deriving from wxDCImpl.

And even for the classes which do compute these fields using the display
resolution, it may still be unnecessary to do it as they can be never
used if neither GetSizeMM() nor SetLogicalScale() are called on the
corresponding wxDC object.

Finally, this is more than an optimization as when using Cairo-based
wxGCDC without display (which is explicitly supported), calling
wxGetDisplaySize() simply doesn't work at all.
2018-12-06 03:30:55 +01:00
Stefan Ziegler
e1a702a205 Fix removing and inserting pages in wxToolbook
Removing a page from wxToolbook could result in crashes due to
dereferencing the now invalid page index. Fix this by not assuming that
the page index is the same as its tool ID, but adding functions to
explicitly map one to the other.

Also fix inserting pages into wxToolbook, which worked as appending them
before.

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

Closes #18275.
2018-12-05 17:23:57 +01:00
Liam Treacy
5e089badc0 Fix bitmap accessor for the buttons in wxQt
Return the bitmap previously set with SetBitmap().

This fixes unit tests using GetBitmap().

Closes https://github.com/wxWidgets/wxWidgets/pull/1035
2018-12-05 03:00:49 +01:00
Liam Treacy
16c121d4d3 Implement [GS]etLabel() for wxStaticText and wxCheckBox in wxQt
This allows the corresponding unit tests to pass.

Closes https://github.com/wxWidgets/wxWidgets/pull/1033
2018-12-05 02:55:54 +01:00
Vadim Zeitlin
7e22ddd27c Merge branch 'qt_menubar' of https://github.com/GeoTeric/wxWidgets
Improve radio menu items support in wxQt and make the menu unit tests
pass for it, although some of them had to be disabled.

See https://github.com/wxWidgets/wxWidgets/pull/1030
2018-12-05 02:53:37 +01:00
Daniel Kulp
727a100a6a Handle wxEVT_SYS_COLOUR_CHANGED in wxAUI classes
Update the colours used when the system theme changes.

This is especially important to use the colour scheme compatible with
macOS 10.14+ dark mode.

Note that this commit is best viewed with "git diff --color-moved".

Closes https://github.com/wxWidgets/wxWidgets/pull/916
2018-12-03 19:48:32 +01:00
Stefan Ziegler
974b7c0990 Add wxToolbook::EnablePage()
Add functions to enable or disable pages inside wxToolbook.

Using the new functions you can present disabled icons so that the user
can expect more functionality and you do not need to add/remove pages in
different states.

Closes https://github.com/wxWidgets/wxWidgets/pull/1038
2018-12-03 19:42:45 +01:00
Maarten Bent
2f78849d24 Fix build without precompiled headers 2018-11-26 23:51:40 +01:00
Maarten Bent
3bab07edcf Fix some build warnings
private field 'm_dwCookie' is not used
'return' will never be executed
result of comparison of unsigned enum expression < 0 is always false
'FlushDC' overrides a member function but is not marked 'override'
potentially uninitialized local variable 'bound' used
2018-11-25 21:29:38 +01:00
Maarten Bent
bcf53d6b96 Fix extra semicolon warnings 2018-11-25 21:29:37 +01:00
Maarten Bent
39ff5b90e5 Replace wxDeprecatedGUIConstants enum values 2018-11-25 21:29:32 +01:00
Richard Smith
6b7b43d1fe Get WxQt menu titles passing GUI tests 2018-11-21 12:58:23 +00:00
Vadim Zeitlin
f7514dc79d Suppress harmless gcc -Wfloat-equal in wxNumValidator code
Exact comparison with 0 here is fine, so just disable the warning for
this code.

Closes #18271.
2018-11-20 14:11:53 +01:00
Vadim Zeitlin
20b02d6169 Rename new wxTranslations method to GetAcceptableTranslations()
This name seems to be more precise than a very generic "all good" one
used previously.
2018-11-18 01:47:12 +01:00
Lauri Nurmi
5d08e404c7 Allow getting all usable translations languages
Add a method to return the full list of translations that can be used,
generalizing the existing GetBestTranslation().
2018-11-18 01:47:12 +01:00
Artur Wieczorek
ea7f86d9f7 Use wxVector<int> instead of wxArrayInt 2018-11-14 22:37:16 +01:00
Artur Wieczorek
c05fac0ade Don't re-enter wxComboCtrlBase::HidePopup
Under wxMSW this method is re-entered due to triggering EVT_ACTIVATE when EVT_LEFT_UP is being already handled.
We need to prevent this to avoid generating spurious EVT_TEXT events and raising errors on calling SetFocus().

Closes #18260.
2018-11-14 21:30:35 +01:00
John Gehrig
b07305234c Fix dragging beyond the rightmost column in generic wxHeaderCtrl
Dragging a column header in a wxHeaderCtrl and dropping it past the
rightmost column resulted in a crash due to accessing a column with
invalid index.

Fix this and correctly move the column to the last position when this
happens instead.

This bug notably affected dragging columns in wxGrid.

Closes https://github.com/wxWidgets/wxWidgets/pull/972
2018-11-12 00:08:13 +01:00
jbbbms
87195cf3ea Put wxDECLARE_EVENT_TABLE at the end of wxTextCtrl declaration
This fixes the access specifier effectively used for the members
following these macros, as it's changed to "public" inside them, meaning
that e.g. m_privateContextMenu was actually public even though it was
ostensibly declared in the private section and the intention was for it
to be private.

Closes #16038.
2018-11-10 23:37:33 +01:00
Artur Wieczorek
c86f795914 Move shared wxVector utilities to one place 2018-11-10 22:27:57 +01:00
Artur Wieczorek
43f7e35c52 Explicitly return Boolean value as declared 2018-11-10 20:56:24 +01:00
Artur Wieczorek
e2115d0d6f Remove unneeded calls to c_str() 2018-11-10 20:44:54 +01:00
Artur Wieczorek
322d6874c3 Use wxVector<> instead of wxArrayPGProperty 2018-11-10 20:43:58 +01:00
Vadim Zeitlin
664b8c153f Don't export sorted dynamic arrays from the shared library
This shouldn't be necessary and doing it seems to result in duplicate
symbol errors when using MSVC under some not completely elucidated
circumstances.

See https://github.com/utelle/wxpdfdoc/pull/48

Closes https://github.com/wxWidgets/wxWidgets/pull/1013
2018-11-10 12:17:53 +01:00
Vadim Zeitlin
463deb03c9 Merge branch 'gtk-dpi'
A bunch of improvements for per-monitor DPI support in wxGTK and
wxGraphicsContext more generally.

Closes https://github.com/wxWidgets/wxWidgets/pull/995
2018-11-10 12:15:27 +01:00
VZ
cce9ef9d53 Fix compatibility breakage with wxMask::Create() in wxOSX (#1019)
Defining a Mac-specific Create(wxMemoryBuffer) overload hid the other
Create() overloads, which are actually part of the public API, so they
couldn't be used any longer since the changes of
e7d21f6638

Fix this by renaming this Create() to OSXCreate(), to avoid hiding the
base class methods.

Also remove Mac-specific ctor taking wxMemoryBuffer, this is confusing
and can be avoided by just calling OSXCreate() directly in the only
place where it is used.
2018-11-09 17:52:58 +01:00
Vadim Zeitlin
3d18e1a2b4 Merge branch 'joystick-fixes'
Harmonize joystick events between different platforms.

See https://github.com/wxWidgets/wxWidgets/pull/1017
2018-11-07 18:33:26 +01:00
Vadim Zeitlin
5e53b22bd4 Add wxGraphicsContext::GetWindow()
This method allows to retrieve the window this context is associated
with, if any.

Add "wxWindow*" argument to wxGraphicsContext ctor and provide the
window pointer to it when available, i.e. when creating the context from
a wxWindow directly or from wxWindowDC, which is also associated with a
window, in platform-specific code.

No real changes yet.
2018-11-06 03:36:53 +01:00
Vadim Zeitlin
3e246c767f Return true from wxHyperlinkCtrl::MSWOnNotify()
As SendEvent() not only sends the event about clicking on the link, but
also opens the link in the default browser if this event was not
processed (which wasn't really obvious from its name, so at least
mention it in its comment), the event is actually always handled and so
MSWOnNotify() must return true, not false (and definitely not 0) to
indicate it.

Closes #18266.
2018-11-05 19:35:44 +01:00
Vadim Zeitlin
1c68979fb4 Move wxCTZ() documentation to the appropriate place
The documentation comment belongs to interface/wx/math.h, not the header
under include.

Also change the argument type to wxUint32 as the non-gcc version only
works for 32 bit values.
2018-11-05 19:27:53 +01:00
Mick Phillips
291a880d0c Synchronize joystick events between all ports
Generate wxJoystickEvent with the same fields under all platforms by
making the Linux and macOS versions follow MSW convention of using
"1 << N" for the changed button.

Add GetButtonOrdinal() accessor which can be used to retrieve just N.

Closes #18233.
2018-11-05 19:27:36 +01:00
Vadim Zeitlin
84d3ee10cc Merge branch 'simplify-imagelist'
Merge Mac-specific and generic wxImageList versions and modernize the
code.

See https://github.com/wxWidgets/wxWidgets/pull/1001
2018-11-04 14:15:16 +01:00
Artur Wieczorek
161bb592ce Use wxVector<int> instead of wxArrayInt 2018-11-01 18:22:22 +01:00
Artur Wieczorek
e7357eafa2 Declare array explicitly as a wxVector instead of using wxArrayPGProperty alias 2018-11-01 18:19:56 +01:00
Paul Cornett
e13a2cfd03 Make wxGtkStyleContext ctor explicit, just to be safe 2018-11-01 08:50:59 -07:00
Paul Cornett
5ff0d3a458 Improve wxRendererGTK drawing with HiDPI 2018-11-01 00:11:31 -07:00
Vadim Zeitlin
5ee0edde99 Merge branch 'propagate-inform-first-dir'
Fix some layouts involving wxWrapSizer by correctly propagating
InformFirstDirection() call to the nested sizers that need it.

See https://github.com/wxWidgets/wxWidgets/pull/988
2018-11-01 00:13:18 +01:00
Vadim Zeitlin
f57cb6c1d9 Add wxDisplay(wxWindow*) ctor with fall back on primary display
This is more convenient than calling GetFromWindow() and then checking
its return value.
2018-11-01 00:02:47 +01:00
Vadim Zeitlin
83a7b49954 Always store wxBitmap objects in wxGenericImageList
There doesn't seem to be any point in storing pointers to wxBitmap or
wxIcon and storing the objects directly allows to avoid an extra heap
allocation and all the code dealing with freeing memory when replacing
or removing images from the list, making things much simpler.

Also use wxVector<> for storage instead of the obsolete and ugly
wxObjectList.

There shouldn't be any user-visible changes.
2018-10-31 15:35:30 +01:00
Vadim Zeitlin
3b5441f59e Deprecate wxGenericImageList::GetBitmapPtr()
This function was in effect deprecated since 2.5.5 (!) and it's not
finally time to do it formally and to stop using it in wxWidgets own
code.
2018-10-31 15:35:30 +01:00
Vadim Zeitlin
61e4534bd2 Deprecate useless wxGenericImageList::Create() overload
This overload doesn't do anything and doesn't exist in the MSW version,
so deprecate it.
2018-10-31 15:32:23 +01:00
Silent
6fff1c37b5 Avoid using mismatched translations for wxWizard buttons
Cache labels for "Next>" or "Finish" button in wxWizard so that their
translations stay consistent throughout wizard's lifetime: previously,
this button could use a label in a different language if the currently
used translations have changed since the wizard creation, as this label
was recreated on every page change, unlike the other labels which were
only translated once in the very beginning.

Closes https://github.com/wxWidgets/wxWidgets/pull/1000
2018-10-30 23:45:12 +01:00
Vadim Zeitlin
9f8684c789 Factor out wxDisplayImpl::ComputePPI() helper
No real changes, this is a pure refactoring.
2018-10-30 23:43:29 +01:00
Vadim Zeitlin
26c6db4b90 Replace wxGenericImageList::m_{width,height} with m_size
Using a single wxSize variable is slightly simpler and shorter than
using 2 ints.

No real changes.
2018-10-30 22:01:32 +01:00
Stefan Csomor
9a05410470 Adding IsSolid to wxColour
Under macOS colors can be patterns, then accessors for RGB values are useless, IsSolid returns true if the color can be expressed in RGB values at all.
2018-10-30 20:53:35 +01:00
Vadim Zeitlin
c374eefd34 Fold wxOSX-specific wxImageList into generic version
Get rid of wxOSX wxImageList implementation as it was 99% identical to
the generic version and the non-identical parts should really have been
made part of the generic version too from the beginning.

Notably, use GetScaled{Width,Height}() in Add() method in the generic
version too now.
2018-10-30 16:28:07 +01:00
Vadim Zeitlin
a2a3518b71 Also remove wxImageList::Replace(wxIcon) overload from wxOSX
This one is harmless, unless Add() overload removed by the previous
commit, but still unnecessary.
2018-10-30 16:28:07 +01:00
VZ
3ab2bfd62a Remove unused wx/osx/icon.h header (#998)
This header isn't necessary any longer after the changes of
0bdd7e5f48
2018-10-30 09:34:19 +01:00
VZ
d118ca6c56 Remove wxImageList::Add() overload taking wxIcon from wxOSX (#997)
This is not necessary as wxIcon is implicitly convertible to wxBitmap
anyhow, so calling Add(icon) works using the existing Add(wxBitmap)
overload, and is actually harmful because of the wrong icon size check
in this function, which used physical bitmap size instead of the logical
(scaled) size.

Closes #18188.
2018-10-30 09:31:15 +01:00
Vadim Zeitlin
53f527726e Merge branch 'use-scrollbar-fixes'
Minor fixes, mostly add wxUSE_SCROLLBAR guards.

See https://github.com/wxWidgets/wxWidgets/pull/989
2018-10-29 23:15:39 +01:00
Vadim Zeitlin
a34bedd7b5 Revert "Add guard over wxMSWDateControls"
This reverts commit f1fa6d5ea2 which
doesn't seem correct nor necessary.
2018-10-29 23:12:57 +01:00
Vadim Zeitlin
f09b9dbfa2 Add wxDisplayImpl::GetScaleFactor() and implement it for wxGTK
We need to account for the scale factor under GTK+ (and, presumably,
under macOS) to compute the correct PPI value as it must use the number
of physical and not logical pixels.
2018-10-29 18:33:26 +01:00
Vadim Zeitlin
8890a25db3 Merge branch 'setup-h-cmake' of https://github.com/MaartenBent/wxWidgets
Fix issues with generating setup.h.in.

See https://github.com/wxWidgets/wxWidgets/pull/994
2018-10-29 15:18:43 +01:00
Vadim Zeitlin
5d5654742f Merge branch 'msw-popup'
Reimplement wxPopupWindow using WS_POPUP instead of WS_CHILD window in
wxMSW as the new approach allows using the controls inside the popup
normally, unlike the old one.

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

Closes #18243.
2018-10-27 15:08:22 +02:00
Maarten Bent
c41255bd98 Add recent macOS setup.h defines to correct file
It was added to setup.h, not setup_inc.h. Regenerating setup.h would remove the defines.
2018-10-24 19:30:41 +02:00
Stefan Csomor
651e1cd1b5 Supporting newer transparent background API 2018-10-22 22:36:42 +02:00
Stefan Csomor
7dfbe50fc0 fixing proper font rendering color when using emulated bold
when the stroke width is set in macOS (emulated bold), the stroke color was not correctly set - unless text color was black
2018-10-22 17:43:31 +02:00
Tim Stahlhut
09aa25ab4a Add wxUSE_SCROLLBAR guards in wxUniversal 2018-10-21 22:01:50 -04:00
Tim Stahlhut
f1fa6d5ea2 Add guard over wxMSWDateControls 2018-10-21 22:01:49 -04:00
Tim Stahlhut
caa6e5de2f Add message "wxStyledTextCtrl requires wxUSE_SCROLLBAR" 2018-10-21 22:01:49 -04:00
Tim Stahlhut
71a2fc0706 Forward declare wxQt template class 2018-10-21 22:01:49 -04:00
Vadim Zeitlin
c6cc416977 Propagate InformFirstDirection() to wxCollapsiblePane pane
As wxCollapsiblePane doesn't use sizers for layout (and while this could
be changed for the generic version, it still wouldn't fix the problem
for the native one), default InformFirstDirection() implementation
forwarding it to the window sizer doesn't work for it and we need to
explicitly let the contents of wxCollapsiblePane know about the
available size.
2018-10-21 16:45:24 +02:00
Vadim Zeitlin
e397d5d825 Propagate InformFirstDirection() calls to wxBoxSizer children
InformFirstDirection() is required to let wxWrapSizer calculate its best
height from its current width (or vice versa, but usually in this
sense), but it only worked if wxWrapSizer was an immediate child of
another size doing layout but not if wxWrapSizer was inside another
wxBoxSizer which was contained in a top-level sizer.

Explicitly forward calls to InformFirstDirection() to wxBoxSizer
children to fix this and make wxWrapSizers nested in wxBoxSizer work.

Note that there are still many problems in this code, including but not
limited to:

- Doing this forwarding for the sizer minor direction only.
- Not passing the correct value of "availableOtherDir".
- Still calling InformFirstDirection() from RecalcSizes(), when it's too
  late to change the min size returned by CalcMin().
- Inconsistency: wxGridSizer calls InformFirstDirection() from its
  CalcMin(), wxFlexGridSizer calls it from its RecalcSizes(),
  wxGridBagSizer doesn't call it at all.

All this size-in-first-direction logic really needs to be completely
reviewed, but for now at least make wxWrapSizer inside a wxBoxSizer work
as well, or as badly, as wxWrapSizer on its own.
2018-10-21 15:58:33 +02:00
Vadim Zeitlin
56c4191168 Reimplement wxPopupWindow as a WS_POPUP window under MSW
Don't use the child window of the desktop window for popup windows under
MSW, while this worked in simplest cases, it didn't allow having
functional controls inside a wxPopupWindow as e.g. wxTextCtrl didn't
accept input it at all if created as a child of such window.

Instead, switch to using a top-level window, with WS_POPUP style, and
fix the problem with the loss of activation by explicitly pretending to
still be active in the owner window when losing activation to our own
popup (thanks to Barmak Shemirani for providing this solution).

Also use an MSW-specific and much simpler implementation of detecting
when the popup should be dismissed in wxPopupTransientWindow: instead of
capturing mouse or tracking focus, just react to activation loss
directly.

Add a wxTextCtrl to the popup in samples/popup to show that editing it
works now.
2018-10-20 22:50:46 +02:00
Artur Wieczorek
5fb9d8d244 Use dedicated function to change flag 2018-10-13 23:33:21 +02:00
Vadim Zeitlin
bc974910ec Implement setting bitmaps for the menu item for wxQt
Closes https://github.com/wxWidgets/wxWidgets/pull/975
2018-10-11 14:40:20 +02:00
Vadim Zeitlin
8e1c4e9238 Avoid harmless signed/unsigned warning in g++ 5.4 wxGTK build
Change GTKGetEntryTextLength() to return a signed value, as it's always
either assigned to or compared with the signed variables anyhow.

This avoids a couple of -Wsign-compare warnings when building with g++
5.4 from Ubuntu 16.04.
2018-10-11 01:05:43 +02:00
Vadim Zeitlin
b0c025e9fd Build fix for wxUSE_CONSOLE_EVENTLOOP==0 under Unix
Don't declare GetEventLoopSourcesManager() in Unix wxAppTraits if
console event loops are not used.

See https://github.com/wxWidgets/wxWidgets/pull/953
2018-10-10 19:07:28 +02:00
Vadim Zeitlin
e9ecc6728f Always include X11 headers from the private X11 display header
Commit 28ab24cd55 excluded too much in
wxUSE_DISPLAY==0 case, we still need X11 headers when not using
wxUSE_DISPLAY.
2018-10-10 14:14:48 +02:00
Paul Cornett
4ad6f67147 Fix build with wxUSE_PALETTE==0 2018-10-09 22:24:58 -07:00
Vadim Zeitlin
54ef52fbd9 Merge branch 'display-funcs'
Implement all global functions in terms of wxDisplay and add
wxDisplay::GetPPI().

See https://github.com/wxWidgets/wxWidgets/pull/963
2018-10-09 16:31:54 +02:00
Vadim Zeitlin
28ab24cd55 Add missing wxUSE_DISPLAY check to X11 display header
Don't define functions dealing with video modes etc when
wxUSE_DISPLAY==0.
2018-10-09 15:28:28 +02:00
Vadim Zeitlin
818d69f113 Make wxDataViewCtrl::FromGTKColumn() public and rename
This function has to be called from a GTK+ callback, so make it public
and also rename to GTKColumnToWX() to conform to the naming convention
mandating the use of "GTK" prefix for the public methods which are not
part of the public API.
2018-10-09 15:12:42 +02:00
Vadim Zeitlin
ded2894b78 Add wxDisplay::GetPPI() to use instead of wxGetDisplayPPI()
While this is not done for all the ports yet, the new API allows
returning different PPI values for different monitors, unlike the old
(and still existing, but implemented in terms of the new one) global
function.
2018-10-08 13:04:38 +02:00
Vadim Zeitlin
309f942aa6 Merge branch 'qt-build'
Minor wxQt API fixes and simplifications.

See https://github.com/wxWidgets/wxWidgets/pull/962
2018-10-07 19:55:37 +02:00
Vadim Zeitlin
24b5e256df Add wxDisplay::GetDepth() and use it for wxDisplayDepth()
Allow getting the depth of any display, not just the primary one, even
though this is not implemented for Unix ports currently.

Mostly do this for consistency with the other display-related functions.
2018-10-07 00:30:12 +02:00
Scott Furry
f8c14d1176 Define more wxToolBar::SetToolXXX() methods in wxQt
Provide a stub for SetToolShortHelp() and really implement
SetTool{Normal,Disabled}Bitmap().
2018-10-06 14:07:02 +02:00
Scott Furry
2ea9548ffb Add default argument values to wxToolBar::CreateTool() in wxQt
Make the API consistent with the other ports.
2018-10-06 14:06:55 +02:00
Vadim Zeitlin
e0ba727dec Extract X11 functions used by wxGTK in a separate header
This makes src/unix/displayx11.cpp almost readable as it's not littered
by "#ifndef __WXGTK20__" checks everywhere any more -- instead this file
is just not compiled as part of wxGTK2 at all any longer (it is still
included in wxGTK1 as well as wxX11 itself and wxMotif).

wxGTK code also can just include the new wx/unix/private/displayx11.h
instead of having to declare all the X11 functions it uses manually.

There should be no changes in behaviour, this is just a clean up.
2018-10-04 17:07:11 +02:00
Vadim Zeitlin
9cc1424b84 Return empty string from wxDisplayImpl::GetName() by default
Simplify the code by not making this function pure virtual as all the
ports except MSW had to override it just to return an empty string.

Instead, just return empty string by default as it's not critical to
force the derived classes to override this function.
2018-10-04 16:37:12 +02:00
Maarten Bent
32d32f8172 Revert "Fix missing wxOwnerDrawn functions in WXQT wxMenuItem"
This reverts commit 4e23b3e7f4.
wxOwnerDrawn is only used with wxMSW toolkit.
2018-10-01 21:47:33 +02:00
Vadim Zeitlin
761f9f74fc Merge branch 'simplify-display'
Centralize all display-related code in wxDisplay class and avoid
duplicating or reimplementing it in wxDisplaySize() and
wxClientDisplayRect() functions.

See https://github.com/wxWidgets/wxWidgets/pull/955
2018-10-01 13:52:07 +02:00
Stefan Csomor
00197d0c75 removing the menu from the public API of wxChoice on osx
on iOS pickers are having data sources that are not implemented using a menu, therefore the implementation API had to be changed
2018-10-01 08:28:41 +02:00
Stefan Csomor
ca6cae20e8 Adding more osx types as opaque public types 2018-10-01 08:12:03 +02:00
Stefan Csomor
c2ab36a2da add implicit conversion to NSArray* 2018-10-01 08:10:13 +02:00
Stefan Csomor
ef48d7f184 set wxOSX_USE_ICONREF to 0 if not defined 2018-10-01 07:21:49 +02:00
Vadim Zeitlin
ddc88b74b6 Remove unnecessary DLL export declarations for private classes
wxDisplayFactory and wxDisplayImpl don't have to be exported from the
wxWidgets shared libraries and, in fact, shouldn't be.
2018-09-30 23:08:43 +02:00
Vadim Zeitlin
c2162792cf Implement wxDisplaySize() and wxClientDisplayRect() via wxDisplay
Instead of forwarding to these functions from wxDisplay implementation
in wxUSE_DISPLAY==0 case, make the functions themselves wrappers around
wxDisplay, which may, or not, depending on the platform, have a simpler
implementation in wxUSE_DISPLAY==0 case, but is always available in any
case.

As part of this change, only use src/osx/core/display.cpp in macOS
builds, not iOS ones and update the Xcode project accordingly too.

This cuts down on code duplication, especially in wxGTK, and facilitates
further additions to wxDisplay API.
2018-09-30 23:07:45 +02:00
Maarten Bent
7f0d7ef520 Fix several build errors in WXQT
Move declaration of wxOwnerDrawnBase::ms_defaultMargin to correct file.
Do not include headers when wxUSE_UIACTIONSIMULATOR is disabled.
Add guards for wxUSE_DRAG_AND_DROP.
Use a different wxFont constructor in printing sample, which is also available in WXQT.
2018-09-30 17:23:58 +02:00
Maarten Bent
4e23b3e7f4 Fix missing wxOwnerDrawn functions in WXQT wxMenuItem 2018-09-30 17:23:58 +02:00
Maarten Bent
bb82470640 Fix missing gl functions in WXQT 2018-09-30 17:23:58 +02:00
Maarten Bent
8f017509f6 Remove wxConsoleEventLoop from WXQT
The console event loop in the wxBase library is GUI toolkit independent.
2018-09-30 17:23:58 +02:00
Vadim Zeitlin
990c8bfd73 Cache wxDisplayImpl object for faster access
Avoid a heap allocation on every wxDisplay creation by caching the
wxDisplayImpl objects once they're created.

Currently we never invalidate the cache, but we should add a way to do
it in the future.

This speeds up wxDisplay::GetGeometry() benchmark by a factor of 4.
2018-09-30 00:53:59 +02:00
Vadim Zeitlin
b4aaa10032 Fix wx/display.h compilation when it's the first included header
Include wx/defs.h to ensure that wxUSE_DISPLAY is defined before it is
checked for.
2018-09-30 00:38:27 +02:00
Vadim Zeitlin
bac28b95cd Move wx/display_impl.h to wx/private/display.h
This shows more clearly that this header is private to wxWidgets and
can't be included by user code.

No real changes.
2018-09-30 00:38:26 +02:00
Vadim Zeitlin
96ecfd8c77 Provide wxPGChoices ctor, Add(), Set() overloads taking wxStrings
Allow passing an array of wxStrings in addition to an array of wxChar*
strings.
2018-09-29 17:13:00 +02:00
Vadim Zeitlin
b624064659 Call Add(), not Set(), from wxPGChoices ctors
There is no need to call Free() on a newly constructed object and Set()
is just Free() followed by Add().

No real changes.
2018-09-29 17:01:17 +02:00
Vadim Zeitlin
378f62bd08 Improve documentation of wxPGChoices ctor and Add() methods
Mention that the "labels" array must be NULL-terminated and that
"values" must have at least as many items, if they're provided at all.
2018-09-29 16:55:16 +02:00
Vadim Zeitlin
713a7ab895 Move wxUSE_ENH_METAFILE check inside wx/msw/enhmeta.h itself
This is more consistent with the other headers, which are safe to
include even when the corresponding feature is turned off.

Also remove the now redundant wxUSE_ENH_METAFILE checks in the source
code including this header.

See https://github.com/wxWidgets/wxWidgets/pull/951
2018-09-26 14:47:45 +02:00
Stefan Csomor
494581c542 macOS wxStaticBitmap missing commit 2018-09-25 15:59:50 +02:00
Stefan Csomor
19c4d8cf3e macOS, iOS native implementation for wxStaticBitmap
templated native images are not drawing correctly using the low-level drawing calls, therefore use the native Image Views
2018-09-25 15:22:56 +02:00
Vadim Zeitlin
a02ed536e6 Add support for more than 4 joystick buttons under MSW
Use polling thread instead of relying on MM_JOYXXX events to allow
receiving events from all the supported buttons.

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

Closes #1142.
2018-09-25 01:03:58 +02:00
Paul Cornett
7872b9fd38 Deprecate Set{Height,Width,Depth} for other platforms as well
Fixes GTK build with --disable-compat30
See https://github.com/wxWidgets/wxWidgets/pull/925
2018-09-23 20:02:21 -07:00
Stefan Csomor
9bfa4c6da3 further cleanup 2018-09-24 00:12:33 +02:00
Stefan Csomor
f29faa0217 optimize handling of high-res native images 2018-09-24 00:12:33 +02:00
Stefan Csomor
266f32493e Removing non-native bitmap code, using common code for iOS and macOS 2018-09-24 00:11:31 +02:00
Stefan Csomor
0bdd7e5f48 forgotten commit of header change for generic icon 2018-09-24 00:11:31 +02:00
Stefan Csomor
3370b76318 Direct NSImage drawing 2018-09-24 00:11:31 +02:00
Stefan Csomor
148732993a only use native NSImage dimension 2018-09-24 00:11:31 +02:00
Stefan Csomor
84f68aa764 Fixes and Cleanup 2018-09-24 00:11:31 +02:00
Stefan Csomor
e7d21f6638 Initial Commit of full native bitmap macOS implementation
Right now, to better test regressions, with dual implementation
2018-09-24 00:11:31 +02:00
Vadim Zeitlin
1833c3d8e4 Add wxBitmap::operator=(wxImage) to wxMSW to resolve amboguities
Code doing "bitmap = image" compiled in the other ports, but not in
wxMSW with WXWIN_COMPATIBILITY_3_0==1 as there was an ambiguity between
converting wxImage to wxBitmap, as intended, or converting wxImage to
wxCursor and then assigning it to wxBitmap using operator=(wxCursor)
overload.

Resolve this ambiguity by providing operator=() overload taking wxImage
directly.

This fixes widgets sample compilation under MSW after the changes of
455a45f5a8

See https://github.com/wxWidgets/wxWidgets/pull/946
2018-09-23 15:51:26 +02:00
Vadim Zeitlin
94c8179ef8 Merge branch 'more-wxoverride' of https://github.com/MaartenBent/wxWidgets
See https://github.com/wxWidgets/wxWidgets/pull/944
2018-09-22 14:44:08 +02:00
Maarten Bent
7c1ab06ea5 Add more wxOVERRIDE 2018-09-22 14:44:07 +02:00
Maarten Bent
a3eeb4d0be Revert wxAuiDefaultDockArt::DrawIcon API change
Mark the function as deprecated. It should not be part of the public API. It
cannot be overridden and manually calling it has no lasting effect because
DrawCaption calls it as well.

Closes https://github.com/wxWidgets/wxWidgets/pull/943
2018-09-22 14:44:00 +02:00
Maarten Bent
7a8e314736 Fix clicking on drop down button in wxAuiToolBar on wxMSW
The code handling the mouse events assumed the drop down button with was
10px, but wxAuiMSWToolBarArt uses a different width (14px). So clicking
on the left-most 4 pixels was not registered as a drop down click.

Allow the get (and set) the width of the drop down button of the
ToolBarArt.

Increase the detection area for drop down events, because the drop down
button is drawn 1 pixel larger than the actual size.

Rename some variables where dropdown was used instead of overflow.

Closes https://github.com/wxWidgets/wxWidgets/pull/939
2018-09-20 23:23:53 +02:00
Vadim Zeitlin
d663cd5641 Merge branch 'travis-toolkits' of https://github.com/MaartenBent/wxWidgets
Test all the 2nd (and even 3rd) tier ports on Travis CI too: run builds
using wxX11, wxQt, wxDFB and even wxMotif.

See https://github.com/wxWidgets/wxWidgets/pull/922
2018-09-20 13:55:01 +02:00
Maarten Bent
ce4363eb7c Add implementations for missing wxDFB functions 2018-09-19 22:03:00 +02:00
Maarten Bent
86d586222d Add missing wxFont constructor to wxMotif 2018-09-19 22:02:47 +02:00
Scott Furry
fd7f4dfe3d Implement wxComboBox::SetValue() in wxQt
Make setting combobox value work.
2018-09-19 00:25:08 +02:00
Scott Furry
019cf6e6f0 Move wxComboBox::Clear() out of line in wxQt
No real changes.
2018-09-19 00:25:08 +02:00
Scott Furry
4c0b919851 Make wxToolBar::Init() private in wxQt
No real changes, just keep private method out of the public part.
2018-09-19 00:25:08 +02:00
Vadim Zeitlin
f741031e69 Suppress gcc -Wfloat-conversion warning in wxFontInfo ctor
Add an explicit cast to avoid warnings when compiling with this option.

While just casting double to float is not the best idea, it seems quite
unlikely that anybody would pass a value outside of float range to this
ctor.
2018-09-18 15:57:43 +02:00
Vadim Zeitlin
9bd3de272a Merge branch 'mdi-window'
Fix handling of MDI "Window" menu under MSW when the translation of its
label changes during the program lifetime.

See https://github.com/wxWidgets/wxWidgets/pull/937
2018-09-18 14:16:04 +02:00
Vadim Zeitlin
b88d5e08ce Fix adding pages without associated window to wxTreebook
wxTreebook is supposed to allow not specifying any valid window for the
top-level pages, but this didn't work any longer, probably since the
changes of 02a92e23f3 (see #4379), as a
possibly null page was dereferenced without checking, resulting in a
crash.

Fix this by adding a missing check.

Also rename DoGetNonNullPage() to TryGetNonNullPage() to make it more
clear that this function can return null and add a unit test checking
that calling AddPage(NULL) really works (or at least doesn't crash).

See https://github.com/wxWidgets/wxWidgets/pull/921
2018-09-18 00:33:59 +02:00
Vadim Zeitlin
2ee322b667 Slightly simplify the previous commits
Remove SetWindowMenuLabelTranslated() which was only called once and so
didn't seem to be worth having. Also get rid of WINDOW_MENU_LABEL for
the same reason: it was used only once and imposed the use of
gettext_noop() which is not needed any longer.

Rename GetWindowMenuLabelTranslated() to have a MSW prefix in order to
indicate that it's a private MSW function and not part of the public wx
API.

Also renamed "Translated" to "Current" to (hopefully) more clearly
indicate why do we need to keep this variable.
2018-09-18 00:13:35 +02:00
utelle
9a9176a1be Change storage of window menu label translation
Use member variable instead of global variable
2018-09-18 00:05:50 +02:00
Vadim Zeitlin
1f435261f6 Merge branch 'more-qt-win-build-fixes' of https://github.com/catalinr/wxWidgets
Miscellaneous fixes for building wxQt under MSW.

See https://github.com/wxWidgets/wxWidgets/pull/918
2018-09-17 23:26:27 +02:00
Vadim Zeitlin
26b4701ebd Define wxShrinkToFit() helper for wxVector<>
Unlike member shrink_to_fit(), this function is always defined, even
when wxVector is pre-C++11 std::vector<>.
2018-09-17 23:19:23 +02:00
Vadim Zeitlin
0fd8ec0fa2 Include <utility> to get std::swap() declaration in C++11
Include both <algorithm>, to get std::swap() declaration when using
C++98, and <utility>, to do the same thing when using C++11.

This is not pretty but simpler than using preprocessor tests (which
would need to take MSVS into account in a special way) and virtually
guaranteed not to break anything.

Closes #18220.
2018-09-17 23:01:30 +02:00
Vadim Zeitlin
6401c2e956 Merge branch 'font-fixes'
Complete support for fractional point sizes and font weights other than
light/bold.

Also harmonize wxFont API and implementation among all ports (fixing
compilation of those of them that were broken by recent changes).

See https://github.com/wxWidgets/wxWidgets/pull/919
2018-09-17 22:58:56 +02:00
Vadim Zeitlin
6cbc661179 Merge branch 'grid-corner-label'
Add wxGrid::SetCornerLabelValue().

See https://github.com/wxWidgets/wxWidgets/pull/928
2018-09-17 22:57:05 +02:00
Simon Rozman
770e0bcd16 Improve high DPI support in wxAui
Window initial/minimum/maximum sizes are now treated as logical pixels.

Furthermore, many margins and paddings are now converted using
wxWindow::FromDIP() to allow their growth in accord with screen DPI.
This places buttons on toolbars more apart on high DPI screens providing
space for easier touch operations.

Closes https://github.com/wxWidgets/wxWidgets/pull/933
2018-09-17 22:54:29 +02:00
Vitaly Stakhovsky
2af7e38153 Replace obsolete object array with vector in wxGenericListCtrl
Use wxVector<wxListLineData*> instead of WX_DECLARE_OBJARRAY().

This modernizes the code and allows to get rid of the static variables
previously used for sorting as now we can use std::sort().

Closes https://github.com/wxWidgets/wxWidgets/pull/924
2018-09-17 22:50:43 +02:00
Vadim Zeitlin
f69dbaa1ae Introduce MSW ARM64 support
This is a preliminary ARM64 platform support for wxWidgets at "it
compiles" stage. This will allow building and testing wxWidgets based
apps for oncoming Windows 10 ARM64.

Requirements:
- Visual Studio 2017 Update 4 or later with Visual C++ compilers and
  libraries for ARM64 component installed

Building:
1. Open command prompt.
2. Change directory to build\msw subfolder.
3. Run "C:\Program Files (x86)\Microsoft Visual
   Studio\2017\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" once.
4. Use `nmake TARGET_CPU=ARM64 ...` to build required flavor of wxWidget
   libraries.

Notes:
1. Building of *.sln/*.vcxproj files does not support ARM64 yet. This
   requires to hardcode Windows SDK to 10.0.15063.0 or later in
   *.vcxproj files, which would render them non-compilable in older
   Visual Studio versions. Microsoft is aware of this issue and is
   planning a fix in the next version of Visual Studio.
2. wxmsw31ud_gl.dll does not build yet. Awaiting Microsoft to deliver
   missing opengl32.lib for ARM64. Please, specify USE_OPENGL=0.

Closes https://github.com/wxWidgets/wxWidgets/pull/923
2018-09-17 22:34:32 +02:00
Vadim Zeitlin
4ada99945f Extract ConvertFromLegacyWeightIfNecessary() function
Make it possible to reuse just this part of GetNumericWeightOf() in the
upcoming commit.
2018-09-17 15:24:42 +02:00
Vadim Zeitlin
5d4ca0dbbe Add support for strike through attribute to markup spans
It can be handled in exactly the same way as underlining, so just do it
instead of leaving a "TODO" comment about it.
2018-09-17 15:24:42 +02:00
Vadim Zeitlin
ea00b0b603 Use SetFractionalPointSize() in wxMarkupParser code
Now that fractional sizes are supported, use them instead of rounding up
to integer size.
2018-09-17 15:24:42 +02:00
Vadim Zeitlin
18d7801346 Fix wxMotif build after wxFont API changes
Run-time seems to be totally broken, but fonts are probably not the most
important problem in this port, so don't bother fixing it.
2018-09-17 15:24:42 +02:00
Vadim Zeitlin
90dd87ee65 Fix wxGTK1 build after wxFont API changes
Implement the new {Get,Set}{FractionalPointSize,NumericWeight} methods.

Also change wxLoadQueryFont() to use wxNativeFontInfo methods as a side
effect, to reduce code duplication and reuse the existing support for
numeric weights and fractional point sizes in wxNativeFontInfo.
2018-09-17 15:24:42 +02:00
Vadim Zeitlin
9627798496 More steps towards using wxFontInfo in all ports
Replace AccountForCompatValues() with InfoFromLegacyParams() which
directly constructs wxFontInfo from the old-style parameters, applying
all the compatibility hacks internally.

There are no real changes in this commit, just simplify the code further
and make wxFontInfo more central.
2018-09-17 15:24:41 +02:00
Vadim Zeitlin
7866c293e8 Add wxFontInfo::HasFaceName() and use it
No real changes, just simplify the code a little by adding this helper.
2018-09-17 15:24:41 +02:00