PCManFM-Qt
sidepane.h
1 /*
2 
3  Copyright (C) 2013 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 
21 #ifndef FM_SIDEPANE_H
22 #define FM_SIDEPANE_H
23 
24 #include "libfmqtglobals.h"
25 #include <libfm/fm.h>
26 #include <QWidget>
27 
28 class QComboBox;
29 class QVBoxLayout;
30 class QWidget;
31 
32 namespace Fm {
33 
34 class LIBFM_QT_API SidePane : public QWidget {
35  Q_OBJECT
36 
37 public:
38  enum Mode {
39  ModeNone = -1,
40  ModePlaces = 0,
41  ModeDirTree,
42  NumModes
43  };
44 
45 public:
46  explicit SidePane(QWidget* parent = 0);
47  virtual ~SidePane();
48 
49  QSize iconSize() {
50  return iconSize_;
51  }
52 
53  void setIconSize(QSize size);
54 
55  FmPath* currentPath() {
56  return currentPath_;
57  }
58 
59  void setCurrentPath(FmPath* path);
60 
61  void setMode(Mode mode);
62 
63  Mode mode() {
64  return mode_;
65  }
66 
67  QWidget* view() {
68  return view_;
69  }
70 
71  const char *modeName(Mode mode);
72 
73  Mode modeByName(const char *str);
74 
75 #if 0 // FIXME: are these APIs from libfm-qt needed?
76  int modeCount(void) {
77  return NumModes;
78  }
79 
80  QString modeLabel(Mode mode);
81 
82  QString modeTooltip(Mode mode);
83 #endif
84 
85  bool setShowHidden(bool show_hidden);
86 
87  bool showHidden() {
88  return showHidden_;
89  }
90 
91  bool setHomeDir(const char *home_dir);
92 
93  // libfm-gtk compatible alias
94  FmPath* getCwd() {
95  return currentPath();
96  }
97 
98  void chdir(FmPath* path) {
99  setCurrentPath(path);
100  }
101 
102 Q_SIGNALS:
103  void chdirRequested(int type, FmPath* path);
104  void modeChanged();
105 
106 protected Q_SLOTS:
107  void onPlacesViewChdirRequested(int type, FmPath* path);
108  void onDirTreeViewChdirRequested(int type, FmPath* path);
109  void onComboCurrentIndexChanged(int current);
110 
111 private:
112  void initDirTree();
113 
114 private:
115  FmPath* currentPath_;
116  QWidget* view_;
117  QComboBox* combo_;
118  QVBoxLayout* verticalLayout;
119  QSize iconSize_;
120  Mode mode_;
121  bool showHidden_;
122 };
123 
124 }
125 
126 #endif // FM_SIDEPANE_H
Definition: appchoosercombobox.cpp:26
Definition: sidepane.h:34