Commit Graph

36151 Commits

Author SHA1 Message Date
Vadim Zeitlin
8c6ce2cd59 Improve RunScript() error message when using old WebKit
Don't put WebKit in all capitals and, more importantly, make it clear
that this is related to running JavaScript to the user.
2017-10-21 23:10:42 +02:00
Jose Lorenzo
af8f7f33c3 Merge wxWebView JavaScript improvements branch
This is a squashed commit of the SOC2017_WEBVIEW_JS branch from
https://github.com/joseeloren/wxWidgets.git

Closes https://github.com/wxWidgets/wxWidgets/pull/538
2017-10-21 22:42:30 +02:00
Artur Wieczorek
afdfc02a49 Allow changing wxPropertyGridManager wxPG_EX_NO_TOOLBAR_DIVIDER style
Currently this style can be set only at toolbar creation and cannot
be changed afterwards.
2017-10-21 22:17:54 +02:00
Andreas Falkenhahn
eb035485d7 Add wxDataViewCtrl::GetTopItem() and GetCountPerPage()
Add methods doing the same thing for wxDataViewCtrl as the existing wxListBox
methods.

Closes #17498.
2017-10-21 22:10:35 +02:00
Andreas Falkenhahn
e77cb6f31f Improve wxListBox::GetCountPerPage() in wxGTK and wxOSX
Provide native implementation of this function instead of using the ad hoc one
in common code, which didn't really work -- so remove it completely now.

Closes #17189.
2017-10-21 22:10:35 +02:00
Andreas Falkenhahn
accf7ab117 Add wxFontPickerCtrl::SetMinPointSize()
Allow setting the minimal, as well as maximal, point size.

Closes #17126.
2017-10-21 22:10:35 +02:00
Vadim Zeitlin
60c93971b3 Merge branch 'dvc-compare-values'
Fix comparing items with checkboxes in wxTreeListCtrl and make it
simpler to correctly implement item comparison in other
wxDataViewCtrl-derived classes.

See https://github.com/wxWidgets/wxWidgets/pull/558
2017-10-21 19:59:12 +02:00
Vadim Zeitlin
6974280ee1 Merge branch 'better-assert-dialog'
Use wxRichMessageDialog for showing asserts if possible.
2017-10-21 19:55:15 +02:00
Vadim Zeitlin
a1a3efe03b Use wxRichMessageDialog for showing assertion failures
This allows to hide the long (and possibly not fitting on the screen)
call stack by default to avoid intimidating people not used to it and
provides a much more clear way to ignore the subsequent asserts, by
clicking a dedicated checkbox instead of having to choose the "Cancel"
button which didn't make much sense.

See #15430.
2017-10-21 18:19:35 +02:00
Paul Cornett
5ba7a1d166 Draw a point instead of a line in wxGCDC::DrawPoint()
See #9674, #4550
2017-10-20 09:40:43 -07:00
Vadim Zeitlin
c52ed1aff3 Make "No" button default in the assert dialog
This makes more sense than the default default (sic) "Yes" button,
pressing which accidentally could kill the program if not running under
the debugger.
2017-10-20 02:40:05 +02:00
Vadim Zeitlin
2e3f0d95dd Open debugger at assert location from the GUI assert handler too
This should have been part of 55fd62c1e3
which only updated the default assert handler, but not the one used by
default in all GUI applications, for some reason, see there for more
explanations.

Do this now to ensure that after pressing "Yes" in the assert failure
dialog, the debugger opens at the assert location and not deep inside
wxWidgets code.

See #11184.
2017-10-20 02:36:01 +02:00
Vadim Zeitlin
1cf41eced6 Use __DARWIN__ for -psn command line argument test
This code should be used in all ports that can be used under macOS, i.e.
also wxGTK and not just wxMac.

Closes #15432.
2017-10-19 19:01:08 +02:00
Artur Wieczorek
892def066c Pass only relevant extra style bits to wxPropertyGrid
When extra style bits are set with the call to
wxPropertyGridManager::SetExtraStyle(), only those which are relevant
to wxPropertyGrid should be passed to the underlying property grid object.
Because it can happen that not all extra style bits of the underlying
wxPropertyGrid have been effectively changed by call to SetExtraStyle()
(e.g. wxPG_EX_NATIVE_DOUBLE_BUFFERING), we have to get the actual style
bits prior to storing them.
2017-10-18 22:58:21 +02:00
Artur Wieczorek
aaf1d505c6 Rely on native double buffering by default in wxPropertyGrid
If the platform has native double-buffering, instruct wxPropertyGrid
to rely on it by default.

Closes #16978.
2017-10-17 21:13:45 +02:00
Artur Wieczorek
cd669aea71 Use GetContentScaleFactor() to obtain the scale of the back buffer
GetContentScaleFactor() is implemented on all platforms and therefore
can be used to obtain the proper scale not only under wxOSX.
2017-10-17 20:32:29 +02:00
Paul Cornett
ed8a541463 Use wxFALLTHROUGH 2017-10-17 09:21:45 -07:00
Artur Wieczorek
cb799483b7 Rely on native double buffering by default in wxSTC
To avoid unnecessary buffering, turn off Scintilla buffered drawing
by default on platforms which have native double-buffering already.
2017-10-16 19:40:01 +02:00
Artur Wieczorek
2c69d27c0d Directly generate EVT_CONTEXT_MENU when Applications (Menu) key is pressed
WM_CONTEXTMENU message is generated directly by the system when the user presses and releases the VK_APPS key so there is no need to do this by emulating right mouse button click.

Closes #17969.
2017-10-09 16:14:50 +02:00
Artur Wieczorek
f34a6253c7 Fix compilation with wxUSE_ACCEL==0 2017-10-08 10:38:54 +02:00
New Pagodi
3a362c64cf Implement EVT_MOUSE_CAPTURE_LOST handler in wxSTC
When mouse is captured somwhere in the application, it's recommended
to have implemented a EVT_MOUSE_CAPTURE_LOST handler.
Resetting in the handler flag signalling captured state seems
to be a sufficient action because something like this is implemented
in the native Scintilla and it works fine in SciTE.

Closes #17961.
2017-10-08 10:22:59 +02:00
New Pagodi
6d0cb403a9 Prevent sending EVT_MOUSE_CAPTURE_LOST while opening a context menu in wxSTC
At least under wxMSW and wxGTK opening a popup menu when mouse is captured
generates EVT_MOUSE_CAPTURE_LOST. We would like to avoid this and
to release capture in a controlled way.

See #17961.
2017-10-08 10:11:47 +02:00
Artur Wieczorek
1ef1f8fda6 Allow setting position of wxProgressDialog (wxMSW)
Position of wxProgressDialog cannot be changed directly because the dialog is created in another thread and may exist when SetPosition() is called. New position has be stored in the data structure used to share data between the main thread and the task dialog runner and the real update is done during the cyclic refresh in the dialog thread.

Closes #13546.
2017-10-05 16:22:15 +02:00
Artur Wieczorek
bff8421ed7 Fix setting icon for wxProgressDialog (wxMSW)
Icon for wxProgressDialog cannot be changed directly because the dialog is created in another thread and may not yet exist when SetIcon() is called. We have to store new icon(s) in the data structure used to share data between the main thread and the task dialog runner and wait for a cyclic update.

Closes #17967.
2017-10-04 16:09:23 +02:00
Artur Wieczorek
718c916c93 Don't overwrite notification flags while setting a title for wxProgressDialog (wxMSW)
In wxProgressDialog::SetTitle(), wxSPDD_TITLE_CHANGED flag signaling a request to update a title should be added to the flags already being set and signaling another data waiting for the update.

