cmake/Tests/FindGTK2/gtkmm/helloworld.cpp

31 lines
707 B
C++
Raw Normal View History

2014-08-03 19:52:23 +02:00
#include "helloworld.h"
2020-02-01 23:06:01 +01:00
2014-08-03 19:52:23 +02:00
#include <iostream>
HelloWorld::HelloWorld()
2016-07-09 11:21:54 +02:00
: m_button("Hello World") // creates a new button with label "Hello World".
2014-08-03 19:52:23 +02:00
{
2016-07-09 11:21:54 +02:00
// Sets the border width of the window.
set_border_width(10);
2014-08-03 19:52:23 +02:00
2016-07-09 11:21:54 +02:00
// When the button receives the "clicked" signal, it will call the
// on_button_clicked() method defined below.
m_button.signal_clicked().connect(
sigc::mem_fun(*this, &HelloWorld::on_button_clicked));
2014-08-03 19:52:23 +02:00
2016-07-09 11:21:54 +02:00
// This packs the button into the Window (a container).
add(m_button);
2014-08-03 19:52:23 +02:00
2016-07-09 11:21:54 +02:00
// The final step is to display this newly created widget...
m_button.show();
2014-08-03 19:52:23 +02:00
}
HelloWorld::~HelloWorld()
{
}
void HelloWorld::on_button_clicked()
{
2016-07-09 11:21:54 +02:00
std::cout << "Hello World" << std::endl;
2014-08-03 19:52:23 +02:00
}