};
-#ifndef SWIG
-
-
// space between vertical sides of a custom image
#define wxPG_CUSTOM_IMAGE_SPACINGY 1
DontUseCellBgCol
};
- virtual void Render( wxDC& dc,
+ /**
+ Returns @true if rendered something in the foreground (text or
+ bitmap.
+ */
+ virtual bool Render( wxDC& dc,
const wxRect& rect,
const wxPropertyGrid* propertyGrid,
wxPGProperty* property,
wxPGProperty* property,
const wxPGEditor* editor ) const;
- /** Utility to render cell bitmap and set text colour plus bg brush colour.
+ /** Utility to render cell bitmap and set text colour plus bg brush
+ colour.
- Returns image width that, for instance, can be passed to DrawText.
+ @return Returns image width, which, for instance, can be passed to
+ DrawText.
*/
int PreDrawCell( wxDC& dc,
const wxRect& rect,
const wxPGCell& cell,
int flags ) const;
+
+ /**
+ Utility to be called after drawing is done, to revert whatever
+ changes PreDrawCell() did.
+
+ @param flags
+ Same as those passed to PreDrawCell().
+ */
+ void PostDrawCell( wxDC& dc,
+ const wxPropertyGrid* propGrid,
+ const wxPGCell& cell,
+ int flags ) const;
+};
+
+
+/**
+ @class wxPGDefaultRenderer
+
+ Default cell renderer, that can handles the common
+ scenarios.
+*/
+class WXDLLIMPEXP_PROPGRID wxPGDefaultRenderer : public wxPGCellRenderer
+{
+public:
+ virtual bool Render( wxDC& dc,
+ const wxRect& rect,
+ const wxPropertyGrid* propertyGrid,
+ wxPGProperty* property,
+ int column,
+ int item,
+ int flags ) const;
+
+ virtual wxSize GetImageSize( const wxPGProperty* property,
+ int column,
+ int item ) const;
+
+protected:
};
void SetBitmap( const wxBitmap& bitmap ) { m_bitmap = bitmap; }
void SetFgCol( const wxColour& col ) { m_fgCol = col; }
void SetBgCol( const wxColour& col ) { m_bgCol = col; }
+ void SetFont( const wxFont& font ) { m_font = font; }
protected:
virtual ~wxPGCellData() { }
wxBitmap m_bitmap;
wxColour m_fgCol;
wxColour m_bgCol;
+ wxFont m_font;
// True if m_text is valid and specified
bool m_hasValidText;
};
-/** @class wxPGCell
- Base class for simple wxPropertyGrid cell information.
+/**
+ @class wxPGCell
+
+ Base class for wxPropertyGrid cell information.
*/
class WXDLLIMPEXP_PROPGRID wxPGCell : public wxObject
{
return (m_refData && GetData()->m_hasValidText);
}
+ /**
+ Sets empty but valid data to this cell object.
+ */
+ void SetEmptyData();
+
/**
Merges valid data from srcCell into this.
*/
void SetText( const wxString& text );
void SetBitmap( const wxBitmap& bitmap );
void SetFgCol( const wxColour& col );
+
+ /**
+ Sets font of the cell.
+
+ @remarks Because wxPropertyGrid does not support rows of
+ different height, it makes little sense to change
+ size of the font. Therefore it is recommended
+ to use return value of wxPropertyGrid::GetFont()
+ or wxPropertyGrid::GetCaptionFont() as a basis
+ for the font that, after modifications, is passed
+ to this member function.
+ */
+ void SetFont( const wxFont& font );
+
void SetBgCol( const wxColour& col );
const wxString& GetText() const { return GetData()->m_text; }
const wxBitmap& GetBitmap() const { return GetData()->m_bitmap; }
const wxColour& GetFgCol() const { return GetData()->m_fgCol; }
+
+ /**
+ Returns font of the cell. If no specific font is set for this
+ cell, then the font will be invalid.
+ */
+ const wxFont& GetFont() const { return GetData()->m_font; }
+
const wxColour& GetBgCol() const { return GetData()->m_bgCol; }
wxPGCell& operator=( const wxPGCell& other )
return *this;
}
-protected:
+private:
virtual wxObjectRefData *CreateRefData() const
{ return new wxPGCellData(); }
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
};
-
-/** @class wxPGDefaultRenderer
-
- Default cell renderer, that can handles the common
- scenarios.
-*/
-class WXDLLIMPEXP_PROPGRID wxPGDefaultRenderer : public wxPGCellRenderer
-{
-public:
- virtual void Render( wxDC& dc,
- const wxRect& rect,
- const wxPropertyGrid* propertyGrid,
- wxPGProperty* property,
- int column,
- int item,
- int flags ) const;
-
- virtual wxSize GetImageSize( const wxPGProperty* property,
- int column,
- int item ) const;
-
-protected:
-};
-
// -----------------------------------------------------------------------
/** @class wxPGAttributeStorage
wxPGHashMapS2P m_map;
};
-#endif // !SWIG
// -----------------------------------------------------------------------
*/
wxPG_PROP_MISC_PARENT = 0x4000,
-/** Property is read-only. Editor is still created.
+/** Property is read-only. Editor is still created for wxTextCtrl-based
+ property editors. For others, editor is not usually created because
+ they do implement wxTE_READONLY style or equivalent.
*/
wxPG_PROP_READONLY = 0x8000,
// -----------------------------------------------------------------------
-#ifndef SWIG
-
/**
@section propgrid_property_attributes wxPropertyGrid Property Attribute
Identifiers.
*/
#define wxPG_ATTR_UNITS wxS("Units")
-/** Universal, string. When set, will be shown in property's value cell
- when displayed value string is empty, or value is unspecified.
+/** When set, will be shown as 'greyed' text in property's value cell when
+ the actual displayed value is blank.
+*/
+#define wxPG_ATTR_HINT wxS("Hint")
+
+#if wxPG_COMPATIBILITY_1_4
+/**
+ @deprecated Use "Hint" (wxPG_ATTR_HINT) instead.
*/
#define wxPG_ATTR_INLINE_HELP wxS("InlineHelp")
+#endif
/** Universal, wxArrayString. Set to enable auto-completion in any
wxTextCtrl-based property editor.
#define wxPG_ATTR_MAX wxPGGlobalVars->m_strMax
#undef wxPG_ATTR_UNITS
#define wxPG_ATTR_UNITS wxPGGlobalVars->m_strUnits
+#undef wxPG_ATTR_HINT
+#define wxPG_ATTR_HINT wxPGGlobalVars->m_strHint
+#if wxPG_COMPATIBILITY_1_4
#undef wxPG_ATTR_INLINE_HELP
#define wxPG_ATTR_INLINE_HELP wxPGGlobalVars->m_strInlineHelp
-
-#endif // !SWIG
+#endif
// -----------------------------------------------------------------------
-#ifndef SWIG
-
/** @class wxPGChoiceEntry
Data of a single wxPGChoices choice.
*/
#define wxPGChoicesEmptyData ((wxPGChoicesData*)NULL)
-#endif // SWIG
/** @class wxPGChoices
@param values
Values for choices. If NULL, indexes are used.
*/
- wxPGChoices( const wxChar** labels, const long* values = NULL )
+ wxPGChoices( const wxChar* const* labels, const long* values = NULL )
{
Init();
Set(labels,values);
@param values
Values for added choices. If empty, relevant entry indexes are used.
*/
- void Add( const wxChar** labels, const ValArrItem* values = NULL );
+ void Add( const wxChar* const* labels, const ValArrItem* values = NULL );
/** Version that works with wxArrayString and wxArrayInt. */
void Add( const wxArrayString& arr, const wxArrayInt& arrint = wxArrayInt() );
/** Removes count items starting at position nIndex. */
void RemoveAt(size_t nIndex, size_t count = 1);
-#ifndef SWIG
- /** Does not create copies for itself. */
- void Set( const wxChar** labels, const long* values = NULL )
+ /** Does not create copies for itself.
+ TODO: Deprecate.
+ */
+ void Set( const wxChar* const* labels, const long* values = NULL )
{
Free();
Add(labels,values);
}
-#endif // SWIG
/** Version that works with wxArrayString and wxArrayInt. */
void Set( const wxArrayString& labels,
wxArrayString GetLabels() const;
-#ifndef SWIG
void operator= (const wxPGChoices& a)
{
if (this != &a)
void Init();
void Free();
-#endif // !SWIG
};
// -----------------------------------------------------------------------
*/
virtual wxVariant DoGetValue() const { return m_value; }
-#if !defined(SWIG) || defined(CREATE_VCW)
/** Implement this function in derived class to check the value.
Return true if it is ok. Returning false prevents property change events
from occurring.
virtual bool IntToValue( wxVariant& value,
int number,
int argFlags = 0 ) const;
-#endif // !defined(SWIG) || defined(CREATE_VCW)
+
/**
Converts property value into a text representation.
*/
virtual void RefreshChildren();
- /** Special handling for attributes of this property.
+ /**
+ Reimplement this member function to add special handling for
+ attributes of this property.
- If returns false, then the attribute will be automatically stored in
- m_attributes.
+ @return Return @false to have the attribute automatically stored in
+ m_attributes. Default implementation simply does that and
+ nothing else.
- Default implementation simply returns false.
+ @remarks To actually set property attribute values from the
+ application, use wxPGProperty::SetAttribute() instead.
*/
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
return GetValueAsString(0);
}
+ /**
+ Returns property's hint text (shown in empty value cell).
+ */
+ inline wxString GetHintText() const;
+
/** Returns property grid where property lies. */
wxPropertyGrid* GetGrid() const;
@param colour
Background colour to use.
- @param recursively
- If @true, children are affected recursively, and any categories
- are not.
+ @param flags
+ Default is wxPG_RECURSE which causes colour to be set recursively.
+ Omit this flag to only set colour for the property in question
+ and not any of its children.
*/
void SetBackgroundColour( const wxColour& colour,
- bool recursively = false );
+ int flags = wxPG_RECURSE );
/**
Sets property's text colour.
@param colour
Text colour to use.
- @param recursively
- If @true, children are affected recursively, and any categories
- are not.
+ @param flags
+ Default is wxPG_RECURSE which causes colour to be set recursively.
+ Omit this flag to only set colour for the property in question
+ and not any of its children.
*/
void SetTextColour( const wxColour& colour,
- bool recursively = false );
+ int flags = wxPG_RECURSE );
/** Set default value of a property. Synonymous to
*/
void SetDefaultValue( wxVariant& value );
-#ifndef SWIG
/** Sets editor for a property.
@param editor
{
m_customEditor = editor;
}
-#endif
/** Sets editor for a property.
*/
void SetValueToUnspecified()
{
wxVariant val; // Create NULL variant
- SetValue(val);
+ SetValue(val, NULL, wxPG_SETVAL_REFRESH_EDITOR);
}
// Helper function (for wxPython bindings and such) for settings protected
return m_validator;
return DoGetValidator();
}
-#endif // #if wxUSE_VALIDATORS
+#endif // wxUSE_VALIDATORS
-#ifndef SWIG
/** Returns client data (void*) of a property.
*/
void* GetClientData() const
/** Sets managed client object of a property.
*/
wxClientData *GetClientObject() const { return m_clientObject; }
-#endif
/** Sets new set of choices for property.
*/
int GetImageOffset( int imageWidth ) const;
-#ifndef SWIG
// Returns wxPropertyGridPageState in which this property resides.
wxPropertyGridPageState* GetParentState() const { return m_parentState; }
-#endif
-#ifndef SWIG
wxPGProperty* GetItemAtY( unsigned int y,
unsigned int lh,
unsigned int* nextItemY ) const;
-#endif
/** Returns property at given virtual y coordinate.
*/
*/
wxPGProperty* GetPropertyByName( const wxString& name ) const;
-#ifndef SWIG
-
// Returns various display-related information for given column
void GetDisplayInfo( unsigned int column,
int choiceIndex,
// Called in constructors.
void Init();
void Init( const wxString& label, const wxString& name );
-#endif // #ifndef SWIG
};
// -----------------------------------------------------------------------
#define WX_PG_DECLARE_DOGETEDITORCLASS \
virtual const wxPGEditor* DoGetEditorClass() const;
-#ifndef SWIG
+#ifndef WX_PG_DECLARE_PROPERTY_CLASS
#define WX_PG_DECLARE_PROPERTY_CLASS(CLASSNAME) \
public: \
DECLARE_DYNAMIC_CLASS(CLASSNAME) \
WX_PG_DECLARE_DOGETEDITORCLASS \
private:
-#else
- #define WX_PG_DECLARE_PROPERTY_CLASS(CLASSNAME)
#endif
// Implements sans constructor function. Also, first arg is class name, not
// -----------------------------------------------------------------------
-#ifndef SWIG
-
/** @class wxPGRootProperty
@ingroup classes
Root parent property.
int GetTextExtent( const wxWindow* wnd, const wxFont& font ) const;
virtual wxString ValueToString( wxVariant& value, int argFlags ) const;
+ virtual wxString GetValueAsString( int argFlags = 0 ) const;
protected:
void SetTextColIndex( unsigned int colInd )
void Init();
};
-#endif // !SWIG
-
// -----------------------------------------------------------------------
#endif // wxUSE_PROPGRID