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.
This commit is contained in:
committed by
Vadim Zeitlin
parent
8e0799e3e5
commit
7feaa794bc
@@ -640,6 +640,8 @@ void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l
|
||||
wxALIGN_NOT,
|
||||
wxDATAVIEW_COL_REORDERABLE | wxDATAVIEW_COL_SORTABLE);
|
||||
|
||||
m_ctrl[1]->AppendDateColumn("date",
|
||||
MyListModel::Col_Date);
|
||||
m_attributes =
|
||||
new wxDataViewColumn("attributes",
|
||||
new wxDataViewTextRenderer,
|
||||
|
@@ -428,6 +428,10 @@ void MyListModel::GetValueByRow( wxVariant &variant,
|
||||
}
|
||||
break;
|
||||
|
||||
case Col_Date:
|
||||
variant = wxDateTime(1, wxDateTime::Jan, 2000).Add(wxTimeSpan(row));
|
||||
break;
|
||||
|
||||
case Col_TextWithAttr:
|
||||
{
|
||||
static const char *labels[5] =
|
||||
@@ -454,6 +458,7 @@ bool MyListModel::GetAttrByRow( unsigned int row, unsigned int col,
|
||||
switch ( col )
|
||||
{
|
||||
case Col_EditableText:
|
||||
case Col_Date:
|
||||
return false;
|
||||
|
||||
case Col_IconText:
|
||||
@@ -524,6 +529,7 @@ bool MyListModel::SetValueByRow( const wxVariant &variant,
|
||||
}
|
||||
return true;
|
||||
|
||||
case Col_Date:
|
||||
case Col_TextWithAttr:
|
||||
case Col_Custom:
|
||||
wxLogError("Cannot edit the column %d", col);
|
||||
|
@@ -194,6 +194,7 @@ public:
|
||||
{
|
||||
Col_EditableText,
|
||||
Col_IconText,
|
||||
Col_Date,
|
||||
Col_TextWithAttr,
|
||||
Col_Custom,
|
||||
Col_Max
|
||||
|
Reference in New Issue
Block a user