📄 changes-propgrid.txt
字号:
- wxPG_EX_FLAT_TOOLBAR is now default. Use wxPG_EX_NO_FLAT_TOOLBAR
to disable it.
New Features:
- ChoiceAndButton editor class. Used by a new example, AdvImageFile
property (its on first page in the app). It works like ImageFile
property, but also has dropdown list of all tried image files
(with thumbnails, too).
- New property generator macro pair:
WX_PG_DECLARE_ARRAYSTRING_PROPERTY(PROPNAME)
WX_PG_IMPLEMENT_ARRAYSTRING_PROPERTY(PROPNAME,DELIMITER,CUSTBUTTXT)
Creates a wxArrayStringProperty derivative which allows a custom
string list delimiter and setting a custom editor action into
the string editor dialog.
PROPNAME = As usual.
DELIMITER = wxT('"') for "str1" "str2" style and anything else for
str1<DELIMETER> str2 style.
CUSTBUTTXT = A const wxChar* text for a button label. NULL for no
custom button.
Also, you must implement the custom button method
bool PROPNAMEClass::OnCustomStringEdit ( wxWindow* parent, wxString& value )
even if you used NULL as CUSTBUTTXT.
Included in the sample is wxDirsProperty as an example of using
these macros.
Summary of Other Changes in Creating User Custom Properties (vs 0.9.9.x):
- Main change with macros is that they are always preceded by "WX_PG_"
instead of nothing or "wxPG_", and that they generally accept
property names (wxStringProperty is a property name,
wxStringPropertyClass is property class name). Thus, first
argument for IMPLEMENT macros should stay the same.
Apart from the additon of prefix, easy-property macros such
as DECLARE_STRING_PROPERTY and IMPLEMENT_CUSTOM_FLAGS_PROPERTY
remain unchanged.
- Since property classes are now generally hidden,
WX_PG_DECLARE_PROPERTY(PROPNAME,TYPE_AS_ARG,DEFVAL)
macro is used to declare a constructor function for them
(instead of putting the class declaration into a header file).
Example of use:
WX_PG_DECLARE_PROPERTY(wxRealPointProperty,const wxRealPoint&,RealPoint())
As always, there is also _WITH_DECL variant that takes an additional
declaration argument (such as export).
- DECLARE_PROPERTY_CLASS (now WX_PG_DECLARE_PROPERTY_CLASS), which
was used inside a property class declaration, no longer has an argument
(previously it had class name as argument).
- IMPLEMENT_PROPERTY_CLASS(CLASSNAME,PARENTCLASS,VALUETYPE,EDITORCLASS)
got rid of PARENTCLASS argument and got a TYPE_AS_ARG argument (same use
as in WX_PG_DECLARE_PROPERTY), so it is now:
WX_PG_IMPLEMENT_PROPERTY_CLASS(PROPNAME,VALUETYPE,TYPE_AS_ARG,EDITORCLASS)
So for example:
IMPLEMENT_PROPERTY_CLASS(wxFontDataProperty,wxFontProperty,
wxFontData,TextCtrlAndButton)
is now:
WX_PG_IMPLEMENT_PROPERTY_CLASS(wxFontDataProperty,wxFontData,
const wxFontData&,TextCtrlAndButton)
- To sum things up in an example...
//* BEFORE *//
// Header:
class wxMyCustomProperty : public wxPGProperty
{
DECLARE_PROPERTY_CLASS(wxMyCustomProperty)
public:
...
};
// Source:
IMPLEMENT_PROPERTY_CLASS(wxMyCustomProperty,wxPGProperty,
MyValueClass,TextCtrl)
//* NOW *//
// Header:
WX_PG_DECLARE_PROPERTY(wxMyCustomProperty,const MyValueClass&,MyValueClass())
// Source:
class wxMyCustomPropertyClass : public wxPGProperty
{
WX_PG_DECLARE_PROPERTY_CLASS()
public:
...
};
WX_PG_IMPLEMENT_PROPERTY_CLASS(wxMyCustomProperty,MyValueClass,
const MyValueClass&,TextCtrl)
- wxPGProperty::GetValue
is now
wxPGProperty::DoGetValue
- void wxPGProperty::GetValueAsString(wxString& str,bool fullvalue)
is now
wxString wxPGProperty::GetValueAsString(int argflags)
So it now just returns the string instead of adding to the
one given as argument. Also, previous (fullvalue == TRUE) test
is now (argflags & wxPG_FULL_VALUE), but this is really only
important for those rare properties that different stored/
displayed value (wxPG_FULL_VALUE is set if true value should
be returned instead of displayed one).
- wxPGProperty::DoSetValueFromInt
is now
SetValueFromInt.
- Changed flags arguments in wxPGProperty methods from long to int
(affects SetValueFromString and SetValueFromInt).
- In future, it is preferable to use WX_PG_DECLARE_XXX_METHODS()
macros to declare overridden methods in property class declaration.
This causes compile time failure if method specifications
change, potentially saving debugging time.
WX_PG_DECLARE_BASIC_TYPE_METHODS(): Declares
GetValue, DoSetValue, GetValueAsString, SetValueFromString.
WX_PG_DECLARE_PARENTAL_TYPE_METHODS(): Declares
GetValue, DoSetValue.
WX_PG_DECLARE_EVENT_METHODS(): Declares OnEvent.
WX_PG_DECLARE_CHOICE_METHODS(): Declares GetChoiceInfo,
SetValueFromInt.
WX_PG_DECLARE_PARENTAL_METHODS(): Declares ChildChanged,
RefreshChildren.
WX_PG_DECLARE_CUSTOM_PAINT_METHODS(): Declares GetImageSize,
OnCustomPaint.
- WX_PG_DECLARE_VALUE_TYPE_VOIDP:
Use this to declare value types implemented with
WX_PG_IMPLEMENT_VALUE_TYPE_VOIDP (see below).
- WX_PG_IMPLEMENT_VALUE_TYPE_VOIDP: Generates a wxVariantData class
as well. This is necessary if you want a wxVariant list (acquired,
for example, with GetPropertyValues) to own a copy of an object
of the type (instead of holding just the pointer to the value stored
in the property). wxVariantData_TYPENAME class is made globally
accessible by WX_PG_DECLARE_VALUE_TYPE_VOIDP.
- Old wxPG_IMPLEMENT_VALUE_TYPE_VOIDP is now
WX_PG_IMPLEMENT_VALUE_TYPE_VOIDP_SIMPLE.
- WX_PG_IMPLEMENT_VALUE_TYPE_VOIDP_CVD: Like, but instead of
implementing own wxVariantData class, uses an app-provided one
(there is extra argument for that purpose). Also, you need to use
regular WX_PG_DECLARE_VALUE_TYPE with this implement macro.
NOTE: wxVariantData class must have constructor that accepts
a reference to the data type class and creates a copy of it.
- wxPGProperty::UpdateControl(ctrl) added. It calls, if ctrl
is valid, UpdateControl of the editor class. It is used
in almost every propertyclass::OnEvent.
- wxPGPaintData: m_choiceitem is now m_choiceItem.
- Method generator macros (wxPG_IMPLEMENT_SETVALUE etc.) removed.
Using them just made the code less clear.
- Added specs for variable height image support in a choice editor
drop-down.
- GetImageSize must return wxPG_FLEXIBLE_SIZE(W,H) where W and H
are Width and Height of preferred custom image size (both must
be > 1).
- When OnCustomPaint receives a call with rect.x < 0, then it
is a measure item call that should return pd.m_choiceItem's
height in pd.m_drawnHeight.
- wxPGPaintData got m_drawnWidth member, which should be filled by
OnCustomPaint if it infact painted wider or thinner image than
it should.
- wxPGProperty from wxObject inheritance option is no longer
supported (allows simpler WX_PG_IMPLEMENT_PROPERTY_CLASS and
WX_PG_DECLARE_PROPERTY_CLASS macro).
- wxLongStringProperty's static functions ExpandEscapeSequences and
CreateEscapeSequences moved to wxPropertyGrid.
Other Changes:
- Supplied bakefile generated makefiles for wxWidgets 2.5.2.
Unix install script now asks which version you got and copies
the apropriate makefile (in Windows you have to copy the
required file manually).
- wxCCustomComboBox: Now accepts left, right, pgup and pgdn
keys (when popup not displayed).
- wxPG_EX_NO_MODE_BUTTONS allows hiding categoric/alphabetic
mode buttons from wxPropertyGridManager's toolbar.
- If property grid's frame has status bar, then any property
specific errors are shown there (instead of using wxLogError).
- wxFileProperty etc. use proper Editor Class calls instead
of assuming anything about the editor control used.
- Added SetPropertyValue(id/name,wxObject&) to both wxPropertyGrid
and wxPropertyGridManager. Previously there only was a version
that accepted a wxObject*.
- GetPropertyClassName now returns constructor function name
(i.e. property name) instead of actual class name. Thus, string
returned is the same as in previous versions.
- wxPGEditor::SetControlValue -> UpdateControl
- Added wxPGEditor::AppendItem for adding items for controls
with children.
- Added wxPGEditor::SetControlStringValue for setting string value
specifically.
- Added wxPGEditor::SetControlIntValue for setting int value
(choice index etc.) specifically.
Bugs Fixed:
- There was crash if top-level (i.e. had root as parent)
properties were used (needed to add m_bgColIndex = 0
to wxPGProperty::Init).
- wxPropertyGrid::Collapse and Expand: Attempted visible
changes for categories in non-categoric mode.
- Right click on custom control did not properly produce
property right click event.
- SetPropertyValues: If property/parent with list's name
already existed, then list's contents was skipped.
- GetPropertyValues: Names of list variants was extracted
from property's label instead of name.
- GetPropertyByLabel: Resulted in infinite loop.
- GetFirstCategory and GetNextCategory did not work in
non-categoric mode.
- Tab, Shift-Tab, and Escape based property traversal
worked even when wxTAB_TRAVERSAL was not specified.
- Changed properties with children did not get properly
repainted in all cases.
- If SetPropertyValues was called with selected being
a sub-property, then that selected property's editor
control was not properly refreshed (now editor of
selected is always refreshed in SetPropertyValues).
- wxPropertyGridManager: Did not correctly get various flags
(namely wxPG_HIDE_CATEGORIES). Changes in OnToolBarClick and
SetWindowStyleFlag.
- wxPropertyGridManager: Proper Refresh method was missing.
- wxFontDataProperty: Did not check if editor control was NULL.
- Choice editor didn't accept zero length string arrays.
- Various bugs that may have existed in older releases.
Version 0.9.9.2 ( Jan-14-2005 )
Changes:
- wxGTK wxCCustomButton: gtk_paint_box and gtk_paint_arrow are now
employed to draw real GTK buttons.
- wxMSW wxCCustomButton: wxUxTheme is now used to draw real XP buttons.
- wxCCustomComboBox: Popup now uses wxPopupWindow where available. With
wxGTK this is currently disabled because it doesn't have proper border
support for this type of window (as it would seem).
- wxCCustomComboBox: When popup is open, background of text in the actual
control is reverted to the standard colour (similar to Windows read-only
combo).
- wxCCustomTextCtrl: Double-clicking selects the word under cursor. This is
done slightly differently under Windows and GTK, according to their native
textctrl behaviour.
- Added following methods, previously only available in wxPropertyGrid,
to wxPropertyGridManager as well: GetPropertyByLabel.
- Small section removed from wxFontDataProperty example (OnEvent's first
conditional block; it is unnecessary and currently produces compilation
error).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -