aae07e7cf746464d940ca51e81734dfa4bea29a7
[maevies] / src / mywindow.cpp
1 /*******************************************************************************
2  * Copyright (c) 2007-2008 INdT.
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU Lesser General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7
8  *  This program is distributed in the hope that it will be useful,
9  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  *  GNU Lesser General Public License for more details.
12
13  *  You should have received a copy of the GNU Lesser General Public License
14  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  *
16  */
17
18 /*
19  ============================================================================
20  Name        : mywindow.cpp
21  Author      : Simón Pena
22  Version     : 0.1
23  Description : CPP Hello World
24  ============================================================================
25  */
26
27 #include <glibmm/i18n.h>
28 #include <gtkmm.h>
29 #include <hildonmm.h>
30
31 #include "mywindow.h"
32
33 /* Class constructor */
34 MyWindow::MyWindow() :
35         m_button_helloworld(_("Say Hello"))
36 {
37         /* Set the menu for the application */
38         Hildon::Program::get_instance()->set_common_app_menu(m_main);
39
40         /* Add items to the menu */
41         m_main.append(m_button_helloworld);
42         m_main.show_all();
43
44         /* Attach the callback function to signal handler */
45         m_button_helloworld.signal_activate().connect(
46                 sigc::mem_fun(*this, &MyWindow::on_menu_helloworld));
47
48         /* Make all menu widgets visible */
49         show_all();
50 }
51
52 /* Class destructor */
53 MyWindow::~MyWindow()
54 {
55 }
56
57 void MyWindow::on_menu_helloworld()
58 {
59         /* Create and show a "Hello World" dialog */
60         Hildon::Note helloworld_note(Hildon::NOTE_TYPE_INFORMATION, _("Hello World!!!"));
61         helloworld_note.run();
62 }