Closes #17966.
2017-10-04 16:09:23 +02:00
Vadim Zeitlin
f0de65fb98 Make wxDataViewCheckIconTextRenderer class public
Export this class, which was only used internally by wxTreeListCtrl
before, so that user code can use it for its own columns with custom
wxDataViewCtrl models.
2017-10-02 22:28:28 +02:00
Paul Cornett
9662be097d Fix build error caused by 0b2ec56a 2017-10-01 13:24:07 -07:00
Paul Cornett
0b2ec56ae3 Simplify wxMacConvertNewlines helper functions
One is not used at all, two are only used in one place. Make the remaining
two return a wxString instead of taking a wxString pointer parameter.
2017-10-01 10:44:35 -07:00
Paul Cornett
37e29d3451 Use wx prefix for global names 2017-10-01 10:03:48 -07:00
Paul Cornett
29e1f1e9ce Avoid deleting object of different size than what was allocated 2017-10-01 09:02:11 -07:00
Paul Cornett
591da5dcc4 Fix memory leak of wxClientData when wxChoice is deleted 2017-10-01 08:55:57 -07:00
Paul Cornett
6a75c8f484 Fix invalid memory access beyond end of image data 2017-10-01 08:41:14 -07:00
Artur Wieczorek
c6938e9f97 Fix setting transparency flag for wxBitmap created from wxIcon
wxBitmap should be made transparency-capable before copying wxIcon bits to it. Doing so when wxIcon bits are already copied seems to work fine for OSX 10.8, but not for newer versions. 

Closes #17953.
2017-09-28 19:08:50 +02:00
Stefan Csomor
dfed16a792 Adding intrinsics for ARM 64 bit ios png builds 2017-09-26 20:09:24 +02:00
Vadim Zeitlin
81304fcafd Fix linking console applications with MinGW in monolithic build
Do compile wxEntry(void) overload used in wxIMPLEMENT_WXWIN_MAIN_CONSOLE
expansion by non-MSVC compilers under MSW inside the monolithic library
too by replacing the "#if !wxUSE_GUI" check guarding it with "#if
wxUSE_BASE" one.

It's not really clear how could this have ever worked without this fix
before, although it apparently did, but stopped with gcc 7.
2017-09-25 19:01:12 +02:00
Stefan Csomor
3063ea6ca9 Fixing Creation of wxGLCanvas on iOS 2017-09-25 17:42:11 +02:00
Stefan Csomor
9e88518eb2 Emulating proper Left Down State for Mouse Events on iPhone 2017-09-25 17:40:36 +02:00
Andreas Falkenhahn
ccc513bca9 Allow changing alignment styles after wxTextCtrl creation (wxOSX)
Update NSTextView/NSTextField alignment mode when wxTextCtrl alignment styles are changed with SetWindowStyleFlag().

Closes #17952.
2017-09-25 15:38:24 +02:00
Fabian Cenedese
812224488f Fix wxTreeListCtrl items comparison when using checkboxes
Override DoCompareValues() to handle values of "wxDataViewCheckIconText"
type which is not handled by wxDataViewModel::Compare() itself.

This ensures that the items with checkboxes are sorted by their (text)
contents instead of by the order of their addresses in memory as was
done for them, as for any unknown values type, previously.
2017-09-25 14:47:35 +02:00
Vadim Zeitlin
10e7725246 Add wxDataViewModel::DoCompareValues() useful virtual hook
This new method, called from the default Compare() implementation, is
simpler to override in the derived classes than Compare() itself.
2017-09-25 14:44:24 +02:00
Paul Cornett
cd1c3fab0c Use static linkage for various local names 2017-09-24 09:29:26 -07:00
Paul Cornett
925a1c0734 Avoid assert when deleting last item from wxListCtrl
See #17959
2017-09-24 08:51:48 -07:00
Artur Wieczorek
086793ceef Fix sending SPIN_UP/DOWN events when value wraps around (wxGTK)
SPIN_UP/DOWN events should represent the arrow being pressed,
not a direction in which the value changed (see documentation).

Closes #17957.
2017-09-23 19:08:29 +02:00
Paul Cornett
fd33fcf191 Use static linkage for various local names 2017-09-22 10:45:56 -07:00
Paul Cornett
18edcfab00 Fix memory leak when wxDataViewCtrl is deleted (wxGTK)
Need to delete wxGtkTreeModelNode structure
2017-09-22 10:29:52 -07:00
Artur Wieczorek
3b0a539045 Ensure that new value sent in EVT_SPIN_UP/DOWN is never out the range (wxMSW)
The new value sent in the event cannot be just set to the current value +/- 1. Wrapping and actual limits has to be taken into account.

See #17957.
2017-09-22 15:39:16 +02:00
Artur Wieczorek
a9843a7492 Send EVT_SPIN_UP/DOWN events also when wxSpinButton value wraps around (wxOSX)
EVT_SPIN events should be sent at every value change, not only if it's changed by +/- 1.

See #17957.
2017-09-22 15:28:12 +02:00
Artur Wieczorek
3d5e84b229 Update transparency flag for wxBitmap created from wxIcon
Just created wxBitmap has "hasAlpha" flag set to false so it needs to be modified if source wxIcon contains transparency values.

Closes #17953.
2017-09-22 09:44:10 +02:00
Vadim Zeitlin
4d388e351c Fix Direct2D graphics context after wxPenInfo changes
At least in wxMSW wxPen::GetStipple() returns a non-null (but invalid)
bitmap even when pen style is not wxPENSTYLE_STIPPLE, so don't test for
this bitmap when creating a wxGraphicsPen from a wxPen but for the style
directly.

This avoids using this invalid bitmap later in D2D code, where it
resulted in assert failures.

Also add a similar style test before calling wxPen::GetDashes() for
consistency, even if it doesn't seem to be strictly necessary.

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

Closes #17958.
2017-09-21 18:04:24 +02:00
Václav Slavík
c515c43fd5 Fix wxDataViewCtrl::ClearColumns() crash on macOS 10.13
When replacing m_OutlineView with a new one in ClearColumns(), we must
explicitly remove the old one from its superview to ensure that no more
drawing operations are pending for it. Without this change, Cocoa
drawing code would occasionally crash on attempting to message the
now-zombie m_OutlineView instance. This happened in older macOS
versions too, but became much more frequent in 10.13 High Sierra.
2017-09-21 14:02:41 +02:00
Václav Slavík
03e93b277e Fix wxCommandLinkButton explicit initial size 2017-09-21 14:02:41 +02:00
Artur Wieczorek
e2bfba21fe Fix sending EVT_SPIN_DOWN/UP events in Cocoa implementation of wxSpinButton
To determine which wxSpinButton arrow was clicked, in the action handler there is compared current NSStepper value (after the actual change) with the value before the change. This former value is fetched in the internal mouse click event handler which is invoked before the action handler. This method of determining a delta works fine as long as the current value remains unchanged between the execution of the internal mouse click event handler and the action handler. But if the current value is explicitly changed (by calls to SetValue(), SetRange()) in some handler(s) invoked between these two (like e.g. bound EVT_LEFT_DOWN handler), calculated delta can be invalid and therefore wrong EVT_SPIN_DOWN/UP events can be sent.
To get correct delta value we should to keep track of all explicit changes made to the current value starting from the mouse click and up to the entry to the action handler.

Closes #17955.
2017-09-21 13:45:13 +02:00
Anil Kumar
22a4feea53 Update current item in generic wxDataViewCtrl::SetSelections()
SetSelections was clearing the previous selection, invalidating the
current item, but didn't set it after selecting the new items.

This was causing issues in keyboard selection, e.g. pressing Shift+click
didn't select all the items between the selected and the clicked ones.

Fix this by making the last item of the new selection current, which is
the expected behaviour considering that SetSelections() should be
equivalent to calling SetSelection() with all items one by one.

