Wt examples 4.7.2
|
View class for source code. More...
#include <SourceView.h>
Public Member Functions | |
SourceView (ItemDataRole fileNameRole, ItemDataRole contentRole, ItemDataRole filePathRole) | |
Constructor. More... | |
virtual | ~SourceView () |
Destructor. More... | |
bool | setIndex (const WModelIndex &index) |
Sets the model index. More... | |
virtual std::unique_ptr< WWidget > | renderView () |
Returns the widget that renders the view. More... | |
Private Member Functions | |
std::string | imageExtension (const std::string &fileName) |
Private Attributes | |
WModelIndex | index_ |
The index that is currently displayed. More... | |
Wt::ItemDataRole | fileNameRole_ |
The role that is currently displayed. More... | |
Wt::ItemDataRole | contentRole_ |
Wt::ItemDataRole | filePathRole_ |
std::shared_ptr< WMemoryResource > | imageResource_ |
View class for source code.
A view class is used so that no server-side memory is used while displaying a potentially large file.
Definition at line 28 of file SourceView.h.
SourceView::SourceView | ( | ItemDataRole | fileNameRole, |
ItemDataRole | contentRole, | ||
ItemDataRole | filePathRole | ||
) |
Constructor.
The fileNameRole will be used to retrieve data from a file to be displayed. If no data is set for this role, then contentRole should hold the data as a string.
Definition at line 20 of file SourceView.C.
|
virtual |
|
private |
Definition at line 203 of file SourceView.C.
|
virtual |
Returns the widget that renders the view.
Returns he view contents: renders the file to a WText widget. WViewWidget deletes this widget after every rendering step.
Definition at line 97 of file SourceView.C.
bool SourceView::setIndex | ( | const WModelIndex & | index | ) |
Sets the model index.
Returns true whether the view will be rerendered. The view will only be rerendered if the index contains new data.
Definition at line 32 of file SourceView.C.
|
private |
Definition at line 65 of file SourceView.h.
|
private |
The role that is currently displayed.
Definition at line 64 of file SourceView.h.
|
private |
Definition at line 66 of file SourceView.h.
|
private |
Definition at line 68 of file SourceView.h.
|
private |
The index that is currently displayed.
Definition at line 61 of file SourceView.h.