diff options
author | Ira Rice <irarice@gmail.com> | 2009-01-15 22:58:07 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-01-15 22:58:07 -0700 |
commit | ecc18d3a2ed44d4b4e6ccfe879771686b2616bb4 (patch) | |
tree | 9fd6afb73c8478311bd3d55d519467d8122f5c64 | |
parent | 600e10515e127d6393f0756cb72e5a63303557a2 (diff) | |
download | Mana-ecc18d3a2ed44d4b4e6ccfe879771686b2616bb4.tar.gz Mana-ecc18d3a2ed44d4b4e6ccfe879771686b2616bb4.tar.bz2 Mana-ecc18d3a2ed44d4b4e6ccfe879771686b2616bb4.tar.xz Mana-ecc18d3a2ed44d4b4e6ccfe879771686b2616bb4.zip |
A little bit of code cleanup/simplification.
TODO: Figure out how the itempopup transparency is broken and fix it
(broken on code import). Best guess would be that the window is attached
to a widget which is then attached to a window, causing a break in
updates to the transparency code.
Signed-off-by: Ira Rice <irarice@gmail.com>
-rw-r--r-- | src/gui/inventorywindow.cpp | 1 | ||||
-rw-r--r-- | src/gui/itemcontainer.h | 4 | ||||
-rw-r--r-- | src/gui/itempopup.cpp | 17 | ||||
-rw-r--r-- | src/gui/itempopup.h | 2 | ||||
-rw-r--r-- | src/gui/scrollarea.cpp | 18 |
5 files changed, 23 insertions, 19 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index f52745bf..8c5edec4 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -28,7 +28,6 @@ #include "inventorywindow.h" #include "item_amount.h" #include "itemcontainer.h" -#include "itempopup.h" #include "scrollarea.h" #include "viewport.h" diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index 223a3677..7f0e5386 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -108,6 +108,8 @@ class ItemContainer : public gcn::Widget, mListeners.remove(listener); } + ItemPopup *mItemPopup; + private: void mouseExited(gcn::MouseEvent &event); void mouseMoved(gcn::MouseEvent &event); @@ -150,8 +152,6 @@ class ItemContainer : public gcn::Widget, int mMaxItems; int mOffset; - ItemPopup *mItemPopup; - std::list<gcn::SelectionListener*> mListeners; static const int gridWidth; diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 1402a148..a0df3eed 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -20,23 +20,24 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "itempopup.h" #include <guichan/widgets/label.hpp> -#include "widgets/layout.h" #include "gui.h" +#include "itempopup.h" + +#include "widgets/layout.h" #include "../resources/image.h" -#include "../resources/resourcemanager.h" #include "../resources/iteminfo.h" +#include "../resources/resourcemanager.h" + #include "../utils/gettext.h" #include "../utils/strprintf.h" - ItemPopup::ItemPopup() { setResizable(false); - setCaption(""); + setShowTitle(false); setTitleBarHeight(0); loadSkin("graphics/gui/gui.xml"); @@ -49,7 +50,6 @@ ItemPopup::ItemPopup() // Item Description mItemDesc = new TextBox(); mItemDesc->setEditable(false); - mItemDesc->setMinWidth(170); mItemDescScroll = new ScrollArea(mItemDesc); mItemDescScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); @@ -61,7 +61,6 @@ ItemPopup::ItemPopup() // Item Effect mItemEffect = new TextBox(); mItemEffect->setEditable(false); - mItemEffect->setMinWidth(170); mItemEffectScroll = new ScrollArea(mItemEffect); mItemEffectScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); @@ -88,8 +87,8 @@ void ItemPopup::setItem(const ItemInfo &item) const gcn::Rectangle &area = getChildrenArea(); const int width = area.width; - mItemDesc->setMinWidth(width - 30); - mItemEffect->setMinWidth(width - 30); + mItemDesc->setMinWidth(width - 10); + mItemEffect->setMinWidth(width - 10); mItemName->setCaption(item.getName()); mItemDesc->setTextWrapped(item.getDescription()); diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h index 8da0b32a..5b7a911a 100644 --- a/src/gui/itempopup.h +++ b/src/gui/itempopup.h @@ -23,8 +23,8 @@ #ifndef _TMW_ITEMPOPUP_H__ #define _TMW_ITEMPOPUP_H__ -#include "textbox.h" #include "scrollarea.h" +#include "textbox.h" #include "window.h" #include "../item.h" diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index ba119a61..07b4027b 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -108,8 +108,10 @@ void ScrollArea::init() int vsgridy[4] = {0, 4, 15, 19}; a = 0; - for (y = 0; y < 3; y++) { - for (x = 0; x < 3; x++) { + for (y = 0; y < 3; y++) + { + for (x = 0; x < 3; x++) + { vMarker.grid[a] = vscroll->getSubImage( vsgridx[x], vsgridy[y], vsgridx[x + 1] - vsgridx[x], @@ -200,7 +202,8 @@ void ScrollArea::drawFrame(gcn::Graphics *graphics) int w = getWidth() + bs * 2; int h = getHeight() + bs * 2; - if (mOpaque) { + if (mOpaque) + { static_cast<Graphics*>(graphics)-> drawImageRect(0, 0, w, h, background); } @@ -210,10 +213,12 @@ void ScrollArea::setOpaque(bool opaque) { mOpaque = opaque; - if (mOpaque) { + if (mOpaque) + { setFrameSize(2); } - else { + else + { setFrameSize(0); } } @@ -223,7 +228,8 @@ void ScrollArea::drawButton(gcn::Graphics *graphics, BUTTON_DIR dir) int state = 0; gcn::Rectangle dim; - switch(dir) { + switch(dir) + { case UP: state = mUpButtonPressed ? 1 : 0; dim = getUpButtonDimension(); |