Commit Graph

643 Commits

Author SHA1 Message Date
Marcos
cda21c8ddc Fix a cosmetic bug in ExtendRulesAndAlternateColour() code
Ensure that vertical rules extend to the bottom of the window on the
non-first page of the control too.

This was probably broken in 5ae2a8ebb8 (Simplify API for extending
wxListCtrl background display, 2020-11-09).

Closes https://github.com/wxWidgets/wxWidgets/pull/2130
2020-12-01 01:32:26 +01:00
Vadim Zeitlin
5ae2a8ebb8 Simplify API for extending wxListCtrl background display
Replace SetListRulesAlternateColourOnBlank() taking 2 arguments, with
the second of them being used only when the first one is true, with a
simpler but still sufficient ExtendRulesAndAlternateColour(bool).

Make the new method virtual and define it as doing nothing in
wxListCtrlBase class, so that it's still available, even if currently
not implemented, in wxMSW.

Also simplify the implementation, fix style problems and other minor
improvements.
2020-11-09 00:37:55 +01:00
Marcos
584d1ae47d Allow showing rules and background on entire wxListCtrl window
Previously they were both limited to the part occupied by the items
only, add a new method allowing to extend them to the whole client
window area.

See https://github.com/wxWidgets/wxWidgets/pull/2106
2020-11-09 00:07:53 +01:00
PB
f57f214122 Remove BCC-specific hdrstop pragma from everywhere 2020-10-12 21:58:37 +02:00
ali kettab
fedc80eee3 Improve selection and focus events generation in wxGenericLisCtrl
Avoid sending spurious wxEVT_LIST_ITEM_{FOCUSED, SELECTED, DESELECTED}
events and make the generic version consistent with the behaviour of the
native wxMSW one.

Also add/extend the tests and slightly improve the sample.

Closes https://github.com/wxWidgets/wxWidgets/pull/2044
2020-10-10 19:13:52 +02:00
Vadim Zeitlin
6c5751db4f Remove unused HEADER_HEIGHT constant
It wasn't used since f8252483ec (Applied patch [ 803473 ] wxListCtrl
header height bugfix, 2003-09-11) but remained, commented out, in the
code for some reason.
2020-07-10 18:09:16 +02:00
Vadim Zeitlin
96acdae1e6 Remove the test for y mouse position in wxListHeaderWindow
This test was apparently supposed to check if the mouse was inside the
header, vertically, but this should always be the case unless the mouse
is captured and when it is captured in this code, m_isDragging is set to
true meaning that the code in the "else" branch of the test for it can't
be executed at all, so checking the vertical position seems completely
unnecessary.

Worse, it was actively harmful when using GTK 2 with DPI scaling, as in
this case the height of the window could be different from 22 (e.g. 44
for 2x scaling).

Closes #18713.
2020-07-10 18:06:32 +02:00
Lauri Nurmi
96b83a1523 Make virtual lists send DESELECTED events consistently on both implementations
In the case when a listctrl is clicked outside of any item, the item is
visually deselected, and it is logical that a DESELECTED is sent.

For non-virtual lists this would happen, but for virtual lists it would
either happen or not happen depending on implementation (MSW/generic)
and mode (single/multi). From now on the DESELECTED event is always sent.
2020-05-28 10:51:58 +03:00
Vadim Zeitlin
e1fce68be6 Account for checkboxes when autosizing wxListCtrl first column
Without this, the text of the first column was truncated when using
checkboxes.

Closes #18661.
2020-01-31 16:22:49 +01:00
Vadim Zeitlin
1014877302 Slightly reorganize last column width calculation
No real changes, just make it more obvious that we increase the last
column width to the remaining margin if it's smaller than it.
2020-01-31 16:18:41 +01:00
Vadim Zeitlin
01d0deb5bf Get rid of unnecessary variable in wxListCtrl::SetColumnWidth()
No real changes, just remove a variable assigned and used exactly once.
2020-01-31 16:15:13 +01:00
Paul Cornett
26f58bdf78 Fix base class call of virtual SetFont() in wxGenericListCtrl
Hard-coding 'wxWindow' improperly bypasses an override in wxControl on GTK3
2020-01-27 11:27:39 -08:00
Vadim Zeitlin
fa74c30d09 Remove commented out code using wxINVERT from wxListCtrl
No real changes, just remove the old code using wxINVERT logical
function which doesn't work with wxGTK3/wxMac anyhow and so is really
not worth keeping.

See #16890.
2020-01-23 01:17:36 +01:00
Vadim Zeitlin
41eb39b4a7 Don't activate items on Ctrl-M in generic wxListCtrl
This is unexpected, so add the check for the modifiers, as is done in
generic wxDataViewCtrl, to only accept the "real" Enter here and not
Ctrl-M sending the same key code.

