00001 00014 #ifndef _cImageMainPanel_h 00015 #define _cImageMainPanel_h 00016 00017 #include <wx/panel.h> 00018 #include <wx/image.h> 00019 00020 #include "cFile.h" 00021 00022 #include "cImagePanel.h" 00023 #include "cPreference.h" 00024 00025 #include <string> 00026 using std::string; 00027 00028 00029 // Image handler used. 00030 #define wxUSE_LIBPNG 1 00031 #define wxUSE_LIBJPEG 1 00032 #define wxUSE_LIBTIFF 1 00033 #define wxUSE_GIF 1 00034 #define wxUSE_PCX 1 00035 #define wxUSE_PNM 1 00036 #define wxUSE_XPM 1 00037 #define wxUSE_ICO_CUR 1 00038 00039 class cImageMainPanel: public wxPanel 00040 { 00041 public: 00042 00044 cImageMainPanel(wxWindow *pParent); 00045 00047 ~cImageMainPanel(); 00048 00050 void DisplayPoster(const string sFilename); 00051 00053 void UpdatePosterFileName(cFile *pFile); 00054 00056 Bool IsFileExist(const string sFilename); 00057 00058 protected: 00059 00060 private: 00061 cFile *m_pFile; 00062 00063 cPreference *m_pPreference; 00064 cImagePanel *m_pImagePanel; 00065 wxBoxSizer *m_pImageSizer; 00066 00067 DECLARE_EVENT_TABLE() 00068 00069 00070 const string GetPosterFullPath(const string sFilename); 00071 00073 void DisplayFilePoster(const string sFilePath); 00074 00076 const string GetExtractFileName(const string sFilePath); 00077 00078 /* 00079 * \brief Make a copy of file by copying the WHOLE content of the file into 1 00080 * block of memory and transfer to a new file. 00081 * NOT EFFICIENT WITH BIG FILE. 00082 */ 00083 Bool CopyFile(const string sFrom, const string sTo); 00084 00085 void RescaleImg(wxImage *pImage, const Double iWidth, const Double iHeight); 00086 00087 void AddImageHandler(void); 00088 //----------------------------- 00089 // Event functions 00090 //----------------------------- 00091 void OnDoubleClick(wxMouseEvent& event); 00092 void OnDeletePress(wxKeyEvent& event); 00093 }; 00094 00095 #endif // _cImageMainPanel_h 00096