📄 propgrid.h
字号:
non-categorized data storage right away. IMPORTANT NOTE: If you do plan not
switching to non-categoric mode, or if you don't plan to use categories at
all, then using this style will result in waste of resources.
*/
#define wxPG_EX_INIT_NOCAT 0x00001000
/** Extended window style that sets wxPropertyGridManager toolbar to not
use flat style.
*/
#define wxPG_EX_NO_FLAT_TOOLBAR 0x00002000
/** Classic spacing uses spacing that most resembles .NET propertygrid.
*/
#define wxPG_EX_CLASSIC_SPACING 0x00004000
/** Hides alphabetic/categoric mode buttons from toolbar.
*/
#define wxPG_EX_NO_MODE_BUTTONS 0x00008000
/** Combines various styles.
*/
#define wxPG_DEFAULT_STYLE (wxNO_FULL_REPAINT_ON_RESIZE)
/** Combines various styles.
*/
#define wxPGMAN_DEFAULT_STYLE (wxNO_FULL_REPAINT_ON_RESIZE)
/** @}
*/
//
// Valid constants for wxPG_UINT_BASE attribute
// (long because of wxVariant constructor)
#define wxPG_BASE_OCT (long)8
#define wxPG_BASE_DEC (long)10
#define wxPG_BASE_HEX (long)16
#define wxPG_BASE_HEXL (long)32
//
// Valid constants for wxPG_UINT_PREFIX attribute
#define wxPG_PREFIX_NONE (long)0
#define wxPG_PREFIX_0x (long)1
#define wxPG_PREFIX_DOLLAR_SIGN (long)2
/** Flags for wxPropertyGrid::GetPropertyValues and wxPropertyGridManager::GetPropertyValues. */
#ifndef wxKEEP_STRUCTURE
# define wxKEEP_STRUCTURE 0x00000010
#endif
/** Flags for wxPropertyGrid::SetPropertyAttribute etc */
#ifndef wxRECURSE
# define wxRECURSE 0x00000020
#endif
// -----------------------------------------------------------------------
// Property priorities
#define wxPG_LOW 1
#define wxPG_HIGH 2
// -----------------------------------------------------------------------
// Misc argument flags.
#define wxPG_FULL_VALUE 0x00000001 // Get/Store full value instead of displayed value.
#define wxPG_REPORT_ERROR 0x00000002
// -----------------------------------------------------------------------
// Simple class to hold the wxPGProperty pointer.
class WXDLLIMPEXP_PG wxPGId
{
public:
inline wxPGId() { m_ptr = (wxPGProperty*) NULL; }
inline wxPGId ( wxPGProperty* ptr ) { m_ptr = ptr; }
inline wxPGId ( wxPGProperty& ref ) { m_ptr = &ref; }
~wxPGId() {}
bool IsOk () const { return ( m_ptr != NULL ); }
bool operator == (const wxPGId& other)
{
return m_ptr == other.m_ptr;
}
operator wxPGProperty* ()
{
return m_ptr;
}
wxPGProperty& GetProperty () const { return *m_ptr; }
wxPGProperty* GetPropertyPtr () const { return m_ptr; }
private:
wxPGProperty* m_ptr;
};
#define wxPGIdGen(PTR) wxPGId(PTR)
#define wxPGIdToPtr(ID) ID.GetPropertyPtr()
#define wxPGIdIsOk(ID) ID.IsOk()
// -----------------------------------------------------------------------
WXDLLIMPEXP_PG void wxPGTypeOperationFailed ( const wxPGProperty* p, const wxChar* typestr, const wxChar* op );
WXDLLIMPEXP_PG void wxPGGetFailed ( const wxPGProperty* p, const wxChar* typestr );
// -----------------------------------------------------------------------
/*
#define wxPG_CURSOR_FROM_FILE 0xFFFFFE
#define wxPG_CURSOR_FROM_RESOURCE 0xFFFFFF
*/
// -----------------------------------------------------------------------
/** @defgroup propflags wxPGProperty Flags
@{
*/
// NOTE: Do not change order of these, and if you add
// any, remember also to update gs_property_flag_to_string
// in propgrid.cpp.
/** Indicates bold font.
*/
#define wxPG_PROP_MODIFIED 0x0001
/** Disables ('greyed' text and editor does not activate) property.
*/
#define wxPG_PROP_DISABLED 0x0002
/** Hider button will hide this property.
*/
#define wxPG_PROP_HIDEABLE 0x0004
/** This property has custom paint image just in front of its value.
If property only draws custom images into a popup list, then this
flag should not be set.
*/
#define wxPG_PROP_CUSTOMIMAGE 0x0008
/** Do not create text based editor for this property (but button-triggered
dialog and choice are ok).
*/
#define wxPG_PROP_NOEDITOR 0x0010
/** Value is unspecified.
*/
#define wxPG_PROP_UNSPECIFIED 0x0020
/** Indicates the bit useable by derived properties.
*/
#define wxPG_PROP_CLASS_SPECIFIC_1 0x0040
/** Indicates the bit useable by derived properties.
*/
#define wxPG_PROP_CLASS_SPECIFIC_2 0x0080
/** @}
*/
// -----------------------------------------------------------------------
/** @defgroup attrids wxPropertyGrid Property Attribute Identifiers
wxPropertyGrid::SetPropertyAttribute accepts one of these as
attrid argument when used with one of the built-in property classes.
@{
*/
/** wxBoolProperty specific, int, default 0. When 1 sets bool property to
use checkbox instead of choice.
*/
#define wxPG_BOOL_USE_CHECKBOX 64
/** wxBoolProperty specific, int, default 0. When 1 sets bool property value
to cycle on double click (instead of showing the popup listbox).
*/
#define wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING 65
/** wxFloatProperty (and similar) specific, int, default -1. Sets the (max) precision
used when floating point value is rendered as text. The default -1 means infinite
precision.
*/
#define wxPG_FLOAT_PRECISION 66
/** wxFileProperty/wxImageFileProperty specific, wxChar*, default is detected/varies.
Sets the wildcard used in the triggered wxFileDialog. Format is the
same.
*/
#define wxPG_FILE_WILDCARD 67
/** wxFileProperty/wxImageFileProperty specific, int, default 1.
When 0, only the file name is shown (i.e. drive and directory are hidden).
*/
#define wxPG_FILE_SHOW_FULL_PATH 68
/** Define base used by a wxUIntProperty. Valid constants are
wxPG_BASE_OCT, wxPG_BASE_DEC, wxPG_BASE_HEX and wxPG_BASE_HEXL
(lowercase characters).
*/
#define wxPG_UINT_BASE 69
/** Define prefix rendered to wxUIntProperty. Accepted constants
wxPG_PREFIX_NONE, wxPG_PREFIX_0x, and wxPG_PREFIX_DOLLAR_SIGN.
<b>Note:</b> Only wxPG_PREFIX_NONE works with Decimal and Octal
numbers.
*/
#define wxPG_UINT_PREFIX 70
/** wxCustomProperty specific, wxPGEditor*. Set editor control. Editor pointer is stored
in variable named wxPGEditor_EDITORNAME. So built-in editors are at
wxPGEditor_TextCtrl, wxPGEditor_Choice, wxPGEditor_CheckBox,
wxPGEditor_TextCtrlAndButton, and wxPGEditor_ChoiceAndButton.
*/
#define wxPG_CUSTOM_EDITOR 128
/** wxCustomProperty specific, wxBitmap*. Sets a small bitmap. Value must be given as
pointer and it is then copied. If you give it wxNullBitmap, then the current
image (if any) is deleted.
*/
#define wxPG_CUSTOM_IMAGE 129
/** wxCustomProperty specific, void*. Sets callback function (of type wxPropertyGridCallback)
that is called whenever button is pressed.
*/
#define wxPG_CUSTOM_CALLBACK 130
/** wxCustomProperty specific, void*. Sets callback function (of type wxPGPaintCallback)
that is called whenever image in front of property needs to be repainted. This attribute
takes precedence over bitmap set with wxPG_CUSTOM_IMAGE, and it is only proper way
to draw images to wxCustomProperty's drop down choices list.
\remarks
Callback must handle measure calls (i.e. when rect.x < 0, set paintdata.m_drawnHeight to
height of item in question).
*/
#define wxPG_CUSTOM_PAINT_CALLBACK 131
/** wxCustomProperty specific, int, default 0. Setting to 1 makes children private, similar to other
properties with children.
\remarks
- Children must be added <b>when this attribute has value 0</b>. Otherwise
there will be an assertion failure.
*/
#define wxPG_CUSTOM_PRIVATE_CHILDREN 132
/** First attribute id that is guaranteed not to be used built-in
properties.
*/
#define wxPG_USER_ATTRIBUTE 192
/** @}
*/
// -----------------------------------------------------------------------
// Value type.
// Value type declarer, with optional declaration part (with creator function).
#define WX_PG_DECLARE_VALUE_TYPE_WITH_DECL(VALUETYPE,DECL) \
extern DECL const wxPGValueType *wxPGValueType_##VALUETYPE; \
extern DECL wxPGValueType* wxPGNewVT##VALUETYPE();
// Value type declarer (with creator function).
#define WX_PG_DECLARE_VALUE_TYPE(VALUETYPE) \
extern const wxPGValueType *wxPGValueType_##VALUETYPE; \
wxPGValueType* wxPGNewVT##VALUETYPE();
// Value type declarer, with optional declaration part.
#define WX_PG_DECLARE_VALUE_TYPE_BUILTIN_WITH_DECL(VALUETYPE,DECL) \
extern DECL const wxPGValueType *wxPGValueType_##VALUETYPE;
// Value type accessor.
#define wxPG_VALUETYPE(T) wxPGValueType_##T
// Like wxPG_VALUETYPE, but casts pointer to exact class.
#define wxPG_VALUETYPE_EXACT(T) ((wxPGValueType##VALUETYPE##Class)wxPGValueType##T)
// Declare builtin value types.
WX_PG_DECLARE_VALUE_TYPE_BUILTIN_WITH_DECL(none,WXDLLIMPEXP_PG)
WX_PG_DECLARE_VALUE_TYPE_BUILTIN_WITH_DECL(wxString,WXDLLIMPEXP_PG)
WX_PG_DECLARE_VALUE_TYPE_BUILTIN_WITH_DECL(long,WXDLLIMPEXP_PG)
WX_PG_DECLARE_VALUE_TYPE_BUILTIN_WITH_DECL(bool,WXDLLIMPEXP_PG)
WX_PG_DECLARE_VALUE_TYPE_BUILTIN_WITH_DECL(double,WXDLLIMPEXP_PG)
WX_PG_DECLARE_VALUE_TYPE_BUILTIN_WITH_DECL(void,WXDLLIMPEXP_PG)
WX_PG_DECLARE_VALUE_TYPE_BUILTIN_WITH_DECL(wxArrayString,WXDLLIMPEXP_PG)
#define WX_PG_DECLARE_VALUE_TYPE_VDC(VALUETYPE) \
wxVariantData_##VALUETYPE : public wxPGVariantDataWxObj \
{ \
DECLARE_DYNAMIC_CLASS(wxVariantData_##VALUETYPE) \
protected: \
VALUETYPE m_value; \
public: \
wxVariantData_##VALUETYPE(); \
wxVariantData_##VALUETYPE(const VALUETYPE& value); \
virtual void Copy(wxVariantData& data); \
virtual bool Eq(wxVariantData& data) const; \
virtual wxString GetType() const; \
virtual void* GetValuePtr(); \
inline const VALUETYPE& GetValue () const { return m_value; }
// Value type declarer for void* that need auto-generated .
#define WX_PG_DECLARE_VALUE_TYPE_VOIDP_WITH_DECL(VALUETYPE,DECL) \
class DECL WX_PG_DECLARE_VALUE_TYPE_VDC(VALUETYPE) \
}; \
extern DECL const wxPGValueType *wxPGValueType_##VALUETYPE;
#define WX_PG_DECLARE_VALUE_TYPE_VOIDP(VALUETYPE) \
class WX_PG_DECLARE_VALUE_TYPE_VDC(VALUETYPE) \
}; \
WX_PG_DECLARE_VALUE_TYPE(VALUETYPE)
/** \class wxPGVariantDataWxObj
\ingroup classes
\brief Identical to wxVariantDataWxObjectPtr except that it deletes the
ptr on destruction.
*/
class WXDLLIMPEXP_PG wxPGVariantDataWxObj : public wxVariantData
{
public:
#if wxUSE_STD_IOSTREAM
virtual bool Write(wxSTD ostream& str) const;
#endif
virtual bool Write(wxString& str) const;
#if wxUSE_STD_IOSTREAM
virtual bool Read(wxSTD istream& str);
#endif
virtual bool Read(wxString& str);
virtual void* GetValuePtr() = 0;
};
// -----------------------------------------------------------------------
// Editor class.
// Editor accessor.
#define wxPG_EDITOR(T) wxPGEditor_##T
// Declare editor class, with optional part.
#define WX_PG_DECLARE_EDITOR_CLASS_WITH_DECL(EDITOR,DECL) \
extern DECL wxPGEditor* wxPGEditor_##EDITOR; \
extern DECL wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
// Declare editor class.
#define WX_PG_DECLARE_EDITOR_CLASS(EDITOR) \
extern wxPGEditor* wxPGEditor_##EDITOR; \
extern wxPGEditor* wxPGConstruct##EDITOR##EditorClass();
// Declare builtin editor classes.
WX_PG_DECLARE_EDITOR_CLASS_WITH_DECL(TextCtrl,WXDLLIMPEXP_PG)
WX_PG_DECLARE_EDITOR_CLASS_WITH_DECL(Choice,WXDLLIMPEXP_PG)
WX_PG_DECLARE_EDITOR_CLASS_WITH_DECL(TextCtrlAndButton,WXDLLIMPEXP_PG)
#if wxPG_INCLUDE_CHECKBOX
WX_PG_DECLARE_EDITOR_CLASS_WITH_DECL(CheckBox,WXDLLIMPEXP_PG)
#endif
WX_PG_DECLARE_EDITOR_CLASS_WITH_DECL(ChoiceAndButton,WXDLLIMPEXP_PG)
// -----------------------------------------------------------------------
/** \class wxPGValueType
\ingroup classes
\brief wxPGValueType is base class for property value types.
*/
class WXDLLIMPEXP_PG wxPGValueType
{
public:
virtual ~wxPGValueType() = 0;
/** Returns type name. If there is wxVariantData for this type, then name should
be the same that the class uses (otherwise wxT("void*")). */
virtual const wxChar* GetTypeName() const = 0;
/** Returns custom type name. If this is base for a type, should not be overridden,
as the default implementation already does good thing and calls GetTypeName.
Otherwise, should be an unique string, such as the class name etc.
*/
virtual const wxChar* GetCustomTypeName() const;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -