use wxArtProvider in wxFileDialog

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14730 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2002-03-22 19:20:41 +00:00
parent 546bfbea81
commit 60d2cc2571
11 changed files with 42 additions and 25 deletions

View File

@ -59,10 +59,18 @@ typedef wxString wxArtID;
#define wxART_GO_UP _T("go_up")
#define wxART_GO_DOWN _T("go_down")
#define wxART_GO_TO_PARENT _T("go_to_parent")
#define wxART_GO_HOME _T("go_home")
#define wxART_FILE_OPEN _T("file_open")
#define wxART_PRINT _T("print")
#define wxART_HELP _T("help")
#define wxART_TIP _T("tip")
#define wxART_REPORT_VIEW _T("report_view")
#define wxART_LIST_VIEW _T("list_view")
#define wxART_NEW_DIR _T("new_dir")
#define wxART_FOLDER _T("folder")
#define wxART_GO_DIR_UP _T("go_dir_up")
#define wxART_EXECUTABLE_FILE _T("executable_file")
#define wxART_NORMAL_FILE _T("normal_file")
// ----------------------------------------------------------------------------
// wxArtProvider class

View File

@ -84,6 +84,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxDefaultArtProviderModule, wxModule)
#include "../../art/print.xpm"
#include "../../art/helpicon.xpm"
#include "../../art/tipicon.xpm"
#include "../../art/home.xpm"
#include "../../art/repview.xpm"
#include "../../art/listview.xpm"
#include "../../art/new_dir.xpm"
#include "../../art/folder.xpm"
#include "../../art/dir_up.xpm"
#include "../../art/exefile.xpm"
#include "../../art/deffile.xpm"
#undef static
@ -109,10 +117,18 @@ wxBitmap wxDefaultArtProvider::CreateBitmap(const wxArtID& id,
ART(wxART_GO_UP, up)
ART(wxART_GO_DOWN, down)
ART(wxART_GO_TO_PARENT, toparent)
ART(wxART_GO_HOME, home)
ART(wxART_FILE_OPEN, fileopen)
ART(wxART_PRINT, print)
ART(wxART_HELP, helpicon)
ART(wxART_TIP, tipicon)
ART(wxART_REPORT_VIEW, repview)
ART(wxART_LIST_VIEW, listview)
ART(wxART_NEW_DIR, new_dir)
ART(wxART_FOLDER, folder)
ART(wxART_GO_DIR_UP, dir_up)
ART(wxART_EXECUTABLE_FILE, exefile)
ART(wxART_NORMAL_FILE, deffile)
return wxNullBitmap;
}

View File

@ -46,6 +46,7 @@
#include "wx/config.h"
#include "wx/imaglist.h"
#include "wx/dir.h"
#include "wx/artprov.h"
#if wxUSE_TOOLTIPS
#include "wx/tooltip.h"
@ -69,22 +70,6 @@
# include <time.h>
#include <unistd.h>
// XPM hack: make the arrays const
#define static static const
#ifndef __DOS__
#include "wx/generic/home.xpm"
#endif
#include "wx/generic/listview.xpm"
#include "wx/generic/repview.xpm"
#include "wx/generic/new_dir.xpm"
#include "wx/generic/dir_up.xpm"
#include "wx/generic/folder.xpm"
#include "wx/generic/deffile.xpm"
#include "wx/generic/exefile.xpm"
#undef static
//-----------------------------------------------------------------------------
// wxFileData
//-----------------------------------------------------------------------------
@ -211,11 +196,14 @@ wxFileIconsTable::wxFileIconsTable() :
m_HashTable(wxKEY_STRING)
{
m_HashTable.DeleteContents(TRUE);
m_ImageList.Add(wxBitmap(folder_xpm)); // FI_FOLDER
m_ImageList.Add(wxBitmap(deffile_xpm)); // FI_UNKNOWN
// FI_FOLDER:
m_ImageList.Add(wxArtProvider::GetBitmap(wxART_FOLDER, wxART_CMN_DIALOG));
// FI_UNKNOWN:
m_ImageList.Add(wxArtProvider::GetBitmap(wxART_NORMAL_FILE, wxART_CMN_DIALOG));
// FI_EXECUTABLE:
if (GetIconID(wxEmptyString, _T("application/x-executable")) == FI_UNKNOWN)
{ // FI_EXECUTABLE
m_ImageList.Add(wxBitmap(exefile_xpm));
{
m_ImageList.Add(wxArtProvider::GetBitmap(wxART_EXECUTABLE_FILE, wxART_CMN_DIALOG));
m_HashTable.Delete(_T("exe"));
m_HashTable.Put(_T("exe"), new wxFileIconEntry(FI_EXECUTABLE));
}
@ -1071,13 +1059,15 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
wxBitmapButton *but;
but = new wxBitmapButton( this, ID_LIST_MODE, wxBitmap( listview_xpm ) );
but = new wxBitmapButton(this, ID_LIST_MODE,
wxArtProvider::GetBitmap(wxART_LIST_VIEW, wxART_CMN_DIALOG));
#if wxUSE_TOOLTIPS
but->SetToolTip( _("View files as a list view") );
#endif
buttonsizer->Add( but, 0, wxALL, 5 );
but = new wxBitmapButton( this, ID_REPORT_MODE, wxBitmap( repview_xpm ) );
but = new wxBitmapButton(this, ID_REPORT_MODE,
wxArtProvider::GetBitmap(wxART_REPORT_VIEW, wxART_CMN_DIALOG));
#if wxUSE_TOOLTIPS
but->SetToolTip( _("View files as a detailed view") );
#endif
@ -1086,14 +1076,16 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
buttonsizer->Add( 30, 5, 1 );
wxWindow *butDirUp =
new wxBitmapButton( this, ID_UP_DIR, wxBitmap( dir_up_xpm ) );
new wxBitmapButton(this, ID_UP_DIR,
wxArtProvider::GetBitmap(wxART_GO_DIR_UP, wxART_CMN_DIALOG));
#if wxUSE_TOOLTIPS
butDirUp->SetToolTip( _("Go to parent directory") );
#endif
buttonsizer->Add( butDirUp, 0, wxALL, 5 );
#ifndef __DOS__ // VS: Home directory is meaningless in MS-DOS...
but = new wxBitmapButton( this, ID_PARENT_DIR, wxBitmap(home_xpm) );
but = new wxBitmapButton(this, ID_PARENT_DIR,
wxArtProvider::GetBitmap(wxART_GO_HOME, wxART_CMN_DIALOG));
#if wxUSE_TOOLTIPS
but->SetToolTip( _("Go to home directory") );
#endif
@ -1103,7 +1095,8 @@ wxFileDialog::wxFileDialog(wxWindow *parent,
#endif //!__DOS__
wxWindow *butNewDir =
new wxBitmapButton( this, ID_NEW_DIR, wxBitmap(new_dir_xpm) );
new wxBitmapButton(this, ID_NEW_DIR,
wxArtProvider::GetBitmap(wxART_NEW_DIR, wxART_CMN_DIALOG));
#if wxUSE_TOOLTIPS
butNewDir->SetToolTip( _("Create new directory") );
#endif