Commit Graph

65895 Commits

Author SHA1 Message Date
Vadim Zeitlin
c22e81c7a1 Extend unit test for events generated by wxNotebook::AddPage()
In addition to checking that adding the first page doesn't generate any
events, check that adding another page later does generate them.
2019-01-28 19:01:17 +01:00
Vadim Zeitlin
7d36b02bcc Reuse base class helper in wxGTK wxNotebook::InsertPage()
Call DoSetSelectionAfterInsertion() instead of partially duplicating it.

This ensures that m_selection is correct after inserting a new page,
which wasn't the case before. Surprisingly, this didn't actually matter
because wxGTK implementation doesn't really use the base class
m_selection neither and just queries GTK+ widget directly for its
selection in GetSelection() instead, but it was at the very least
confusing.
2019-01-28 18:59:34 +01:00
Vadim Zeitlin
7cd6a27e16 Clarify when wxBookCtrl::AddPage() sends page changing events
Notably document that it does not do it when adding the first page.
2019-01-28 18:56:03 +01:00
Vadim Zeitlin
359b23a58b Avoid events on first page insertion in wxGTK wxNotebook
Make wxGTK consistent with wxMSW and wxOSX and also make it pass the
unit test added in the previous commit by suppressing events generated
by gtk_notebook_insert_page() when adding the first page (but not any
subsequent ones).
2019-01-28 18:51:02 +01:00
Vadim Zeitlin
da96ab179f Fix updating selection in wxNotebook::InsertPage() in wxQt
Just use DoSetSelectionAfterInsertion() provided by the base class,
which does the right thing already, including both setting m_selection
and sending (or not sending) the corresponding events.
2019-01-28 18:29:31 +01:00
Vadim Zeitlin
6fdcfd8199 Add unit test for no events when adding first wxNotebook page
Adding the first page shouldn't generate any events even if the
selection does change (from -1 to 0) internally.
2019-01-28 18:21:32 +01:00
Vadim Zeitlin
665b5a76a8 Remove unnecessary wxNotebook::DoSetSelection() from wxQt
Having this method didn't really help, it's simpler and more
straightforward to implement ChangeSelection() as a signal-blocking
wrapper around SetSelection() instead.

No real changes in behaviour, this is a pure refactoring.
2019-01-28 17:51:27 +01:00
Jay Nabonne
0dc1654ab6 Get simple (text) drag and drop case working with drop source.
We ended up not needing the underlying QMimeData-based implementation, as the classes sitting on top of it
bypassed it anyway. It now treats the hierarchy as a pure data storage mechanism, generating the
QMimeData when drag-drop is initiated.
2019-01-28 15:30:25 +00:00
Jay Nabonne
ea4c7120ff Fixed up and cleaned up Qt variant of wxDataFormat.
Kept "mime type" and "id" conceptually separate in the interface in case they need to diverge later.
Got rid of the odd "wxChar *" variants and the QString one.
Implemented unimplemented "type" functions.
Implemented "!=" in terms of "==", to keep from having two places to keep in sync.
2019-01-28 15:22:01 +00:00
Graham Dawes
6b11c372a1 Fix recently introduced build error in widgets sample
Make it compile again when wxHAS_BITMAPTOGGLEBUTTON is not defined,
which is notably the case in wxQt.

Closes https://github.com/wxWidgets/wxWidgets/pull/1189
2019-01-28 12:41:31 +01:00
Vadim Zeitlin
2c7489fffe Merge branch 'widgets-sample-buttons' of https://github.com/MaartenBent/wxWidgets
Several improvements to the buttons pages of the widgets sample:

- Use a valid font when creating the bitmap.
- Create the bitmap with an DPI independent size.
- Use different images for different button states, as described by the
  checkbox options.
- Add a checkbox to disable the bitmap.
- Recreate the button when changing label, so the bitmap is updated.
- Implement the 'fit exactly' option on ToggleButton page.
- Use more wxSizerFlags in widgets sample.