Closes #17458.
2019-11-02 20:34:07 +01:00
oneeyeman1
f46a5423ae Implement autosizing of columns in generic wxListCtrl
Autosize the column to fit its contents or its label width if there are
no items when its divider is double clicked.

This is consistent with wxMSW behaviour and is generally convenient.

Closes https://github.com/wxWidgets/wxWidgets/pull/1573
2019-10-08 01:33:26 +02:00
Vadim Zeitlin
32fe124899 Add support for icon/label rectangles to generic wxListCtrl
Honour the value of "code" parameter in GetSubItemRect().
2019-08-27 17:12:14 +02:00
Vadim Zeitlin
9395d7f404 Replace another hardcoded constant with a symbolic one
Use the already existing IMAGE_MARGIN_IN_REPORT_MODE instead of "5".
2019-08-27 17:12:14 +02:00
Vadim Zeitlin
a87e596be7 Replace hardcoded number with a constant in generic wxListCtrl
Use ICON_OFFSET_X instead of hardcoded 2.
2019-08-27 17:12:14 +02:00
oneeyeman1
43c519e04f Add wxListCtrl::IsVisible()
Allow checking if the given item is (at least partially) visible on
screen.

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

Closes #9949.
2019-08-05 13:46:15 +02:00
Maarten Bent
34efac1a21 Don't call unimplemented virtual wxListCtrl::OnGetItemIsChecked()
This method should only be called when checkboxes are enabled and
calling it unconditionally triggered an assert failure.

See #18393.

Closes https://github.com/wxWidgets/wxWidgets/pull/1330
2019-05-26 16:41:48 +02:00
Maarten Bent
c20060745f Support checkboxes in virtual wxListCtrl 2019-05-05 14:25:06 +02:00
Maarten Bent
ceaf2aa803 Move virtual stub functions to wxListCtrlBase 2019-05-05 14:23:44 +02:00
Paul Cornett
fe1737d399 Reduce the scope of some local variables 2019-04-05 10:44:02 -07:00
Vadim Zeitlin
795095a4ec Fix wxGenericListCtrl build with wxUSE_STD_CONTAINERS and C++98
Use wxShrinkToFit() instead of wxVector::shrink_to_fit() which is not
defined in this build configuration.

This was broken by recent 2af7e38153.

See https://github.com/wxWidgets/wxWidgets/pull/924
2018-09-17 23:20:03 +02:00
Vitaly Stakhovsky
2af7e38153 Replace obsolete object array with vector in wxGenericListCtrl
Use wxVector<wxListLineData*> instead of WX_DECLARE_OBJARRAY().

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

Closes https://github.com/wxWidgets/wxWidgets/pull/924
2018-09-17 22:50:43 +02:00
Vadim Zeitlin
a824ee092d Change the return type of wxListCtrl::SetItem() overload to bool
For some reason lost in the depths of time (but probably just a typo)
(but probably just a typo) (but probably just a typo) (but probably just
a typo), SetItem() overload taking the column index returned "long" and
not "bool", even though the actual return value was always "true" or
"false" (or even just always "true" in the case of the generic version).

Change it to return "bool" for consistency with the other overload and
because this just makes more sense and shouldn't break any existing code
due to the implicit conversions between bool and long.

Also document the return value meaning.

Closes #18153.
2018-06-28 00:39:31 +02:00
Vadim Zeitlin
8401d3fec9 Fix coordinates adjustment for wxGenericListCtrl mouse events
wxListHeaderWindow event coordinates don't need to be adjusted, as it's
positioned at (0, 0) of its parent window anyhow, but wxListMainWindow
events do need to be adjusted to use the parent window coordinates, as
it's the only window that should be seen by the outside code -- and also
for consistency with the native MSW version.

This corrects the changes originally done in
651d7a1ff8

See #18133.
2018-05-19 15:06:35 +02:00
Vadim Zeitlin
822809ef78 Stop forwarding DoPopupMenu() to wxGenericListCtrl main window
There doesn't seem to be anything wrong with just showing the popup menu
in this window itself and this avoids the need to do any coordinate
adjustments, which didn't work correctly for the menus shown over the
header window after the previous commit (and hadn't worked correctly for
the menus shown over the non-header area before it).

See #18133.
2018-05-17 03:41:53 +02:00
Vadim Zeitlin
0446382e82 Fix position of popup menus in wxGenericListCtrl
The position was off by the header height due to a missing translation
between wxGenericListCtrl and wxListMainWindow, in which the menu is
actually shown, coordinates.

