Commit Graph

20 Commits

Author SHA1 Message Date
Stefan Csomor
235e61c311 Implement macOS-specific wxDataViewCheckIconTextRenderer
This implementation suffers at least from 2 problems:

1. It doesn't support icons at all.
2. It toggles the checkbox when clicking on the text and not just on the
   checkbox itself, as would be expected.

but it's still better than the current version which simply doesn't work
at all, i.e. can't be toggled in any way (and also doesn't draw itself
correctly when using dark mode under macOS 10.14+), so use it for now.

A better solution would be to fix the problem with ActivateCell() not
working at all (see #17746) and update the code to respect drawing in
dark mode.

Closes #17473.

Closes https://github.com/wxWidgets/wxWidgets/pull/904
2019-10-21 21:14:54 +02:00
Paul Cornett
9511ab08f1 More use of wxOVERRIDE 2019-04-05 11:08:53 -07:00
Vadim Zeitlin
61223ab32d Fix using radio buttons in wxDataViewToggleRenderer under macOS
Changing item cell in ShowAsRadio() was wrong as the item cell doesn't
exist when it is called and changing the column cell didn't seem to work
well, so just recreate the entire cell in it instead.

See https://github.com/wxWidgets/wxWidgets/pull/853
2018-07-13 18:16:16 +02:00
Vadim Zeitlin
03a13591b9 Add wxDataViewToggleRenderer::ShowAsRadio()
This allows showing radio buttons in wxDataViewCtrl easily and natively.

Notice that this approach, adding an extra function to the existing
renderer class instead of creating some new wxDataViewRadioRenderer (see
https://github.com/wxWidgets/wxWidgets/pull/809), was finally chosen
because it is simpler to implement and, more importantly, because it
will be more natural to generalize if/when we also add a 3-state
check/radio renderer.

Closes https://github.com/wxWidgets/wxWidgets/pull/853
2018-07-11 23:48:14 +02:00
Vadim Zeitlin
3a16250303 Don't make inert toggle/choice wxDataViewCtrl cell editable in wxOSX
Don't disable all inert renderers as this results in ugly "disabled"
look for some of them (see 6e885992f5),
but do disable the renderers that would be editable otherwise, such as
wxDataViewChoiceRenderer and wxDataViewToggleRenderer, in wxOSX as it
shouldn't be possible to change value of the inert cells.

See https://github.com/wxWidgets/wxWidgets/pull/707

Closes #18056.
2018-02-04 00:35:11 +01: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
6316045e19 Remove unnecessary wxOSX_USE_COCOA checks in wx/osx/dvrenderers.h
These checks are not needed any more now that Carbon is not supported any
loner.
2016-03-19 00:17:14 +01:00
wanup
c4e892629f Implement wxDataViewChoiceByIndexRenderer for wxOSX
Add missing class implementation.

Closes #17452.
2016-03-19 00:17:13 +01:00
Vadim Zeitlin
361c6357b4 Use wxDataViewRenderer::PrepareForItem() in all ports
wxOSX and wxGTK previously used their own methods for handling the enabled
state and the attributes of the items being rendered, change them to reuse the
same methods as the generic implementation, i.e. SetEnabled() and SetAttr()
and remove the port-specific GtkSetAttr(), OSXApplyAttr() and so on.

This has the advantage of ensuring that the logic is the same for all
platforms (e.g. item enabled status wasn't handled in the same way in wxGTK as
in the other ports previously) and hopefully makes the code simpler by cutting
down on the number of virtual methods.

Notice that GtkSupportsAttrs() optimization was removed as it didn't seem to
be worth the bother (we basically saved a call to a virtual model method at a
price of a virtual renderer method call) and preserving it would have
complicated things needlessly.
2015-08-31 22:20:33 +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
Vadim Zeitlin
615b49692c Add GetDefaultType() to all standard wxDataViewRenderer-derived classes.
This makes it possible to refer to the associated wxVariant types without hard
coding the string constants, i.e. instead of writing "string" (error prone as
typos are not detected) it is now possible to write wxDataViewTextRenderer::
GetDefaultType().

This will also make it simpler to write generic (in C++ templates sense) code
using renderers.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78288 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-12-20 21:51:54 +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
119e862ca9 Fix wxDataViewChoiceRenderer behaviour in wxOSX/Cocoa.
Changing the value of a "choice" cell in wxDataViewCtrl didn't work correctly
in wxOSX/Cocoa because wxDataViewChoiceRenderer used the base class version of
OSXOnCellChanged() which passed the integer index we received from NSOutlineView
to the model instead of the expected string.

Fix this by overriding OSXOnCellChanged() in wxDataViewChoiceRenderer itself
and using its argument as an integer index of the selection because this is
what it is, at least under OS X 10.7.

Closes #14373.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71939 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-07-02 14:36:56 +00:00
Francesco Montorsi
b1153ed60f no real change: just fix RCS-ID so that it reflects the current revision number
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64140 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-25 21:33:16 +00:00
Vadim Zeitlin
061a5c21db Add wxOSX_USE_COCOA around Cocoa-only OSXApplyAttr() method.
This method is used in wxOSX/Cocoa only.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62607 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-11 01:36:36 +00:00
Vadim Zeitlin
aaedb44c5e Revert r62598 which removed "unnecessary wxOSX_USE_COCOA checks."
These checks were not unnecessary at all, this file is used for both Cocoa and
Carbon, fix this momentary lapse of reason.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62606 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-11 01:32:58 +00:00
Vadim Zeitlin
b0607dd221 Add support for custom attributes to wxOSX/Cocoa wxDataViewCustomRenderer.
Virtualize applying the attributes in a new OSXApplyAttr() function and simply
store the attribute in its wxDataViewCustomRenderer version so that it could
be reused later in Render().

The attributes now work correctly in wxOSX/Cocoa dataview sample too.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62599 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-10 17:42:24 +00:00
Vadim Zeitlin
b7cc3b72f9 No changes, just remove unnecessary wxOSX_USE_COCOA checks.
This file is only compiled in wxOSX/Cocoa build so there is no need to check
that we're using Cocoa here.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62598 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-10 17:42:13 +00:00
Vadim Zeitlin
62265c2c67 Allow custom wxDataViewCtrl renderers to easily use attributes.
Set up the DC passed to wxDataViewCustomRenderer::Render() to use the font and
colour defined by the item attribute by default so that any calls to
RenderText() from it will use them automatically.

Also added public wxDataViewCustomRenderer::GetAttr() to allow retrieving the
attribute explicitly in Render().

The column using custom renderer in the dataview sample now works as expected
in the generic version; the native ones will be corrected in the upcoming
commits.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62590 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-10 17:41:11 +00:00
Vadim Zeitlin
6eec70b984 Big wxDataViewCtrl renderer classes refactoring.
This commit adds no changes in functionality but paves way for the upcoming
improvements of wxDataViewCustomRenderer.

First, introduce wxDataViewCustomRendererBase class in order to allow
implementing behaviour common to custom renderers in all ports in this class
instead of triplicating it.

This required splitting monolithic dataview.h in more parts, now we have
wx/dvrenderer.h which defines wxDataViewRendererBase and the new
wxDataViewCustomRendererBase and includes wx/port/dvrenderer.h which define
wxDataViewRenderer and wx/port/dvrenderers.h which defines all the other
renderer classes.

Also bring renderers hierarchy in the generic version closer to other ports:
all standard renderer classes now inherit from wxDataViewRenderer and not
wxDataViewCustomRenderer in for consistency with the other ports.
wxDataViewRenderer itself still does derive from wxDataViewCustomRendererBase,
unlike elsewhere, but this is unavoidable considering that all generic
renderers are custom ones.

Finally do some cleanup in OS X part of the code: correct indentation,
spacing, comment style.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62589 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-10 17:40:58 +00:00