SuperTuxKart
addons_pack.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2019 SuperTuxKart-Team
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 #ifndef HEADER_ADDONS_PACK_HPP
19 #define HEADER_ADDONS_PACK_HPP
20 
21 #include "guiengine/modaldialog.hpp"
22 #include "utils/cpp2011.hpp"
23 
24 class AddonsPackRequest;
25 namespace GUIEngine { class LabelWidget; class ProgressBarWidget; }
26 
31 {
32 private:
33  GUIEngine::ProgressBarWidget* m_progress;
34 
35  GUIEngine::LabelWidget* m_size;
36 
37  void stopDownload();
38 
41  std::shared_ptr<AddonsPackRequest> m_download_request;
42  AddonsPack(const std::string& url);
43  ~AddonsPack();
44 public:
45  virtual GUIEngine::EventPropagation processEvent(const std::string& event_source) OVERRIDE;
46  virtual void beforeAddingWidgets() OVERRIDE;
47  virtual void init() OVERRIDE;
48  void onUpdate(float delta) OVERRIDE;
49  virtual bool onEscapePressed() OVERRIDE;
50  static void install(const std::string& name);
51  static void uninstall(const std::string& name, bool force_remove_skin = false);
52  static void uninstallByName(const std::string& name, bool force_clear = false);
53 }; // DownloadAssets
54 
55 #endif
Definition: addons_pack.cpp:51
Definition: addons_pack.hpp:31
void onUpdate(float delta) OVERRIDE
Override to be notified of updates.
Definition: addons_pack.cpp:204
virtual GUIEngine::EventPropagation processEvent(const std::string &event_source) OVERRIDE
Returns whether to block event propagation (usually, you will want to block events you processed)
Definition: addons_pack.cpp:177
void stopDownload()
This function is called when the user click on 'Back', 'Cancel' or press escape.
Definition: addons_pack.cpp:245
std::shared_ptr< AddonsPackRequest > m_download_request
A pointer to the download request, which gives access to the progress of a download.
Definition: addons_pack.hpp:41
virtual void init() OVERRIDE
Optional callback invoked after widgets have been add()ed.
Definition: addons_pack.cpp:164
virtual bool onEscapePressed() OVERRIDE
Override to change what happens on escape pressed.
Definition: addons_pack.cpp:170
AddonsPack(const std::string &url)
Creates a modal dialog with given percentage of screen width and height.
Definition: addons_pack.cpp:109
virtual void beforeAddingWidgets() OVERRIDE
Optional callback invoked very early, before widgets have been added (contrast with init(),...
Definition: addons_pack.cpp:158
A simple label widget.
Definition: label_widget.hpp:41
Abstract base class representing a modal dialog.
Definition: modaldialog.hpp:56
A progress bar widget.
Definition: progress_bar_widget.hpp:36
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:33