ScummVM API documentation
buy_sell_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 ULTIMA_ULTIMA1_U1DIALOGS_BUY_SELL_DIALOG_H
23 #define ULTIMA_ULTIMA1_U1DIALOGS_BUY_SELL_DIALOG_H
24 
25 #include "ultima/ultima1/u1dialogs/dialog.h"
26 #include "ultima/shared/gfx/character_input.h"
27 
28 namespace Ultima {
29 namespace Ultima1 {
30 namespace U1Dialogs {
31 
32 #define DIALOG_CLOSE_DELAY 50
33 
34 enum BuySell { SELECT, BUY, SELL, SOLD, CANT_AFFORD, DONE };
35 
36 using Shared::CShowMsg;
37 using Shared::CFrameMsg;
38 using Shared::CCharacterInputMsg;
39 
43 class BuySellDialog : public Dialog {
44  DECLARE_MESSAGE_MAP;
45  bool ShowMsg(CShowMsg *msg);
46  bool FrameMsg(CFrameMsg *msg);
47  virtual bool CharacterInputMsg(CCharacterInputMsg *msg);
48 private:
49  Shared::Gfx::CharacterInput _charInput;
50 protected:
51  BuySell _mode;
52  Common::String _title;
53  uint _closeCounter;
54 protected:
58  BuySellDialog(Ultima1Game *game, const Common::String &title);
59 
63  void nothing();
64 
68  virtual void setMode(BuySell mode);
69 
73  void showSold() { setMode(SOLD); }
74 
78  void cantAfford() { setMode(CANT_AFFORD); }
79 
83  void closeShortly() { _closeCounter = 3 * DIALOG_CLOSE_DELAY; }
84 public:
85  CLASSDEF;
86 
90  void draw() override;
91 };
92 
93 } // End of namespace U1Dialogs
94 } // End of namespace Ultima1
95 } // End of namespace Ultima
96 
97 #endif
Definition: str.h:59
BuySellDialog(Ultima1Game *game, const Common::String &title)
Definition: messages.h:225
void cantAfford()
Definition: buy_sell_dialog.h:78
Definition: messages.h:290
Definition: character_input.h:34
Definition: detection.h:27
void closeShortly()
Definition: buy_sell_dialog.h:83
void showSold()
Definition: buy_sell_dialog.h:73
Definition: game.h:42
Definition: buy_sell_dialog.h:43
Definition: messages.h:280
Definition: dialog.h:42
virtual void setMode(BuySell mode)