ALL,
#ifdef __WXOSX__
#include "wx/toplevel.h"
#include "wx/font.h"
#include "wx/settings.h"
#include "wx/utils.h"
#include "wx/osx/private.h"
#include "wx/osx/private/available.h"
#include "wx/osx/cocoa/dataview.h"
#include "wx/renderer.h"
#include "wx/stopwatch.h"
#include "wx/dcgraph.h"
#endif
class SortColumnRenderer
: public wxDataViewRenderer
{
public:
explicit SortColumnRenderer(
wxCheckBoxState state = wxCHK_CHECKED,
wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE,
int align = wxDVR_DEFAULT_ALIGNMENT)
: wxDataViewRenderer( GetDefaultType(), mode, mode ), m_checkedState(state)
{
m_allow3rdStateForUser = false;
m_value = "Ascending";
NSButtonCell* cell;
cell = [[NSButtonCell alloc] init];
[cell setAlignment:ConvertToNativeHorizontalTextAlignment(GetAlignment())];
[cell setButtonType: NSSwitchButton];
[cell setImagePosition:NSImageLeft];
[cell setAllowsMixedState:YES];
SetNativeData(new wxDataViewRendererNativeData( cell ) );
[cell release];
};
};
The code above produces a lot of errors, such as:
Expected unqualified-id NSObjCRuntime.h
that comes from the #include "wx/osx/cocoa/dataview.h".
And if I comment out that include I get:
Unknown type name 'NSButtonCell'; did you mean 'NSButton'?
Trying to import AppKit/NSButtonCell.h, result in the same set of errors as above: Expected unqualified-id...
.
I am trying to mimic the code from the wxCheckIconTextRenderer, but without the Icon portion.
Anybody have an idea?
TIA!
You need to compile the code using Objective-C as such, i.e. put it in a file with .mm
extension if you don't want to explicitly use -x
compiler option.