~nha/widelands/yai

« back to all changes in this revision

Viewing changes to src/wui/attack_box.cc

  • Committer: Nicolai Hähnle
  • Date: 2011-11-29 22:03:50 UTC
  • mfrom: (6105.1.31 trunk)
  • Revision ID: prefect_@gmx.net-20111129220350-b9u8weoduafkmtyv
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2002-2004, 2006-2010 by the Widelands Development Team
 
2
 * Copyright (C) 2002-2004, 2006-2011 by the Widelands Development Team
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or
5
5
 * modify it under the terms of the GNU General Public License
105
105
        return result;
106
106
}
107
107
 
108
 
UI::Callback_Button & AttackBox::add_button
 
108
UI::Button & AttackBox::add_button
109
109
        (UI::Box           & parent,
110
110
         char        const * const text,
111
111
         void         (AttackBox::*fn)(),
112
112
         std::string const & tooltip_text)
113
113
{
114
 
        UI::Callback_Button & button =
115
 
                *new UI::Callback_Button
 
114
        UI::Button * button =
 
115
                new UI::Button
116
116
                        (&parent, text,
117
117
                         8, 8, 26, 26,
118
118
                         g_gr->get_picture(PicMod_UI, "pics/but2.png"),
119
 
                         boost::bind(fn, boost::ref(*this)),
120
119
                         text,
121
120
                         tooltip_text);
122
 
        parent.add(&button, Box::AlignCenter);
123
 
        return button;
 
121
        button->sigclicked.connect(boost::bind(fn, boost::ref(*this)));
 
122
        parent.add(button, Box::AlignCenter);
 
123
        return *button;
124
124
}
125
125
 
126
126
void AttackBox::update_attack() {
198
198
                                 "pics/but2.png",
199
199
                                 _("Number of soldiers"));
200
200
 
201
 
                m_slider_soldiers->changed.set(this, &AttackBox::update_attack);
 
201
                m_slider_soldiers->changed.connect(boost::bind(&AttackBox::update_attack, this));
202
202
 
203
203
                sprintf(buf, "%u", max_attackers);
204
204
                m_add_soldiers =
237
237
                                 m_pl->get_retreat_percentage(),
238
238
                                 "pics/but2.png",
239
239
                                 _("Supported damage before retreat"));
240
 
                m_slider_retreat->changed.set(this, &AttackBox::update_attack);
 
240
                m_slider_retreat->changed.connect(boost::bind(&AttackBox::update_attack, this));
241
241
                add_text(linebox, _("Once injured"));
242
242
                m_slider_retreat->set_enabled(m_pl->is_retreat_change_allowed());
243
243
                linebox.set_visible(m_pl->is_retreat_change_allowed());