Initial commit
This commit is contained in:
71
Torque/SDK/engine/gui/utility/guiBubbleTextCtrl.cc
Normal file
71
Torque/SDK/engine/gui/utility/guiBubbleTextCtrl.cc
Normal file
@@ -0,0 +1,71 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Torque Game Engine
|
||||
// Copyright (C) GarageGames.com, Inc.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "gui/utility/guiBubbleTextCtrl.h"
|
||||
#include "gui/core/guiCanvas.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(GuiBubbleTextCtrl);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void GuiBubbleTextCtrl::popBubble()
|
||||
{
|
||||
// Release the mouse:
|
||||
mInAction = false;
|
||||
mouseUnlock();
|
||||
|
||||
// Pop the dialog
|
||||
getRoot()->popDialogControl(mDlg);
|
||||
|
||||
// Kill the popup
|
||||
mDlg->removeObject(mPopup);
|
||||
mPopup->removeObject(mMLText);
|
||||
mMLText->deleteObject();
|
||||
mPopup->deleteObject();
|
||||
mDlg->deleteObject();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void GuiBubbleTextCtrl::onMouseDown(const GuiEvent &event)
|
||||
{
|
||||
if (mInAction)
|
||||
{
|
||||
popBubble();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
mDlg = new GuiControl();
|
||||
AssertFatal(mDlg, "Failed to create the GuiControl for the BubbleTextCtrl");
|
||||
mDlg->setField("profile","GuiModelessDialogProfile");
|
||||
mDlg->setField("horizSizing", "width");
|
||||
mDlg->setField("vertSizing", "height");
|
||||
mDlg->setField("extent", "640 480");
|
||||
|
||||
mPopup = new GuiControl();
|
||||
AssertFatal(mPopup, "Failed to create the GuiControl for the BubbleTextCtrl");
|
||||
mPopup->setField("profile","GuiBubblePopupProfile");
|
||||
|
||||
mMLText = new GuiMLTextCtrl();
|
||||
AssertFatal(mMLText, "Failed to create the GuiMLTextCtrl for the BubbleTextCtrl");
|
||||
mMLText->setField("profile","GuiBubbleTextProfile");
|
||||
mMLText->setField("position", "2 2");
|
||||
mMLText->setField("extent", "296 51");
|
||||
|
||||
mMLText->setText((char*)mText,dStrlen(mText));
|
||||
|
||||
mMLText->registerObject();
|
||||
mPopup->registerObject();
|
||||
mDlg->registerObject();
|
||||
|
||||
mPopup->addObject(mMLText);
|
||||
mDlg->addObject(mPopup);
|
||||
|
||||
mPopup->resize(event.mousePoint,Point2I(300,55));
|
||||
|
||||
getRoot()->pushDialogControl(mDlg,0);
|
||||
mouseLock();
|
||||
|
||||
mInAction = true;
|
||||
}
|
||||
Reference in New Issue
Block a user