00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "gui/magic.h"
00023
00024 #include "gui/widgets/button.h"
00025
00026 #include "localplayer.h"
00027
00028 #include "utils/dtor.h"
00029 #include "utils/gettext.h"
00030
00031 MagicDialog::MagicDialog():
00032 Window(_("Magic"))
00033 {
00034 setWindowName("Magic");
00035 setCloseButton(true);
00036 setSaveVisible(true);
00037 setDefaultSize(255, 30, 175, 225);
00038
00039 gcn::Button *spellButton1 = new Button(_("Cast Test Spell 1"), "spell_1", this);
00040 gcn::Button *spellButton2 = new Button(_("Cast Test Spell 2"), "spell_2", this);
00041 gcn::Button *spellButton3 = new Button(_("Cast Test Spell 3"), "spell_3", this);
00042
00043 spellButton1->setPosition(10, 30);
00044 spellButton2->setPosition(10, 60);
00045 spellButton3->setPosition(10, 90);
00046
00047 add(spellButton1);
00048 add(spellButton2);
00049 add(spellButton3);
00050
00051 update();
00052
00053 setLocationRelativeTo(getParent());
00054 loadWindowState();
00055 }
00056
00057 MagicDialog::~MagicDialog()
00058 {
00059 }
00060
00061 void MagicDialog::action(const gcn::ActionEvent &event)
00062 {
00063 if (event.getId() == "spell_1")
00064 {
00065 player_node->useSpecial(1);
00066 }
00067 if (event.getId() == "spell_2")
00068 {
00069 player_node->useSpecial(2);
00070 }
00071 if (event.getId() == "spell_3")
00072 {
00073 player_node->useSpecial(3);
00074 }
00075 else if (event.getId() == "close")
00076 {
00077 setVisible(false);
00078 }
00079 }
00080
00081 void MagicDialog::draw(gcn::Graphics *g)
00082 {
00083 update();
00084
00085 Window::draw(g);
00086 }
00087
00088 void MagicDialog::update()
00089 {
00090 }