OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
base_view_object.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_SEQUENCE_VIEWER_BASE_VIEW_OBJECT
20 #define OST_SEQUENCE_VIEWER_BASE_VIEW_OBJECT
21 
22 /*
23  Author: Stefan Scheuber
24  */
25 
26 
27 #include "base_row.hh"
28 
29 #include <QObject>
30 #include <QList>
31 
32 namespace ost { namespace gui {
33 
34 class BaseViewObject : public QObject
35 {
36  Q_OBJECT
37 
38 
39 public:
40  BaseViewObject(QObject* parent = 0);
41 
42  void InsertRow(int pos, BaseRow* row);
43  void RemoveRow(BaseRow* row);
44  BaseRow* GetRow(int pos);
45  int GetRowCount();
46  int GetMaxColumnCount() const;
47 
48  virtual void SetSelection(int row, const QSet<int>& added, const QSet<int>& removed);
49 
50  virtual QVariant GetData(int row, int column, int role);
51  virtual bool SetData(int row, int column, const QVariant& value, int role);
52  virtual Qt::ItemFlags Flags(int row, int column) const;
53 
54  virtual const QStringList& GetDisplayModes();
55  virtual const QString& GetCurrentDisplayMode();
56  virtual void SetDisplayMode(const QString& mode);
57 
58  void DoubleClicked(int row, int column);
59  void ZoomIn();
60  void ZoomOut();
61 
62 protected:
63  virtual void AddDisplayMode(const QString& mode);
64 
65  QList<BaseRow*> rows_;
67  QStringList display_modes_;
68 };
69 
70 
71 }}
72 
73 #endif
void RemoveRow(BaseRow *row)
virtual void AddDisplayMode(const QString &mode)
QList< BaseRow * > rows_
virtual QVariant GetData(int row, int column, int role)
virtual void SetSelection(int row, const QSet< int > &added, const QSet< int > &removed)
int GetMaxColumnCount() const
void InsertRow(int pos, BaseRow *row)
virtual const QStringList & GetDisplayModes()
BaseRow * GetRow(int pos)
void DoubleClicked(int row, int column)
BaseViewObject(QObject *parent=0)
virtual bool SetData(int row, int column, const QVariant &value, int role)
virtual const QString & GetCurrentDisplayMode()
virtual Qt::ItemFlags Flags(int row, int column) const
virtual void SetDisplayMode(const QString &mode)