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