Merge pull request #4687 from ruuk/textboxgettext
[vuplus_xbmc] / xbmc / guilib / GUIMultiImage.h
1 /*!
2 \file GUIMultiImage.h
3 \brief
4 */
5
6 #ifndef GUILIB_GUIMULTIIMAGECONTROL_H
7 #define GUILIB_GUIMULTIIMAGECONTROL_H
8
9 #pragma once
10
11 /*
12  *      Copyright (C) 2005-2013 Team XBMC
13  *      http://xbmc.org
14  *
15  *  This Program is free software; you can redistribute it and/or modify
16  *  it under the terms of the GNU General Public License as published by
17  *  the Free Software Foundation; either version 2, or (at your option)
18  *  any later version.
19  *
20  *  This Program is distributed in the hope that it will be useful,
21  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
22  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  *  GNU General Public License for more details.
24  *
25  *  You should have received a copy of the GNU General Public License
26  *  along with XBMC; see the file COPYING.  If not, see
27  *  <http://www.gnu.org/licenses/>.
28  *
29  */
30
31 #include "GUIImage.h"
32 #include "utils/Stopwatch.h"
33 #include "utils/Job.h"
34 #include "threads/CriticalSection.h"
35
36 /*!
37  \ingroup controls
38  \brief
39  */
40 class CGUIMultiImage : public CGUIControl, public IJobCallback
41 {
42 public:
43   CGUIMultiImage(int parentID, int controlID, float posX, float posY, float width, float height, const CTextureInfo& texture, unsigned int timePerImage, unsigned int fadeTime, bool randomized, bool loop, unsigned int timeToPauseAtEnd);
44   CGUIMultiImage(const CGUIMultiImage &from);
45   virtual ~CGUIMultiImage(void);
46   virtual CGUIMultiImage *Clone() const { return new CGUIMultiImage(*this); };
47
48   virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
49   virtual void Render();
50   virtual void UpdateVisibility(const CGUIListItem *item = NULL);
51   virtual void UpdateInfo(const CGUIListItem *item = NULL);
52   virtual bool OnAction(const CAction &action);
53   virtual bool OnMessage(CGUIMessage &message);
54   virtual void AllocResources();
55   virtual void FreeResources(bool immediately = false);
56   virtual void DynamicResourceAlloc(bool bOnOff);
57   virtual bool IsDynamicallyAllocated() { return m_bDynamicResourceAlloc; };
58   virtual void SetInvalid();
59   virtual bool CanFocus() const;
60   virtual CStdString GetDescription() const;
61
62   void SetInfo(const CGUIInfoLabel &info);
63   void SetAspectRatio(const CAspectRatio &ratio);
64
65 protected:
66   void LoadDirectory();
67   void OnDirectoryLoaded();
68   void CancelLoading();
69
70   enum DIRECTORY_STATUS { UNLOADED = 0, LOADING, LOADED, READY };
71   virtual void OnJobComplete(unsigned int jobID, bool success, CJob *job);
72
73   class CMultiImageJob : public CJob
74   {
75   public:
76     CMultiImageJob(const CStdString &path);
77     virtual bool DoWork();
78     virtual const char *GetType() const { return "multiimage"; };
79
80     std::vector<CStdString> m_files;
81     CStdString              m_path;
82   };
83
84   CGUIInfoLabel m_texturePath;
85   CStdString m_currentPath;
86   unsigned int m_currentImage;
87   CStopWatch m_imageTimer;
88   unsigned int m_timePerImage;
89   unsigned int m_timeToPauseAtEnd;
90   bool m_randomized;
91   bool m_loop;
92
93   bool m_bDynamicResourceAlloc;
94   std::vector<CStdString> m_files;
95
96   CGUIImage m_image;
97
98   CCriticalSection m_section;
99   DIRECTORY_STATUS m_directoryStatus;
100   unsigned int m_jobID;
101 };
102 #endif