/usr/include/Wt/WStringListModel is in libwt-dev 3.1.10-1ubuntu2.
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 | // 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 WSTRING_LIST_MODEL_H_
#define WSTRING_LIST_MODEL_H_
#include <Wt/WAbstractListModel>
namespace Wt {
/*! \class WStringListModel Wt/WStringListModel Wt/WStringListModel
* \brief An model that manages a list of strings.
*
* This model only manages a unidimensional list of strings. It is
* used as the default model for view classes that show a
* list.
*
* The model only presents \link Wt::DisplayRole DisplayRole\endlink
* data of a single column of data, but otherwise provides support for
* all standard features of a model, including editing and addition
* and removal of data rows.
*
* You can populate the model by passing a list of strings to its
* consructor, or by using the setStringList() method. You can set or
* retrieve data using the setData() and data() methods, and add or
* remove data using the insertRows() and removeRows() methods.
*
* \if cpp
* \sa WComboBox, WSelectionBox, Ext::ComboBox
* \elseif java
* \sa WComboBox, WSelectionBox
* \endif
*
* \ingroup modelview
*/
class WT_API WStringListModel : public WAbstractListModel
{
public:
/*! \brief Creates a new empty string list model.
*/
WStringListModel(WObject *parent = 0);
/*! \brief Creates a new string list model.
*/
WStringListModel(const std::vector<WString>& strings, WObject *parent = 0);
/*! \brief Destructor.
*/
~WStringListModel();
/*! \brief Sets a new string list.
*
* Replaces the current string list with a new list.
*
* \sa dataChanged()
* \sa addString()
*/
void setStringList(const std::vector<WString>& strings);
/*! \brief Inserts a string.
*
* \sa setStringList()
*/
void insertString(int row, const WString& string);
/*! \brief Adds a string.
*
* \sa setStringList()
*/
void addString(const WString& string);
/*! \brief Returns the string list.
*
* \sa setStringList()
*/
const std::vector<WString>& stringList() const { return strings_; }
/*! \brief Returns the flags for an item.
*
* This method is reimplemented to return \link Wt::ItemIsSelectable
* ItemIsSelectable\endlink | \link Wt::ItemIsEditable
* ItemIsEditable\endlink.
*
* \sa Wt::ItemFlag
*/
virtual WFlags<ItemFlag> flags(const WModelIndex& index) const;
using WAbstractListModel::setData;
virtual bool setData(const WModelIndex& index, const boost::any& value,
int role = EditRole);
virtual boost::any data(const WModelIndex& index, int role = DisplayRole)
const;
virtual int rowCount(const WModelIndex& parent = WModelIndex()) const;
virtual bool insertRows(int row, int count,
const WModelIndex& parent = WModelIndex());
virtual bool removeRows(int row, int count,
const WModelIndex& parent = WModelIndex());
virtual void sort(int column, SortOrder order = AscendingOrder);
private:
std::vector<WString> strings_;
};
}
#endif // WSTRING_LIST_MODEL_H_
|