summaryrefslogtreecommitdiffstats
path: root/Tests/FindGTK2/gtkmm
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/FindGTK2/gtkmm')
-rw-r--r--Tests/FindGTK2/gtkmm/CMakeLists.txt19
-rw-r--r--Tests/FindGTK2/gtkmm/helloworld.cpp30
-rw-r--r--Tests/FindGTK2/gtkmm/helloworld.h20
-rw-r--r--Tests/FindGTK2/gtkmm/main.cpp14
4 files changed, 83 insertions, 0 deletions
diff --git a/Tests/FindGTK2/gtkmm/CMakeLists.txt b/Tests/FindGTK2/gtkmm/CMakeLists.txt
new file mode 100644
index 0000000..eb0b7aa
--- /dev/null
+++ b/Tests/FindGTK2/gtkmm/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(gtkmm CXX)
+
+find_package(GTK2 COMPONENTS gtk gtkmm REQUIRED)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+add_executable(gtkmm-target WIN32 main.cpp helloworld.cpp helloworld.h)
+target_link_libraries(gtkmm-target GTK2::gtkmm)
+
+add_executable(gtkmm-all-libs WIN32 main.cpp helloworld.cpp helloworld.h)
+target_link_libraries(gtkmm-all-libs ${GTK2_LIBRARIES})
+target_include_directories(gtkmm-all-libs PRIVATE ${GTK2_INCLUDE_DIRS})
+
+# Linking via the library variables does not cause compile feature
+# requirements to propagate. Do it manually for purposes of this test.
+get_property(features TARGET GTK2::sigc++ PROPERTY INTERFACE_COMPILE_FEATURES)
+set_property(TARGET gtkmm-all-libs PROPERTY COMPILE_FEATURES ${features})
diff --git a/Tests/FindGTK2/gtkmm/helloworld.cpp b/Tests/FindGTK2/gtkmm/helloworld.cpp
new file mode 100644
index 0000000..45c9422
--- /dev/null
+++ b/Tests/FindGTK2/gtkmm/helloworld.cpp
@@ -0,0 +1,30 @@
+#include "helloworld.h"
+
+#include <iostream>
+
+HelloWorld::HelloWorld()
+ : m_button("Hello World") // creates a new button with label "Hello World".
+{
+ // Sets the border width of the window.
+ set_border_width(10);
+
+ // 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));
+
+ // This packs the button into the Window (a container).
+ add(m_button);
+
+ // The final step is to display this newly created widget...
+ m_button.show();
+}
+
+HelloWorld::~HelloWorld()
+{
+}
+
+void HelloWorld::on_button_clicked()
+{
+ std::cout << "Hello World" << std::endl;
+}
diff --git a/Tests/FindGTK2/gtkmm/helloworld.h b/Tests/FindGTK2/gtkmm/helloworld.h
new file mode 100644
index 0000000..ae9af17
--- /dev/null
+++ b/Tests/FindGTK2/gtkmm/helloworld.h
@@ -0,0 +1,20 @@
+#ifndef GTKMM_EXAMPLE_HELLOWORLD_H
+#define GTKMM_EXAMPLE_HELLOWORLD_H
+
+#include <gtkmm.h>
+
+class HelloWorld : public Gtk::Window
+{
+public:
+ HelloWorld();
+ virtual ~HelloWorld();
+
+protected:
+ // Signal handlers:
+ void on_button_clicked();
+
+ // Member widgets:
+ Gtk::Button m_button;
+};
+
+#endif // GTKMM_EXAMPLE_HELLOWORLD_H
diff --git a/Tests/FindGTK2/gtkmm/main.cpp b/Tests/FindGTK2/gtkmm/main.cpp
new file mode 100644
index 0000000..29e23fd
--- /dev/null
+++ b/Tests/FindGTK2/gtkmm/main.cpp
@@ -0,0 +1,14 @@
+#include <gtkmm.h>
+
+#include "helloworld.h"
+
+int main(int argc, char* argv[])
+{
+ Gtk::Main kit(argc, argv);
+
+ HelloWorld helloworld;
+ // Shows the window and returns when it is closed.
+ Gtk::Main::run(helloworld);
+
+ return 0;
+}