- wxCreateGreyedImage() deprecated, use wxImage::ConvertToGreyscale() instead.
- wxString::GetWriteBuf() and UngetWriteBuf() deprecated, using wxStringBuffer
or wxStringBufferLength instead.
+- wxDIRCTRL_SHOW_FILTERS style is deprecated, filters are alwsys shown if
+ specified so this style should simply be removed
+
Major new features in this release
----------------------------------
\twocolitem{\indexit{wxDIRCTRL\_DIR\_ONLY}}{Only show directories, and not files.}
\twocolitem{\indexit{wxDIRCTRL\_3D\_INTERNAL}}{Use 3D borders for internal controls.}
\twocolitem{\indexit{wxDIRCTRL\_SELECT\_FIRST}}{When setting the default path, select the first file in the directory.}
-\twocolitem{\indexit{wxDIRCTRL\_SHOW\_FILTERS}}{Show the drop-down filter list.}
\twocolitem{\indexit{wxDIRCTRL\_EDIT\_LABELS}}{Allow the folder and file labels to be editable.}
\end{twocollist}
wxDIRCTRL_DIR_ONLY = 0x0010,
// When setting the default path, select the first file in the directory
wxDIRCTRL_SELECT_FIRST = 0x0020,
- // Show the filter list
+#if WXWIN_COMPATIBILITY_2_8
+ // Unused, for compatibility only
wxDIRCTRL_SHOW_FILTERS = 0x0040,
+#endif // WXWIN_COMPATIBILITY_2_8
// Use 3D borders on internal controls
wxDIRCTRL_3D_INTERNAL = 0x0080,
// Editable labels
wxCheckBox *m_chkDirOnly,
*m_chk3D,
*m_chkFirst,
- *m_chkFilters,
*m_chkLabels;
+ // filters
+ wxCheckBox *m_fltr[3];
private:
DECLARE_EVENT_TABLE()
m_chkDirOnly = CreateCheckBoxAndAddToSizer(sizerUseFlags, _T("wxDIRCTRL_DIR_ONLY"));
m_chk3D = CreateCheckBoxAndAddToSizer(sizerUseFlags, _T("wxDIRCTRL_3D_INTERNAL"));
m_chkFirst = CreateCheckBoxAndAddToSizer(sizerUseFlags, _T("wxDIRCTRL_SELECT_FIRST"));
- m_chkFilters = CreateCheckBoxAndAddToSizer(sizerUseFlags, _T("wxDIRCTRL_SHOW_FILTERS"));
m_chkLabels = CreateCheckBoxAndAddToSizer(sizerUseFlags, _T("wxDIRCTRL_EDIT_LABELS"));
sizerLeft->Add(sizerUseFlags, wxSizerFlags().Expand().Border());
+ wxSizer *sizerFilters =
+ new wxStaticBoxSizer(wxVERTICAL, this, _T("&Filters"));
+ m_fltr[0] = CreateCheckBoxAndAddToSizer(sizerFilters, wxString::Format(wxT("all files (%s)|%s"),
+ wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr));
+ m_fltr[1] = CreateCheckBoxAndAddToSizer(sizerFilters, wxT("C++ files (*.cpp; *.h)|*.cpp;*.h"));
+ m_fltr[2] = CreateCheckBoxAndAddToSizer(sizerFilters, wxT("PNG images (*.png)|*.png"));
+ sizerLeft->Add(sizerFilters, wxSizerFlags().Expand().Border());
+
wxButton *btn = new wxButton(this, DirCtrlPage_Reset, _T("&Reset"));
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
( m_chkDirOnly->IsChecked() ? wxDIRCTRL_DIR_ONLY : 0 ) |
( m_chk3D->IsChecked() ? wxDIRCTRL_3D_INTERNAL : 0 ) |
( m_chkFirst->IsChecked() ? wxDIRCTRL_SELECT_FIRST : 0 ) |
- ( m_chkFilters->IsChecked() ? wxDIRCTRL_SHOW_FILTERS : 0 ) |
( m_chkLabels->IsChecked() ? wxDIRCTRL_EDIT_LABELS : 0 )
);
+ wxString filter;
+ for (int i = 0; i < 3; ++i)
+ {
+ if (m_fltr[i]->IsChecked())
+ {
+ if (!filter.IsEmpty())
+ filter += wxT("|");
+ filter += m_fltr[i]->GetLabel();
+ }
+ }
+ dirCtrl->SetFilter(filter);
+
// update sizer's child window
GetSizer()->Replace(m_dirCtrl, dirCtrl, true);
wxFLAGS_MEMBER(wxDIRCTRL_DIR_ONLY)
wxFLAGS_MEMBER(wxDIRCTRL_3D_INTERNAL)
wxFLAGS_MEMBER(wxDIRCTRL_SELECT_FIRST)
- wxFLAGS_MEMBER(wxDIRCTRL_SHOW_FILTERS)
wxEND_FLAGS( wxGenericDirCtrlStyle )
else
treeStyle |= wxBORDER_SUNKEN;
- long filterStyle = 0;
- if ((style & wxDIRCTRL_3D_INTERNAL) == 0)
- filterStyle |= wxNO_BORDER;
- else
- filterStyle |= wxBORDER_SUNKEN;
-
m_treeCtrl = CreateTreeCtrl(this, wxID_TREECTRL,
wxPoint(0,0), GetClientSize(), treeStyle);
- if (!filter.empty() && (style & wxDIRCTRL_SHOW_FILTERS))
- m_filterListCtrl = new wxDirFilterListCtrl(this, wxID_FILTERLISTCTRL, wxDefaultPosition, wxDefaultSize, filterStyle);
+ if (!filter.empty())
+ m_filterListCtrl = new wxDirFilterListCtrl(this, wxID_FILTERLISTCTRL);
m_defaultPath = dir;
m_filter = filter;
if (m_filter.empty())
-#ifdef __UNIX__
- m_filter = wxT("*");
-#else
- m_filter = wxT("*.*");
-#endif
+ m_filter = wxFileSelectorDefaultWildcardStr;
SetFilterIndex(defaultFilter);
{
m_filter = filter;
+ if (!filter.empty() && !m_filterListCtrl)
+ m_filterListCtrl = new wxDirFilterListCtrl(this, wxID_FILTERLISTCTRL);
+ else if (filter.empty() && m_filterListCtrl)
+ {
+ m_filterListCtrl->Destroy();
+ m_filterListCtrl = NULL;
+ }
+
wxString f, d;
if (ExtractWildcard(m_filter, m_currentFilter, f, d))
m_currentFilterStr = f;
#else
m_currentFilterStr = wxT("*.*");
#endif
+ // current filter index is meaningless after filter change, set it to zero
+ SetFilterIndex(0);
+ if (m_filterListCtrl)
+ m_filterListCtrl->FillFilterList(m_filter, 0);
}
// Extract description and actual filter from overall filter string
EVT_CHOICE(wxID_ANY, wxDirFilterListCtrl::OnSelFilter)
END_EVENT_TABLE()
-bool wxDirFilterListCtrl::Create(wxGenericDirCtrl* parent, const wxWindowID id,
- const wxPoint& pos,
- const wxSize& size,
- long style)
+bool wxDirFilterListCtrl::Create(wxGenericDirCtrl* parent,
+ const wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ long style)
{
m_dirCtrl = parent;
+
+ // by default our border style is determined by the style of our parent
+ if ( !(style & wxBORDER_MASK) )
+ {
+ style |= parent->HasFlag(wxDIRCTRL_3D_INTERNAL) ? wxBORDER_SUNKEN
+ : wxBORDER_NONE;
+ }
+
return wxChoice::Create(parent, id, pos, size, 0, NULL, style);
}
XRC_ADD_STYLE(wxDIRCTRL_DIR_ONLY);
XRC_ADD_STYLE(wxDIRCTRL_3D_INTERNAL);
XRC_ADD_STYLE(wxDIRCTRL_SELECT_FIRST);
- XRC_ADD_STYLE(wxDIRCTRL_SHOW_FILTERS);
XRC_ADD_STYLE(wxDIRCTRL_EDIT_LABELS);
AddWindowStyles();
}