See https://github.com/wxWidgets/wxWidgets/pull/1188
2019-01-28 01:19:31 +01:00
Vadim Zeitlin
66727bf04b Merge branch 'wxradiobox' of https://github.com/MaartenBent/wxWidgets
Several wxRadioBox-related improvements:

- Fix its minimum width calculation to take the title into account.
- Remove unused nor useful wxRA_LEFTTORIGHT and wxRA_TOPTOBOTTOM.
- Tidy up the radiobox page of the widgets sample.

See https://github.com/wxWidgets/wxWidgets/pull/1187
2019-01-28 01:17:34 +01:00
Tomay
10eeb0b262 Improve drawing buttons in generic wxSearchCtrl
Several fixes:
* Clear the buttons background, which can be important if their (custom)
  bitmap is transparent.
* Only add margin before/after the corresponding button if it is
  actually visible.
* Select the bitmap out of wxMemoryDC before modifying it.
* Don't assume that the "Cancel" button is always square.

Closes https://github.com/wxWidgets/wxWidgets/pull/1142
2019-01-28 01:15:05 +01:00
New Pagodi
07f64c3b75 Add wxPU_CONTAINS_CONTROLS style for wxPopupWindow
This restores the default behavior of a popup window in MSW to the
behavior it had before 56c4191168. The new
flag added by this commit can be used to give the popup window the
behavior from after that commit, i.e. choose the implementation using a
WS_POPUP window rather than the default one using a WS_CHILD of the
desktop.

The old behavior kept the popup from taking focus from its parent window
but left some controls not working. The new behavior has the popup take
focus and lets all controls work.

Closes https://github.com/wxWidgets/wxWidgets/pull/1123
2019-01-28 00:48:16 +01:00
Tomay
8deb2cf0bb Add wxUSE_WINSOCK2 wxMSW option to include winsock2.h
Including <winsock.h> and <winsock2.h> is incompatible and if the
application wants to use the latter, it may be convenient to define
wxUSE_WINSOCK2 when building wxWidgets instead of having to work around
winsock.h implicit inclusion from include/wx/msw/wrapwin.h.

Closes https://github.com/wxWidgets/wxWidgets/pull/1122
2019-01-28 00:34:34 +01:00
Scott Talbert
eaee931011 Fix sending of EVT_KEY_DOWN on wxGTK for non-ASCII characters
Instead of returning early if the keycode is invalid, try setting the unicode
character first, and if neither are valid, return.

Fixes #18054
2019-01-27 09:01:05 -08:00
Maarten Bent
ee752e2439 Use more wxSizerFlags in widgets sample 2019-01-27 17:04:08 +01:00
Maarten Bent
a6fbfacc62 Improve wxButton and wxToggleButton with bitmap in widgets sample
Use a valid font when creating the bitmap.
Create the bitmap with a DPI independent size.
Use different images for different button states, as described by the checkbox
options.
Add a checkbox to disable the bitmap.
Recreate the button when changing label, so the bitmap is updated.
Implement the 'fit exactly' option on ToggleButton page.
2019-01-27 17:04:07 +01:00
Maarten Bent
0d5ed276a4 Update radio page in widgets sample
Make the reset button work by binding to OnUpdateUIReset.
Use wxSizerFlags based API.
Remove minimum size of right panel so the minimum size of wxRadioBox can be
verified.
Use wxArrayString instead of manually creating and deleting an array of
wxString pointers.
Reapply disabling and hiding the test button, and check if test button is
available.
Layout the entire page instead of only the sizer, see #18100.
2019-01-27 15:26:17 +01:00
Maarten Bent
a377f0e5f0 Get rid of wxRA_LEFTTORIGHT and wxRA_TOPTOBOTTOM styles
This was only used in wxUniv, wxRA_SPECIFY_[COLS/ROWS] can be used instead.
Do not remove them from the definitions, to not break user code.

