ScummVM API documentation
computer.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_SPACEBAR_COMPUTER_H
24 #define BAGEL_SPACEBAR_COMPUTER_H
25 
26 #include "bagel/spacebar/spacebar.h"
27 #include "bagel/boflib/gui/list_box.h"
28 #include "bagel/boflib/gui/text_box.h"
29 #include "bagel/boflib/gui/button.h"
30 #include "bagel/boflib/list.h"
31 
32 namespace Bagel {
33 namespace SpaceBar {
34 
35 #define NUM_COMPBUTT 12
36 
37 // ID's and INDEX of buttons
38 #define OFFBUT 0
39 #define ONBUT 1
40 #define DRINKS 2
41 #define INGRED 3
42 #define LISTD 4
43 #define LISTI 5
44 #define ORDER 6
45 #define PGUP 7
46 #define PGDOWN 8
47 #define BCBACK 9
48 #define BCHELP 10
49 #define BCQUIT 11
50 
51 enum COMPMODE {
52  OFFMODE, DRINKMODE, INGMODE, LISTMODE
53 };
54 
55 class SBarCompItem {
56 public:
57  char *_pItem;
58  char *_pList;
59  char *_pDrink;
60 };
61 
63 private:
64  CBofRect _compDisplay;
65  CBofRect _compTextWindow;
66 
67 protected:
68  CBofListBox *_pDrinkBox; // Used for list of Drinks
69  CBofListBox *_pIngBox; // Used for list of Ingredients
70  CBofTextBox *_pTBox; // Used to display the list
71  char *_pDrinkBuff;
72  char *_pIngBuff;
73  CBofList<SBarCompItem> *_pDrinkList;
74  CBofList<SBarCompItem> *_pIngList;
75  int _nDrinkSelect;
76  int _nIngSelect;
77  CBofBmpButton *_pButtons[NUM_COMPBUTT];
78  COMPMODE _eMode;
79  COMPMODE _ePrevMode;
80 
81 public:
82  SBarComputer();
83  virtual ~SBarComputer();
84 
85  void onBofListBox(CBofObject *pListBox, int nItemIndex);
86 
87  virtual void onBofButton(CBofObject *pButton, int nState);
88  virtual void onKeyHit(uint32 lKey, uint32 nRepCount);
89 
93  virtual ErrorCode attach();
94 
98  virtual ErrorCode detach();
99 
100  ErrorCode createDrinksListBox();
101  ErrorCode createIngListBox();
102 
103  void createTextBox(CBofString &newText);
104  void deleteTextBox();
105  void deleteListBox();
106 
107  void setOn();
108  void setOff();
109  void setDrink();
110  void setIng();
111  void setList();
112 
116  ErrorCode readDrnkFile();
117 
121  ErrorCode readIngFile();
122 
126  void order();
127 
128  void pageUp();
129  void pageDown();
130  void back();
131 
132  void onMainLoop();
133 
134  virtual void onTimer(uint32 /*nTimerID*/) {
135  }
136 
137  void onPaint(CBofRect *pRect);
138  void eraseBackdrop();
139 
140  void onLButtonDown(uint32 /*nFlags*/, CBofPoint * /*pPoint*/, void * = nullptr) {}
141  void onLButtonUp(uint32 /*nFlags*/, CBofPoint * /*pPoint*/, void * = nullptr) {}
142 
143  void onMouseMove(uint32 nFlags, CBofPoint *, void * = nullptr);
144 };
145 
146 } // namespace SpaceBar
147 } // namespace Bagel
148 
149 #endif
Definition: storage_dev_win.h:406
Definition: object.h:28
Definition: list_box.h:49
Definition: rect.h:36
Definition: button.h:109
Definition: computer.h:55
Definition: text_box.h:34
Definition: string.h:38
Definition: bagel.h:31
Definition: point.h:34
Definition: list.h:60
Definition: computer.h:62