add support for custom controls in file dialog in wxGTK and generic versions; also allow using generic dialogs in the sample with wxGTK2 (patch 1846837)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52252 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -85,6 +85,9 @@ public:
|
||||
Create(parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name);
|
||||
}
|
||||
|
||||
virtual ~wxFileDialogBase() {}
|
||||
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
const wxString& message = wxFileSelectorPromptStr,
|
||||
const wxString& defaultDir = wxEmptyString,
|
||||
@@ -113,6 +116,17 @@ public:
|
||||
virtual wxString GetWildcard() const { return m_wildCard; }
|
||||
virtual int GetFilterIndex() const { return m_filterIndex; }
|
||||
|
||||
// this function is called with wxFileDialog as parameter and should
|
||||
// create the window containing the extra controls we want to show in it
|
||||
typedef wxWindow *(*ExtraControlCreatorFunction)(wxWindow*);
|
||||
|
||||
// extra controls are currently supported in GTK and generic versions
|
||||
// only currently
|
||||
virtual bool SupportsExtraControl() const { return false; }
|
||||
|
||||
bool SetExtraControlCreator(ExtraControlCreatorFunction WXUNUSED(c));
|
||||
wxWindow *GetExtraControl() const { return m_extraControl; }
|
||||
|
||||
// Utility functions
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_6
|
||||
@@ -137,13 +151,20 @@ protected:
|
||||
wxString m_fileName;
|
||||
wxString m_wildCard;
|
||||
int m_filterIndex;
|
||||
wxWindow* m_extraControl;
|
||||
|
||||
// returns true if control is created (if it already exists returns false)
|
||||
bool CreateExtraControl();
|
||||
|
||||
private:
|
||||
ExtraControlCreatorFunction m_extraControlCreator;
|
||||
|
||||
void Init();
|
||||
DECLARE_DYNAMIC_CLASS(wxFileDialogBase)
|
||||
DECLARE_NO_COPY_CLASS(wxFileDialogBase)
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// wxFileDialog convenience functions
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
@@ -82,6 +82,7 @@ public:
|
||||
{ return m_filectrl->GetWildcard(); }
|
||||
virtual int GetFilterIndex() const
|
||||
{ return m_filectrl->GetFilterIndex(); }
|
||||
virtual bool SupportsExtraControl() const { return true; }
|
||||
|
||||
// implementation only from now on
|
||||
// -------------------------------
|
||||
@@ -113,6 +114,8 @@ protected:
|
||||
|
||||
private:
|
||||
void Init();
|
||||
wxBitmapButton* AddBitmapButton( wxWindowID winId, const wxArtID& artId,
|
||||
const wxString& tip, wxSizer *sizer );
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxGenericFileDialog)
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
@@ -30,8 +30,7 @@ public:
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& sz = wxDefaultSize,
|
||||
const wxString& name = wxFileDialogNameStr);
|
||||
|
||||
virtual ~wxFileDialog() {}
|
||||
virtual ~wxFileDialog() { delete m_extraControl; }
|
||||
|
||||
virtual wxString GetPath() const;
|
||||
virtual void GetPaths(wxArrayString& paths) const;
|
||||
@@ -48,8 +47,8 @@ public:
|
||||
virtual void SetFilterIndex(int filterIndex);
|
||||
|
||||
virtual int ShowModal();
|
||||
virtual bool Show( bool show = true );
|
||||
|
||||
virtual bool SupportsExtraControl() const { return true; }
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user