Set width of the new columns to wxLIST_DEFAULT_COL_WIDTH and not 0 in
the generic version: this is more compatible with the MSW version and
more useful.
Document that omitting list column width in XRC results in columns of
default, rather than null, as previously, width.
The same value of 80px was used in both the generic and MSW versions of
wxListCtrl, so introduce a symbolic name for it and define it only once,
similarly to how it's already done for wxDVC_DEFAULT_WIDTH and
WXGRID_DEFAULT_COL_WIDTH.
No real changes.
This wasn't done since the changes of c1c4c5516c (fixed unwanted owner
data accesses in virtual list ctrl, 2001-08-07), but there doesn't seem
to be any reason to avoid accessing the item in SendNotify() (any more?)
and if we ever did generate events for all the items in a virtual list
control, this would be already a problem, even if we didn't access the
line info from here.
So just revert the check for !IsVirtual() and always fill the item in
the generated event to make the behaviour of the generic version
consistent with the MSW one and slightly more useful.
See https://github.com/wxWidgets/wxWidgets/pull/2456Closes#19235.
Use 2 separate functions instead to make the code more clear, as passing
false for indicate the refresh shouldn't be done was quite confusing.
Also get rid of a separate RefreshAll() which was called only from
RecalculatePositions().
No real changes.
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
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.
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
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
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.
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.
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.
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.
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.
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
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
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.
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.
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.
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.
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.
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.
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.