From 5c6dc4e9dc4e13e3531135ad434b540055c2393e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 18 Oct 2013 19:56:18 +0300 Subject: move virtual member calls from popupmenu constuctor into postInit. --- src/gui/popups/popupmenu.cpp | 4 ++++ src/gui/popups/popupmenu.h | 2 ++ src/gui/viewport.cpp | 1 + src/gui/widgets/textfield.cpp | 3 +++ 4 files changed, 10 insertions(+) diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 3655451d3..cba03800a 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -120,6 +120,10 @@ PopupMenu::PopupMenu() : mPlayerListener.setType(static_cast(Being::UNKNOWN)); mScrollArea = new ScrollArea(mBrowserBox, false); mScrollArea->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO); +} + +void PopupMenu::postInit() +{ add(mScrollArea); } diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index f5ff7fb84..4bb7e2e04 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -104,6 +104,8 @@ class PopupMenu final : public Popup, public LinkHandler A_DELETE_COPY(PopupMenu) + void postInit(); + /** * Shows the being related popup menu at the specified mouse coords. */ diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 4404060d5..e82b0f546 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -79,6 +79,7 @@ Viewport::Viewport() : mCameraRelativeY(0) { mBeingPopup->postInit(); + mPopupMenu->postInit(); setOpaque(false); addMouseListener(this); diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index bf5485a7b..04527e1ae 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -566,7 +566,10 @@ void TextField::mousePressed(gcn::MouseEvent &mouseEvent) else { if (!mPopupMenu) + { mPopupMenu = new PopupMenu(); + mPopupMenu->postInit(); + } int x = 0; int y = 0; SDL_GetMouseState(&x, &y); -- cgit v1.2.3-70-g09d2