| 1 |
/* |
| 2 |
* Copyright (C) 2005-2018 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include "windowing/GraphicContext.h" // for VIEW_TYPE |
| 12 |
|
| 13 |
#include <string> |
| 14 |
#include <vector> |
| 15 |
|
| 16 |
class CGUIControl; |
| 17 |
class CFileItemList; |
| 18 |
|
| 19 |
class CGUIViewControl |
| 20 |
{ |
| 21 |
public: |
| 22 |
CGUIViewControl(); |
| 23 |
virtual ~CGUIViewControl(); |
| 24 |
|
| 25 |
void Reset(); |
| 26 |
void SetParentWindow(int window); |
| 27 |
void AddView(const CGUIControl *control); |
| 28 |
void SetViewControlID(int control); |
| 29 |
|
| 30 |
void SetCurrentView(int viewMode, bool bRefresh = false); |
| 31 |
|
| 32 |
void SetItems(CFileItemList &items); |
| 33 |
|
| 34 |
void SetSelectedItem(int item); |
| 35 |
void SetSelectedItem(const std::string &itemPath); |
| 36 |
|
| 37 |
int GetSelectedItem() const; |
| 38 |
std::string GetSelectedItemPath() const; |
| 39 |
void SetFocused(); |
| 40 |
|
| 41 |
bool HasControl(int controlID) const; |
| 42 |
int GetNextViewMode(int direction = 1) const; |
| 43 |
int GetViewModeNumber(int number) const; |
| 44 |
int GetViewModeCount() const; |
| 45 |
int GetViewModeByID(int id) const; |
| 46 |
|
| 47 |
int GetCurrentControl() const; |
| 48 |
|
| 49 |
void Clear(); |
| 50 |
|
| 51 |
protected: |
| 52 |
int GetSelectedItem(const CGUIControl *control) const; |
| 53 |
void UpdateContents(const CGUIControl *control, int currentItem) const; |
| 54 |
void UpdateView(); |
| 55 |
void UpdateViewAsControl(const std::string &viewLabel); |
| 56 |
void UpdateViewVisibility(); |
| 57 |
int GetView(VIEW_TYPE type, int id) const; |
| 58 |
|
| 59 |
std::vector<CGUIControl*> m_allViews; |
| 60 |
std::vector<CGUIControl*> m_visibleViews; |
| 61 |
typedef std::vector<CGUIControl*>::const_iterator ciViews; |
| 62 |
|
| 63 |
CFileItemList* m_fileItems; |
| 64 |
int m_viewAsControl; |
| 65 |
int m_parentWindow; |
| 66 |
int m_currentView; |
| 67 |
}; |