23 #ifndef BAGEL_BAGLIB_OBJECT_H 24 #define BAGEL_BAGLIB_OBJECT_H 26 #include "bagel/baglib/expression.h" 27 #include "bagel/baglib/res.h" 28 #include "bagel/boflib/gfx/bitmap.h" 29 #include "bagel/boflib/string.h" 30 #include "bagel/baglib/parse_object.h" 35 typedef void *(*BagFuncPtr)(int,
void *);
39 BMP_OBJ = BOF_BMP_OBJ,
40 SPRITE_OBJ = BOF_SPRITE_OBJ,
41 BUTTON_OBJ = BOF_BUTTON_OBJ,
42 SOUND_OBJ = BOF_SOUND_OBJ,
43 LINK_OBJ = BOF_LINK_OBJ,
44 TEXT_OBJ = BOF_TEXT_OBJ,
45 CHAR_OBJ = BOF_CHAR_OBJ,
46 VAR_OBJ = BOF_VAR_OBJ,
47 AREA_OBJ = BOF_AREA_OBJ,
48 EXPRESS_OBJ = BOF_EXPRESS_OBJ,
49 COMMAND_OBJ = BOF_COMM_OBJ,
50 MOVIE_OBJ = BOF_MOVIE_OBJ,
51 THING_OBJ = BOF_THING_OBJ,
52 RESPRNT_OBJ = BOF_RESPRNT_OBJ,
53 DOSSIER_OBJ = BOF_DOSSIER_OBJ,
57 enum BAG_OBJECT_PROPERTIES {
80 CBofString getStringTypeOfObject(BagObjectType n);
97 uint16 _xObjType = AREA_OBJ;
100 uint16 _nProperties = 0;
105 byte _nOverCursor = 0;
107 byte _bMsgWaiting : 1;
108 byte _bAlwaysUpdate : 1;
112 byte _bInteractive = 0;
115 bool isProperty(BAG_OBJECT_PROPERTIES xProp) {
116 return _nProperties & xProp;
119 void setProperty(BAG_OBJECT_PROPERTIES xProp,
bool bVal);
125 bool isInteractive() {
126 return _bInteractive;
128 void setInteractive(
bool b) {
129 _bInteractive = (byte)b;
133 virtual bool runCallBack() {
137 virtual BagFuncPtr getCallBack() {
142 virtual bool runObject();
152 ErrorCode attach()
override;
153 ErrorCode detach()
override;
155 BagObjectType getType() {
156 return (BagObjectType)_xObjType;
158 void setType(BagObjectType nType) {
159 _xObjType = (uint16)nType;
163 virtual bool isInside(
const CBofPoint &xPoint) {
164 return getRect().ptInRect(xPoint);
169 return isProperty(MOVABLE);
171 void setMovable(
bool b =
true) {
172 setProperty(MOVABLE, b);
175 bool isStretchable() {
176 return isProperty(STRETCH);
178 void setStretchable(
bool b =
true) {
179 setProperty(STRETCH, b);
183 return isProperty(MODAL);
185 void setModal(
bool b =
true) {
186 setProperty(MODAL, b);
188 virtual bool isModalDone() {
193 return isProperty(VISIBLE);
195 void setVisible(
bool b =
true) {
196 setProperty(VISIBLE, b);
200 return isProperty(HIGHLIGHT);
202 void setHighlight(
bool b =
true) {
203 setProperty(HIGHLIGHT, b);
207 return isProperty(ACTIVE);
209 void setActive(
bool b =
true) {
210 setProperty(ACTIVE, b);
213 bool isTransparent() {
214 return isProperty(TRANSPAR);
217 virtual void setTransparent(
bool b =
true) {
218 setProperty(TRANSPAR, b);
221 bool isHideOnClick() {
222 return isProperty(HIDEONCLK);
224 void setHideOnClick(
bool b =
true) {
225 setProperty(HIDEONCLK, b);
228 bool isImmediateRun() {
229 return isProperty(IMRUN);
231 void setImmediateRun(
bool b =
true) {
232 setProperty(IMRUN, b);
236 return isProperty(LOCAL);
238 void setLocal(
bool b =
true) {
239 setProperty(LOCAL, b);
243 return isProperty(NEGATIVE);
245 void setNegative(
bool b =
true) {
246 setProperty(NEGATIVE, b);
249 bool isConstantUpdate() {
250 return isProperty(CONUPDATE);
252 void setConstantUpdate(
bool b =
true) {
253 setProperty(CONUPDATE, b);
257 return isProperty(TIMELESS);
260 void setTimeless(
bool b =
true);
263 return isProperty(FLOATING);
265 void setFloating(
bool b =
true) {
266 setProperty(FLOATING, b);
270 return isProperty(PRELOAD);
272 void setPreload(
bool b =
true) {
273 setProperty(PRELOAD, b);
277 void setForeGround(
bool b =
true);
279 void setProperties(
int nProperties);
282 virtual const CBofString *getInitInfo()
const;
283 virtual void setInitInfo(
const CBofString &) {}
284 virtual int getProperty(
const CBofString &sProp);
285 virtual void setProperty(
const CBofString &,
int nVal);
291 void setDirty(
bool b =
true) {
296 bool isMsgWaiting() {
297 return _bMsgWaiting != 0;
300 void setMsgWaiting(
bool b =
true) {
301 _bMsgWaiting = (byte)b;
304 bool isAlwaysUpdate() {
305 return _bAlwaysUpdate != 0;
308 void setAlwaysUpdate(
bool b =
true) {
309 _bAlwaysUpdate = (byte)b;
316 void setNoMenu(
bool b =
true) {
321 virtual int getRefId();
322 virtual int getOverCursor();
323 virtual int getState();
329 virtual void setFileName(
const CBofString &s);
330 virtual void setSize(
const CBofSize &) {}
331 virtual void setRefId(
int id);
332 virtual void setOverCursor(
int curs);
333 virtual void setState(
int state);
334 virtual void setMenuPtr(
CBagMenu *pm);
335 virtual void setPosition(
const CBofPoint &pos);
347 virtual void onLButtonDown(uint32 ,
CBofPoint * ,
void * =
nullptr) {}
348 virtual void onLButtonUp(uint32 ,
CBofPoint * ,
void * =
nullptr);
349 virtual bool onMouseMove(uint32 ,
CBofPoint ,
void * =
nullptr);
350 virtual bool onMouseOver(uint32 ,
CBofPoint ,
void * =
nullptr);
353 inline void CBagObject::setFileName(
const CBofString &s) {
357 inline void CBagObject::setMenuPtr(
CBagMenu *pm) {
Definition: ifstream.h:31
ParseCodes setInfo(CBagIfstream &istr) override
Definition: parse_object.h:45
Definition: expression.h:32
Definition: storage_dev_win.h:78