gtkmm

gtkmm
Logo
Aktuální verze4.12.0 (8. srpna 2023)
Operační systémUN*X
Microsoft Windows
macOS
PlatformaGTK+
Vyvíjeno vC++
Typ softwaruGTK software binding, knihovna, svobodný software a Widget toolkit
LicenceGNU Lesser General Public License
Webhttp://gtkmm.org/
Některá data mohou pocházet z datové položky.

gtkmm (někdy také gtk--) je GTK+ pro C++. Je to svobodný software pod licencí GNU Lesser General Public License.

Hello World

//HelloWorldWindow.h
#ifndef HELLOWORLDWINDOW_H
#define HELLOWORLDWINDOW_H

#include <gtkmm/window.h>
#include <gtkmm/button.h>

// Derive a new window widget from an existing one.
// This window will only contain a button labelled "Hello World"
class HelloWorldWindow : public Gtk::Window
{
  public:
    HelloWorldWindow();

  protected:
    void on_button_clicked(); //event handler

    Gtk::Button hello_world;
};

#endif
//HelloWorldWindow.cc
#include <iostream>
#include "HelloWorldWindow.h"

HelloWorldWindow::HelloWorldWindow()
 : hello_world("Hello World")
{
    // Set the title of the window.
    set_title("Hello World");

    // Add the member button to the window,
    add(hello_world);

    // Handle the 'click' event.
    hello_world.signal_clicked().connect(
        sigc::mem_fun(*this, &HelloWorldWindow::on_button_clicked));

    // Display all the child widgets of the window.
    show_all_children();
}

void HelloWorldWindow::on_button_clicked()
{
    std::cout << "Hello world" << std::endl;
}
//main.cc

#include <gtkmm/main.h>
#include "HelloWorldWindow.h"

int main(int argc, char *argv[])
{
    // Initialization
    Gtk::Main kit(argc, argv);

    // Create a hello world window object
    HelloWorldWindow example;

    // gtkmm main loop
    Gtk::Main::run(example);
    return 0;
}

Aplikace, které gtkmm používají

Externí odkazy

Média použitá na této stránce

GTK.svg
Autor: Jose Hevia, vectorised by DTR na projektu Wikipedie v jazyce angličtina, Licence: CC BY-SA 3.0
Gtkmm example.png
Autor:
This file was made by User:Sven
Translation

If this image contains text, it can be translated easily into your language. If you need help, contact me

Flexible licenses

If you want to use this picture with another license than stated below, contact me

Contact the author

If you need a really fast answer, mail me. If you need only a fast answer, write me here.

, Licence: GPL
This is a screenshot from a short gtkmm example program written for the german wikipedia article de:Gtkmm.