SuperTuxKart
achievement_progress_dialog.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2018 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 
19 #ifndef HEADER_ACHIEVEMENT_PROGRESS_DIALOG_HPP
20 #define HEADER_ACHIEVEMENT_PROGRESS_DIALOG_HPP
21 
22 #include "achievements/achievement.hpp"
23 #include "guiengine/modaldialog.hpp"
24 #include "utils/types.hpp"
25 
26 #include <irrString.h>
27 #include <vector>
28 
29 namespace GUIEngine
30 {
31  class IconButtonWidget;
32  class LabelWidget;
33  class ListWidget;
34  class RibbonWidget;
35 }
36 
42 {
43 private:
44  Achievement *m_achievement;
45 
46  bool m_self_destroy;
47  int m_depth;
48  int m_row_counter;//Used in the recurisve table filling
49 
50  GUIEngine::ListWidget* m_progress_table;
51  GUIEngine::LabelWidget* m_main_goal_description;
52  GUIEngine::LabelWidget* m_main_goal_progress;
53 
54  GUIEngine::RibbonWidget* m_options_widget;
55 
56  GUIEngine::IconButtonWidget* m_ok_widget;
57 
58  void recursiveFillTable(AchievementInfo::goalTree &progress,
59  AchievementInfo::goalTree &reference, int depth);
60  core::stringw niceGoalName(std::string internal_name);
61 public:
63  // ------------------------------------------------------------------------
65  // ------------------------------------------------------------------------
66  virtual void beforeAddingWidgets();
67  // ------------------------------------------------------------------------
68  virtual void init();
69  // ------------------------------------------------------------------------
70  void onEnterPressedInternal() { m_self_destroy = true; }
71  // ------------------------------------------------------------------------
72  GUIEngine::EventPropagation processEvent(const std::string& source);
73  // ------------------------------------------------------------------------
74  virtual bool onEscapePressed()
75  {
76  m_self_destroy = true;
77  return false;
78  }
79  // ------------------------------------------------------------------------
80  virtual void onUpdate(float dt);
81 };
82 
83 #endif
Contains all GUI engine related classes and functions.
Definition: abstract_state_manager.hpp:31
Definition: achievement_info.hpp:53
virtual void onUpdate(float dt)
Override to be notified of updates.
Definition: achievement_progress_dialog.cpp:350
Definition: achievement.hpp:41
Dialog that shows an achievement description and progress.
Definition: achievement_progress_dialog.hpp:41
Declares the general types that are used by the network.
A button widget with an icon and optionnaly a label beneath.
Definition: icon_button_widget.hpp:43
GUIEngine::EventPropagation processEvent(const std::string &source)
Returns whether to block event propagation (usually, you will want to block events you processed)
Definition: achievement_progress_dialog.cpp:362
A static text/icons/tabs bar widget.
Definition: ribbon_widget.hpp:59
A vertical list widget with text entries.
Definition: list_widget.hpp:49
virtual void beforeAddingWidgets()
Optional callback invoked very early, before widgets have been added (contrast with init(),...
Definition: achievement_progress_dialog.cpp:326
virtual bool onEscapePressed()
Override to change what happens on escape pressed.
Definition: achievement_progress_dialog.hpp:74
A simple label widget.
Definition: label_widget.hpp:35
Abstract base class representing a modal dialog.
Definition: modaldialog.hpp:55
virtual void init()
Optional callback invoked after widgets have been add()ed.
Definition: achievement_progress_dialog.cpp:336