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 SELL_H 00023 #define SELL_H 00024 00025 #include "gui/widgets/window.h" 00026 00027 #include <guichan/actionlistener.hpp> 00028 #include <guichan/selectionlistener.hpp> 00029 00030 #include <SDL_types.h> 00031 00032 class Item; 00033 class ShopItems; 00034 class ShopListBox; 00035 00041 class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener 00042 { 00043 public: 00049 SellDialog(); 00050 00054 virtual ~SellDialog(); 00055 00059 void reset(); 00060 00064 void addItem(const Item *item, int price); 00065 00069 void action(const gcn::ActionEvent &event); 00070 00076 void valueChanged(const gcn::SelectionEvent &event); 00077 00081 void setMoney(int amount); 00082 00086 void logic(); 00087 00091 void setVisible(bool visible); 00092 00096 void close(); 00097 private: 00101 void updateButtonsAndLabels(); 00102 00103 gcn::Button *mSellButton; 00104 gcn::Button *mQuitButton; 00105 gcn::Button *mAddMaxButton; 00106 gcn::Button *mIncreaseButton; 00107 gcn::Button *mDecreaseButton; 00108 ShopListBox *mShopItemList; 00109 gcn::ScrollArea *mScrollArea; 00110 gcn::Label *mMoneyLabel; 00111 gcn::Label *mItemDescLabel; 00112 gcn::Label *mItemEffectLabel; 00113 gcn::Label *mQuantityLabel; 00114 gcn::Slider *mSlider; 00115 00116 ShopItems *mShopItems; 00117 int mPlayerMoney; 00118 00119 int mMaxItems; 00120 int mAmountItems; 00121 }; 00122 00123 extern SellDialog *sellDialog; 00124 00125 #endif