Closes #18133.
2018-05-16 15:23:00 +02:00
Vadim Zeitlin
79d35109f0 Avoid assert if there is no selection in wxListCtrl::DeleteItem()
Don't try making the current item visible if there is no current item.

This is another fix after 99d7b13e3f (in
addition to the previous 925a1c0734).
2017-11-07 02:54:24 +01: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
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
Paul Cornett
e9fdda8638 Avoid clearing selection for mouse button up event which is not over an item, see #17547 2016-06-16 07:23:34 -07:00
Jonathan Dagresta
306597c4fa Ensure wxGenericListCtrl item selected from keyboard is visible
When using the keyboard to select an item by typing the first characters of
its name, we need to make the item visible in addition to selecting it.

Closes #16336.
2016-05-13 15:30:13 +02:00
Vadim Zeitlin
70b64b8c53 Merge branch 'rename-listctrl-checkbox-methods' of https://github.com/discnl/wxWidgets
Use consistent case for wxListCtrl::{Has,Enable}CheckBoxes() methods.

Closes https://github.com/wxWidgets/wxWidgets/pull/275
2016-04-23 18:53:41 +02:00
Dimitri Schoolwerth
c78470b647 Rename wxListMainWindow::IsInsideCheckBox to IsInsideCheckbox 2016-04-21 17:47:10 +00:00
Dimitri Schoolwerth
602111f2b3 Rename wxListCtrl::HasCheckboxes() and EnableCheckboxes()
Rename them to HasCheckBoxes and EnableCheckBoxes for consistency with
wxCheckBox naming.

See also PR https://github.com/wxWidgets/wxWidgets/pull/153
2016-04-21 15:25:10 +00:00
Vadim Zeitlin
246ae58c19 Replace wxTreeItemAttr and wxListItemAttr with wxItemAttr
The two existing structs were completely identical, just replace them with a
single wxItemAttr.

Notice that wxDataViewItemAttr is not quite the same, although pretty similar,
so it remains separate for now. It would be nice to combine it with this one
too in the future, e.g. to make it simpler to make items bold in a wxListCtrl.
2016-04-16 19:04:52 +02:00
Vadim Zeitlin
57fa59b81c Merge branch 'listctrl-checkboxes-generic' of https://github.com/MaartenBent/wxWidgets
Implement checkboxes support for the generic version of wxListCtrl too so it's
not available under all platforms.
2016-02-06 19:18:58 +01:00
Maarten Bent
dedda75b3a Fixed checking with multiple-selection enabled, added left offset. 2016-02-06 18:54:08 +01:00
Maarten Bent
9301692b68 Removed unneeded column width change to match msw behavior. 2016-02-06 17:30:29 +01:00
Maarten Bent
7dd65abaf7 Implemented checking checkboxes. 2016-02-06 17:20:40 +01:00
Maarten Bent
3b89a3c7c5 Implemented drawing checkboxes. 2016-02-06 17:19:15 +01:00
Maarten Bent
415292c614 Implemented logic. 2016-02-06 17:12:56 +01:00
Maarten Bent
47794945b5 Fixed compiling with MSVC. 2016-02-06 17:09:36 +01:00
Tobias Taschner
5ba67c67e4 Remove wxOSX/Carbon support.
Cocoa has been the default toolkit in wxWidgets for a long time. There is really no good reason to use Carbon in 2016 and this removes a lot of unused and unmaintained code.
2016-02-01 13:48:48 +01:00
Igor Korot
aa4aa74154 Don't generate wxEVT_LIST_ITEM_RIGHT_CLICK outside of item area
Make wxGenericListCtrl used under wxGTK and wxOSX behave the same as the
native wxMSW wxListCtrl and wxTreeCtrl under all platforms and only generate
ITEM_RIGHT_CLICK events when an item was actually clicked, i.e. don't generate
them for the clicks completely outside of the client area.

Closes #4711.
2016-01-30 18:54:09 +01:00
Tobias Taschner
8282c1be0f Remove Windows CE support
Windows CE doesn't seem to be supported by Microsoft any longer. Last CE
release was in early 2013 and the PocketPC and Smartphone targets supported by
wxWidgets are long gone.

The build files where already removed in an earlier cleanup this commit
removes all files, every #ifdef and all documentation regarding the Windows CE
support.

Closes https://github.com/wxWidgets/wxWidgets/pull/81
2015-09-23 00:52:30 +02:00
Dimitri Schoolwerth
8f8d58d193 Use wx-prefixed macros throughout the repository.
Change {DECLARE,IMPLEMENT}_*CLASS and {DECLARE,BEGIN,END}_EVENT_TABLE
occurrences to use the wx-prefixed version of the macros.
2015-04-23 22:00:35 +04:00