Signed-off-by: Anil Kumar <anilkumar8753@gmail.com>

Closes https://github.com/wxWidgets/wxWidgets/pull/557
2017-09-19 22:32:21 +02:00
Vadim Zeitlin
5db73ec9b1 Use wxScopedArray<> instead of wxScopeGuard in wxTGAHandler
Using smart array class is better than using ad hoc scope guards for
freeing memory in any case, but in this particular case it also helps to
avoid g++ 7 -Wnoexcept-type warnings due to type of free() changing to
become "void(*)() noexcept" in C++17.
2017-09-17 18:17:58 +02:00
New Pagodi
33ad8063d6 Add Scintilla FineTicker methods to wxSTC
Starting with version 3.5, Scintilla implemented a newer method for
handling timers and used this method in its Windows, GTK+, Cocoa, and Qt
ports. This patch attempts to bring the timer handling for wxSTC in line
with those other ports.

Closes #17949.
2017-09-17 11:12:34 +02:00
Artur Sochirca
6c01707627 Don't use wxTreeCtrl item insertion workaround under modern MSW
Don't refresh the control unnecessarily after inserting the first child
node when using modern (i.e. post-XP) MSW version, this just slows down
inserting of the first child item in big trees.

Closes https://github.com/wxWidgets/wxWidgets/pull/555
2017-09-13 17:32:25 +02:00
Vadim Zeitlin
81d9952dfe Really fix spurious asserts in wxGTK wxDataViewCtrl::EditItem()
This replaces the changes of 24c0401e81
which, for some reason, used a global variable for storing whether the
selection function had been already set or not, when this clearly is a
per-control (or per-selection, but this seems one and the same) bit of
information.

Replace global ms_firstTime with a wxDataViewCtrlInternal field to avoid
asserts as soon as EditItem() is called on more than one wxDataViewCtrl.

Closes #17946.
2017-09-13 17:25:48 +02:00
Vadim Zeitlin
e48676cf4a Fix input buffer overflow in wxZip code
Don't crash when reading malformed ZIP files with incorrect field
lengths for the extra fields.

Closes #17947.
2017-09-13 14:46:11 +02:00
Vadim Zeitlin
d25d2400fc Fix crash in wxGraphicsPen::CreatePen() after wxPenInfo changes
Don't unconditionally dereference the result of wxPen::GetStipple()
which can (and often is) null.

This fixes crash introduced in 40f8403f5d.
2017-09-13 14:02:45 +02:00
Paul Cornett
a357fefaf4 Use const_cast in new code 2017-09-12 09:47:55 -07:00
Vadim Zeitlin
97dcc02db5 Fix wxQt compilation after first week day changes
Fix typo in its version of wxCalendarCtrl.

See https://github.com/wxWidgets/wxWidgets/pull/522
2017-09-11 19:48:09 +02:00
Vadim Zeitlin
40f8403f5d Merge branch 'peninfo'
Add wxPenInfo and wxGraphicsPenInfo which allows to specify fractional
pen widths when using wxGraphicsContext.

Closes #17087.

Closes https://github.com/wxWidgets/wxWidgets/pull/472
2017-09-10 21:45:47 +02:00
Vadim Zeitlin
f19012c62c Merge branch 'firstweekday' of https://github.com/lanurmi/wxWidgets
Add API for determining the first day of the week and use it in
wxCalendarCtrl.

Closes https://github.com/wxWidgets/wxWidgets/pull/522
2017-09-10 21:41:36 +02:00
Vadim Zeitlin
2bb6ac7051 Refactor all wxPen ctors to use wxPenRefData(wxPenInfo) ctor
Centralize all pen creation logic in a single place (in each port) in
the new wxPenRefData ctor taking wxPenInfo.
2017-09-10 15:48:31 +02:00
Vadim Zeitlin
8bad0e494f Get rid of wxGraphicsPenInfo::CreateFromPen()
This is a helper method used only in wxWidgets itself and only once, so
just inline it at the point of use to avoid exporting an unnecessary
function in the public API.
2017-09-10 01:53:02 +02:00
Vadim Zeitlin
76fd05b147 Leave only wxGraphicsRenderer::CreatePen(wxGraphicsPenInfo) overload
It doesn't make much sense to require all the graphics backends to
create wxGraphicsPen from either wxPen or wxGraphicsPenInfo when the
former can be handled just once in the common code.

So do just this, leaving CreatePen() overload taking wxGraphicsPenInfo
where the real pen construction takes place and implementing
wxGraphicsPen creation from wxPen in the common wxGraphicsContext code.

This is not 100% backwards-compatible as any code inheriting from
wxGraphicsRenderer and overriding its CreatePen() will now be broken,
however this should be extremely rare (there is no good reason to
inherit from this class in the user code) and result in compile errors
if it does happen.
2017-09-10 01:48:30 +02:00
Vadim Zeitlin
a156d5fa40 Extract wxPenInfoBase in a separate header
This allows to avoid dependency of wx/graphics.h on wx/pen.h.
2017-09-10 01:24:16 +02:00
Vadim Zeitlin
cc91a7d6d4 Minor formatting and style changes in wxPenInfo code
Use more standard formatting, wrap some overlong lines.
2017-09-10 01:11:06 +02:00
Adrien Tétar
999c750ca7 Review feedback 2017-09-10 01:02:21 +02:00
Adrien Tétar
2305604565 Introduce wxGraphicsPenInfo class 2017-09-10 01:02:20 +02:00
Adrien Tétar
bc562289c6 Introduce wxPenInfo class 2017-09-10 01:02:06 +02:00
Stefan Csomor
a0f924191e Fixing vertical mirrored drawing for overlay on macos 2017-09-09 19:32:18 +02:00
Artur Wieczorek
abfd27db91 Fix PCH-less build
Add missing includes for compiling without WX_PRECOMP after 4d8c1fc890.
2017-09-09 16:29:42 +02:00
Stefan Csomor
8ad0039b71 Further implementation of native overlay on Cocoa
Should work for Caret,  still has a problem with the transformation matrix otherwise, too many things have changed there for me to find a quick solutions.
2017-09-09 11:44:43 +02:00
Stefan Csomor
4d8c1fc890 Using another API for popup menus on modal dialogs
Using popupMenuPositioningItem leads to several problems on modal dialogs - the validation and action callbacks are not used, thefore we revert in this situation to using the older API, see #549 and https://trac.wxwidgets.org/ticket/17459
2017-09-08 14:35:49 +02:00
Stefan Csomor
102edb544d Fixing Popup Menu with Submenus
Submenus have to turn off autoenablind as well, see #549 and https://trac.wxwidgets.org/ticket/17459
2017-09-07 20:27:49 +02:00
Stefan Csomor
37191f6f16 Only set font color if explicitly set
Otherwise eg the default button doesn't get its white font color.
2017-09-07 19:00:43 +02:00
Artur Wieczorek
627870be90 Restore wxButton's feature to use focus bitmap for hover state (wxMSW)
Prior to 2.9.2, if the focus bitmap was specified but current one wasn't, the focus bitmap was used for hovering as well.
This feature was entirely discarded in b4354db179 (see wxBitmapButton::DoSetBitmap) but it is still described in the documentation of wxButton's states and images. It seems it was removed unintentionally, so let's restore it.
2017-09-06 14:10:46 +02:00
Artur Wieczorek
52d6b0ae85 Don't discard all current input processing flags in response to WM_GETDLGCODE
Some current input processing flags, like DLGC_HASSETSEL, should be retained because they are in use (in wxWindowMSW::SetFocusFromKbd() for instance).

