diff options
author | Daniele E. Domenichelli <daniele.domenichelli@iit.it> | 2013-08-06 09:33:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-10-08 14:47:06 (GMT) |
commit | 7efef02df29399d37b692e01fb69de63e558585b (patch) | |
tree | 5faedaafc63060018e252aa8c5f876a3ad9fca7b /Tests/FindGTK2/gtkmm | |
parent | 95fc47aa49515d45afcfb609262bd85025fb4a3d (diff) | |
download | CMake-7efef02df29399d37b692e01fb69de63e558585b.zip CMake-7efef02df29399d37b692e01fb69de63e558585b.tar.gz CMake-7efef02df29399d37b692e01fb69de63e558585b.tar.bz2 |
FindGTK2: Add tests for components and targets in gtk and gtkmm modules
Diffstat (limited to 'Tests/FindGTK2/gtkmm')
-rw-r--r-- | Tests/FindGTK2/gtkmm/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/FindGTK2/gtkmm/helloworld.cpp | 29 | ||||
-rw-r--r-- | Tests/FindGTK2/gtkmm/helloworld.h | 20 | ||||
-rw-r--r-- | Tests/FindGTK2/gtkmm/main.cpp | 13 |
4 files changed, 76 insertions, 0 deletions
diff --git a/Tests/FindGTK2/gtkmm/CMakeLists.txt b/Tests/FindGTK2/gtkmm/CMakeLists.txt new file mode 100644 index 0000000..32aafe2 --- /dev/null +++ b/Tests/FindGTK2/gtkmm/CMakeLists.txt @@ -0,0 +1,14 @@ +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}) diff --git a/Tests/FindGTK2/gtkmm/helloworld.cpp b/Tests/FindGTK2/gtkmm/helloworld.cpp new file mode 100644 index 0000000..535f44a --- /dev/null +++ b/Tests/FindGTK2/gtkmm/helloworld.cpp @@ -0,0 +1,29 @@ +#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..ab9a076 --- /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..5ff64d1 --- /dev/null +++ b/Tests/FindGTK2/gtkmm/main.cpp @@ -0,0 +1,13 @@ +#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; +} |