Hydra 0.20
|
00001 00002 /* 00003 * Copyright (c) 2010 Aleksander B. Demko 00004 * This source code is distributed under the MIT license. 00005 * See the accompanying file LICENSE.MIT.txt for details. 00006 */ 00007 00008 #ifndef __INCLUDED_HYDRADESKTOP_VIEW_H__ 00009 #define __INCLUDED_HYDRADESKTOP_VIEW_H__ 00010 00011 #include <QWidget> 00012 #include <QAbstractItemView> 00013 00014 #include <desktop/FileList.h> 00015 00016 namespace desktop 00017 { 00018 class MainWindow; //fwd 00019 00020 class FileListListener; 00021 class View; 00022 } 00023 00024 class desktop::FileListListener 00025 { 00026 public: 00027 FileListListener(FileList *_filelist); 00028 virtual ~FileListListener(); 00029 00030 /// sometimes called by FileList's destructor (doesn't modify the FileList listener list) 00031 void resetFileList(void); 00032 00033 // may be null, in dtor phases 00034 FileList * fileList(void) const { return dm_filelist; } 00035 00036 /** 00037 * Called when the base changes of the filelist. 00038 * 00039 * This handler does nothing by default. 00040 * 00041 * @author Aleksander Demko 00042 */ 00043 virtual void onBaseChange(FileList *fl); 00044 00045 /** 00046 * Called when the image itself changes 00047 * for the give file entry. 00048 * For now, this is usaully the result of a rotate operation. 00049 * 00050 * This handler does nothing by default. 00051 * 00052 * @author Aleksander Demko 00053 */ 00054 virtual void onImageChange(FileList *fl, int fileIndex); 00055 00056 private: 00057 FileList * dm_filelist; 00058 }; 00059 00060 /** 00061 * A View is a graphical (QWidget) compoenent that can monitor a FileList. 00062 * 00063 * @author Aleksander Demko 00064 */ 00065 class desktop::View : public QWidget, public FileListListener 00066 { 00067 public: 00068 /// constructor 00069 View(FileList *_filelist); 00070 /// newer constructor, if the mainwin pointer needs to be retained 00071 /// if mainwin is null, this acts like the first ctor 00072 View(MainWindow *mainwin, FileList *_filelist); 00073 /// destrctor 00074 virtual ~View(); 00075 00076 // may be null, if one wasn't supplied in the ctor 00077 MainWindow *mainWindow(void) const { return dm_mainwindow; } 00078 00079 protected: 00080 //virtual void contextMenuEvent(QContextMenuEvent * event); 00081 00082 // used by tag-changing views, for convience 00083 // origianlly from TagEditorView2 00084 void setTag(const QString &newtag); 00085 // used by tag-changing views, for convience 00086 // origianlly from TagEditorView2 00087 void unsetTag(const QString &newtag); 00088 00089 private: 00090 MainWindow *dm_mainwindow; 00091 }; 00092 00093 #endif 00094