Commit Graph

40 Commits

Author SHA1 Message Date
orbitcowboy
915dcce320 Fix typo in a comment in dataview sample
No real changes, just fix a typo in "invisible".

Closes https://github.com/wxWidgets/wxWidgets/pull/1899
2020-06-20 14:44:10 +02:00
Jorge Moraleda
8b9cf87653 Added an example of overriding method HasValue in wxDataView to show how some items may not have values for some columns. 2020-04-14 17:48:47 -07:00
Paul Cornett
948ddc6e0f Eliminate -Wcast-qual warnings with GCC and Clang
Use const_cast, mutable, and various other changes to avoid -Wcast-qual
2020-02-02 22:50:32 -08:00
Vadim Zeitlin
334ff40716 Show wxDataViewCheckIconTextRenderer in the sample
Instead of using separate check and icon+text columns in the list model
page, use the combined check+icon+text column to verify that it works
(which is not the case current in the native Mac version).
2019-12-15 19:27:58 +01:00
Vadim Zeitlin
2e71e14dc4 Fix format specifier in an error message in dataview sample
Use "%zu" for a size_t value to avoid assert failures under LP64 (i.e.
all 64-bit Unix) systems.
2019-12-15 19:26:18 +01:00
jensgoe
14ca16ffaf example for DataView with wxDV_VARIABLE_LINE_HEIGHT flag 2019-01-08 00:12:47 +01:00
Maarten Bent
eb23d4735c Fix unannotated fall-through warnings 2018-11-25 21:29:37 +01:00
approach
09124932eb Add strike-through support to wxDataViewItem attributes
Implement support for this attribute only in the generic version so far,
it will hopefully be implemented for the natives ones in the future.

Also add a new toggle column to the dataview sample to check how it
works: checking the items in this column enables using this attribute
for some other ones.

Closes #18180.
2018-08-14 18:04:31 +02:00
Václav Slavík
60bd6842e4 Fix handling of ampersands in wxDataViewCtrl markup
Handle "&" in exactly the same way as "&" in wxMarkupParser, i.e. do not
map the former to "&&" to prevent it from being interpreted as a mnemonic as
this is incompatible with using markup for anything but the control labels,
e.g. for wxDataViewCtrl items text, in which mnemonics are not recognized.
And even when using markup for control labels, it was a questionable decision
as it's really not clear at all why should the XML entity and the raw
character itself be handled differently.

Also split wxMarkupText into two classes, wxMarkupText that handles
mnemonics in the markup (which is typically a label) and a very
similar, but not derived, wxItemMarkupText that handles mnemonics-less
markup for list etc. items, uses DrawItemText() and supports
ellipsizing.

Illustrate the use of ampersands in the dataview sample.
2017-04-07 18:45:39 +02:00
Vadim Zeitlin
74c0462c84 Add wxDataViewTextRenderer::EnableMarkup()
Implement the new method to all the implementations (generic, GTK, OS X), show
it in the sample and update the documentation.
2016-06-16 00:06:23 +02:00
Vadim Zeitlin
1bbc44daff Support background colour in wxDataViewItemAttr in wxGTK
The code handling background colour was commented out for some reason, simply
enable it as it seems to be working just fine -- and update the sample to show
that it does.
2016-03-22 17:49:49 +01:00
Vadim Zeitlin
7e37c6763f Test custom editor in the dataview sample
Show how to create and use a custom editor in the custom renderer.
2016-02-20 17:07:04 +01:00
Hartwig Wiesmann
7feaa794bc Use available space better in wxDataViewCtrl date renderer in wxOSX.
Try to show as much useful information as possible for the available width,
notably show the time fully, including seconds, which was never done before.

Also add a date column to the dataview sample to allow seeing how this works
in practice.

