请输入您要查询的百科知识:

 

词条 Gtkmm
释义

  1. Features

  2. Hello World in Gtkmm

  3. Applications

  4. See also

  5. References

  6. External links

{{Lowercase|title=gtkmm}}{{Infobox software
| name =
| title =
| logo =
| logo caption =
| logo_size =
| logo_alt =
| screenshot =
| caption =
| screenshot_size =
| screenshot_alt =
| collapsible =
| author =
| developer =
| released =
| discontinued =
| latest release version =
| latest release date =
| latest preview version =
| latest preview date =
| status =
| programming language = C++
| operating system =
| platform = GTK+
| size =
| genre = Language binding
| license = GNU Lesser General Public License
| website = {{URL|http://www.gtkmm.org}}
}}{{Main|List of language bindings for GTK+}}

gtkmm (formerly known as gtk-- or gtk minus minus[1]) is the official C++ interface for the popular GUI library GTK+. gtkmm is free software distributed under the GNU Lesser General Public License (LGPL).

gtkmm allows the creation of user interfaces either in code or with the Glade Interface Designer, using the Gtk::Builder class. Other features include typesafe callbacks, a comprehensive set of graphical control elements, and the extensibility of widgets via inheritance.

Features

Because gtkmm is the official C++ interface of the GUI library GTK+, C++ programmers can use the common OOP techniques such as inheritance, and C++-specific facilities such as STL (In fact, many of the gtkmm interfaces, especially those for widget containers, are designed to be similar to the Standard Template Library (STL)).

Main features of gtkmm are listed as follows:

  • Use inheritance to derive custom widgets.
  • Type-safe signal handlers, in standard C++.
  • Polymorphism.
  • Use of Standard C++ Library, including strings, containers, and iterators.
  • Full internationalisation with UTF-8.
  • Complete C++ memory management.
    • Object composition.
    • Automatic deallocation of dynamically allocated widgets.
  • Full use of C++ namespaces.
  • No macros.
  • Cross-platform: Linux (gcc, LLVM), FreeBSD (gcc, LLVM), NetBSD (gcc), Solaris (gcc, Forte), Win32 (gcc, MSVC++), macOS (gcc), others.

Hello World in Gtkmm

//HelloWorldWindow.h

  1. ifndef HELLOWORLDWINDOW_H
  2. define HELLOWORLDWINDOW_H
  1. include
  2. include

// 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:    Gtk::Button hello_world;

};

  1. endif

//HelloWorldWindow.cc

  1. include
  2. include "HelloWorldWindow.h"

HelloWorldWindow::HelloWorldWindow()

{
    // 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([] () {          std::cout << "Hello world" << std::endl;    });    // Display all the child widgets of the window.    show_all_children();

}

//main.cc

  1. include
  2. 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;

}

The above program will create a window with a button labeled "Hello World". The button sends "Hello world" to standard output when clicked.

The program is run using the following commands:

$ g++ -std=c++11 *.cc -o example `pkg-config gtkmm-3.0 --cflags --libs`

$ ./example

This is usually done using a simple makefile.

Applications

Some notable applications that use Gtkmm include:

  • Amsynth[2]
  • Cadabra (computer program)[3]
  • Inkscape Vector graphics drawing.
  • Workrave Assists in recovery and prevention of RSI.
  • [https://sourceforge.net/projects/gnomecc/ GNOME Color Chooser][4]
  • Gnome System Monitor[5]
  • Gigedit[6]
  • GParted disk partitioning tool.
  • Nemiver GUI for the GNU debugger gdb.
  • PulseAudio tools: pavucontrol,[7] paman,[8] paprefs[9] pavumeter,[10]
  • RawTherapee[11]
  • GNOME Referencer document organiser and bibliography manager
  • Seq24[12]
  • Synfig Studio[13]
  • Linthesia[14]
  • MySQL Workbench[15] Administrator Database GUI.
  • Ardour Open Source digital audio workstation (DAW) for Linux and MacOS.
  • Gnote desktop notetaking application.
  • VisualBoyAdvance[16]
  • VMware Workstation and VMware Player both use Gtkmm for their Linux ports.

See also

{{Portal|Free and open-source software}}
  • GTK+
  • wxWidgets
  • FLTK
  • FOX toolkit
  • Qt
  • VCF

References

1. ^[https://wiki.gnome.org/Projects/gtkmm/FAQ The gtkmm FAQ]
2. ^{{cite web | url=https://packages.debian.org/jessie/amsynth | title=Debian -- Details of package amsynth in jessie | accessdate=2017-03-06}}
3. ^{{cite web | url=https://packages.debian.org/jessie/cadabra | title=Debian -- Details of package cadabra in jessie | accessdate=2017-03-06}}
4. ^{{cite web | url=https://packages.debian.org/jessie/gnome-color-chooser | title=Debian -- Details of package gnome-color-chooser in jessie | accessdate=2017-03-06}}
5. ^{{cite web | url=https://packages.debian.org/jessie/gnome-system-monitor | title=Debian -- Details of package gnome-system-monitor in jessie | accessdate=2017-03-06}}
6. ^{{cite web | url=https://packages.debian.org/jessie/gigedit | title=Debian -- Details of package gigedit in jessie | accessdate=2017-03-06}}
7. ^{{cite web | url=https://packages.debian.org/jessie/pavucontrol | title=Debian -- Details of package pavucontrol in jessie | accessdate=2017-03-06}}
8. ^{{cite web | url=https://packages.debian.org/jessie/paman | title=Debian -- Details of package paman in jessie | accessdate=2017-03-06}}
9. ^{{cite web | url=https://packages.debian.org/jessie/paprefs | title=Debian -- Details of package paprefs in jessie | accessdate=2017-03-06}}
10. ^{{cite web | url=https://packages.debian.org/jessie/pavumeter | title=Debian -- Details of package pavumeter in jessie | accessdate=2017-03-06}}
11. ^{{cite web | url=https://packages.debian.org/jessie/rawtherapee | title=Debian -- Details of package rawtherapee in jessie | accessdate=2017-03-06}}
12. ^{{cite web | url=https://packages.debian.org/jessie/seq24 | title=Debian -- Details of package seq24 in jessie | accessdate=2017-03-06}}
13. ^{{cite web | url=https://packages.debian.org/jessie/synfigstudio | title=Debian -- Details of package synfigstudio in jessie | accessdate=2017-03-06}}
14. ^{{cite web | url=https://packages.debian.org/jessie/linthesia | title=Debian -- Details of package linthesia in jessie | accessdate=2017-03-06}}
15. ^{{cite web | url=https://packages.debian.org/jessie/mysql-workbench | title=Debian -- Details of package mysql-workbench in jessie | accessdate=2017-03-06}}
16. ^{{cite web | url=https://packages.debian.org/jessie/visualboyadvance-gtk | title=Debian -- Details of package visualboyadvance-gtk in jessie | accessdate=2017-03-06}}

External links

  • {{Official|www.gtkmm.org}}
  • {{sourceforge|gtk-mingw|gtkmm binaries for Windows}}
{{GTK}}

6 : Articles with example C++ code|C++ libraries|Free computer libraries|Free software programmed in C++|GTK language bindings|Software using the LGPL license

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/27 7:14:46