Wt examples: wt-homepage/SourceView.h Source File

Wt examples 4.10.4

Loading...
Searching...
No Matches
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
15using namespace Wt;
16
21
28 class SourceView : public WViewWidget
29{
30public:
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
59private:
61 WModelIndex index_;
62
64 Wt::ItemDataRole fileNameRole_;
65 Wt::ItemDataRole contentRole_;
66 Wt::ItemDataRole filePathRole_;
67
68 std::shared_ptr<WMemoryResource> imageResource_;
69
70private:
71 std::string imageExtension(const std::string& fileName);
72};
73
76#endif //SOURCEVIEW_H
SourceView
View class for source code.
Definition SourceView.h:29
SourceView::renderView
virtual std::unique_ptr< WWidget > renderView()
Returns the widget that renders the view.
Definition SourceView.C:97
SourceView::filePathRole_
Wt::ItemDataRole filePathRole_
Definition SourceView.h:66
SourceView::index_
WModelIndex index_
The index that is currently displayed.
Definition SourceView.h:61
SourceView::imageExtension
std::string imageExtension(const std::string &fileName)
Definition SourceView.C:203
SourceView::setIndex
bool setIndex(const WModelIndex &index)
Sets the model index.
Definition SourceView.C:32
SourceView::fileNameRole_
Wt::ItemDataRole fileNameRole_
The role that is currently displayed.
Definition SourceView.h:64
SourceView::imageResource_
std::shared_ptr< WMemoryResource > imageResource_
Definition SourceView.h:68
SourceView::SourceView
SourceView(ItemDataRole fileNameRole, ItemDataRole contentRole, ItemDataRole filePathRole)
Constructor.
Definition SourceView.C:20
SourceView::contentRole_
Wt::ItemDataRole contentRole_
Definition SourceView.h:65
SourceView::~SourceView
virtual ~SourceView()
Destructor.
Definition SourceView.C:29
Wt
Definition AddresseeEdit.h:16