mirror of https://github.com/stella-emu/stella.git
fixed BrowserDialog sizing and title
This commit is contained in:
parent
44a8ef1db3
commit
3a1df0e99b
|
@ -29,8 +29,8 @@
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font,
|
BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font,
|
||||||
int max_w, int max_h, const string& title)
|
int max_w, int max_h)
|
||||||
: Dialog(boss->instance(), boss->parent(), font, title)
|
: Dialog(boss->instance(), boss->parent(), font, "Title") // dummy title value!
|
||||||
{
|
{
|
||||||
// Set real dimensions
|
// Set real dimensions
|
||||||
_w = max_w;
|
_w = max_w;
|
||||||
|
@ -122,13 +122,18 @@ void BrowserDialog::show(GuiObject* parent, const GUI::Font& font,
|
||||||
const FilesystemNode::NameFilter& namefilter)
|
const FilesystemNode::NameFilter& namefilter)
|
||||||
{
|
{
|
||||||
uInt32 w = 0, h = 0;
|
uInt32 w = 0, h = 0;
|
||||||
|
|
||||||
static_cast<Dialog*>(parent)->getDynamicBounds(w, h);
|
static_cast<Dialog*>(parent)->getDynamicBounds(w, h);
|
||||||
if(w > uInt32(font.getMaxCharWidth() * 80))
|
if(w > uInt32(font.getMaxCharWidth() * 80))
|
||||||
w = font.getMaxCharWidth() * 80;
|
w = font.getMaxCharWidth() * 80;
|
||||||
|
|
||||||
static unique_ptr<BrowserDialog> ourBrowser =
|
static unique_ptr<BrowserDialog> ourBrowser{nullptr};
|
||||||
make_unique<BrowserDialog>(parent, font, w, h, title);
|
|
||||||
|
|
||||||
|
if(ourBrowser == nullptr
|
||||||
|
|| ourBrowser->getWidth() != int(w) || ourBrowser->getHeight() != int(h))
|
||||||
|
ourBrowser = make_unique<BrowserDialog>(parent, font, w, h);
|
||||||
|
|
||||||
|
ourBrowser->setTitle(title); // has to be always updated!
|
||||||
ourBrowser->show(startpath, mode, command, namefilter);
|
ourBrowser->show(startpath, mode, command, namefilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,7 @@ class BrowserDialog : public Dialog
|
||||||
public:
|
public:
|
||||||
// NOTE: Do not call this c'tor directly! Use the static show method below
|
// NOTE: Do not call this c'tor directly! Use the static show method below
|
||||||
// There is no point in doing so, since the result can't be returned
|
// There is no point in doing so, since the result can't be returned
|
||||||
BrowserDialog(GuiObject* boss, const GUI::Font& font, int max_w, int max_h,
|
BrowserDialog(GuiObject* boss, const GUI::Font& font, int max_w, int max_h);
|
||||||
const string& title);
|
|
||||||
~BrowserDialog() override = default;
|
~BrowserDialog() override = default;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue