ScummVM API documentation
restore_dialog.h
1 
2 /* ScummVM - Graphic Adventure Engine
3  *
4  * ScummVM is the legal property of its developers, whose names
5  * are too numerous to list here. Please refer to the COPYRIGHT
6  * file distributed with this source distribution.
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 
23 #ifndef BAGEL_DIALOGS_RESTORE_DIALOG_H
24 #define BAGEL_DIALOGS_RESTORE_DIALOG_H
25 
26 #include "bagel/bagel.h"
27 #include "bagel/boflib/gui/list_box.h"
28 #include "bagel/boflib/gui/scroll_bar.h"
29 #include "bagel/boflib/gui/button.h"
30 #include "bagel/boflib/gui/text_box.h"
31 #include "bagel/dialogs/save_dialog.h"
32 
33 namespace Bagel {
34 
35 #define NUM_RESTORE_BTNS 6
36 
37 class CBagRestoreDialog : public CBofDialog {
38 private:
39  ErrorCode RestoreAndclose();
40 
41  CBofBmpButton *_pButtons[NUM_RESTORE_BTNS];
42  CBofScrollBar *_pScrollBar = nullptr;
43 
44  CBofText *_pText = nullptr;
45  CBofListBox *_pListBox = nullptr;
46  int _nSelectedItem = -1;
47  StBagelSave *_pSaveBuf = nullptr;
48  int _nBufSize = 0;
49  bool _bRestored = false;
50  CBofPalette *_pSavePalette = nullptr;
51  SaveStateList _savesList;
52 
53 protected:
54  void onPaint(CBofRect *pRect) override;
55  void onBofButton(CBofObject *pObject, int nState) override;
56  void onBofListBox(CBofObject *pObject, int nItemIndex) override;
57 
58  void onKeyHit(uint32 lKey, uint32 lRepCount) override;
59 
60 public:
62 
63  virtual ErrorCode attach();
64  virtual ErrorCode detach();
65 
66  StBagelSave *getSaveGameBuffer(int &nLength) {
67  nLength = _nBufSize;
68  return _pSaveBuf;
69  }
70 
71  void setSaveGameBuffer(StBagelSave *pBuf, int nLength) {
72  _pSaveBuf = pBuf;
73  _nBufSize = nLength;
74  }
75 
76  bool restored() {
77  return _bRestored;
78  }
79 
80  void onInitDialog() override;
81 };
82 
83 } // namespace Bagel
84 
85 #endif
Definition: scroll_bar.h:43
Definition: object.h:28
Definition: list_box.h:49
Definition: dialog.h:38
Definition: rect.h:36
Definition: button.h:109
Definition: bagel.h:31
Definition: palette.h:69
Definition: text.h:122
Definition: save_game_file.h:103
Definition: restore_dialog.h:37