Closes #17945.
2017-09-06 12:34:20 +02:00
Stefan Csomor
51e7994cff Adding Borders and Multi-Line calculations also when native best size is available
Otherwise wxTE_MULTILINE are getting a tiny one-line minimal size, and the border as to be added as well.
2017-09-06 09:54:35 +02:00
Gavin Kinsey
d24ffcf749 Fix wxHTML parse bug in non-unicode, ? characters are not displayed.
GetEntitiesParser()->GetCharForCode(NBSP_UNICODE_VALUE) in the non-unicode
build returns the value '?' as it doesn't find a match for that value.  The
parser then proceeds to replace all '?' characters in the HTML document with
NBSP.

Change the type of the #define to be unsigned int rather than wxChar for
non-unicode to fix this.

Closes #17692.
2017-09-05 21:57:52 +02:00
Roberto Perpuly
361d7b4938 Fix popup menu items being always disabled in Mac OS X (#549)
Menus on Mac use automatic menu enabling, meaning that the system will enable
menu items only if the app responds to the menu item action. If I understand
correctly, the responder chain for menus in popup dialogs stop at the dialog
window, so the system thinks that the app does not handle the menu items.

This fix should not affect existing code since the wxWidgets user-facing API
dictates that apps specifically disable menu items.

Fix #17459

See Apple docs on automatic menu enabling at

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/MenuList/Articles/EnablingMenuItems.html#//apple_ref/doc/uid/20000261-BAJBFGED
2017-09-05 20:28:45 +02:00
Vadim Zeitlin
406608b31c Remove obsolete wxCHECK_W32API_VERSION() checks
The latest of those checks tested for w32 API 3.3, which is older than
MinGW 3.4 released which is more than 13 years old, so we can safely
drop them (let alone checks for prehistoric 0.5 w32 API).

This incidentally fixes compilation errors due to the use of
wxCHECK_W32API_VERSION() in wx/msw/winundef.h which was now (since
the changes of 8c572c0a77) included before
this macro was defined.
2017-09-04 22:38:23 +02:00
Tim Kosse
808c842edd Unbind events when destroying wxTextEntryHintData
Leaving these event handlers bound resulted in crashes due to
dereferencing the already destroyed wxTextEntryHintData object.

Closes #17944.
2017-09-04 22:28:32 +02:00
Lauri Nurmi
2f2700b2dd Automatically determine the first weekday for a calendar control
If neither wxCAL_SUNDAY_FIRST or wxCAL_MONDAY_FIRST was given, use
wxDateTime::GetFirstWeekDay() to automatically determine the preferred
day.

This changes the earlier default behaviour, which was to use Sunday
if not otherwise specified. However, the wxGTK native calendar control
ignored this behaviour anyway.
2017-09-02 17:02:35 +03:00
Lauri Nurmi
378851a283 Refactor WeekFlags processing into UseEffectiveWeekDayFlags()
Use the new GetFirstWeekDay() function rather than GetCountry() == USA
to determine the first weekday.
2017-09-02 17:02:35 +03:00
Lauri Nurmi
94c35b2cdd Implement new static function wxDateTime::GetFirstWeekDay()
This function tries to determine the preferred first day of week to use in
calendars. The procedure for obtaining this information is highly
platform-dependent, and is not possible on all platforms; in that case
Sunday is used as the fallback value.

Implementations are included for MSW, OSX, and Linux.
2017-09-02 17:02:35 +03:00
Artur Wieczorek
c51dd81db6 Optimize wxTextCtrl::GetLastPosition()
It's better to call one API instead of four.
2017-09-01 11:17:50 +02:00
Artur Wieczorek
ed638371a7 Fix accounting for the last position in wxTextCtrl (wxOSX)
If the text in the control doesn't end with a new line,
last valid position is just past the last character in the
the last line.
But if it ends with new line, last valid position
is located at the beginning of the next virtual (empty) line.
So, this case has to be also taken into account in determining
whether position is valid or not.
2017-08-31 21:34:17 +02:00
Artur Wieczorek
4503c41bd8 Optimize wxTextCtrl::GetLastPosition() in wxOSX
To get the length of the text in the control there is no need to convert NSString to wxString (what is done now by calling to GetStringValue).
2017-08-31 16:28:42 +02:00
Artur Wieczorek
2d464ca576 Account for the last position in wxTextCtrl (wxOSX)
Take into account that last valid position is after the last character of the text.
This applies also to empty controls for which XYToPosition(0, 0) should return 0.
2017-08-31 16:28:14 +02:00
Andreas Falkenhahn
bcfad5b5d0 Show help even for toolbars which aren't direct wxFrame children
Display "long help" text associated with the toolbar items in the status
bar of the parent frame even if the toolbar is not a direct child of the
frame.

Closes #17897.
2017-08-31 00:26:57 +02:00
Paul Cornett
4a71ba820f Avoid delayed destruction if TLW was never created. See #17942 2017-08-28 20:31:47 -07:00
Vadim Zeitlin
2a06ef9bf3 Merge branch 'textctrl-fixes'
Closes https://github.com/wxWidgets/wxWidgets/pull/546
2017-08-28 21:50:35 +02:00
VZ
a582d6162d Merge pull request #542 from vadz/unhandled-except
Improve user-visible message about unhandled exception.
2017-08-28 19:48:02 +02:00
Vadim Zeitlin
9d02d6af2a Merge branch 'gtk-text-simplify'
Closes https://github.com/wxWidgets/wxWidgets/pull/545
2017-08-28 19:44:05 +02:00
Artur Wieczorek
70fe9f3291 Remove inappropriate assertion
New line is not always marked by 2-character (\r\n) sequence. It can be
also 1-character (\r) for RichText controls or even no mark at all (for
wrapped line).
2017-08-28 18:49:50 +02:00
Vadim Zeitlin
49ebac7102 Revert "Simplify wxTextCtrl::GetLastPosition"
This reverts commit c4e1fb4ef9.

Last position is not necessarily the number of characters in the buffer,
rich edit controls still store the text using CR LF between lines, but
GetLastPosition() should return the position as if they used only LF to
be consistent with all the other positions in these controls and
changing this broke existing code passing GetLastPosition() to other
functions taking position.
2017-08-25 01:45:39 +02:00
Vadim Zeitlin
e74fb5effe Account for the last position in wxMSW wxTextCtrl
There is a valid position after the last character of the text in
wxTextCtrl, e.g. position 0 in the empty control, so account for it and,
notably, don't return -1 from XYToPosition(0, 0) when the control is
empty.

This fixes a regression in a69ab2907c.
2017-08-25 01:45:37 +02:00
Vadim Zeitlin
42e9f0cf58 Make wxGTK wxTextCtrl::WriteText() less inefficient
Use wxScopedCharBuffer as we only need the buffer in the current scope.
This avoids a buffer copy done by wxCharBuffer which could be a
significant pessimization for large buffers.

Also don't call strlen() unnecessarily, we already know the buffer
length, so just use it.
2017-08-24 22:31:16 +02:00
Vadim Zeitlin
1c946a469a Get rid of overridden wxTextCtrl::DoSetValue() in wxGTK
This method seems completely unnecessary, the base
wxTextEntry::DoSetValue(), which delegates to Remove() and WriteText(),
seems to work just as well and avoids code duplication between this
method and wxTextCtrl::WriteText().

Notice that gtk_text_buffer_set_text() is just a trivial wrapper around
gtk_text_buffer_delete() and gtk_text_buffer_insert() anyhow, so there
is no efficiency loss in not using it neither.
2017-08-24 22:30:33 +02:00
Vadim Zeitlin
1a55f4cfa2 Don't send wxEVT_CHAR events from wxTextCtrl::SetValue() in wxGTK
This could happen if the code calling SetValue() was in a handler
invoked in response to a keyboard action as our insert-text signal
handler believed that it was called in response to this key in this
case, even when it wasn't the case.

This extends the changes of def8247c61
to WriteText() to DoSetValue(), thus fixing the same problem in
SetValue() and ChangeValue() too.

But the question of why do we have two so similar, yet different,
functions, resulting in having to fix the same bugs twice still remains
unanswered...
2017-08-24 17:04:04 +02:00
Vadim Zeitlin
46d36d99c7 Don't give misleading message for unhandled exceptions in a thread
The application doesn't necessarily terminate when a thread dies due to an
unhandled exception, even though it will often crash later.
2017-08-22 21:39:27 +02:00
Vadim Zeitlin
bf083479d5 Make message from wxApp::OnUnhandledException() more clear
This message now appears even in the (default) release builds as __WXDEBUG__
is always defined, so it needs to be at least somewhat understandable by
normal users, even if it remains primarily targeted at the developers.

Also remove __WXDEBUG__ checks in this function, this is a left-over from the
pre-3.0 debug mode.
2017-08-22 21:39:27 +02:00
Vadim Zeitlin
b8ff711460 Merge branch 'blocking-sockets-fixes'
Closes #17937.
2017-08-21 13:22:53 +02:00
Vadim Zeitlin
296bd7d64e Simplify TAB order code in wxStdDialogButtonSizer::Realize()
No real changes, just add a helper class to avoid repeating the same
sequence of lines many times in this function.

This aims to slightly improve 42e9eb7ce8.

See #17940.

Closes https://github.com/wxWidgets/wxWidgets/pull/539
2017-08-21 13:21:31 +02:00
Vadim Zeitlin
c45a8d49f1 Replace dynamic casts with MSWShouldSetDefaultFont() virtual method
Get rid of ugly wxDynamicCastThis()s in wxMSW wxControl code and add a
new virtual method overridden in wx{Tree,List}Ctrl instead.

Also stop comparing the font with wxSYS_DEFAULT_GUI_FONT, there doesn't
seem to be any good reason to set this particular font for these
controls neither.

In addition to simplifying and de-ugligying the code, this commit
incidentally fixes -Wnonnull-compare warnings in this code from gcc6
too.
2017-08-21 02:09:19 +02:00
Vadim Zeitlin
04c5a179be Don't compare reference with null in wxBitmap::UngetRawData()
This doesn't seem to make any sense as this function is always called
with non-null "*this" reference from wxPixelData dtor and results in
-Waddress warning from gcc 6.
2017-08-21 01:53:22 +02:00
Artur Wieczorek
0624108acc Use dedicated function to check whether menu item is a radio button
No real changes, just refactoring.
2017-08-20 21:28:46 +02:00
Artur Wieczorek
e56cb112d3 Fix warning about unused variable in release build
Refactor the code to remove variable which is used only in the assertion.

See #14213.
2017-08-20 21:28:12 +02:00
Artur Wieczorek
42e9eb7ce8 Ensure that navigation order reflects button layout in wxStdDialogButtonSizer
In wxStdDialogButtonSizer, keyboard navigation order through the buttons
should be the same as the order they are positioned in the sizer regardless
of the order the were created or added to the sizer.

Closes #17940.
2017-08-16 23:12:26 +02:00
Vadim Zeitlin
2e3e265a8b Remove unnecessary checks for INVALID_SOCKET in MSW code
wxSocketManager::Install_Callback() and Uninstall_Callback() are only
called for successfully created sockets, so there should be no need for
these checks and there are none in the Unix version.
2017-08-15 19:49:02 +02:00
Vadim Zeitlin
8a29f958a1 Detect any attempt to use non-blocking socket from worker threads
This doesn't work, as non-blocking sockets implementation requires
dispatching events generated by them, which is only possible from the
main thread event loop, and it's better to be upfront about it rather
than failing mysteriously later.
2017-08-15 19:48:46 +02:00
Vadim Zeitlin
8d66bfd7ef Use blocking server socket in non-main threads for active FTP
This is similar to the previous commit, but for active FTP connections.
wxSocketServer was also created directly in this case, without using
wxProtocol ctor, so wxSOCKET_BLOCK must be explicitly specified when
creating it from worker thread, just as it was already done in
d421373c2e for the other connections and
in the previous commit for passive FTP ones.

See #17937.
2017-08-15 19:35:01 +02:00
Vadim Zeitlin
40774e1ccd Use blocking sockets from non-main threads for passive FTP too
This extends the changes of d421373c2e
to the case of passive FTP, which created wxSocketClient directly and so
didn't use the correct flags when used from a worker thread.

See #17937.
2017-08-15 19:34:58 +02:00
Vadim Zeitlin
ba8bab2282 Factor out socket flag selection into GetBlockingFlagIfNeeded()
No real changes, just refactor wxProtocol ctor to use a new function
that can be reused elsewhere too.
2017-08-15 19:34:54 +02:00
Vadim Zeitlin
01fac4b748 Delete windows before application on session end in wxMSW
When WM_ENDSESSION was received by the application, the wxApp object
itself was shut down by calling OnExit() on it before all the TLWs were
destroyed, which could be completely unexpected as during normal
shutdown the order of events is exactly the reverse.

In practice, this resulted in crashes in any application whose main
window close event handler or dtor touched wxTheApp in any way (e.g. to
save any configuration in the global wxConfig object destroyed by
wxApp::OnExit()).

See #9590 (sorry for missing the point before, ATS).
2017-08-15 00:41:16 +02:00
Artur Wieczorek
b6e4bdce3d Reimplement adding items to radio groups in wxMenu (wxOSX)
Rewrote wxOSX radio groups-related code reusing the code which works on
wxMSW and which seems to provide more rich functionality (supports adding
radio as well as no-radio items) and to have known bugs fixed.
The ranges of all radio groups are stored in wxMenu itself instead of
storing the information about the radio group an item belongs to in
the item itself - see 89511b4268.

Closes #14213.
Closes #17568.
2017-08-13 01:48:59 +02:00
Artur Wieczorek
4bc1c6fb7c Extract wxMenuRadioItemsData to a separate file
wxMenuRadioItemsData implementation is not MSW-specific and can be reused
on other platforms.

See #14213.
2017-08-13 00:36:37 +02:00
Artur Wieczorek
28af0ca6e9 Fix updating radio groups when non-radio item is inserted to wxMenu (MSW)
When wxMenu contains radio groups and a new item (radio and non-radio) is
being added to the menu, data describing exisiting groups have to
be updated accordingly. Because adding radio and non-radio items has
a different impact on the groups, adding non-radio items has to be handled
separately. (The main difference between adding radio and non-radio item is
that when a radio item is inserted inside the group this group is extended,
but for non-radio item the group is split into two subgroups.)
2017-08-13 00:31:53 +02:00
Artur Wieczorek
8dc4bd40a8 Don't convert any non-monochrome wxBitmap to ARGB format
While selecting wxBitmap with colour depth > 1 bpp into wxMemoryDC there is
no need to convert its format to ARGB regardless of the current
interpretation of the alpha channel values in the bitmap. If original
bitmap was marked as a RGB one (with alpha channel being ignored), it
should retain this format to avoid confusions.

Closes #16309.
2017-08-09 21:23:34 +02:00
Vadim Zeitlin
a11e09fb11 Skip setting geometry hints for non resizeable windows in wxGTK
Avoid calling gtk_window_set_geometry_hints() when the window can't be
resized anyhow, this doesn't seem to be necessary and results in
warnings like the following when using Gnome:

gnome-session[xxx]: Window manager warning: Window 0xxxx (Minimal wx)
sets an MWM hint indicating it isn't resizable, but sets min size 198 x
154 and max size 268435454 x 268435454; this doesn't make much sense.

Closes https://github.com/wxWidgets/wxWidgets/pull/529
2017-08-09 20:57:12 +02:00
Vadim Zeitlin
7e80ff4ed8 Merge branch 'i18n-context'
Closes https://github.com/wxWidgets/wxWidgets/pull/530
2017-08-09 20:47:41 +02:00
Vadim Zeitlin
99d7b13e3f Force current item to stay visible in wxListCtrl after deletion
The vertical scrollbar position could be updated (at least wit wxGTK) to
not show the last item any longer, after deleting the previously last
item, which was very annoying from the user point of view as the focus
was visually lost.

Avoid this by explicitly calling EnsureVisible() to prevent this from
happening.
2017-08-09 14:12:38 +02:00
atobi
7e0093d61b Fix wrong minimization of wxRibbonPanel
Don't minimize the panel if it's just of sufficient size.

Closes #17934.
2017-08-08 10:59:40 +02:00
Artur Wieczorek
ec55f11ff7 Add support for wxTE_CHARWRAP to wxTextCtrl
Apparently various text wrapping modes are not supported natively by
NSTextView (apart from word wrapping which is used by default) and
non-default wrapping has to be implemented in the custom code.
To wrap lines at any character, NSLineBreakByCharWrapping style should be
applied at any text change to the entire text stored in NSTextStorage
associated with NSTextView. This is done in DoUpdateTextStyle() method
which is called from controlTextDidChange() when text is modified by
the user, or SetStringValue() and WriteText() when text is set
programmatically.
2017-08-05 21:57:01 +02:00
Paul Cornett
7626292fa4 Don't reset scroll position to zero when window size changes
Aside from just being the proper thing to do, this fixes scrolling with
GTK3 when not using overlay scrollbars, where size events are somehow being
generated during scrolling.
See #17915
2017-08-04 07:56:23 -07:00
Artur Wieczorek
723650d51d Honour text alignment while formatting window label
Take into account text alignment while formatting NSAttributedString containing the text of the label.

Closes #17933.
2017-08-03 11:57:47 +02:00
Artur Wieczorek
5aa66ffd93 Fix text alignment in wxRadioButton
Label should be always left-aligned to be positioned just next to the button image.

See #17933.
2017-08-03 11:56:30 +02:00
Artur Wieczorek
da0299f30e Fix text alignment in wxCheckBox
Align the text according to the style.

See #17933.
2017-08-03 11:55:36 +02:00
Artur Wieczorek
7c0d4f211d Make wxTextCtrl with no wxTE_MULTILINE style really single-line (wxOSX)
Under wxGTK wrapping for single-line controls is explictly disabled (see
wxTextCtrl::GTKSetWrapMode), under wxMSW wrapping is not supported, so for
the sake of consistency also under wxOSX single-line control shouldn't
support wrapping and vertical scrolling.

Closes #12693.
2017-08-03 00:11:26 +02:00
Artur Wieczorek
1731ad5e31 Add support for wxTE_NO_VSCROLL style to wxTextCtrl (wxOSX) 2017-08-02 23:24:02 +02:00
Nusi
962327dec0 Fix checking key categories in wxKeyEvent::IsKeyInCategory()
WXK_END key belongs to WXK_CATEGORY_JUMP (not WXK_CATEGORY_PAGING)
and WXK_PAGEUP belongs to WXK_CATEGORY_PAGING (not WXK_CATEGORY_JUMP).
2017-08-02 23:05:24 +02:00
Artur Wieczorek
d3adf5e464 Don't do the run-time check for GTK+ 2 under GTK+ 3
...because it fails.
2017-08-01 22:36:33 +02:00
Nusi
446d707064 Get access to DrawThemeBackgroundEx API from wxUxThemeEngine (wxMSW) 2017-08-01 21:37:19 +02:00
Artur Wieczorek
8dd2ac3016 Implement DragAcceptFiles() only when wxUSE_DRAG_AND_DROP==1
This virtual method is implemented in wxWindowBase class only when
wxUSE_DRAG_AND_DROP==1, so it should be re-implemented in the derived class
wxWindowMac also only when wxUSE_DRAG_AND_DROP==1.
2017-08-01 21:36:26 +02:00
Artur Wieczorek
f81cc8e61e Fix compilation when wxUSE_SPINCTRL==0
In wxWindowMac code there is a reference to wxSpinButton (not wxSpinCtrl),
so we need to include wxSpinButton's header file.
2017-08-01 21:35:38 +02:00
Paul Cornett
3a9fc640e4 Don't crash on trailing '%' in wxDateTime::Format(). See #17931 2017-08-01 08:35:58 -07:00
Artur Wieczorek
8317bc2844 Fix determining the length of the text in wxTextEntry/wxTextCtrl (wxGTK)
Several functions of wxTextEntry and wxTextCtrl call to
gtk_entry_get_text_length() API to determine the length of the text in
GTKEntry. This API is available since GTK+ 2.14 so we have to implement
a fallback method for older GTK+ versions.
Dedicated function GTKGetEntryTextLength() is implemented in wxTextEntry
and exposed through its interface because it is also used in wxTextCtrl.
2017-07-31 21:39:48 +02:00
Paul Cornett
5b679bfbec Get rid of wxGTKDash, it's the same as wxDash 2017-07-31 10:19:44 -07:00
Paul Cornett
41311298eb Fix SetPen() with a re-used user dash array
wxPen::SetDashes() is poorly designed, making it possible for different
wxPenRefData objects to point to the same dash array. This allows two wxPen
objects to appear to be equal after modifying the array and setting it on
the second pen (the drawing sample does this). So testing for equality is
not enough to determine that SetPen() can return early.
2017-07-31 10:14:26 -07:00
Artur Wieczorek
d57672ee42 Fix compilation with wxUSE_ACCEL==0 2017-07-30 10:38:06 +02:00
Artur Wieczorek
2c2e0aaa01 Implement ShowPosition() for single-line wxTextCtrl (wxGTK) 2017-07-30 09:59:27 +02:00
Artur Wieczorek
f208cfc886 Implement XYToPosition() for single-line wxTextCtrl (wxGTK) 2017-07-30 09:58:53 +02:00
Artur Wieczorek
bb9c7680ab Fix wxTextCtrl::PositionToXY (wxMSW)
Check if character position is not past the line.
When calculating (x,y) for given character position there is necessary
to take into account that for multi-line control each line (but last one)
is ended by 2-character end of line mark. Each character of this
2-character mark has a different position in the text buffer but is mapped
to the same (x,y) coordinates.
2017-07-30 09:58:28 +02:00
Artur Wieczorek
a69ab2907c Fix wxTextCtrl::XYToPosition (wxMSW)
When calculating character position for given (x,y) there is necessary
to verify if passed coordinates are sane and return error status (-1) if
not. y-coordinate has to be in the range [0..numLines-1] and x-coordinate
cannot exceed the length of the text in the given line.
2017-07-30 09:57:54 +02:00
Artur Wieczorek
c4e1fb4ef9 Simplify wxTextCtrl::GetLastPosition
Last position is just the number of characters in the buffer.
2017-07-30 09:57:17 +02:00
Troels Knakkergaard
d255dc6706 Do not set wxUnknownControlContainer background to a fixed color
Don't explicitly set the background colour if it's not specified.

Closes #17675.
2017-07-27 13:26:00 +02:00
RickS
9c6befef3a Support for context-sensitive translations 2017-07-27 13:22:29 +02:00
Vadim Zeitlin
df37c4f9e9 Add missing file required by Expat 2.2.2
Expat configure fails without this file.

See https://github.com/wxWidgets/wxWidgets/pull/524
2017-07-25 16:03:22 +02:00
Paul Cornett
a533fb141d Fix unresponsive frame after using wxHtmlHelpFrame from a dialog. See #17837 2017-07-24 08:56:59 -07:00
Artur Wieczorek
572ec50827 Implement wxTextCtrl::ShowPosition() (wxOSX)
Closes #17811.
2017-07-22 22:23:34 +02:00
Artur Wieczorek
d233b8939b Implement wxTextCtrl::PositionToXY() and XYToPosition() (wxOSX)
Apparently there is no native API to retrieve such information in a simple
way so all calculations have to be done with raw text stored in
the corresponding control(s).

Closes #4146.
See #17811.
2017-07-22 22:23:34 +02:00
Paul Cornett
c4acd5f9dd Fix drawing miniframe resize grip with GTK3, see #17918 2017-07-22 12:04:56 -07:00
Stefan Csomor
537cf17ca9 Supporting updated expat for Xcode builds 2017-07-21 16:52:39 +02:00
Paul Cornett
0c06fc6358 Avoid unused parameter warnings 2017-07-20 08:51:36 -07:00
Paul Cornett
f23d3e45b0 Use correct signature for C callbacks 2017-07-20 08:34:05 -07:00
Paul Cornett
ccb8da2054 Fix build error after dfd03f5 2017-07-20 08:10:33 -07:00
Vadim Zeitlin
a43e25c3d6 Fix wxWebViewWebKit build with WebKit2 < 2.8
This allows this code to be compiled with WebKit2 2.6 included in Debian
Jessie.

Closes https://github.com/wxWidgets/wxWidgets/pull/519
2017-07-19 15:58:09 +02:00
Vadim Zeitlin
88a767773f Fix harmless warning about bool conversion in wxGenericColourButton
Make the conversion explicit to avoid MSVC warning C4800 about it being
done implicitly (which appears in release builds only).
2017-07-18 21:33:24 +02:00
VZ
1f6cd7a780 Upgrade bundled expat to 2.2.2+
Merge https://github.com/wxWidgets/wxWidgets/pull/524
2017-07-18 01:51:46 +02:00
Vadim Zeitlin
2fffbde096 Change wxSecretStore API to allow retrieving the username
The old API didn't make any sense for the most common case when both the
user name and password need to be stored, as it required providing the
user name as input, which couldn't work (but somehow this went
unnoticed for more than a year...).