Closes #18100.
2019-01-27 15:26:16 +01:00
Maarten Bent
4fc38bc2c7 Improve minimum width of wxRadioBox
Take the minimum width of the wxStaticBox into account, instead of only the
width of the label.
2019-01-27 15:26:14 +01:00
Graham Dawes
0265139c11 Track Qt tab widget selection when adding pages to wxNotebook
Ensure the selected state tracks the Qt selection: without this, if
no explicit selection is made after adding the pages,
wxNotebook::GetSelection() returns wxNOT_FOUND even though the first
page is selected.

Closes https://github.com/wxWidgets/wxWidgets/pull/1182
2019-01-27 04:04:42 +01:00
chris2oph
b1594725c9 Use QWidget::update() rather than repaint() in wxClientDC
Qt documentation advises to avoid calling repaint() except when an
immediate update is required, i.e. it corresponds to wxWindow::Update().
Use update() instead to avoid many Qt warnings that appeared when
resizing the caret sample window, for example.

Closes https://github.com/wxWidgets/wxWidgets/pull/1178
2019-01-27 04:00:12 +01:00
Vadim Zeitlin
b38587c0ca Merge branch 'tests-wait-event' of https://github.com/vadz/wxWidgets
Refactor code waiting for events in the test suite.

See https://github.com/wxWidgets/wxWidgets/pull/1173
2019-01-27 03:58:23 +01:00
Vadim Zeitlin
c74727c20f Merge branch 'qt_more_event_loop_improvements' of https://github.com/GeoTeric/wxWidgets
Event loop and idle events improvements for wxQt

See https://github.com/wxWidgets/wxWidgets/pull/1171
2019-01-27 03:55:38 +01:00
Vadim Zeitlin
d8348b0419 Merge branch 'master' of https://github.com/dghart/wxWidgets
Improve wxDateTime::SetToWeekDay documentation.

See https://github.com/wxWidgets/wxWidgets/pull/1185
2019-01-27 03:41:22 +01:00
dghart
8e4b492cf4 Clarify what happens if the wxDateTime::SetToWeekDay month and/or year parameters are left as the default Inv_Month/Inv_Year
This causes the month and/or year being set to their wxDateTime::Now values, even if the original values in the wxDateTime object were valid.
2019-01-26 21:12:07 +00:00
dghart
2716347f17 Correct the order of parameters in the wxDateTime::SetToWeekDay examples
e.g. "For example, SetToWeekDay(wxDateTime::Wed, 2)"
not  "For example, SetToWeekDay(2, wxDateTime::Wed)"
2019-01-26 20:55:20 +00:00
Scott Talbert
c68e5d0617 Fix some spelling/grammar errors in documentation
Mostly replace ungrammatical "allows to do" with correct "allows doing".

Closes https://github.com/wxWidgets/wxWidgets/pull/1183
2019-01-26 03:50:47 +01:00
Graham Dawes
e40323d312 Simplify shared timer reference counting in wxEventLoop for wxQT 2019-01-25 16:44:23 +00:00
ali kettab
84fc5c1714 Fix changing tooltip via wxToolTip::SetTip() in wxQt
Update the actual tool tip used by Qt and not just the internal variable
when SetTip() is called.

Also implement wxToolTip::SetWindow().

Closes https://github.com/wxWidgets/wxWidgets/pull/1175
2019-01-25 14:39:37 +01:00
ali kettab
3c369af2e6 Translate QFocusEvent to wxFocusEvent correctly
Set the ID, object and the associated window.

Closes https://github.com/wxWidgets/wxWidgets/pull/1177
2019-01-25 03:31:22 +01:00
Vadim Zeitlin
5811d541da Refactor code waiting for events in the test suite
We already had WX_ASSERT_EVENT_OCCURS_IN macro and a recent commit also
added code doing almost the same thing manually in wxTopLevelWindow unit
test, which was one version too many.

Replace both of them with the new EventCounter::WaitEvent().