See #16640.
2015-07-18 02:29:17 +02:00
Vadim Zeitlin
4d9afe351a Undo the change of the number of items in dataview sample.
Increasing it to 10000000 in r77905 brought both the native GTK (see #16741)
and OSX (see #16740) wxDataViewCtrl implementation to their knees, so don't do
this.

This is, of course, just hiding the real bug, but still better than not
allowing people to run the sample at all.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78287 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-12-20 21:51:47 +00:00
Paul Cornett
1a4e398732 fix assert in dataview sample, closes #16679
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78169 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-11-21 17:20:04 +00:00
Vadim Zeitlin
36a5983f64 Use wxSelectionStore in wxDataViewCtrl generic implementation.
This makes the code (slightly) shorter and more clear and is more efficient as
selecting all items in wxDataViewCtrl is now a O(1) operation instead of being
O(N), where N is the number of items -- and the latter could take quite a long
time (and consume non-negligible amount of memory) for large N.

Increase the size of the virtual list control from 1000 to 10000000 in the
sample to show this.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77905 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-27 20:46:25 +00:00
Vadim Zeitlin
3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00
Vadim Zeitlin
98f8e6666b Add the possibility to disable invisible wxDataViewCtrl items.
Add new wxDataViewModel::IsEnabled() and wxDataViewListStore::IsEnabledByRow()
methods and implement support for actually disabling the items in wxOSX/Cocoa
native implementation of wxDataViewCtrl and limited support for it in the
generic version.

We need to implement this in wxGTK using GtkCellRenderer "sensitive" propriety
later.

Closes #12686.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66403 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-12-19 15:02:56 +00:00
Vadim Zeitlin
ce00f59b5b No changes whatsoever, just remove trailing whitespace.
There are no real changes in this commit but it removes all trailing white
space from our source files. This avoids problems when applying patches and
making diffs and it would be nice to prevent it from reappearing.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65680 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-09-30 11:44:45 +00:00
Robert Roebling
d8090b5e2c Further work on wxDataViewListModel::Reset()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65538 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-09-13 20:02:01 +00:00
Vadim Zeitlin
526954c596 Globally use "wxWindows licence" consistently.
Use "wxWindows licence" and not "wxWidgets licence" (the latter doesn't
exist) and consistently spell "licence" using British spelling.

See #12165.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64940 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-07-13 13:29:13 +00:00
Vadim Zeitlin
ef6833f9ab Add custom renderer column to the list model example in dataview sample.
Add a column using custom renderer to the example using a list model with
attributes to test attributes support -- currently they are ignored, but this
will be fixed soon.

Also make the custom renderer display somewhat more clear as previously it
didn't depend at all on its value.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-10 17:40:37 +00:00
Vadim Zeitlin
2746bccf23 Use symbolic constants for list model columns in dataview sample.
Using Col_EditableText, Col_IconText and Col_TextWithAttr instead of 0, 1 and
2 makes the sample code a bit easier to read.

Also use switch on the column value instead of nested ifs everywhere to give
compiler a chance to warn us if we forget to update some function when a new
column is added.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62587 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-10 17:40:25 +00:00
Vadim Zeitlin
7fadac8872 Make wxDataViewModel::GetAttr() and GetAttrByRow() const.
This is an incompatible change but having to use a non-const model pointer to
call a clearly logically const version was simply too ugly so change it while
we still can.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-24 21:42:04 +00:00
Vadim Zeitlin
c27050d2e3 Use virtual items in wxDVC sample under Mac too.
There doesn't seem to be any reason to not use them and having different
appearance under OS X and elsewhere is just confusing and looks like a bug.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62491 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-24 01:02:31 +00:00
Vadim Zeitlin
c937bcac0f Add ellipsization support to wxDataViewCtrl.
Implemented ellipsization in the generic, GTK and both OS X Carbon and Cocoa
versions but it currently doesn't work well in GTK as it changes the item
alignment unconditionally, this will need to be fixed later.

The behaviour for the columns is currently inconsistent between ports too:
under MSW they (natively) use wxELLIPSIZE_END, under GTK -- wxELLIPSIZE_NONE
and under OS X the same ellipsization mode as the column contents, i.e.
wxELLIPSIZE_MIDDLE by default.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62433 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-16 21:35:26 +00:00
Vadim Zeitlin
205bdf2069 Implement icon text column using native GTK renderers in wxDVC.
This has a possible advantage of a more native look and feel (although it's
hard to tell the difference between drawing the icon ourselves and how the
default GTK+ renderer does it to be honest) and a very real advantage of
allowing to edit in place cells with icons. It also reduces code duplication
in GTK implementation.

Modify the sample to make the icon-text column in the list model editable to
show that it works. This required storing the values of the second column as
well, so do it in its own array and to avoid calling it "m_array2", rename the
existing m_array to m_textColValues (which accounts for most of the diff in
the sample) and call the new one m_iconColValues.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62423 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-16 01:29:06 +00:00
Vadim Zeitlin
38c349189a Implement attributes support in generic wxDataViewIconTextRenderer.
Simply override RenderWithAttr() instead of Render().

Update the sample to show that this works now.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62395 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-12 22:44:15 +00:00
Vadim Zeitlin
09a0ece0dc Fix display of items without attributes in Cocoa wxDVC.
The attribute used for the last item was reused for the next item in the same
column unless it was overridden in the attribute of this item, fix this by
remembering the original attribute and using it if no attributes are
explicitly specified.

Also change the sample to show the items without attributes in a column with
attributes and make the label correspond to the attribute of the item.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62390 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-12 17:30:48 +00:00
Vadim Zeitlin
77ea22ef1c Make the colours in the demo a bit more logical.
Make the colours of the items in the "attributes" column blue/green/red in
order instead of making all odd items blue and all even and divisible by 3
ones green while making the rest of them red -- it was a bit difficult to
figure out how it worked before.

Also correct wxDataViewItemAttr::SetItalic() check: comparing the remainder of
the division by 2 with 5 didn't risk to work.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62385 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-12 13:59:39 +00:00
Robert Roebling
a82e28dd03 Change Compare() method to being const
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59471 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-10 14:06:04 +00:00
Robert Roebling
ecc322264b Implement vetoing editing in wxDataViewTextRenderer under GTK+ and test it in the sample (see also #10495)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-09 20:49:22 +00:00
Francesco Montorsi
caa4f8ff5c fix typo (part of r59384)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59385 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-06 20:45:56 +00:00
Francesco Montorsi
ecad59d882 remove wxT() and _() macros to make the sample more readable; add File->Clear log menuitem; re-add m_container flag in MyMusicTreeModelNode and describe in a TODO/FIXME item why it's needed; warn when selecting the ninth symphony is not possible
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59384 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-06 20:45:04 +00:00
Vadim Zeitlin
bfb9ad8b60 2nd (blind) fix for VC6 build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-05 23:41:27 +00:00
Vadim Zeitlin
03dfc8f515 set svn properties correctly for the new files (please use the auto-props!)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59334 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-05 14:00:46 +00:00
Vadim Zeitlin
a4991d4333 (blind) fix for VC6 build
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59333 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-05 13:58:12 +00:00
Francesco Montorsi
8bf6f04451 build fix
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59325 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-04 23:23:28 +00:00
Francesco Montorsi
81c3f0fce3 all code revisited.
Main additions:
- now it's possible to change the DVC style dynamically
- make models more robust against deleting items, and against other allowed user actions
- comment portions of the code to make it more didactive

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59323 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-04 22:33:18 +00:00
Francesco Montorsi
bf19b714f0 reorganize the sample splitting it in two source files and an additional header; most important: don't tile all the controls into the main frame: it becomes too big; rather use a notebook control to properly layout them
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59316 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-03-04 17:21:40 +00:00