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 "support.h"
33 
34 #include "ui.h"
35 
36 #include <gtkmm/image.h>
37 #include <gtkmm/scrolledwindow.h>
38 #include <gtkmm/textview.h>
39 
40 namespace UI_GTKMM_NS {
41 
42 /** constructor
43  **
44  ** @param    parent   the parent object
45  **/
Support(Base * const parent)46 Support::Support(Base* const parent) :
47   Base(parent),
48   StickyDialog("FreeDoko – " + _("Window::support"), false)
49 {
50   this->ui->add_window(*this);
51   this->signal_realize().connect(sigc::mem_fun(*this, &Support::init));
52 } // Support::Support(Base* parent)
53 
54 /** destruktor
55  **/
56 Support::~Support() = default;
57 
58 /** create all subelements
59  **/
60 void
init()61 Support::init()
62 {
63   this->set_icon(this->ui->icon);
64 
65   this->set_skip_taskbar_hint();
66 
67   this->text = Gtk::manage(new Gtk::TextView());
68 
69   this->text->get_buffer()->set_text(_("Version: %s",
70                                        static_cast<string>(*::version))
71                                      + "\n\n"
72                                      + _("Support::support"));
73 
74   add_close_button(*this);
75 
76   this->set_default_size((this->ui->logo->get_width() * 3) / 2,
77                          (this->ui->logo->get_height() * 5) / 2);
78 #ifdef POSTPONED
79   this->get_window()->set_decorations(Gdk::DECOR_BORDER
80                                       | Gdk::DECOR_RESIZEH
81                                       | Gdk::DECOR_TITLE
82                                       | Gdk::DECOR_MENU);
83 #endif
84 
85   { // the image
86     auto image = Gtk::manage(new Gtk::Image(parent->ui->logo));
87     this->get_content_area()->pack_start(*image, Gtk::PACK_SHRINK);
88   } // the image
89   { // the text
90     auto text_window = Gtk::manage(new Gtk::ScrolledWindow());
91     text_window->add(*this->text);
92     text_window->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
93     this->text->set_editable(false);
94     this->text->set_wrap_mode(Gtk::WRAP_WORD);
95     this->text->set_cursor_visible(false);
96 
97     this->get_content_area()->pack_start(*text_window);
98   } // the text
99 
100   this->show_all_children();
101 } // void Support::init()
102 
103 } // namespace UI_GTKMM_NS
104 
105 #endif // #ifdef USE_UI_GTKMM
106