My Project
D:/source/c++/Programme/sally/sally/sallyAPI/FileBrowser.h
Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 #pragma once
00029 #include "Define.h"
00030 
00031 #include <algorithm>
00032 #include <shlobj.h>
00033 #include "Form.h"
00034 #include "ListViewExt.h"
00035 #include "ButtonBar.h"
00036 #include "Breadcrumb.h"
00037 #include "StringCompareWithArray.h"
00038 
00039 namespace SallyAPI
00040 {
00041         namespace GUI
00042         {
00048 
00049                 enum CHAR_SELECTOR_COUNT { CHAR_SELECTOR_COUNT_28, CHAR_SELECTOR_COUNT_15, CHAR_SELECTOR_COUNT_OFF};
00050 
00059 
00060                 class DLL_API_SALLY CFileBrowser :
00061                         public SallyAPI::GUI::CForm
00062                 {
00063                 protected:
00064                         static std::string              m_strMyDocument;
00065                         static std::string              m_strMyMusic;
00066                         static std::string              m_strMyVideos;
00067                         static std::string              m_strMyPictures;
00068                         static std::string              m_strMyDesktop;
00069 
00070                         std::vector<std::string>                        m_vFolders;
00071                         std::vector<std::string>                        m_vFiles;
00072                         std::map<std::string, std::string>      m_vFoldersFilesDate;
00073 
00074                         SallyAPI::GUI::CButton*                         m_pButtonAction;
00075                         SallyAPI::GUI::CBreadcrumb*                     m_pBreadcrumb;
00076 
00077                         SallyAPI::GUI::CButtonBar*                      m_pMenu;
00078                         SallyAPI::GUI::CButtonBarButton*        m_pButtonRefreshView;
00079                         SallyAPI::GUI::CButtonBarButton*        m_pButtonGoUp;
00080                         SallyAPI::GUI::CButtonBarButton*        m_pMenuSortName;
00081                         SallyAPI::GUI::CButtonBarButton*        m_pMenuSortDate;
00082 
00083                         SallyAPI::GUI::CListViewExt*            m_pListViewFileWalker;
00084                         SallyAPI::GUI::CButton*                         m_pCharSelector[28];
00085                         int                                                     m_iFolderDepth;
00086                         std::string                                     m_strCurrentFolderName;
00087                         std::vector<std::string>        m_vStartFolders;
00088                         bool                                            m_bShowRemovableDisk;
00089                         std::map<std::string, int>      m_mMimetypeList;
00090                         bool                                            m_bShowSubfolders;
00091                         bool                                            m_bShowHardDisks;
00092                         bool                                            m_bShowSpecialFolders;
00093                         bool                                            m_bShowUnkonwFiles;
00094                         int                                                     m_iActionCommand;
00095                         std::map<int, int>                      m_mListViewPages;
00096                         CHAR_SELECTOR_COUNT                     m_eCharSelectorCount;
00097                         char                                            m_cLastCharSelected;
00098                         bool                                            m_bFolderOpend;
00099 
00100                         int                                                     m_iActionImage;
00101 
00102                         void    SortFiles();
00103 
00104                         void    OnCommandChangeSorting(int reporterId);
00105 
00106                         void    OnCommandItemClicked(SallyAPI::GUI::CGUIBaseObject *reporter, int reporterId, int messageId, SallyAPI::GUI::SendMessage::CParameterBase* messageParameter);
00107                         void    OnCommandActionClicked(SallyAPI::GUI::CGUIBaseObject *reporter, int reporterId, int messageId, SallyAPI::GUI::SendMessage::CParameterBase* messageParameter);
00108                         bool    OnCommandOpenFolder(SallyAPI::GUI::SendMessage::CParameterBase* messageParameter);
00109                         void    OnCommandOpenFolder(std::string& folder);
00110                         void    OnCommandReset();
00111                         void    OnCommandCharSelector(SallyAPI::GUI::CGUIBaseObject* reporter);
00112                         void    OnCommandListviewItemClicked(SallyAPI::GUI::CGUIBaseObject* reporter, int reporterId, int messageId, SallyAPI::GUI::SendMessage::CParameterBase* messageParameter);
00113 
00114                         void    FilewalkerAddFolder(std::string& folder);
00115                 public:
00116                         CFileBrowser(SallyAPI::GUI::CGUIBaseObject* parent, int x, int y, int width, int height, int controlId = 0);
00117                         virtual ~CFileBrowser();
00118 
00119                         void                    SetStartFolders(std::vector<std::string>& startFolders);
00120                         void                    SetShowSpecialFolders(bool showSpecialFolders);
00121                         void                    SetShowRemovableDisk(bool showRemovableDisk);
00122                         void                    SetShowHardDisks(bool showHardDisks);
00123                         void                    SetShowUnkownFiles(bool showUnkonwFiles);
00124                         void                    SetMimetypeList(std::map<std::string, int>& mimetypeList);
00125                         void                    SetShowSubfolders(bool showSubfolders);
00126                         void                    SetActionImageId(int icon);
00127                         void                    SetActionButtonCommand(int command);
00128                         void                    SetActionButtonText(const std::string& text);
00129                         void                    SetActionButtonImage(int icon);
00130                         void                    SetFolder(std::string& folder, int folderDepth = -1);
00131 
00132                         void                    UpdateView();
00133                         void                    Reset();
00134                         void                    ValidateFolder();
00135 
00136                         SallyAPI::GUI::CListViewExt*    GetListView();
00137                         
00138                         virtual void    SendMessageToParent(SallyAPI::GUI::CGUIBaseObject* reporter, int reporterId, int messageId, SallyAPI::GUI::SendMessage::CParameterBase* messageParameter = NULL);
00139                         virtual void    SendMessageToChilds(SallyAPI::GUI::CGUIBaseObject* reporter, int reporterId, int messageId, SallyAPI::GUI::SendMessage::CParameterBase* messageParameter = NULL);
00140 
00141                         std::string             GetCurrentFolder();
00142                         int                             GetCurrentFolderDepth();
00143                 };
00144         }
00145 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines