1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 11:23:51 +00:00

adjust topic list on window resize

This commit is contained in:
scrawl 2012-05-10 11:19:22 +02:00
parent 8a9e05a96b
commit de995e3a69
4 changed files with 19 additions and 1 deletions

View file

@ -67,6 +67,8 @@ DialogueWindow::DialogueWindow(WindowManager& parWindowManager)
getWidget(pDispositionBar, "Disposition"); getWidget(pDispositionBar, "Disposition");
getWidget(pDispositionText,"DispositionText"); getWidget(pDispositionText,"DispositionText");
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &DialogueWindow::onWindowResize);
} }
void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender) void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
@ -88,6 +90,11 @@ void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
} }
} }
void DialogueWindow::onWindowResize(MyGUI::Window* _sender)
{
topicsList->adjustSize();
}
void DialogueWindow::onMouseWheel(MyGUI::Widget* _sender, int _rel) void DialogueWindow::onMouseWheel(MyGUI::Widget* _sender, int _rel)
{ {
if (history->getVScrollPosition() - _rel*0.3 < 0) if (history->getVScrollPosition() - _rel*0.3 < 0)

View file

@ -51,6 +51,7 @@ namespace MWGui
void onByeClicked(MyGUI::Widget* _sender); void onByeClicked(MyGUI::Widget* _sender);
void onHistoryClicked(MyGUI::Widget* _sender); void onHistoryClicked(MyGUI::Widget* _sender);
void onMouseWheel(MyGUI::Widget* _sender, int _rel); void onMouseWheel(MyGUI::Widget* _sender, int _rel);
void onWindowResize(MyGUI::Window* _sender);
private: private:
void updateOptions(); void updateOptions();

View file

@ -32,6 +32,11 @@ void MWList::addItem(const std::string& name)
redraw(); redraw();
} }
void MWList::adjustSize()
{
redraw();
}
void MWList::redraw(bool scrollbarShown) void MWList::redraw(bool scrollbarShown)
{ {
const int _scrollBarWidth = 24; // fetch this from skin? const int _scrollBarWidth = 24; // fetch this from skin?

View file

@ -9,7 +9,7 @@ namespace MWGui
{ {
/** /**
* \brief a very simple list widget that supports word-wrapping entries * \brief a very simple list widget that supports word-wrapping entries
* \note does not handle changing the width of the list at runtime * \note if the width or height of the list changes, you must call adjustSize() method
*/ */
class MWList : public MyGUI::Widget class MWList : public MyGUI::Widget
{ {
@ -25,6 +25,11 @@ namespace MWGui
*/ */
EventHandle_String eventItemSelected; EventHandle_String eventItemSelected;
/**
* Call after the size of the list changed
*/
void adjustSize();
void addItem(const std::string& name); void addItem(const std::string& name);
void removeItem(const std::string& name); void removeItem(const std::string& name);
bool hasItem(const std::string& name); bool hasItem(const std::string& name);