2008-09-12 16:57:41 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/propgrid/advprops.h
|
|
|
|
// Purpose: wxPropertyGrid Advanced Properties (font, colour, etc.)
|
|
|
|
// Author: Jaakko Salli
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2004-09-25
|
|
|
|
// Copyright: (c) Jaakko Salli
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-09-12 16:57:41 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_PROPGRID_ADVPROPS_H_
|
|
|
|
#define _WX_PROPGRID_ADVPROPS_H_
|
|
|
|
|
2019-08-15 20:27:07 -04:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
2008-09-17 11:00:00 -04:00
|
|
|
#if wxUSE_PROPGRID
|
|
|
|
|
2008-09-12 16:57:41 -04:00
|
|
|
#include "wx/propgrid/props.h"
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
//
|
|
|
|
// Additional Value Type Handlers
|
|
|
|
//
|
|
|
|
bool WXDLLIMPEXP_PROPGRID
|
|
|
|
operator==(const wxArrayInt& array1, const wxArrayInt& array2);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Additional Property Editors
|
|
|
|
//
|
|
|
|
#if wxUSE_SPINBTN
|
|
|
|
WX_PG_DECLARE_EDITOR_WITH_DECL(SpinCtrl,WXDLLIMPEXP_PROPGRID)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if wxUSE_DATEPICKCTRL
|
|
|
|
WX_PG_DECLARE_EDITOR_WITH_DECL(DatePickerCtrl,WXDLLIMPEXP_PROPGRID)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
// Web colour is currently unsupported
|
|
|
|
#define wxPG_COLOUR_WEB_BASE 0x10000
|
|
|
|
//#define wxPG_TO_WEB_COLOUR(A) ((wxUint32)(A+wxPG_COLOUR_WEB_BASE))
|
|
|
|
|
|
|
|
|
|
|
|
#define wxPG_COLOUR_CUSTOM 0xFFFFFF
|
|
|
|
#define wxPG_COLOUR_UNSPECIFIED (wxPG_COLOUR_CUSTOM+1)
|
|
|
|
|
2016-07-23 17:38:39 -04:00
|
|
|
// Because text, background and other colours tend to differ between
|
|
|
|
// platforms, wxSystemColourProperty must be able to select between system
|
|
|
|
// colour and, when necessary, to pick a custom one. wxSystemColourProperty
|
|
|
|
// value makes this possible.
|
2008-09-12 16:57:41 -04:00
|
|
|
class WXDLLIMPEXP_PROPGRID wxColourPropertyValue : public wxObject
|
|
|
|
{
|
|
|
|
public:
|
2016-07-23 17:38:39 -04:00
|
|
|
// An integer value relating to the colour, and which exact
|
|
|
|
// meaning depends on the property with which it is used.
|
|
|
|
// For wxSystemColourProperty:
|
|
|
|
// Any of wxSYS_COLOUR_XXX, or any web-colour ( use wxPG_TO_WEB_COLOUR
|
|
|
|
// macro - (currently unsupported) ), or wxPG_COLOUR_CUSTOM.
|
|
|
|
//
|
|
|
|
// For custom colour properties without values array specified:
|
|
|
|
// index or wxPG_COLOUR_CUSTOM
|
|
|
|
// For custom colour properties with values array specified:
|
|
|
|
// m_arrValues[index] or wxPG_COLOUR_CUSTOM
|
2008-09-12 16:57:41 -04:00
|
|
|
wxUint32 m_type;
|
|
|
|
|
2016-07-23 17:38:39 -04:00
|
|
|
// Resulting colour. Should be correct regardless of type.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxColour m_colour;
|
|
|
|
|
|
|
|
wxColourPropertyValue()
|
2008-10-03 13:46:01 -04:00
|
|
|
: wxObject()
|
2022-05-21 16:01:58 -04:00
|
|
|
, m_type(0)
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ~wxColourPropertyValue()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
wxColourPropertyValue( const wxColourPropertyValue& v )
|
2008-10-03 13:46:01 -04:00
|
|
|
: wxObject()
|
2022-05-21 16:01:58 -04:00
|
|
|
, m_type(v.m_type)
|
2019-02-25 13:23:35 -05:00
|
|
|
, m_colour(v.m_colour)
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Init( wxUint32 type, const wxColour& colour )
|
|
|
|
{
|
|
|
|
m_type = type;
|
|
|
|
m_colour = colour;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxColourPropertyValue( const wxColour& colour )
|
2008-10-03 13:46:01 -04:00
|
|
|
: wxObject()
|
2022-05-21 16:01:58 -04:00
|
|
|
, m_type(wxPG_COLOUR_CUSTOM)
|
2019-02-25 13:23:35 -05:00
|
|
|
, m_colour(colour)
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
wxColourPropertyValue( wxUint32 type )
|
2008-10-03 13:46:01 -04:00
|
|
|
: wxObject()
|
2022-05-21 16:01:58 -04:00
|
|
|
, m_type(type)
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
wxColourPropertyValue( wxUint32 type, const wxColour& colour )
|
2008-10-03 13:46:01 -04:00
|
|
|
: wxObject()
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
|
|
|
Init( type, colour );
|
|
|
|
}
|
|
|
|
|
|
|
|
void operator=(const wxColourPropertyValue& cpv)
|
|
|
|
{
|
2008-11-16 13:03:08 -05:00
|
|
|
if (this != &cpv)
|
|
|
|
Init( cpv.m_type, cpv.m_colour );
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxColourPropertyValue);
|
2008-09-12 16:57:41 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
bool WXDLLIMPEXP_PROPGRID
|
|
|
|
operator==(const wxColourPropertyValue&, const wxColourPropertyValue&);
|
|
|
|
|
2008-09-16 11:55:53 -04:00
|
|
|
DECLARE_VARIANT_OBJECT_EXPORTED(wxColourPropertyValue, WXDLLIMPEXP_PROPGRID)
|
|
|
|
|
2008-09-12 16:57:41 -04:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2016-07-23 17:38:39 -04:00
|
|
|
// Property representing wxFont.
|
2019-07-02 14:54:25 -04:00
|
|
|
class WXDLLIMPEXP_PROPGRID wxFontProperty : public wxEditorDialogProperty
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
|
|
|
WX_PG_DECLARE_PROPERTY_CLASS(wxFontProperty)
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxFontProperty(const wxString& label = wxPG_LABEL,
|
|
|
|
const wxString& name = wxPG_LABEL,
|
|
|
|
const wxFont& value = wxFont());
|
|
|
|
virtual ~wxFontProperty();
|
2015-09-06 20:20:42 -04:00
|
|
|
virtual void OnSetValue() wxOVERRIDE;
|
|
|
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE;
|
2009-06-07 03:52:53 -04:00
|
|
|
virtual wxVariant ChildChanged( wxVariant& thisValue,
|
|
|
|
int childIndex,
|
2015-09-06 20:20:42 -04:00
|
|
|
wxVariant& childValue ) const wxOVERRIDE;
|
|
|
|
virtual void RefreshChildren() wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
protected:
|
2019-07-02 14:54:25 -04:00
|
|
|
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2016-07-23 17:38:39 -04:00
|
|
|
// If set, then match from list is searched for a custom colour.
|
2008-09-12 16:57:41 -04:00
|
|
|
#define wxPG_PROP_TRANSLATE_CUSTOM wxPG_PROP_CLASS_SPECIFIC_1
|
|
|
|
|
|
|
|
|
2016-07-23 17:38:39 -04:00
|
|
|
// Has dropdown list of wxWidgets system colours. Value used is
|
|
|
|
// of wxColourPropertyValue type.
|
2008-09-12 16:57:41 -04:00
|
|
|
class WXDLLIMPEXP_PROPGRID wxSystemColourProperty : public wxEnumProperty
|
|
|
|
{
|
|
|
|
WX_PG_DECLARE_PROPERTY_CLASS(wxSystemColourProperty)
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxSystemColourProperty( const wxString& label = wxPG_LABEL,
|
|
|
|
const wxString& name = wxPG_LABEL,
|
|
|
|
const wxColourPropertyValue&
|
|
|
|
value = wxColourPropertyValue() );
|
|
|
|
virtual ~wxSystemColourProperty();
|
|
|
|
|
2015-09-06 20:20:42 -04:00
|
|
|
virtual void OnSetValue() wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
virtual bool IntToValue(wxVariant& variant,
|
|
|
|
int number,
|
2015-09-06 20:20:42 -04:00
|
|
|
int argFlags = 0) const wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2016-07-23 17:38:39 -04:00
|
|
|
// Override in derived class to customize how colours are printed as
|
|
|
|
// strings.
|
2011-01-02 05:14:29 -05:00
|
|
|
virtual wxString ColourToString( const wxColour& col, int index,
|
|
|
|
int argFlags = 0 ) const;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2016-07-23 17:38:39 -04:00
|
|
|
// Returns index of entry that triggers colour picker dialog
|
|
|
|
// (default is last).
|
2008-09-12 16:57:41 -04:00
|
|
|
virtual int GetCustomColourIndex() const;
|
|
|
|
|
2015-09-06 20:20:42 -04:00
|
|
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE;
|
2008-09-19 13:13:51 -04:00
|
|
|
virtual bool StringToValue( wxVariant& variant,
|
|
|
|
const wxString& text,
|
2015-09-06 20:20:42 -04:00
|
|
|
int argFlags = 0 ) const wxOVERRIDE;
|
2008-09-19 13:13:51 -04:00
|
|
|
virtual bool OnEvent( wxPropertyGrid* propgrid,
|
2015-09-06 20:20:42 -04:00
|
|
|
wxWindow* primary, wxEvent& event ) wxOVERRIDE;
|
|
|
|
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) wxOVERRIDE;
|
|
|
|
virtual wxSize OnMeasureImage( int item ) const wxOVERRIDE;
|
2008-09-19 13:13:51 -04:00
|
|
|
virtual void OnCustomPaint( wxDC& dc,
|
2015-09-06 20:20:42 -04:00
|
|
|
const wxRect& rect, wxPGPaintData& paintdata ) wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
// Helper function to show the colour dialog
|
|
|
|
bool QueryColourFromUser( wxVariant& variant ) const;
|
|
|
|
|
2016-07-23 17:38:39 -04:00
|
|
|
// Default is to use wxSystemSettings::GetColour(index). Override to use
|
|
|
|
// custom colour tables etc.
|
2008-09-12 16:57:41 -04:00
|
|
|
virtual wxColour GetColour( int index ) const;
|
|
|
|
|
|
|
|
wxColourPropertyValue GetVal( const wxVariant* pVariant = NULL ) const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// Special constructors to be used by derived classes.
|
|
|
|
wxSystemColourProperty( const wxString& label, const wxString& name,
|
2014-05-17 09:41:27 -04:00
|
|
|
const char* const* labels, const long* values, wxPGChoices* choicesCache,
|
2008-09-12 16:57:41 -04:00
|
|
|
const wxColourPropertyValue& value );
|
|
|
|
wxSystemColourProperty( const wxString& label, const wxString& name,
|
2014-05-17 09:41:27 -04:00
|
|
|
const char* const* labels, const long* values, wxPGChoices* choicesCache,
|
2008-09-12 16:57:41 -04:00
|
|
|
const wxColour& value );
|
|
|
|
|
|
|
|
void Init( int type, const wxColour& colour );
|
|
|
|
|
|
|
|
// Utility functions for internal use
|
|
|
|
virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const;
|
|
|
|
wxVariant TranslateVal( wxColourPropertyValue& v ) const
|
|
|
|
{
|
|
|
|
return DoTranslateVal( v );
|
|
|
|
}
|
|
|
|
wxVariant TranslateVal( int type, const wxColour& colour ) const
|
|
|
|
{
|
|
|
|
wxColourPropertyValue v(type, colour);
|
|
|
|
return DoTranslateVal( v );
|
|
|
|
}
|
|
|
|
|
|
|
|
// Translates colour to a int value, return wxNOT_FOUND if no match.
|
|
|
|
int ColToInd( const wxColour& colour ) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2008-10-07 13:28:05 -04:00
|
|
|
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();
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2015-09-06 20:20:42 -04:00
|
|
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE;
|
|
|
|
virtual wxColour GetColour( int index ) const wxOVERRIDE;
|
2008-11-16 13:03:08 -05:00
|
|
|
|
|
|
|
protected:
|
2015-09-06 20:20:42 -04:00
|
|
|
virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const wxOVERRIDE;
|
2008-10-07 13:28:05 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
void Init( wxColour colour );
|
|
|
|
};
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2016-07-23 17:38:39 -04:00
|
|
|
// Property representing wxCursor.
|
2008-09-12 16:57:41 -04:00
|
|
|
class WXDLLIMPEXP_PROPGRID wxCursorProperty : public wxEnumProperty
|
|
|
|
{
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxCursorProperty);
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
wxCursorProperty( const wxString& label= wxPG_LABEL,
|
|
|
|
const wxString& name= wxPG_LABEL,
|
|
|
|
int value = 0 );
|
|
|
|
virtual ~wxCursorProperty();
|
|
|
|
|
2022-04-24 04:17:56 -04:00
|
|
|
virtual wxString ValueToString(wxVariant& value, int argFlags = 0) const wxOVERRIDE;
|
2015-09-06 20:20:42 -04:00
|
|
|
virtual wxSize OnMeasureImage( int item ) const wxOVERRIDE;
|
2008-09-19 13:13:51 -04:00
|
|
|
virtual void OnCustomPaint( wxDC& dc,
|
2015-09-06 20:20:42 -04:00
|
|
|
const wxRect& rect, wxPGPaintData& paintdata ) wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#if wxUSE_IMAGE
|
|
|
|
|
|
|
|
WXDLLIMPEXP_PROPGRID const wxString& wxPGGetDefaultImageWildcard();
|
2019-08-04 14:15:01 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxBitmap;
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxImage;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2016-07-23 17:38:39 -04:00
|
|
|
// Property representing image file(name).
|
2008-09-12 16:57:41 -04:00
|
|
|
class WXDLLIMPEXP_PROPGRID wxImageFileProperty : public wxFileProperty
|
|
|
|
{
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxImageFileProperty);
|
2008-09-12 16:57:41 -04:00
|
|
|
public:
|
|
|
|
|
|
|
|
wxImageFileProperty( const wxString& label= wxPG_LABEL,
|
|
|
|
const wxString& name = wxPG_LABEL,
|
|
|
|
const wxString& value = wxEmptyString);
|
|
|
|
virtual ~wxImageFileProperty();
|
|
|
|
|
2015-09-06 20:20:42 -04:00
|
|
|
virtual void OnSetValue() wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2015-09-06 20:20:42 -04:00
|
|
|
virtual wxSize OnMeasureImage( int item ) const wxOVERRIDE;
|
2008-09-19 13:13:51 -04:00
|
|
|
virtual void OnCustomPaint( wxDC& dc,
|
2015-09-06 20:20:42 -04:00
|
|
|
const wxRect& rect, wxPGPaintData& paintdata ) wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
protected:
|
2022-04-18 16:16:23 -04:00
|
|
|
void SetImage(const wxImage& img);
|
2022-04-10 07:34:03 -04:00
|
|
|
wxImage m_image; // original thumbnail area
|
2013-08-29 16:44:58 -04:00
|
|
|
|
|
|
|
private:
|
2022-04-10 07:31:14 -04:00
|
|
|
// Initialize m_image using the current file name.
|
2013-08-29 16:44:58 -04:00
|
|
|
void LoadImageFromFile();
|
2022-04-18 16:16:23 -04:00
|
|
|
|
|
|
|
wxBitmap m_bitmap; // final thumbnail area
|
2008-09-12 16:57:41 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2009-05-30 06:49:05 -04:00
|
|
|
#if wxUSE_CHOICEDLG
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2016-07-23 17:38:39 -04:00
|
|
|
// Property that manages a value resulting from wxMultiChoiceDialog. Value is
|
|
|
|
// array of strings. You can get value as array of choice values/indices by
|
|
|
|
// calling wxMultiChoiceProperty::GetValueAsArrayInt().
|
2019-07-02 14:54:25 -04:00
|
|
|
class WXDLLIMPEXP_PROPGRID wxMultiChoiceProperty : public wxEditorDialogProperty
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
|
|
|
WX_PG_DECLARE_PROPERTY_CLASS(wxMultiChoiceProperty)
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxMultiChoiceProperty( const wxString& label,
|
|
|
|
const wxString& name,
|
|
|
|
const wxArrayString& strings,
|
|
|
|
const wxArrayString& value );
|
|
|
|
wxMultiChoiceProperty( const wxString& label,
|
|
|
|
const wxString& name,
|
|
|
|
const wxPGChoices& choices,
|
|
|
|
const wxArrayString& value = wxArrayString() );
|
|
|
|
|
|
|
|
wxMultiChoiceProperty( const wxString& label = wxPG_LABEL,
|
|
|
|
const wxString& name = wxPG_LABEL,
|
|
|
|
const wxArrayString& value = wxArrayString() );
|
2010-02-10 11:45:39 -05:00
|
|
|
|
2008-09-12 16:57:41 -04:00
|
|
|
virtual ~wxMultiChoiceProperty();
|
|
|
|
|
2015-09-06 20:20:42 -04:00
|
|
|
virtual void OnSetValue() wxOVERRIDE;
|
|
|
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
virtual bool StringToValue(wxVariant& variant,
|
|
|
|
const wxString& text,
|
2015-09-06 20:20:42 -04:00
|
|
|
int argFlags = 0) const wxOVERRIDE;
|
2019-04-22 05:45:32 -04:00
|
|
|
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
wxArrayInt GetValueAsArrayInt() const
|
|
|
|
{
|
|
|
|
return m_choices.GetValuesForStrings(m_value.GetArrayString());
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
2019-07-02 14:54:25 -04:00
|
|
|
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2022-01-28 18:12:27 -05:00
|
|
|
#if WXWIN_COMPATIBILITY_3_0
|
|
|
|
wxDEPRECATED_MSG("use function GenerateValueAsString(val) returning wxString")
|
|
|
|
void GenerateValueAsString( wxVariant& value, wxString* target ) const
|
|
|
|
{
|
|
|
|
*target = GenerateValueAsString(value);
|
|
|
|
}
|
|
|
|
#endif // WXWIN_COMPATIBILITY_3_0
|
|
|
|
wxString GenerateValueAsString(const wxVariant& value) const;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
// Returns translation of values into string indices.
|
|
|
|
wxArrayInt GetValueAsIndices() const;
|
|
|
|
|
|
|
|
// Cache displayed text since generating it is relatively complicated.
|
|
|
|
wxString m_display;
|
2019-04-22 05:45:32 -04:00
|
|
|
// How to handle user strings
|
|
|
|
int m_userStringMode;
|
2008-09-12 16:57:41 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // wxUSE_CHOICEDLG
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#if wxUSE_DATETIME
|
|
|
|
|
2016-07-23 17:38:39 -04:00
|
|
|
// Property representing wxDateTime.
|
2008-09-12 16:57:41 -04:00
|
|
|
class WXDLLIMPEXP_PROPGRID wxDateProperty : public wxPGProperty
|
|
|
|
{
|
|
|
|
WX_PG_DECLARE_PROPERTY_CLASS(wxDateProperty)
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxDateProperty( const wxString& label = wxPG_LABEL,
|
|
|
|
const wxString& name = wxPG_LABEL,
|
|
|
|
const wxDateTime& value = wxDateTime() );
|
|
|
|
virtual ~wxDateProperty();
|
|
|
|
|
2015-09-06 20:20:42 -04:00
|
|
|
virtual void OnSetValue() wxOVERRIDE;
|
|
|
|
virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
virtual bool StringToValue(wxVariant& variant,
|
|
|
|
const wxString& text,
|
2015-09-06 20:20:42 -04:00
|
|
|
int argFlags = 0) const wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2015-09-06 20:20:42 -04:00
|
|
|
virtual bool DoSetAttribute( const wxString& name, wxVariant& value ) wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
void SetFormat( const wxString& format )
|
|
|
|
{
|
|
|
|
m_format = format;
|
|
|
|
}
|
|
|
|
|
|
|
|
const wxString& GetFormat() const
|
|
|
|
{
|
|
|
|
return m_format;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetDateValue( const wxDateTime& dt )
|
|
|
|
{
|
|
|
|
//m_valueDateTime = dt;
|
|
|
|
m_value = dt;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxDateTime GetDateValue() const
|
|
|
|
{
|
|
|
|
//return m_valueDateTime;
|
|
|
|
return m_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
long GetDatePickerStyle() const
|
|
|
|
{
|
|
|
|
return m_dpStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
wxString m_format;
|
|
|
|
long m_dpStyle; // DatePicker style
|
|
|
|
|
|
|
|
static wxString ms_defaultDateFormat;
|
|
|
|
static wxString DetermineDefaultDateFormat( bool showCentury );
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // wxUSE_DATETIME
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
#if wxUSE_SPINBTN
|
|
|
|
|
|
|
|
//
|
|
|
|
// Implement an editor control that allows using wxSpinCtrl (actually, a
|
|
|
|
// combination of wxTextCtrl and wxSpinButton) to edit value of wxIntProperty
|
|
|
|
// and wxFloatProperty (and similar).
|
|
|
|
//
|
|
|
|
// Note that new editor classes needs to be registered before use. This can be
|
|
|
|
// accomplished using wxPGRegisterEditorClass macro, which is used for SpinCtrl
|
|
|
|
// in wxPropertyGridInterface::RegisterAdditionalEditors (see below).
|
|
|
|
// Registration can also be performed in a constructor of a property that is
|
|
|
|
// likely to require the editor in question.
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#include "wx/spinbutt.h"
|
|
|
|
#include "wx/propgrid/editors.h"
|
|
|
|
|
|
|
|
|
|
|
|
// NOTE: Regardless that this class inherits from a working editor, it has
|
|
|
|
// all necessary methods to work independently. wxTextCtrl stuff is only
|
|
|
|
// used for event handling here.
|
|
|
|
class WXDLLIMPEXP_PROPGRID wxPGSpinCtrlEditor : public wxPGTextCtrlEditor
|
|
|
|
{
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxPGSpinCtrlEditor);
|
2008-09-12 16:57:41 -04:00
|
|
|
public:
|
|
|
|
virtual ~wxPGSpinCtrlEditor();
|
|
|
|
|
2015-09-06 20:20:42 -04:00
|
|
|
wxString GetName() const wxOVERRIDE;
|
2008-10-06 12:09:36 -04:00
|
|
|
virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
|
|
|
|
wxPGProperty* property,
|
|
|
|
const wxPoint& pos,
|
2015-09-06 20:20:42 -04:00
|
|
|
const wxSize& size) const wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property,
|
2015-09-06 20:20:42 -04:00
|
|
|
wxWindow* wnd, wxEvent& event ) const wxOVERRIDE;
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
mutable wxString m_tempString;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // wxUSE_SPINBTN
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2008-09-17 11:00:00 -04:00
|
|
|
#endif // wxUSE_PROPGRID
|
|
|
|
|
2008-09-12 16:57:41 -04:00
|
|
|
#endif // _WX_PROPGRID_ADVPROPS_H_
|