From 504219f9df4b9dda139dd832e263a136e51c4851 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 20 Oct 2012 00:14:41 +0300 Subject: Add palette inheritance to browserbox class. --- src/gui/didyouknowwindow.cpp | 2 +- src/gui/helpwindow.cpp | 2 +- src/gui/npcdialog.cpp | 2 +- src/gui/popupmenu.cpp | 2 +- src/gui/questswindow.cpp | 2 +- src/gui/setup_colors.cpp | 2 +- src/gui/socialwindow.cpp | 2 +- src/gui/updaterwindow.cpp | 2 +- src/gui/whoisonline.cpp | 2 +- src/gui/widgets/browserbox.cpp | 5 +++-- src/gui/widgets/browserbox.h | 3 ++- src/gui/widgets/chattab.cpp | 2 +- 12 files changed, 15 insertions(+), 13 deletions(-) (limited to 'src/gui') diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp index c40c60fe7..c6880b420 100644 --- a/src/gui/didyouknowwindow.cpp +++ b/src/gui/didyouknowwindow.cpp @@ -50,7 +50,7 @@ static const int maxTip = 16; DidYouKnowWindow::DidYouKnowWindow(): Window(_("Did You Know?"), false, nullptr, "didyouknow.xml"), gcn::ActionListener(), - mBrowserBox(new BrowserBox), + mBrowserBox(new BrowserBox(this)), mScrollArea(new ScrollArea(mBrowserBox, true, "didyouknow_background.xml")), mButtonPrev(new Button(_("< Previous"), "prev", this)), diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp index 9018f68aa..ef6511ac5 100644 --- a/src/gui/helpwindow.cpp +++ b/src/gui/helpwindow.cpp @@ -47,7 +47,7 @@ HelpWindow::HelpWindow(): Window(_("Help"), false, nullptr, "help.xml"), gcn::ActionListener(), - mBrowserBox(new BrowserBox), + mBrowserBox(new BrowserBox(this)), mScrollArea(new ScrollArea(mBrowserBox, true, "help_background.xml")) { setMinWidth(300); diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 566a44e0b..3e2e860f1 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -66,7 +66,7 @@ NpcDialog::NpcDialog(const int npcId) : mNpcId(npcId), mLogInteraction(config.getBoolValue("logNpcInGui")), mDefaultInt(0), - mTextBox(new BrowserBox(BrowserBox::AUTO_WRAP)), + mTextBox(new BrowserBox(this, BrowserBox::AUTO_WRAP)), mScrollArea(new ScrollArea(mTextBox, getOptionBool("showtextbackground"), "npc_textbackground.xml")), mItemList(new ExtendedListBox(this, this)), diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 4b41ed98b..49790982e 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -79,7 +79,7 @@ std::string tradePartnerName(""); PopupMenu::PopupMenu(): Popup("PopupMenu", "popupmenu.xml"), - mBrowserBox(new BrowserBox), + mBrowserBox(new BrowserBox(this)), mBeingId(0), mFloorItemId(0), mItem(nullptr), diff --git a/src/gui/questswindow.cpp b/src/gui/questswindow.cpp index 825b471ab..fe6fdb2b3 100644 --- a/src/gui/questswindow.cpp +++ b/src/gui/questswindow.cpp @@ -94,7 +94,7 @@ QuestsWindow::QuestsWindow() : mQuestScrollArea(new ScrollArea(mQuestsListBox, getOptionBool("showlistbackground"), "quests_list_background.xml")), mItemLinkHandler(new ItemLinkHandler), - mText(new BrowserBox(BrowserBox::AUTO_WRAP)), + mText(new BrowserBox(this, BrowserBox::AUTO_WRAP)), mTextScrollArea(new ScrollArea(mText, getOptionBool("showtextbackground"), "quests_text_background.xml")), mCloseButton(new Button(_("Close"), "close", this)), diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp index 0e916b691..abeb96252 100644 --- a/src/gui/setup_colors.cpp +++ b/src/gui/setup_colors.cpp @@ -53,7 +53,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : gcn::SelectionListener(), mColorBox(new ListBox(this, userPalette)), mScroll(new ScrollArea(mColorBox, true, "setup_colors_background.xml")), - mPreview(new BrowserBox(BrowserBox::AUTO_WRAP)), + mPreview(new BrowserBox(this, BrowserBox::AUTO_WRAP)), mTextPreview(new TextPreview(rawmsg)), mPreviewBox(new ScrollArea(mPreview, true, "setup_colors_preview_background.xml")), diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index ecce2cc82..fef935314 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -1172,7 +1172,7 @@ public: CreatePopup() : Popup("SocialCreatePopup"), LinkHandler(), - mBrowserBox(new BrowserBox) + mBrowserBox(new BrowserBox(this)) { mBrowserBox->setPosition(4, 4); mBrowserBox->setHighlightMode(BrowserBox::BACKGROUND); diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index c0f8efba8..f53a84cd7 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -160,7 +160,7 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost, mCancelButton(new Button(_("Cancel"), "cancel", this)), mPlayButton(new Button(_("Play"), "play", this)), mProgressBar(new ProgressBar(0.0, 310, 0)), - mBrowserBox(new BrowserBox), + mBrowserBox(new BrowserBox(this)), mScrollArea(new ScrollArea(mBrowserBox, true, "update_background.xml")), mUpdateServerPath(mUpdateHost) { diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index d71b595fe..6a14edd6e 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -102,7 +102,7 @@ WhoIsOnline::WhoIsOnline(): mUpdateButton->setEnabled(false); mUpdateButton->setDimension(gcn::Rectangle(5, 5, w - 10, 20 + 5)); - mBrowserBox = new BrowserBox; + mBrowserBox = new BrowserBox(this); mScrollArea = new ScrollArea(mBrowserBox, false); mBrowserBox->setOpaque(false); mBrowserBox->setHighlightMode(BrowserBox::BACKGROUND); diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 0f72ad649..578ddd4a9 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -45,9 +45,10 @@ #include "debug.h" -BrowserBox::BrowserBox(const unsigned int mode, const bool opaque) : +BrowserBox::BrowserBox(const Widget2 *const widget, const unsigned int mode, + const bool opaque) : gcn::Widget(), - Widget2(), + Widget2(widget), gcn::MouseListener(), mLinkHandler(nullptr), mMode(mode), diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index b6d504a15..ceb4b1b3f 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -84,7 +84,8 @@ class BrowserBox final : public gcn::Widget, /** * Constructor. */ - BrowserBox(const unsigned int mode = AUTO_SIZE, + BrowserBox(const Widget2 *const widget, + const unsigned int mode = AUTO_SIZE, const bool opaque = true); A_DELETE_COPY(BrowserBox) diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 63b5f8e05..8d983921e 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -51,7 +51,7 @@ static const unsigned int MAX_WORD_SIZE = 50; ChatTab::ChatTab(const Widget2 *const widget, const std::string &name) : Tab(widget), - mTextOutput(new BrowserBox(BrowserBox::AUTO_WRAP)), + mTextOutput(new BrowserBox(this, BrowserBox::AUTO_WRAP)), mScrollArea(new ScrollArea(mTextOutput, false)), mAllowHightlight(true), mRemoveNames(false), -- cgit v1.2.3-70-g09d2