Unity 8
horizontaljournal.h
1 /*
2  * Copyright (C) 2013 Canonical, Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; version 3.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef HORIZONTALJOURNAL_H
18 #define HORIZONTALJOURNAL_H
19 
20 #include "abstractdashview.h"
21 
29  class HorizontalJournal : public AbstractDashView
30 {
31  Q_OBJECT
32 
33  Q_PROPERTY(qreal rowHeight READ rowHeight WRITE setRowHeight NOTIFY rowHeightChanged)
34 
35 friend class HorizontalJournalTest;
36 
37 public:
39 
40  qreal rowHeight() const;
41  void setRowHeight(qreal rowHeight);
42 
43 Q_SIGNALS:
44  void rowHeightChanged();
45 
46 private:
47  void findBottomModelIndexToAdd(int *modelIndex, qreal *yPos) override;
48  void findTopModelIndexToAdd(int *modelIndex, qreal *yPos) override;
49  bool removeNonVisibleItems(qreal bufferFromY, qreal bufferToY) override;
50  void addItemToView(int modelIndex, QQuickItem *item) override;
51  void cleanupExistingItems() override;
52  void calculateImplicitHeight() override;
53  void doRelayout() override;
54  void updateItemCulling(qreal visibleFromY, qreal visibleToY) override;
55  void processModelRemoves(const QVector<QQmlChangeSet::Change> &removes) override;
56 
57  int m_firstVisibleIndex;
58  QList<QQuickItem*> m_visibleItems;
59  QMap<int, double> m_lastInRowIndexPosition;
60  int m_rowHeight;
61 };
62 
63 #endif