diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-07-28 02:12:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-07-28 02:12:32 +0300 |
commit | 7898fc26ca13913637bd84008df016763358d082 (patch) | |
tree | 13ffeeab17bebd8e79391bfc75cc3cd38d068cdc /src/gui | |
parent | f60d54307c20d4150e630620dbe0be62b2a1b8a5 (diff) | |
download | mv-7898fc26ca13913637bd84008df016763358d082.tar.gz mv-7898fc26ca13913637bd84008df016763358d082.tar.bz2 mv-7898fc26ca13913637bd84008df016763358d082.tar.xz mv-7898fc26ca13913637bd84008df016763358d082.zip |
Simplify scrollarea opaque flag.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/shortcutwindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/skilldialog.cpp | 6 | ||||
-rw-r--r-- | src/gui/statuswindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/whoisonline.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/scrollarea.cpp | 11 | ||||
-rw-r--r-- | src/gui/widgets/scrollarea.h | 4 | ||||
-rw-r--r-- | src/gui/widgets/setuptabscroll.cpp | 3 |
8 files changed, 17 insertions, 27 deletions
diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index 4d7443037..a051705b8 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -97,10 +97,9 @@ ShortcutWindow::ShortcutWindow(const std::string &title, mBoxesWidth += mItems->getBoxWidth() + border; - mScrollArea = new ScrollArea(mItems); + mScrollArea = new ScrollArea(mItems, false); mScrollArea->setPosition(SCROLL_PADDING, SCROLL_PADDING); mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - mScrollArea->setOpaque(false); place(0, 0, mScrollArea, 5, 5).setPadding(0); @@ -161,10 +160,9 @@ ShortcutWindow::~ShortcutWindow() void ShortcutWindow::addTab(std::string name, ShortcutContainer *content) { - ScrollArea *scroll = new ScrollArea(content); + ScrollArea *scroll = new ScrollArea(content, false); scroll->setPosition(SCROLL_PADDING, SCROLL_PADDING); scroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - scroll->setOpaque(false); Tab *tab = new ShortcutTab(name, content); mTabs->addTab(tab, scroll); } diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index aa8ea716f..86a4df38b 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -394,8 +394,7 @@ void SkillDialog::loadSkills(const std::string &file) listbox = new SkillListBox(model); listbox->setActionEventId("sel"); listbox->addActionListener(this); - scroll = new ScrollArea(listbox); - scroll->setOpaque(false); + scroll = new ScrollArea(listbox, false); scroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); scroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS); @@ -458,8 +457,7 @@ void SkillDialog::loadSkills(const std::string &file) listbox = new SkillListBox(model); listbox->setActionEventId("sel"); listbox->addActionListener(this); - scroll = new ScrollArea(listbox); - scroll->setOpaque(false); + scroll = new ScrollArea(listbox, false); scroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); scroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 73d95c54b..d64aa3ebf 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -227,15 +227,13 @@ StatusWindow::StatusWindow(): // ---------------------- mAttrCont = new VertContainer(32); - mAttrScroll = new ScrollArea(mAttrCont); - mAttrScroll->setOpaque(false); + mAttrScroll = new ScrollArea(mAttrCont, false); mAttrScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mAttrScroll->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO); place(0, 3, mAttrScroll, 5, 3); mDAttrCont = new VertContainer(32); - mDAttrScroll = new ScrollArea(mDAttrCont); - mDAttrScroll->setOpaque(false); + mDAttrScroll = new ScrollArea(mDAttrCont, false); mDAttrScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mDAttrScroll->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO); place(6, 3, mDAttrScroll, 5, 3); diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 8e130d887..503ce3758 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -105,9 +105,8 @@ WhoIsOnline::WhoIsOnline(): mUpdateButton->setEnabled(false); mUpdateButton->setDimension(gcn::Rectangle(5, 5, w - 10, 20 + 5)); - mBrowserBox = new BrowserBox(); - mScrollArea = new ScrollArea(mBrowserBox); - mScrollArea->setOpaque(false); + mBrowserBox = new BrowserBox; + mScrollArea = new ScrollArea(mBrowserBox, false); mBrowserBox->setOpaque(false); mBrowserBox->setHighlightMode(BrowserBox::BACKGROUND); mScrollArea->setDimension(gcn::Rectangle(5, 20 + 10, w - 10, h - 10 - 30)); diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index f67b75107..1dd4e1fc8 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -55,7 +55,7 @@ ChatTab::ChatTab(const std::string &name) : Tab(), mTextOutput(new BrowserBox(BrowserBox::AUTO_WRAP)), - mScrollArea(new ScrollArea(mTextOutput)), + mScrollArea(new ScrollArea(mTextOutput, false)), mAllowHightlight(true), mRemoveNames(false), mNoAway(false) @@ -71,7 +71,6 @@ ChatTab::ChatTab(const std::string &name) : mScrollArea->setScrollPolicy(gcn::ScrollArea::SHOW_NEVER, gcn::ScrollArea::SHOW_ALWAYS); mScrollArea->setScrollAmount(0, 1); - mScrollArea->setOpaque(false); if (chatWindow) chatWindow->addTab(this); diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 3635e5f4f..214874f69 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -49,14 +49,14 @@ static std::string const buttonFiles[2] = "scrollbuttons_pressed.xml" }; -ScrollArea::ScrollArea(): +ScrollArea::ScrollArea(bool opaque): gcn::ScrollArea(), mX(0), mY(0), mClickX(0), mClickY(0), mHasMouse(false), - mOpaque(true), + mOpaque(opaque), mVertexes(new GraphicsVertexes()), mRedraw(true), mXOffset(0), @@ -68,14 +68,14 @@ ScrollArea::ScrollArea(): init(); } -ScrollArea::ScrollArea(gcn::Widget *widget): +ScrollArea::ScrollArea(gcn::Widget *widget, bool opaque): gcn::ScrollArea(widget), mX(0), mY(0), mClickX(0), mClickY(0), mHasMouse(false), - mOpaque(true), + mOpaque(opaque), mVertexes(new GraphicsVertexes()), mRedraw(true), mXOffset(0), @@ -114,8 +114,7 @@ ScrollArea::~ScrollArea() void ScrollArea::init() { - // Draw background by default - setOpaque(true); + setOpaque(mOpaque); setUpButtonScrollAmount(2); setDownButtonScrollAmount(2); diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index 53a79d20f..335d810b2 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -46,14 +46,14 @@ class ScrollArea : public gcn::ScrollArea, public gcn::WidgetListener * Constructor that takes no content. Needed for use with the DropDown * class. */ - ScrollArea(); + ScrollArea(bool opaque = true); /** * Constructor. * * @param content the initial content to show in the scroll area */ - ScrollArea(gcn::Widget *content); + ScrollArea(gcn::Widget *content, bool opaque = true); /** * Destructor. Also deletes the content. diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp index d7ff749d2..6bf627cdd 100644 --- a/src/gui/widgets/setuptabscroll.cpp +++ b/src/gui/widgets/setuptabscroll.cpp @@ -30,10 +30,9 @@ SetupTabScroll::SetupTabScroll() : SetupTab(), mContainer(new VertContainer(25, false, 8)), - mScroll(new ScrollArea(mContainer)), + mScroll(new ScrollArea(mContainer, false)), mPreferredFirstItemSize(200) { - mScroll->setOpaque(false); mScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mScroll->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO); } |