From 60d2cc2571b4528aa02d06e80444dc762b41f9f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Fri, 22 Mar 2002 19:20:41 +0000 Subject: [PATCH] use wxArtProvider in wxFileDialog git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14730 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- {include/wx/generic => art}/deffile.xpm | 0 {include/wx/generic => art}/dir_up.xpm | 0 {include/wx/generic => art}/exefile.xpm | 0 {include/wx/generic => art}/folder.xpm | 0 {include/wx/generic => art}/home.xpm | 0 {include/wx/generic => art}/listview.xpm | 0 {include/wx/generic => art}/new_dir.xpm | 0 {include/wx/generic => art}/repview.xpm | 0 include/wx/artprov.h | 8 +++++ src/common/artstd.cpp | 16 +++++++++ src/generic/filedlgg.cpp | 43 ++++++++++-------------- 11 files changed, 42 insertions(+), 25 deletions(-) rename {include/wx/generic => art}/deffile.xpm (100%) rename {include/wx/generic => art}/dir_up.xpm (100%) rename {include/wx/generic => art}/exefile.xpm (100%) rename {include/wx/generic => art}/folder.xpm (100%) rename {include/wx/generic => art}/home.xpm (100%) rename {include/wx/generic => art}/listview.xpm (100%) rename {include/wx/generic => art}/new_dir.xpm (100%) rename {include/wx/generic => art}/repview.xpm (100%) diff --git a/include/wx/generic/deffile.xpm b/art/deffile.xpm similarity index 100% rename from include/wx/generic/deffile.xpm rename to art/deffile.xpm diff --git a/include/wx/generic/dir_up.xpm b/art/dir_up.xpm similarity index 100% rename from include/wx/generic/dir_up.xpm rename to art/dir_up.xpm diff --git a/include/wx/generic/exefile.xpm b/art/exefile.xpm similarity index 100% rename from include/wx/generic/exefile.xpm rename to art/exefile.xpm diff --git a/include/wx/generic/folder.xpm b/art/folder.xpm similarity index 100% rename from include/wx/generic/folder.xpm rename to art/folder.xpm diff --git a/include/wx/generic/home.xpm b/art/home.xpm similarity index 100% rename from include/wx/generic/home.xpm rename to art/home.xpm diff --git a/include/wx/generic/listview.xpm b/art/listview.xpm similarity index 100% rename from include/wx/generic/listview.xpm rename to art/listview.xpm diff --git a/include/wx/generic/new_dir.xpm b/art/new_dir.xpm similarity index 100% rename from include/wx/generic/new_dir.xpm rename to art/new_dir.xpm diff --git a/include/wx/generic/repview.xpm b/art/repview.xpm similarity index 100% rename from include/wx/generic/repview.xpm rename to art/repview.xpm diff --git a/include/wx/artprov.h b/include/wx/artprov.h index c01a5ccd10..9fb5f85fee 100644 --- a/include/wx/artprov.h +++ b/include/wx/artprov.h @@ -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 diff --git a/src/common/artstd.cpp b/src/common/artstd.cpp index e97af0bc4a..fe55f9d2f3 100644 --- a/src/common/artstd.cpp +++ b/src/common/artstd.cpp @@ -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; } diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index 9e43121fbc..4f2629a4fa 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -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 #include -// 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 -- 2.45.2