本文整理汇总了C++中Popup::adaptToNewSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Popup::adaptToNewSize方法的具体用法?C++ Popup::adaptToNewSize怎么用?C++ Popup::adaptToNewSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Popup
的用法示例。
在下文中一共展示了Popup::adaptToNewSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
void Setup_Video::apply()
{
const std::string mode = mModeListModel->getElementAt(mModeList->getSelected());
if (mode.find("x") != std::string::npos)
{
const int width = atoi(mode.substr(0, mode.find("x")).c_str());
const int height = atoi(mode.substr(mode.find("x") + 1).c_str());
gui->resize(width, height);
}
// Full screen changes
bool fullscreen = mFsCheckBox->isSelected();
if (fullscreen != (config.getValue("screen", false) == 1))
{
/* The OpenGL test is only necessary on Windows, since switching
* to/from full screen works fine on Linux. On Windows we'd have to
* reinitialize the OpenGL state and reload all textures.
*
* See http://libsdl.org/cgi/docwiki.cgi/SDL_SetVideoMode
*/
#ifdef WIN32
// checks for opengl usage
if (!(config.getValue("opengl", false) == 1))
{
#endif
if (!graphics->setFullscreen(fullscreen))
{
fullscreen = !fullscreen;
if (!graphics->setFullscreen(fullscreen))
{
std::stringstream error;
error << _("Failed to switch to ") <<
(fullscreen ? _("windowed") : _("fullscreen")) <<
_("mode and restoration of old mode also failed!") <<
std::endl;
logger->error(error.str());
}
}
#ifdef WIN32
}
else
{
new OkDialog(_("Switching to full screen"),
_("Restart needed for changes to take effect."));
}
#endif
config.setValue("screen", fullscreen ? true : false);
}
// OpenGL change
if (mOpenGLCheckBox->isSelected() != mOpenGLEnabled)
{
config.setValue("opengl", mOpenGLCheckBox->isSelected() ? true : false);
// OpenGL can currently only be changed by restarting, notify user.
new OkDialog(_("Changing OpenGL"),
_("Applying change to OpenGL requires restart."));
}
if ((int) mFontSizeSlider->getValue() != mFontSize)
{
const int val = (int) mFontSizeSlider->getValue();
gui->changeFontSize(val);
Widgets widgets = windowContainer->getWidgetList();
WidgetIterator iter;
for (iter = widgets.begin(); iter != widgets.end(); ++iter)
{
Popup* popup = dynamic_cast<Popup*>(*iter);
if (popup)
{
popup->adaptToNewSize();
continue;
}
}
if (state != GAME_STATE && desktop)
desktop->resize();
config.setValue("fontSize", val);
}
mFps = (mFpsCheckBox->isSelected()) ? (int) mFpsSlider->getValue() : 0;
mFpsSlider->setEnabled(mFps > 0);
// FPS change
config.setValue("fpslimit", mFps);
// We sync old and new values at apply time
mFullScreenEnabled = config.getValue("screen", false);
mOpenGLEnabled = config.getValue("opengl", false);
mCustomCursorEnabled = config.getValue("customcursor", true);
mNameEnabled = config.getValue("showownname", false);
//.........这里部分代码省略.........