ScummVM API documentation
massadd.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef MASSADD_DIALOG_H
23 #define MASSADD_DIALOG_H
24 
25 #include "gui/dialog.h"
26 #include "gui/widgets/list.h"
27 #include "common/fs.h"
28 #include "common/hashmap.h"
29 #include "common/stack.h"
30 #include "common/str.h"
31 
32 namespace GUI {
33 
34 class StaticTextWidget;
35 class MassAddListWidget;
36 
37 class MassAddDialog : public Dialog {
38 public:
39  MassAddDialog(const Common::FSNode &startDir);
40 
41  //void open();
42  void handleCommand(CommandSender *sender, uint32 cmd, uint32 data) override;
43  void handleTickle() override;
44 
45  Common::String getFirstAddedTarget() const {
46  if (!_games.empty())
47  return _games.front().gameId;
48  return Common::String();
49  }
50 
51 private:
53  DetectedGames _games;
54 
55  void updateGameList();
56 
64 
65  int _dirsScanned;
66  int _oldGamesCount;
67  int _dirTotal;
68 
69  Widget *_okButton;
70  StaticTextWidget *_dirProgressText;
71  StaticTextWidget *_gameProgressText;
72 
73  MassAddListWidget *_list;
74 };
75 
76 class MassAddListWidget : public ListWidget {
77 public:
78  MassAddListWidget(Dialog *boss, const Common::String &name)
79  : ListWidget(boss, name) { }
80 
81  void appendToSelectedList(bool selected) { _listSelected.push_back(selected); }
82  void clearSelectedList() { _listSelected.clear(); }
83 
84 protected:
85  ThemeEngine::WidgetStateInfo getItemState(int item) const override {
86  // Display selected/unselected games in mass detection as enabled/disabled items.
87  if (item < (signed int)_listSelected.size() && _listSelected[item]) {
89  } else {
91  }
92  }
93 
94  Common::Array<bool> _listSelected;
95 };
96 
97 } // End of namespace GUI
98 
99 #endif
Definition: path.h:220
Definition: str.h:59
Definition: massadd.h:37
Definition: path.h:224
Definition: path.h:52
Definition: widget.h:205
T & front()
Definition: array.h:217
Definition: system.h:46
bool empty() const
Definition: array.h:351
Definition: hashmap.h:85
Definition: fs.h:69
Array< String > StringArray
Definition: str-array.h:43
Indicates that the widget is enabled.
Definition: ThemeEngine.h:251
Definition: list.h:51
Definition: massadd.h:76
Definition: dialog.h:49
State
State of the widget to be drawn.
Definition: ThemeEngine.h:249
Definition: widget.h:101
Indicates that the widget is disabled, that does NOT include that it is invisible.
Definition: ThemeEngine.h:250
Definition: object.h:40