adjust topic list on window resize

actorid
scrawl 13 years ago
parent 8a9e05a96b
commit de995e3a69

@ -67,6 +67,8 @@ DialogueWindow::DialogueWindow(WindowManager& parWindowManager)
getWidget(pDispositionBar, "Disposition");
getWidget(pDispositionText,"DispositionText");
static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &DialogueWindow::onWindowResize);
}
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)
{
if (history->getVScrollPosition() - _rel*0.3 < 0)

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

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

@ -9,7 +9,7 @@ namespace MWGui
{
/**
* \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
{
@ -25,6 +25,11 @@ namespace MWGui
*/
EventHandle_String eventItemSelected;
/**
* Call after the size of the list changed
*/
void adjustSize();
void addItem(const std::string& name);
void removeItem(const std::string& name);
bool hasItem(const std::string& name);

Loading…
Cancel
Save