No real changes, this is just a refactoring.
2019-01-24 22:52:46 +01:00
Vadim Zeitlin
f4ea128007 Include wx/stopwatch.h explicitly from wxTextCtrl unit test
Don't rely on it being implicitly included from another header when we
use wxStopWatch in this file (with wxGTK only).
2019-01-24 22:52:46 +01:00
Vadim Zeitlin
7c831d25ee Group headers together in wxTextCtrl unit test
No real changes.
2019-01-24 22:52:46 +01:00
ali kettab
515031cf6b Set event object for wxKeyEvents generated in wxQt
Not setting the event object broke the code expecting it to be set,
notably in our own validators code.

Closes https://github.com/wxWidgets/wxWidgets/pull/1176
2019-01-24 22:47:26 +01:00
Vadim Zeitlin
7a42dbd83b Merge branch 'qt_listctrl_find_text' of https://github.com/GeoTeric/wxWidgets
Fix wxListCtrl::FindItem() and add support for columns to GetItemText()
in wxQt.

See https://github.com/wxWidgets/wxWidgets/pull/1174
2019-01-24 22:42:35 +01:00
Liam Treacy
f9280c8529 Now use the column index to retrieve the correct text in GetItemText 2019-01-24 14:38:38 +00:00
Liam Treacy
ca00251454 Fix in wxListCtrl::FindItem. Every item is now iterated through, rather than only the first 2019-01-24 14:35:47 +00:00
Liam Treacy
83f23cec89 Added virtual and override specifiers to derived method in ListCtrl 2019-01-24 14:31:17 +00:00
Maarten Bent
42c602bddf CMake: test installation with Travis CI
With wx-config working, test installing and building the minimal sample
with Travis CI.

Closes https://github.com/wxWidgets/wxWidgets/pull/1172
2019-01-24 13:20:38 +01:00
Graham Dawes
9cd566789d Added file missing from previous commit 2019-01-24 08:08:12 +00:00
Dummy
b0660cc87c Pass argument of proper type to wxPropertyGridInterface::SetPropertyBackgroundColour
The last argument passed to this function should be an int flag not a Boolean value.
Boolean value 'true' passed here is converted to int 1 so wxPG_RECURSE flag is never set and the background colour is never changed for sub-properties.

Closes #18333.
2019-01-23 20:08:57 +01:00
Richard Smith
537b2c3bb0 Reinstate wxTextCtrl unit test previously disabled for wxQt
This test was fixed by earlier changes to wxQt font styles and passes
now.

Closes https://github.com/wxWidgets/wxWidgets/pull/1169
2019-01-23 16:48:26 +01:00
Vadim Zeitlin
9c16a3748e Declare variable only needed inside an "if" inside it
No real changes, just make the code slightly more concise.
2019-01-23 16:47:05 +01:00
Vadim Zeitlin
6b3a0cc460 Make wxQtSpinBoxBase-derived valueChanged() methods inline
It seems better to have them in the class itself, near the connect()
call binding them.

This also resolves an inconsistency between wxQtSpinBox::valueChanged(),
which was defined elsewhere in the source file, and the same method of
wxQtDoubleSpinBox, which was defined directly after the class
declaration.

See https://github.com/wxWidgets/wxWidgets/pull/1168
2019-01-23 16:45:21 +01:00
Matthew Griffin
adee46d155 Send event when wxSpinCtrlDouble value changes in wxQt
Closes https://github.com/wxWidgets/wxWidgets/pull/1168
2019-01-23 16:44:46 +01:00
phowstan
7cfb5b91a5 Implement wxStaticBox::Set/GetLabel() in wxQt
Closes https://github.com/wxWidgets/wxWidgets/pull/1167
2019-01-23 16:38:25 +01:00
Graham Dawes
6aecaa8845 Share a single idle timer for all event loops in wxQT 2019-01-23 13:55:20 +00:00
Graham Dawes
0c28952ff6 Make ScheduleIdleCheck take into account whether the loop is exiting 2019-01-23 12:04:42 +00:00