PCManFM-Qt
appmenuview.h
1 /*
2  * <one line to give the library's name and an idea of what it does.>
3  * Copyright (C) 2014 <copyright holder> <email>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library 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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  */
20 
21 #ifndef FM_APPMENUVIEW_H
22 #define FM_APPMENUVIEW_H
23 
24 #include <QTreeView>
25 #include "libfmqtglobals.h"
26 #include <libfm/fm.h>
27 #include <menu-cache/menu-cache.h>
28 
29 class QStandardItemModel;
30 class QStandardItem;
31 
32 namespace Fm {
33 
34 class AppMenuViewItem;
35 
36 class LIBFM_QT_API AppMenuView : public QTreeView {
37  Q_OBJECT
38 public:
39  explicit AppMenuView(QWidget* parent = NULL);
40  ~AppMenuView();
41 
42  GAppInfo* selectedApp();
43 
44  const char* selectedAppDesktopId();
45 
46  QByteArray selectedAppDesktopFilePath();
47 
48  FmPath * selectedAppDesktopPath();
49 
50  bool isAppSelected();
51 
52 Q_SIGNALS:
53  void selectionChanged();
54 
55 private:
56  void addMenuItems(QStandardItem* parentItem, MenuCacheDir* dir);
57  void onMenuCacheReload(MenuCache* mc);
58  static void _onMenuCacheReload(MenuCache* mc, gpointer user_data) {
59  static_cast<AppMenuView*>(user_data)->onMenuCacheReload(mc);
60  }
61 
62  AppMenuViewItem* selectedItem();
63 
64 private:
65  // gboolean fm_app_menu_view_is_item_app(, GtkTreeIter* it);
66  QStandardItemModel* model_;
67  MenuCache* menu_cache;
68  MenuCacheNotifyId menu_cache_reload_notify;
69 };
70 
71 }
72 
73 #endif // FM_APPMENUVIEW_H
Definition: appchoosercombobox.cpp:26
Definition: appmenuview.h:36