Fix this by returning the username, and not only the password, from
Load() instead of taking it as parameter and removing this parameter
from Delete() as well.

Also improve the documentation, notably include a simple example of
using this class.

Notice that this is a backwards-incompatible change, but the old API was
really badly broken and didn't appear in 3.1.0 yet, so the breakage is
both unavoidable and, hopefully, shouldn't affect much code.
Nevertheless, a special wxHAS_SECRETSTORE_LOAD_USERNAME symbol is added
to allow testing for it if necessary.
2017-07-17 18:26:20 +02:00
Cătălin Răceanu
5e9d9dc2f9 Define XML_STATIC in Expat header rather than Expat projects.
This defines XML_STATIC unconditionally in Expat sources themselves as the built-in Expat is always used as a static library, so this solution is simpler and more portable.
2017-07-17 02:54:13 +03:00
Cătălin Răceanu
791fa1050d Update libexpat to commit 5f1f1f1d98fef39ef885d4271029b4c3fd814a2d, after version 2.2.2 2017-07-17 02:52:00 +03:00
PB
362b1220b4 Fix a few more BSTR leaks in wxWebViewIE
Use wxBasicString to ensure that temporary BSTRs are correctly freed.
2017-07-16 23:04:22 +02:00
Artur Wieczorek
54275bb2c9 Fix positioning of ComboBoxEditor in wxPG (wxOSX), cont.
By mistake, parameter for improper platform was set in dd9c08447e.
2017-07-16 20:58:34 +02:00
Artur Wieczorek
97b6244748 Fix positioning of TextCtrlEditor in wxPG (wxOSX), cont.
By mistake, improper value was used in 836bbcbfcb.
2017-07-16 20:57:38 +02:00
Vadim Zeitlin
3e7f70f368 Merge branch 'fix-basicstring-use'
Fix recently introduced bug in wxWMP10MediaBackend and simplify
wxBasicString.

