本文整理汇总了C++中MessageView::localToGlobal方法的典型用法代码示例。如果您正苦于以下问题:C++ MessageView::localToGlobal方法的具体用法?C++ MessageView::localToGlobal怎么用?C++ MessageView::localToGlobal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MessageView
的用法示例。
在下文中一共展示了MessageView::localToGlobal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupDialog
void MessageDialog::setupDialog(std::string& message, std::string& buttonText1, std::string& buttonText2)
{
// int resId = 0;
// int resSubId = 0;
MessageView* messageView = new MessageView(this, getDialogRect(), message);
addView(messageView, VIEW_ID_MESSAGE_VIEW);
Rect messageViewArea = messageView->getViewArea();
int middleX = messageViewArea.width() / 2;
int middleY = messageViewArea.height() - BUTTON_V_OFFSET - BUTTON_SIZE_Y;
Point middlePoint(middleX, middleY);
if(!buttonText1.empty())
{
Point button1Point = middlePoint;
if(!buttonText2.empty())
{
// setup for 2 buttons
button1Point.x -= BUTTON_SIZE_X + BUTTON_SPACE/2;
}
else
{
// setup for 1 button
button1Point.x -= BUTTON_SIZE_X/2;
}
// create button1
Button* button1 = new Button(this, messageView->localToGlobal(button1Point), VIEW_ID_BUTTON_1);
button1->setText(buttonText1.c_str());
addView(button1, VIEW_ID_BUTTON_1);
if(!buttonText2.empty())
{
Point button2Point = middlePoint;
button2Point.x += BUTTON_SPACE/2;
// create button2
Button* button2 = new Button(this, messageView->localToGlobal(button2Point), VIEW_ID_BUTTON_2);
button2->setText(buttonText2.c_str());
addView(button2, VIEW_ID_BUTTON_2);
}
}
// TODO: remove these catan specific things
#if (defined(CATAN_CLIENT) || defined(CATAN_STANDALONE))
// Draw Catan Scroll Border around dialog
CatanDialogBorder* borderView = new CatanDialogBorder(this, getDialogRect());
addView(borderView, VIEW_ID_BORDER);
#endif
redraw();
}