mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 19:45:38 +00:00
auto adjust size of map window title bar
This commit is contained in:
parent
4a2ade2372
commit
f959a5cbeb
2 changed files with 24 additions and 0 deletions
|
@ -202,6 +202,7 @@ void MapWindow::setVisible(bool b)
|
|||
void MapWindow::setCellName(const std::string& cellName)
|
||||
{
|
||||
static_cast<MyGUI::Window*>(mMainWidget)->setCaption(cellName);
|
||||
adjustWindowCaption();
|
||||
}
|
||||
|
||||
void MapWindow::setPlayerPos(const float x, const float y)
|
||||
|
|
|
@ -80,6 +80,29 @@ namespace GUI
|
|||
mMainWidget->setCoord(x,y,w,h);
|
||||
}
|
||||
|
||||
void adjustWindowCaption()
|
||||
{
|
||||
// adjust the size of the window caption so that all text is visible
|
||||
// NOTE: this assumes that mMainWidget is of type Window.
|
||||
MyGUI::TextBox* box = static_cast<MyGUI::Window*>(mMainWidget)->getCaptionWidget();
|
||||
box->setSize(box->getTextSize().width + 48, box->getSize().height);
|
||||
|
||||
// in order to trigger alignment updates, we need to update the parent
|
||||
// mygui doesn't provide a proper way of doing this, so we are just changing size
|
||||
box->getParent()->setCoord(MyGUI::IntCoord(
|
||||
box->getParent()->getCoord().left,
|
||||
box->getParent()->getCoord().top,
|
||||
box->getParent()->getCoord().width,
|
||||
box->getParent()->getCoord().height+1
|
||||
));
|
||||
box->getParent()->setCoord(MyGUI::IntCoord(
|
||||
box->getParent()->getCoord().left,
|
||||
box->getParent()->getCoord().top,
|
||||
box->getParent()->getCoord().width,
|
||||
box->getParent()->getCoord().height-1
|
||||
));
|
||||
}
|
||||
|
||||
void setVisible(bool b)
|
||||
{
|
||||
mMainWidget->setVisible(b);
|
||||
|
|
Loading…
Reference in a new issue