See #17889.

Closes https://github.com/wxWidgets/wxWidgets/pull/515
2017-07-16 20:00:44 +02:00
Artur Wieczorek
6395e7805a Fix repositioning of active property editor in wxPG
When there is open an editor for some property and in the same time
wxPropertyGrid layout is changed (due to the adding or removing a property,
sorting), it is necessary to recalculate the actual position of the active
editor to display it in the cell dedicated for the edited property. Under
some platforms the position of the edit control is shifted within the cell
and we have to take this shift into account in repositioning process.
Because actual value of the shift depends on the platform and on
the particular control, it is convenient to determine actual shift when
the editor is created and use this value whenever repositioning is done.

Close #17912.
2017-07-16 19:38:08 +02:00
Artur Wieczorek
dd9c08447e Fix positioning of ComboBoxEditor in wxPG (wxOSX)
Position of the combo box editor associated with properties having custom
bitmaps like e.g. ColourProperty, needs to be adjusted in order to display
edited text at the same position as the text which is displayed as
a property value prior to the editing.
2017-07-16 19:13:37 +02:00
Artur Wieczorek
836bbcbfcb Fix positioning of TextCtrlEditor in wxPG (wxOSX)
Position of the editor associated with properties like StringProperty,
IntProperty, etc. needs to be adjusted in order to display edited text
at the same position as the text which is displayed as a property value
prior to the editing.
2017-07-16 19:12:20 +02:00
Artur Wieczorek
9994288688 Fix positioning of ComboBoxEditor in wxPG (wxGTK)
Position of the combo box editor associated with properties having custom
bitmaps like e.g. ColourProperty, needs to be adjusted in order to display
edited text at the same position as the text which is displayed as
a property value prior to the editing.
2017-07-16 19:09:18 +02:00
Artur Wieczorek
3212f7eab9 Fix positioning of TextCtrlEditor in wxPG (wxGTK)
Position of the editor associated with properties like StringProperty,
IntProperty, etc. needs to be adjusted in order to display edited text
string at the same position as the text which is displayed as a property
value prior to the editing.
2017-07-16 19:03:38 +02:00
Paul Cornett
a03c2ef4e0 Fix wxComboBox entry sizing with GTK+ >= 3.20, see #17852 2017-07-16 09:09:06 -07:00
Vadim Zeitlin
10f7d35694 Remove unwanted CR characters from MSW OLE source file
Somehow recent changes to this file added CRs (^M) characters to the
ends of some lines, remove them to avoid having a mix of Unix and DOS
EOLs in the same file.

