00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012 #ifndef _WX_PROPGRID_ADVPROPS_H_
00013 #define _WX_PROPGRID_ADVPROPS_H_
00014
00015 #ifdef DOXYGEN
00016 #define wxUSE_IMAGE 1
00017 #define wxUSE_CHOICEDLG 1
00018 #define wxUSE_DATETIME 1
00019 #else
00020
00021 #ifndef wxPG_INCLUDE_ADVPROPS
00022 #error "Include propgrid.h"
00023 #endif
00024
00025 #endif
00026
00027 #include "props.h"
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef SWIG
00037 bool WXDLLIMPEXP_PG operator == (const wxArrayInt& array1, const wxArrayInt& array2);
00038
00039
00040
00041
00042
00043 #if wxUSE_SPINBTN
00044 WX_PG_DECLARE_EDITOR_WITH_DECL(SpinCtrl,WXDLLIMPEXP_PG)
00045 #endif
00046
00047 #if wxUSE_DATEPICKCTRL
00048 WX_PG_DECLARE_EDITOR_WITH_DECL(DatePickerCtrl,WXDLLIMPEXP_PG)
00049 #endif
00050
00051 #endif // !SWIG
00052
00053
00054
00055
00056
00057 #define wxPG_COLOUR_WEB_BASE 0x10000
00058
00059
00060
00061 #define wxPG_COLOUR_CUSTOM 0xFFFFFF
00062 #define wxPG_COLOUR_UNSPECIFIED (wxPG_COLOUR_CUSTOM+1)
00063
00071 class WXDLLIMPEXP_PG wxColourPropertyValue : public wxObject
00072 {
00073 public:
00090 wxUint32 m_type;
00091
00093 wxColour m_colour;
00094
00095 wxColourPropertyValue()
00096 : wxObject()
00097 {
00098 m_type = 0;
00099 }
00100
00101 wxColourPropertyValue( const wxColourPropertyValue& v )
00102 : wxObject()
00103 {
00104 m_type = v.m_type;
00105 m_colour = v.m_colour;
00106 }
00107
00108 virtual ~wxColourPropertyValue()
00109 {
00110 }
00111
00112 void Init( wxUint32 type, const wxColour& colour )
00113 {
00114 m_type = type;
00115 m_colour = colour;
00116 }
00117
00118 wxColourPropertyValue( const wxColour& colour )
00119 : wxObject()
00120 {
00121 m_type = wxPG_COLOUR_CUSTOM;
00122 m_colour = colour;
00123 }
00124
00125 wxColourPropertyValue( wxUint32 type )
00126 : wxObject()
00127 {
00128 m_type = type;
00129 }
00130
00131 wxColourPropertyValue( wxUint32 type, const wxColour& colour )
00132 : wxObject()
00133 {
00134 Init( type, colour );
00135 }
00136
00137 #ifndef SWIG
00138
00139 void operator= (const wxColourPropertyValue& cpv)
00140 {
00141 Init( cpv.m_type, cpv.m_colour );
00142 }
00143
00144 private:
00145 DECLARE_DYNAMIC_CLASS(wxColourPropertyValue)
00146 #endif
00147 };
00148
00149
00150 #ifndef SWIG
00151 bool WXDLLIMPEXP_PG operator == (const wxColourPropertyValue&, const wxColourPropertyValue&);
00152
00153 WX_PG_DECLARE_WXOBJECT_VARIANT_DATA(wxPGVariantDataColourPropertyValue, wxColourPropertyValue, WXDLLIMPEXP_PG)
00154 #endif
00155
00156 #ifndef SWIG
00157 #define wxPG_EMPTY_CPV (*((wxColourPropertyValue*)NULL))
00158 #define wxPG_NORMAL_FONT (*wxNORMAL_FONT)
00159 #else
00160 #define wxPG_EMPTY_CPV wxCPV_wxPG_EMPTY
00161 #define wxPG_NORMAL_FONT wxFONT_wxPG_NORMAL_FONT
00162 #endif
00163
00164
00165
00166
00167
00168 #if wxUSE_IMAGE || defined(SWIG)
00169 #include <wx/image.h>
00170 #endif
00171
00172
00173
00178 class WXDLLIMPEXP_PG wxFontProperty : public wxPGProperty
00179 {
00180 WX_PG_DECLARE_PROPERTY_CLASS(wxFontProperty)
00181 public:
00182
00183 wxFontProperty( const wxString& label = wxPG_LABEL, const wxString& name = wxPG_LABEL, const wxFont& value = wxFont() );
00184 virtual ~wxFontProperty();
00185 virtual void OnSetValue();
00186 virtual wxString GetValueAsString( int argFlags = 0 ) const;
00187
00188 WX_PG_DECLARE_EVENT_METHODS()
00189 WX_PG_DECLARE_PARENTAL_METHODS()
00190
00191
00192 protected:
00193 };
00194
00195
00196
00197
00199 #define wxPG_PROP_TRANSLATE_CUSTOM wxPG_PROP_CLASS_SPECIFIC_1
00200
00201
00207 class WXDLLIMPEXP_PG wxSystemColourProperty : public wxEnumProperty
00208 {
00209 WX_PG_DECLARE_PROPERTY_CLASS(wxSystemColourProperty)
00210 public:
00211
00212 wxSystemColourProperty( const wxString& label = wxPG_LABEL,
00213 const wxString& name = wxPG_LABEL,
00214 const wxColourPropertyValue& value = wxColourPropertyValue() );
00215 ~wxSystemColourProperty();
00216
00217 virtual void OnSetValue();
00218 virtual bool IntToValue( wxVariant& variant, int number, int argFlags = 0 ) const;
00219
00222 virtual wxString ColourToString( const wxColour& col, int index ) const;
00223
00227 virtual int GetCustomColourIndex() const;
00228
00229 WX_PG_DECLARE_BASIC_TYPE_METHODS()
00230 WX_PG_DECLARE_EVENT_METHODS()
00231 WX_PG_DECLARE_ATTRIBUTE_METHODS()
00232
00233 WX_PG_DECLARE_CUSTOM_PAINT_METHODS()
00234
00235
00236
00237
00238 bool QueryColourFromUser( wxVariant& variant ) const;
00239
00243 virtual wxColour GetColour( int index ) const;
00244
00245 wxColourPropertyValue GetVal( const wxVariant* pVariant = NULL ) const;
00246
00247 protected:
00248
00249
00250 wxSystemColourProperty( const wxString& label, const wxString& name,
00251 const wxChar** labels, const long* values, wxPGChoices* choicesCache,
00252 const wxColourPropertyValue& value );
00253 wxSystemColourProperty( const wxString& label, const wxString& name,
00254 const wxChar** labels, const long* values, wxPGChoices* choicesCache,
00255 const wxColour& value );
00256
00257 void Init( int type, const wxColour& colour );
00258
00259
00260 virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const;
00261 wxVariant TranslateVal( wxColourPropertyValue& v ) const
00262 {
00263 return DoTranslateVal( v );
00264 }
00265 wxVariant TranslateVal( int type, const wxColour& colour ) const
00266 {
00267 wxColourPropertyValue v(type, colour);
00268 return DoTranslateVal( v );
00269 }
00270
00271
00272 int ColToInd( const wxColour& colour ) const;
00273 };
00274
00275
00276
00277 WX_PG_DECLARE_CUSTOM_COLOUR_PROPERTY_USES_WXCOLOUR_WITH_DECL(wxColourProperty, class WXDLLIMPEXP_PG)
00278
00279
00280
00281
00285 class WXDLLIMPEXP_PG wxCursorProperty : public wxEnumProperty
00286 {
00287 DECLARE_DYNAMIC_CLASS(wxCursorProperty)
00288
00289 wxCursorProperty( const wxString& label= wxPG_LABEL,
00290 const wxString& name= wxPG_LABEL,
00291 int value = 0 );
00292 virtual ~wxCursorProperty();
00293
00294 WX_PG_DECLARE_CUSTOM_PAINT_METHODS()
00295
00296
00297 };
00298
00299
00300
00301 #if wxUSE_IMAGE
00302
00303 WXDLLIMPEXP_PG const wxString& wxPGGetDefaultImageWildcard();
00304
00309 class WXDLLIMPEXP_PG wxImageFileProperty : public wxFileProperty
00310 {
00311 DECLARE_DYNAMIC_CLASS(wxImageFileProperty)
00312 public:
00313
00314 wxImageFileProperty( const wxString& label= wxPG_LABEL,
00315 const wxString& name = wxPG_LABEL,
00316 const wxString& value = wxEmptyString);
00317 virtual ~wxImageFileProperty();
00318
00319 virtual void OnSetValue();
00320
00321 WX_PG_DECLARE_CUSTOM_PAINT_METHODS()
00322
00323 protected:
00324 wxBitmap* m_pBitmap;
00325 wxImage* m_pImage;
00326 };
00327
00328 #endif
00329
00330 #if wxUSE_CHOICEDLG || defined(SWIG)
00331
00345 class WXDLLIMPEXP_PG wxMultiChoiceProperty : public wxPGProperty
00346 {
00347 WX_PG_DECLARE_PROPERTY_CLASS(wxMultiChoiceProperty)
00348 public:
00349
00350 wxMultiChoiceProperty( const wxString& label,
00351 const wxString& name,
00352 const wxArrayString& strings,
00353 const wxArrayString& value );
00354 #ifndef SWIG
00355 wxMultiChoiceProperty( const wxString& label,
00356 const wxString& name,
00357 const wxPGChoices& choices,
00358 const wxArrayString& value = wxArrayString() );
00359
00360 wxMultiChoiceProperty( const wxString& label = wxPG_LABEL,
00361 const wxString& name = wxPG_LABEL,
00362 const wxArrayString& value = wxArrayString() );
00363 #endif
00364 virtual ~wxMultiChoiceProperty();
00365
00366 virtual void OnSetValue();
00367 virtual wxString GetValueAsString( int flags = 0 ) const;
00368 virtual bool StringToValue( wxVariant& variant, const wxString& text, int argFlags = 0 ) const;
00369 WX_PG_DECLARE_EVENT_METHODS()
00370
00371 virtual int GetChoiceInfo( wxPGChoiceInfo* choiceinfo );
00372
00373 wxArrayInt GetValueAsArrayInt() const
00374 {
00375 return m_choices.GetValuesForStrings(m_value.GetArrayString());
00376 }
00377
00378 protected:
00379
00380 void GenerateValueAsString();
00381
00382
00383 wxArrayInt GetValueAsIndices() const;
00384
00385 wxArrayString m_valueAsStrings;
00386
00387 wxPGChoices m_choices;
00388
00389 wxString m_display;
00390 };
00391
00392 #endif // wxUSE_CHOICEDLG
00393
00394
00395
00396 #if wxUSE_DATETIME || defined(SWIG)
00397
00408 class WXDLLIMPEXP_PG wxDateProperty : public wxPGProperty
00409 {
00410 WX_PG_DECLARE_PROPERTY_CLASS(wxDateProperty)
00411 public:
00412
00413 wxDateProperty( const wxString& label = wxPG_LABEL,
00414 const wxString& name = wxPG_LABEL,
00415 const wxDateTime& value = wxDateTime() );
00416 virtual ~wxDateProperty();
00417
00418 virtual void OnSetValue();
00419 virtual wxString GetValueAsString( int flags = 0 ) const;
00420 virtual bool StringToValue( wxVariant& variant, const wxString& text, int argFlags = 0 ) const;
00421
00422 WX_PG_DECLARE_ATTRIBUTE_METHODS()
00423
00424 void SetFormat( const wxString& format )
00425 {
00426 m_format = format;
00427 }
00428
00429 const wxString& GetFormat() const
00430 {
00431 return m_format;
00432 }
00433
00434 void SetDateValue( const wxDateTime& dt )
00435 {
00436
00437 m_value = dt;
00438 }
00439
00440 wxDateTime GetDateValue() const
00441 {
00442
00443 return m_value;
00444 }
00445
00446 long GetDatePickerStyle() const
00447 {
00448 return m_dpStyle;
00449 }
00450
00451 protected:
00452 wxString m_format;
00453 long m_dpStyle;
00454
00455 static wxString ms_defaultDateFormat;
00456 static wxString DetermineDefaultDateFormat( bool showCentury );
00457 };
00458
00459 #endif
00460
00461
00462
00463 #if wxUSE_SPINBTN
00464
00465
00466
00467
00468
00469
00470
00471
00472
00473
00474
00475
00476
00477
00478 #include <wx/spinbutt.h>
00479 #include "editors.h"
00480
00481
00482
00483
00484
00485 class WXDLLIMPEXP_PG wxPGSpinCtrlEditor : public wxPGTextCtrlEditor
00486 {
00487 WX_PG_DECLARE_EDITOR_CLASS(wxPGSpinCtrlEditor)
00488 public:
00489 virtual ~wxPGSpinCtrlEditor();
00490
00491
00492 wxPG_DECLARE_CREATECONTROLS
00493
00494 virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property,
00495 wxWindow* wnd, wxEvent& event ) const;
00496
00497 private:
00498 mutable wxString m_tempString;
00499 };
00500
00501 #endif
00502
00503
00504
00505 #endif // _WX_PROPGRID_ADVPROPS_H_