2013-08-06 13:33:59 +04:00
|
|
|
#include "helloworld.h"
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
HelloWorld::HelloWorld()
|
2016-05-16 17:34:04 +03:00
|
|
|
: m_button("Hello World") // creates a new button with label "Hello World".
|
2013-08-06 13:33:59 +04:00
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
// Sets the border width of the window.
|
|
|
|
set_border_width(10);
|
2013-08-06 13:33:59 +04:00
|
|
|
|
2016-05-16 17:34:04 +03: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));
|
2013-08-06 13:33:59 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
// This packs the button into the Window (a container).
|
|
|
|
add(m_button);
|
2013-08-06 13:33:59 +04:00
|
|
|
|
2016-05-16 17:34:04 +03:00
|
|
|
// The final step is to display this newly created widget...
|
|
|
|
m_button.show();
|
2013-08-06 13:33:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
HelloWorld::~HelloWorld()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void HelloWorld::on_button_clicked()
|
|
|
|
{
|
2016-05-16 17:34:04 +03:00
|
|
|
std::cout << "Hello World" << std::endl;
|
2013-08-06 13:33:59 +04:00
|
|
|
}
|