Wt
4.11.1
|
An abstract base class for item Views. More...
#include <Wt/WAbstractItemView.h>
Public Member Functions | |
virtual void | setModel (const std::shared_ptr< WAbstractItemModel > &model) |
Sets the model. More... | |
std::shared_ptr< WAbstractItemModel > | model () const |
Returns the model. More... | |
void | setRootIndex (const WModelIndex &rootIndex) |
Sets the root index. More... | |
const WModelIndex & | rootIndex () const |
Returns the root index. More... | |
void | setItemDelegate (const std::shared_ptr< WAbstractItemDelegate > &delegate) |
Sets the default item delegate. More... | |
std::shared_ptr< WAbstractItemDelegate > | itemDelegate () const |
Returns the default item delegate. More... | |
void | setItemDelegateForColumn (int column, const std::shared_ptr< WAbstractItemDelegate > &delegate) |
Sets the delegate for a column. More... | |
std::shared_ptr< WAbstractItemDelegate > | itemDelegateForColumn (int column) const |
Returns the delegate that was set for a column. More... | |
std::shared_ptr< WAbstractItemDelegate > | itemDelegate (const WModelIndex &index) const |
Returns the delegate for rendering an item. More... | |
std::shared_ptr< WAbstractItemDelegate > | itemDelegate (int column) const |
Returns the delegate for a column. More... | |
virtual WWidget * | itemWidget (const WModelIndex &index) const =0 |
Returns the widget that renders an item. More... | |
void | setHeaderItemDelegate (const std::shared_ptr< WAbstractItemDelegate > &delegate) |
Sets the header item delegate. More... | |
std::shared_ptr< WAbstractItemDelegate > | headerItemDelegate () const |
Returns the header item delegate. More... | |
virtual void | setColumnAlignment (int column, AlignmentFlag alignment) |
Sets the content alignment for a column. More... | |
virtual AlignmentFlag | columnAlignment (int column) const |
Returns the content alignment for a column. More... | |
virtual void | setHeaderAlignment (int column, WFlags< AlignmentFlag > alignment) |
Sets the header alignment for a column. More... | |
AlignmentFlag | horizontalHeaderAlignment (int column) const |
Returns the horizontal header alignment for a column. More... | |
AlignmentFlag | verticalHeaderAlignment (int column) const |
Returns the vertical header alignment for a column. More... | |
void | setHeaderWordWrap (int column, bool enabled) |
Configures header text wrapping. More... | |
virtual void | setAlternatingRowColors (bool enable) |
Sets if alternating row colors are to be used. More... | |
virtual bool | alternatingRowColors () const |
Returns whether alternating row colors are used. More... | |
void | sortByColumn (int column, SortOrder order) |
Sorts the data according to a column. More... | |
int | sortColumn () const |
Returns the current sorting columm. More... | |
SortOrder | sortOrder () const |
Returns the current sorting order. More... | |
void | setSortingEnabled (bool enabled) |
Enables or disables sorting for all columns. More... | |
void | setSortingEnabled (int column, bool enabled) |
Enables or disables sorting for a single column. More... | |
bool | isSortingEnabled () const |
Returns whether sorting is enabled. More... | |
bool | isSortingEnabled (int column) const |
Returns whether sorting is enabled for a single column. More... | |
void | setColumnResizeEnabled (bool enabled) |
Enables interactive column resizing. More... | |
void | setColumnResizeEnabled (bool enabled, int column) |
Enables interactive column resizing. More... | |
bool | isColumnResizeEnabled () const |
Returns whether column resizing is enabled for new columns. More... | |
bool | isColumnResizeEnabled (int column) const |
Returns whether column resizing is enabled for a single column. More... | |
void | setSelectionBehavior (SelectionBehavior behavior) |
Changes the selection behaviour. More... | |
SelectionBehavior | selectionBehavior () const |
Returns the selection behaviour. More... | |
void | setSelectionMode (SelectionMode mode) |
Sets the selection mode. More... | |
SelectionMode | selectionMode () const |
Returns the selection mode. More... | |
WItemSelectionModel * | selectionModel () const |
Returns the selection model. More... | |
void | setSelectedIndexes (const WModelIndexSet &indexes) |
Sets the selected items. More... | |
void | clearSelection () |
Clears the selection. More... | |
void | select (const WModelIndex &index, SelectionFlag option=SelectionFlag::Select) |
Selects a single item. More... | |
bool | isSelected (const WModelIndex &index) const |
Returns wheter an item is selected. More... | |
WModelIndexSet | selectedIndexes () const |
Returns the set of selected items. More... | |
void | setDragEnabled (bool enable) |
Enables the selection to be dragged (drag & drop). More... | |
void | setDropsEnabled (bool enable) |
Enables drop operations (drag & drop). More... | |
void | setEnabledDropLocations (WFlags< DropLocation > droplocation) |
Enables drop operations (drag & drop). More... | |
WFlags< DropLocation > | enabledDropLocations () const |
Returns the enabled drop locations. | |
virtual void | setRowHeight (const WLength &rowHeight) |
Sets the row height. More... | |
const WLength & | rowHeight () const |
Returns the row height. | |
virtual void | setColumnWidth (int column, const WLength &width)=0 |
Sets the column width. More... | |
WLength | columnWidth (int column) const |
Returns the column width. More... | |
virtual void | setColumnHidden (int column, bool hide) |
Changes the visibility of a column. More... | |
bool | isColumnHidden (int column) const |
Returns if a column is hidden. More... | |
void | hideColumn (int column) |
Hides a column. More... | |
void | showColumn (int column) |
Shows a column. More... | |
virtual void | setHeaderHeight (const WLength &height) |
Sets the header height. More... | |
const WLength & | headerHeight () const |
Returns the header height. More... | |
virtual int | pageCount () const =0 |
Returns the number of pages. More... | |
virtual int | pageSize () const =0 |
Returns the page size. More... | |
virtual int | currentPage () const =0 |
Returns the current page. More... | |
virtual void | setCurrentPage (int page)=0 |
Sets the current page. More... | |
virtual void | scrollTo (const WModelIndex &index, ScrollHint hint=ScrollHint::EnsureVisible)=0 |
Scrolls the view to an item. More... | |
void | setEditTriggers (WFlags< EditTrigger > editTriggers) |
Configures what actions should trigger editing. More... | |
WFlags< EditTrigger > | editTriggers () const |
Returns the editing triggers. More... | |
void | setEditOptions (WFlags< EditOption > options) |
Configures editing options. More... | |
WFlags< EditOption > | editOptions () const |
Returns the editing options. More... | |
void | edit (const WModelIndex &index) |
Opens an editor for the given index. More... | |
void | closeEditor (const WModelIndex &index, bool saveData=true) |
Closes the editor for the given index. More... | |
void | closeEditors (bool saveData=true) |
Closes all open editors. More... | |
ValidationState | validateEditor (const WModelIndex &index) |
Validates the editor for the given index. More... | |
ValidationState | validateEditors () |
Validates all editors. More... | |
bool | isEditing (const WModelIndex &index) const |
Returns whether an editor is open for a given index. More... | |
bool | isValid (const WModelIndex &index) const |
Returns whether an editor's state is valid. | |
Signal< WModelIndex, WMouseEvent > & | clicked () |
Signal emitted when clicked. More... | |
Signal< WModelIndex, WMouseEvent > & | doubleClicked () |
Signal emitted when double clicked. More... | |
Signal< WModelIndex, WMouseEvent > & | mouseWentDown () |
Signal emitted when a mouse button is pressed down. More... | |
Signal< WModelIndex, WMouseEvent > & | mouseWentUp () |
Signal emitted when the mouse button is released. More... | |
Signal< WModelIndex, WTouchEvent > & | touchStart () |
Signal emitted when a finger is placed on the screen. More... | |
Signal< std::vector< WModelIndex >, WTouchEvent > & | touchStarted () |
Signal emitted when one or more fingers are placed on the screen. More... | |
Signal< std::vector< WModelIndex >, WTouchEvent > & | touchMoved () |
Signal emitted when one or more fingers are moved on the screen. More... | |
Signal< std::vector< WModelIndex >, WTouchEvent > & | touchEnded () |
Signal emitted when one or more fingers are removed from the screen. More... | |
Signal & | selectionChanged () |
Signal emitted when the selection is changed. More... | |
Signal & | pageChanged () |
Signal emitted when page information was updated. More... | |
Signal< int, WLength > & | columnResized () |
Returns the signal emitted when a column is resized by the user. More... | |
bool | sortEnabled () |
Returns whether the view is sortable. More... | |
void | setHeaderClickSortEnabled (bool enabled) |
Alow to sort. More... | |
Signal< int, WMouseEvent > & | headerClicked () |
Signal emitted when a header item is clicked. More... | |
Signal< int, WMouseEvent > & | headerDoubleClicked () |
Signal emitted when a header item is double clicked. More... | |
Signal< int, WMouseEvent > & | headerMouseWentDown () |
Signal emitted when a mouse button is pressed on a header item More... | |
Signal< int, WMouseEvent > & | headerMouseWentUp () |
Signal emitted when a mouse button is released on a header item More... | |
virtual EventSignal< WScrollEvent > & | scrolled ()=0 |
Signal emitted when scrolling. More... | |
virtual void | setRowHeaderCount (int count) |
Configures the number of columns that are used as row headers. More... | |
int | rowHeaderCount () const |
Returns the number of columns that are used as row headers. More... | |
EventSignal< WKeyEvent > & | keyWentDown () |
Event signal emitted when a keyboard key is pushed down. More... | |
EventSignal< WKeyEvent > & | keyPressed () |
Event signal emitted when a "character" was entered. More... | |
EventSignal< WKeyEvent > & | keyWentUp () |
Event signal emitted when a keyboard key is released. More... | |
Public Member Functions inherited from Wt::WCompositeWidget | |
WCompositeWidget () | |
Creates a WCompositeWidget. More... | |
WCompositeWidget (std::unique_ptr< WWidget > implementation) | |
Creates a WCompositeWidget with given implementation. More... | |
virtual std::vector< WWidget * > | children () const override |
Returns child widgets. More... | |
virtual std::unique_ptr< WWidget > | removeWidget (WWidget *widget) override |
Removes a child widget. | |
virtual void | setObjectName (const std::string &name) override |
Sets an object name. More... | |
virtual std::string | objectName () const override |
Returns the object name. More... | |
virtual const std::string | id () const override |
Returns the (unique) identifier for this object. More... | |
virtual void | setPositionScheme (PositionScheme scheme) override |
Sets the CSS position scheme. More... | |
virtual PositionScheme | positionScheme () const override |
Returns the CSS position scheme. More... | |
virtual void | setOffsets (const WLength &offset, WFlags< Side > sides=AllSides) override |
Sets CSS offsets for a non-statically positioned widget. More... | |
virtual WLength | offset (Side s) const override |
Returns a CSS offset. More... | |
virtual void | resize (const WLength &width, const WLength &height) override |
Resizes the widget. More... | |
virtual WLength | width () const override |
Returns the width. More... | |
virtual WLength | height () const override |
Returns the height. More... | |
virtual void | setMinimumSize (const WLength &width, const WLength &height) override |
Sets a minimum size. More... | |
virtual WLength | minimumWidth () const override |
Returns the minimum width. More... | |
virtual WLength | minimumHeight () const override |
Returns the minimum height. More... | |
virtual void | setMaximumSize (const WLength &width, const WLength &height) override |
Sets a maximum size. More... | |
virtual WLength | maximumWidth () const override |
Returns the maximum width. More... | |
virtual WLength | maximumHeight () const override |
Returns the maximum height. More... | |
virtual void | setLineHeight (const WLength &height) override |
Sets the CSS line height for contained text. | |
virtual WLength | lineHeight () const override |
Returns the CSS line height for contained text. More... | |
virtual void | setFloatSide (Side s) override |
Specifies a CSS float side. More... | |
virtual Side | floatSide () const override |
Returns the CSS float side. More... | |
virtual void | setClearSides (WFlags< Side > sides) override |
Sets the sides that should be cleared of floats. More... | |
virtual WFlags< Side > | clearSides () const override |
Returns the sides that should remain empty. More... | |
virtual void | setMargin (const WLength &margin, WFlags< Side > sides=AllSides) override |
Sets CSS margins around the widget. More... | |
virtual WLength | margin (Side side) const override |
Returns a CSS margin set. More... | |
virtual void | setHiddenKeepsGeometry (bool enabled) override |
Sets whether the widget keeps its geometry when hidden. More... | |
virtual bool | hiddenKeepsGeometry () const override |
Returns whether the widget keeps its geometry when hidden. More... | |
virtual void | setHidden (bool hidden, const WAnimation &animation=WAnimation()) override |
Hides or shows the widget. More... | |
virtual bool | isHidden () const override |
Returns whether the widget is set hidden. More... | |
virtual bool | isVisible () const override |
Returns whether the widget is visible. More... | |
virtual void | setDisabled (bool disabled) override |
Sets whether the widget is disabled. More... | |
virtual bool | isDisabled () const override |
Returns whether the widget is set disabled. More... | |
virtual bool | isEnabled () const override |
Returns whether the widget is enabled. More... | |
virtual void | setPopup (bool popup) override |
Lets the widget overlay over other sibling widgets. More... | |
virtual bool | isPopup () const override |
Returns whether the widget is overlayed. More... | |
virtual void | setInline (bool isInline) override |
Sets whether the widget is displayed inline or as a block. More... | |
virtual bool | isInline () const override |
Returns whether the widget is displayed inline or as block. More... | |
virtual void | setDecorationStyle (const WCssDecorationStyle &style) override |
Sets a CSS decoration style. More... | |
virtual WCssDecorationStyle & | decorationStyle () override |
Returns the decoration style of this widget. More... | |
virtual void | setStyleClass (const WString &styleClass) override |
Sets (one or more) CSS style classes. More... | |
virtual WString | styleClass () const override |
Returns the CSS style class. More... | |
virtual void | addStyleClass (const WString &styleClass, bool force=false) override |
Adds a CSS style class. More... | |
virtual void | removeStyleClass (const WString &styleClass, bool force=false) override |
Removes a CSS style class. More... | |
virtual bool | hasStyleClass (const WString &styleClass) const override |
Returns whether the widget has a style class. | |
virtual void | setVerticalAlignment (AlignmentFlag alignment, const WLength &length=WLength::Auto) override |
Sets the vertical alignment. More... | |
virtual AlignmentFlag | verticalAlignment () const override |
Returns the vertical alignment. More... | |
virtual WLength | verticalAlignmentLength () const override |
Returns the fixed vertical alignment that was set. More... | |
virtual void | setToolTip (const WString &text, TextFormat textFormat=TextFormat::Plain) override |
Sets a tooltip. More... | |
virtual WString | toolTip () const override |
Returns the tooltip. | |
virtual void | setDeferredToolTip (bool enable, TextFormat textFormat=TextFormat::Plain) override |
Enable deferred tooltip. More... | |
virtual void | refresh () override |
Refresh the widget. More... | |
virtual void | setAttributeValue (const std::string &name, const WString &value) override |
Sets an attribute value. More... | |
virtual WString | attributeValue (const std::string &name) const override |
Returns an attribute value. More... | |
virtual void | setJavaScriptMember (const std::string &name, const std::string &value) override |
Sets a JavaScript member. More... | |
virtual std::string | javaScriptMember (const std::string &name) const override |
Returns the value of a JavaScript member. More... | |
virtual void | callJavaScriptMember (const std::string &name, const std::string &args) override |
Calls a JavaScript member. More... | |
virtual void | load () override |
Loads content just before the widget is used. More... | |
virtual bool | loaded () const override |
Returns whether this widget has been loaded. More... | |
virtual void | setCanReceiveFocus (bool enabled) override |
Sets whether the widget can receive focus. More... | |
virtual bool | canReceiveFocus () const override |
Returns whether the widget can receive focus. More... | |
virtual void | setFocus (bool focus) override |
Sets focus. More... | |
virtual bool | setFirstFocus () override |
Set focus on the widget's first descendant. More... | |
virtual bool | hasFocus () const override |
Returns whether the widget currently has the focus. | |
virtual void | setTabIndex (int index) override |
Sets the tab index. More... | |
virtual int | tabIndex () const override |
Returns the tab index. More... | |
virtual void | setId (const std::string &id) override |
Sets the CSS Id. More... | |
virtual WWidget * | find (const std::string &name) override |
Finds a descendent widget by name. More... | |
virtual WWidget * | findById (const std::string &name) override |
Finds a descendent widget by id. | |
virtual void | setSelectable (bool selectable) override |
Sets as selectable. More... | |
virtual void | doJavaScript (const std::string &js) override |
Executes the given JavaScript statements when the widget is rendered or updated. More... | |
virtual void | propagateSetEnabled (bool enabled) override |
Propagates that a widget was enabled or disabled through children. More... | |
virtual bool | scrollVisibilityEnabled () const final override |
Returns whether scroll visibility detection is enabled for this widget. More... | |
virtual void | setScrollVisibilityEnabled (bool enabled) final override |
Sets whether scroll visibility detection is enabled for this widget. More... | |
virtual int | scrollVisibilityMargin () const final override |
Returns the margin around the viewport within which the widget is considered visible. More... | |
virtual void | setScrollVisibilityMargin (int margin) final override |
Sets the margin around the viewport within which the widget is considered visible. More... | |
virtual Signal< bool > & | scrollVisibilityChanged () final override |
Signal triggered when the scroll visibility of this widget changes. More... | |
virtual bool | isScrollVisible () const final override |
Returns whether this widget is currently considered scroll visible. More... | |
virtual void | setThemeStyleEnabled (bool enabled) final override |
Sets whether theme styling for a widget is enabled or disabled. More... | |
virtual bool | isThemeStyleEnabled () const final override |
Returns whether this widget is currently styled by the chosen theme. More... | |
virtual std::unique_ptr< WWidget > | removeWidget (WWidget *widget) |
Removes a child widget. | |
template<typename Widget > | |
std::unique_ptr< Widget > | removeWidget (Widget *widget) |
Removes a child widget. More... | |
void | setFocus () |
Sets focus. More... | |
virtual void | setFocus (bool focus)=0 |
Sets focus. More... | |
Public Member Functions inherited from Wt::WWidget | |
virtual | ~WWidget () |
Destructor. More... | |
WWidget * | parent () const |
Returns the parent widget. | |
template<typename Widget > | |
std::unique_ptr< Widget > | removeWidget (Widget *widget) |
Removes a child widget. More... | |
std::unique_ptr< WWidget > | removeFromParent () |
Removes the widget from its parent. More... | |
void | setWidth (const WLength &width) |
Sets the width. More... | |
void | setHeight (const WLength &height) |
Sets the height. More... | |
virtual void | positionAt (const WWidget *widget, Orientation orientation=Orientation::Vertical) |
Positions a widget next to another widget. More... | |
virtual void | toggleStyleClass (const WString &styleClass, bool add, bool force=false) |
Toggles a CSS style class. | |
std::string | jsRef () const |
Returns a JavaScript expression to the corresponding DOM node. More... | |
void | setFocus () |
Sets focus. More... | |
virtual void | acceptDrops (const std::string &mimeType, const WString &hoverStyleClass=WString()) |
Sets a mime type to be accepted for dropping. More... | |
virtual void | stopAcceptDrops (const std::string &mimeType) |
Indicates that a mime type is no longer accepted for dropping. More... | |
virtual void | htmlText (std::ostream &out) |
Streams the (X)HTML representation. More... | |
bool | isRendered () const |
Returns whether the widget is rendered. More... | |
void | hide () |
Hides the widget. More... | |
void | animateHide (const WAnimation &animation) |
Hides the widget using an animation. More... | |
void | show () |
Shows the widget. More... | |
void | animateShow (const WAnimation &animation) |
Shows the widget using an animation. More... | |
void | enable () |
Enables the widget. More... | |
void | disable () |
Disable thes widget. More... | |
bool | layoutSizeAware () const |
Returns whether the widget is layout size aware. More... | |
Public Member Functions inherited from Wt::WObject | |
void | addChild (std::unique_ptr< WObject > child) |
Add a child WObject whose lifetime is determined by this WObject. | |
template<typename Child > | |
Child * | addChild (std::unique_ptr< Child > child) |
Add a child WObject, returning a raw pointer. More... | |
std::unique_ptr< WObject > | removeChild (WObject *child) |
Remove a child WObject, so its lifetime is no longer determined by this WObject. | |
template<typename Child > | |
std::unique_ptr< Child > | removeChild (Child *child) |
Remove a child WObject, so its lifetime is no longer determined by this WObject. More... | |
void | resetLearnedSlots () |
Resets learned stateless slot implementations. More... | |
template<class T > | |
void | resetLearnedSlot (void(T::*method)()) |
Resets a learned stateless slot implementation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)()) |
Declares a slot to be stateless and learn client-side behaviour on first invocation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)()) |
Declares a slot to be stateless and learn client-side behaviour in advance. More... | |
void | isNotStateless () |
Marks the current function as not stateless. More... | |
template<class T > | |
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode) |
Provides a JavaScript implementation for a method. More... | |
Public Member Functions inherited from Wt::Core::observable | |
observable () noexcept | |
Default constructor. | |
virtual | ~observable () |
Destructor. More... | |
template<typename... Args, typename C > | |
auto | bindSafe (void(C::*method)(Args...)) noexcept |
Protects a method call against object destruction. More... | |
template<typename... Args, typename C > | |
auto | bindSafe (void(C::*method)(Args...) const) const noexcept |
Protects a const method call against object destruction. More... | |
template<typename Function > | |
auto | bindSafe (const Function &function) noexcept |
Protects a function against object destruction. More... | |
Protected Member Functions | |
WAbstractItemView () | |
Creates a new item view. | |
virtual void | dropEvent (const WDropEvent &event, const WModelIndex &target) |
Handles a drop event (drag & drop). More... | |
virtual void | dropEvent (const WDropEvent &event, const WModelIndex &index, Wt::Side side) |
Handles a drop event (drag & drop). More... | |
virtual std::unique_ptr< WWidget > | createExtraHeaderWidget (int column) |
Create an extra widget in the header. More... | |
WWidget * | extraHeaderWidget (int column) |
Returns the extra header widget. More... | |
virtual std::unique_ptr< WWidget > | createPageNavigationBar () |
Returns a page navigation widget. More... | |
virtual void | handleClick (const WModelIndex &index, const WMouseEvent &event) |
Handles a click event. More... | |
virtual void | handleDoubleClick (const WModelIndex &index, const WMouseEvent &event) |
Handles a double click event. More... | |
virtual void | handleMouseDown (const WModelIndex &index, const WMouseEvent &event) |
Handles a mouse down event. More... | |
virtual void | handleMouseUp (const WModelIndex &index, const WMouseEvent &event) |
Handles a mouse up event. More... | |
virtual void | handleTouchSelect (const std::vector< WModelIndex > &indices, const WTouchEvent &event) |
Handles a touch select event. | |
virtual void | handleTouchStart (const std::vector< WModelIndex > &indices, const WTouchEvent &event) |
Handles a touch started event. | |
virtual void | handleTouchMove (const std::vector< WModelIndex > &indices, const WTouchEvent &event) |
Handles a touch moved event. | |
virtual void | handleTouchEnd (const std::vector< WModelIndex > &indices, const WTouchEvent &event) |
Handles a touch ended event. | |
virtual void | enableAjax () override |
Progresses to an Ajax-enabled widget. More... | |
virtual void | dropEvent (WDropEvent dropEvent) |
Handles a drop event. More... | |
Protected Member Functions inherited from Wt::WCompositeWidget | |
void | setImplementation (std::unique_ptr< WWidget > widget) |
Set the implementation widget. More... | |
template<typename Widget > | |
Widget * | setImplementation (std::unique_ptr< Widget > widget) |
Sets the implementation widget, returning a raw pointer. More... | |
template<typename W , typename... Args> | |
W * | setNewImplementation (Args &&... args) |
Creates the implementation widget and sets it, returning a raw pointer. More... | |
WWidget * | implementation () |
Get the implementation widget. More... | |
virtual int | boxPadding (Orientation orientation) const override |
Returns the widget's built-in padding. More... | |
virtual int | boxBorder (Orientation orientation) const override |
Returns the widget's built-in border width. More... | |
virtual void | render (WFlags< RenderFlag > flags) override |
Renders the widget. More... | |
Protected Member Functions inherited from Wt::WWidget | |
void | setLayoutSizeAware (bool sizeAware) |
Sets the widget to be aware of its size set by a layout manager. More... | |
virtual void | layoutSizeChanged (int width, int height) |
Virtual method that indicates a size change. More... | |
WWidget () | |
Creates a widget. | |
virtual void | dropEvent (WDropEvent dropEvent) |
Handles a drop event. More... | |
void | scheduleRender (WFlags< RepaintFlag > flags=None) |
Schedules rerendering of the widget. More... | |
virtual WStatelessSlot * | getStateless (Method method) override |
On-demand stateless slot implementation. More... | |
Additional Inherited Members | |
Public Types inherited from Wt::WObject | |
typedef void(WObject::* | Method) () |
Typedef for a WObject method without arguments. | |
Static Public Member Functions inherited from Wt::WWidget | |
static WString | tr (const char *key) |
Short hand for WString::tr() More... | |
An abstract base class for item Views.
See WTableView or WTreeView for a description.
The strings used in this class can be translated by overriding the default values for the following localization keys:
|
virtual |
Returns whether alternating row colors are used.
When enabled, rows are displayed in alternating row colors, according to the current theme's definition.
void Wt::WAbstractItemView::clearSelection | ( | ) |
Clears the selection.
Signal<WModelIndex, WMouseEvent>& Wt::WAbstractItemView::clicked | ( | ) |
Signal emitted when clicked.
When the event happened over an item, the first argument indicates the item that was clicked on.
void Wt::WAbstractItemView::closeEditor | ( | const WModelIndex & | index, |
bool | saveData = true |
||
) |
Closes the editor for the given index.
If saveData
is true, then the currently edited value is saved first to the model.
void Wt::WAbstractItemView::closeEditors | ( | bool | saveData = true | ) |
Closes all open editors.
If saveData
is true, then the currently edited values are saved to the model before closing the editor.
|
virtual |
Returns the content alignment for a column.
Returns the signal emitted when a column is resized by the user.
The arguments of the signal are: the column index and the new width of the column.
WLength Wt::WAbstractItemView::columnWidth | ( | int | column | ) | const |
Returns the column width.
|
protectedvirtual |
Create an extra widget in the header.
You may reimplement this method to provide an extra widget to be placed below the header label. The extra widget will be visible only if a multi-line header is configured using setHeaderHeight().
The widget is created only once, but this method may be called repeatedly for a column for which prior calls returned 0
(i.e. each time the header is rerendered).
The default implementation returns 0
.
|
protectedvirtual |
Returns a page navigation widget.
When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data, created by this method. The default implementation displays a simple navigation bar with (First, Prevous, Next, Last) buttons and a page counter.
You may want to reimplement this method to provide a custom page navigation bar. You can use the currentPage(), pageCount(), and setCurrentPage() methods to set or get the page information, and listen to the pageChanged() signal to react to changes.
|
pure virtual |
Returns the current page.
When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This returns the current page (between 0 and pageCount() - 1).
Implemented in Wt::WTreeView, and Wt::WTableView.
Signal<WModelIndex, WMouseEvent>& Wt::WAbstractItemView::doubleClicked | ( | ) |
Signal emitted when double clicked.
When the event happened over an item, the first argument indicates the item that was double clicked on.
|
protectedvirtual |
Handles a drop event (drag & drop).
The event
object contains details about the drop operation, identifying the source (which provides the data) and the mime-type of the data. The drop was received relative to the index
item and the side
parameter will only be Wt::Top or Wt::Bottom.
A drop below the lowest item or on an empty view will result in a call to this method with an invalid index and side Wt::Bottom.
The drop event can be handled either by the view itself, or by the model. The default implementation checks if the mime-type is accepted by the model, and if so passes the drop event to the model as a DropAction::Move.
|
protectedvirtual |
Handles a drop event (drag & drop).
The event
object contains details about the drop operation, identifying the source (which provides the data) and the mime-type of the data. The drop was received on the target
item.
The drop event can be handled either by the view itself, or by the model. The default implementation checks if the mime-type is accepted by the model, and if so passes the drop event to the model. If the source is the view's own selection model, then the drop event will be handled as a DropAction::Move, otherwise the drop event will be handled as a DropAction::Copy.
|
protected |
Handles a drop event.
Reimplement this method to handle a drop events for mime types you declared to accept using acceptDrops.
The default implementation simply completes the drag and drop operation as if nothing happened.
void Wt::WAbstractItemView::edit | ( | const WModelIndex & | index | ) |
Opens an editor for the given index.
Unless multiple editors are enabled, any other open editor is closed first.
WFlags<EditOption> Wt::WAbstractItemView::editOptions | ( | ) | const |
Returns the editing options.
WFlags<EditTrigger> Wt::WAbstractItemView::editTriggers | ( | ) | const |
Returns the editing triggers.
|
overrideprotectedvirtual |
Progresses to an Ajax-enabled widget.
This method is called when the progressive bootstrap method is used, and support for AJAX has been detected. The default behavior will upgrade the widget's event handling to use AJAX instead of full page reloads, and propagate the call to its children.
You may want to reimplement this method if you want to make changes to widget when AJAX is enabled. You should always call the base implementation.
Reimplemented from Wt::WCompositeWidget.
Reimplemented in Wt::WTreeView, and Wt::WTableView.
|
protected |
Returns the extra header widget.
Returns the widget previously created using createExtraHeaderWidget()
|
protectedvirtual |
Handles a click event.
This processes the event for internal purposes (such as selection or editing) and emits the clicked() signal.
You may want to override this signal to override the built-in selection or editing behaviour.
|
protectedvirtual |
Handles a double click event.
This processes the event for internal purposes (such as editing) and emits the doubleClicked() signal.
You may want to override this signal to override the built-in editing behaviour.
|
protectedvirtual |
Handles a mouse down event.
This emits the mouseWentDown() signal.
|
protectedvirtual |
Handles a mouse up event.
This emits the mouseWentUp() signal.
Signal<int, WMouseEvent>& Wt::WAbstractItemView::headerClicked | ( | ) |
Signal emitted when a header item is clicked.
The argument that is passed is the column number.
Signal<int, WMouseEvent>& Wt::WAbstractItemView::headerDoubleClicked | ( | ) |
Signal emitted when a header item is double clicked.
The argument that is passed is the column number.
const WLength& Wt::WAbstractItemView::headerHeight | ( | ) | const |
Returns the header height.
std::shared_ptr< WAbstractItemDelegate > Wt::WAbstractItemView::headerItemDelegate | ( | ) | const |
Returns the header item delegate.
Signal<int, WMouseEvent>& Wt::WAbstractItemView::headerMouseWentDown | ( | ) |
Signal emitted when a mouse button is pressed on a header item
The argument that is passed is the column number.
Signal<int, WMouseEvent>& Wt::WAbstractItemView::headerMouseWentUp | ( | ) |
Signal emitted when a mouse button is released on a header item
The argument that is passed is the column number.
void Wt::WAbstractItemView::hideColumn | ( | int | column | ) |
Hides a column.
AlignmentFlag Wt::WAbstractItemView::horizontalHeaderAlignment | ( | int | column | ) | const |
Returns the horizontal header alignment for a column.
bool Wt::WAbstractItemView::isColumnHidden | ( | int | column | ) | const |
Returns if a column is hidden.
bool Wt::WAbstractItemView::isColumnResizeEnabled | ( | ) | const |
Returns whether column resizing is enabled for new columns.
bool Wt::WAbstractItemView::isColumnResizeEnabled | ( | int | column | ) | const |
Returns whether column resizing is enabled for a single column.
The column
that is passed indicated the column index in the view. The indices start from 0.
bool Wt::WAbstractItemView::isEditing | ( | const WModelIndex & | index | ) | const |
Returns whether an editor is open for a given index.
bool Wt::WAbstractItemView::isSelected | ( | const WModelIndex & | index | ) | const |
Returns wheter an item is selected.
When selection operates on rows (SelectionBehavior::Rows), this method returns true for each element in a selected row.
This is a convenience method for:
bool Wt::WAbstractItemView::isSortingEnabled | ( | ) | const |
Returns whether sorting is enabled.
bool Wt::WAbstractItemView::isSortingEnabled | ( | int | column | ) | const |
Returns whether sorting is enabled for a single column.
std::shared_ptr<WAbstractItemDelegate> Wt::WAbstractItemView::itemDelegate | ( | ) | const |
Returns the default item delegate.
std::shared_ptr< WAbstractItemDelegate > Wt::WAbstractItemView::itemDelegate | ( | const WModelIndex & | index | ) | const |
Returns the delegate for rendering an item.
std::shared_ptr< WAbstractItemDelegate > Wt::WAbstractItemView::itemDelegate | ( | int | column | ) | const |
Returns the delegate for a column.
Returns either the delegate that was set for the column, or the default delegate.
std::shared_ptr< WAbstractItemDelegate > Wt::WAbstractItemView::itemDelegateForColumn | ( | int | column | ) | const |
Returns the delegate that was set for a column.
Returns 0
if no delegate was set for the column.
|
pure virtual |
Returns the widget that renders an item.
This returns the widget that renders the given item. This may return 0 if the item is currently not rendered.
This widget has been created by an item delegate, and usually an item delegate is involved when updating it.
Implemented in Wt::WTreeView, and Wt::WTableView.
EventSignal< WKeyEvent > & Wt::WAbstractItemView::keyPressed | ( | ) |
Event signal emitted when a "character" was entered.
The keyPressed signal is emitted when a key is pressed, and a character is entered. Unlike keyWentDown(), it is emitted only for key presses that result in a character being entered, and thus not for modifier keys or keyboard navigation keys.
EventSignal< WKeyEvent > & Wt::WAbstractItemView::keyWentDown | ( | ) |
Event signal emitted when a keyboard key is pushed down.
The keyWentDown signal is the first signal emitted when a key is pressed (before the keyPressed signal). Unlike keyPressed() however it is also emitted for modifier keys (such as "shift", "control", ...) or keyboard navigation keys that do not have a corresponding character.
EventSignal< WKeyEvent > & Wt::WAbstractItemView::keyWentUp | ( | ) |
Event signal emitted when a keyboard key is released.
This is the counter-part of the keyWentDown() event. Every key-down has its corresponding key-up.
std::shared_ptr<WAbstractItemModel> Wt::WAbstractItemView::model | ( | ) | const |
Returns the model.
Signal<WModelIndex, WMouseEvent>& Wt::WAbstractItemView::mouseWentDown | ( | ) |
Signal emitted when a mouse button is pressed down.
This signal is emitted only when 'over' an item (the model index is passed as first argument is never invalid).
Signal<WModelIndex, WMouseEvent>& Wt::WAbstractItemView::mouseWentUp | ( | ) |
Signal emitted when the mouse button is released.
When the event happened over an item, the first argument indicates the item where the mouse went up.
Signal& Wt::WAbstractItemView::pageChanged | ( | ) |
Signal emitted when page information was updated.
When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This signal is emitted when page-related information changed (e.g. the current page was changed, or the number of rows was changed).
|
pure virtual |
Returns the number of pages.
When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This returns the number of pages currently shown.
Implemented in Wt::WTreeView, and Wt::WTableView.
|
pure virtual |
Returns the page size.
When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This returns the number of items per page.
Implemented in Wt::WTreeView, and Wt::WTableView.
const WModelIndex& Wt::WAbstractItemView::rootIndex | ( | ) | const |
Returns the root index.
int Wt::WAbstractItemView::rowHeaderCount | ( | ) | const |
Returns the number of columns that are used as row headers.
|
pure virtual |
Signal emitted when scrolling.
Implemented in Wt::WTreeView, and Wt::WTableView.
|
pure virtual |
Scrolls the view to an item.
Scrolls the view to ensure that the item which represents the provided index
is visible. A hint
may indicate how the item should appear in the viewport (if possible).
Implemented in Wt::WTreeView, and Wt::WTableView.
void Wt::WAbstractItemView::select | ( | const WModelIndex & | index, |
SelectionFlag | option = SelectionFlag::Select |
||
) |
Selects a single item.
WModelIndexSet Wt::WAbstractItemView::selectedIndexes | ( | ) | const |
Returns the set of selected items.
The model indexes are returned as a set, topologically ordered (in the order they appear in the view).
When selection operates on rows (SelectionBehavior::Rows), this method only returns the model index of first column's element of the selected rows.
This is a convenience method for:
SelectionBehavior Wt::WAbstractItemView::selectionBehavior | ( | ) | const |
Returns the selection behaviour.
Signal& Wt::WAbstractItemView::selectionChanged | ( | ) |
Signal emitted when the selection is changed.
SelectionMode Wt::WAbstractItemView::selectionMode | ( | ) | const |
Returns the selection mode.
WItemSelectionModel* Wt::WAbstractItemView::selectionModel | ( | ) | const |
Returns the selection model.
The selection model keeps track of the currently selected items.
|
virtual |
Sets if alternating row colors are to be used.
Configure whether rows get alternating background colors, defined by the current CSS theme.
The default value is false
.
Reimplemented in Wt::WTreeView, and Wt::WTableView.
|
virtual |
Sets the content alignment for a column.
The default value is Wt::AlignmentFlag::Left.
|
virtual |
Changes the visibility of a column.
Reimplemented in Wt::WTreeView, and Wt::WTableView.
void Wt::WAbstractItemView::setColumnResizeEnabled | ( | bool | enabled | ) |
Enables interactive column resizing.
Enable or disable column resize handles for interactive resizing of the columns.
Column resizing is enabled by default when JavaScript is available.
void Wt::WAbstractItemView::setColumnResizeEnabled | ( | bool | enabled, |
int | column | ||
) |
Enables interactive column resizing.
Enable or disable column resize handles for interactive resizing of a single column. The column
that is passed indicated the column index in the view. The indices start from 0.
Column resizing is enabled by default when JavaScript is available.
|
pure virtual |
Sets the column width.
The default column width is 150 pixels.
Implemented in Wt::WTreeView, and Wt::WTableView.
|
pure virtual |
Sets the current page.
When Ajax/JavaScript is not available, the view will use a paging navigation bar to allow scrolling through the data. This method can be used to change the current page.
Implemented in Wt::WTreeView, and Wt::WTableView.
void Wt::WAbstractItemView::setDragEnabled | ( | bool | enable | ) |
Enables the selection to be dragged (drag & drop).
To enable dragging of the selection, you first need to enable selection using setSelectionMode().
Whether an individual item may be dragged is controlled by the item's ItemFlag::DragEnabled flag. The selection can be dragged only if all items currently selected can be dragged.
void Wt::WAbstractItemView::setDropsEnabled | ( | bool | enable | ) |
Enables drop operations (drag & drop).
When drop is enabled, the tree view will indicate that something may be dropped when the mime-type of the dragged object is compatible with one of the model's accepted drop mime-types (see WAbstractItemModel::acceptDropMimeTypes()) or this widget's accepted drop mime-types (see WWidget::acceptDrops()), and the target item has drop enabled (which is controlled by the item's ItemFlag::DropEnabled flag).
Drop events must be handled in dropEvent().
void Wt::WAbstractItemView::setEditOptions | ( | WFlags< EditOption > | options | ) |
Configures editing options.
The default value is SingleEditor;
void Wt::WAbstractItemView::setEditTriggers | ( | WFlags< EditTrigger > | editTriggers | ) |
void Wt::WAbstractItemView::setEnabledDropLocations | ( | WFlags< DropLocation > | droplocation | ) |
Enables drop operations (drag & drop).
When drop is enabled, the tree view will indicate that something may be dropped when the mime-type of the dragged object is compatible with one of the model's accepted drop mime-types (see WAbstractItemModel::acceptDropMimeTypes()) or this widget's accepted drop mime-types (see WWidget::acceptDrops()).
When DropLocation::OnItem is enabled, the view will allow drops on items that have the ItemFlag::DropEnabled flag set. When DropLocation::BetweenRows is enabled, the view will indicate that something may be dropped between any two rows. When DropLocation::OnItem and DropLocation::BetweenRows are both enabled, the drop indication differs depending on whether ItemFlag::DropEnabled is set on the item.
Drop events must be handled in dropEvent().
|
virtual |
Sets the header alignment for a column.
The default alignemnt is horizontally left, and vertically centered. (Wt::AlignmentFlag::Left | Wt::AlignmentFlag::Middle).
Valid options for horizontal alignment are Wt::AlignmentFlag::Left, Wt::AlignmentFlag::Center or Wt::AlignmentFlag::Right.
Valid options for vertical alignment are Wt::AlignmentFlag::Middle or Wt::AlignmentFlag::Top. In the latter case, other contents may be added below the label in createExtraHeaderWidget().
void Wt::WAbstractItemView::setHeaderClickSortEnabled | ( | bool | enabled | ) |
Alow to sort.
When enabeld the view can be sorted by clicking on the header.
|
virtual |
Sets the header height.
The default value is 20 pixels.
Reimplemented in Wt::WTreeView, and Wt::WTableView.
void Wt::WAbstractItemView::setHeaderItemDelegate | ( | const std::shared_ptr< WAbstractItemDelegate > & | delegate | ) |
Sets the header item delegate.
This item delegate is used for rendering items in the header.
The previous delegate is not deleted. This item delegate is for all columns for which no specific item delegate is set.
The default item delegate is a WItemDelegate.
void Wt::WAbstractItemView::setHeaderWordWrap | ( | int | column, |
bool | enabled | ||
) |
Configures header text wrapping.
This setting only affects a multiline header, and the default value is true
. When set to false
, the header itself will not wrap (as with a vertically centered header), and thus extra widgets will not shift down when there is a long header label.
void Wt::WAbstractItemView::setItemDelegate | ( | const std::shared_ptr< WAbstractItemDelegate > & | delegate | ) |
Sets the default item delegate.
The previous delegate is not deleted. This item delegate is for all columns for which no specific item delegate is set.
The default item delegate is a WItemDelegate.
void Wt::WAbstractItemView::setItemDelegateForColumn | ( | int | column, |
const std::shared_ptr< WAbstractItemDelegate > & | delegate | ||
) |
Sets the delegate for a column.
A delegate previously set (if any) is not deleted.
|
virtual |
Sets the model.
The View will display data of the given model
and changes in the model are reflected by the View.
The initial model is 0
.
Reimplemented in Wt::WTreeView, and Wt::WTableView.
void Wt::WAbstractItemView::setRootIndex | ( | const WModelIndex & | rootIndex | ) |
Sets the root index.
The root index is the model index that is considered the root node. This node itself is not rendered, but its children are.
The default value is an invalid model index, corresponding to the model's root node.
|
virtual |
Configures the number of columns that are used as row headers.
An item view does not use the vertical header data from the model in any way, but instead you can configure data in the first column(s) to be used as a row headers.
These columns will not scroll horizontally together with the rest of the model.
The default value is 0.
Reimplemented in Wt::WTreeView, and Wt::WTableView.
|
virtual |
Sets the row height.
The view renders all rows with a same height. This method configures this row height.
The default value is 20 pixels.
Reimplemented in Wt::WTreeView, and Wt::WTableView.
void Wt::WAbstractItemView::setSelectedIndexes | ( | const WModelIndexSet & | indexes | ) |
Sets the selected items.
Replaces the current selection with indexes
.
When selection operates on rows (SelectionBehavior::Rows), it is sufficient to pass the first element in a row (column 0
) to select the entire row.
void Wt::WAbstractItemView::setSelectionBehavior | ( | SelectionBehavior | behavior | ) |
Changes the selection behaviour.
The selection behavior indicates whether whole rows or individual items can be selected. It is a property of the selectionModel().
By default, selection operates on rows (SelectionBehavior::Rows), in which case model indexes will always be in the first column (column 0
).
Alternatively, you can allow selection for individual items (SelectionBehavior::Items)
void Wt::WAbstractItemView::setSelectionMode | ( | SelectionMode | mode | ) |
Sets the selection mode.
By default selection is disabled (SelectionMode::None).
void Wt::WAbstractItemView::setSortingEnabled | ( | bool | enabled | ) |
Enables or disables sorting for all columns.
Enable or disable sorting by the user on all columns.
Sorting is enabled by default.
void Wt::WAbstractItemView::setSortingEnabled | ( | int | column, |
bool | enabled | ||
) |
Enables or disables sorting for a single column.
Enable or disable sorting by the user for a specific column.
Sorting is enabled by default.
void Wt::WAbstractItemView::showColumn | ( | int | column | ) |
Shows a column.
void Wt::WAbstractItemView::sortByColumn | ( | int | column, |
SortOrder | order | ||
) |
Sorts the data according to a column.
Sorts the data according to data in column column
and sort order order
.
The default sorting column is -1: the model is unsorted.
int Wt::WAbstractItemView::sortColumn | ( | ) | const |
Returns the current sorting columm.
bool Wt::WAbstractItemView::sortEnabled | ( | ) |
Returns whether the view is sortable.
When enabeld the view can be sorted by clicking on the header.
SortOrder Wt::WAbstractItemView::sortOrder | ( | ) | const |
Returns the current sorting order.
Signal<std::vector<WModelIndex>, WTouchEvent>& Wt::WAbstractItemView::touchEnded | ( | ) |
Signal emitted when one or more fingers are removed from the screen.
When the event happened over an item, the first argument indicates the items where the touch ended. The indices in the model index vector match the indices in the changedTouches() of the WTouchEvent.
Signal<std::vector<WModelIndex>, WTouchEvent>& Wt::WAbstractItemView::touchMoved | ( | ) |
Signal emitted when one or more fingers are moved on the screen.
When the event happened over an item, the first argument indicates the items that were touched. The indices in the model index vector match the indices in the changedTouches() of the WTouchEvent.
Signal<WModelIndex, WTouchEvent>& Wt::WAbstractItemView::touchStart | ( | ) |
Signal emitted when a finger is placed on the screen.
When the event happened over an item, the first argument indicates the item that was touched.
Signal<std::vector<WModelIndex>, WTouchEvent>& Wt::WAbstractItemView::touchStarted | ( | ) |
Signal emitted when one or more fingers are placed on the screen.
When the event happened over an item, the first argument indicates the items that were touched. The indices in the model index vector match the indices in the changedTouches() of the WTouchEvent.
ValidationState Wt::WAbstractItemView::validateEditor | ( | const WModelIndex & | index | ) |
Validates the editor for the given index.
Validation is done by invoking WAbstractItemDelegate::validate().
ValidationState Wt::WAbstractItemView::validateEditors | ( | ) |
Validates all editors.
AlignmentFlag Wt::WAbstractItemView::verticalHeaderAlignment | ( | int | column | ) | const |
Returns the vertical header alignment for a column.