File tree Expand file tree Collapse file tree 5 files changed +54
-0
lines changed Expand file tree Collapse file tree 5 files changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ hello
Original file line number Diff line number Diff line change 1+ g++ main.cpp hello.cpp -o hello ` pkg-config --cflags --libs gtkmm-4.0 ` -std=c++20
Original file line number Diff line number Diff line change 1+ #include " hello.hpp"
2+
3+ #include < iostream>
4+
5+ Hello::Hello () : button_(" Hello World" ) {
6+ button_.set_margin (10 );
7+
8+ button_.signal_clicked ().connect (sigc::mem_fun (*this ,
9+ &Hello::on_button_clicked));
10+
11+ // This packs the button into the Window (a container).
12+ set_child (button_);
13+ }
14+
15+ Hello::~Hello () {
16+ }
17+
18+ void Hello::on_button_clicked ()
19+ {
20+ std::cout << " Hello World" << std::endl;
21+ }
22+
Original file line number Diff line number Diff line change 1+ #ifndef HELLO_HPP
2+ #define HELLO_HPP
3+
4+ #include < gtkmm/button.h>
5+ #include < gtkmm/window.h>
6+
7+ class Hello : public Gtk ::Window {
8+ public:
9+ Hello ();
10+ ~Hello () override ;
11+
12+ protected:
13+ // Signal handlers:
14+ void on_button_clicked ();
15+
16+ // Member widgets:
17+ Gtk::Button button_;
18+ };
19+
20+ #endif // HELLO_HPP
Original file line number Diff line number Diff line change 1+ #include " hello.hpp"
2+
3+ #include < gtkmm/application.h>
4+
5+ int main (int argc, char * argv[]) {
6+ auto app = Gtk::Application::create (" org.gtkmm.example" );
7+
8+ // Shows the window and returns when it is closed.
9+ return app->make_window_and_run <Hello>(argc, argv);
10+ }
You can’t perform that action at this time.
0 commit comments