Implement wxDataViewChoiceByIndexRenderer for wxOSX
Add missing class implementation. Closes #17452.
This commit is contained in:
parent
9829446755
commit
c4e892629f
@ -82,6 +82,7 @@ wxOSX:
|
||||
- Remove extra borders around wxFilePickerCtrl (John Roberts).
|
||||
- Set up extensions filter correctly in wxFileDialog (nick863).
|
||||
- Turn off automatic quotes substitutions in wxTextCtrl (Xlord2).
|
||||
- Implement wxDataViewChoiceByIndexRenderer (wanup).
|
||||
|
||||
Unix:
|
||||
|
||||
|
@ -116,6 +116,25 @@ private:
|
||||
wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewChoiceRenderer);
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataViewChoiceByIndexRenderer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLIMPEXP_ADV wxDataViewChoiceByIndexRenderer: public wxDataViewChoiceRenderer
|
||||
{
|
||||
public:
|
||||
wxDataViewChoiceByIndexRenderer(const wxArrayString& choices,
|
||||
wxDataViewCellMode mode = wxDATAVIEW_CELL_EDITABLE,
|
||||
int alignment = wxDVR_DEFAULT_ALIGNMENT);
|
||||
|
||||
virtual bool SetValue(const wxVariant& value) wxOVERRIDE;
|
||||
virtual bool GetValue(wxVariant& value) const wxOVERRIDE;
|
||||
|
||||
virtual void OSXOnCellChanged(NSObject *value,
|
||||
const wxDataViewItem& item,
|
||||
unsigned col) wxOVERRIDE;
|
||||
};
|
||||
|
||||
#endif // wxOSX_USE_COCOA
|
||||
|
||||
// ---------------------------------------------------------
|
||||
|
@ -2836,6 +2836,49 @@ bool wxDataViewChoiceRenderer::MacRender()
|
||||
|
||||
wxIMPLEMENT_CLASS(wxDataViewChoiceRenderer, wxDataViewRenderer);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxDataViewChoiceByIndexRenderer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDataViewChoiceByIndexRenderer::wxDataViewChoiceByIndexRenderer(const wxArrayString& choices,
|
||||
wxDataViewCellMode mode,
|
||||
int alignment)
|
||||
: wxDataViewChoiceRenderer(choices, mode, alignment)
|
||||
{
|
||||
m_variantType = wxS("long");
|
||||
}
|
||||
|
||||
void
|
||||
wxDataViewChoiceByIndexRenderer::OSXOnCellChanged(NSObject *value,
|
||||
const wxDataViewItem& item,
|
||||
unsigned col)
|
||||
{
|
||||
wxVariant valueLong(ObjectToLong(value));
|
||||
if ( !Validate(valueLong) )
|
||||
return;
|
||||
|
||||
wxDataViewModel *model = GetOwner()->GetOwner()->GetModel();
|
||||
model->ChangeValue(valueLong, item, col);
|
||||
}
|
||||
|
||||
bool
|
||||
wxDataViewChoiceByIndexRenderer::SetValue(const wxVariant& value)
|
||||
{
|
||||
const wxVariant valueStr = GetChoice(value.GetLong());
|
||||
return wxDataViewChoiceRenderer::SetValue(valueStr);
|
||||
}
|
||||
|
||||
bool
|
||||
wxDataViewChoiceByIndexRenderer::GetValue(wxVariant& value) const
|
||||
{
|
||||
wxVariant valueStr;
|
||||
if ( !wxDataViewChoiceRenderer::GetValue(valueStr) )
|
||||
return false;
|
||||
|
||||
value = (long) GetChoices().Index(valueStr.GetString());
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// wxDataViewDateRenderer
|
||||
// ---------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user