diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-02-15 21:55:32 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-02-15 21:55:32 +0100 |
commit | 08c9cde4726f94698ea938d464cd1de95b7be587 (patch) | |
tree | f75128313418756395683398342cf808387ed390 /src/gui | |
parent | a6623430aa11b02f93761d27c25db9bb4157ec6f (diff) | |
download | mana-08c9cde4726f94698ea938d464cd1de95b7be587.tar.gz mana-08c9cde4726f94698ea938d464cd1de95b7be587.tar.bz2 mana-08c9cde4726f94698ea938d464cd1de95b7be587.tar.xz mana-08c9cde4726f94698ea938d464cd1de95b7be587.zip |
Fixes some variable names to conform to naming convention
Please do remember that member variables are prefixes with 'm', so that
they are easily distinguishable.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/confirm_dialog.h | 1 | ||||
-rw-r--r-- | src/gui/npc_text.cpp | 12 | ||||
-rw-r--r-- | src/gui/npc_text.h | 3 | ||||
-rw-r--r-- | src/gui/npcintegerdialog.cpp | 6 | ||||
-rw-r--r-- | src/gui/npcintegerdialog.h | 3 | ||||
-rw-r--r-- | src/gui/npclistdialog.cpp | 6 | ||||
-rw-r--r-- | src/gui/npclistdialog.h | 7 | ||||
-rw-r--r-- | src/gui/npcstringdialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/npcstringdialog.h | 6 | ||||
-rw-r--r-- | src/gui/ok_dialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/ok_dialog.h | 9 | ||||
-rw-r--r-- | src/gui/scrollarea.cpp | 13 | ||||
-rw-r--r-- | src/gui/scrollarea.h | 9 | ||||
-rw-r--r-- | src/gui/table.cpp | 6 | ||||
-rw-r--r-- | src/gui/table.h | 2 | ||||
-rw-r--r-- | src/gui/truetypefont.cpp | 16 | ||||
-rw-r--r-- | src/gui/truetypefont.h | 2 |
17 files changed, 48 insertions, 59 deletions
diff --git a/src/gui/confirm_dialog.h b/src/gui/confirm_dialog.h index 3fa2b90d..8d8c0436 100644 --- a/src/gui/confirm_dialog.h +++ b/src/gui/confirm_dialog.h @@ -55,7 +55,6 @@ class ConfirmDialog : public Window, public gcn::ActionListener private: TextBox *mTextBox; ScrollArea *mTextArea; - gcn::Button *okButton; }; #endif diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp index b4313b70..3e40d1bb 100644 --- a/src/gui/npc_text.cpp +++ b/src/gui/npc_text.cpp @@ -44,13 +44,13 @@ NpcTextDialog::NpcTextDialog(): mTextBox->setEditable(false); mTextBox->setOpaque(false); - scrollArea = new ScrollArea(mTextBox); - okButton = new Button(_("OK"), "ok", this); + mScrollArea = new ScrollArea(mTextBox); + gcn::Button *okButton = new Button(_("OK"), "ok", this); - scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - scrollArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS); + mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); + mScrollArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS); - place(0, 0, scrollArea, 5).setPadding(3); + place(0, 0, mScrollArea, 5).setPadding(3); place(4, 1, okButton); Layout &layout = getLayout(); @@ -63,7 +63,7 @@ NpcTextDialog::NpcTextDialog(): void NpcTextDialog::setText(const std::string &text) { mText = text; - mTextBox->setTextWrapped(mText, scrollArea->getWidth() - 15); + mTextBox->setTextWrapped(mText, mScrollArea->getWidth() - 15); } void NpcTextDialog::addText(const std::string &text) diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h index a07aa04f..cd1f58a5 100644 --- a/src/gui/npc_text.h +++ b/src/gui/npc_text.h @@ -78,8 +78,7 @@ class NpcTextDialog : public Window, public gcn::ActionListener void widgetResized(const gcn::Event &event); private: - gcn::Button *okButton; - gcn::ScrollArea *scrollArea; + gcn::ScrollArea *mScrollArea; TextBox *mTextBox; std::string mText; diff --git a/src/gui/npcintegerdialog.cpp b/src/gui/npcintegerdialog.cpp index c58fc460..540eca88 100644 --- a/src/gui/npcintegerdialog.cpp +++ b/src/gui/npcintegerdialog.cpp @@ -36,9 +36,9 @@ NpcIntegerDialog::NpcIntegerDialog(): mDecButton = new Button("-", "decvalue", this); mIncButton = new Button("+", "incvalue", this); - okButton = new Button(_("OK"), "ok", this); - cancelButton = new Button(_("Cancel"), "cancel", this); - resetButton = new Button(_("Reset"), "reset", this); + gcn::Button *okButton = new Button(_("OK"), "ok", this); + gcn::Button *cancelButton = new Button(_("Cancel"), "cancel", this); + gcn::Button *resetButton = new Button(_("Reset"), "reset", this); mDecButton->setSize(20, 20); mIncButton->setSize(20, 20); diff --git a/src/gui/npcintegerdialog.h b/src/gui/npcintegerdialog.h index 10ec60b9..a8ffcf0f 100644 --- a/src/gui/npcintegerdialog.h +++ b/src/gui/npcintegerdialog.h @@ -75,9 +75,6 @@ class NpcIntegerDialog : public Window, public gcn::ActionListener gcn::Button *mDecButton; gcn::Button *mIncButton; IntTextField *mValueField; - gcn::Button *okButton; - gcn::Button *cancelButton; - gcn::Button *resetButton; }; #endif // GUI_NPCINTEGERDIALOG_H diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp index 7d8a362a..fe924da1 100644 --- a/src/gui/npclistdialog.cpp +++ b/src/gui/npclistdialog.cpp @@ -44,9 +44,9 @@ NpcListDialog::NpcListDialog(): mItemList = new ListBox(this); mItemList->setWrappingEnabled(true); - scrollArea = new ScrollArea(mItemList); - okButton = new Button(_("OK"), "ok", this); - cancelButton = new Button(_("Cancel"), "cancel", this); + gcn::ScrollArea *scrollArea = new ScrollArea(mItemList); + gcn::Button *okButton = new Button(_("OK"), "ok", this); + gcn::Button *cancelButton = new Button(_("Cancel"), "cancel", this); setContentSize(260, 175); scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); diff --git a/src/gui/npclistdialog.h b/src/gui/npclistdialog.h index 30167a5e..57d6247a 100644 --- a/src/gui/npclistdialog.h +++ b/src/gui/npclistdialog.h @@ -22,12 +22,12 @@ #ifndef GUI_NPCLISTDIALOG_H #define GUI_NPCLISTDIALOG_H -#include <vector> +#include "window.h" #include <guichan/actionlistener.hpp> #include <guichan/listmodel.hpp> -#include "window.h" +#include <vector> /** * The npc list dialog. @@ -74,9 +74,6 @@ class NpcListDialog : public Window, public gcn::ActionListener, private: gcn::ListBox *mItemList; - gcn::ScrollArea *scrollArea; - gcn::Button *okButton; - gcn::Button *cancelButton; std::vector<std::string> mItems; }; diff --git a/src/gui/npcstringdialog.cpp b/src/gui/npcstringdialog.cpp index 718c416f..02f4e4b9 100644 --- a/src/gui/npcstringdialog.cpp +++ b/src/gui/npcstringdialog.cpp @@ -34,8 +34,8 @@ NpcStringDialog::NpcStringDialog(): { mValueField = new TextField(""); - okButton = new Button(_("OK"), "ok", this); - cancelButton = new Button(_("Cancel"), "cancel", this); + gcn::Button *okButton = new Button(_("OK"), "ok", this); + gcn::Button *cancelButton = new Button(_("Cancel"), "cancel", this); place(0, 0, mValueField, 3); place(1, 1, cancelButton); diff --git a/src/gui/npcstringdialog.h b/src/gui/npcstringdialog.h index 1933e0f1..960f8cec 100644 --- a/src/gui/npcstringdialog.h +++ b/src/gui/npcstringdialog.h @@ -22,10 +22,10 @@ #ifndef GUI_NPCSTRINGDIALOG_H #define GUI_NPCSTRINGDIALOG_H -#include <guichan/actionlistener.hpp> - #include "window.h" +#include <guichan/actionlistener.hpp> + /** * The npc integer input dialog. * @@ -70,8 +70,6 @@ class NpcStringDialog : public Window, public gcn::ActionListener private: gcn::TextField *mValueField; - gcn::Button *okButton; - gcn::Button *cancelButton; }; #endif // GUI_NPCSTRINGDIALOG_H diff --git a/src/gui/ok_dialog.cpp b/src/gui/ok_dialog.cpp index 2c67e71f..d9722704 100644 --- a/src/gui/ok_dialog.cpp +++ b/src/gui/ok_dialog.cpp @@ -37,7 +37,7 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg, mTextBox->setOpaque(false); mTextArea = new ScrollArea(mTextBox); - okButton = new Button(_("Ok"), "ok", this); + gcn::Button *okButton = new Button(_("Ok"), "ok", this); mTextArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mTextArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); diff --git a/src/gui/ok_dialog.h b/src/gui/ok_dialog.h index 3a438513..24325c2f 100644 --- a/src/gui/ok_dialog.h +++ b/src/gui/ok_dialog.h @@ -19,13 +19,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _OK_DIALOG_H -#define _OK_DIALOG_H - -#include <guichan/actionlistener.hpp> +#ifndef OK_DIALOG_H +#define OK_DIALOG_H #include "window.h" +#include <guichan/actionlistener.hpp> + class ScrollArea; class TextBox; @@ -54,7 +54,6 @@ class OkDialog : public Window, public gcn::ActionListener { private: TextBox *mTextBox; ScrollArea *mTextArea; - gcn::Button *okButton; }; #endif diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index bc3a62dc..70504a03 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -35,18 +35,16 @@ ImageRect ScrollArea::background; ImageRect ScrollArea::vMarker; Image *ScrollArea::buttons[4][2]; -ScrollArea::ScrollArea(bool gc, bool opaque): +ScrollArea::ScrollArea(): gcn::ScrollArea(), - mOpaque(opaque), - mGC(gc) + mOpaque(true) { init(); } -ScrollArea::ScrollArea(gcn::Widget *widget, bool gc, bool opaque): +ScrollArea::ScrollArea(gcn::Widget *widget): gcn::ScrollArea(widget), - mOpaque(opaque), - mGC(gc) + mOpaque(true) { init(); } @@ -54,8 +52,7 @@ ScrollArea::ScrollArea(gcn::Widget *widget, bool gc, bool opaque): ScrollArea::~ScrollArea() { // Garbage collection - if (mGC) - delete getContent(); + delete getContent(); instances--; diff --git a/src/gui/scrollarea.h b/src/gui/scrollarea.h index 33ebc692..e9aa5ed2 100644 --- a/src/gui/scrollarea.h +++ b/src/gui/scrollarea.h @@ -30,6 +30,10 @@ class ImageRect; /** * A scroll area. * + * Contrary to Guichan's scroll area, this scroll area takes ownership over its + * content. However, it won't delete a previously set content widget when + * setContent is called! + * * \ingroup GUI */ class ScrollArea : public gcn::ScrollArea @@ -38,12 +42,12 @@ class ScrollArea : public gcn::ScrollArea /** * Constructor. */ - ScrollArea(bool gc = true, bool opaque = true); + ScrollArea(); /** * Constructor. */ - ScrollArea(gcn::Widget *content, bool gc = true, bool opaque = true); + ScrollArea(gcn::Widget *content); /** * Destructor. @@ -106,7 +110,6 @@ class ScrollArea : public gcn::ScrollArea static Image *buttons[4][2]; bool mOpaque; - bool mGC; }; #endif diff --git a/src/gui/table.cpp b/src/gui/table.cpp index 76877c6b..1fd088ce 100644 --- a/src/gui/table.cpp +++ b/src/gui/table.cpp @@ -238,8 +238,8 @@ void GuiTable::setSelectedColumn(int selected) void GuiTable::uninstallActionListeners(void) { - delete_all(action_listeners); - action_listeners.clear(); + delete_all(mActionListeners); + mActionListeners.clear(); } void GuiTable::installActionListeners() @@ -254,7 +254,7 @@ void GuiTable::installActionListeners() for (int column = 0; column < columns; ++column) { gcn::Widget *widget = mModel->getElementAt(row, column); - action_listeners.push_back(new GuiTableActionListener(this, widget, + mActionListeners.push_back(new GuiTableActionListener(this, widget, row, column)); } diff --git a/src/gui/table.h b/src/gui/table.h index 841f6ef2..d73cf340 100644 --- a/src/gui/table.h +++ b/src/gui/table.h @@ -180,7 +180,7 @@ private: gcn::Widget *mTopWidget; /** Vector for compactness; used as a list in practice. */ - std::vector<GuiTableActionListener *> action_listeners; + std::vector<GuiTableActionListener *> mActionListeners; }; diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp index 8481d80d..7c72e2f5 100644 --- a/src/gui/truetypefont.cpp +++ b/src/gui/truetypefont.cpp @@ -131,12 +131,12 @@ void TrueTypeFont::drawString(gcn::Graphics *graphics, bool found = false; - for (CacheIterator i = cache.begin(); i != cache.end(); i++) + for (CacheIterator i = mCache.begin(); i != mCache.end(); ++i) { if (chunk == (*i)) { // Raise priority: move it to front - cache.splice(cache.begin(), cache, i); + mCache.splice(mCache.begin(), mCache, i); found = true; break; } @@ -145,16 +145,16 @@ void TrueTypeFont::drawString(gcn::Graphics *graphics, // Surface not found if (!found) { - if (cache.size() >= CACHE_SIZE) + if (mCache.size() >= CACHE_SIZE) { - cache.pop_back(); + mCache.pop_back(); } - cache.push_front(chunk); - cache.front().generate(mFont); + mCache.push_front(chunk); + mCache.front().generate(mFont); } - cache.front().img->setAlpha(alpha); - g->drawImage(cache.front().img, x, y); + mCache.front().img->setAlpha(alpha); + g->drawImage(mCache.front().img, x, y); } int TrueTypeFont::getWidth(const std::string &text) const diff --git a/src/gui/truetypefont.h b/src/gui/truetypefont.h index 3ab24248..71b45fd1 100644 --- a/src/gui/truetypefont.h +++ b/src/gui/truetypefont.h @@ -70,7 +70,7 @@ class TrueTypeFont : public gcn::Font TTF_Font *mFont; // Word surfaces cache - std::list<TextChunk> cache; + std::list<TextChunk> mCache; }; #endif |