Wt examples  4.10.4
SourceView.h
Go to the documentation of this file.
1 // This may look like C code, but it's really -*- C++ -*-
2 /*
3  * Copyright (C) 2009 Emweb bv, Herent, Belgium
4  *
5  * See the LICENSE file for terms of use.
6  */
7 
8 #ifndef SOURCEVIEW_H
9 #define SOURCEVIEW_H
10 
11 #include <Wt/WViewWidget.h>
12 #include <Wt/WModelIndex.h>
13 #include <Wt/WMemoryResource.h>
14 
15 using namespace Wt;
16 
21 
28 class SourceView : public WViewWidget
29 {
30 public:
37  SourceView(ItemDataRole fileNameRole,
38  ItemDataRole contentRole,
39  ItemDataRole filePathRole);
40 
43  virtual ~SourceView();
44 
50  bool setIndex(const WModelIndex& index);
51 
57  virtual std::unique_ptr<WWidget> renderView();
58 
59 private:
62 
67 
68  std::shared_ptr<WMemoryResource> imageResource_;
69 
70 private:
71  std::string imageExtension(const std::string& fileName);
72 };
73 
76 #endif //SOURCEVIEW_H
View class for source code.
Definition: SourceView.h:29
Wt::ItemDataRole filePathRole_
Definition: SourceView.h:66
WModelIndex index_
The index that is currently displayed.
Definition: SourceView.h:61
Wt::ItemDataRole fileNameRole_
The role that is currently displayed.
Definition: SourceView.h:64
std::shared_ptr< WMemoryResource > imageResource_
Definition: SourceView.h:68
Wt::ItemDataRole contentRole_
Definition: SourceView.h:65