initial commit
Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
369
libs/wxWidgets-3.3.1/interface/wx/propgrid/advprops.h
Normal file
369
libs/wxWidgets-3.3.1/interface/wx/propgrid/advprops.h
Normal file
@@ -0,0 +1,369 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: advprops.h
|
||||
// Purpose: interfaces of wxPropertyGrid Advanced Properties (font,
|
||||
// colour, etc.)
|
||||
// Author: wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
/** Web colour is currently unsupported @hideinitializer */
|
||||
constexpr wxUint32 wxPG_COLOUR_WEB_BASE = 0x10000;
|
||||
|
||||
/** @hideinitializer */
|
||||
constexpr wxUint32 wxPG_COLOUR_CUSTOM = 0xFFFFFF;
|
||||
/** @hideinitializer */
|
||||
constexpr wxUint32 wxPG_COLOUR_UNSPECIFIED = wxPG_COLOUR_CUSTOM + 1;
|
||||
|
||||
/** @class wxColourPropertyValue
|
||||
|
||||
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.
|
||||
*/
|
||||
class wxColourPropertyValue : public wxObject
|
||||
{
|
||||
public:
|
||||
/** 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 <b>with</b> values array specified:
|
||||
|
||||
m_arrValues[index] or wxPG_COLOUR_CUSTOM
|
||||
*/
|
||||
wxUint32 m_type;
|
||||
|
||||
/** Resulting colour. Should be correct regardless of type. */
|
||||
wxColour m_colour;
|
||||
|
||||
wxColourPropertyValue();
|
||||
wxColourPropertyValue( const wxColourPropertyValue& v );
|
||||
wxColourPropertyValue( const wxColour& colour );
|
||||
wxColourPropertyValue( wxUint32 type );
|
||||
wxColourPropertyValue( wxUint32 type, const wxColour& colour );
|
||||
|
||||
virtual ~wxColourPropertyValue();
|
||||
|
||||
void Init( wxUint32 type, const wxColour& colour );
|
||||
|
||||
void operator=(const wxColourPropertyValue& cpv);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** @class wxFontProperty
|
||||
@ingroup classes
|
||||
Property representing wxFont.
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_DIALOG_TITLE: Sets a specific title for the font dialog (since 3.1.3).
|
||||
*/
|
||||
class wxFontProperty : public wxEditorDialogProperty
|
||||
{
|
||||
public:
|
||||
wxFontProperty(const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
const wxFont& value = wxFont());
|
||||
virtual ~wxFontProperty();
|
||||
virtual void OnSetValue();
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual wxVariant ChildChanged( wxVariant& thisValue,
|
||||
int childIndex,
|
||||
wxVariant& childValue ) const;
|
||||
virtual void RefreshChildren();
|
||||
|
||||
protected:
|
||||
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value);
|
||||
};
|
||||
|
||||
|
||||
/** @class wxSystemColourProperty
|
||||
@ingroup classes
|
||||
Has dropdown list of wxWidgets system colours. Value used is
|
||||
of wxColourPropertyValue type.
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
::wxPG_COLOUR_ALLOW_CUSTOM, ::wxPG_COLOUR_HAS_ALPHA
|
||||
*/
|
||||
class wxSystemColourProperty : public wxEnumProperty
|
||||
{
|
||||
public:
|
||||
|
||||
wxSystemColourProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
const wxColourPropertyValue&
|
||||
value = wxColourPropertyValue() );
|
||||
virtual ~wxSystemColourProperty();
|
||||
|
||||
virtual void OnSetValue();
|
||||
virtual bool IntToValue(wxVariant& variant, int number,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
|
||||
/** Override in derived class to customize how colours are printed as
|
||||
strings.
|
||||
*/
|
||||
virtual wxString ColourToString(const wxColour& col, int index,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
|
||||
/** Returns index of entry that triggers colour picker dialog
|
||||
(default is last).
|
||||
*/
|
||||
virtual int GetCustomColourIndex() const;
|
||||
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) 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;
|
||||
|
||||
/** Default is to use wxSystemSettings::GetColour(index). Override to use
|
||||
custom colour tables etc.
|
||||
*/
|
||||
virtual wxColour GetColour( int index ) const;
|
||||
|
||||
wxColourPropertyValue GetVal( const wxVariant* pVariant = nullptr ) const;
|
||||
|
||||
protected:
|
||||
|
||||
// Special constructors to be used by derived classes.
|
||||
wxSystemColourProperty( const wxString& label, const wxString& name,
|
||||
const wxChar* const* labels, const long* values, wxPGChoices* choicesCache,
|
||||
const wxColourPropertyValue& value );
|
||||
|
||||
wxSystemColourProperty( const wxString& label, const wxString& name,
|
||||
const wxChar* const* labels, const long* values, wxPGChoices* choicesCache,
|
||||
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;
|
||||
wxVariant TranslateVal( int type, const wxColour& colour ) const;
|
||||
|
||||
// Translates colour to an int value, return wxNOT_FOUND if no match.
|
||||
int ColToInd( const wxColour& colour ) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** @class wxColourProperty
|
||||
@ingroup classes
|
||||
Allows to select a colour from the list or with colour dialog. Value used
|
||||
is of wxColourPropertyValue type.
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
::wxPG_COLOUR_ALLOW_CUSTOM, ::wxPG_COLOUR_HAS_ALPHA
|
||||
*/
|
||||
class wxColourProperty : public wxSystemColourProperty
|
||||
{
|
||||
public:
|
||||
wxColourProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
const wxColour& value = *wxWHITE );
|
||||
virtual ~wxColourProperty();
|
||||
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual wxColour GetColour( int index ) const;
|
||||
|
||||
protected:
|
||||
virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** @class wxCursorProperty
|
||||
@ingroup classes
|
||||
Property representing wxCursor.
|
||||
*/
|
||||
class wxCursorProperty : public wxEnumProperty
|
||||
{
|
||||
public:
|
||||
wxCursorProperty( const wxString& label= wxPG_LABEL,
|
||||
const wxString& name= wxPG_LABEL,
|
||||
int value = 0 );
|
||||
virtual ~wxCursorProperty();
|
||||
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual wxSize OnMeasureImage( int item ) const;
|
||||
virtual void OnCustomPaint( wxDC& dc,
|
||||
const wxRect& rect, wxPGPaintData& paintdata );
|
||||
};
|
||||
|
||||
|
||||
const wxString& wxPGGetDefaultImageWildcard();
|
||||
|
||||
/** @class wxImageFileProperty
|
||||
@ingroup classes
|
||||
Property representing image file(name).
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_DIALOG_TITLE: Sets a specific title for the file dialog (since 3.1.3).
|
||||
- ::wxPG_FILE_DIALOG_STYLE: Sets a specific wxFileDialog style for the file dialog.
|
||||
- ::wxPG_FILE_WILDCARD: Sets wildcard (see wxFileDialog for format details), "All
|
||||
files..." is default.
|
||||
- ::wxPG_FILE_SHOW_FULL_PATH: Default @true. When @false, only the file name is shown
|
||||
(i.e. drive and directory are hidden).
|
||||
- ::wxPG_FILE_SHOW_RELATIVE_PATH: If set, then the filename is shown relative to the
|
||||
given path string.
|
||||
- ::wxPG_FILE_INITIAL_PATH: Sets the initial path of where to look for files.
|
||||
*/
|
||||
class wxImageFileProperty : public wxFileProperty
|
||||
{
|
||||
public:
|
||||
|
||||
wxImageFileProperty( const wxString& label= wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
const wxString& value = wxString());
|
||||
virtual ~wxImageFileProperty();
|
||||
|
||||
virtual void OnSetValue();
|
||||
|
||||
virtual wxSize OnMeasureImage( int item ) const;
|
||||
virtual void OnCustomPaint( wxDC& dc,
|
||||
const wxRect& rect, wxPGPaintData& paintdata );
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** @class wxMultiChoiceProperty
|
||||
@ingroup classes
|
||||
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().
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_ATTR_MULTICHOICE_USERSTRINGMODE: If > 0, allow user to manually
|
||||
enter strings that are not in the list of choices. If this value is 1,
|
||||
user strings are preferably placed in front of valid choices. If value is
|
||||
2, then those strings will placed behind valid choices.
|
||||
- ::wxPG_DIALOG_TITLE: Sets a specific title for the editor dialog (since 3.1.3).
|
||||
*/
|
||||
class wxMultiChoiceProperty : public wxEditorDialogProperty
|
||||
{
|
||||
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() );
|
||||
|
||||
virtual ~wxMultiChoiceProperty();
|
||||
|
||||
virtual void OnSetValue();
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
|
||||
wxArrayInt GetValueAsArrayInt() const;
|
||||
|
||||
protected:
|
||||
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value);
|
||||
|
||||
wxString GenerateValueAsString(const wxVariant& value) const;
|
||||
|
||||
// Returns translation of values into string indices.
|
||||
wxArrayInt GetValueAsIndices() const;
|
||||
|
||||
// Cache displayed text since generating it is relatively complicated.
|
||||
wxString m_display;
|
||||
// How to handle user strings
|
||||
int m_userStringMode;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** @class wxDateProperty
|
||||
@ingroup classes
|
||||
Property representing wxDateTime.
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_DATE_FORMAT: Determines displayed date format.
|
||||
- ::wxPG_DATE_PICKER_STYLE: Determines window style used with wxDatePickerCtrl.
|
||||
Default is ::wxDP_DEFAULT | ::wxDP_SHOWCENTURY. Using ::wxDP_ALLOWNONE
|
||||
enables additional support for unspecified property value.
|
||||
*/
|
||||
class wxDateProperty : public wxPGProperty
|
||||
{
|
||||
public:
|
||||
|
||||
wxDateProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
const wxDateTime& value = wxDateTime() );
|
||||
virtual ~wxDateProperty();
|
||||
|
||||
virtual void OnSetValue();
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
|
||||
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
|
||||
|
||||
void SetFormat( const wxString& format );
|
||||
const wxString& GetFormat() const;
|
||||
|
||||
void SetDateValue( const wxDateTime& dt );
|
||||
wxDateTime GetDateValue() const;
|
||||
|
||||
long GetDatePickerStyle() const;
|
||||
|
||||
protected:
|
||||
wxString m_format;
|
||||
long m_dpStyle; // DatePicker style
|
||||
|
||||
static wxString ms_defaultDateFormat;
|
||||
static wxString DetermineDefaultDateFormat( bool showCentury );
|
||||
};
|
||||
|
||||
|
||||
|
||||
class wxPGSpinCtrlEditor : public wxPGTextCtrlEditor
|
||||
{
|
||||
public:
|
||||
virtual ~wxPGSpinCtrlEditor();
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
extern wxPGEditor* wxPGEditor_SpinCtrl;
|
||||
extern wxPGEditor* wxPGEditor_DatePickerCtrl;
|
||||
598
libs/wxWidgets-3.3.1/interface/wx/propgrid/editors.h
Normal file
598
libs/wxWidgets-3.3.1/interface/wx/propgrid/editors.h
Normal file
@@ -0,0 +1,598 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: editors.h
|
||||
// Purpose: interface of wxPropertyGrid editors
|
||||
// Author: wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxPGWindowList
|
||||
|
||||
Contains a list of editor windows returned by CreateControls.
|
||||
*/
|
||||
|
||||
class wxPGWindowList
|
||||
{
|
||||
public:
|
||||
wxPGWindowList(wxWindow* primary, wxWindow* secondary = nullptr);
|
||||
|
||||
void SetSecondary(wxWindow* secondary);
|
||||
|
||||
/** Gets window of primary editor.
|
||||
@since 3.1.4
|
||||
*/
|
||||
wxWindow* GetPrimary() const;
|
||||
/** Gets window of secondary editor.
|
||||
@since 3.1.4
|
||||
*/
|
||||
wxWindow* GetSecondary() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxPGEditor
|
||||
|
||||
Base class for custom wxPropertyGrid editors.
|
||||
|
||||
@remarks
|
||||
- Names of built-in property editors are: TextCtrl, Choice,
|
||||
ComboBox, CheckBox, TextCtrlAndButton, and ChoiceAndButton. Additional
|
||||
editors include SpinCtrl and DatePickerCtrl, but using them requires
|
||||
calling wxPropertyGrid::RegisterAdditionalEditors() prior use.
|
||||
|
||||
- Pointer to built-in editor is available as wxPGEditor_EditorName
|
||||
(e.g. wxPGEditor_TextCtrl).
|
||||
|
||||
- Before you start using new editor you just created, you need to register
|
||||
it using static function
|
||||
wxPropertyGrid::RegisterEditorClass(), with code like this:
|
||||
@code
|
||||
wxPGEditor* editorPointer = wxPropertyGrid::RegisterEditorClass(new MyEditorClass(), "MyEditor");
|
||||
@endcode
|
||||
After that, wxPropertyGrid will take ownership of the given object, but
|
||||
you should still store editorPointer somewhere, so you can pass it to
|
||||
wxPGProperty::SetEditor(), or return it from wxPGEditor::DoGetEditorClass().
|
||||
|
||||
@library{wxpropgrid}
|
||||
@category{propgrid}
|
||||
*/
|
||||
class wxPGEditor : public wxObject
|
||||
{
|
||||
public:
|
||||
|
||||
/** Constructor. */
|
||||
wxPGEditor();
|
||||
|
||||
/** Destructor. */
|
||||
virtual ~wxPGEditor();
|
||||
|
||||
/**
|
||||
Returns pointer to the name of the editor. For example,
|
||||
wxPGEditor_TextCtrl has name "TextCtrl". If you don't need to access
|
||||
your custom editor by string name, then you do not need to implement
|
||||
this function.
|
||||
*/
|
||||
virtual wxString GetName() const;
|
||||
|
||||
/**
|
||||
Instantiates editor controls.
|
||||
|
||||
@param propgrid
|
||||
wxPropertyGrid to which the property belongs (use as parent for control).
|
||||
|
||||
@param property
|
||||
Property for which this method is called.
|
||||
|
||||
@param pos
|
||||
Position, inside wxPropertyGrid, to create control(s) to.
|
||||
|
||||
@param size
|
||||
Initial size for control(s).
|
||||
|
||||
@remarks
|
||||
- It is not necessary to call wxEvtHandler::Bind() for interesting
|
||||
editor events. All events from controls are automatically
|
||||
forwarded to wxPGEditor::OnEvent() and wxPGProperty::OnEvent().
|
||||
*/
|
||||
virtual wxPGWindowList CreateControls( wxPropertyGrid* propgrid,
|
||||
wxPGProperty* property,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size ) const = 0;
|
||||
|
||||
/** Loads value from property to the control. */
|
||||
virtual void UpdateControl( wxPGProperty* property, wxWindow* ctrl ) const = 0;
|
||||
|
||||
/**
|
||||
Draws value for given property.
|
||||
*/
|
||||
virtual void DrawValue( wxDC& dc, const wxRect& rect,
|
||||
wxPGProperty* property, const wxString& text ) const;
|
||||
|
||||
/**
|
||||
Handles events. Returns @true if value in control was modified
|
||||
(see wxPGProperty::OnEvent() for more information).
|
||||
|
||||
@remarks wxPropertyGrid will automatically unfocus the editor when
|
||||
@c wxEVT_TEXT_ENTER is received and when it results in
|
||||
property value being modified. This happens regardless of
|
||||
editor type (i.e. behaviour is same for any wxTextCtrl and
|
||||
wxComboBox based editor).
|
||||
*/
|
||||
virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property,
|
||||
wxWindow* wnd_primary, wxEvent& event ) const = 0;
|
||||
|
||||
/**
|
||||
Returns value from control, via parameter @a variant.
|
||||
Usually ends up calling property's StringToValue() or IntToValue().
|
||||
Returns @true if value was different.
|
||||
*/
|
||||
virtual bool GetValueFromControl( wxVariant& variant, wxPGProperty* property,
|
||||
wxWindow* ctrl ) const;
|
||||
|
||||
/** Sets value in control to unspecified. */
|
||||
virtual void SetValueToUnspecified( wxPGProperty* property,
|
||||
wxWindow* ctrl ) const;
|
||||
|
||||
/**
|
||||
Called by property grid to set new appearance for the control.
|
||||
Default implementation sets foreground colour, background colour,
|
||||
font, plus text for wxTextCtrl and wxComboCtrl.
|
||||
|
||||
@param pg
|
||||
Property grid to which the edited property belongs.
|
||||
|
||||
@param property
|
||||
Edited property to which the editor control belongs.
|
||||
|
||||
@param ctrl
|
||||
Editor control.
|
||||
|
||||
@param appearance
|
||||
New appearance to be applied.
|
||||
|
||||
@param oldAppearance
|
||||
Previously applied appearance. Used to detect which control
|
||||
attributes need to be changed (e.g. so we only change background
|
||||
colour if really needed).
|
||||
|
||||
@param unspecified
|
||||
If @true tells this function that the new appearance represents
|
||||
an unspecified property value.
|
||||
*/
|
||||
virtual void SetControlAppearance( wxPropertyGrid* pg,
|
||||
wxPGProperty* property,
|
||||
wxWindow* ctrl,
|
||||
const wxPGCell& appearance,
|
||||
const wxPGCell& oldAppearance,
|
||||
bool unspecified ) const;
|
||||
|
||||
/** Sets control's value specifically from string. */
|
||||
virtual void SetControlStringValue( wxPGProperty* property,
|
||||
wxWindow* ctrl, const wxString& txt ) const;
|
||||
|
||||
/** Sets control's value specifically from int (applies to choice etc.). */
|
||||
virtual void SetControlIntValue( wxPGProperty* property,
|
||||
wxWindow* ctrl, int value ) const;
|
||||
|
||||
/**
|
||||
Inserts item to existing control. Index -1 means end of list.
|
||||
Default implementation does nothing. Returns index of item added.
|
||||
*/
|
||||
virtual int InsertItem( wxWindow* ctrl, const wxString& label, int index ) const;
|
||||
|
||||
/**
|
||||
Deletes item from existing control.
|
||||
Default implementation does nothing.
|
||||
*/
|
||||
virtual void DeleteItem( wxWindow* ctrl, int index ) const;
|
||||
|
||||
/**
|
||||
Extra processing when control gains focus.
|
||||
For example, wxTextCtrl based controls should select all text.
|
||||
*/
|
||||
virtual void OnFocus( wxPGProperty* property, wxWindow* wnd ) const;
|
||||
|
||||
/**
|
||||
Returns @true if control itself can contain the custom image.
|
||||
Default implementation returns @false.
|
||||
*/
|
||||
virtual bool CanContainCustomImage() const;
|
||||
|
||||
//
|
||||
// This member is public so scripting language bindings
|
||||
// wrapper code can access it freely.
|
||||
void* m_clientData;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class wxPGTextCtrlEditor : public wxPGEditor
|
||||
{
|
||||
public:
|
||||
wxPGTextCtrlEditor();
|
||||
virtual ~wxPGTextCtrlEditor();
|
||||
|
||||
virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
|
||||
wxPGProperty* property,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size) const;
|
||||
virtual void UpdateControl( wxPGProperty* property,
|
||||
wxWindow* ctrl ) const;
|
||||
virtual bool OnEvent( wxPropertyGrid* propgrid,
|
||||
wxPGProperty* property,
|
||||
wxWindow* primaryCtrl,
|
||||
wxEvent& event ) const;
|
||||
virtual bool GetValueFromControl( wxVariant& variant,
|
||||
wxPGProperty* property,
|
||||
wxWindow* ctrl ) const;
|
||||
|
||||
virtual wxString GetName() const;
|
||||
|
||||
virtual void SetControlStringValue( wxPGProperty* property,
|
||||
wxWindow* ctrl,
|
||||
const wxString& txt ) const;
|
||||
virtual void OnFocus( wxPGProperty* property, wxWindow* wnd ) const;
|
||||
|
||||
static bool OnTextCtrlEvent( wxPropertyGrid* propgrid,
|
||||
wxPGProperty* property,
|
||||
wxWindow* ctrl,
|
||||
wxEvent& event );
|
||||
|
||||
static bool GetTextCtrlValueFromControl( wxVariant& variant,
|
||||
wxPGProperty* property,
|
||||
wxWindow* ctrl );
|
||||
};
|
||||
|
||||
|
||||
class wxPGChoiceEditor : public wxPGEditor
|
||||
{
|
||||
public:
|
||||
wxPGChoiceEditor();
|
||||
virtual ~wxPGChoiceEditor();
|
||||
|
||||
virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
|
||||
wxPGProperty* property,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size) const;
|
||||
virtual void UpdateControl( wxPGProperty* property,
|
||||
wxWindow* ctrl ) const;
|
||||
virtual bool OnEvent( wxPropertyGrid* propgrid,
|
||||
wxPGProperty* property,
|
||||
wxWindow* primaryCtrl,
|
||||
wxEvent& event ) const;
|
||||
virtual bool GetValueFromControl( wxVariant& variant,
|
||||
wxPGProperty* property,
|
||||
wxWindow* ctrl ) const;
|
||||
virtual void SetValueToUnspecified( wxPGProperty* property,
|
||||
wxWindow* ctrl ) const;
|
||||
virtual wxString GetName() const;
|
||||
|
||||
virtual void SetControlIntValue( wxPGProperty* property,
|
||||
wxWindow* ctrl,
|
||||
int value ) const;
|
||||
virtual void SetControlStringValue( wxPGProperty* property,
|
||||
wxWindow* ctrl,
|
||||
const wxString& txt ) const;
|
||||
|
||||
virtual int InsertItem( wxWindow* ctrl,
|
||||
const wxString& label,
|
||||
int index ) const;
|
||||
virtual void DeleteItem( wxWindow* ctrl, int index ) const;
|
||||
virtual bool CanContainCustomImage() const;
|
||||
|
||||
wxWindow* CreateControlsBase( wxPropertyGrid* propgrid,
|
||||
wxPGProperty* property,
|
||||
const wxPoint& pos,
|
||||
const wxSize& sz,
|
||||
long extraStyle ) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class wxPGComboBoxEditor : public wxPGChoiceEditor
|
||||
{
|
||||
public:
|
||||
wxPGComboBoxEditor();
|
||||
virtual ~wxPGComboBoxEditor();
|
||||
|
||||
virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
|
||||
wxPGProperty* property,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size) const;
|
||||
|
||||
virtual wxString GetName() const;
|
||||
|
||||
virtual void UpdateControl( wxPGProperty* property, wxWindow* ctrl ) const;
|
||||
|
||||
virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property,
|
||||
wxWindow* ctrl, wxEvent& event ) const;
|
||||
|
||||
virtual bool GetValueFromControl( wxVariant& variant,
|
||||
wxPGProperty* property,
|
||||
wxWindow* ctrl ) const;
|
||||
|
||||
virtual void OnFocus( wxPGProperty* property, wxWindow* wnd ) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
class wxPGChoiceAndButtonEditor : public wxPGChoiceEditor
|
||||
{
|
||||
public:
|
||||
wxPGChoiceAndButtonEditor();
|
||||
virtual ~wxPGChoiceAndButtonEditor();
|
||||
virtual wxString GetName() const;
|
||||
|
||||
virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
|
||||
wxPGProperty* property,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size) const;
|
||||
};
|
||||
|
||||
class wxPGTextCtrlAndButtonEditor : public wxPGTextCtrlEditor
|
||||
{
|
||||
public:
|
||||
wxPGTextCtrlAndButtonEditor();
|
||||
virtual ~wxPGTextCtrlAndButtonEditor();
|
||||
virtual wxString GetName() const;
|
||||
|
||||
virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
|
||||
wxPGProperty* property,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class wxPGCheckBoxEditor : public wxPGEditor
|
||||
{
|
||||
public:
|
||||
wxPGCheckBoxEditor();
|
||||
virtual ~wxPGCheckBoxEditor();
|
||||
|
||||
virtual wxString GetName() const;
|
||||
virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid,
|
||||
wxPGProperty* property,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size) const;
|
||||
virtual void UpdateControl( wxPGProperty* property,
|
||||
wxWindow* ctrl ) const;
|
||||
virtual bool OnEvent( wxPropertyGrid* propgrid,
|
||||
wxPGProperty* property,
|
||||
wxWindow* primaryCtrl,
|
||||
wxEvent& event ) const;
|
||||
virtual bool GetValueFromControl( wxVariant& variant,
|
||||
wxPGProperty* property,
|
||||
wxWindow* ctrl ) const;
|
||||
virtual void SetValueToUnspecified( wxPGProperty* property,
|
||||
wxWindow* ctrl ) const;
|
||||
|
||||
virtual void DrawValue( wxDC& dc,
|
||||
const wxRect& rect,
|
||||
wxPGProperty* property,
|
||||
const wxString& text ) const;
|
||||
|
||||
virtual void SetControlIntValue( wxPGProperty* property,
|
||||
wxWindow* ctrl,
|
||||
int value ) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxPGEditorDialogAdapter
|
||||
|
||||
Derive a class from this to adapt an existing editor dialog or function to
|
||||
be used when editor button of a property is pushed.
|
||||
|
||||
You only need to derive class and implement DoShowDialog() to create and
|
||||
show the dialog, and finally submit the value returned by the dialog
|
||||
via SetValue().
|
||||
|
||||
@library{wxpropgrid}
|
||||
@category{propgrid}
|
||||
*/
|
||||
class wxPGEditorDialogAdapter : public wxObject
|
||||
{
|
||||
public:
|
||||
wxPGEditorDialogAdapter();
|
||||
virtual ~wxPGEditorDialogAdapter();
|
||||
|
||||
bool ShowDialog( wxPropertyGrid* propGrid, wxPGProperty* property );
|
||||
|
||||
virtual bool DoShowDialog( wxPropertyGrid* propGrid,
|
||||
wxPGProperty* property ) = 0;
|
||||
|
||||
void SetValue( wxVariant value );
|
||||
|
||||
/**
|
||||
This method is typically only used if deriving class from existing
|
||||
adapter with value conversion purposes.
|
||||
*/
|
||||
wxVariant& GetValue() { return m_value; }
|
||||
|
||||
//
|
||||
// This member is public so scripting language bindings
|
||||
// wrapper code can access it freely.
|
||||
void* m_clientData;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxPGMultiButton
|
||||
|
||||
This class can be used to have multiple buttons in a property editor.
|
||||
You will need to create a new property editor class, override CreateControls,
|
||||
and have it return wxPGMultiButton instance in wxPGWindowList::SetSecondary().
|
||||
|
||||
For instance, here we add three buttons to a TextCtrl editor:
|
||||
|
||||
@code
|
||||
#include <wx/propgrid/editors.h>
|
||||
|
||||
class wxSampleMultiButtonEditor : public wxPGTextCtrlEditor
|
||||
{
|
||||
wxDECLARE_DYNAMIC_CLASS(wxSampleMultiButtonEditor);
|
||||
|
||||
public:
|
||||
wxSampleMultiButtonEditor() = default;
|
||||
virtual ~wxSampleMultiButtonEditor() = default;
|
||||
|
||||
virtual wxString GetName() const { return "SampleMultiButtonEditor"; }
|
||||
|
||||
virtual wxPGWindowList CreateControls( wxPropertyGrid* propGrid,
|
||||
wxPGProperty* property,
|
||||
const wxPoint& pos,
|
||||
const wxSize& sz ) const;
|
||||
virtual bool OnEvent( wxPropertyGrid* propGrid,
|
||||
wxPGProperty* property,
|
||||
wxWindow* ctrl,
|
||||
wxEvent& event ) const;
|
||||
};
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxSampleMultiButtonEditor, wxPGTextCtrlEditor);
|
||||
|
||||
wxPGWindowList wxSampleMultiButtonEditor::CreateControls( wxPropertyGrid* propGrid,
|
||||
wxPGProperty* property,
|
||||
const wxPoint& pos,
|
||||
const wxSize& sz ) const
|
||||
{
|
||||
// Create and populate buttons-subwindow
|
||||
wxPGMultiButton* buttons = new wxPGMultiButton( propGrid, sz );
|
||||
|
||||
// Add two regular buttons
|
||||
buttons->Add( "..." );
|
||||
buttons->Add( "A" );
|
||||
// Add a bitmap button
|
||||
buttons->Add( wxArtProvider::GetBitmap(wxART_FOLDER) );
|
||||
|
||||
// Create the 'primary' editor control (textctrl in this case)
|
||||
wxPGWindowList wndList = wxPGTextCtrlEditor::CreateControls
|
||||
( propGrid, property, pos,
|
||||
buttons->GetPrimarySize() );
|
||||
|
||||
// Finally, move buttons-subwindow to correct position and make sure
|
||||
// returned wxPGWindowList contains our custom button list.
|
||||
buttons->Finalize(propGrid, pos);
|
||||
|
||||
wndList.SetSecondary( buttons );
|
||||
return wndList;
|
||||
}
|
||||
|
||||
bool wxSampleMultiButtonEditor::OnEvent( wxPropertyGrid* propGrid,
|
||||
wxPGProperty* property,
|
||||
wxWindow* ctrl,
|
||||
wxEvent& event ) const
|
||||
{
|
||||
if ( event.GetEventType() == wxEVT_BUTTON )
|
||||
{
|
||||
wxPGMultiButton* buttons = (wxPGMultiButton*) propGrid->GetEditorControlSecondary();
|
||||
|
||||
if ( event.GetId() == buttons->GetButtonId(0) )
|
||||
{
|
||||
// Do something when the first button is pressed
|
||||
// Return true if the action modified the value in editor.
|
||||
...
|
||||
}
|
||||
if ( event.GetId() == buttons->GetButtonId(1) )
|
||||
{
|
||||
// Do something when the second button is pressed
|
||||
...
|
||||
}
|
||||
if ( event.GetId() == buttons->GetButtonId(2) )
|
||||
{
|
||||
// Do something when the third button is pressed
|
||||
...
|
||||
}
|
||||
}
|
||||
return wxPGTextCtrlEditor::OnEvent(propGrid, property, ctrl, event);
|
||||
}
|
||||
@endcode
|
||||
|
||||
Further to use this editor, code like this can be used:
|
||||
|
||||
@code
|
||||
// Register editor class - needs only to be called once
|
||||
wxPGEditor* multiButtonEditor = new wxSampleMultiButtonEditor();
|
||||
wxPropertyGrid::RegisterEditorClass( multiButtonEditor );
|
||||
|
||||
// Insert the property that will have multiple buttons
|
||||
propGrid->Append( new wxLongStringProperty("MultipleButtons", wxPG_LABEL) );
|
||||
|
||||
// Change property to use editor created in the previous code segment
|
||||
propGrid->SetPropertyEditor( "MultipleButtons", multiButtonEditor );
|
||||
@endcode
|
||||
|
||||
@library{wxpropgrid}
|
||||
@category{propgrid}
|
||||
*/
|
||||
class WXDLLIMPEXP_PROPGRID wxPGMultiButton : public wxWindow
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxPGMultiButton( wxPropertyGrid* pg, const wxSize& sz );
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxPGMultiButton() = default;
|
||||
|
||||
/**
|
||||
Adds new button, with given label.
|
||||
*/
|
||||
void Add( const wxString& label, int id = wxID_ANY );
|
||||
|
||||
/**
|
||||
Adds new bitmap button.
|
||||
*/
|
||||
void Add( const wxBitmapBundle& bitmap, int id = wxID_ANY );
|
||||
|
||||
/**
|
||||
Call this in CreateControls() of your custom editor class
|
||||
after all buttons have been added.
|
||||
|
||||
@param propGrid
|
||||
wxPropertyGrid given in CreateControls().
|
||||
|
||||
@param pos
|
||||
wxPoint given in CreateControls().
|
||||
*/
|
||||
void Finalize( wxPropertyGrid* propGrid, const wxPoint& pos );
|
||||
|
||||
/**
|
||||
Returns pointer to one of the buttons.
|
||||
*/
|
||||
wxWindow* GetButton( unsigned int i );
|
||||
|
||||
/**
|
||||
Returns Id of one of the buttons.
|
||||
This is utility function to be used in event handlers.
|
||||
*/
|
||||
int GetButtonId( unsigned int i ) const;
|
||||
|
||||
/**
|
||||
Returns number of buttons.
|
||||
*/
|
||||
unsigned int GetCount();
|
||||
|
||||
/**
|
||||
Returns size of primary editor control, as appropriately
|
||||
reduced by number of buttons present.
|
||||
*/
|
||||
wxSize GetPrimarySize() const;
|
||||
};
|
||||
|
||||
extern wxPGEditor* wxPGEditor_TextCtrl;
|
||||
extern wxPGEditor* wxPGEditor_Choice;
|
||||
extern wxPGEditor* wxPGEditor_ComboBox;
|
||||
extern wxPGEditor* wxPGEditor_TextCtrlAndButton;
|
||||
extern wxPGEditor* wxPGEditor_CheckBox;
|
||||
extern wxPGEditor* wxPGEditor_ChoiceAndButton;
|
||||
555
libs/wxWidgets-3.3.1/interface/wx/propgrid/manager.h
Normal file
555
libs/wxWidgets-3.3.1/interface/wx/propgrid/manager.h
Normal file
@@ -0,0 +1,555 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: manager.h
|
||||
// Purpose: interface of wxPropertyGridManager
|
||||
// Author: wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxPropertyGridPage
|
||||
|
||||
Holder of property grid page information. You can subclass this and
|
||||
give instance in wxPropertyGridManager::AddPage. It inherits from
|
||||
wxEvtHandler and can be used to process events specific to this
|
||||
page (id of events will still be same as manager's). If you don't
|
||||
want to use it to process all events of the page, you need to
|
||||
return @false in the derived wxPropertyGridPage::IsHandlingAllEvents.
|
||||
|
||||
Please note that wxPropertyGridPage lacks many non-const property
|
||||
manipulation functions found in wxPropertyGridManager.
|
||||
Please use parent manager (m_manager member variable) when needed.
|
||||
|
||||
Please note that most member functions are inherited and as such not
|
||||
documented on this page. This means you will probably also want to read
|
||||
wxPropertyGridInterface class reference.
|
||||
|
||||
@section propgridpage_event_handling Event Handling
|
||||
|
||||
wxPropertyGridPage receives events emitted by its wxPropertyGridManager, but
|
||||
only those events that are specific to that page. If wxPropertyGridPage::
|
||||
IsHandlingAllEvents returns @false, then unhandled events are sent to the
|
||||
manager's parent, as usual.
|
||||
|
||||
See @ref propgrid_event_handling "wxPropertyGrid Event Handling"
|
||||
for more information.
|
||||
|
||||
@library{wxpropgrid}
|
||||
@category{propgrid}
|
||||
*/
|
||||
class wxPropertyGridPage : public wxEvtHandler,
|
||||
public wxPropertyGridInterface,
|
||||
public wxPropertyGridPageState
|
||||
{
|
||||
friend class wxPropertyGridManager;
|
||||
|
||||
public:
|
||||
wxPropertyGridPage();
|
||||
virtual ~wxPropertyGridPage();
|
||||
|
||||
/**
|
||||
Deletes all properties on page.
|
||||
*/
|
||||
virtual void Clear();
|
||||
|
||||
/**
|
||||
Reduces column sizes to minimum possible that contents are still visibly
|
||||
(naturally some margin space will be applied as well).
|
||||
|
||||
@return Returns minimum size for the page to still display everything.
|
||||
|
||||
@remarks This function only works properly if size of containing grid was
|
||||
already fairly large.
|
||||
|
||||
Note that you can also get calculated column widths by calling
|
||||
GetColumnWidth() immediately after this function returns.
|
||||
*/
|
||||
wxSize FitColumns();
|
||||
|
||||
/**
|
||||
Returns page index in manager;
|
||||
*/
|
||||
inline int GetIndex() const;
|
||||
|
||||
/**
|
||||
Returns "root property". It does not have name, etc. and it is not
|
||||
visible. It is only useful for accessing its children.
|
||||
*/
|
||||
wxPGProperty* GetRoot() const;
|
||||
|
||||
/**
|
||||
Returns x-coordinate position of splitter on a page.
|
||||
*/
|
||||
int GetSplitterPosition( int col = 0 ) const;
|
||||
|
||||
/**
|
||||
Returns pointer to contained property grid state.
|
||||
*/
|
||||
wxPropertyGridPageState* GetStatePtr();
|
||||
|
||||
/**
|
||||
Returns pointer to contained property grid state.
|
||||
*/
|
||||
const wxPropertyGridPageState* GetStatePtr() const;
|
||||
|
||||
/**
|
||||
Returns id of the tool bar item that represents this page on
|
||||
wxPropertyGridManager's wxToolBar.
|
||||
*/
|
||||
int GetToolId() const;
|
||||
|
||||
/**
|
||||
Do any member initialization in this method.
|
||||
|
||||
@remarks - Called every time the page is added into a manager.
|
||||
- You can add properties to the page here.
|
||||
*/
|
||||
virtual void Init();
|
||||
|
||||
/**
|
||||
Return @false here to indicate unhandled events should be
|
||||
propagated to manager's parent, as normal.
|
||||
*/
|
||||
virtual bool IsHandlingAllEvents() const;
|
||||
|
||||
/**
|
||||
Called every time page is about to be shown.
|
||||
Useful, for instance, creating properties just-in-time.
|
||||
*/
|
||||
virtual void OnShow();
|
||||
|
||||
/**
|
||||
Refreshes given property on page.
|
||||
*/
|
||||
virtual void RefreshProperty( wxPGProperty* p );
|
||||
|
||||
/**
|
||||
Sets splitter position on page.
|
||||
|
||||
@remarks
|
||||
Splitter position cannot exceed grid size, and therefore setting it
|
||||
during form creation may fail as initial grid size is often smaller than
|
||||
desired splitter position, especially when sizers are being used.
|
||||
*/
|
||||
void SetSplitterPosition( int splitterPos, int col = 0 );
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@class wxPropertyGridManager
|
||||
|
||||
wxPropertyGridManager is an efficient multi-page version of wxPropertyGrid,
|
||||
which can optionally have toolbar for mode and page selection, a help text
|
||||
box, and a header.
|
||||
|
||||
wxPropertyGridManager inherits from wxPropertyGridInterface, and as such
|
||||
it has most property manipulation functions. However, only some of them affect
|
||||
properties on all pages (e.g. GetPropertyByName() and ExpandAll()), while some
|
||||
(e.g. Append()) only apply to the currently selected page.
|
||||
|
||||
To operate explicitly on properties on specific page, use
|
||||
wxPropertyGridManager::GetPage() to obtain pointer to page's
|
||||
wxPropertyGridPage object.
|
||||
|
||||
Visual methods, such as SetCellBackgroundColour() are only available in
|
||||
wxPropertyGrid. Use wxPropertyGridManager::GetGrid() to obtain pointer to it.
|
||||
|
||||
Non-virtual iterators will not work in wxPropertyGridManager. Instead, you must
|
||||
acquire the internal grid (GetGrid()) or wxPropertyGridPage object (GetPage()).
|
||||
|
||||
wxPropertyGridManager constructor has exact same format as wxPropertyGrid
|
||||
constructor, and basically accepts same extra window style flags (albeit also
|
||||
has some extra ones).
|
||||
|
||||
Here's some example code for creating and populating a wxPropertyGridManager:
|
||||
|
||||
@code
|
||||
wxPropertyGridManager* pgMan = new wxPropertyGridManager(this, PGID,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
// These and other similar styles are automatically
|
||||
// passed to the embedded wxPropertyGrid.
|
||||
wxPG_BOLD_MODIFIED|wxPG_SPLITTER_AUTO_CENTER|
|
||||
// Include toolbar.
|
||||
wxPG_TOOLBAR |
|
||||
// Include description box.
|
||||
wxPG_DESCRIPTION |
|
||||
// Include compactor.
|
||||
wxPG_COMPACTOR |
|
||||
// Plus defaults.
|
||||
wxPGMAN_DEFAULT_STYLE
|
||||
);
|
||||
|
||||
wxPropertyGridPage* page;
|
||||
|
||||
page = pgMan->AddPage("First Page");
|
||||
|
||||
page->Append( new wxPropertyCategory("Category A1") );
|
||||
|
||||
page->Append( new wxIntProperty("Number",wxPG_LABEL,1) );
|
||||
|
||||
page->Append( new wxColourProperty("Colour",wxPG_LABEL,*wxWHITE) );
|
||||
|
||||
page = pgMan->AddPage("Second Page");
|
||||
|
||||
page->Append( "Text",wxPG_LABEL,"(no text)" );
|
||||
|
||||
page->Append( new wxFontProperty("Font",wxPG_LABEL) );
|
||||
|
||||
// Display a header above the grid
|
||||
pgMan->ShowHeader();
|
||||
@endcode
|
||||
|
||||
@section propgridmanager_window_styles_ Window Styles
|
||||
|
||||
See @ref propgrid_window_styles.
|
||||
|
||||
@section propgridmanager_event_handling Event Handling
|
||||
|
||||
See @ref propgrid_event_handling "wxPropertyGrid Event Handling"
|
||||
for more information.
|
||||
|
||||
@library{wxpropgrid}
|
||||
@category{propgrid}
|
||||
*/
|
||||
class wxPropertyGridManager : public wxPanel, public wxPropertyGridInterface
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Two step constructor.
|
||||
Call Create when this constructor is called to build up the
|
||||
wxPropertyGridManager.
|
||||
*/
|
||||
wxPropertyGridManager();
|
||||
|
||||
/**
|
||||
The default constructor. The styles to be used are styles valid for
|
||||
the wxWindow.
|
||||
@see @ref propgrid_window_styles
|
||||
*/
|
||||
wxPropertyGridManager( wxWindow *parent, wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxPGMAN_DEFAULT_STYLE,
|
||||
const wxString& name = wxPropertyGridManagerNameStr );
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxPropertyGridManager();
|
||||
|
||||
/**
|
||||
Creates new property page. Note that the first page is not created
|
||||
automatically.
|
||||
|
||||
@param label
|
||||
A label for the page. This may be shown as a toolbar tooltip etc.
|
||||
|
||||
@param bmp
|
||||
Bitmap bundle for toolbar image. If the bundle is empty, then
|
||||
a built-in default bitmap bundle is used.
|
||||
|
||||
@param pageObj
|
||||
wxPropertyGridPage instance. Manager will take ownership of this
|
||||
object. @NULL indicates that a default page instance should be created.
|
||||
|
||||
@return Returns pointer to created property grid page.
|
||||
|
||||
@remarks If toolbar is used, it is highly recommended that the pages are
|
||||
added when the toolbar is not turned off using window style flag
|
||||
switching. Otherwise toolbar buttons might not be added properly.
|
||||
*/
|
||||
wxPropertyGridPage* AddPage( const wxString& label = wxString(),
|
||||
const wxBitmapBundle& bmp = wxBitmapBundle(),
|
||||
wxPropertyGridPage* pageObj = nullptr );
|
||||
|
||||
/**
|
||||
Deletes all properties and all pages.
|
||||
*/
|
||||
virtual void Clear();
|
||||
|
||||
/**
|
||||
Deletes all properties on given page.
|
||||
*/
|
||||
void ClearPage( int page );
|
||||
|
||||
/**
|
||||
Forces updating the value of property from the editor control.
|
||||
|
||||
@return Returns @true if value was actually updated.
|
||||
*/
|
||||
bool CommitChangesFromEditor(wxPGSelectPropertyFlags flags = wxPGSelectPropertyFlags::Null);
|
||||
|
||||
/**
|
||||
Two step creation. Whenever the control is created without any parameters,
|
||||
use Create to actually create it. Don't access the control's public methods
|
||||
before this is called.
|
||||
|
||||
@see @ref propgrid_window_styles
|
||||
*/
|
||||
bool Create( wxWindow *parent, wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxPGMAN_DEFAULT_STYLE,
|
||||
const wxString& name = wxPropertyGridManagerNameStr );
|
||||
|
||||
/**
|
||||
Enables or disables (shows/hides) categories according to parameter enable.
|
||||
|
||||
@remarks
|
||||
Calling this may not properly update toolbar buttons.
|
||||
*/
|
||||
bool EnableCategories( bool enable );
|
||||
|
||||
/**
|
||||
Selects page, scrolls and/or expands items to ensure that the
|
||||
given item is visible.
|
||||
|
||||
@return Returns @true if something was actually done.
|
||||
*/
|
||||
bool EnsureVisible( wxPGPropArg id );
|
||||
|
||||
/**
|
||||
Returns number of columns on given page. By the default,
|
||||
returns number of columns on current page.
|
||||
*/
|
||||
int GetColumnCount( int page = -1 ) const;
|
||||
|
||||
/**
|
||||
Returns height of the description text box.
|
||||
*/
|
||||
int GetDescBoxHeight() const;
|
||||
|
||||
/**
|
||||
Returns pointer to the contained wxPropertyGrid. This does not change
|
||||
after wxPropertyGridManager has been created, so you can safely obtain
|
||||
pointer once and use it for the entire lifetime of the manager
|
||||
instance.
|
||||
*/
|
||||
wxPropertyGrid* GetGrid();
|
||||
|
||||
/**
|
||||
Similar to GetIterator(), but instead returns wxPGVIterator instance,
|
||||
which can be useful for forward-iterating through arbitrary property
|
||||
containers.
|
||||
*/
|
||||
virtual wxPGVIterator GetVIterator( int flags ) const;
|
||||
|
||||
/**
|
||||
Returns currently selected page.
|
||||
*/
|
||||
wxPropertyGridPage* GetCurrentPage() const;
|
||||
|
||||
/**
|
||||
Returns page object for given page index.
|
||||
*/
|
||||
wxPropertyGridPage* GetPage( unsigned int ind ) const;
|
||||
|
||||
/**
|
||||
Returns page object for given page name.
|
||||
*/
|
||||
wxPropertyGridPage* GetPage( const wxString& name ) const;
|
||||
|
||||
/**
|
||||
Returns index for a page name. If no match is found, wxNOT_FOUND is
|
||||
returned.
|
||||
*/
|
||||
int GetPageByName( const wxString& name ) const;
|
||||
|
||||
/**
|
||||
Returns index for a relevant property grid state.
|
||||
If no match is found, wxNOT_FOUND is returned.
|
||||
*/
|
||||
int GetPageByState( const wxPropertyGridPageState* pstate ) const;
|
||||
|
||||
/**
|
||||
Returns number of managed pages.
|
||||
*/
|
||||
size_t GetPageCount() const;
|
||||
|
||||
/**
|
||||
Returns name of given page.
|
||||
*/
|
||||
const wxString& GetPageName( int index ) const;
|
||||
|
||||
/**
|
||||
Returns "root property" of the given page. It does not have name, etc.
|
||||
and it is not visible. It is only useful for accessing its children.
|
||||
*/
|
||||
wxPGProperty* GetPageRoot( int index ) const;
|
||||
|
||||
/** Returns index to currently selected page. */
|
||||
int GetSelectedPage() const;
|
||||
|
||||
/** Alias for GetSelection(). */
|
||||
wxPGProperty* GetSelectedProperty() const;
|
||||
|
||||
/** Shortcut for GetGrid()->GetSelection(). */
|
||||
wxPGProperty* GetSelection() const;
|
||||
|
||||
/**
|
||||
Returns a pointer to the toolbar currently associated with the
|
||||
wxPropertyGridManager (if any).
|
||||
*/
|
||||
wxToolBar* GetToolBar() const;
|
||||
|
||||
/**
|
||||
Creates new property page. Note that the first page is not created
|
||||
automatically.
|
||||
|
||||
@param index
|
||||
Add to this position. -1 will add as the last item.
|
||||
|
||||
@param label
|
||||
A label for the page. This may be shown as a toolbar tooltip etc.
|
||||
|
||||
@param bmp
|
||||
Bitmap bundle for toolbar image. If the bundle is empty, then
|
||||
a built-in default bitmap bundle is used.
|
||||
|
||||
@param pageObj
|
||||
wxPropertyGridPage instance. Manager will take ownership of this
|
||||
object. If @NULL, default page object is constructed.
|
||||
|
||||
@return Returns pointer to created page.
|
||||
*/
|
||||
virtual wxPropertyGridPage* InsertPage( int index, const wxString& label,
|
||||
const wxBitmapBundle& bmp = wxBitmapBundle(),
|
||||
wxPropertyGridPage* pageObj = nullptr );
|
||||
|
||||
/**
|
||||
Returns @true if any property on any page has been modified by the user.
|
||||
*/
|
||||
bool IsAnyModified() const;
|
||||
|
||||
/**
|
||||
Returns @true if any property on given page has been modified by the user.
|
||||
*/
|
||||
bool IsPageModified( size_t index ) const;
|
||||
|
||||
/**
|
||||
Returns @true if property is selected. Since selection is page
|
||||
based, this function checks every page in the manager.
|
||||
*/
|
||||
virtual bool IsPropertySelected( wxPGPropArg id ) const;
|
||||
|
||||
/**
|
||||
Removes a page.
|
||||
|
||||
@return Returns @false if it was not possible to remove page in question.
|
||||
*/
|
||||
virtual bool RemovePage( int page );
|
||||
|
||||
/**
|
||||
Select and displays a given page.
|
||||
|
||||
@param index
|
||||
Index of page being selected. Can be -1 to select nothing.
|
||||
*/
|
||||
void SelectPage( int index );
|
||||
|
||||
/**
|
||||
Select and displays a given page (by label).
|
||||
*/
|
||||
void SelectPage( const wxString& label );
|
||||
|
||||
/** Select and displays a given page. */
|
||||
void SelectPage( wxPropertyGridPage* page );
|
||||
|
||||
/**
|
||||
Select a property.
|
||||
|
||||
@see wxPropertyGrid::SelectProperty(),
|
||||
wxPropertyGridInterface::ClearSelection()
|
||||
*/
|
||||
bool SelectProperty( wxPGPropArg id, bool focus = false );
|
||||
|
||||
/**
|
||||
Sets number of columns on given page (default is current page).
|
||||
|
||||
@remarks If you use header, then you should always use this
|
||||
member function to set the column count, instead of
|
||||
ones present in wxPropertyGrid or wxPropertyGridPage.
|
||||
*/
|
||||
void SetColumnCount( int colCount, int page = -1 );
|
||||
|
||||
/**
|
||||
Sets a column title. Default title for column 0 is "Property",
|
||||
and "Value" for column 1.
|
||||
|
||||
@remarks If header is not shown yet, then calling this
|
||||
member function will make it visible.
|
||||
*/
|
||||
void SetColumnTitle( int idx, const wxString& title );
|
||||
|
||||
/**
|
||||
Sets label and text in description box.
|
||||
*/
|
||||
void SetDescription( const wxString& label, const wxString& content );
|
||||
|
||||
/** Sets y coordinate of the description box splitter. */
|
||||
void SetDescBoxHeight( int ht, bool refresh = true );
|
||||
|
||||
/**
|
||||
Moves splitter as left as possible, while still allowing all
|
||||
labels to be shown in full.
|
||||
|
||||
@param subProps
|
||||
If @false, will still allow sub-properties (i.e. properties which
|
||||
parent is not root or category) to be cropped.
|
||||
|
||||
@param allPages
|
||||
If @true, takes labels on all pages into account.
|
||||
*/
|
||||
void SetSplitterLeft( bool subProps = false, bool allPages = true );
|
||||
|
||||
/** Moves splitter as left as possible on an individual page, while still allowing all
|
||||
labels to be shown in full.
|
||||
*/
|
||||
void SetPageSplitterLeft(int page, bool subProps = false);
|
||||
|
||||
/**
|
||||
Sets splitter position on individual page.
|
||||
|
||||
@remarks If you use header, then you should always use this
|
||||
member function to set the splitter position, instead of
|
||||
ones present in wxPropertyGrid or wxPropertyGridPage.
|
||||
*/
|
||||
void SetPageSplitterPosition( int page, int pos, int column = 0 );
|
||||
|
||||
/**
|
||||
Sets splitter position for all pages.
|
||||
|
||||
@remarks Splitter position cannot exceed grid size, and therefore
|
||||
setting it during form creation may fail as initial grid
|
||||
size is often smaller than desired splitter position,
|
||||
especially when sizers are being used.
|
||||
|
||||
If you use header, then you should always use this
|
||||
member function to set the splitter position, instead of
|
||||
ones present in wxPropertyGrid or wxPropertyGridPage.
|
||||
*/
|
||||
void SetSplitterPosition( int pos, int column = 0 );
|
||||
|
||||
/**
|
||||
Show or hide the property grid header control. It is hidden
|
||||
by the default.
|
||||
|
||||
@remarks Grid may look better if you use ::wxPG_NO_INTERNAL_BORDER
|
||||
window style when showing a header.
|
||||
*/
|
||||
void ShowHeader(bool show = true);
|
||||
|
||||
protected:
|
||||
|
||||
//
|
||||
// Subclassing helpers
|
||||
//
|
||||
|
||||
/**
|
||||
Creates property grid for the manager. Reimplement in derived class to
|
||||
use subclassed wxPropertyGrid. However, if you do this then you
|
||||
must also use the two-step construction (i.e. default constructor and
|
||||
Create() instead of constructor with arguments) when creating the
|
||||
manager.
|
||||
*/
|
||||
virtual wxPropertyGrid* CreatePropertyGrid() const;
|
||||
};
|
||||
2950
libs/wxWidgets-3.3.1/interface/wx/propgrid/property.h
Normal file
2950
libs/wxWidgets-3.3.1/interface/wx/propgrid/property.h
Normal file
File diff suppressed because it is too large
Load Diff
1586
libs/wxWidgets-3.3.1/interface/wx/propgrid/propgrid.h
Normal file
1586
libs/wxWidgets-3.3.1/interface/wx/propgrid/propgrid.h
Normal file
File diff suppressed because it is too large
Load Diff
220
libs/wxWidgets-3.3.1/interface/wx/propgrid/propgriddefs.h
Normal file
220
libs/wxWidgets-3.3.1/interface/wx/propgrid/propgriddefs.h
Normal file
@@ -0,0 +1,220 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: propgriddefs.h
|
||||
// Purpose: various constants, etc. used in documented propgrid API
|
||||
// Author: wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** Used to tell wxPGProperty to use label as name as well
|
||||
@hideinitializer
|
||||
*/
|
||||
#define wxPG_LABEL (*wxPGProperty::sm_labelItem)
|
||||
|
||||
/** Convert Red, Green and Blue to a single 32-bit value.
|
||||
@hideinitializer
|
||||
*/
|
||||
#define wxPG_COLOUR(R,G,B) ((wxUint32)(R+(G<<8)+(B<<16)))
|
||||
|
||||
|
||||
/** If property is supposed to have custom-painted image, then returning
|
||||
this in wxPGProperty::OnMeasureImage() will usually be enough.
|
||||
@hideinitializer
|
||||
*/
|
||||
#define wxPG_DEFAULT_IMAGE_SIZE wxDefaultSize
|
||||
|
||||
|
||||
/** This callback function is used for sorting properties.
|
||||
|
||||
Call wxPropertyGrid::SetSortFunction() to set it.
|
||||
|
||||
Sort function should return a value greater than 0 if position of @a p1 is
|
||||
after @a p2. So, for instance, when comparing property names, you can use
|
||||
following implementation:
|
||||
|
||||
@code
|
||||
int MyPropertySortFunction(wxPropertyGrid* propGrid,
|
||||
wxPGProperty* p1,
|
||||
wxPGProperty* p2)
|
||||
{
|
||||
return p1->GetBaseName().compare( p2->GetBaseName() );
|
||||
}
|
||||
@endcode
|
||||
*/
|
||||
typedef int (*wxPGSortCallback)(wxPropertyGrid* propGrid,
|
||||
wxPGProperty* p1,
|
||||
wxPGProperty* p2);
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** Used to indicate wxPGChoices::Add() etc that the value is actually not given
|
||||
by the caller.
|
||||
@hideinitializer
|
||||
*/
|
||||
constexpr int wxPG_INVALID_VALUE = std::numeric_limits<int>::max();
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
enum class wxPGPropertyValuesFlags : int
|
||||
{
|
||||
/** Flag for wxPropertyGridInterface::SetProperty* functions,
|
||||
wxPropertyGridInterface::HideProperty(), etc.
|
||||
Apply changes only for the property in question.
|
||||
@hideinitializer
|
||||
*/
|
||||
DontRecurse = 0x00000000,
|
||||
|
||||
/** Flag for wxPropertyGridInterface::GetPropertyValues().
|
||||
Use this flag to retain category structure; each sub-category
|
||||
will be its own wxVariantList of wxVariant.
|
||||
@hideinitializer
|
||||
*/
|
||||
KeepStructure = 0x00000010,
|
||||
|
||||
/** Flag for wxPropertyGridInterface::SetProperty* functions,
|
||||
wxPropertyGridInterface::HideProperty(), etc.
|
||||
Apply changes recursively for the property and all its children.
|
||||
@hideinitializer
|
||||
*/
|
||||
Recurse = 0x00000020,
|
||||
|
||||
/** Flag for wxPropertyGridInterface::GetPropertyValues().
|
||||
Use this flag to include property attributes as well.
|
||||
@hideinitializer
|
||||
*/
|
||||
IncAttributes = 0x00000040,
|
||||
|
||||
/** Used when first starting recursion.
|
||||
@hideinitializer
|
||||
*/
|
||||
RecurseStarts = 0x00000080,
|
||||
|
||||
/** Force value change.
|
||||
@hideinitializer
|
||||
*/
|
||||
Force = 0x00000100,
|
||||
|
||||
/** Only sort categories and their immediate children.
|
||||
Sorting done by ::wxPG_AUTO_SORT option uses this.
|
||||
@hideinitializer
|
||||
*/
|
||||
SortTopLevelOnly = 0x00000200
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** Miscellaneous property value format flags.
|
||||
*/
|
||||
enum class wxPGPropValFormatFlags : int
|
||||
{
|
||||
/** No flags.
|
||||
@hideinitializer
|
||||
*/
|
||||
Null = 0,
|
||||
|
||||
/** Get/Store full value instead of displayed value.
|
||||
@hideinitializer
|
||||
*/
|
||||
FullValue = 0x00000001,
|
||||
|
||||
/** Perform special action in case of unsuccessful conversion.
|
||||
@hideinitializer
|
||||
*/
|
||||
ReportError = 0x00000002,
|
||||
|
||||
/**
|
||||
@hideinitializer
|
||||
*/
|
||||
PropertySpecific = 0x00000004,
|
||||
|
||||
/** Get/Store editable value instead of displayed one (should only be
|
||||
different in the case of common values).
|
||||
@hideinitializer
|
||||
*/
|
||||
EditableValue = 0x00000008,
|
||||
|
||||
/** Used when dealing with fragments of composite string value
|
||||
@hideinitializer
|
||||
*/
|
||||
CompositeFragment = 0x00000010,
|
||||
|
||||
/** Means property for which final string value is for cannot really be
|
||||
edited.
|
||||
@hideinitializer
|
||||
*/
|
||||
UneditableCompositeFragment = 0x00000020,
|
||||
|
||||
/** wxPGProperty::ValueToString() called from wxPGProperty::GetValueAsString()
|
||||
(guarantees that input wxVariant value is current own value)
|
||||
@hideinitializer
|
||||
*/
|
||||
ValueIsCurrent = 0x00000040,
|
||||
|
||||
/** Value is being set programmatically (i.e. not by user)
|
||||
@hideinitializer
|
||||
*/
|
||||
ProgrammaticValue = 0x00000080
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** wxPGProperty::SetValue() flags
|
||||
*/
|
||||
enum class wxPGSetValueFlags : int
|
||||
{
|
||||
/**
|
||||
@hideinitializer
|
||||
*/
|
||||
RefreshEditor = 0x0001,
|
||||
|
||||
/**
|
||||
@hideinitializer
|
||||
*/
|
||||
Aggregated = 0x0002,
|
||||
|
||||
/**
|
||||
@hideinitializer
|
||||
*/
|
||||
FromParent = 0x0004,
|
||||
|
||||
/** Set if value changed by user
|
||||
@hideinitializer
|
||||
*/
|
||||
ByUser = 0x0008
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** Constant for ::wxPG_UINT_BASE attribute
|
||||
@hideinitializer
|
||||
*/
|
||||
constexpr long wxPG_BASE_OCT = 8L;
|
||||
/** Constant for ::wxPG_UINT_BASE attribute
|
||||
@hideinitializer
|
||||
*/
|
||||
constexpr long wxPG_BASE_DEC = 10L;
|
||||
/** Constant for ::wxPG_UINT_BASE attribute
|
||||
@hideinitializer
|
||||
*/
|
||||
constexpr long wxPG_BASE_HEX = 16L;
|
||||
/** Constant for ::wxPG_UINT_BASE attribute
|
||||
@hideinitializer
|
||||
*/
|
||||
constexpr long wxPG_BASE_HEXL = 32L;
|
||||
|
||||
/** Constant for ::wxPG_UINT_PREFIX attribute
|
||||
@hideinitializer
|
||||
*/
|
||||
constexpr long wxPG_PREFIX_NONE = 0L;
|
||||
/** Constant for ::wxPG_UINT_PREFIX attribute
|
||||
@hideinitializer
|
||||
*/
|
||||
constexpr long wxPG_PREFIX_0x = 1L;
|
||||
/** Constant for ::wxPG_UINT_PREFIX attribute
|
||||
@hideinitializer
|
||||
*/
|
||||
constexpr long wxPG_PREFIX_DOLLAR_SIGN = 2L;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
1232
libs/wxWidgets-3.3.1/interface/wx/propgrid/propgridiface.h
Normal file
1232
libs/wxWidgets-3.3.1/interface/wx/propgrid/propgridiface.h
Normal file
File diff suppressed because it is too large
Load Diff
517
libs/wxWidgets-3.3.1/interface/wx/propgrid/propgridpagestate.h
Normal file
517
libs/wxWidgets-3.3.1/interface/wx/propgrid/propgridpagestate.h
Normal file
@@ -0,0 +1,517 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: propgridpagestate.h
|
||||
// Purpose: interface of wxPGProperty
|
||||
// Author: wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
Flags affecting property selection.
|
||||
|
||||
Values of this enum are used with wxPropertyGrid::CommitChangesFromEditor(),
|
||||
for example.
|
||||
|
||||
@since 3.3.0
|
||||
*/
|
||||
enum class wxPGSelectPropertyFlags : int
|
||||
{
|
||||
/**
|
||||
No flags
|
||||
@hideinitializer
|
||||
*/
|
||||
Null = 0,
|
||||
/**
|
||||
Focuses to created editor
|
||||
@hideinitializer
|
||||
*/
|
||||
Focus = 0x0001,
|
||||
/**
|
||||
Forces deletion and recreation of editor
|
||||
@hideinitializer
|
||||
*/
|
||||
Force = 0x0002,
|
||||
/**
|
||||
For example, doesn't cause EnsureVisible
|
||||
@hideinitializer
|
||||
*/
|
||||
Nonvisible = 0x0004,
|
||||
/**
|
||||
Do not validate editor's value before selecting
|
||||
@hideinitializer
|
||||
*/
|
||||
NoValidate = 0x0008,
|
||||
/**
|
||||
Property being deselected is about to be deleted
|
||||
@hideinitializer
|
||||
*/
|
||||
Deleting = 0x0010,
|
||||
/**
|
||||
Property's values was set to unspecified by the user
|
||||
@hideinitializer
|
||||
*/
|
||||
SetUnspec = 0x0020,
|
||||
/**
|
||||
Property's event handler changed the value
|
||||
@hideinitializer
|
||||
*/
|
||||
DialogVal = 0x0040,
|
||||
/**
|
||||
Set to disable sending of wxEVT_PG_SELECTED event
|
||||
@hideinitializer
|
||||
*/
|
||||
DontSendEvent = 0x0080,
|
||||
/**
|
||||
Don't make any graphics updates
|
||||
@hideinitializer
|
||||
*/
|
||||
NoRefresh = 0x0100
|
||||
};
|
||||
|
||||
/**
|
||||
Flags for wxPropertyGridPageState::DoSetSplitter().
|
||||
|
||||
@since 3.3.0
|
||||
*/
|
||||
enum class wxPGSplitterPositionFlags : int
|
||||
{
|
||||
/// No special flags.
|
||||
Null = 0,
|
||||
/// Refresh the grid after setting splitter position.
|
||||
Refresh = 0x0001,
|
||||
/// Set splitter position for all pages.
|
||||
AllPages = 0x0002,
|
||||
|
||||
/*
|
||||
These are intentionally not documented as it seems that they are only
|
||||
used internally.
|
||||
|
||||
FromEvent = 0x0004,
|
||||
FromAutoCenter = 0x0008
|
||||
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
@section propgrid_hittestresult wxPropertyGridHitTestResult
|
||||
|
||||
A return value from wxPropertyGrid::HitTest(),
|
||||
contains all you need to know about an arbitrary location on the grid.
|
||||
*/
|
||||
class wxPropertyGridHitTestResult
|
||||
{
|
||||
friend class wxPropertyGridPageState;
|
||||
public:
|
||||
wxPropertyGridHitTestResult();
|
||||
|
||||
~wxPropertyGridHitTestResult();
|
||||
|
||||
/**
|
||||
Returns column hit. -1 for margin.
|
||||
*/
|
||||
int GetColumn() const;
|
||||
|
||||
/**
|
||||
Returns property hit. @NULL if empty space below
|
||||
properties was hit instead.
|
||||
*/
|
||||
wxPGProperty* GetProperty() const;
|
||||
|
||||
/**
|
||||
Returns index of splitter hit, -1 for none.
|
||||
*/
|
||||
int GetSplitter() const;
|
||||
|
||||
/**
|
||||
If splitter hit, then this member function
|
||||
returns offset to the exact splitter position.
|
||||
*/
|
||||
int GetSplitterHitOffset() const;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
#define wxPG_IT_CHILDREN(A) ((A)<<16)
|
||||
|
||||
/** @section propgrid_iterator_flags wxPropertyGridIterator Flags
|
||||
@{
|
||||
|
||||
NOTES: At lower 16-bits, there are flags to check if item will be included. At higher
|
||||
16-bits, there are same flags, but to instead check if children will be included.
|
||||
*/
|
||||
|
||||
enum wxPG_ITERATOR_FLAGS
|
||||
{
|
||||
/**
|
||||
Iterate through 'normal' property items (does not include children of
|
||||
aggregate or hidden items by default).
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_ITERATE_PROPERTIES = wxPGFlags::Property |
|
||||
wxPGFlags::MiscParent |
|
||||
wxPGFlags::Aggregate |
|
||||
wxPGFlags::Collapsed |
|
||||
wxPG_IT_CHILDREN(wxPGFlags::MiscParent) |
|
||||
wxPG_IT_CHILDREN(wxPGFlags::Category),
|
||||
|
||||
/**
|
||||
Iterate children of collapsed parents, and individual items that are hidden.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_ITERATE_HIDDEN = wxPGFlags::Hidden |
|
||||
wxPG_IT_CHILDREN(wxPGFlags::Collapsed),
|
||||
|
||||
/**
|
||||
Iterate children of parent that is an aggregate property (ie has fixed
|
||||
children).
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_ITERATE_FIXED_CHILDREN = wxPG_IT_CHILDREN(wxPGFlags::Aggregate) |
|
||||
wxPG_ITERATE_PROPERTIES,
|
||||
|
||||
/** Iterate categories.
|
||||
Note that even without this flag, children of categories are still iterated
|
||||
through.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_ITERATE_CATEGORIES = wxPGFlags::Category |
|
||||
wxPG_IT_CHILDREN(wxPGFlags::Category) |
|
||||
wxPGFlags::Collapsed,
|
||||
|
||||
/**
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_ITERATE_ALL_PARENTS = wxPGFlags::MiscParent |
|
||||
wxPGFlags::Aggregate |
|
||||
wxPGFlags::Category,
|
||||
|
||||
/**
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_ITERATE_ALL_PARENTS_RECURSIVELY = wxPG_ITERATE_ALL_PARENTS |
|
||||
wxPG_IT_CHILDREN(
|
||||
wxPG_ITERATE_ALL_PARENTS),
|
||||
|
||||
/**
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_ITERATOR_FLAGS_ALL = wxPGFlags::Property |
|
||||
wxPGFlags::MiscParent |
|
||||
wxPGFlags::Aggregate |
|
||||
wxPGFlags::Hidden |
|
||||
wxPGFlags::Category |
|
||||
wxPGFlags::Collapsed,
|
||||
|
||||
/**
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_ITERATOR_MASK_OP_ITEM = wxPG_ITERATOR_FLAGS_ALL,
|
||||
|
||||
/**
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_ITERATOR_MASK_OP_PARENT = wxPG_ITERATOR_FLAGS_ALL,
|
||||
|
||||
/**
|
||||
Combines all flags needed to iterate through visible properties
|
||||
(i.e. hidden properties and children of collapsed parents are skipped).
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_ITERATE_VISIBLE = wxPG_ITERATE_PROPERTIES |
|
||||
wxPGFlags::Category |
|
||||
wxPG_IT_CHILDREN(wxPGFlags::Aggregate),
|
||||
|
||||
/**
|
||||
Iterate all items.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_ITERATE_ALL = wxPG_ITERATE_VISIBLE |
|
||||
wxPG_ITERATE_HIDDEN,
|
||||
|
||||
/**
|
||||
Iterate through individual properties (ie categories and children of
|
||||
aggregate properties are skipped).
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_ITERATE_NORMAL = wxPG_ITERATE_PROPERTIES |
|
||||
wxPG_ITERATE_HIDDEN,
|
||||
|
||||
/**
|
||||
Default iterator flags.
|
||||
@hideinitializer
|
||||
*/
|
||||
wxPG_ITERATE_DEFAULT = wxPG_ITERATE_NORMAL
|
||||
|
||||
};
|
||||
|
||||
/** @}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
@section propgrid_iterator_class wxPropertyGridIterator
|
||||
|
||||
Preferable way to iterate through contents of wxPropertyGrid,
|
||||
wxPropertyGridManager, and wxPropertyGridPage.
|
||||
|
||||
See wxPropertyGridInterface::GetIterator() for more information about usage.
|
||||
|
||||
@library{wxpropgrid}
|
||||
@category{propgrid}
|
||||
|
||||
@{
|
||||
*/
|
||||
/**
|
||||
Base for wxPropertyGridIterator classes.
|
||||
*/
|
||||
class wxPropertyGridIteratorBase
|
||||
{
|
||||
protected:
|
||||
wxPropertyGridIteratorBase();
|
||||
|
||||
public:
|
||||
void Assign( const wxPropertyGridIteratorBase& it );
|
||||
|
||||
bool AtEnd() const;
|
||||
|
||||
/**
|
||||
Get current property.
|
||||
*/
|
||||
wxPGProperty* GetProperty() const;
|
||||
|
||||
void Init( wxPropertyGridPageState* state,
|
||||
int flags,
|
||||
wxPGProperty* property,
|
||||
int dir = 1 );
|
||||
|
||||
void Init( wxPropertyGridPageState* state,
|
||||
int flags,
|
||||
int startPos = wxTOP,
|
||||
int dir = 0 );
|
||||
|
||||
/**
|
||||
Iterate to the next property.
|
||||
*/
|
||||
void Next( bool iterateChildren = true );
|
||||
|
||||
/**
|
||||
Iterate to the previous property.
|
||||
*/
|
||||
void Prev();
|
||||
|
||||
/**
|
||||
Set base parent, i.e. a property when, in which iteration returns,
|
||||
it ends.
|
||||
|
||||
Default base parent is the root of the used wxPropertyGridPageState.
|
||||
*/
|
||||
void SetBaseParent( wxPGProperty* baseParent );
|
||||
};
|
||||
|
||||
class wxPropertyGridIterator : public wxPropertyGridIteratorBase
|
||||
{
|
||||
public:
|
||||
wxPropertyGridIterator();
|
||||
wxPropertyGridIterator( wxPropertyGridPageState* state,
|
||||
int flags = wxPG_ITERATE_DEFAULT,
|
||||
wxPGProperty* property = nullptr, int dir = 1 );
|
||||
wxPropertyGridIterator( wxPropertyGridPageState* state,
|
||||
int flags, int startPos, int dir = 0 );
|
||||
wxPropertyGridIterator( const wxPropertyGridIterator& it );
|
||||
~wxPropertyGridIterator();
|
||||
};
|
||||
|
||||
/**
|
||||
Const version of wxPropertyGridIterator.
|
||||
*/
|
||||
class wxPropertyGridConstIterator : public wxPropertyGridIteratorBase
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Additional copy constructor.
|
||||
*/
|
||||
wxPropertyGridConstIterator( const wxPropertyGridIterator& other );
|
||||
|
||||
/**
|
||||
Additional assignment operator.
|
||||
*/
|
||||
const wxPropertyGridConstIterator& operator=( const wxPropertyGridIterator& it );
|
||||
|
||||
wxPropertyGridConstIterator();
|
||||
wxPropertyGridConstIterator( const wxPropertyGridPageState* state,
|
||||
int flags = wxPG_ITERATE_DEFAULT,
|
||||
const wxPGProperty* property = nullptr, int dir = 1 );
|
||||
wxPropertyGridConstIterator( wxPropertyGridPageState* state,
|
||||
int flags, int startPos, int dir = 0 );
|
||||
wxPropertyGridConstIterator( const wxPropertyGridConstIterator& it );
|
||||
~wxPropertyGridConstIterator();
|
||||
};
|
||||
|
||||
/** @}
|
||||
*/
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@section propgrid_viterator_class wxPGVIterator
|
||||
|
||||
Abstract implementation of a simple iterator. Can only be used
|
||||
to iterate in forward order, and only through the entire container.
|
||||
Used to have functions dealing with all properties work with both
|
||||
wxPropertyGrid and wxPropertyGridManager.
|
||||
*/
|
||||
class wxPGVIterator
|
||||
{
|
||||
public:
|
||||
wxPGVIterator();
|
||||
wxPGVIterator( wxPGVIteratorBase* obj );
|
||||
~wxPGVIterator();
|
||||
void UnRef();
|
||||
wxPGVIterator( const wxPGVIterator& it );
|
||||
const wxPGVIterator& operator=( const wxPGVIterator& it );
|
||||
void Next();
|
||||
bool AtEnd() const;
|
||||
wxPGProperty* GetProperty() const;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @class wxPropertyGridPageState
|
||||
|
||||
Contains low-level property page information (properties, column widths,
|
||||
etc.) of a single wxPropertyGrid or single wxPropertyGridPage. Generally you
|
||||
should not use this class directly, but instead member functions in
|
||||
wxPropertyGridInterface, wxPropertyGrid, wxPropertyGridPage, and
|
||||
wxPropertyGridManager.
|
||||
|
||||
@remarks
|
||||
Currently this class is not implemented in wxPython.
|
||||
|
||||
@library{wxpropgrid}
|
||||
@category{propgrid}
|
||||
*/
|
||||
class wxPropertyGridPageState
|
||||
{
|
||||
friend class wxPropertyGrid;
|
||||
friend class wxPropertyGridInterface;
|
||||
friend class wxPropertyGridPage;
|
||||
friend class wxPropertyGridManager;
|
||||
friend class wxPGProperty;
|
||||
friend class wxFlagsProperty;
|
||||
friend class wxPropertyGridIteratorBase;
|
||||
public:
|
||||
|
||||
/**
|
||||
Default constructor.
|
||||
*/
|
||||
wxPropertyGridPageState();
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxPropertyGridPageState();
|
||||
|
||||
/**
|
||||
Makes sure all columns have minimum width.
|
||||
*/
|
||||
void CheckColumnWidths( int widthChange = 0 );
|
||||
|
||||
/**
|
||||
Override this member function to add custom behaviour on property
|
||||
deletion.
|
||||
*/
|
||||
virtual void DoDelete( wxPGProperty* item, bool doDelete = true );
|
||||
|
||||
/**
|
||||
Override this member function to add custom behaviour on property
|
||||
insertion.
|
||||
*/
|
||||
virtual wxPGProperty* DoInsert( wxPGProperty* parent,
|
||||
int index,
|
||||
wxPGProperty* property );
|
||||
|
||||
/**
|
||||
This needs to be overridden in grid used the manager so that splitter
|
||||
changes can be propagated to other pages.
|
||||
*/
|
||||
virtual void DoSetSplitter( int pos,
|
||||
int splitterColumn = 0,
|
||||
wxPGSplitterPositionFlags flags =
|
||||
wxPGSplitterPositionFlags::Null );
|
||||
|
||||
bool EnableCategories( bool enable );
|
||||
|
||||
/**
|
||||
Make sure virtual height is up-to-date.
|
||||
*/
|
||||
void EnsureVirtualHeight();
|
||||
|
||||
/**
|
||||
Returns (precalculated) height of contained visible properties.
|
||||
*/
|
||||
unsigned int GetVirtualHeight() const;
|
||||
|
||||
/**
|
||||
Returns (precalculated) height of contained visible properties.
|
||||
*/
|
||||
unsigned int GetVirtualHeight();
|
||||
|
||||
/**
|
||||
Returns actual height of contained visible properties.
|
||||
@remarks
|
||||
Mostly used for internal diagnostic purposes.
|
||||
*/
|
||||
inline unsigned int GetActualVirtualHeight() const;
|
||||
|
||||
unsigned int GetColumnCount() const;
|
||||
|
||||
int GetColumnMinWidth( int column ) const;
|
||||
|
||||
int GetColumnWidth( unsigned int column ) const;
|
||||
|
||||
wxPropertyGrid* GetGrid() const;
|
||||
|
||||
/**
|
||||
Returns last item which could be iterated using given flags.
|
||||
@param flags
|
||||
@ref propgrid_iterator_flags
|
||||
*/
|
||||
wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT );
|
||||
|
||||
const wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ) const;
|
||||
|
||||
/**
|
||||
Returns currently selected property.
|
||||
*/
|
||||
wxPGProperty* GetSelection() const;
|
||||
|
||||
wxPropertyCategory* GetPropertyCategory( const wxPGProperty* p ) const;
|
||||
|
||||
/**
|
||||
Returns combined width of margin and all the columns.
|
||||
*/
|
||||
int GetVirtualWidth() const;
|
||||
|
||||
int GetColumnFullWidth(wxPGProperty* p, unsigned int col) const;
|
||||
|
||||
/**
|
||||
Returns information about arbitrary position in the grid.
|
||||
|
||||
@param pt
|
||||
Logical coordinates in the virtual grid space. Use
|
||||
wxScrolled<T>::CalcUnscrolledPosition() if you need to
|
||||
translate a scrolled position into a logical one.
|
||||
*/
|
||||
wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const;
|
||||
|
||||
/**
|
||||
Returns true if page is visibly displayed.
|
||||
*/
|
||||
inline bool IsDisplayed() const;
|
||||
|
||||
bool IsInNonCatMode() const;
|
||||
|
||||
/**
|
||||
Called after virtual height needs to be recalculated.
|
||||
*/
|
||||
void VirtualHeightChanged();
|
||||
};
|
||||
860
libs/wxWidgets-3.3.1/interface/wx/propgrid/props.h
Normal file
860
libs/wxWidgets-3.3.1/interface/wx/propgrid/props.h
Normal file
@@ -0,0 +1,860 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: props.h
|
||||
// Purpose: interface of some wxPGProperty subclasses
|
||||
// Author: wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
/** @class wxPGInDialogValidator
|
||||
@ingroup classes
|
||||
Creates and manages a temporary wxTextCtrl for validation purposes.
|
||||
Uses wxPropertyGrid's current editor, if available.
|
||||
*/
|
||||
class wxPGInDialogValidator
|
||||
{
|
||||
public:
|
||||
wxPGInDialogValidator();
|
||||
~wxPGInDialogValidator();
|
||||
|
||||
bool DoValidate( wxPropertyGrid* propGrid,
|
||||
wxValidator* validator,
|
||||
const wxString& value );
|
||||
};
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Property classes
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
/** @class wxStringProperty
|
||||
@ingroup classes
|
||||
Basic property with string value.
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_STRING_PASSWORD: set to @true in order to enable ::wxTE_PASSWORD
|
||||
on the editor.
|
||||
|
||||
@remarks
|
||||
- If value "<composed>" is set, then actual value is formed (or composed)
|
||||
from values of child properties.
|
||||
*/
|
||||
class wxStringProperty : public wxPGProperty
|
||||
{
|
||||
public:
|
||||
wxStringProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
const wxString& value = wxString() );
|
||||
virtual ~wxStringProperty();
|
||||
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
|
||||
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
|
||||
|
||||
/** This is updated so "<composed>" special value can be handled.
|
||||
*/
|
||||
virtual void OnSetValue();
|
||||
};
|
||||
|
||||
|
||||
/** Constants used with NumericValidation<>().
|
||||
*/
|
||||
enum class wxPGNumericValidationMode
|
||||
{
|
||||
/** Instead of modifying the value, show an error message.
|
||||
*/
|
||||
ErrorMessage,
|
||||
|
||||
/** Modify value, but stick with the limitations.
|
||||
*/
|
||||
Saturate,
|
||||
|
||||
/** Modify value, wrap around on overflow.
|
||||
*/
|
||||
Wrap
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
A more comprehensive numeric validator class.
|
||||
*/
|
||||
class wxNumericPropertyValidator : public wxTextValidator
|
||||
{
|
||||
public:
|
||||
enum NumericType
|
||||
{
|
||||
Signed = 0,
|
||||
Unsigned,
|
||||
Float
|
||||
};
|
||||
|
||||
wxNumericPropertyValidator( NumericType numericType, int base = 10 );
|
||||
virtual ~wxNumericPropertyValidator() = default;
|
||||
virtual bool Validate(wxWindow* parent);
|
||||
};
|
||||
|
||||
/** @class wxNumericProperty
|
||||
@ingroup classes
|
||||
|
||||
This is an abstract class which serves as a base class for numeric properties,
|
||||
like wxIntProperty, wxUIntProperty, wxFloatProperty.
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_ATTR_MIN, ::wxPG_ATTR_MAX: Specify acceptable value range.
|
||||
- ::wxPG_ATTR_SPINCTRL_STEP: How much number changes when SpinCtrl editor
|
||||
button is pressed (or up/down on keyboard).
|
||||
- ::wxPG_ATTR_SPINCTRL_WRAP: Specify if value modified with SpinCtrl editor
|
||||
wraps at Min/Max.
|
||||
- ::wxPG_ATTR_SPINCTRL_MOTION: Specify if value can also by changed with
|
||||
SpinCtrl editor by moving mouse when left mouse button is being pressed.
|
||||
|
||||
@since 3.1.3
|
||||
*/
|
||||
class wxNumericProperty : public wxPGProperty
|
||||
{
|
||||
public:
|
||||
virtual ~wxNumericProperty();
|
||||
|
||||
virtual bool DoSetAttribute(const wxString& name, wxVariant& value);
|
||||
|
||||
/**
|
||||
Returns what would be the new value of the property after adding
|
||||
SpinCtrl editor step to the current value. Current value range
|
||||
and wrapping (if enabled) are taken into account.
|
||||
This member has to be implemented in derived properties.
|
||||
|
||||
@param stepScale
|
||||
SpinCtrl editor step is first multiplied by this factor and next
|
||||
added to the current value.
|
||||
|
||||
@return
|
||||
Value which property would have after adding SpinCtrl editor step.
|
||||
|
||||
@remark
|
||||
Current property value is not changed.
|
||||
*/
|
||||
virtual wxVariant AddSpinStepValue(long stepScale) const = 0;
|
||||
|
||||
/**
|
||||
Return @true if value can be changed with SpinCtrl editor by moving
|
||||
the mouse.
|
||||
*/
|
||||
bool UseSpinMotion() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
Constructor is protected because wxNumericProperty is only a base
|
||||
class for other numeric property classes.
|
||||
*/
|
||||
wxNumericProperty(const wxString& label, const wxString& name);
|
||||
|
||||
wxVariant m_minVal;
|
||||
wxVariant m_maxVal;
|
||||
bool m_spinMotion;
|
||||
wxVariant m_spinStep;
|
||||
bool m_spinWrap;
|
||||
};
|
||||
|
||||
|
||||
/** @class wxIntProperty
|
||||
@ingroup classes
|
||||
Basic property with integer value.
|
||||
|
||||
Seamlessly supports 64-bit integer (wxLongLong) on overflow.
|
||||
|
||||
<b>Example how to use seamless 64-bit integer support</b>
|
||||
|
||||
Getting value:
|
||||
|
||||
@code
|
||||
wxLongLong_t value = pg->GetPropertyValueAsLongLong();
|
||||
@endcode
|
||||
|
||||
or
|
||||
|
||||
@code
|
||||
wxLongLong_t value;
|
||||
wxVariant variant = property->GetValue();
|
||||
if ( variant.GetType() == "wxLongLong" )
|
||||
value = wxLongLongFromVariant(variant);
|
||||
else
|
||||
value = variant.GetLong();
|
||||
@endcode
|
||||
|
||||
Setting value:
|
||||
|
||||
@code
|
||||
pg->SetPropertyValue(longLongVal);
|
||||
@endcode
|
||||
|
||||
or
|
||||
|
||||
@code
|
||||
property->SetValue(WXVARIANT(longLongVal));
|
||||
@endcode
|
||||
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_ATTR_MIN, ::wxPG_ATTR_MAX, ::wxPG_ATTR_SPINCTRL_STEP,
|
||||
::wxPG_ATTR_SPINCTRL_WRAP, ::wxPG_ATTR_SPINCTRL_MOTION:
|
||||
like in wxNumericProperty.
|
||||
*/
|
||||
class wxIntProperty : public wxNumericProperty
|
||||
{
|
||||
public:
|
||||
wxIntProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
long value = 0 );
|
||||
virtual ~wxIntProperty();
|
||||
|
||||
wxIntProperty( const wxString& label,
|
||||
const wxString& name,
|
||||
const wxLongLong& value );
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool ValidateValue( wxVariant& value,
|
||||
wxPGValidationInfo& validationInfo ) const;
|
||||
virtual bool IntToValue(wxVariant& variant, int number,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
static wxValidator* GetClassValidator();
|
||||
virtual wxValidator* DoGetValidator() const;
|
||||
virtual wxVariant AddSpinStepValue(long stepScale) const;
|
||||
};
|
||||
|
||||
|
||||
/** @class wxUIntProperty
|
||||
@ingroup classes
|
||||
Basic property with unsigned integer value.
|
||||
Seamlessly supports 64-bit integer (wxULongLong) on overflow.
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_UINT_BASE: Define base. Valid constants are ::wxPG_BASE_OCT,
|
||||
::wxPG_BASE_DEC, ::wxPG_BASE_HEX and ::wxPG_BASE_HEXL (lowercase characters).
|
||||
Arbitrary bases are <b>not</b> supported.
|
||||
- ::wxPG_UINT_PREFIX: Possible values are ::wxPG_PREFIX_NONE, ::wxPG_PREFIX_0x,
|
||||
and ::wxPG_PREFIX_DOLLAR_SIGN. Only ::wxPG_PREFIX_NONE works with Decimal
|
||||
and Octal numbers.
|
||||
- ::wxPG_ATTR_MIN, ::wxPG_ATTR_MAX, ::wxPG_ATTR_SPINCTRL_STEP,
|
||||
::wxPG_ATTR_SPINCTRL_WRAP, ::wxPG_ATTR_SPINCTRL_MOTION:
|
||||
like in wxNumericProperty.
|
||||
|
||||
@remarks
|
||||
- For example how to use seamless 64-bit integer support, see wxIntProperty
|
||||
documentation (just use wxULongLong instead of wxLongLong).
|
||||
*/
|
||||
class wxUIntProperty : public wxNumericProperty
|
||||
{
|
||||
public:
|
||||
wxUIntProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
unsigned long value = 0 );
|
||||
virtual ~wxUIntProperty();
|
||||
wxUIntProperty( const wxString& label,
|
||||
const wxString& name,
|
||||
const wxULongLong& value );
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
|
||||
virtual bool ValidateValue( wxVariant& value,
|
||||
wxPGValidationInfo& validationInfo ) const;
|
||||
virtual wxValidator* DoGetValidator () const;
|
||||
virtual bool IntToValue(wxVariant& variant, int number,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual wxVariant AddSpinStepValue(long stepScale) const;
|
||||
|
||||
protected:
|
||||
wxByte m_base;
|
||||
wxByte m_realBase; // translated to 8,16,etc.
|
||||
wxByte m_prefix;
|
||||
};
|
||||
|
||||
|
||||
/** @class wxFloatProperty
|
||||
@ingroup classes
|
||||
Basic property with double-precision floating point value.
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_FLOAT_PRECISION: Sets the (max) precision used when floating point
|
||||
value is rendered as text. The default -1 means infinite precision.
|
||||
- ::wxPG_ATTR_MIN, ::wxPG_ATTR_MAX, ::wxPG_ATTR_SPINCTRL_STEP,
|
||||
::wxPG_ATTR_SPINCTRL_WRAP, ::wxPG_ATTR_SPINCTRL_MOTION:
|
||||
like in wxNumericProperty.
|
||||
*/
|
||||
class wxFloatProperty : public wxNumericProperty
|
||||
{
|
||||
public:
|
||||
wxFloatProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
double value = 0.0 );
|
||||
virtual ~wxFloatProperty();
|
||||
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
|
||||
virtual bool ValidateValue( wxVariant& value,
|
||||
wxPGValidationInfo& validationInfo ) const;
|
||||
|
||||
static wxValidator* GetClassValidator();
|
||||
virtual wxValidator* DoGetValidator () const;
|
||||
virtual wxVariant AddSpinStepValue(long stepScale) const;
|
||||
|
||||
protected:
|
||||
int m_precision;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** @class wxBoolProperty
|
||||
@ingroup classes
|
||||
Basic property with boolean value.
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_BOOL_USE_CHECKBOX: Set to @true to use check box editor instead
|
||||
of combo box.
|
||||
- ::wxPG_BOOL_USE_DOUBLE_CLICK_CYCLING: Set to @true to cycle combo box
|
||||
instead showing the list.
|
||||
*/
|
||||
class wxBoolProperty : public wxPGProperty
|
||||
{
|
||||
public:
|
||||
wxBoolProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
bool value = false );
|
||||
virtual ~wxBoolProperty();
|
||||
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool IntToValue(wxVariant& variant, int number,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
|
||||
};
|
||||
|
||||
|
||||
/** @class wxEnumProperty
|
||||
@ingroup classes
|
||||
You can derive custom properties with choices from this class. See
|
||||
wxBaseEnumProperty for remarks.
|
||||
|
||||
@remarks
|
||||
- Updating private index is important. You can do this either by calling
|
||||
SetIndex() in IntToValue, and then letting wxBaseEnumProperty::OnSetValue
|
||||
be called (by not implementing it, or by calling super class function in
|
||||
it) -OR- you can just call SetIndex in OnSetValue.
|
||||
*/
|
||||
class wxEnumProperty : public wxPGProperty
|
||||
{
|
||||
public:
|
||||
wxEnumProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
const wxChar* const* labels = nullptr,
|
||||
const long* values = nullptr,
|
||||
int value = 0 );
|
||||
|
||||
wxEnumProperty( const wxString& label,
|
||||
const wxString& name,
|
||||
wxPGChoices& choices,
|
||||
int value = 0 );
|
||||
|
||||
// Special constructor for caching choices (used by derived class)
|
||||
wxEnumProperty( const wxString& label,
|
||||
const wxString& name,
|
||||
const wxChar* const* labels,
|
||||
const long* values,
|
||||
wxPGChoices* choicesCache,
|
||||
int value = 0 );
|
||||
|
||||
wxEnumProperty( const wxString& label,
|
||||
const wxString& name,
|
||||
const wxArrayString& labels,
|
||||
const wxArrayInt& values = wxArrayInt(),
|
||||
int value = 0 );
|
||||
|
||||
virtual ~wxEnumProperty();
|
||||
|
||||
size_t GetItemCount() const;
|
||||
|
||||
virtual void OnSetValue();
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool ValidateValue( wxVariant& value,
|
||||
wxPGValidationInfo& validationInfo ) const;
|
||||
|
||||
/** If wxPGPropValFormatFlags::FullValue is not set in flags, then the value is interpreted
|
||||
as index to choices list. Otherwise, it is actual value.
|
||||
*/
|
||||
virtual bool IntToValue(wxVariant& variant, int number,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
|
||||
//
|
||||
// Additional virtuals
|
||||
|
||||
// This must be overridden to have non-index based value
|
||||
virtual int GetIndexForValue( int value ) const;
|
||||
|
||||
// GetChoiceSelection needs to overridden since m_index is
|
||||
// the true index, and various property classes derived from
|
||||
// this take advantage of it.
|
||||
virtual int GetChoiceSelection() const;
|
||||
|
||||
protected:
|
||||
|
||||
int GetIndex() const;
|
||||
void SetIndex( int index );
|
||||
|
||||
bool ValueFromString_(wxVariant& value, int* pIndex, const wxString& text,
|
||||
wxPGPropValFormatFlags flags) const;
|
||||
bool ValueFromInt_(wxVariant& value, int* pIndex, int intVal,
|
||||
wxPGPropValFormatFlags flags) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** @class wxEditEnumProperty
|
||||
@ingroup classes
|
||||
wxEnumProperty with wxString value and writable combo box editor.
|
||||
|
||||
@remarks
|
||||
Uses int value, similar to wxEnumProperty, unless text entered by user
|
||||
is not in choices (in which case string value is used).
|
||||
*/
|
||||
class wxEditEnumProperty : public wxEnumProperty
|
||||
{
|
||||
public:
|
||||
|
||||
wxEditEnumProperty( const wxString& label,
|
||||
const wxString& name,
|
||||
const wxChar* const* labels,
|
||||
const long* values,
|
||||
const wxString& value );
|
||||
|
||||
wxEditEnumProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
const wxArrayString& labels = wxArrayString(),
|
||||
const wxArrayInt& values = wxArrayInt(),
|
||||
const wxString& value = wxString() );
|
||||
|
||||
wxEditEnumProperty( const wxString& label,
|
||||
const wxString& name,
|
||||
wxPGChoices& choices,
|
||||
const wxString& value = wxString() );
|
||||
|
||||
// Special constructor for caching choices (used by derived class)
|
||||
wxEditEnumProperty( const wxString& label,
|
||||
const wxString& name,
|
||||
const wxChar* const* labels,
|
||||
const long* values,
|
||||
wxPGChoices* choicesCache,
|
||||
const wxString& value );
|
||||
|
||||
virtual ~wxEditEnumProperty();
|
||||
|
||||
void OnSetValue() override;
|
||||
bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
bool ValidateValue(wxVariant& value,
|
||||
wxPGValidationInfo& validationInfo) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** @class wxFlagsProperty
|
||||
@ingroup classes
|
||||
Represents a bit set that fits in a long integer. wxBoolProperty
|
||||
sub-properties are created for editing individual bits. Textctrl is created
|
||||
to manually edit the flags as a text; a continuous sequence of spaces,
|
||||
commas and semicolons is considered as a flag id separator.
|
||||
<b>Note:</b> When changing "choices" (ie. flag labels) of wxFlagsProperty,
|
||||
you will need to use SetPropertyChoices - otherwise they will not get
|
||||
updated properly.
|
||||
*/
|
||||
class wxFlagsProperty : public wxPGProperty
|
||||
{
|
||||
public:
|
||||
|
||||
wxFlagsProperty( const wxString& label,
|
||||
const wxString& name,
|
||||
const wxChar* const* labels,
|
||||
const long* values = nullptr,
|
||||
long value = 0 );
|
||||
|
||||
wxFlagsProperty( const wxString& label,
|
||||
const wxString& name,
|
||||
wxPGChoices& choices,
|
||||
long value = 0 );
|
||||
|
||||
wxFlagsProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
const wxArrayString& labels = wxArrayString(),
|
||||
const wxArrayInt& values = wxArrayInt(),
|
||||
int value = 0 );
|
||||
|
||||
virtual ~wxFlagsProperty ();
|
||||
|
||||
virtual void OnSetValue();
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags) const;
|
||||
virtual wxVariant ChildChanged( wxVariant& thisValue,
|
||||
int childIndex,
|
||||
wxVariant& childValue ) const;
|
||||
virtual void RefreshChildren();
|
||||
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
|
||||
|
||||
virtual int GetChoiceSelection() const;
|
||||
|
||||
size_t GetItemCount() const;
|
||||
const wxString& GetLabel( size_t ind ) const;
|
||||
|
||||
protected:
|
||||
long IdToBit( const wxString& id ) const;
|
||||
void Init(long value);
|
||||
};
|
||||
|
||||
|
||||
/** @class wxEditorDialogProperty
|
||||
@ingroup classes
|
||||
|
||||
This is an abstract class which serves as a base class for the properties
|
||||
having a button triggering an editor dialog, like e.g. wxLongStringProperty,
|
||||
wxDirProperty, wxFileProperty.
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_DIALOG_TITLE: Sets a specific title for the editor dialog.
|
||||
|
||||
@since 3.1.3
|
||||
*/
|
||||
class wxEditorDialogProperty : public wxPGProperty
|
||||
{
|
||||
public:
|
||||
virtual ~wxEditorDialogProperty();
|
||||
|
||||
virtual wxPGEditorDialogAdapter* GetEditorDialog() const;
|
||||
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
|
||||
|
||||
protected:
|
||||
/**
|
||||
Constructor is protected because wxEditorDialogProperty is only
|
||||
the base class for other property classes.
|
||||
*/
|
||||
wxEditorDialogProperty(const wxString& label, const wxString& name);
|
||||
|
||||
/**
|
||||
Shows editor dialog. Value to be edited should be read from
|
||||
@a value, and if dialog is not cancelled, it should be stored back
|
||||
and @true should be returned.
|
||||
|
||||
@param value
|
||||
Value to be edited.
|
||||
|
||||
@param pg
|
||||
Property grid in which property is displayed.
|
||||
|
||||
@return
|
||||
Returns @true if editor dialog was not cancelled and @a value
|
||||
was updated.
|
||||
*/
|
||||
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value) = 0;
|
||||
|
||||
wxString m_dlgTitle;
|
||||
long m_dlgStyle;
|
||||
};
|
||||
|
||||
|
||||
/** @class wxFileProperty
|
||||
@ingroup classes
|
||||
Like wxLongStringProperty, but the button triggers file selector instead.
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_DIALOG_TITLE: Sets a specific title for the file dialog (since 3.1.3).
|
||||
- ::wxPG_FILE_DIALOG_STYLE: Sets a specific wxFileDialog style for the file
|
||||
dialog (since 2.9.4).
|
||||
- ::wxPG_FILE_WILDCARD: Sets wildcard (see wxFileDialog for format details),
|
||||
"All files..." is default.
|
||||
- ::wxPG_FILE_SHOW_FULL_PATH: Default @true. When @false, only the file name is
|
||||
shown (i.e. drive and directory are hidden).
|
||||
- ::wxPG_FILE_SHOW_RELATIVE_PATH: If set, then the filename is shown relative
|
||||
to the given path string.
|
||||
- ::wxPG_FILE_INITIAL_PATH: Sets the initial path of where to look for files.
|
||||
*/
|
||||
class wxFileProperty : public wxEditorDialogProperty
|
||||
{
|
||||
public:
|
||||
|
||||
wxFileProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
const wxString& value = wxString() );
|
||||
virtual ~wxFileProperty ();
|
||||
|
||||
virtual void OnSetValue();
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
|
||||
|
||||
static wxValidator* GetClassValidator();
|
||||
virtual wxValidator* DoGetValidator() const;
|
||||
|
||||
/**
|
||||
Returns filename to file represented by current value.
|
||||
*/
|
||||
wxFileName GetFileName() const;
|
||||
|
||||
protected:
|
||||
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value);
|
||||
|
||||
wxString m_wildcard;
|
||||
wxString m_basePath;
|
||||
wxString m_initialPath;
|
||||
int m_indFilter;
|
||||
};
|
||||
|
||||
|
||||
/** @class wxLongStringProperty
|
||||
@ingroup classes
|
||||
Like wxStringProperty, but has a button that triggers a small text
|
||||
editor dialog.
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_DIALOG_TITLE: Sets a specific title for the text editor dialog (since 3.1.3).
|
||||
*/
|
||||
class wxLongStringProperty : public wxEditorDialogProperty
|
||||
{
|
||||
public:
|
||||
|
||||
wxLongStringProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
const wxString& value = wxString() );
|
||||
virtual ~wxLongStringProperty();
|
||||
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
|
||||
protected:
|
||||
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value);
|
||||
};
|
||||
|
||||
|
||||
/** @class wxDirProperty
|
||||
@ingroup classes
|
||||
Like wxLongStringProperty, but the button triggers directory selector
|
||||
instead.
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_DIALOG_TITLE: Sets a specific title for the file dialog (since 3.1.3).
|
||||
*/
|
||||
class wxDirProperty : public wxEditorDialogProperty
|
||||
{
|
||||
public:
|
||||
wxDirProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
const wxString& value = wxString() );
|
||||
virtual ~wxDirProperty();
|
||||
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual wxValidator* DoGetValidator() const;
|
||||
|
||||
protected:
|
||||
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value);
|
||||
};
|
||||
|
||||
|
||||
/** @class wxArrayStringProperty
|
||||
@ingroup classes
|
||||
Property that manages a list of strings.
|
||||
|
||||
<b>Supported special attributes:</b>
|
||||
- ::wxPG_ARRAY_DELIMITER: Sets string delimiter character.
|
||||
- ::wxPG_DIALOG_TITLE: Sets a specific title for the editor dialog (since 3.1.3).
|
||||
*/
|
||||
class wxArrayStringProperty : public wxEditorDialogProperty
|
||||
{
|
||||
public:
|
||||
wxArrayStringProperty( const wxString& label = wxPG_LABEL,
|
||||
const wxString& name = wxPG_LABEL,
|
||||
const wxArrayString& value = wxArrayString() );
|
||||
virtual ~wxArrayStringProperty();
|
||||
|
||||
virtual void OnSetValue();
|
||||
virtual wxString ValueToString(wxVariant& value,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool StringToValue(wxVariant& variant, const wxString& text,
|
||||
wxPGPropValFormatFlags flags = wxPGPropValFormatFlags::Null) const;
|
||||
virtual bool DoSetAttribute( const wxString& name, wxVariant& value );
|
||||
|
||||
/**
|
||||
Implement in derived class for custom array-to-string conversion.
|
||||
*/
|
||||
virtual wxString ConvertArrayToString(const wxArrayString& arr,
|
||||
const wxUniChar& delimiter) const;
|
||||
|
||||
/**
|
||||
Shows string editor dialog to edit the individual item. Value to be edited
|
||||
should be read from @a value, and if dialog is not cancelled, it
|
||||
should be stored back and @true should be returned if that was the case.
|
||||
*/
|
||||
virtual bool OnCustomStringEdit( wxWindow* parent, wxString& value );
|
||||
|
||||
/** Creates wxPGArrayEditorDialog for string editing.
|
||||
*/
|
||||
virtual wxPGArrayEditorDialog* CreateEditorDialog();
|
||||
|
||||
enum ConversionFlags
|
||||
{
|
||||
Escape = 0x01,
|
||||
QuoteStrings = 0x02
|
||||
};
|
||||
|
||||
/**
|
||||
Generates string based on the contents of wxArrayString @a src.
|
||||
*/
|
||||
static wxString ArrayStringToString(const wxArrayString& src,
|
||||
wxUniChar delimiter, int flags);
|
||||
|
||||
protected:
|
||||
virtual bool DisplayEditorDialog(wxPropertyGrid* pg, wxVariant& value);
|
||||
|
||||
/**
|
||||
Previously this was to be implemented in derived class for array-to-
|
||||
string conversion. Now you should implement ConvertValueToString()
|
||||
instead.
|
||||
*/
|
||||
virtual void GenerateValueAsString();
|
||||
|
||||
wxString m_display; // Cache for displayed text.
|
||||
wxUniChar m_delimiter;
|
||||
wxString m_customBtnText;
|
||||
};
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// wxPGArrayEditorDialog
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
#define wxAEDIALOG_STYLE \
|
||||
(wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE)
|
||||
|
||||
class wxPGArrayEditorDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
wxPGArrayEditorDialog();
|
||||
virtual ~wxPGArrayEditorDialog();
|
||||
|
||||
void Init();
|
||||
|
||||
bool Create( wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
long style = wxAEDIALOG_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& sz = wxDefaultSize );
|
||||
|
||||
void EnableCustomNewAction();
|
||||
|
||||
/** Sets tooltip text for button allowing the user to enter new string.
|
||||
@since 3.1.3
|
||||
*/
|
||||
void SetNewButtonText(const wxString& text);
|
||||
|
||||
/** Set value modified by dialog.
|
||||
*/
|
||||
virtual void SetDialogValue( const wxVariant& value );
|
||||
|
||||
/** Return value modified by dialog.
|
||||
*/
|
||||
virtual wxVariant GetDialogValue() const;
|
||||
|
||||
/** Override to return wxValidator to be used with the wxTextCtrl
|
||||
in dialog. Note that the validator is used in the standard
|
||||
wx way, ie. it immediately prevents user from entering invalid
|
||||
input.
|
||||
|
||||
@remarks
|
||||
Dialog frees the validator.
|
||||
*/
|
||||
virtual wxValidator* GetTextCtrlValidator() const;
|
||||
|
||||
/** Returns true if array was actually modified
|
||||
*/
|
||||
bool IsModified() const;
|
||||
|
||||
int GetSelection() const;
|
||||
|
||||
protected:
|
||||
wxEditableListBox* m_elb;
|
||||
wxWindow* m_elbSubPanel;
|
||||
wxWindow* m_lastFocused;
|
||||
|
||||
/** A new item, edited by user, is pending at this index.
|
||||
It will be committed once list ctrl item editing is done.
|
||||
*/
|
||||
int m_itemPendingAtIndex;
|
||||
|
||||
bool m_modified;
|
||||
bool m_hasCustomNewAction;
|
||||
|
||||
virtual wxString ArrayGet( size_t index ) = 0;
|
||||
virtual size_t ArrayGetCount() = 0;
|
||||
virtual bool ArrayInsert( const wxString& str, int index ) = 0;
|
||||
virtual bool ArraySet( size_t index, const wxString& str ) = 0;
|
||||
virtual void ArrayRemoveAt( int index ) = 0;
|
||||
virtual void ArraySwap( size_t first, size_t second ) = 0;
|
||||
|
||||
virtual bool OnCustomNewAction(wxString* resString);
|
||||
};
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// wxPGArrayStringEditorDialog
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
class wxPGArrayStringEditorDialog : public wxPGArrayEditorDialog
|
||||
{
|
||||
public:
|
||||
wxPGArrayStringEditorDialog();
|
||||
virtual ~wxPGArrayStringEditorDialog() = default;
|
||||
|
||||
void Init();
|
||||
|
||||
virtual void SetDialogValue( const wxVariant& value );
|
||||
virtual wxVariant GetDialogValue() const;
|
||||
|
||||
void SetCustomButton( const wxString& custBtText,
|
||||
wxArrayStringProperty* pcc );
|
||||
|
||||
virtual bool OnCustomNewAction(wxString* resString);
|
||||
|
||||
protected:
|
||||
wxArrayString m_array;
|
||||
|
||||
wxArrayStringProperty* m_pCallingClass;
|
||||
|
||||
virtual wxString ArrayGet( size_t index );
|
||||
virtual size_t ArrayGetCount();
|
||||
virtual bool ArrayInsert( const wxString& str, int index );
|
||||
virtual bool ArraySet( size_t index, const wxString& str );
|
||||
virtual void ArrayRemoveAt( int index );
|
||||
virtual void ArraySwap( size_t first, size_t second );
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user