/usr/include/Wt/WItemSelectionModel is in libwt-dev 3.3.3+dfsg-4.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WITEM_SELECTION_MODEL_H_
#define WITEM_SELECTION_MODEL_H_
#include <Wt/WObject>
#include <Wt/WModelIndex>
#include <Wt/WGlobal>
#include <string>
namespace Wt {
class WAbstractItemModel;
class WAbstractItemView;
/*! \class WItemSelectionModel Wt/WItemSelectionModel Wt/WItemSelectionModel
* \brief A class that represents a selection for a WAbstractItemView.
*
* This model is currently only used by WTreeView, and plays only
* a role in drag & drop of an item selection.
*
* When an item selection is dragged from a view widget, the generated
* drop events will have as source object (see WDropEvent::source())
* this selection model.
*
* Although this class does not (yet) allow you to modify the
* selection, note that manipulations to the model may modify the
* selection (row insertions and removals may shift the selection, and
* row deletions may shrink the selection).
*
* \note Currently this class cannot be shared between multiple views.
*
* \ingroup modelview
*
* \sa WTreeView, WTableView, WAbstractItemModel
*/
class WT_API WItemSelectionModel : public WObject
{
public:
/*! \brief Returns the WAbstractItemModel.
*/
WAbstractItemModel *model() const { return model_; }
/*! \brief 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 (\link Wt::SelectRows SelectRows\endlink),
* this method only returns the model index of first column's element of the
* selected rows.
*/
WModelIndexSet selectedIndexes() const { return selection_; }
/*! \brief Returns wheter an item is selected.
*
* When selection operates on rows (\link Wt::SelectRows SelectRows\endlink),
* this method returns true for each element in a selected row.
*
* \sa selectedIndexes()
*/
bool isSelected(const WModelIndex& index) const;
/*! \brief Sets the selection behaviour.
*
* By default, the selection contains rows (\link Wt::SelectRows
* SelectRows\endlink), in which case model indexes will always be
* have column 0, but represent the whole row.
*
* Alternatively, you can allow selection for individual items
* (\link Wt::SelectItems SelectItems\endlink).
*/
void setSelectionBehavior(SelectionBehavior behavior);
/*! \brief Returns the selection behaviour.
*
* \sa setSelectionBehavior()
*/
SelectionBehavior selectionBehavior() const { return selectionBehavior_; }
/*! \brief Returns the selection mime type.
*
* This should return the mime type for the current selection, or an emtpy
* string if the selection cannot be dragged.
*
* The default implementation returns the mime type based on MimeTypeRole data
* if all selected items indicate the same mime type, or the model mimeType()
* otherwise.
*
* If one or more items indicate that they cannot be dragged, then an empty
* string is returned.
*/
virtual std::string mimeType();
private:
WModelIndexSet selection_;
WAbstractItemModel *model_;
SelectionBehavior selectionBehavior_;
WItemSelectionModel(WAbstractItemModel *model, WObject *parent = 0);
void modelLayoutAboutToBeChanged();
void modelLayoutChanged();
friend class WAbstractItemView;
friend class WTableView;
friend class WTreeView;
};
}
#endif // WITEM_SELECTION_MODEL_H_
|