Commit Graph

17326 Commits

Author SHA1 Message Date
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
Stefan Csomor
f045323934 Adding native macos Cocoa implementation for overlays into build files 2017-09-09 23:34:50 +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
41d042516d Exposing Colour Flags, adding Synonym UseBackgroundColour for UseBgCol
No abbreviations in method name, include new methods in docs
2017-09-07 11:30:10 +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
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
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
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
8c572c0a77 Always include wx/msw/winundef.h from wx/defs.h, not just once
Fix compilation/link problems due to symbols redefinitions in user code
that could happen if it included some wx header first, then <windows.h>
(possibly indirectly, e.g. via another third party library) and then
another wx header -- in this case, the second wx header wasn't protected
from <windows.h> redefinitions resulting in all the usual problems.

Avoid this by always including winundef.h whenever any wx header is
included, not just when wx/defs.h is included for the first time.
2017-08-24 13:55:23 +02:00
Vadim Zeitlin
35620a15b6 Remove redundant __WINDOWS__ check and definition
Remove this block was as it was inside "#ifdef __WINDOWS__" and so the
condition could never be true anyhow.

No real changes.
2017-08-24 13:42:48 +02:00
Paul Cornett
df1254dfbf Remove unneeded override of Destroy() after d456d2d6 2017-08-23 23:27:25 -07:00
Paul Cornett
d456d2d60e Prevent use of deleted wxDocMDIChildFrame in wxView dtor
Revert 0d8737fd, it became unnecessary after a9e2e6e5 and prevents b7341fe0 from working properly
See #5066
2017-08-23 23:23:08 -07:00
Vadim Zeitlin
b8ff711460 Merge branch 'blocking-sockets-fixes'
Closes #17937.
2017-08-21 13:22:53 +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
f72575ad08 Remove unnecessary semicolon at top level
This results in a warning from gcc with -pedantic.
2017-08-21 00:19:31 +02:00
Vadim Zeitlin
dadb7b9fb0 Don't register async notifications for MSW blocking sockets
Under MSW calling UnblockAndRegisterWithEventLoop() for blocking sockets
is not only useless, but actually harmful when the socket is used from a
worker thread (which is the common case for blocking sockets), as it
means that the main thread will be receiving notifications for the
socket events and modifying the socket object while it's being used from
the other thread, resulting in data races and general brokenness.

This is similar to e18c8fd29a for Unix
sockets.

Closes #17937.
2017-08-15 19:49:04 +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
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
91385acd5d Rename context-specific translation macros and document them
Try to use more clear names for the macros and also try to make the
sample more self-explanatory.
2017-08-09 14:21:47 +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
Nusi
446d707064 Get access to DrawThemeBackgroundEx API from wxUxThemeEngine (wxMSW) 2017-08-01 21:37:19 +02:00
Nusi
d1ea25be06 Fix signature of DrawThemeParentBackground API in wxUxThemeEngine (wxMSW)
According to the documentation, 3-rd parameter is a pointer
to the constant RECT structure.
2017-08-01 21:36:58 +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
729c3ec77b Fix compilation when wxUSE_DIRDLG==0
wxGenericDirCtrl has to be declared when wxUSE_DIRDLG==1
or wxUSE_FILEDLG==1 (see src/common/dirctrlcmn.cpp).
2017-08-01 21:35:06 +02:00
Paul Cornett
49605bc5a7 Use forward-declaration macro to avoid compiler warnings 2017-08-01 08:37:15 -07:00
Artur Wieczorek
1eef3fc5fc Add header file with missing wxScopedPtr declaration
wxScopedPtr is referred in wxSVGFileDCImpl declaration, but corresponding
header file is not explicitly included. This can break the compilation if
wxScopedPtr declaration is not included by chance by another module (e.g.
is taken from translation.h but it is not effective when wxUSE_INTL==0).
2017-07-31 23:50:06 +02:00
Artur Wieczorek
b12e6279d2 Implement missing virtual function in generic wxStandardPaths
MakeConfigFileName() is declared as a pure virtual function in the base
class wxStandardPathsBase and has to be implemented in the derived class
wxStandardPaths.
This fixes compilation when wxUSE_STDPATHS==0.
2017-07-31 23:24:17 +02:00
Artur Wieczorek
e2b937270a Check for wxUSE_DC_TRANSFORM_MATRIX dependency on wxUSE_GEOMETRY
Transform matrix functions depend on wxAffineMatrix2D which is implemented
if wxUSE_GEOMETRY==1.
2017-07-31 23:21:15 +02: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
RickS
9c6befef3a Support for context-sensitive translations 2017-07-27 13:22:29 +02:00
Vadim Zeitlin
9592823cde Add missing wxOVERRIDE to wxNSText{Field,View}Control in wxOSX
No real changes, just avoid (tons of) -Winconsistent-missing-override
warnings when building wxOSX.
2017-07-25 16:23:02 +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
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
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
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
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
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
a07013a6f1 Tab navigation improvements for wxOSX
Closes #17341.

Closes https://github.com/wxWidgets/wxWidgets/pull/493
2017-07-16 15:59:48 +02:00
Vadim Zeitlin
4defd593dc Compilation fix for wxOSX when not using PCH
Explicitly include wx/containr.h in a header using wxNavigationEnabled.
2017-07-16 15:57:54 +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
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