Make wxPG_FILE_xxx built-in attributes

All wxPG_FILE_xxx attributes are used only in wxFileProperty to set respective internal data members and don't have to be stored in the property's attribute store.
This commit is contained in:
Artur Wieczorek
2019-05-12 11:45:23 +02:00
parent baaba42776
commit 1b977718d4
4 changed files with 19 additions and 19 deletions

View File

@@ -125,29 +125,31 @@ struct wxPGPaintData
*/
#define wxPG_UINT_PREFIX wxS("Prefix")
/** wxFileProperty/wxImageFileProperty specific, @c wxChar*, default is detected/varies.
Sets the wildcard used in the triggered wxFileDialog. Format is the
same.
/** wxFileProperty and wxImageFileProperty specific built-in attribute,
@c wxChar*, default is detected/varies. Sets the wildcard used in
the triggered wxFileDialog. Format is the same.
*/
#define wxPG_FILE_WILDCARD wxS("Wildcard")
/** wxFileProperty and wxImageFileProperty specific, @c int, default 1.
When 0, only the file name is shown (i.e. drive and directory are hidden).
/** wxFileProperty and wxImageFileProperty specific built-in attribute, @c bool,
default @true. When @false, only the file name is shown (i.e. drive and
directory are hidden).
*/
#define wxPG_FILE_SHOW_FULL_PATH wxS("ShowFullPath")
/** Specific to wxFileProperty and derived properties, wxString, default empty.
If set, then the filename is shown relative to the given path string.
/** Built-in attribute specific to wxFileProperty and derived properties,
wxString, default empty. If set, then the filename is shown relative
to the given path string.
*/
#define wxPG_FILE_SHOW_RELATIVE_PATH wxS("ShowRelativePath")
/** Specific to wxFileProperty and derived properties, wxString, default is empty.
Sets the initial path of where to look for files.
/** Built-in attribute specific to wxFileProperty and derived properties,
wxString, default is empty. Sets the initial path of where to look for files.
*/
#define wxPG_FILE_INITIAL_PATH wxS("InitialPath")
/** Specific to wxFileProperty and derivatives, wxString, default is empty.
Sets a specific title for the dir dialog.
/** Built-in attribute specific to wxFileProperty and derivatives, wxString,
default is empty. Sets a specific title for the dir dialog.
*/
#define wxPG_FILE_DIALOG_TITLE wxS("DialogTitle")

View File

@@ -513,8 +513,8 @@ public:
<b>Supported special attributes:</b>
- ::wxPG_FILE_WILDCARD: Sets wildcard (see wxFileDialog for format details),
"All files..." is default.
- ::wxPG_FILE_SHOW_FULL_PATH: Default 1. When 0, only the file name is shown
(i.e. drive and directory are hidden).
- ::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.

View File

@@ -1946,7 +1946,7 @@ wxImageFileProperty::wxImageFileProperty( const wxString& label, const wxString&
const wxString& value )
: wxFileProperty(label,name,value)
{
SetAttribute( wxPG_FILE_WILDCARD, wxPGGetDefaultImageWildcard() );
m_wildcard = wxPGGetDefaultImageWildcard();
m_pImage = NULL;
m_pBitmap = NULL;

View File

@@ -1938,7 +1938,7 @@ wxFileProperty::wxFileProperty( const wxString& label, const wxString& name,
m_flags |= wxPG_PROP_SHOW_FULL_FILENAME;
m_indFilter = -1;
m_dlgStyle = 0;
SetAttribute( wxPG_FILE_WILDCARD, wxALL_FILES);
m_wildcard = wxALL_FILES;
SetValue(value);
}
@@ -2091,8 +2091,6 @@ bool wxFileProperty::StringToValue( wxVariant& variant, const wxString& text, in
bool wxFileProperty::DoSetAttribute( const wxString& name, wxVariant& value )
{
// Return false on some occasions to make sure those attributes will get
// stored in m_attributes.
if ( name == wxPG_FILE_SHOW_FULL_PATH )
{
ChangeFlag(wxPG_PROP_SHOW_FULL_FILENAME, value.GetBool());
@@ -2101,7 +2099,7 @@ bool wxFileProperty::DoSetAttribute( const wxString& name, wxVariant& value )
else if ( name == wxPG_FILE_WILDCARD )
{
m_wildcard = value.GetString();
return false;
return true;
}
else if ( name == wxPG_FILE_SHOW_RELATIVE_PATH )
{
@@ -2109,7 +2107,7 @@ bool wxFileProperty::DoSetAttribute( const wxString& name, wxVariant& value )
// Make sure wxPG_FILE_SHOW_FULL_PATH is also set
m_flags |= wxPG_PROP_SHOW_FULL_FILENAME;
return false;
return true;
}
else if ( name == wxPG_FILE_INITIAL_PATH )
{