~lubuntu-dev/lxde/libfm-qt-debian-git

« back to all changes in this revision

Viewing changes to src/folderview_p.h

  • Committer: Alf Gaida
  • Date: 2015-12-17 15:45:00 UTC
  • Revision ID: git-v1:99d4cf5e0b3761023e2285ffb96a79d050f0bdf4
Tags: upstream/0.10.0+20151214
Adding upstream version 0.10.0+20151214.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2012 - 2015  Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
 
3
 *
 
4
 * This library is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU Lesser General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2.1 of the License, or (at your option) any later version.
 
8
 *
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * Lesser General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Lesser General Public
 
15
 * License along with this library; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
17
 *
 
18
 */
 
19
 
 
20
 
 
21
#ifndef FM_FOLDERVIEW_P_H
 
22
#define FM_FOLDERVIEW_P_H
 
23
 
 
24
#include <QListView>
 
25
#include <QTreeView>
 
26
#include <QMouseEvent>
 
27
#include "folderview.h"
 
28
 
 
29
class QTimer;
 
30
 
 
31
namespace Fm {
 
32
 
 
33
// override these classes for implementing FolderView
 
34
class FolderViewListView : public QListView {
 
35
  Q_OBJECT
 
36
public:
 
37
  friend class FolderView;
 
38
  FolderViewListView(QWidget* parent = 0);
 
39
  virtual ~FolderViewListView();
 
40
  virtual void startDrag(Qt::DropActions supportedActions);
 
41
  virtual void mousePressEvent(QMouseEvent* event);
 
42
  virtual void mouseReleaseEvent(QMouseEvent* event);
 
43
  virtual void mouseDoubleClickEvent(QMouseEvent* event);
 
44
  virtual void dragEnterEvent(QDragEnterEvent* event);
 
45
  virtual void dragMoveEvent(QDragMoveEvent* e);
 
46
  virtual void dragLeaveEvent(QDragLeaveEvent* e);
 
47
  virtual void dropEvent(QDropEvent* e);
 
48
 
 
49
  virtual QModelIndex indexAt(const QPoint & point) const;
 
50
 
 
51
  inline void setPositionForIndex(const QPoint & position, const QModelIndex & index) {
 
52
    QListView::setPositionForIndex(position, index);
 
53
  }
 
54
 
 
55
  inline QRect rectForIndex(const QModelIndex & index) const {
 
56
    return QListView::rectForIndex(index);
 
57
  }
 
58
 
 
59
  inline QStyleOptionViewItem getViewOptions() {
 
60
    return viewOptions();
 
61
  }
 
62
 
 
63
Q_SIGNALS:
 
64
  void activatedFiltered(const QModelIndex &index);
 
65
 
 
66
private Q_SLOTS:
 
67
  void activation(const QModelIndex &index);
 
68
 
 
69
private:
 
70
  bool activationAllowed_;
 
71
};
 
72
 
 
73
class FolderViewTreeView : public QTreeView {
 
74
  Q_OBJECT
 
75
public:
 
76
  friend class FolderView;
 
77
  FolderViewTreeView(QWidget* parent = 0);
 
78
  virtual ~FolderViewTreeView();
 
79
  virtual void setModel(QAbstractItemModel* model);
 
80
  virtual void mousePressEvent(QMouseEvent* event);
 
81
  virtual void mouseReleaseEvent(QMouseEvent* event);
 
82
  virtual void mouseDoubleClickEvent(QMouseEvent* event);
 
83
  virtual void dragEnterEvent(QDragEnterEvent* event);
 
84
  virtual void dragMoveEvent(QDragMoveEvent* e);
 
85
  virtual void dragLeaveEvent(QDragLeaveEvent* e);
 
86
  virtual void dropEvent(QDropEvent* e);
 
87
 
 
88
  virtual void rowsInserted(const QModelIndex& parent,int start, int end);
 
89
  virtual void rowsAboutToBeRemoved(const QModelIndex& parent,int start, int end);
 
90
  virtual void dataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
 
91
  virtual void reset();
 
92
 
 
93
  virtual void resizeEvent(QResizeEvent* event);
 
94
  void queueLayoutColumns();
 
95
 
 
96
Q_SIGNALS:
 
97
  void activatedFiltered(const QModelIndex &index);
 
98
 
 
99
private Q_SLOTS:
 
100
  void layoutColumns();
 
101
  void activation(const QModelIndex &index);
 
102
  void onSortFilterChanged();
 
103
 
 
104
private:
 
105
  bool doingLayout_;
 
106
  QTimer* layoutTimer_;
 
107
  bool activationAllowed_;
 
108
};
 
109
 
 
110
 
 
111
} // namespace Fm
 
112
 
 
113
#endif // FM_FOLDERVIEW_P_H