~ubuntu-branches/ubuntu/precise/supertuxkart/precise

« back to all changes in this revision

Viewing changes to src/states_screens/addons_screen.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger
  • Date: 2011-02-24 22:36:25 UTC
  • mfrom: (1.1.9 upstream) (6.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110224223625-ygrjfpg92obovuch
Tags: 0.7+dfsg1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  SuperTuxKart - a fun racing game with go-kart
 
2
//  Copyright (C) 2010 Lucas Baudin
 
3
//
 
4
//  This program is free software; you can redistribute it and/or
 
5
//  modify it under the terms of the GNU General Public License
 
6
//  as published by the Free Software Foundation; either version 3
 
7
//  of the License, or (at your option) any later version.
 
8
//
 
9
//  This program is distributed in the hope that it will be useful,
 
10
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
//  GNU General Public License for more details.
 
13
//
 
14
//  You should have received a copy of the GNU General Public License
 
15
//  along with this program; if not, write to the Free Software
 
16
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
17
 
 
18
#ifdef ADDONS_MANAGER
 
19
 
 
20
#ifndef HEADER_ADDONS_SCREEN_HPP
 
21
#define HEADER_ADDONS_SCREEN_HPP
 
22
 
 
23
#include "guiengine/screen.hpp"
 
24
#include "states_screens/dialogs/addons_loading.hpp"
 
25
#include "addons/addons.hpp"
 
26
#include "guiengine/widgets/label_widget.hpp"
 
27
#include <pthread.h>
 
28
#include "irrlicht.h"
 
29
/* used for the installed/unsinstalled icons*/
 
30
namespace irr { namespace gui { class STKModifiedSpriteBank; } }
 
31
 
 
32
namespace GUIEngine { class Widget; }
 
33
 
 
34
/**
 
35
  * \brief Addons screen
 
36
  * \ingroup states_screens
 
37
  */
 
38
class AddonsScreen : public GUIEngine::Screen, public GUIEngine::ScreenSingleton<AddonsScreen>
 
39
{
 
40
    friend class GUIEngine::ScreenSingleton<AddonsScreen>;
 
41
 
 
42
    AddonsScreen();
 
43
    Addons * addons;
 
44
    AddonsLoading  * load;
 
45
    void loadInformations();
 
46
    /** For the addons list, a package when it is installed. */
 
47
    irr::gui::STKModifiedSpriteBank* m_icon_bank;
 
48
    GUIEngine::LabelWidget* m_update_status;
 
49
 
 
50
public:
 
51
 
 
52
    bool can_load_list;
 
53
    pthread_mutex_t         mutex;
 
54
    std::string type;
 
55
 
 
56
    /** Load the addons into the main list.*/
 
57
    void loadList();
 
58
 
 
59
    /** \brief implement callback from parent class GUIEngine::Screen */
 
60
    virtual void loadedFromFile();
 
61
 
 
62
    /** \brief implement callback from parent class GUIEngine::Screen */
 
63
    virtual void eventCallback(GUIEngine::Widget* widget, const std::string& name, const int playerID);
 
64
 
 
65
    /** \brief implement callback from parent class GUIEngine::Screen */
 
66
    virtual void init();
 
67
 
 
68
    friend void * startInstall(void *);
 
69
 
 
70
    /** This function is used to download a text from the server to show the news. */
 
71
    static void * downloadList(void *);
 
72
 
 
73
    /** This function is used to handle the thread (load the new list, etc...). */
 
74
    virtual void onUpdate(float delta,  irr::video::IVideoDriver*);
 
75
};
 
76
 
 
77
#endif
 
78
#endif