wxWindow* ctrl,
const wxPGCell& cell,
const wxPGCell& oCell,
- bool WXUNUSED(unspecified) ) const
+ bool unspecified ) const
{
// Get old editor appearance
wxTextCtrl* tc = NULL;
}
}
+ // Do not make the mistake of calling GetClassDefaultAttributes()
+ // here. It is static, while GetDefaultAttributes() is virtual
+ // and the correct one to use.
wxVisualAttributes vattrs = ctrl->GetDefaultAttributes();
// Foreground colour
}
// Also call the old SetValueToUnspecified()
- SetValueToUnspecified(property, ctrl);
+ if ( unspecified )
+ SetValueToUnspecified(property, ctrl);
}
void wxPGEditor::SetValueToUnspecified( wxPGProperty* WXUNUSED(property),
wxTextCtrl* tc )
{
// Make sure there is correct text (instead of unspecified value
- // indicator or inline help)
+ // indicator or hint text)
int flags = property->HasFlag(wxPG_PROP_READONLY) ?
0 : wxPG_EDITABLE_VALUE;
wxString correctText = property->GetValueAsString(flags);
int flags ) const
{
wxPropertyGrid* pg = GetGrid();
- pg->OnComboItemPaint( this, item, &dc, (wxRect&)rect, flags );
+
+ // Handle hint text via super class
+ if ( (flags & wxODCB_PAINTING_CONTROL) &&
+ ShouldUseHintText(flags) )
+ {
+ wxOwnerDrawnComboBox::OnDrawItem(dc, rect, item, flags);
+ }
+ else
+ {
+ pg->OnComboItemPaint( this, item, &dc, (wxRect&)rect, flags );
+ }
}
virtual wxCoord OnMeasureItem( size_t item ) const
rect.y + 1);
int renderFlags = wxPGCellRenderer::DontUseCellColours;
+ bool useCustomPaintProcedure;
+
+ // If custom image had some size, we will start from the assumption
+ // that custom paint procedure is required
+ if ( cis.x > 0 )
+ useCustomPaintProcedure = true;
+ else
+ useCustomPaintProcedure = false;
+
+ if ( flags & wxODCB_PAINTING_SELECTED )
+ renderFlags |= wxPGCellRenderer::Selected;
if ( flags & wxODCB_PAINTING_CONTROL )
+ {
renderFlags |= wxPGCellRenderer::Control;
+
+ // If wxPG_PROP_CUSTOMIMAGE was set, then that means any custom
+ // image will not appear on the control row (it may be too
+ // large to fit, for instance). Also do not draw custom image
+ // if no choice was selected.
+ if ( !p->HasFlag(wxPG_PROP_CUSTOMIMAGE) || item < 0 )
+ useCustomPaintProcedure = false;
+ }
else
+ {
renderFlags |= wxPGCellRenderer::ChoicePopup;
+ }
- if ( flags & wxODCB_PAINTING_SELECTED )
- renderFlags |= wxPGCellRenderer::Selected;
+ // If not drawing a selected popup item, then give property's
+ // m_valueBitmap a chance.
+ if ( p->m_valueBitmap && item != pCb->GetSelection() )
+ useCustomPaintProcedure = false;
+ // If current choice had a bitmap set by the application, then
+ // use it instead of any custom paint procedure.
+ else if ( itemBitmap )
+ useCustomPaintProcedure = false;
- if ( cis.x > 0 && (p->HasFlag(wxPG_PROP_CUSTOMIMAGE) || !(flags & wxODCB_PAINTING_CONTROL)) &&
- ( !p->m_valueBitmap || item == pCb->GetSelection() ) &&
- ( item >= 0 || (flags & wxODCB_PAINTING_CONTROL) ) &&
- !itemBitmap
- )
+ if ( useCustomPaintProcedure )
{
pt.x += wxCC_CUSTOM_IMAGE_MARGIN1;
wxRect r(pt.x,pt.y,cis.x,cis.y);
cb->SetButtonPosition(si.y,0,wxRIGHT);
cb->SetMargins(wxPG_XBEFORETEXT-1);
- wxPGChoiceEditor_SetCustomPaintWidth( propGrid, cb, property->GetCommonValue() );
+ // Set hint text
+ cb->SetHint(property->GetHintText());
+
+ wxPGChoiceEditor_SetCustomPaintWidth( propGrid, cb,
+ property->GetCommonValue() );
if ( index >= 0 && index < (int)cb->GetCount() )
{
tc->AutoComplete(attrVal.GetArrayString());
}
+ // Set hint text
+ tc->SetHint(prop->GetHintText());
+
return tc;
}