Wt examples
3.3.0
|
00001 // This may look like C code, but it's really -*- C++ -*- 00002 /* 00003 * Copyright (C) 2009 Emweb bvba 00004 * 00005 * See the LICENSE file for terms of use. 00006 */ 00007 00008 #ifndef SOURCEVIEW_H 00009 #define SOURCEVIEW_H 00010 00011 #include <Wt/WViewWidget> 00012 #include <Wt/WModelIndex> 00013 #include <Wt/WMemoryResource> 00014 00019 00026 class SourceView : public Wt::WViewWidget 00027 { 00028 public: 00035 SourceView(int fileNameRole, int contentRole, int filePathRole); 00036 00039 virtual ~SourceView(); 00040 00046 bool setIndex(const Wt::WModelIndex& index); 00047 00053 virtual Wt::WWidget *renderView(); 00054 00055 private: 00057 Wt::WModelIndex index_; 00058 00060 int fileNameRole_; 00061 int contentRole_; 00062 int filePathRole_; 00063 00064 Wt::WMemoryResource* imageResource_; 00065 00066 private: 00067 std::string imageExtension(const std::string& fileName); 00068 }; 00069 00072 #endif //SOURCEVIEW_H