Merge pull request #5039 from CEikermann/patch-1
[vuplus_xbmc] / xbmc / addons / GUIWindowAddonBrowser.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://xbmc.org
6  *
7  *  This Program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  This Program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with XBMC; see the file COPYING.  If not, see
19  *  <http://www.gnu.org/licenses/>.
20  *
21  */
22
23 #include "addons/Addon.h"
24 #include "windows/GUIMediaWindow.h"
25 #include "ThumbLoader.h"
26
27 class CFileItem;
28 class CFileItemList;
29
30 class CGUIWindowAddonBrowser : public CGUIMediaWindow
31 {
32 public:
33   CGUIWindowAddonBrowser(void);
34   virtual ~CGUIWindowAddonBrowser(void);
35   virtual bool OnMessage(CGUIMessage& message);
36
37   /*! \brief Popup a selection dialog with a list of addons of the given type
38    \param type the type of addon wanted
39    \param addonID [out] the addon ID of the selected item
40    \param showNone whether there should be a "None" item in the list (defaults to false)
41    \return 1 if an addon was selected, 2 if "Get More" was chosen, or 0 if an error occurred or if the selection process was cancelled
42    */
43   static int SelectAddonID(ADDON::TYPE type, CStdString &addonID, bool showNone = false);
44   static int SelectAddonID(const std::vector<ADDON::TYPE> &types, CStdString &addonID, bool showNone = false);
45   /*! \brief Popup a selection dialog with a list of addons of the given type
46    \param type the type of addon wanted
47    \param addonIDs [out] array of selected addon IDs
48    \param showNone whether there should be a "None" item in the list (defaults to false)
49    \param multipleSelection allow selection of multiple addons, if set to true showNone will automaticly switch to false
50    \return 1 if an addon was selected or multiple selection was specified, 2 if "Get More" was chosen, or 0 if an error occurred or if the selection process was cancelled
51    */
52   static int SelectAddonID(ADDON::TYPE type, CStdStringArray &addonIDs, bool showNone = false, bool multipleSelection = true);
53   static int SelectAddonID(const std::vector<ADDON::TYPE> &types, CStdStringArray &addonIDs, bool showNone = false, bool multipleSelection = true);
54   
55 protected:
56   /* \brief set label2 of an item based on the Addon.Status property
57    \param item the item to update
58    */
59   void SetItemLabel2(CFileItemPtr item);
60
61   virtual void GetContextButtons(int itemNumber, CContextButtons &buttons);
62   virtual bool OnContextButton(int itemNumber, CONTEXT_BUTTON button);
63   virtual bool OnClick(int iItem);
64   virtual void UpdateButtons();
65   virtual bool GetDirectory(const CStdString &strDirectory, CFileItemList &items);
66   virtual bool Update(const CStdString &strDirectory, bool updateFilterPath = true);
67   virtual CStdString GetStartFolder(const CStdString &dir);
68 private:
69   CProgramThumbLoader m_thumbLoader;
70 };
71