ScummVM API documentation
dialog.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 BAGEL_BOFLIB_GUI_DIALOG_H
23 #define BAGEL_BOFLIB_GUI_DIALOG_H
24 
25 #include "bagel/boflib/gui/window.h"
26 #include "bagel/boflib/gfx/bitmap.h"
27 
28 namespace Bagel {
29 
30 #define IDOK 1
31 #define IDCANCEL 2
32 
33 #define BOFDLG_TRANSPARENT 0x00000001
34 #define BOFDLG_SAVEBACKGND 0x00000002
35 
36 #define BOFDLG_DEFAULT (BOFDLG_TRANSPARENT /* | BOFDLG_SAVEBACKGND*/)
37 
38 class CBofDialog : public CBofWindow {
39 protected:
40  CBofBitmap *_pDlgBackground = nullptr;
41  uint32 _lFlags = 0;
42  int _nReturnValue = 0;
43 
44  bool _bFirstTime = false;
45  bool _bTempBitmap = false;
46  bool _bEndDialog = false;
47  bool _bHavePainted = false;
48 
49 protected:
50  virtual ErrorCode paint(CBofRect *pRect);
51  virtual ErrorCode paintBackground();
52  virtual ErrorCode saveBackground();
53  virtual ErrorCode killBackground();
54 
55  void onPaint(CBofRect *pRect) override;
56  void onClose() override;
57  virtual void onInitDialog();
58 
59 public:
63  CBofDialog();
64 
68  CBofDialog(const char *pszFileName, CBofWindow *pParent, uint32 nID = 0, uint32 lFlags = BOFDLG_DEFAULT);
69 
73  virtual ~CBofDialog();
74 
86  ErrorCode create(const char *pszName, int x, int y, int nWidth, int nHeight, CBofWindow *pParent, uint32 nControlID = 0) override;
87 
96  ErrorCode create(const char *pszName, CBofRect *pRect, CBofWindow *pParent, uint32 nControlID = 0) override;
97 
101  void setFlags(uint32 lFlags) {
102  _lFlags = lFlags;
103  }
104 
108  uint32 getFlags() const {
109  return _lFlags;
110  }
111 
115  int doModal();
116 
120  void endModal() {
121  _bEndDialog = true;
122  }
123 
127  void setReturnValue(int nValue) {
128  _nReturnValue = nValue;
129  }
130 
135  int getReturnValue() const {
136  return _nReturnValue;
137  }
138 };
139 
140 } // namespace Bagel
141 
142 #endif
Definition: window.h:50
void setFlags(uint32 lFlags)
Definition: dialog.h:101
Definition: bitmap.h:55
Definition: dialog.h:38
Definition: rect.h:36
uint32 getFlags() const
Definition: dialog.h:108
void setReturnValue(int nValue)
Definition: dialog.h:127
void endModal()
Definition: dialog.h:120
int getReturnValue() const
Definition: dialog.h:135
Definition: bagel.h:31
virtual ~CBofDialog()
ErrorCode create(const char *pszName, int x, int y, int nWidth, int nHeight, CBofWindow *pParent, uint32 nControlID=0) override