No real changes.
2017-07-16 16:32:52 +02:00
PB
4ebef67e3e Update update constructing wxBasicString from literal strings
No real changes, just replace wxT() with wxS() as wxBasicString ctor now
that it takes wxString and not "const wchar_t*" and remove the now
unnecessary explicit "wxString()".
2017-07-16 16:32:51 +02:00
PB
cfb3ef98fc Make wxBasicString as simple and safe to use as possible
Don't try to write a general purpose class, but provide just the methods
that we need in our code.

This fixes the bug added in 294436c8bb
which resulted in a crash because a literal string, not a BSTR, was
passed to wxBasicString ctor.
2017-07-16 16:32:50 +02:00
Vadim Zeitlin
de3087c0de Tab navigation improvements for wxOSX
Closes https://github.com/wxWidgets/wxWidgets/pull/493
2017-07-16 15:52:38 +02:00
Steve Browne
1525e84e56 Fix unwanted refreshes when setting size of wxChoice in wxMSW
The window was still resized even if its size didn't really change,
which, in particular, unexpectedly resulted in closing its drop down if
it was shown.

Fix this by moving the code dealing with the different interpretation of
the control height between wxMSW and MSW (for the former, it's just the
height of the visible part, while for the latter it includes drop down
as well), from wxChoice::DoSetSize() to DoMoveWindow(). This allows the
base class DoSetSize() to correctly filter out calls not really changing
the size, while still setting the height correctly when it does change.

