Commit Graph

63084 Commits

Author SHA1 Message Date
Artur Wieczorek
4fc8753285 Test PositionToXY and XYToPostion also for multiline Rich Edit controls 2017-09-01 11:00:06 +02:00
Artur Wieczorek
691f530359 Swap arguments of CPPUNIT_ASSERT_EQUAL
Expected value should be passed as a first argument to CPPUNIT_ASSERT_EQUAL and actual value as a second one.
2017-09-01 08:26:15 +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
4308386eff Extend XYToPostion unit test for multiline controls
Extend the ranges of tested X,Y coordinates
to cover also areas beyond the text.
2017-08-31 21:32:01 +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
Robin Dunn
ce8d795013 Add missing DeleteAllColumns 2017-08-29 18:15:17 -07:00
Robin Dunn
85ed13be75 Add missing FindCellByPos 2017-08-29 18:11:56 -07:00
Robin Dunn
5df63f100c Add missing event type constants for propgrid 2017-08-29 18:09:41 -07:00
Robin Dunn
eeac334e11 Add propgriddefs.h to the interface, containing macros, enums and such referenced elsewhere in the API. 2017-08-29 18:06:13 -07: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
4cf4e48cd5 Merge pull request #544 from pbfordev/sizer-overview
Update Sizers Overview in the manual.
2017-08-28 19:49:37 +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
VZ
c4260d7098 Merge pull request #543 from pbfordev/AutomationObject-docs
Improve wxAutomationObject-related documentation
2017-08-28 19:46:29 +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
5d79ab82ce Split building and running tests in 2 steps on Travis CI
This might prevent us from running into Travis timeouts in OS X builds
so often.
2017-08-25 14:22:43 +02:00
Vadim Zeitlin
4ddc7a7f4a Fix wxIMPLEMENT_CLASS documentation
It is a synonym for wxIMPLEMENT_ABSTRACT_CLASS and not
wxIMPLEMENT_DYNAMIC_CLASS as it was wrongly stated.

Also avoid duplicating the documentation of the other macro and just
refer to it instead.
2017-08-25 13:17:12 +02:00
Vadim Zeitlin
af0a938a65 Enable InsertionPoint unit test for multiline text controls too
There doesn't seem to be any reason to not run it.
2017-08-25 01:45:41 +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
de9b6fdc9e Show the exact wxTextCtrlHitTestResult in the text sample too
In addition to showing the position returned by HitTest(), also show its
return value which is not necessarily wxTE_HT_ON_TEXT if it is not
wxTE_HT_UNKNOWN under MSW.
2017-08-25 01:03:36 +02:00
Vadim Zeitlin
dd63efe986 Fix wxTextCtrl::HitTest() overload returning position docs
Don't mention row/column in this overload documentation.
2017-08-25 01:01:24 +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
0873abb836 Replace wxEVT_SIZE handler with sizers in the listctrl sample
Just simplify the code, no real changes.
2017-08-24 22:11:53 +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
PB
32cde66d9c Replace invalid character in Sizers Overview 2017-08-24 16:49:55 +02:00
PB
134279e8a8 Remove duplicity in Sizer Overview
Remove the already described sizers from section Other Types of Sizers. Remove "See ..." sentences which are unnecessary when the class documentation is already linked right above. Also fix a typo in a sizer name that prevented doxygen linking to the class.
2017-08-24 16:33:01 +02:00
PB
3ed335677c Fix section structure in Sizer Overview
Descriptions of wxBoxSizer, wxStaticBoxSizer, wxGridSizer, and wxFlexGridSizer are not subsections of Hiding Controls Using Sizers.
2017-08-24 16:24:40 +02:00
PB
278957e176 Update Sizer Overview
Remove references to concrete GUI-building programs. Such references are not necessary not to mention that  most of the referred programs have not been maintained for a long time.

List of flags in the CreateButtonSizer sizer was unnecessary, some of the values were not valid flags for the methods and comment descriptions for most values did not make much sense in the given context. The section was therefore removed and the method is mentioned in the newly-added part about wxStdDialogButtonSizer.

Sizer types not mentioned in the overview before were added, the rest of changes was mostly adding @c and such.
2017-08-24 16:13:07 +02:00
Vadim Zeitlin
741dd542f2 Fix assert in the text sample when logging char events
Passing long argument to "%c" printf format specifier was correctly
flagged as invalid in 64 bit Unix builds where long != int.

Fix this by just making the "keycode" variable int in the first place,
there doesn't seem to be any reason whatsoever for it to be long and
this allows us to get rid of a couple of existing casts instead of
adding yet another one.
2017-08-24 14:17: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
PB
8a5a57ac10 Add one more @c 2017-08-23 22:36:41 +02:00
PB
fe2a31d6f9 Few more changes 2017-08-23 21:43:48 +02:00
PB
622adc978c Improve wxAutomationObject-related documentation 2017-08-23 19:56:01 +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
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
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