00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #if !defined(AFX_BuyAccessoryDialog_H__4B5E93CF_1DE2_4979_A629_AEBD725ABE65__INCLUDED_)
00022 #define AFX_BuyAccessoryDialog_H__4B5E93CF_1DE2_4979_A629_AEBD725ABE65__INCLUDED_
00023
00024 #include <map>
00025 #include <set>
00026 #include <vector>
00027 #include <weapons/Weapon.h>
00028 #include <GLW/GLWFlag.h>
00029 #include <GLW/GLWWindow.h>
00030 #include <GLW/GLWButton.h>
00031 #include <GLW/GLWPanel.h>
00032 #include <GLW/GLWTab.h>
00033 #include <GLW/GLWCheckBoxText.h>
00034 #include <GLW/GLWDropDownText.h>
00035
00036 class Tank;
00037 class BuyAccessoryDialog : public GLWWindow,
00038 public GLWButtonI,
00039 public GLWCheckBoxI,
00040 public GLWDropDownI,
00041 public GLWTabI
00042 {
00043 public:
00044 static BuyAccessoryDialog *instance();
00045
00046
00047 virtual void draw();
00048 virtual void buttonDown(unsigned int id);
00049 virtual void display();
00050
00051
00052 virtual void stateChange(bool state, unsigned int id);
00053
00054
00055 virtual void select(unsigned int id, const int pos, GLWSelectorEntry value);
00056
00057
00058 virtual void tabDown(unsigned int id);
00059
00060 void playerRefreshKeepPos();
00061
00062 protected:
00063 static BuyAccessoryDialog *instance_;
00064 unsigned int okId_, giftId_;
00065 bool firstDrawTime_;
00066 std::map<std::string, GLWTab *> buyTabs_;
00067 GLWTab *sellTab_;
00068 GLWTab *favouritesTab_;
00069 GLWPanel *topPanel_;
00070 GLWDropDownText *sortDropDown_;
00071 GLWCheckBoxText *defaultTab_;
00072 GLWFlag *flag_;
00073 std::map<unsigned int, Accessory *> sellMap_;
00074 std::map<unsigned int, Accessory *> buyMap_;
00075 std::map<unsigned int, Accessory *> favMap_;
00076 std::set<std::string> favorites_;
00077
00078 void addTabs();
00079 void loadFavorites();
00080 void saveFavorites();
00081 void playerRefresh();
00082 void addPlayerName();
00083 void addPlayerWeapons();
00084 void addPlayerWeaponsSell();
00085 void addPlayerFavorites();
00086 void addPlayerWeaponsBuy(GLWTab *tab, const char *group);
00087 bool addAccessory(Tank *tank, GLWTab *tab, float height, Accessory *current);
00088
00089 private:
00090 BuyAccessoryDialog();
00091 virtual ~BuyAccessoryDialog();
00092 };
00093
00094 #endif // !defined(AFX_BuyAccessoryDialog_H__4B5E93CF_1DE2_4979_A629_AEBD725ABE65__INCLUDED_)