X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/939d936402b4ac38310531ed39b4fd05afe29531..726cc8697cd44a41b43257f05ca8cdd42b71a711:/include/wx/propgrid/advprops.h diff --git a/include/wx/propgrid/advprops.h b/include/wx/propgrid/advprops.h index a73c0d3c76..860b89029b 100644 --- a/include/wx/propgrid/advprops.h +++ b/include/wx/propgrid/advprops.h @@ -4,31 +4,27 @@ // Author: Jaakko Salli // Modified by: // Created: 2004-09-25 -// RCS-ID: $Id: +// RCS-ID: $Id$ // Copyright: (c) Jaakko Salli -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_PROPGRID_ADVPROPS_H_ #define _WX_PROPGRID_ADVPROPS_H_ +#include "wx/defs.h" + #if wxUSE_PROPGRID #include "wx/propgrid/props.h" // ----------------------------------------------------------------------- - // // Additional Value Type Handlers // -#ifndef SWIG -bool WXDLLIMPEXP_PROPGRID operator==(const wxFont&, const wxFont&); - bool WXDLLIMPEXP_PROPGRID operator==(const wxArrayInt& array1, const wxArrayInt& array2); -#endif - // // Additional Property Editors @@ -84,6 +80,7 @@ public: wxColour m_colour; wxColourPropertyValue() + : wxObject() { m_type = 0; } @@ -93,6 +90,7 @@ public: } wxColourPropertyValue( const wxColourPropertyValue& v ) + : wxObject() { m_type = v.m_type; m_colour = v.m_colour; @@ -105,62 +103,49 @@ public: } wxColourPropertyValue( const wxColour& colour ) + : wxObject() { m_type = wxPG_COLOUR_CUSTOM; m_colour = colour; } wxColourPropertyValue( wxUint32 type ) + : wxObject() { m_type = type; } wxColourPropertyValue( wxUint32 type, const wxColour& colour ) + : wxObject() { Init( type, colour ); } -#ifndef SWIG void operator=(const wxColourPropertyValue& cpv) { - Init( cpv.m_type, cpv.m_colour ); + if (this != &cpv) + Init( cpv.m_type, cpv.m_colour ); } private: DECLARE_DYNAMIC_CLASS(wxColourPropertyValue) -#endif }; -#ifndef SWIG bool WXDLLIMPEXP_PROPGRID operator==(const wxColourPropertyValue&, const wxColourPropertyValue&); DECLARE_VARIANT_OBJECT_EXPORTED(wxColourPropertyValue, WXDLLIMPEXP_PROPGRID) -#endif - -#ifndef SWIG - #define wxPG_EMPTY_CPV (*((wxColourPropertyValue*)NULL)) - #define wxPG_NORMAL_FONT (*wxNORMAL_FONT) -#else - #define wxPG_EMPTY_CPV wxCPV_wxPG_EMPTY - #define wxPG_NORMAL_FONT wxFONT_wxPG_NORMAL_FONT -#endif - - // ----------------------------------------------------------------------- // Declare part of custom colour property macro pairs. -#if wxUSE_IMAGE || defined(SWIG) +#if wxUSE_IMAGE #include "wx/image.h" #endif // ----------------------------------------------------------------------- -// Exclude class from wxPython bindings -#ifndef SWIG - /** @class wxFontProperty @ingroup classes Property representing wxFont. @@ -175,17 +160,17 @@ public: const wxFont& value = wxFont()); virtual ~wxFontProperty(); virtual void OnSetValue(); - virtual wxString GetValueAsString( int argFlags = 0 ) const; - - WX_PG_DECLARE_EVENT_METHODS() - WX_PG_DECLARE_PARENTAL_METHODS() - //WX_PG_DECLARE_CUSTOM_PAINT_METHODS() + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool OnEvent( wxPropertyGrid* propgrid, + wxWindow* primary, wxEvent& event ); + virtual wxVariant ChildChanged( wxVariant& thisValue, + int childIndex, + wxVariant& childValue ) const; + virtual void RefreshChildren(); protected: }; -#endif // !SWIG - // ----------------------------------------------------------------------- @@ -218,20 +203,24 @@ public: Override in derived class to customize how colours are printed as strings. */ - virtual wxString ColourToString( const wxColour& col, int index ) const; + virtual wxString ColourToString( const wxColour& col, int index, + int argFlags = 0 ) const; /** Returns index of entry that triggers colour picker dialog (default is last). */ virtual int GetCustomColourIndex() const; - WX_PG_DECLARE_BASIC_TYPE_METHODS() - WX_PG_DECLARE_EVENT_METHODS() - WX_PG_DECLARE_ATTRIBUTE_METHODS() - - WX_PG_DECLARE_CUSTOM_PAINT_METHODS() - //virtual wxSize GetImageSize( int item ) const; - //virtual wxPGCellRenderer* GetCellRenderer( int column ) const; + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const; + virtual bool OnEvent( wxPropertyGrid* propgrid, + wxWindow* primary, wxEvent& event ); + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); + virtual wxSize OnMeasureImage( int item ) const; + virtual void OnCustomPaint( wxDC& dc, + const wxRect& rect, wxPGPaintData& paintdata ); // Helper function to show the colour dialog bool QueryColourFromUser( wxVariant& variant ) const; @@ -247,10 +236,10 @@ protected: // Special constructors to be used by derived classes. wxSystemColourProperty( const wxString& label, const wxString& name, - const wxChar** labels, const long* values, wxPGChoices* choicesCache, + const wxChar* const* labels, const long* values, wxPGChoices* choicesCache, const wxColourPropertyValue& value ); wxSystemColourProperty( const wxString& label, const wxString& name, - const wxChar** labels, const long* values, wxPGChoices* choicesCache, + const wxChar* const* labels, const long* values, wxPGChoices* choicesCache, const wxColour& value ); void Init( int type, const wxColour& colour ); @@ -273,11 +262,24 @@ protected: // ----------------------------------------------------------------------- -WX_PG_DECLARE_CUSTOM_COLOUR_PROPERTY_USES_WXCOLOUR_WITH_DECL( - wxColourProperty, class WXDLLIMPEXP_PROPGRID) +class WXDLLIMPEXP_PROPGRID wxColourProperty : public wxSystemColourProperty +{ + WX_PG_DECLARE_PROPERTY_CLASS(wxColourProperty) +public: + wxColourProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxColour& value = *wxWHITE ); + virtual ~wxColourProperty(); + + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual wxColour GetColour( int index ) const; -// Exclude classes from wxPython bindings -#ifndef SWIG +protected: + virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const; + +private: + void Init( wxColour colour ); +}; // ----------------------------------------------------------------------- @@ -294,9 +296,9 @@ class WXDLLIMPEXP_PROPGRID wxCursorProperty : public wxEnumProperty int value = 0 ); virtual ~wxCursorProperty(); - WX_PG_DECLARE_CUSTOM_PAINT_METHODS() - //virtual wxSize GetImageSize( int item ) const; - //virtual wxPGCellRenderer* GetCellRenderer( int column ) const; + virtual wxSize OnMeasureImage( int item ) const; + virtual void OnCustomPaint( wxDC& dc, + const wxRect& rect, wxPGPaintData& paintdata ); }; // ----------------------------------------------------------------------- @@ -321,7 +323,9 @@ public: virtual void OnSetValue(); - WX_PG_DECLARE_CUSTOM_PAINT_METHODS() + virtual wxSize OnMeasureImage( int item ) const; + virtual void OnCustomPaint( wxDC& dc, + const wxRect& rect, wxPGPaintData& paintdata ); protected: wxBitmap* m_pBitmap; // final thumbnail area @@ -330,7 +334,7 @@ protected: #endif -#if wxUSE_CHOICEDLG || defined(SWIG) +#if wxUSE_CHOICEDLG /** @class wxMultiChoiceProperty @ingroup classes @@ -353,7 +357,6 @@ public: const wxString& name, const wxArrayString& strings, const wxArrayString& value ); -#ifndef SWIG wxMultiChoiceProperty( const wxString& label, const wxString& name, const wxPGChoices& choices, @@ -362,15 +365,16 @@ public: wxMultiChoiceProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, const wxArrayString& value = wxArrayString() ); -#endif + virtual ~wxMultiChoiceProperty(); virtual void OnSetValue(); - virtual wxString GetValueAsString( int flags = 0 ) const; + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual bool StringToValue(wxVariant& variant, const wxString& text, int argFlags = 0) const; - WX_PG_DECLARE_EVENT_METHODS() + virtual bool OnEvent( wxPropertyGrid* propgrid, + wxWindow* primary, wxEvent& event ); wxArrayInt GetValueAsArrayInt() const { @@ -379,7 +383,7 @@ public: protected: - void GenerateValueAsString(); + void GenerateValueAsString( wxVariant& value, wxString* target ) const; // Returns translation of values into string indices. wxArrayInt GetValueAsIndices() const; @@ -403,7 +407,8 @@ protected: Supported special attributes: - "DateFormat": Determines displayed date format. - "PickerStyle": Determines window style used with wxDatePickerCtrl. - Default is wxDP_DEFAULT | wxDP_SHOWCENTURY. + Default is wxDP_DEFAULT | wxDP_SHOWCENTURY. Using wxDP_ALLOWNONE + enables additional support for unspecified property value. */ class WXDLLIMPEXP_PROPGRID wxDateProperty : public wxPGProperty { @@ -415,12 +420,13 @@ public: const wxDateTime& value = wxDateTime() ); virtual ~wxDateProperty(); - virtual wxString GetValueAsString( int flags = 0 ) const; + virtual void OnSetValue(); + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; virtual bool StringToValue(wxVariant& variant, const wxString& text, int argFlags = 0) const; - WX_PG_DECLARE_ATTRIBUTE_METHODS() + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); void SetFormat( const wxString& format ) { @@ -459,8 +465,6 @@ protected: #endif // wxUSE_DATETIME -#endif // !SWIG - // ----------------------------------------------------------------------- #if wxUSE_SPINBTN @@ -487,13 +491,15 @@ protected: // used for event handling here. class WXDLLIMPEXP_PROPGRID wxPGSpinCtrlEditor : public wxPGTextCtrlEditor { - WX_PG_DECLARE_EDITOR_CLASS(wxPGSpinCtrlEditor) + DECLARE_DYNAMIC_CLASS(wxPGSpinCtrlEditor) public: virtual ~wxPGSpinCtrlEditor(); - // See below for short explanations of what these are suppposed to do. - wxPG_DECLARE_CREATECONTROLS - + wxString GetName() const; + virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid, + wxPGProperty* property, + const wxPoint& pos, + const wxSize& size) const; virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property, wxWindow* wnd, wxEvent& event ) const;