00001 /* 00002 * The Mana World 00003 * Copyright (C) 2004 The Mana World Development Team 00004 * 00005 * This file is part of The Mana World. 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 #ifndef BUY_H 00023 #define BUY_H 00024 00025 #include "gui/widgets/window.h" 00026 00027 #include "guichanfwd.h" 00028 00029 #include <guichan/actionlistener.hpp> 00030 #include <guichan/selectionlistener.hpp> 00031 00032 class ShopItems; 00033 class ShopListBox; 00034 class ListBox; 00035 00041 class BuyDialog : public Window, public gcn::ActionListener, 00042 public gcn::SelectionListener 00043 { 00044 public: 00050 BuyDialog(); 00051 00055 ~BuyDialog(); 00056 00060 void reset(); 00061 00065 void setMoney(int amount); 00066 00070 void addItem(int id, int amount, int price); 00071 00075 void action(const gcn::ActionEvent &event); 00076 00080 int getNumberOfElements(); 00081 00085 void valueChanged(const gcn::SelectionEvent &event); 00086 00090 std::string getElementAt(int i); 00091 00095 void updateButtonsAndLabels(); 00096 00100 void logic(); 00101 00105 void setVisible(bool visible); 00106 00110 void close(); 00111 00112 private: 00113 gcn::Button *mBuyButton; 00114 gcn::Button *mQuitButton; 00115 gcn::Button *mAddMaxButton; 00116 gcn::Button *mIncreaseButton; 00117 gcn::Button *mDecreaseButton; 00118 ShopListBox *mShopItemList; 00119 gcn::ScrollArea *mScrollArea; 00120 gcn::Label *mItemDescLabel; 00121 gcn::Label *mItemEffectLabel; 00122 gcn::Label *mMoneyLabel; 00123 gcn::Label *mQuantityLabel; 00124 gcn::Slider *mSlider; 00125 00126 ShopItems *mShopItems; 00127 00128 int mMoney; 00129 int mAmountItems; 00130 int mMaxItems; 00131 }; 00132 00133 extern BuyDialog *buyDialog; 00134 00135 #endif