See #17075.

See https://github.com/wxWidgets/wxWidgets/pull/389
2017-07-16 15:17:03 +02:00
Vadim Zeitlin
0bae199ffe Merge branch 'msw-locale'
Fixes for setting locale under MSW when using older compilers and minor
simplifications and optimizations in wxLocale code.

See https://github.com/wxWidgets/wxWidgets/pull/517
2017-07-16 15:04:16 +02:00
Vadim Zeitlin
019e9d041f Fix setting locale under MSW when using locale name
Previously, all MSW-specific stuff like calling SetThreadLocale() and
SetThreadUILanguage() was only done when initializing wxLocale from a
wxLanguage value, but not when using a string name for it.

Fix this by implicitly calling Init(wxLanguage) from Init(wxString) if
we can find the language corresponding to the given name, and if the
other parameter is not incompatible with it.
2017-07-16 15:03:24 +02:00
Vadim Zeitlin
8cb4e70064 Refactor wxLocale initialization code
Don't call wxSetlocale() in DoInit() any more, this was redundant when
it was called from Init(wxLanguage) overload.

Add new DoCommonPostInit() called from both Init() overloads after
setting the locale in whichever way they do it to avoid code
duplication.

As a side effect of this change, the error message given if the locale
can't be set is the same now independently of the ctor/Init() overload
used (previously it differed depending on whether a wxLanguage or the
name of the language as string was passed) and it's always logged using
wxLogWarning() and not it in one case and wxLogError() in the other one.
2017-07-16 15:03:22 +02:00
Vadim Zeitlin
2deca99789 Don't duplicate "ret" flag in wxLocale::Init()
Simplify the code by just using "retloc != NULL" as success indicator
until the call to DoInit() instead of keeping a separate "bool ret"
variable in sync with "retloc".
2017-07-16 15:03:20 +02:00
Vadim Zeitlin
8713d73466 Avoid at least some unnecessary setlocale() calls
Instead of calling wxLanguageInfo::GetLocaleName(), which called
setlocale() at least thrice (first to query the current locale, second
to try to change it and third to restore the original locale) and then
calling setlocale() again if it succeeded, use the new TrySetLocale()
method which calls setlocale() just once and doesn't require calling it
again in the caller.

This makes the code slightly more efficient but, more importantly,
shorter and more clear.
2017-07-16 15:03:17 +02:00
Vadim Zeitlin
1003cf3e92 Remove unnecessary c_str() calls in wxLocale code
Pass wxString directly to wxLogWarning(), there is no need for c_str()
since wx 3.0 any more.
2017-07-16 15:03:15 +02:00
Vadim Zeitlin
9104e6fc9a Avoid unnecessary copies in wxLocale code
Micro-optimization: don't copy the strings unnecessarily when using just
a const reference is sufficient.
2017-07-16 15:03:12 +02:00
Vadim Zeitlin
ca3d86155c Get rid of another unused variable in wxLocale::Init()
This one was defined and used only once, just remove it completely.
2017-07-16 15:03:10 +02:00
Vadim Zeitlin
2d170d1bb6 Get rid of common "locale" variable in wxLocale::Init()
Try to make code less confusing by avoiding defining a variable in
platform-independent part of the code and then actually using it only in
platform-specific code.
2017-07-16 15:03:08 +02:00
Vadim Zeitlin
9b387434a0 Remove unnecessary checks for wxLANGUAGE_DEFAULT
Simplify the code by not checking for language == wxLANGUAGE_DEFAULT in
wxLocale::Init(): this can't happen because we use the system language
when passed wxLANGUAGE_DEFAULT as parameter and return false immediately
if we can't determine the system language.
2017-07-16 15:03:05 +02:00
Vadim Zeitlin
7836dfbc77 Make wxLanguageInfo::GetLocaleName() consistent across platforms
Check that the locale can be indeed set to the given string in Unix
version too, there doesn't seem to be any good reason to do it for MSW
only.
2017-07-16 15:03:03 +02:00
Vadim Zeitlin
2e2682116f Try to return valid name from MSW wxLanguageInfo::GetLocaleName()
Check if setlocale() really works with the name of the returned locale
and return empty string if it doesn't.

This fixes problem with setting locale when using old MSVC or MinGW CRT
under new (Vista+) MSW versions, as the CRT doesn't support the locale
names returned by LOCALE_SNAME and we need to fall back on
LOCALE_SENGLANGUAGE.
2017-07-16 15:03:00 +02:00
Vadim Zeitlin
dfd03f5fee Don't refresh wxStaticText if its label didn't really change
Optimize calling SetLabel() with the same label as the current one, this
seems to happen quite often in practice and results in flicker, so check
for it explicitly.
2017-07-16 02:36:07 +02:00
sbrowne
4e2684c155 Avoid flicker when size of wxStaticText doesn't change in wxMSW
Don't do anything if wxStaticText::DoSetSize() is called with the same
size as the control already uses, this only results in flicker.

Closes #17075.
2017-07-16 02:28:16 +02:00
sbrowne
66c5762ab9 Fix check for unchanged size in MSW wxWindow::DoSetSize()
Adjust the size and position we're about to set before comparing them
with the current ones, otherwise the result of the comparison could be
wrong when width and/or height are -1.

See #17075.
2017-07-16 02:22:46 +02:00
Paul Cornett
a9c1f17131 Fix creating cursor from XBM data with GTK3, see #17916 2017-07-15 11:52:01 -07:00
Lauri Nurmi
05ced5ce01 Handle stand-alone weekday and month names in macOS date formats
macOS returns "cccc" (stand-alone weekday name) as a part of the
preferred date+time format for Finnish, and possiblly others. This was
not handled at all by wxTranslateFromUnicodeFormat(), and the user
saw the raw "cccc".

Similarly, handle stand-alone month name ("LLLL").

Closes https://github.com/wxWidgets/wxWidgets/pull/518
2017-07-15 18:08:21 +02:00
Stefan Csomor
175c62d3f3 Using 'new-style' AssertMacros to support compilation for macOS 10.3 and iOS 11
To avoid collisions with boost and c++ standard library using the assert macros starting with two underscores is the default under these new SDKs. Since they already existed in our minimum deploment SDK we can switch them safely.
2017-07-15 13:30:59 +02:00
Kolya Kosenko
a770cd8d79 Fix wxIconBundle::AddIcon() compilation in wxGTK/Win32
This function doesn't compile currently because CreateFromHICON() is
wxMSW-only, so disable it it to at least let wxGTK compile for now, even
if the real solution would be to implement CreateFromHICON() for wxGTK
too.

Closes #17875.
2017-07-13 23:02:03 +02:00
Steve Browne
31ba2d4ca3 Fix setting foreground color for several controls in wxOSX
This allows setting color of wxStaticBox, wxCheckBox, wxRadioButton and
any other controls that use NSBox and NSButton to work.

Closes #16284.

Closes https://github.com/wxWidgets/wxWidgets/pull/489
2017-07-11 23:51:30 +02:00
Vadim Zeitlin
aaae5ef702 Merge branch 'better-mac-32bit-fix'
Re-enable alignment support for wxDataViewCtrl cells in wxOSX which was
previously disabled just to allow the library to compile in 32 bits.

Closes https://github.com/wxWidgets/wxWidgets/pull/377
2017-07-11 23:16:49 +02:00