1 /**********************************************************************
2 *
3 * FreeDoko a Doppelkopf-Game
4 *
5 * Copyright (C) 2001 – 2018 by Diether Knof and Borg Enders
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 * You can find this license in the file 'gpl.txt'.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 *
23 * Contact:
24 * Diether Knof dknof@posteo.de
25 *
26 **********************************************************************/
27
28 #include "constants.h"
29
30 #ifdef USE_UI_GTKMM
31
32 #include "gameinfo.swines.h"
33
34 #include "ui.h"
35 #include "icons.h"
36
37 #include "../../player/player.h"
38 #include "../../game/game.h"
39 #include "../../party/rule.h"
40
41 #include <gtkmm/label.h>
42
43 namespace UI_GTKMM_NS {
44
45 /** constructor
46 **
47 ** @param parent the parent object
48 ** @param player the player with the swines
49 **/
Swines(Base * const parent,Player const & player)50 GameInfoDialog::Information::Swines::Swines(Base* const parent,
51 Player const& player) :
52 GameInfoDialog::Information(parent, _("Window::GameInfo::swines")),
53 player(&player)
54 {
55 this->ui->icons->change_managed_swines(this->icon,
56 this->player->game().cards().trumpcolor());
57
58 this->init();
59 } // GameInfoDialog::Information::Swines::Swines(Base parent, Game game)
60
61 /** destructor
62 **/
63 GameInfoDialog::Information::Swines::~Swines() = default;
64
65 /** update all texts
66 **/
67 void
update_texts()68 GameInfoDialog::Information::Swines::update_texts()
69 {
70 if (this->player->game().rule()(Rule::Type::swine_only_second))
71 this->label->set_label(_("%s has a swine.",
72 this->player->name()
73 ));
74 else
75 this->label->set_label(_("%s has swines.",
76 this->player->name()
77 ));
78 } // void GameInfoDialog::Information::Swines::update_texts()
79
80 } // namespace UI_GTKMM_NS
81
82 #endif // #ifdef USE_UI_GTKMM
83