diff options
| author | Einar Johan Trøan Sømåen | 2012-07-21 21:01:47 +0200 |
|---|---|---|
| committer | Einar Johan Trøan Sømåen | 2012-07-21 21:01:47 +0200 |
| commit | b5a07fef8ebf29f7f44b15d9b34799c7e115fdad (patch) | |
| tree | 76599c7b51aa6ad0447cb6ff6847f9eba54a679a /engines/wintermute/ui | |
| parent | 2e82471240804df65acdf51c43ea044cbb81ae68 (diff) | |
| download | scummvm-rg350-b5a07fef8ebf29f7f44b15d9b34799c7e115fdad.tar.gz scummvm-rg350-b5a07fef8ebf29f7f44b15d9b34799c7e115fdad.tar.bz2 scummvm-rg350-b5a07fef8ebf29f7f44b15d9b34799c7e115fdad.zip | |
WINTERMUTE: Get rid of the C-prefix for class-definitions.
Diffstat (limited to 'engines/wintermute/ui')
| -rw-r--r-- | engines/wintermute/ui/ui_button.cpp | 100 | ||||
| -rw-r--r-- | engines/wintermute/ui/ui_button.h | 40 | ||||
| -rw-r--r-- | engines/wintermute/ui/ui_edit.cpp | 82 | ||||
| -rw-r--r-- | engines/wintermute/ui/ui_edit.h | 20 | ||||
| -rw-r--r-- | engines/wintermute/ui/ui_entity.cpp | 42 | ||||
| -rw-r--r-- | engines/wintermute/ui/ui_entity.h | 20 | ||||
| -rw-r--r-- | engines/wintermute/ui/ui_object.cpp | 72 | ||||
| -rw-r--r-- | engines/wintermute/ui/ui_object.h | 36 | ||||
| -rw-r--r-- | engines/wintermute/ui/ui_text.cpp | 52 | ||||
| -rw-r--r-- | engines/wintermute/ui/ui_text.h | 16 | ||||
| -rw-r--r-- | engines/wintermute/ui/ui_tiled_image.cpp | 82 | ||||
| -rw-r--r-- | engines/wintermute/ui/ui_tiled_image.h | 14 | ||||
| -rw-r--r-- | engines/wintermute/ui/ui_window.cpp | 154 | ||||
| -rw-r--r-- | engines/wintermute/ui/ui_window.h | 38 |
14 files changed, 384 insertions, 384 deletions
diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp index 5b1867b652..af7e3262db 100644 --- a/engines/wintermute/ui/ui_button.cpp +++ b/engines/wintermute/ui/ui_button.cpp @@ -45,10 +45,10 @@ namespace WinterMute {
-IMPLEMENT_PERSISTENT(CUIButton, false)
+IMPLEMENT_PERSISTENT(UIButton, false)
//////////////////////////////////////////////////////////////////////////
-CUIButton::CUIButton(CBGame *inGame): CUIObject(inGame) {
+UIButton::UIButton(BaseGame *inGame): UIObject(inGame) {
_backPress = _backHover = _backDisable = _backFocus = NULL;
_fontHover = _fontPress = _fontDisable = _fontFocus = NULL;
@@ -72,7 +72,7 @@ CUIButton::CUIButton(CBGame *inGame): CUIObject(inGame) { //////////////////////////////////////////////////////////////////////////
-CUIButton::~CUIButton() {
+UIButton::~UIButton() {
delete _backPress;
delete _backHover;
delete _backDisable;
@@ -95,10 +95,10 @@ CUIButton::~CUIButton() { //////////////////////////////////////////////////////////////////////////
-bool CUIButton::loadFile(const char *filename) {
+bool UIButton::loadFile(const char *filename) {
byte *buffer = _gameRef->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
- _gameRef->LOG(0, "CUIButton::LoadFile failed for file '%s'", filename);
+ _gameRef->LOG(0, "UIButton::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
}
@@ -154,7 +154,7 @@ TOKEN_DEF(PIXEL_PERFECT) TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-bool CUIButton::loadBuffer(byte *buffer, bool complete) {
+bool UIButton::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(BUTTON)
TOKEN_TABLE(TEMPLATE)
@@ -196,7 +196,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { byte *params;
int cmd = 2;
- CBParser parser(_gameRef);
+ BaseParser parser(_gameRef);
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_BUTTON) {
@@ -222,7 +222,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK:
delete _back;
- _back = new CUITiledImage(_gameRef);
+ _back = new UITiledImage(_gameRef);
if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
delete _back;
_back = NULL;
@@ -232,7 +232,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK_HOVER:
delete _backHover;
- _backHover = new CUITiledImage(_gameRef);
+ _backHover = new UITiledImage(_gameRef);
if (!_backHover || DID_FAIL(_backHover->loadFile((char *)params))) {
delete _backHover;
_backHover = NULL;
@@ -242,7 +242,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK_PRESS:
delete _backPress;
- _backPress = new CUITiledImage(_gameRef);
+ _backPress = new UITiledImage(_gameRef);
if (!_backPress || DID_FAIL(_backPress->loadFile((char *)params))) {
delete _backPress;
_backPress = NULL;
@@ -252,7 +252,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK_DISABLE:
delete _backDisable;
- _backDisable = new CUITiledImage(_gameRef);
+ _backDisable = new UITiledImage(_gameRef);
if (!_backDisable || DID_FAIL(_backDisable->loadFile((char *)params))) {
delete _backDisable;
_backDisable = NULL;
@@ -262,7 +262,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK_FOCUS:
delete _backFocus;
- _backFocus = new CUITiledImage(_gameRef);
+ _backFocus = new UITiledImage(_gameRef);
if (!_backFocus || DID_FAIL(_backFocus->loadFile((char *)params))) {
delete _backFocus;
_backFocus = NULL;
@@ -272,7 +272,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE:
delete _image;
- _image = new CBSprite(_gameRef);
+ _image = new BaseSprite(_gameRef);
if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
delete _image;
_image = NULL;
@@ -282,7 +282,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE_HOVER:
delete _imageHover;
- _imageHover = new CBSprite(_gameRef);
+ _imageHover = new BaseSprite(_gameRef);
if (!_imageHover || DID_FAIL(_imageHover->loadFile((char *)params))) {
delete _imageHover;
_imageHover = NULL;
@@ -292,7 +292,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE_PRESS:
delete _imagePress;
- _imagePress = new CBSprite(_gameRef);
+ _imagePress = new BaseSprite(_gameRef);
if (!_imagePress || DID_FAIL(_imagePress->loadFile((char *)params))) {
delete _imagePress;
_imagePress = NULL;
@@ -302,7 +302,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE_DISABLE:
delete _imageDisable;
- _imageDisable = new CBSprite(_gameRef);
+ _imageDisable = new BaseSprite(_gameRef);
if (!_imageDisable || DID_FAIL(_imageDisable->loadFile((char *)params))) {
delete _imageDisable;
_imageDisable = NULL;
@@ -312,7 +312,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE_FOCUS:
delete _imageFocus;
- _imageFocus = new CBSprite(_gameRef);
+ _imageFocus = new BaseSprite(_gameRef);
if (!_imageFocus || DID_FAIL(_imageFocus->loadFile((char *)params))) {
delete _imageFocus;
_imageFocus = NULL;
@@ -379,7 +379,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { case TOKEN_CURSOR:
delete _cursor;
- _cursor = new CBSprite(_gameRef);
+ _cursor = new BaseSprite(_gameRef);
if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
delete _cursor;
_cursor = NULL;
@@ -439,7 +439,7 @@ bool CUIButton::loadBuffer(byte *buffer, bool complete) { }
//////////////////////////////////////////////////////////////////////////
-bool CUIButton::saveAsText(CBDynBuffer *buffer, int indent) {
+bool UIButton::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "BUTTON\n");
buffer->putTextIndent(indent, "{\n");
@@ -501,7 +501,7 @@ bool CUIButton::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "TEXT_ALIGN=\"%s\"\n", "center");
break;
default:
- warning("CUIButton::SaveAsText - unhandled enum");
+ warning("UIButton::SaveAsText - unhandled enum");
break;
}
@@ -531,17 +531,17 @@ bool CUIButton::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n");
// editor properties
- CBBase::saveAsText(buffer, indent + 2);
+ BaseClass::saveAsText(buffer, indent + 2);
buffer->putTextIndent(indent, "}\n");
return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-void CUIButton::correctSize() {
+void UIButton::correctSize() {
Rect32 rect;
- CBSprite *img = NULL;
+ BaseSprite *img = NULL;
if (_image) img = _image;
else if (_imageDisable) img = _imageDisable;
else if (_imageHover) img = _imageHover;
@@ -577,21 +577,21 @@ void CUIButton::correctSize() { //////////////////////////////////////////////////////////////////////////
-bool CUIButton::display(int offsetX, int offsetY) {
+bool UIButton::display(int offsetX, int offsetY) {
if (!_visible)
return STATUS_OK;
- CUITiledImage *back = NULL;
- CBSprite *image = NULL;
- CBFont *font = 0;
+ UITiledImage *back = NULL;
+ BaseSprite *image = NULL;
+ BaseFont *font = 0;
//RECT rect;
- //CBPlatform::setRect(&rect, OffsetX + _posX, OffsetY + _posY, OffsetX+_posX+_width, OffsetY+_posY+_height);
- //_hover = (!_disable && CBPlatform::ptInRect(&rect, _gameRef->_mousePos)!=FALSE);
+ //BasePlatform::setRect(&rect, OffsetX + _posX, OffsetY + _posY, OffsetX+_posX+_width, OffsetY+_posY+_height);
+ //_hover = (!_disable && BasePlatform::ptInRect(&rect, _gameRef->_mousePos)!=FALSE);
_hover = (!_disable && _gameRef->_activeObject == this && (_gameRef->_interactive || _gameRef->_state == GAME_SEMI_FROZEN));
if ((_press && _hover && !_gameRef->_mouseLeftDown) ||
- (_oneTimePress && CBPlatform::getTime() - _oneTimePressTime >= 100)) press();
+ (_oneTimePress && BasePlatform::getTime() - _oneTimePressTime >= 100)) press();
if (_disable) {
@@ -638,7 +638,7 @@ bool CUIButton::display(int offsetX, int offsetY) { font->drawText((byte *)_text, offsetX + _posX + ((_press || _oneTimePress) ? 1 : 0), offsetY + _posY + text_offset + ((_press || _oneTimePress) ? 1 : 0), _width, _align);
}
- if (!_pixelPerfect || !_image) _gameRef->_renderer->_rectList.add(new CBActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false));
+ if (!_pixelPerfect || !_image) _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false));
// reset unused sprites
if (_image && _image != image) _image->reset();
@@ -654,7 +654,7 @@ bool CUIButton::display(int offsetX, int offsetY) { //////////////////////////////////////////////////////////////////////////
-void CUIButton::press() {
+void UIButton::press() {
applyEvent("Press");
if (_listenerObject) _listenerObject->listen(_listenerParamObject, _listenerParamDWORD);
if (_parentNotify && _parent) _parent->applyEvent(_name);
@@ -666,13 +666,13 @@ void CUIButton::press() { //////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+bool UIButton::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// SetDisabledFont
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "SetDisabledFont") == 0) {
stack->correctParams(1);
- CScValue *Val = stack->pop();
+ ScValue *Val = stack->pop();
if (_fontDisable) _gameRef->_fontStorage->removeFont(_fontDisable);
if (Val->isNULL()) {
@@ -690,7 +690,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetHoverFont") == 0) {
stack->correctParams(1);
- CScValue *val = stack->pop();
+ ScValue *val = stack->pop();
if (_fontHover) _gameRef->_fontStorage->removeFont(_fontHover);
if (val->isNULL()) {
@@ -708,7 +708,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetPressedFont") == 0) {
stack->correctParams(1);
- CScValue *Val = stack->pop();
+ ScValue *Val = stack->pop();
if (_fontPress) _gameRef->_fontStorage->removeFont(_fontPress);
if (Val->isNULL()) {
@@ -726,7 +726,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetFocusedFont") == 0) {
stack->correctParams(1);
- CScValue *val = stack->pop();
+ ScValue *val = stack->pop();
if (_fontFocus) _gameRef->_fontStorage->removeFont(_fontFocus);
if (val->isNULL()) {
@@ -746,7 +746,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1);
delete _imageDisable;
- _imageDisable = new CBSprite(_gameRef);
+ _imageDisable = new BaseSprite(_gameRef);
const char *filename = stack->pop()->getString();
if (!_imageDisable || DID_FAIL(_imageDisable->loadFile(filename))) {
delete _imageDisable;
@@ -787,7 +787,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1);
delete _imageHover;
- _imageHover = new CBSprite(_gameRef);
+ _imageHover = new BaseSprite(_gameRef);
const char *filename = stack->pop()->getString();
if (!_imageHover || DID_FAIL(_imageHover->loadFile(filename))) {
delete _imageHover;
@@ -827,7 +827,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1);
delete _imagePress;
- _imagePress = new CBSprite(_gameRef);
+ _imagePress = new BaseSprite(_gameRef);
const char *filename = stack->pop()->getString();
if (!_imagePress || DID_FAIL(_imagePress->loadFile(filename))) {
delete _imagePress;
@@ -867,7 +867,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1);
delete _imageFocus;
- _imageFocus = new CBSprite(_gameRef);
+ _imageFocus = new BaseSprite(_gameRef);
const char *filename = stack->pop()->getString();
if (!_imageFocus || DID_FAIL(_imageFocus->loadFile(filename))) {
delete _imageFocus;
@@ -908,7 +908,7 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS if (_visible && !_disable) {
_oneTimePress = true;
- _oneTimePressTime = CBPlatform::getTime();
+ _oneTimePressTime = BasePlatform::getTime();
}
stack->pushNULL();
@@ -916,12 +916,12 @@ bool CUIButton::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS }
- else return CUIObject::scCallMethod(script, stack, thisStack, name);
+ else return UIObject::scCallMethod(script, stack, thisStack, name);
}
//////////////////////////////////////////////////////////////////////////
-CScValue *CUIButton::scGetProperty(const char *name) {
+ScValue *UIButton::scGetProperty(const char *name) {
_scValue->setNULL();
//////////////////////////////////////////////////////////////////////////
@@ -962,12 +962,12 @@ CScValue *CUIButton::scGetProperty(const char *name) { return _scValue;
}
- else return CUIObject::scGetProperty(name);
+ else return UIObject::scGetProperty(name);
}
//////////////////////////////////////////////////////////////////////////
-bool CUIButton::scSetProperty(const char *name, CScValue *value) {
+bool UIButton::scSetProperty(const char *name, ScValue *value) {
//////////////////////////////////////////////////////////////////////////
// TextAlign
//////////////////////////////////////////////////////////////////////////
@@ -1000,20 +1000,20 @@ bool CUIButton::scSetProperty(const char *name, CScValue *value) { return STATUS_OK;
}
- else return CUIObject::scSetProperty(name, value);
+ else return UIObject::scSetProperty(name, value);
}
//////////////////////////////////////////////////////////////////////////
-const char *CUIButton::scToString() {
+const char *UIButton::scToString() {
return "[button]";
}
//////////////////////////////////////////////////////////////////////////
-bool CUIButton::persist(CBPersistMgr *persistMgr) {
+bool UIButton::persist(BasePersistenceManager *persistMgr) {
- CUIObject::persist(persistMgr);
+ UIObject::persist(persistMgr);
persistMgr->transfer(TMEMBER_INT(_align));
persistMgr->transfer(TMEMBER(_backDisable));
diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h index c6538f4423..5c034d6113 100644 --- a/engines/wintermute/ui/ui_button.h +++ b/engines/wintermute/ui/ui_button.h @@ -35,42 +35,42 @@ namespace WinterMute {
-class CUIButton : public CUIObject {
+class UIButton : public UIObject {
public:
bool _pixelPerfect;
bool _stayPressed;
bool _centerImage;
bool _oneTimePress;
uint32 _oneTimePressTime;
- DECLARE_PERSISTENT(CUIButton, CUIObject)
+ DECLARE_PERSISTENT(UIButton, UIObject)
void press();
virtual bool display(int offsetX = 0, int offsetY = 0);
bool _press;
bool _hover;
void correctSize();
TTextAlign _align;
- CBSprite *_imageHover;
- CBSprite *_imagePress;
- CBSprite *_imageDisable;
- CBSprite *_imageFocus;
- CBFont *_fontDisable;
- CBFont *_fontPress;
- CBFont *_fontHover;
- CBFont *_fontFocus;
- CUITiledImage *_backPress;
- CUITiledImage *_backHover;
- CUITiledImage *_backDisable;
- CUITiledImage *_backFocus;
- CUIButton(CBGame *inGame = NULL);
- virtual ~CUIButton();
+ BaseSprite *_imageHover;
+ BaseSprite *_imagePress;
+ BaseSprite *_imageDisable;
+ BaseSprite *_imageFocus;
+ BaseFont *_fontDisable;
+ BaseFont *_fontPress;
+ BaseFont *_fontHover;
+ BaseFont *_fontFocus;
+ UITiledImage *_backPress;
+ UITiledImage *_backHover;
+ UITiledImage *_backDisable;
+ UITiledImage *_backFocus;
+ UIButton(BaseGame *inGame = NULL);
+ virtual ~UIButton();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
- virtual bool saveAsText(CBDynBuffer *buffer, int indent);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
// scripting interface
- virtual CScValue *scGetProperty(const char *name);
- virtual bool scSetProperty(const char *name, CScValue *value);
- virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ScValue *scGetProperty(const char *name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp index 237b944332..d9c6c6586a 100644 --- a/engines/wintermute/ui/ui_edit.cpp +++ b/engines/wintermute/ui/ui_edit.cpp @@ -50,10 +50,10 @@ namespace WinterMute {
-IMPLEMENT_PERSISTENT(CUIEdit, false)
+IMPLEMENT_PERSISTENT(UIEdit, false)
//////////////////////////////////////////////////////////////////////////
-CUIEdit::CUIEdit(CBGame *inGame): CUIObject(inGame) {
+UIEdit::UIEdit(BaseGame *inGame): UIObject(inGame) {
_type = UI_EDIT;
_fontSelected = NULL;
@@ -80,7 +80,7 @@ CUIEdit::CUIEdit(CBGame *inGame): CUIObject(inGame) { //////////////////////////////////////////////////////////////////////////
-CUIEdit::~CUIEdit() {
+UIEdit::~UIEdit() {
if (!_sharedFonts) {
if (_fontSelected) _gameRef->_fontStorage->removeFont(_fontSelected);
}
@@ -91,10 +91,10 @@ CUIEdit::~CUIEdit() { //////////////////////////////////////////////////////////////////////////
-bool CUIEdit::loadFile(const char *filename) {
+bool UIEdit::loadFile(const char *filename) {
byte *buffer = _gameRef->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
- _gameRef->LOG(0, "CUIEdit::LoadFile failed for file '%s'", filename);
+ _gameRef->LOG(0, "UIEdit::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
}
@@ -136,7 +136,7 @@ TOKEN_DEF(EDIT) TOKEN_DEF(CAPTION)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-bool CUIEdit::loadBuffer(byte *buffer, bool complete) {
+bool UIEdit::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(TEMPLATE)
TOKEN_TABLE(DISABLED)
@@ -164,7 +164,7 @@ bool CUIEdit::loadBuffer(byte *buffer, bool complete) { byte *params;
int cmd = 2;
- CBParser parser(_gameRef);
+ BaseParser parser(_gameRef);
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_EDIT) {
@@ -186,7 +186,7 @@ bool CUIEdit::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK:
delete _back;
- _back = new CUITiledImage(_gameRef);
+ _back = new UITiledImage(_gameRef);
if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
delete _back;
_back = NULL;
@@ -196,7 +196,7 @@ bool CUIEdit::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE:
delete _image;
- _image = new CBSprite(_gameRef);
+ _image = new BaseSprite(_gameRef);
if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
delete _image;
_image = NULL;
@@ -247,7 +247,7 @@ bool CUIEdit::loadBuffer(byte *buffer, bool complete) { case TOKEN_CURSOR:
delete _cursor;
- _cursor = new CBSprite(_gameRef);
+ _cursor = new BaseSprite(_gameRef);
if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
delete _cursor;
_cursor = NULL;
@@ -299,7 +299,7 @@ bool CUIEdit::loadBuffer(byte *buffer, bool complete) { }
//////////////////////////////////////////////////////////////////////////
-bool CUIEdit::saveAsText(CBDynBuffer *buffer, int indent) {
+bool UIEdit::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "EDIT\n");
buffer->putTextIndent(indent, "{\n");
@@ -349,7 +349,7 @@ bool CUIEdit::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n");
// editor properties
- CBBase::saveAsText(buffer, indent + 2);
+ BaseClass::saveAsText(buffer, indent + 2);
buffer->putTextIndent(indent, "}\n");
return STATUS_OK;
@@ -358,7 +358,7 @@ bool CUIEdit::saveAsText(CBDynBuffer *buffer, int indent) { //////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-bool CUIEdit::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+bool UIEdit::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// SetSelectedFont
//////////////////////////////////////////////////////////////////////////
@@ -372,12 +372,12 @@ bool CUIEdit::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta return STATUS_OK;
}
- else return CUIObject::scCallMethod(script, stack, thisStack, name);
+ else return UIObject::scCallMethod(script, stack, thisStack, name);
}
//////////////////////////////////////////////////////////////////////////
-CScValue *CUIEdit::scGetProperty(const char *name) {
+ScValue *UIEdit::scGetProperty(const char *name) {
_scValue->setNULL();
//////////////////////////////////////////////////////////////////////////
@@ -449,12 +449,12 @@ CScValue *CUIEdit::scGetProperty(const char *name) { return _scValue;
}
- else return CUIObject::scGetProperty(name);
+ else return UIObject::scGetProperty(name);
}
//////////////////////////////////////////////////////////////////////////
-bool CUIEdit::scSetProperty(const char *name, CScValue *value) {
+bool UIEdit::scSetProperty(const char *name, ScValue *value) {
//////////////////////////////////////////////////////////////////////////
// SelStart
//////////////////////////////////////////////////////////////////////////
@@ -520,18 +520,18 @@ bool CUIEdit::scSetProperty(const char *name, CScValue *value) { return STATUS_OK;
}
- else return CUIObject::scSetProperty(name, value);
+ else return UIObject::scSetProperty(name, value);
}
//////////////////////////////////////////////////////////////////////////
-const char *CUIEdit::scToString() {
+const char *UIEdit::scToString() {
return "[edit]";
}
//////////////////////////////////////////////////////////////////////////
-void CUIEdit::setCursorChar(const char *character) {
+void UIEdit::setCursorChar(const char *character) {
if (!character) return;
delete[] _cursorChar;
_cursorChar = new char [strlen(character) + 1];
@@ -540,7 +540,7 @@ void CUIEdit::setCursorChar(const char *character) { //////////////////////////////////////////////////////////////////////////
-bool CUIEdit::display(int offsetX, int offsetY) {
+bool UIEdit::display(int offsetX, int offsetY) {
if (!_visible) return STATUS_OK;
@@ -552,8 +552,8 @@ bool CUIEdit::display(int offsetX, int offsetY) { if (_image) _image->draw(offsetX + _posX, offsetY + _posY, NULL);
// prepare fonts
- CBFont *font;
- CBFont *sfont;
+ BaseFont *font;
+ BaseFont *sfont;
if (_font) font = _font;
else font = _gameRef->_systemFont;
@@ -630,8 +630,8 @@ bool CUIEdit::display(int offsetX, int offsetY) { // cursor
if (focused && curFirst) {
if (Count) {
- if (CBPlatform::getTime() - _lastBlinkTime >= _cursorBlinkRate) {
- _lastBlinkTime = CBPlatform::getTime();
+ if (BasePlatform::getTime() - _lastBlinkTime >= _cursorBlinkRate) {
+ _lastBlinkTime = BasePlatform::getTime();
_cursorVisible = !_cursorVisible;
}
if (_cursorVisible)
@@ -653,8 +653,8 @@ bool CUIEdit::display(int offsetX, int offsetY) { // cursor
if (focused && !curFirst) {
if (Count) {
- if (CBPlatform::getTime() - _lastBlinkTime >= _cursorBlinkRate) {
- _lastBlinkTime = CBPlatform::getTime();
+ if (BasePlatform::getTime() - _lastBlinkTime >= _cursorBlinkRate) {
+ _lastBlinkTime = BasePlatform::getTime();
_cursorVisible = !_cursorVisible;
}
if (_cursorVisible)
@@ -673,7 +673,7 @@ bool CUIEdit::display(int offsetX, int offsetY) { }
- _gameRef->_renderer->_rectList.add(new CBActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false));
+ _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, this, NULL, offsetX + _posX, offsetY + _posY, _width, _height, 100, 100, false));
_gameRef->_textEncoding = OrigEncoding;
@@ -683,7 +683,7 @@ bool CUIEdit::display(int offsetX, int offsetY) { //////////////////////////////////////////////////////////////////////////
-bool CUIEdit::handleKeypress(Common::Event *event, bool printable) {
+bool UIEdit::handleKeypress(Common::Event *event, bool printable) {
bool handled = false;
if (event->type == Common::EVENT_KEYDOWN && !printable) {
@@ -695,7 +695,7 @@ bool CUIEdit::handleKeypress(Common::Event *event, bool printable) { // ctrl+A
case Common::KEYCODE_a:
- if (CBKeyboardState::isControlDown()) {
+ if (BaseKeyboardState::isControlDown()) {
_selStart = 0;
_selEnd = strlen(_text);
handled = true;
@@ -716,24 +716,24 @@ bool CUIEdit::handleKeypress(Common::Event *event, bool printable) { case Common::KEYCODE_LEFT:
case Common::KEYCODE_UP:
_selEnd--;
- if (!CBKeyboardState::isShiftDown()) _selStart = _selEnd;
+ if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd;
handled = true;
break;
case Common::KEYCODE_RIGHT:
case Common::KEYCODE_DOWN:
_selEnd++;
- if (!CBKeyboardState::isShiftDown()) _selStart = _selEnd;
+ if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd;
handled = true;
break;
case Common::KEYCODE_HOME:
if (_gameRef->_textRTL) {
_selEnd = strlen(_text);
- if (!CBKeyboardState::isShiftDown()) _selStart = _selEnd;
+ if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd;
} else {
_selEnd = 0;
- if (!CBKeyboardState::isShiftDown()) _selStart = _selEnd;
+ if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd;
}
handled = true;
break;
@@ -741,10 +741,10 @@ bool CUIEdit::handleKeypress(Common::Event *event, bool printable) { case Common::KEYCODE_END:
if (_gameRef->_textRTL) {
_selEnd = 0;
- if (!CBKeyboardState::isShiftDown()) _selStart = _selEnd;
+ if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd;
} else {
_selEnd = strlen(_text);
- if (!CBKeyboardState::isShiftDown()) _selStart = _selEnd;
+ if (!BaseKeyboardState::isShiftDown()) _selStart = _selEnd;
}
handled = true;
break;
@@ -786,8 +786,8 @@ bool CUIEdit::handleKeypress(Common::Event *event, bool printable) { //////////////////////////////////////////////////////////////////////////
-int CUIEdit::deleteChars(int start, int end) {
- if (start > end) CBUtils::swap(&start, &end);
+int UIEdit::deleteChars(int start, int end) {
+ if (start > end) BaseUtils::swap(&start, &end);
start = MAX(start, (int)0);
end = MIN((size_t)end, strlen(_text));
@@ -807,7 +807,7 @@ int CUIEdit::deleteChars(int start, int end) { //////////////////////////////////////////////////////////////////////////
-int CUIEdit::insertChars(int pos, byte *chars, int num) {
+int UIEdit::insertChars(int pos, byte *chars, int num) {
if ((int)strlen(_text) + num > _maxLength) {
num -= (strlen(_text) + num - _maxLength);
}
@@ -833,9 +833,9 @@ int CUIEdit::insertChars(int pos, byte *chars, int num) { //////////////////////////////////////////////////////////////////////////
-bool CUIEdit::persist(CBPersistMgr *persistMgr) {
+bool UIEdit::persist(BasePersistenceManager *persistMgr) {
- CUIObject::persist(persistMgr);
+ UIObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_cursorBlinkRate));
persistMgr->transfer(TMEMBER(_cursorChar));
diff --git a/engines/wintermute/ui/ui_edit.h b/engines/wintermute/ui/ui_edit.h index 400cd7b578..221b8aa151 100644 --- a/engines/wintermute/ui/ui_edit.h +++ b/engines/wintermute/ui/ui_edit.h @@ -34,10 +34,10 @@ #include "common/events.h"
namespace WinterMute {
-class CBFont;
-class CUIEdit : public CUIObject {
+class BaseFont;
+class UIEdit : public UIObject {
public:
- DECLARE_PERSISTENT(CUIEdit, CUIObject)
+ DECLARE_PERSISTENT(UIEdit, UIObject)
int _maxLength;
int insertChars(int pos, byte *chars, int num);
int deleteChars(int start, int end);
@@ -52,18 +52,18 @@ public: char *_cursorChar;
int _selEnd;
int _selStart;
- CBFont *_fontSelected;
- CUIEdit(CBGame *inGame);
- virtual ~CUIEdit();
+ BaseFont *_fontSelected;
+ UIEdit(BaseGame *inGame);
+ virtual ~UIEdit();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
- virtual bool saveAsText(CBDynBuffer *buffer, int indent);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
// scripting interface
- virtual CScValue *scGetProperty(const char *name);
- virtual bool scSetProperty(const char *name, CScValue *value);
- virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ScValue *scGetProperty(const char *name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/ui/ui_entity.cpp b/engines/wintermute/ui/ui_entity.cpp index 012ff0390f..acbcd2430f 100644 --- a/engines/wintermute/ui/ui_entity.cpp +++ b/engines/wintermute/ui/ui_entity.cpp @@ -38,27 +38,27 @@ namespace WinterMute {
-IMPLEMENT_PERSISTENT(CUIEntity, false)
+IMPLEMENT_PERSISTENT(UIEntity, false)
//////////////////////////////////////////////////////////////////////////
-CUIEntity::CUIEntity(CBGame *inGame): CUIObject(inGame) {
+UIEntity::UIEntity(BaseGame *inGame): UIObject(inGame) {
_type = UI_CUSTOM;
_entity = NULL;
}
//////////////////////////////////////////////////////////////////////////
-CUIEntity::~CUIEntity() {
+UIEntity::~UIEntity() {
if (_entity) _gameRef->unregisterObject(_entity);
_entity = NULL;
}
//////////////////////////////////////////////////////////////////////////
-bool CUIEntity::loadFile(const char *filename) {
+bool UIEntity::loadFile(const char *filename) {
byte *buffer = _gameRef->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
- _gameRef->LOG(0, "CUIEntity::LoadFile failed for file '%s'", filename);
+ _gameRef->LOG(0, "UIEntity::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
}
@@ -89,7 +89,7 @@ TOKEN_DEF(SCRIPT) TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-bool CUIEntity::loadBuffer(byte *buffer, bool complete) {
+bool UIEntity::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(ENTITY_CONTAINER)
TOKEN_TABLE(TEMPLATE)
@@ -105,7 +105,7 @@ bool CUIEntity::loadBuffer(byte *buffer, bool complete) { byte *params;
int cmd = 2;
- CBParser parser(_gameRef);
+ BaseParser parser(_gameRef);
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_ENTITY_CONTAINER) {
@@ -174,7 +174,7 @@ bool CUIEntity::loadBuffer(byte *buffer, bool complete) { }
//////////////////////////////////////////////////////////////////////////
-bool CUIEntity::saveAsText(CBDynBuffer *buffer, int indent) {
+bool UIEntity::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "ENTITY_CONTAINER\n");
buffer->putTextIndent(indent, "{\n");
@@ -201,16 +201,16 @@ bool CUIEntity::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n");
// editor properties
- CBBase::saveAsText(buffer, indent + 2);
+ BaseClass::saveAsText(buffer, indent + 2);
buffer->putTextIndent(indent, "}\n");
return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-bool CUIEntity::setEntity(const char *filename) {
+bool UIEntity::setEntity(const char *filename) {
if (_entity) _gameRef->unregisterObject(_entity);
- _entity = new CAdEntity(_gameRef);
+ _entity = new AdEntity(_gameRef);
if (!_entity || DID_FAIL(_entity->loadFile(filename))) {
delete _entity;
_entity = NULL;
@@ -225,7 +225,7 @@ bool CUIEntity::setEntity(const char *filename) { }
//////////////////////////////////////////////////////////////////////////
-bool CUIEntity::display(int offsetX, int offsetY) {
+bool UIEntity::display(int offsetX, int offsetY) {
if (!_visible) return STATUS_OK;
if (_entity) {
@@ -251,7 +251,7 @@ bool CUIEntity::display(int offsetX, int offsetY) { //////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-bool CUIEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+bool UIEntity::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// GetEntity
//////////////////////////////////////////////////////////////////////////
@@ -280,12 +280,12 @@ bool CUIEntity::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS return STATUS_OK;
}
- else return CUIObject::scCallMethod(script, stack, thisStack, name);
+ else return UIObject::scCallMethod(script, stack, thisStack, name);
}
//////////////////////////////////////////////////////////////////////////
-CScValue *CUIEntity::scGetProperty(const char *name) {
+ScValue *UIEntity::scGetProperty(const char *name) {
_scValue->setNULL();
//////////////////////////////////////////////////////////////////////////
@@ -305,32 +305,32 @@ CScValue *CUIEntity::scGetProperty(const char *name) { return _scValue;
}
- else return CUIObject::scGetProperty(name);
+ else return UIObject::scGetProperty(name);
}
//////////////////////////////////////////////////////////////////////////
-bool CUIEntity::scSetProperty(const char *name, CScValue *value) {
+bool UIEntity::scSetProperty(const char *name, ScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Freezable
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "Freezable") == 0) {
if (_entity) _entity->makeFreezable(value->getBool());
return STATUS_OK;
- } else return CUIObject::scSetProperty(name, value);
+ } else return UIObject::scSetProperty(name, value);
}
//////////////////////////////////////////////////////////////////////////
-const char *CUIEntity::scToString() {
+const char *UIEntity::scToString() {
return "[entity container]";
}
//////////////////////////////////////////////////////////////////////////
-bool CUIEntity::persist(CBPersistMgr *persistMgr) {
+bool UIEntity::persist(BasePersistenceManager *persistMgr) {
- CUIObject::persist(persistMgr);
+ UIObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_entity));
return STATUS_OK;
diff --git a/engines/wintermute/ui/ui_entity.h b/engines/wintermute/ui/ui_entity.h index 6873000681..9c9bffdc4a 100644 --- a/engines/wintermute/ui/ui_entity.h +++ b/engines/wintermute/ui/ui_entity.h @@ -32,24 +32,24 @@ #include "engines/wintermute/ui/ui_object.h"
namespace WinterMute {
-class CAdEntity;
-class CUIEntity : public CUIObject {
+class AdEntity;
+class UIEntity : public UIObject {
public:
- DECLARE_PERSISTENT(CUIEntity, CUIObject)
- CUIEntity(CBGame *inGame);
- virtual ~CUIEntity();
+ DECLARE_PERSISTENT(UIEntity, UIObject)
+ UIEntity(BaseGame *inGame);
+ virtual ~UIEntity();
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete);
- virtual bool saveAsText(CBDynBuffer *buffer, int indent);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
virtual bool display(int offsetX = 0, int offsetY = 0);
- CAdEntity *_entity;
+ AdEntity *_entity;
bool setEntity(const char *filename);
// scripting interface
- virtual CScValue *scGetProperty(const char *name);
- virtual bool scSetProperty(const char *name, CScValue *value);
- virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ScValue *scGetProperty(const char *name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp index 605b5b74b1..20fd6c363f 100644 --- a/engines/wintermute/ui/ui_object.cpp +++ b/engines/wintermute/ui/ui_object.cpp @@ -38,10 +38,10 @@ namespace WinterMute {
-IMPLEMENT_PERSISTENT(CUIObject, false)
+IMPLEMENT_PERSISTENT(UIObject, false)
//////////////////////////////////////////////////////////////////////////
-CUIObject::CUIObject(CBGame *inGame): CBObject(inGame) {
+UIObject::UIObject(BaseGame *inGame): BaseObject(inGame) {
_back = NULL;
_image = NULL;
_font = NULL;
@@ -70,8 +70,8 @@ CUIObject::CUIObject(CBGame *inGame): CBObject(inGame) { //////////////////////////////////////////////////////////////////////////
-CUIObject::~CUIObject() {
- if (!_gameRef->_loadInProgress) CSysClassRegistry::getInstance()->enumInstances(CBGame::invalidateValues, "CScValue", (void *)this);
+UIObject::~UIObject() {
+ if (!_gameRef->_loadInProgress) SystemClassRegistry::getInstance()->enumInstances(BaseGame::invalidateValues, "ScValue", (void *)this);
if (_back) delete _back;
if (_font && !_sharedFonts) _gameRef->_fontStorage->removeFont(_font);
@@ -85,7 +85,7 @@ CUIObject::~CUIObject() { //////////////////////////////////////////////////////////////////////////
-void CUIObject::setText(const char *text) {
+void UIObject::setText(const char *text) {
if (_text) delete [] _text;
_text = new char [strlen(text) + 1];
if (_text) {
@@ -98,13 +98,13 @@ void CUIObject::setText(const char *text) { //////////////////////////////////////////////////////////////////////////
-bool CUIObject::display(int offsetX, int offsetY) {
+bool UIObject::display(int offsetX, int offsetY) {
return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-void CUIObject::setListener(CBScriptHolder *object, CBScriptHolder *listenerObject, uint32 listenerParam) {
+void UIObject::setListener(BaseScriptHolder *object, BaseScriptHolder *listenerObject, uint32 listenerParam) {
_listenerObject = object;
_listenerParamObject = listenerObject;
_listenerParamDWORD = listenerParam;
@@ -112,7 +112,7 @@ void CUIObject::setListener(CBScriptHolder *object, CBScriptHolder *listenerObje //////////////////////////////////////////////////////////////////////////
-void CUIObject::correctSize() {
+void UIObject::correctSize() {
Rect32 rect;
if (_width <= 0) {
@@ -137,13 +137,13 @@ void CUIObject::correctSize() { //////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+bool UIObject::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// SetFont
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "SetFont") == 0) {
stack->correctParams(1);
- CScValue *Val = stack->pop();
+ ScValue *Val = stack->pop();
if (_font) _gameRef->_fontStorage->removeFont(_font);
if (Val->isNULL()) {
@@ -161,7 +161,7 @@ bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "SetImage") == 0) {
stack->correctParams(1);
- CScValue *val = stack->pop();
+ ScValue *val = stack->pop();
/* const char *filename = */ val->getString();
@@ -172,7 +172,7 @@ bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS return STATUS_OK;
}
- _image = new CBSprite(_gameRef);
+ _image = new BaseSprite(_gameRef);
if (!_image || DID_FAIL(_image->loadFile(val->getString()))) {
delete _image;
_image = NULL;
@@ -221,14 +221,14 @@ bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1);
if (_parent && _parent->_type == UI_WINDOW) {
- CUIWindow *win = (CUIWindow *)_parent;
+ UIWindow *win = (UIWindow *)_parent;
int i;
bool found = false;
- CScValue *val = stack->pop();
+ ScValue *val = stack->pop();
// find directly
if (val->isNative()) {
- CUIObject *widget = (CUIObject *)val->getNative();
+ UIObject *widget = (UIObject *)val->getNative();
for (i = 0; i < win->_widgets.getSize(); i++) {
if (win->_widgets[i] == widget) {
found = true;
@@ -277,7 +277,7 @@ bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(0);
if (_parent && _parent->_type == UI_WINDOW) {
- CUIWindow *win = (CUIWindow *)_parent;
+ UIWindow *win = (UIWindow *)_parent;
for (int i = 0; i < win->_widgets.getSize(); i++) {
if (win->_widgets[i] == this) {
win->_widgets.removeAt(i);
@@ -298,7 +298,7 @@ bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(0);
if (_parent && _parent->_type == UI_WINDOW) {
- CUIWindow *win = (CUIWindow *)_parent;
+ UIWindow *win = (UIWindow *)_parent;
for (int i = 0; i < win->_widgets.getSize(); i++) {
if (win->_widgets[i] == this) {
win->_widgets.removeAt(i);
@@ -312,12 +312,12 @@ bool CUIObject::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS return STATUS_OK;
}
- else return CBObject::scCallMethod(script, stack, thisStack, name);
+ else return BaseObject::scCallMethod(script, stack, thisStack, name);
}
//////////////////////////////////////////////////////////////////////////
-CScValue *CUIObject::scGetProperty(const char *name) {
+ScValue *UIObject::scGetProperty(const char *name) {
_scValue->setNULL();
//////////////////////////////////////////////////////////////////////////
@@ -398,7 +398,7 @@ CScValue *CUIObject::scGetProperty(const char *name) { else if (strcmp(name, "NextSibling") == 0 || strcmp(name, "PrevSibling") == 0) {
_scValue->setNULL();
if (_parent && _parent->_type == UI_WINDOW) {
- CUIWindow *win = (CUIWindow *)_parent;
+ UIWindow *win = (UIWindow *)_parent;
for (int i = 0; i < win->_widgets.getSize(); i++) {
if (win->_widgets[i] == this) {
if (strcmp(name, "NextSibling") == 0) {
@@ -413,12 +413,12 @@ CScValue *CUIObject::scGetProperty(const char *name) { return _scValue;
}
- else return CBObject::scGetProperty(name);
+ else return BaseObject::scGetProperty(name);
}
//////////////////////////////////////////////////////////////////////////
-bool CUIObject::scSetProperty(const char *name, CScValue *value) {
+bool UIObject::scSetProperty(const char *name, ScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Name
//////////////////////////////////////////////////////////////////////////
@@ -475,22 +475,22 @@ bool CUIObject::scSetProperty(const char *name, CScValue *value) { return STATUS_OK;
}
- else return CBObject::scSetProperty(name, value);
+ else return BaseObject::scSetProperty(name, value);
}
//////////////////////////////////////////////////////////////////////////
-const char *CUIObject::scToString() {
+const char *UIObject::scToString() {
return "[ui_object]";
}
//////////////////////////////////////////////////////////////////////////
-bool CUIObject::isFocused() {
+bool UIObject::isFocused() {
if (!_gameRef->_focusedWindow) return false;
if (_gameRef->_focusedWindow == this) return true;
- CUIObject *obj = _gameRef->_focusedWindow;
+ UIObject *obj = _gameRef->_focusedWindow;
while (obj) {
if (obj == this) return true;
else obj = obj->_focusedWidget;
@@ -500,18 +500,18 @@ bool CUIObject::isFocused() { //////////////////////////////////////////////////////////////////////////
-bool CUIObject::handleMouse(TMouseEvent event, TMouseButton button) {
+bool UIObject::handleMouse(TMouseEvent event, TMouseButton button) {
// handle focus change
if (event == MOUSE_CLICK && button == MOUSE_BUTTON_LEFT) {
focus();
}
- return CBObject::handleMouse(event, button);
+ return BaseObject::handleMouse(event, button);
}
//////////////////////////////////////////////////////////////////////////
-bool CUIObject::focus() {
- CUIObject *obj = this;
+bool UIObject::focus() {
+ UIObject *obj = this;
bool disabled = false;
while (obj) {
if (obj->_disable && obj->_type == UI_WINDOW) {
@@ -526,7 +526,7 @@ bool CUIObject::focus() { if (obj->_parent) {
if (!obj->_disable && obj->_canFocus) obj->_parent->_focusedWidget = obj;
} else {
- if (obj->_type == UI_WINDOW) _gameRef->focusWindow((CUIWindow *)obj);
+ if (obj->_type == UI_WINDOW) _gameRef->focusWindow((UIWindow *)obj);
}
obj = obj->_parent;
@@ -537,10 +537,10 @@ bool CUIObject::focus() { //////////////////////////////////////////////////////////////////////////
-bool CUIObject::getTotalOffset(int *offsetX, int *offsetY) {
+bool UIObject::getTotalOffset(int *offsetX, int *offsetY) {
int offX = 0, offY = 0;
- CUIObject *obj = _parent;
+ UIObject *obj = _parent;
while (obj) {
offX += obj->_posX;
offY += obj->_posY;
@@ -555,9 +555,9 @@ bool CUIObject::getTotalOffset(int *offsetX, int *offsetY) { //////////////////////////////////////////////////////////////////////////
-bool CUIObject::persist(CBPersistMgr *persistMgr) {
+bool UIObject::persist(BasePersistenceManager *persistMgr) {
- CBObject::persist(persistMgr);
+ BaseObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_back));
persistMgr->transfer(TMEMBER(_canFocus));
@@ -582,7 +582,7 @@ bool CUIObject::persist(CBPersistMgr *persistMgr) { }
//////////////////////////////////////////////////////////////////////////
-bool CUIObject::saveAsText(CBDynBuffer *buffer, int indent) {
+bool UIObject::saveAsText(BaseDynamicBuffer *buffer, int indent) {
return STATUS_FAILED;
}
diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h index 35bd092592..64cd711dcc 100644 --- a/engines/wintermute/ui/ui_object.h +++ b/engines/wintermute/ui/ui_object.h @@ -35,9 +35,9 @@ namespace WinterMute {
-class CUITiledImage;
-class CBFont;
-class CUIObject : public CBObject {
+class UITiledImage;
+class BaseFont;
+class UIObject : public BaseObject {
public:
bool getTotalOffset(int *offsetX, int *offsetY);
@@ -46,35 +46,35 @@ public: virtual bool handleMouse(TMouseEvent event, TMouseButton button);
bool isFocused();
bool _parentNotify;
- DECLARE_PERSISTENT(CUIObject, CBObject)
- CUIObject *_parent;
+ DECLARE_PERSISTENT(UIObject, BaseObject)
+ UIObject *_parent;
virtual bool display(int offsetX = 0, int offsetY = 0);
virtual void correctSize();
bool _sharedFonts;
bool _sharedImages;
void setText(const char *text);
char *_text;
- CBFont *_font;
+ BaseFont *_font;
bool _visible;
- CUITiledImage *_back;
+ UITiledImage *_back;
bool _disable;
- CUIObject(CBGame *inGame = NULL);
- virtual ~CUIObject();
+ UIObject(BaseGame *inGame = NULL);
+ virtual ~UIObject();
int _width;
int _height;
TUIObjectType _type;
- CBSprite *_image;
- void setListener(CBScriptHolder *object, CBScriptHolder *listenerObject, uint32 listenerParam);
- CBScriptHolder *_listenerParamObject;
+ BaseSprite *_image;
+ void setListener(BaseScriptHolder *object, BaseScriptHolder *listenerObject, uint32 listenerParam);
+ BaseScriptHolder *_listenerParamObject;
uint32 _listenerParamDWORD;
- CBScriptHolder *_listenerObject;
- CUIObject *_focusedWidget;
- virtual bool saveAsText(CBDynBuffer *buffer, int indent);
+ BaseScriptHolder *_listenerObject;
+ UIObject *_focusedWidget;
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
// scripting interface
- virtual CScValue *scGetProperty(const char *name);
- virtual bool scSetProperty(const char *name, CScValue *value);
- virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ScValue *scGetProperty(const char *name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/ui/ui_text.cpp b/engines/wintermute/ui/ui_text.cpp index 6309d05a1e..fdf7f6287f 100644 --- a/engines/wintermute/ui/ui_text.cpp +++ b/engines/wintermute/ui/ui_text.cpp @@ -44,10 +44,10 @@ namespace WinterMute {
-IMPLEMENT_PERSISTENT(CUIText, false)
+IMPLEMENT_PERSISTENT(UIText, false)
//////////////////////////////////////////////////////////////////////////
-CUIText::CUIText(CBGame *inGame): CUIObject(inGame) {
+UIText::UIText(BaseGame *inGame): UIObject(inGame) {
_textAlign = TAL_LEFT;
_verticalAlign = VAL_CENTER;
_type = UI_STATIC;
@@ -56,17 +56,17 @@ CUIText::CUIText(CBGame *inGame): CUIObject(inGame) { //////////////////////////////////////////////////////////////////////////
-CUIText::~CUIText() {
+UIText::~UIText() {
}
//////////////////////////////////////////////////////////////////////////
-bool CUIText::display(int offsetX, int offsetY) {
+bool UIText::display(int offsetX, int offsetY) {
if (!_visible) return STATUS_OK;
- CBFont *font = _font;
+ BaseFont *font = _font;
if (!font) font = _gameRef->_systemFont;
if (_back) _back->display(offsetX + _posX, offsetY + _posY, _width, _height);
@@ -87,7 +87,7 @@ bool CUIText::display(int offsetX, int offsetY) { font->drawText((byte *)_text, offsetX + _posX, offsetY + _posY + textOffset, _width, _textAlign, _height);
}
- //_gameRef->_renderer->_rectList.add(new CBActiveRect(_gameRef, this, NULL, OffsetX + _posX, OffsetY + _posY, _width, _height, 100, 100, false));
+ //_gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, this, NULL, OffsetX + _posX, OffsetY + _posY, _width, _height, 100, 100, false));
return STATUS_OK;
}
@@ -95,10 +95,10 @@ bool CUIText::display(int offsetX, int offsetY) { //////////////////////////////////////////////////////////////////////////
-bool CUIText::loadFile(const char *filename) {
+bool UIText::loadFile(const char *filename) {
byte *buffer = _gameRef->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
- _gameRef->LOG(0, "CUIText::LoadFile failed for file '%s'", filename);
+ _gameRef->LOG(0, "UIText::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
}
@@ -138,7 +138,7 @@ TOKEN_DEF(PARENT_NOTIFY) TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-bool CUIText::loadBuffer(byte *buffer, bool complete) {
+bool UIText::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(STATIC)
TOKEN_TABLE(TEMPLATE)
@@ -164,7 +164,7 @@ bool CUIText::loadBuffer(byte *buffer, bool complete) { byte *params;
int cmd = 2;
- CBParser parser(_gameRef);
+ BaseParser parser(_gameRef);
if (complete) {
if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_STATIC) {
@@ -190,7 +190,7 @@ bool CUIText::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK:
delete _back;
- _back = new CUITiledImage(_gameRef);
+ _back = new UITiledImage(_gameRef);
if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
delete _back;
_back = NULL;
@@ -200,7 +200,7 @@ bool CUIText::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE:
delete _image;
- _image = new CBSprite(_gameRef);
+ _image = new BaseSprite(_gameRef);
if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
delete _image;
_image = NULL;
@@ -249,7 +249,7 @@ bool CUIText::loadBuffer(byte *buffer, bool complete) { case TOKEN_CURSOR:
delete _cursor;
- _cursor = new CBSprite(_gameRef);
+ _cursor = new BaseSprite(_gameRef);
if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
delete _cursor;
_cursor = NULL;
@@ -293,7 +293,7 @@ bool CUIText::loadBuffer(byte *buffer, bool complete) { }
//////////////////////////////////////////////////////////////////////////
-bool CUIText::saveAsText(CBDynBuffer *buffer, int indent) {
+bool UIText::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "STATIC\n");
buffer->putTextIndent(indent, "{\n");
@@ -328,7 +328,7 @@ bool CUIText::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "TEXT_ALIGN=\"%s\"\n", "center");
break;
default:
- error("CUIText::SaveAsText - Unhandled enum");
+ error("UIText::SaveAsText - Unhandled enum");
break;
}
@@ -367,7 +367,7 @@ bool CUIText::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n");
// editor properties
- CBBase::saveAsText(buffer, indent + 2);
+ BaseClass::saveAsText(buffer, indent + 2);
buffer->putTextIndent(indent, "}\n");
return STATUS_OK;
@@ -376,7 +376,7 @@ bool CUIText::saveAsText(CBDynBuffer *buffer, int indent) { //////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-bool CUIText::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+bool UIText::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// SizeToFit
//////////////////////////////////////////////////////////////////////////
@@ -397,12 +397,12 @@ bool CUIText::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisSta return STATUS_OK;
}
- else return CUIObject::scCallMethod(script, stack, thisStack, name);
+ else return UIObject::scCallMethod(script, stack, thisStack, name);
}
//////////////////////////////////////////////////////////////////////////
-CScValue *CUIText::scGetProperty(const char *name) {
+ScValue *UIText::scGetProperty(const char *name) {
_scValue->setNULL();
//////////////////////////////////////////////////////////////////////////
@@ -429,12 +429,12 @@ CScValue *CUIText::scGetProperty(const char *name) { return _scValue;
}
- else return CUIObject::scGetProperty(name);
+ else return UIObject::scGetProperty(name);
}
//////////////////////////////////////////////////////////////////////////
-bool CUIText::scSetProperty(const char *name, CScValue *value) {
+bool UIText::scSetProperty(const char *name, ScValue *value) {
//////////////////////////////////////////////////////////////////////////
// TextAlign
//////////////////////////////////////////////////////////////////////////
@@ -455,21 +455,21 @@ bool CUIText::scSetProperty(const char *name, CScValue *value) { return STATUS_OK;
}
- else return CUIObject::scSetProperty(name, value);
+ else return UIObject::scSetProperty(name, value);
}
//////////////////////////////////////////////////////////////////////////
-const char *CUIText::scToString() {
+const char *UIText::scToString() {
return "[static]";
}
//////////////////////////////////////////////////////////////////////////
-bool CUIText::persist(CBPersistMgr *persistMgr) {
+bool UIText::persist(BasePersistenceManager *persistMgr) {
- CUIObject::persist(persistMgr);
+ UIObject::persist(persistMgr);
persistMgr->transfer(TMEMBER_INT(_textAlign));
persistMgr->transfer(TMEMBER_INT(_verticalAlign));
@@ -478,7 +478,7 @@ bool CUIText::persist(CBPersistMgr *persistMgr) { //////////////////////////////////////////////////////////////////////////
-bool CUIText::sizeToFit() {
+bool UIText::sizeToFit() {
if (_font && _text) {
_width = _font->getTextWidth((byte *)_text);
_height = _font->getTextHeight((byte *)_text, _width);
diff --git a/engines/wintermute/ui/ui_text.h b/engines/wintermute/ui/ui_text.h index dc633dc042..ee2e63c448 100644 --- a/engines/wintermute/ui/ui_text.h +++ b/engines/wintermute/ui/ui_text.h @@ -34,24 +34,24 @@ namespace WinterMute {
-class CUIText : public CUIObject {
+class UIText : public UIObject {
private:
bool sizeToFit();
public:
virtual bool display(int offsetX, int offsetY);
- DECLARE_PERSISTENT(CUIText, CUIObject)
- CUIText(CBGame *inGame = NULL);
- virtual ~CUIText();
+ DECLARE_PERSISTENT(UIText, UIObject)
+ UIText(BaseGame *inGame = NULL);
+ virtual ~UIText();
TTextAlign _textAlign;
TVerticalAlign _verticalAlign;
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
- virtual bool saveAsText(CBDynBuffer *buffer, int indent);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
// scripting interface
- virtual CScValue *scGetProperty(const char *name);
- virtual bool scSetProperty(const char *name, CScValue *value);
- virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ScValue *scGetProperty(const char *name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
virtual const char *scToString();
};
diff --git a/engines/wintermute/ui/ui_tiled_image.cpp b/engines/wintermute/ui/ui_tiled_image.cpp index 39b39b556d..fec30f46e9 100644 --- a/engines/wintermute/ui/ui_tiled_image.cpp +++ b/engines/wintermute/ui/ui_tiled_image.cpp @@ -38,33 +38,33 @@ namespace WinterMute {
-IMPLEMENT_PERSISTENT(CUITiledImage, false)
+IMPLEMENT_PERSISTENT(UITiledImage, false)
//////////////////////////////////////////////////////////////////////////
-CUITiledImage::CUITiledImage(CBGame *inGame): CBObject(inGame) {
+UITiledImage::UITiledImage(BaseGame *inGame): BaseObject(inGame) {
_image = NULL;
- CBPlatform::setRectEmpty(&_upLeft);
- CBPlatform::setRectEmpty(&_upMiddle);
- CBPlatform::setRectEmpty(&_upRight);
- CBPlatform::setRectEmpty(&_middleLeft);
- CBPlatform::setRectEmpty(&_middleMiddle);
- CBPlatform::setRectEmpty(&_middleRight);
- CBPlatform::setRectEmpty(&_downLeft);
- CBPlatform::setRectEmpty(&_downMiddle);
- CBPlatform::setRectEmpty(&_downRight);
+ BasePlatform::setRectEmpty(&_upLeft);
+ BasePlatform::setRectEmpty(&_upMiddle);
+ BasePlatform::setRectEmpty(&_upRight);
+ BasePlatform::setRectEmpty(&_middleLeft);
+ BasePlatform::setRectEmpty(&_middleMiddle);
+ BasePlatform::setRectEmpty(&_middleRight);
+ BasePlatform::setRectEmpty(&_downLeft);
+ BasePlatform::setRectEmpty(&_downMiddle);
+ BasePlatform::setRectEmpty(&_downRight);
}
//////////////////////////////////////////////////////////////////////////
-CUITiledImage::~CUITiledImage() {
+UITiledImage::~UITiledImage() {
delete _image;
_image = NULL;
}
//////////////////////////////////////////////////////////////////////////
-bool CUITiledImage::display(int x, int y, int width, int height) {
+bool UITiledImage::display(int x, int y, int width, int height) {
if (!_image) return STATUS_FAILED;
int tileWidth = _middleMiddle.right - _middleMiddle.left;
@@ -119,10 +119,10 @@ bool CUITiledImage::display(int x, int y, int width, int height) { //////////////////////////////////////////////////////////////////////////
-bool CUITiledImage::loadFile(const char *filename) {
+bool UITiledImage::loadFile(const char *filename) {
byte *buffer = _gameRef->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
- _gameRef->LOG(0, "CUITiledImage::LoadFile failed for file '%s'", filename);
+ _gameRef->LOG(0, "UITiledImage::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
}
@@ -158,7 +158,7 @@ TOKEN_DEF(HORIZONTAL_TILES) TOKEN_DEF(EDITOR_PROPERTY)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-bool CUITiledImage::loadBuffer(byte *buffer, bool complete) {
+bool UITiledImage::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(TILED_IMAGE)
TOKEN_TABLE(TEMPLATE)
@@ -179,7 +179,7 @@ bool CUITiledImage::loadBuffer(byte *buffer, bool complete) { byte *params;
int cmd;
- CBParser parser(_gameRef);
+ BaseParser parser(_gameRef);
bool hTiles = false, vTiles = false;
int h1 = 0, h2 = 0, h3 = 0;
int v1 = 0, v2 = 0, v3 = 0;
@@ -200,7 +200,7 @@ bool CUITiledImage::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE:
delete _image;
- _image = new CBSubFrame(_gameRef);
+ _image = new BaseSubFrame(_gameRef);
if (!_image || DID_FAIL(_image->setSurface((char *)params))) {
delete _image;
_image = NULL;
@@ -270,19 +270,19 @@ bool CUITiledImage::loadBuffer(byte *buffer, bool complete) { if (vTiles && hTiles) {
// up row
- CBPlatform::setRect(&_upLeft, 0, 0, h1, v1);
- CBPlatform::setRect(&_upMiddle, h1, 0, h1 + h2, v1);
- CBPlatform::setRect(&_upRight, h1 + h2, 0, h1 + h2 + h3, v1);
+ BasePlatform::setRect(&_upLeft, 0, 0, h1, v1);
+ BasePlatform::setRect(&_upMiddle, h1, 0, h1 + h2, v1);
+ BasePlatform::setRect(&_upRight, h1 + h2, 0, h1 + h2 + h3, v1);
// middle row
- CBPlatform::setRect(&_middleLeft, 0, v1, h1, v1 + v2);
- CBPlatform::setRect(&_middleMiddle, h1, v1, h1 + h2, v1 + v2);
- CBPlatform::setRect(&_middleRight, h1 + h2, v1, h1 + h2 + h3, v1 + v2);
+ BasePlatform::setRect(&_middleLeft, 0, v1, h1, v1 + v2);
+ BasePlatform::setRect(&_middleMiddle, h1, v1, h1 + h2, v1 + v2);
+ BasePlatform::setRect(&_middleRight, h1 + h2, v1, h1 + h2 + h3, v1 + v2);
// down row
- CBPlatform::setRect(&_downLeft, 0, v1 + v2, h1, v1 + v2 + v3);
- CBPlatform::setRect(&_downMiddle, h1, v1 + v2, h1 + h2, v1 + v2 + v3);
- CBPlatform::setRect(&_downRight, h1 + h2, v1 + v2, h1 + h2 + h3, v1 + v2 + v3);
+ BasePlatform::setRect(&_downLeft, 0, v1 + v2, h1, v1 + v2 + v3);
+ BasePlatform::setRect(&_downMiddle, h1, v1 + v2, h1 + h2, v1 + v2 + v3);
+ BasePlatform::setRect(&_downRight, h1 + h2, v1 + v2, h1 + h2 + h3, v1 + v2 + v3);
}
// default
@@ -290,24 +290,24 @@ bool CUITiledImage::loadBuffer(byte *buffer, bool complete) { int width = _image->_surface->getWidth() / 3;
int height = _image->_surface->getHeight() / 3;
- if (CBPlatform::isRectEmpty(&_upLeft)) CBPlatform::setRect(&_upLeft, 0, 0, width, height);
- if (CBPlatform::isRectEmpty(&_upMiddle)) CBPlatform::setRect(&_upMiddle, width, 0, 2 * width, height);
- if (CBPlatform::isRectEmpty(&_upRight)) CBPlatform::setRect(&_upRight, 2 * width, 0, 3 * width, height);
+ if (BasePlatform::isRectEmpty(&_upLeft)) BasePlatform::setRect(&_upLeft, 0, 0, width, height);
+ if (BasePlatform::isRectEmpty(&_upMiddle)) BasePlatform::setRect(&_upMiddle, width, 0, 2 * width, height);
+ if (BasePlatform::isRectEmpty(&_upRight)) BasePlatform::setRect(&_upRight, 2 * width, 0, 3 * width, height);
- if (CBPlatform::isRectEmpty(&_middleLeft)) CBPlatform::setRect(&_middleLeft, 0, height, width, 2 * height);
- if (CBPlatform::isRectEmpty(&_middleMiddle)) CBPlatform::setRect(&_middleMiddle, width, height, 2 * width, 2 * height);
- if (CBPlatform::isRectEmpty(&_middleRight)) CBPlatform::setRect(&_middleRight, 2 * width, height, 3 * width, 2 * height);
+ if (BasePlatform::isRectEmpty(&_middleLeft)) BasePlatform::setRect(&_middleLeft, 0, height, width, 2 * height);
+ if (BasePlatform::isRectEmpty(&_middleMiddle)) BasePlatform::setRect(&_middleMiddle, width, height, 2 * width, 2 * height);
+ if (BasePlatform::isRectEmpty(&_middleRight)) BasePlatform::setRect(&_middleRight, 2 * width, height, 3 * width, 2 * height);
- if (CBPlatform::isRectEmpty(&_downLeft)) CBPlatform::setRect(&_downLeft, 0, 2 * height, width, 3 * height);
- if (CBPlatform::isRectEmpty(&_downMiddle)) CBPlatform::setRect(&_downMiddle, width, 2 * height, 2 * width, 3 * height);
- if (CBPlatform::isRectEmpty(&_downRight)) CBPlatform::setRect(&_downRight, 2 * width, 2 * height, 3 * width, 3 * height);
+ if (BasePlatform::isRectEmpty(&_downLeft)) BasePlatform::setRect(&_downLeft, 0, 2 * height, width, 3 * height);
+ if (BasePlatform::isRectEmpty(&_downMiddle)) BasePlatform::setRect(&_downMiddle, width, 2 * height, 2 * width, 3 * height);
+ if (BasePlatform::isRectEmpty(&_downRight)) BasePlatform::setRect(&_downRight, 2 * width, 2 * height, 3 * width, 3 * height);
}
return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-bool CUITiledImage::saveAsText(CBDynBuffer *buffer, int indent) {
+bool UITiledImage::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "TILED_IMAGE\n");
buffer->putTextIndent(indent, "{\n");
@@ -330,14 +330,14 @@ bool CUITiledImage::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "HORIZONTAL_TILES { %d, %d, %d }\n", h1, h2, h3);
// editor properties
- CBBase::saveAsText(buffer, indent + 2);
+ BaseClass::saveAsText(buffer, indent + 2);
buffer->putTextIndent(indent, "}\n");
return STATUS_OK;
}
//////////////////////////////////////////////////////////////////////////
-void CUITiledImage::correctSize(int *width, int *height) {
+void UITiledImage::correctSize(int *width, int *height) {
int tileWidth = _middleMiddle.right - _middleMiddle.left;
int tileHeight = _middleMiddle.bottom - _middleMiddle.top;
@@ -350,8 +350,8 @@ void CUITiledImage::correctSize(int *width, int *height) { //////////////////////////////////////////////////////////////////////////
-bool CUITiledImage::persist(CBPersistMgr *persistMgr) {
- CBObject::persist(persistMgr);
+bool UITiledImage::persist(BasePersistenceManager *persistMgr) {
+ BaseObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_downLeft));
persistMgr->transfer(TMEMBER(_downMiddle));
diff --git a/engines/wintermute/ui/ui_tiled_image.h b/engines/wintermute/ui/ui_tiled_image.h index 79adf7caac..2d7068e7cd 100644 --- a/engines/wintermute/ui/ui_tiled_image.h +++ b/engines/wintermute/ui/ui_tiled_image.h @@ -34,19 +34,19 @@ #include "common/rect.h"
namespace WinterMute {
-class CBSubFrame;
-class CUITiledImage : public CBObject {
+class BaseSubFrame;
+class UITiledImage : public BaseObject {
public:
- DECLARE_PERSISTENT(CUITiledImage, CBObject)
+ DECLARE_PERSISTENT(UITiledImage, BaseObject)
void correctSize(int *width, int *height);
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
- virtual bool saveAsText(CBDynBuffer *buffer, int indent);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
bool display(int x, int y, int width, int height);
- CUITiledImage(CBGame *inGame = NULL);
- virtual ~CUITiledImage();
- CBSubFrame *_image;
+ UITiledImage(BaseGame *inGame = NULL);
+ virtual ~UITiledImage();
+ BaseSubFrame *_image;
Rect32 _upLeft;
Rect32 _upMiddle;
Rect32 _upRight;
diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp index 269744a3c2..0fedfdc87a 100644 --- a/engines/wintermute/ui/ui_window.cpp +++ b/engines/wintermute/ui/ui_window.cpp @@ -50,12 +50,12 @@ namespace WinterMute {
-IMPLEMENT_PERSISTENT(CUIWindow, false)
+IMPLEMENT_PERSISTENT(UIWindow, false)
//////////////////////////////////////////////////////////////////////////
-CUIWindow::CUIWindow(CBGame *inGame): CUIObject(inGame) {
- CBPlatform::setRectEmpty(&_titleRect);
- CBPlatform::setRectEmpty(&_dragRect);
+UIWindow::UIWindow(BaseGame *inGame): UIObject(inGame) {
+ BasePlatform::setRectEmpty(&_titleRect);
+ BasePlatform::setRectEmpty(&_dragRect);
_titleAlign = TAL_LEFT;
_transparent = false;
@@ -88,14 +88,14 @@ CUIWindow::CUIWindow(CBGame *inGame): CUIObject(inGame) { //////////////////////////////////////////////////////////////////////////
-CUIWindow::~CUIWindow() {
+UIWindow::~UIWindow() {
close();
cleanup();
}
//////////////////////////////////////////////////////////////////////////
-void CUIWindow::cleanup() {
+void UIWindow::cleanup() {
delete _shieldWindow;
delete _shieldButton;
delete _viewport;
@@ -113,10 +113,10 @@ void CUIWindow::cleanup() { //////////////////////////////////////////////////////////////////////////
-bool CUIWindow::display(int offsetX, int offsetY) {
+bool UIWindow::display(int offsetX, int offsetY) {
// go exclusive
if (_mode == WINDOW_EXCLUSIVE || _mode == WINDOW_SYSTEM_EXCLUSIVE) {
- if (!_shieldWindow) _shieldWindow = new CUIWindow(_gameRef);
+ if (!_shieldWindow) _shieldWindow = new UIWindow(_gameRef);
if (_shieldWindow) {
_shieldWindow->_posX = _shieldWindow->_posY = 0;
_shieldWindow->_width = _gameRef->_renderer->_width;
@@ -126,7 +126,7 @@ bool CUIWindow::display(int offsetX, int offsetY) { }
} else if (_isMenu) {
if (!_shieldButton) {
- _shieldButton = new CUIButton(_gameRef);
+ _shieldButton = new UIButton(_gameRef);
_shieldButton->setName("close");
_shieldButton->setListener(this, _shieldButton, 0);
_shieldButton->_parent = this;
@@ -159,7 +159,7 @@ bool CUIWindow::display(int offsetX, int offsetY) { bool popViewport = false;
if (_clipContents) {
- if (!_viewport) _viewport = new CBViewport(_gameRef);
+ if (!_viewport) _viewport = new BaseViewport(_gameRef);
if (_viewport) {
_viewport->setRect(_posX + offsetX, _posY + offsetY, _posX + _width + offsetX, _posY + _height + offsetY);
_gameRef->pushViewport(_viewport);
@@ -168,9 +168,9 @@ bool CUIWindow::display(int offsetX, int offsetY) { }
- CUITiledImage *back = _back;
- CBSprite *image = _image;
- CBFont *font = _font;
+ UITiledImage *back = _back;
+ BaseSprite *image = _image;
+ BaseFont *font = _font;
if (!isFocused()) {
if (_backInactive) back = _backInactive;
@@ -185,12 +185,12 @@ bool CUIWindow::display(int offsetX, int offsetY) { if (image)
image->draw(_posX + offsetX, _posY + offsetY, _transparent ? NULL : this);
- if (!CBPlatform::isRectEmpty(&_titleRect) && font && _text) {
+ if (!BasePlatform::isRectEmpty(&_titleRect) && font && _text) {
font->drawText((byte *)_text, _posX + offsetX + _titleRect.left, _posY + offsetY + _titleRect.top, _titleRect.right - _titleRect.left, _titleAlign, _titleRect.bottom - _titleRect.top);
}
if (!_transparent && !image)
- _gameRef->_renderer->_rectList.add(new CBActiveRect(_gameRef, this, NULL, _posX + offsetX, _posY + offsetY, _width, _height, 100, 100, false));
+ _gameRef->_renderer->_rectList.add(new BaseActiveRect(_gameRef, this, NULL, _posX + offsetX, _posY + offsetY, _width, _height, 100, 100, false));
for (int i = 0; i < _widgets.getSize(); i++) {
_widgets[i]->display(_posX + offsetX, _posY + offsetY);
@@ -207,10 +207,10 @@ bool CUIWindow::display(int offsetX, int offsetY) { //////////////////////////////////////////////////////////////////////////
-bool CUIWindow::loadFile(const char *filename) {
+bool UIWindow::loadFile(const char *filename) {
byte *buffer = _gameRef->_fileManager->readWholeFile(filename);
if (buffer == NULL) {
- _gameRef->LOG(0, "CUIWindow::LoadFile failed for file '%s'", filename);
+ _gameRef->LOG(0, "UIWindow::LoadFile failed for file '%s'", filename);
return STATUS_FAILED;
}
@@ -266,7 +266,7 @@ TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF(EDIT)
TOKEN_DEF_END
//////////////////////////////////////////////////////////////////////////
-bool CUIWindow::loadBuffer(byte *buffer, bool complete) {
+bool UIWindow::loadBuffer(byte *buffer, bool complete) {
TOKEN_TABLE_START(commands)
TOKEN_TABLE(WINDOW)
TOKEN_TABLE(ALPHA_COLOR)
@@ -308,7 +308,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { byte *params;
int cmd = 2;
- CBParser parser(_gameRef);
+ BaseParser parser(_gameRef);
int fadeR = 0, fadeG = 0, fadeB = 0, fadeA = 0;
int ar = 0, ag = 0, ab = 0, alpha = 0;
@@ -337,7 +337,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK:
delete _back;
- _back = new CUITiledImage(_gameRef);
+ _back = new UITiledImage(_gameRef);
if (!_back || DID_FAIL(_back->loadFile((char *)params))) {
delete _back;
_back = NULL;
@@ -347,7 +347,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK_INACTIVE:
delete _backInactive;
- _backInactive = new CUITiledImage(_gameRef);
+ _backInactive = new UITiledImage(_gameRef);
if (!_backInactive || DID_FAIL(_backInactive->loadFile((char *)params))) {
delete _backInactive;
_backInactive = NULL;
@@ -357,7 +357,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE:
delete _image;
- _image = new CBSprite(_gameRef);
+ _image = new BaseSprite(_gameRef);
if (!_image || DID_FAIL(_image->loadFile((char *)params))) {
delete _image;
_image = NULL;
@@ -367,7 +367,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE_INACTIVE:
delete _imageInactive,
- _imageInactive = new CBSprite(_gameRef);
+ _imageInactive = new BaseSprite(_gameRef);
if (!_imageInactive || DID_FAIL(_imageInactive->loadFile((char *)params))) {
delete _imageInactive;
_imageInactive = NULL;
@@ -424,7 +424,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { case TOKEN_CURSOR:
delete _cursor;
- _cursor = new CBSprite(_gameRef);
+ _cursor = new BaseSprite(_gameRef);
if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) {
delete _cursor;
_cursor = NULL;
@@ -433,7 +433,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { break;
case TOKEN_BUTTON: {
- CUIButton *btn = new CUIButton(_gameRef);
+ UIButton *btn = new UIButton(_gameRef);
if (!btn || DID_FAIL(btn->loadBuffer(params, false))) {
delete btn;
btn = NULL;
@@ -446,7 +446,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { break;
case TOKEN_STATIC: {
- CUIText *text = new CUIText(_gameRef);
+ UIText *text = new UIText(_gameRef);
if (!text || DID_FAIL(text->loadBuffer(params, false))) {
delete text;
text = NULL;
@@ -459,7 +459,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { break;
case TOKEN_EDIT: {
- CUIEdit *edit = new CUIEdit(_gameRef);
+ UIEdit *edit = new UIEdit(_gameRef);
if (!edit || DID_FAIL(edit->loadBuffer(params, false))) {
delete edit;
edit = NULL;
@@ -472,7 +472,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { break;
case TOKEN_WINDOW: {
- CUIWindow *win = new CUIWindow(_gameRef);
+ UIWindow *win = new UIWindow(_gameRef);
if (!win || DID_FAIL(win->loadBuffer(params, false))) {
delete win;
win = NULL;
@@ -575,7 +575,7 @@ bool CUIWindow::loadBuffer(byte *buffer, bool complete) { }
//////////////////////////////////////////////////////////////////////////
-bool CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) {
+bool UIWindow::saveAsText(BaseDynamicBuffer *buffer, int indent) {
buffer->putTextIndent(indent, "WINDOW\n");
buffer->putTextIndent(indent, "{\n");
@@ -621,11 +621,11 @@ bool CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) { error("UIWindow::SaveAsText - Unhandled enum-value NUM_TEXT_ALIGN");
}
- if (!CBPlatform::isRectEmpty(&_titleRect)) {
+ if (!BasePlatform::isRectEmpty(&_titleRect)) {
buffer->putTextIndent(indent + 2, "TITLE_RECT { %d, %d, %d, %d }\n", _titleRect.left, _titleRect.top, _titleRect.right, _titleRect.bottom);
}
- if (!CBPlatform::isRectEmpty(&_dragRect)) {
+ if (!BasePlatform::isRectEmpty(&_dragRect)) {
buffer->putTextIndent(indent + 2, "DRAG_RECT { %d, %d, %d, %d }\n", _dragRect.left, _dragRect.top, _dragRect.right, _dragRect.bottom);
}
@@ -666,7 +666,7 @@ bool CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) { buffer->putTextIndent(indent + 2, "\n");
// editor properties
- CBBase::saveAsText(buffer, indent + 2);
+ BaseClass::saveAsText(buffer, indent + 2);
// controls
for (int i = 0; i < _widgets.getSize(); i++)
@@ -678,7 +678,7 @@ bool CUIWindow::saveAsText(CBDynBuffer *buffer, int indent) { }
//////////////////////////////////////////////////////////////////////////
-bool CUIWindow::enableWidget(const char *name, bool Enable) {
+bool UIWindow::enableWidget(const char *name, bool Enable) {
for (int i = 0; i < _widgets.getSize(); i++) {
if (scumm_stricmp(_widgets[i]->_name, name) == 0) _widgets[i]->_disable = !Enable;
}
@@ -687,7 +687,7 @@ bool CUIWindow::enableWidget(const char *name, bool Enable) { //////////////////////////////////////////////////////////////////////////
-bool CUIWindow::showWidget(const char *name, bool Visible) {
+bool UIWindow::showWidget(const char *name, bool Visible) {
for (int i = 0; i < _widgets.getSize(); i++) {
if (scumm_stricmp(_widgets[i]->_name, name) == 0) _widgets[i]->_visible = Visible;
}
@@ -698,13 +698,13 @@ bool CUIWindow::showWidget(const char *name, bool Visible) { //////////////////////////////////////////////////////////////////////////
// high level scripting interface
//////////////////////////////////////////////////////////////////////////
-bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name) {
+bool UIWindow::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) {
//////////////////////////////////////////////////////////////////////////
// GetWidget / GetControl
//////////////////////////////////////////////////////////////////////////
if (strcmp(name, "GetWidget") == 0 || strcmp(name, "GetControl") == 0) {
stack->correctParams(1);
- CScValue *val = stack->pop();
+ ScValue *val = stack->pop();
if (val->getType() == VAL_INT) {
int widget = val->getInt();
if (widget < 0 || widget >= _widgets.getSize()) stack->pushNULL();
@@ -742,7 +742,7 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS stack->correctParams(1);
delete _imageInactive;
- _imageInactive = new CBSprite(_gameRef);
+ _imageInactive = new BaseSprite(_gameRef);
const char *filename = stack->pop()->getString();
if (!_imageInactive || DID_FAIL(_imageInactive->loadFile(filename))) {
delete _imageInactive;
@@ -824,7 +824,7 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS else if (strcmp(name, "LoadFromFile") == 0) {
stack->correctParams(1);
- CScValue *val = stack->pop();
+ ScValue *val = stack->pop();
cleanup();
if (!val->isNULL()) {
stack->pushBool(DID_SUCCEED(loadFile(val->getString())));
@@ -838,9 +838,9 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "CreateButton") == 0) {
stack->correctParams(1);
- CScValue *val = stack->pop();
+ ScValue *val = stack->pop();
- CUIButton *btn = new CUIButton(_gameRef);
+ UIButton *btn = new UIButton(_gameRef);
if (!val->isNULL()) btn->setName(val->getString());
stack->pushNative(btn, true);
@@ -855,9 +855,9 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "CreateStatic") == 0) {
stack->correctParams(1);
- CScValue *val = stack->pop();
+ ScValue *val = stack->pop();
- CUIText *sta = new CUIText(_gameRef);
+ UIText *sta = new UIText(_gameRef);
if (!val->isNULL()) sta->setName(val->getString());
stack->pushNative(sta, true);
@@ -872,9 +872,9 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "CreateEditor") == 0) {
stack->correctParams(1);
- CScValue *val = stack->pop();
+ ScValue *val = stack->pop();
- CUIEdit *edi = new CUIEdit(_gameRef);
+ UIEdit *edi = new UIEdit(_gameRef);
if (!val->isNULL()) edi->setName(val->getString());
stack->pushNative(edi, true);
@@ -889,9 +889,9 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "CreateWindow") == 0) {
stack->correctParams(1);
- CScValue *val = stack->pop();
+ ScValue *val = stack->pop();
- CUIWindow *win = new CUIWindow(_gameRef);
+ UIWindow *win = new UIWindow(_gameRef);
if (!val->isNULL()) win->setName(val->getString());
stack->pushNative(win, true);
@@ -906,8 +906,8 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS //////////////////////////////////////////////////////////////////////////
else if (strcmp(name, "DeleteControl") == 0 || strcmp(name, "DeleteButton") == 0 || strcmp(name, "DeleteStatic") == 0 || strcmp(name, "DeleteEditor") == 0 || strcmp(name, "DeleteWindow") == 0) {
stack->correctParams(1);
- CScValue *val = stack->pop();
- CUIObject *obj = (CUIObject *)val->getNative();
+ ScValue *val = stack->pop();
+ UIObject *obj = (UIObject *)val->getNative();
for (int i = 0; i < _widgets.getSize(); i++) {
if (_widgets[i] == obj) {
@@ -920,12 +920,12 @@ bool CUIWindow::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS return STATUS_OK;
} else if DID_SUCCEED(_gameRef->windowScriptMethodHook(this, script, stack, name)) return STATUS_OK;
- else return CUIObject::scCallMethod(script, stack, thisStack, name);
+ else return UIObject::scCallMethod(script, stack, thisStack, name);
}
//////////////////////////////////////////////////////////////////////////
-CScValue *CUIWindow::scGetProperty(const char *name) {
+ScValue *UIWindow::scGetProperty(const char *name) {
_scValue->setNULL();
//////////////////////////////////////////////////////////////////////////
@@ -1008,12 +1008,12 @@ CScValue *CUIWindow::scGetProperty(const char *name) { return _scValue;
}
- else return CUIObject::scGetProperty(name);
+ else return UIObject::scGetProperty(name);
}
//////////////////////////////////////////////////////////////////////////
-bool CUIWindow::scSetProperty(const char *name, CScValue *value) {
+bool UIWindow::scSetProperty(const char *name, ScValue *value) {
//////////////////////////////////////////////////////////////////////////
// Name
//////////////////////////////////////////////////////////////////////////
@@ -1097,21 +1097,21 @@ bool CUIWindow::scSetProperty(const char *name, CScValue *value) { return STATUS_OK;
}
- else return CUIObject::scSetProperty(name, value);
+ else return UIObject::scSetProperty(name, value);
}
//////////////////////////////////////////////////////////////////////////
-const char *CUIWindow::scToString() {
+const char *UIWindow::scToString() {
return "[window]";
}
//////////////////////////////////////////////////////////////////////////
-bool CUIWindow::handleKeypress(Common::Event *event, bool printable) {
+bool UIWindow::handleKeypress(Common::Event *event, bool printable) {
//TODO
if (event->type == Common::EVENT_KEYDOWN && event->kbd.keycode == Common::KEYCODE_TAB) {
- return DID_SUCCEED(moveFocus(!CBKeyboardState::isShiftDown()));
+ return DID_SUCCEED(moveFocus(!BaseKeyboardState::isShiftDown()));
} else {
if (_focusedWidget) return _focusedWidget->handleKeypress(event, printable);
else return false;
@@ -1121,26 +1121,26 @@ bool CUIWindow::handleKeypress(Common::Event *event, bool printable) { //////////////////////////////////////////////////////////////////////////
-bool CUIWindow::handleMouseWheel(int Delta) {
+bool UIWindow::handleMouseWheel(int Delta) {
if (_focusedWidget) return _focusedWidget->handleMouseWheel(Delta);
else return false;
}
//////////////////////////////////////////////////////////////////////////
-bool CUIWindow::handleMouse(TMouseEvent event, TMouseButton button) {
- bool res = CUIObject::handleMouse(event, button);
+bool UIWindow::handleMouse(TMouseEvent event, TMouseButton button) {
+ bool res = UIObject::handleMouse(event, button);
// handle window dragging
- if (!CBPlatform::isRectEmpty(&_dragRect)) {
+ if (!BasePlatform::isRectEmpty(&_dragRect)) {
// start drag
if (event == MOUSE_CLICK && button == MOUSE_BUTTON_LEFT) {
Rect32 dragRect = _dragRect;
int offsetX, offsetY;
getTotalOffset(&offsetX, &offsetY);
- CBPlatform::offsetRect(&dragRect, _posX + offsetX, _posY + offsetY);
+ BasePlatform::offsetRect(&dragRect, _posX + offsetX, _posY + offsetY);
- if (CBPlatform::ptInRect(&dragRect, _gameRef->_mousePos)) {
+ if (BasePlatform::ptInRect(&dragRect, _gameRef->_mousePos)) {
_dragFrom.x = _gameRef->_mousePos.x;
_dragFrom.y = _gameRef->_mousePos.y;
_dragging = true;
@@ -1158,9 +1158,9 @@ bool CUIWindow::handleMouse(TMouseEvent event, TMouseButton button) { //////////////////////////////////////////////////////////////////////////
-bool CUIWindow::persist(CBPersistMgr *persistMgr) {
+bool UIWindow::persist(BasePersistenceManager *persistMgr) {
- CUIObject::persist(persistMgr);
+ UIObject::persist(persistMgr);
persistMgr->transfer(TMEMBER(_backInactive));
persistMgr->transfer(TMEMBER(_clipContents));
@@ -1189,7 +1189,7 @@ bool CUIWindow::persist(CBPersistMgr *persistMgr) { //////////////////////////////////////////////////////////////////////////
-bool CUIWindow::moveFocus(bool forward) {
+bool UIWindow::moveFocus(bool forward) {
int i;
bool found = false;
for (i = 0; i < _widgets.getSize(); i++) {
@@ -1230,7 +1230,7 @@ bool CUIWindow::moveFocus(bool forward) { //////////////////////////////////////////////////////////////////////////
-bool CUIWindow::goExclusive() {
+bool UIWindow::goExclusive() {
if (_mode == WINDOW_EXCLUSIVE) return STATUS_OK;
if (_mode == WINDOW_NORMAL) {
@@ -1245,7 +1245,7 @@ bool CUIWindow::goExclusive() { //////////////////////////////////////////////////////////////////////////
-bool CUIWindow::goSystemExclusive() {
+bool UIWindow::goSystemExclusive() {
if (_mode == WINDOW_SYSTEM_EXCLUSIVE) return STATUS_OK;
makeFreezable(false);
@@ -1262,7 +1262,7 @@ bool CUIWindow::goSystemExclusive() { //////////////////////////////////////////////////////////////////////////
-bool CUIWindow::close() {
+bool UIWindow::close() {
if (_mode == WINDOW_SYSTEM_EXCLUSIVE) {
_gameRef->unfreeze();
}
@@ -1276,16 +1276,16 @@ bool CUIWindow::close() { //////////////////////////////////////////////////////////////////////////
-bool CUIWindow::listen(CBScriptHolder *param1, uint32 param2) {
- CUIObject *obj = (CUIObject *)param1;
+bool UIWindow::listen(BaseScriptHolder *param1, uint32 param2) {
+ UIObject *obj = (UIObject *)param1;
switch (obj->_type) {
case UI_BUTTON:
if (scumm_stricmp(obj->_name, "close") == 0) close();
- else return CBObject::listen(param1, param2);
+ else return BaseObject::listen(param1, param2);
break;
default:
- return CBObject::listen(param1, param2);
+ return BaseObject::listen(param1, param2);
}
return STATUS_OK;
@@ -1293,23 +1293,23 @@ bool CUIWindow::listen(CBScriptHolder *param1, uint32 param2) { //////////////////////////////////////////////////////////////////////////
-void CUIWindow::makeFreezable(bool freezable) {
+void UIWindow::makeFreezable(bool freezable) {
for (int i = 0; i < _widgets.getSize(); i++)
_widgets[i]->makeFreezable(freezable);
- CBObject::makeFreezable(freezable);
+ BaseObject::makeFreezable(freezable);
}
//////////////////////////////////////////////////////////////////////////
-bool CUIWindow::getWindowObjects(CBArray<CUIObject *, CUIObject *> &objects, bool interactiveOnly) {
+bool UIWindow::getWindowObjects(BaseArray<UIObject *, UIObject *> &objects, bool interactiveOnly) {
for (int i = 0; i < _widgets.getSize(); i++) {
- CUIObject *control = _widgets[i];
+ UIObject *control = _widgets[i];
if (control->_disable && interactiveOnly) continue;
switch (control->_type) {
case UI_WINDOW:
- ((CUIWindow *)control)->getWindowObjects(objects, interactiveOnly);
+ ((UIWindow *)control)->getWindowObjects(objects, interactiveOnly);
break;
case UI_BUTTON:
diff --git a/engines/wintermute/ui/ui_window.h b/engines/wintermute/ui/ui_window.h index 6fe24c6a2c..9e8862471c 100644 --- a/engines/wintermute/ui/ui_window.h +++ b/engines/wintermute/ui/ui_window.h @@ -35,24 +35,24 @@ namespace WinterMute {
-class CUIButton;
-class CBViewport;
-class CUIWindow : public CUIObject {
+class UIButton;
+class BaseViewport;
+class UIWindow : public UIObject {
public:
- bool getWindowObjects(CBArray<CUIObject *, CUIObject *> &Objects, bool InteractiveOnly);
+ bool getWindowObjects(BaseArray<UIObject *, UIObject *> &Objects, bool InteractiveOnly);
bool _pauseMusic;
void cleanup();
virtual void makeFreezable(bool freezable);
- CBViewport *_viewport;
+ BaseViewport *_viewport;
bool _clipContents;
bool _inGame;
bool _isMenu;
bool _fadeBackground;
uint32 _fadeColor;
virtual bool handleMouseWheel(int delta);
- CUIWindow *_shieldWindow;
- CUIButton *_shieldButton;
+ UIWindow *_shieldWindow;
+ UIButton *_shieldButton;
bool close();
bool goSystemExclusive();
bool goExclusive();
@@ -61,30 +61,30 @@ public: virtual bool handleMouse(TMouseEvent Event, TMouseButton Button);
Point32 _dragFrom;
bool _dragging;
- DECLARE_PERSISTENT(CUIWindow, CUIObject)
+ DECLARE_PERSISTENT(UIWindow, UIObject)
bool _transparent;
bool showWidget(const char *name, bool visible = true);
bool enableWidget(const char *name, bool enable = true);
Rect32 _titleRect;
Rect32 _dragRect;
virtual bool display(int offsetX = 0, int offsetY = 0);
- CUIWindow(CBGame *inGame);
- virtual ~CUIWindow();
+ UIWindow(BaseGame *inGame);
+ virtual ~UIWindow();
virtual bool handleKeypress(Common::Event *event, bool printable = false);
- CBArray<CUIObject *, CUIObject *> _widgets;
+ BaseArray<UIObject *, UIObject *> _widgets;
TTextAlign _titleAlign;
bool loadFile(const char *filename);
bool loadBuffer(byte *buffer, bool complete = true);
- CUITiledImage *_backInactive;
- CBFont *_fontInactive;
- CBSprite *_imageInactive;
- virtual bool listen(CBScriptHolder *param1, uint32 param2);
- virtual bool saveAsText(CBDynBuffer *buffer, int indent);
+ UITiledImage *_backInactive;
+ BaseFont *_fontInactive;
+ BaseSprite *_imageInactive;
+ virtual bool listen(BaseScriptHolder *param1, uint32 param2);
+ virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent);
// scripting interface
- virtual CScValue *scGetProperty(const char *name);
- virtual bool scSetProperty(const char *name, CScValue *value);
- virtual bool scCallMethod(CScScript *script, CScStack *stack, CScStack *thisStack, const char *name);
+ virtual ScValue *scGetProperty(const char *name);
+ virtual bool scSetProperty(const char *name, ScValue *value);
+ virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name);
virtual const char *scToString();
};
|
