helloworld.cpp 706 B

1234567891011121314151617181920212223242526272829
  1. #include "helloworld.h"
  2. #include <iostream>
  3. HelloWorld::HelloWorld()
  4. : m_button("Hello World") // creates a new button with label "Hello World".
  5. {
  6. // Sets the border width of the window.
  7. set_border_width(10);
  8. // When the button receives the "clicked" signal, it will call the
  9. // on_button_clicked() method defined below.
  10. m_button.signal_clicked().connect(
  11. sigc::mem_fun(*this, &HelloWorld::on_button_clicked));
  12. // This packs the button into the Window (a container).
  13. add(m_button);
  14. // The final step is to display this newly created widget...
  15. m_button.show();
  16. }
  17. HelloWorld::~HelloWorld()
  18. {
  19. }
  20. void HelloWorld::on_button_clicked()
  21. {
  22. std::cout << "Hello World" << std::endl;
  23. }