OpenStructure
base_row.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_ROW
20 #define OST_SEQUENCE_VIEWER_BASE_ROW
21 
22 /*
23  Author: Stefan Scheuber
24  */
25 
26 
27 #include "painter.hh"
28 
29 #include <QObject>
30 #include <QModelIndex>
31 #include <QList>
32 namespace ost { namespace gui {
33 
34 class BaseRow : public QObject
35 {
36  Q_OBJECT
37 
38 public:
39  BaseRow(QObject *parent = 0);
40  BaseRow(QFont font, QObject *parent = 0);
41 
42  void Init();
43 
44  virtual int GetColumnCount() const;
45 
46  void InsertPainter(Painter* painter, int pos = -1);
47  void RemovePainter(Painter* painter);
48  Painter* GetPainter(int pos);
50  const PainterList& GetPainters() const;
51 
52  const QFont& GetFont() const;
53  void SetFont(const QFont& font);
54  const QSize& GetFontSize() const;
55 
56  virtual const QSize& GetCellSize() const;
57 
58  virtual QVariant GetData(int column, int role) const;
59  virtual bool SetData(int column, const QVariant& value, int role);
60  virtual Qt::ItemFlags Flags(int column) const;
61  virtual void DoubleClicked(int column);
62  virtual void SetSelection(const QSet<int>& added, const QSet<int>& removed);
63 
64  virtual void ZoomIn();
65  virtual void ZoomOut();
66 
67 private:
68  bool IsPainterPosValid(int pos);
69  PainterList painter_;
70  QFont font_;
71  QSize default_font_size_;
72  QSize default_cell_size_;
73 };
74 
75 typedef QList<BaseRow*> BaseRowList;
76 
77 }}
78 
79 #endif
const PainterList & GetPainters() const
virtual Qt::ItemFlags Flags(int column) const
Painter * GetPainter(int pos)
virtual QVariant GetData(int column, int role) const
const QFont & GetFont() const
const QSize & GetFontSize() const
void InsertPainter(Painter *painter, int pos=-1)
virtual void ZoomOut()
void RemovePainter(Painter *painter)
virtual bool SetData(int column, const QVariant &value, int role)
BaseRow(QFont font, QObject *parent=0)
BaseRow(QObject *parent=0)
void SetFont(const QFont &font)
virtual void DoubleClicked(int column)
virtual int GetColumnCount() const
virtual const QSize & GetCellSize() const
virtual void ZoomIn()
virtual void SetSelection(const QSet< int > &added, const QSet< int > &removed)
QList< BaseRow * > BaseRowList
Definition: base_row.hh:75
QList< Painter * > PainterList
Definition: painter.hh:48
Definition: base.dox:1