Движок ms windows для gtk что это

2. ���������2.1 ����������/��������� GTK#2.2 ������ ��������� GTK#2.3 GTK# ��� Glade#

��������: tuxedo-live.blogspot.com

���������� ������ ������ ����� �� mono-project.com (http://www.mono-project.com/GtkSharpBeginnersGuide)

������� �� �������: va1e

����������


1. �����������
1.1 ��� ����� GTK#?

2. ���������
2.1 ����������/��������� GTK#
2.2 ������ ��������� GTK#
2.3 GTK# ��� Glade#

3. ������ GTK# ����������
3.1 ��� 1. ��������� �������
3.2 ��� 2. �������� ����� � ������
3.3 ��� 3. ������������
3.4 ��� 4. ���������� ������������ ���������� GUI
3.5 ��� 5. ������������ ����
3.6 ��� 6. ���������� �������

4. ������ Glade# ����������
4.1 ��� 1. ��� ����� Glade#
4.1.1 ��� ����� ����� glade?
4.1.2 �� ��� ������ ����� .glade?
4.2 ��� 2. ���������� Glade ������ � ����� �����������
4.2.1 ��� ��������������?
4.3 ��� 3. ��� ������������ Glade# � ���� ����

4.4 ��� ���������� � �������� ������������ � gui.glade
4.5 ��� �������� �������
4.5.1 ������ � ������ ����������� ��� ��������

1. �����������

��� ������ �������� ������������ ��� ���������� GTK# �������������. ��� ������� ���, ��� ������� �� ����� �� �������������� ����������� ���������������� ��������� (����� GUI) ��� ������ GTK#. ������������ ����� �������� � GTK+ API �� ����� ��������� �� ������ ������ (C, C++, Perl, Python) ��� �� ������ ���� ������ ��������, �.�. �� ��������� ������ �������� �������� ���������� �� C# � ����� Mono. ��� ������ ��� �� ������������ �� ������� ������������� Glade � libglade ��� �������� ����������� �������� ������������ ����������������� ����������.

1.1 ��� ����� GTK#?

����� ������, gtk# — ��� ������� ��� gtk+, ������������������ GUI �����������.

gtk+ — ��� ������������������� ������ ��� �������� GUI. ������������ ������ ����� ��������, gtk+ �������� � ��������� ��������: �� ����������� ������� �� ������ ���������� ������ �����������.

(from the gtk+ website (http://www.gtk.org/))

������� gtk+ �������� � ����� X ��������, Direct Framebuffer’�� � ������������ � Microsoft Windows NT. ���������� gtk+ �������� �� Linux, ��� ��� �������� ������� ��� ���������� �������� ������� ����� GNOME. gtk+ ������� ����������� �� ��� ������������ Linux, � ��������� �������� ��� ����������� Windows NT. (� 2000 �������� �����������, ���� ��� ������ �� ��������)

������������ gtk+ �� Mac OS X ��������������, �� ���������� ������������������ ������ �����. ��� ��� � �������.

���� �� �������� ���������������� ���������� ������� � ���, ��� GTK# ������� Mono ��� ������. ��� �������. GTK# ����� ����������� �� ����� .NET-����������� �����. GTK# ��������� ����������� � MS .NET � Mono �����������, �� ����� ����� ���� �������� � ����� ��������� ���������� �����. ��� ��������, ��� ���� �� ������ ���������� �� GTK# � ������ ��������� ��� � Windows, �� ������ ���������� ������ ������ � GTK# � �������������� ����� MS, ��� ���������� ��� � ����� Mono ��� Windows.

2. ���������

2.1 ����������/���������

������ ����, ������� ���������� ������� — ��� ������� GTK# � ���������� ���.

Linux, MacOSX, FreeBSD � ������: ��������� ������� ��������� ������� gtk-sharp, mono � ����� ������������.

aptitude install mono gtk-sharp2

��� Debian-based �������������.
� SuSE Linux �������� ������ ������ � YaST. ���� �� ��� � ������������, ����� ����� �����(http://www.mono-project.com/Downloads) � ����������. ���� �� mono-project.com ��� ������� ��� ����� ���������, ����� ��� �������� �������������� �� ���������� ;)

Windows: �������������� Windows.Forms, �� ���� ����� � GTK =) [���������� ������]

2.2 ������ ��������� GTK#

���������� GTK#
GTK# ������� �� ��������� ������, ������ ������������� �������� ����������:

gtk-sharp (http://www.mono-project.com/monodoc/N:Gtk)
����� ������� gtk+ 2.x ��� �������� GUI

glib-sharp (http://www.mono-project.com/monodoc/N:Glib)
����� ������� glib 2.x, ������� ������������ �������������� ���������� ���� ��� gtk+ (��-GUI)

pango-sharp (http://www.mono-project.com/monodoc/N:Pango)
����� Pango, ��������������� ���������� ���������� � ���������� ������������� �������

atk-sharp (http://www.mono-project.com/monodoc/N:Atk)
����� � atk ����������

gdk-sharp (http://www.mono-project.com/monodoc/N:Gdk)
�������������� �������������� ��� «���������», ������������ gtk+

glade-sharp (http://www.mono-project.com/monodoc/N:Glade)
Glade# ��������� ��� ��������� ���������� Glade � ���������. ��� �������� ������� ���� �������� GTK# GUI.

art-sharp (http://www.mono-project.com/monodoc/N:Art)
���������� ��� ������ � ��������� �������� � ���������

rsvg-sharp (http://www.mono-project.com/monodoc/N:Rsvg)���������� ��������� SVG

gtk-dotnet (http://www.mono-project.com/monodoc/N:Gtk.DotNet)
���������� ������������ ���� Gtk# � System.Drawing

gnome-sharp (http://www.mono-project.com/monodoc/N:Gnome)
����� GNOME

gnomevfs-sharp (http://www.mono-project.com/monodoc/N:GnomeVfs)
����� ������, �� MIME �����, ����������� � ������ ��������� ���������� GNOME’� � �������� �������

vte-sharp (http://www.mono-project.com/monodoc/N:Vte)
����� � ������������� ��������� VTE

gconf-sharp (http://www.mono-project.com/monodoc/N:GConf)
����� � ������� �������� ������������ � GNOME

gtkhtml-sharp (http://www.mono-project.com/monodoc/T:Gtk.HTML)
����� � ������������ HTML �������

������ ���������� �� �������� � �������� ����������� GTK#, �� ����������� ����������, ������ ��� ����� ��������� � GTK#: Gecko#, Gtksourceview#, Gsf#, Guile#, Gst# � dbus#.

2.3 GTK# ��� Glade#

����� ���� �������� �������� Mono, ��� ����� ������ �� ��������� — ����� ���������� ������������: gtk# ��� glade#. ��� ����� ��� ����� ������ ��� ����� glade# � ��� ����� gtk#. gtk# — ��� ���� ��� ���������� ������� � ������ ������. Glade# ��������� GTK#, ����� ������� �������� ������������� GTK# � �������� �����������, �� glade# ������������� ��������� ������� � ��������� �� ��� XML ����. XML ���������� GUI ����� ���� ������������� ��� ������ Glade �������, ������ ������� WYSIWYG.

��� ����������� ���� Glade# — ������ �����. �� �������� ����� �� ���� ���������� ������������� ��������� ������������ ���� ��� GUI � ������ ������� ��������� ���������� � �������. �� ��������� �������� � ���, ��� ��� ����� �� ����������, Glade# �� ����� ��������� ��������� ����������� ���� (�������� ��������, ����������� ��������� ����� �����, ����������� �������). ������ ���� ����� ��� ������, ��� � ���������� ������ ����� ������������.

��� �������� ������������ � Glade# �� �������� �������� ��������� �� ���� ���������(http://nat.org/demos/gtksharp.html) ���� �������� (Nat Friedman)(http://nat.org), � ������� �� ������� ������� ����������� ���������� ����� �� ��������� �����.

3. ������ GTK# ����������

��� 1. ��������� �������

�� ������ ����������� ���� ���������. �������� Dr. Pepper � �������� ������� ������. ������, ������ �� ������.

��� 2. �������� ����� � ������

��� ������ ��� ����� ������� ����� ���������� ��� ���������� �������. (������������ Windows: ������� �� ����� ������������ ������� � �������� ����������, ����� �������� � ���������� �������� ����).

�������� shell (���� �� � Windows, �������� ���� ����� :) ����� ��������� -> Mono 1.x.x -> Mono Command Prompt. ��� ������������� ��������� ������ ���� � mono �����������.) ��������� � ������ ��� ��������� ����������. �� ����� ����� ������������ �������, ������� �������� �� ����������.

�������� � ����. �������� ���� ������� �������� (MonoDevelop, vi, emacs, notepad � �.�.) � �������� ����� ������ ������ (���� ��� ��������) ��� �������� ����� ������ ����. ��������� ���� ��� ������ «helloworld.cs».

��� 3. ������������ ����

� �������, ��� �� ��� ������� � C#, � ��� ���������� ���� �� ������� ������� ������� � ���������. �� ������ ������� ����� �����, ������������ Gtk# � ������� ����� ����� � ���� ���������. ��� ����� ��������� ���:

using System;
using Gtk;

public class GtkHelloWorld {

public static void Main() {
Console.WriteLine("HelloWorld");
}

}

��� ������ ��������� ������ ������� ��� ���. ������ ������ �� ����� ��������������� ������������. �������� �������� ���, �������� � ������� � �������� ������:

mcs -pkg:gtk-sharp-2.0 helloword.cs

��� ��� ��� ����������� csc ������������ � Windows �������� «-pkg:» ����� ���������� ����������. ����� ��������� �� ���� � csc, ������ ��� Mono ������ �� ���� Linux. ���� �������� ��������� ������� �� ������������� ����������� ������ gtk-sharp-2.0. �.�. ������� ���� ���� «gtk-sharp-2.0.pc», ������� �������� ������ � �������������� ���������� ��� ����� ������ (����� ������ ����������). �.�. �� �� ������ ������� «-r:gtk-sharp-2.0.dll -r:atk-sharp-2.0.dll -r:pango-sharp-2.0.dll ….» ������.

��� 4. ���������� ������������ ���������� GUI

������ ������� �������� ������� � ������ ����. ������ �������� «Console.WriteLine». ������, ��� �� ������� — �������� ����� ����. ��������� ��� ����������� ������ ��������� new Window � ����� ���������� (��� ������ ���� ����� main). ��� ���:

using System;
using Gtk;

public class GtkHelloWorld {

public static void Main() {
Application.Init();

//Create the Window

Window myWin = new Window("My first GTK# Application! ");
myWin.Resize(200,200);

//Create a label and put some text in it.

Label myLabel = new Label();
myLabel.Text = "Hello World!!!!";

//Add the label to the form
myWin.Add(myLabel);

//Show Everything

myWin.ShowAll();

Application.Run();
}
}

������ ������������ �������� ��� ��� �� ��� �� ������ ��� ������, � �������� ���������

mono HelloWorld.exe

� ����� �� �������� ���-�� ����� �����:

�� ��� �� � ������, ��?

������ ����, ������� �� ����� ��������, ��� ��, ��� � ������� �� ������������� System.Windows.Forms �� �� ������ ��� ��� ������ ���������� ������ � ����. ��������, �� �� ������ ‘myLabel.Left = 100’ ��� ‘myLabel.Width = 200’ ��� ���-�� �������� ��� ���������� ��������� ����� �� �����, �� ������ ����� ‘myWin.Add(…)’. � ��� ��� ������, ��� ‘Gtk.Window’ — ��� ������, ������� ����������� �� Bin, ��� ���������� ������� ������� �������� � ���������� Container.

������ ����� ����, ������� ����� ��� ��������������, ��� ������������� ��������� «Application.Init()» � «Application.Run()». ���� �� �����-���� ����� ������������ System.Windows.Forms ��� ���������� ������������� «Application.Run()» �� ������ �������. ������, ����� ���������� ����������� ��������� ������ ���� � �������� ������, ���������� ���������������. ������� «ShowAll()» �� ��������� ��� � ���������� ���������� ���������� ���� (������ �� ���������). ������� «Application.Init()» ������� �������� ���������� «�������» ������� ����������� �� Gtk.Windows � � ������ ����� ����������� «Application.Run()» ���������� ���� ���������� ��������� ����� ���������. ��� ��������� ���������� ���������� ���������� �� ��� ��� ���� �� ����� ������� ��� ����. ��� ������� ���������� �������� ���������� �� ������� Application.

��� 5. ������������ ����

�������� �� �������� �������� ���� «��� � ����� �������� ����� ������ �� ����, ���� ��� ����� ��������� ������ ���� ������?» �� ����� �� ��������, ��� Window ������������� ����� ��������� � ���� ������ ���� ������, �� ������ ��� �� ���� ����� ��������� � ���� ��������� ������ ��������. ��������� �� ���� �������� ����������� �� ���������� Gtk.Box, � � ��������� ������� �������� �� ����������. ������������ ������ Bin ����������� �������� �� �������-����������, ��� � ������ ������ �������, �� Bin ����� ��������� � ���� ������ ���� ������� ����������.

��� ���� ����� ��������� ������� ���������� �������� � ����� ����, �� ������ �������� �� ���� ���� �� ��������, ������� ����� ��������� � ���� ������ �������. ���������� ��������� ��������, ������� ����� ������ ���, �� �� �������� ������ ��������� �������: HBox(http://www.go-mono.com/docs/index.aspx?link=T%3aGtk.HBox), VBox(http://www.go-mono.com/docs/index.aspx?link=T%3aGtk.VBox) � �������� Table(http://www.go-mono.com/docs/index.aspx?link=T%3aGtk.Table).

��� 6. ���������� �������

��� ������ ����������� �� ‘Widget (http://www.go-mono.com/docs/index.aspx?link=T%3aGtk.Box)’ ������������� ��������� �������:

  • ButtonPressEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.ButtonPressEvent)
  • ButtonReleaseEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.ButtonReleaseEvent)
  • ScrollEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.ScrollEvent)
  • MotionNotifyEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.MotionNotifyEvent)
  • DeleteEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.DeleteEvent)
  • DestroyEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.DestroyEvent)
  • ExposeEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.ExposeEvent)
  • KeyPressEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.KeyPressEvent)
  • KeyReleaseEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.KeyReleaseEvent)
  • EnterNotifyEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.EnterNotifyEvent)
  • LeaveNotifyEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.LeaveNotifyEvent)
  • ConfigureEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.ConfigureEvent)
  • FocusInEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.FocusInEvent)
  • FocusOutEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.FocusOutEvent)
  • MapEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.MapEvent)
  • UnmapEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.UnmapEvent)
  • PropertyNotifyEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.PropertyNotifyEvent)
  • SelectionClearEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.SelectionClearEvent)
  • SelectionRequestEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.SelectionRequestEvent)
  • SelectionNotifyEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.SelectionNotifyEvent)
  • ProximityInEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.ProximityInEvent)
  • ProximityOutEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.ProximityOutEvent)
  • VisibilityNotifyEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.VisibilityNotifyEvent)
  • ClientEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.ClientEvent)
  • NoExposeEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.NoExposeEvent)
  • WindowStateEvent (http://www.go-mono.com/docs/monodoc.ashx?link=F%3aGtk.Widget.WindowStateEvent)

������ �� ���� ������� ����� ���� ���������� ����������� ������������ �������. ��������:

public static void HandlerMethod(object obj, EventArgs args)

������ ��������� ������� ������� �� ������:

public static void ButtonPressHandler(object obj, ButtonPressEventArgs args)

ButtonPressEventArgs — ��� ����� ����������� �� EventArgs. ����� ButtonPressEventArgs, ��� � ������ ������ � gtk#, ��������� �������� Gtk.Event (��� ������ �� Gtk.Event) � EventArgs.

���� Gdk.Event:

  • EventType.Nothing
  • EventType.Delete
  • EventType.Destroy
  • EventType.Expose
  • EventType.MotionNotify
  • EventType.ButtonPress
  • EventType.TwoButtonPress
  • EventType.ThreeButtonPress
  • EventType.ButtonRelease
  • EventType.KeyPress
  • EventType.KeyRelease
  • EventType.EnterNotify
  • EventType.LeaveNotify
  • EventType.FocusChange
  • EventType.Configure
  • EventType.Map
  • EventType.Unmap
  • EventType.PropertyNotify
  • EventType.SelectionClear
  • EventType.SelectionRequest
  • EventType.SelectionNotify
  • EventType.ProximityIn
  • EventType.ProximityOut
  • EventType.DragEnter
  • EventType.DragLeave
  • EventType.DragMotion
  • EventType.DragStatus
  • EventType.DropStart
  • EventType.DropFinished
  • EventType.ClientEvent
  • EventType.VisibilityNotify
  • EventType.NoExpose
  • EventType.Scroll
  • EventType.WindowState
  • EventType.Setting

��������, ��� ������������� ������� Gdk.Event �� ����� ������������ ����� ���:

using Gdk;
...
widget.ButtonPressEvent += new ButtonPressEventHandler(ButtonPressHandler);
...
private void ButtonPressHandler(object obj, ButtonPressEventArgs args) {

// single click
if (args.Event.Type == EventType.ButtonPress) {

...
}
// double click
if (args.Event.Type == EventType.TwoButtonPress) {

...
}

// the left button was used
if (args.Event.Button == 1) {

...
}
}

� ������� ���� �� ������ ������� ��� ���������� ���� �� ��������� ������� ������ ��� ��� ��� ������� ����.

4. ������ Glade# ����������

��� 1. ��� ����� Glade#

Glade# — ��� ����� ������ � libglade �� ����� C#. ��������� ����� ��������� GUI ���������� ��������� ���������� �������� � ��������� �� � �������, ������� ���������� ������ ������������ �� ����� ����������, ����� ������� ���������. �� ������ ������ ���������� ��� ����� ��� ������������� glade ������: Glade(http://glade.gnome.org/) � ������� Stetic(http://mysterion.org/~danw/blog/2005/03/stetic).

4.1.1 ��� ����� glade �����?

�����, ���������� � XML �������, ������� ������������ ����� GUI � GTK+, �������� ���� ��� ��������� � ��������.

4.1.2 �� ��� ������ ����� .glade?

����: gui.glade

<!--*- mode: xml -*-->

<glade-interface>

<widget class="GtkWindow" id="window1">

<property name="visible">True</property>
<property name="title" translatable="yes">Glade Window</property>

<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER</property>

<property name="modal">False</property>
<property name="default_width">256</property>

<property name="default_height">256</property>
<property name="resizable">True</property>

<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>

<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>

<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>

<property name="focus_on_map">True</property>

<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">

<property name="visible">True</property>
<property name="can_focus">True</property>

<property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>

<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>

<child>
<widget class="GtkLayout" id="layout1">
<property name="visible">True</property>

<property name="width">400</property>
<property name="height">400</property>

<property name="hadjustment">0 0 400 10 212.4 236</property>
<property name="vadjustment">0 0 400 10 212.4 236</property>

<child>
<widget class="GtkLabel" id="label1">
<property name="width_request">38</property>

<property name="height_request">17</property>
<property name="visible">True</property>

<property name="label" translatable="yes">label1</property>
<property name="use_underline">False</property>

<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>

<property name="wrap">False</property>
<property name="selectable">False</property>

<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>

<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>

<property name="single_line_mode">False</property>
<property name="angle">0</property>

</widget>
<packing>
<property name="x">96</property>
<property name="y">88</property>

</packing>
</child>

<child>
<widget class="GtkButton" id="button1">

<property name="width_request">60</property>
<property name="height_request">27</property>

<property name="visible">True</property>
<property name="can_focus">True</property>

<property name="label" translatable="yes">button1</property>
<property name="use_underline">True</property>

<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>

</widget>
<packing>
<property name="x">88</property>
<property name="y">168</property>

</packing>
</child>
</widget>
</child>
</widget>
</child>

</widget>

</glade-interface>

���� .glade �������� � ���� ��� ����������� ���������� ��� ����, ����� ���������� libglade ����� ���������� GUI.

��� 2. ���������� glade ������ � ����� ����������

��������������� ��� .glade ���� ��� ������, ��� ��� ������ Glade, ��� ��� ������ Stetic. ����� � Stetic ����� ���������� ����� (http://mysterion.org/~danw/blog/2005/03/steticzilla.html).

� ���������� ������ ������� �� ������������, ��� GUI ��� �������� � ���� gui.glade, ������� �������� �������� ���� window1, ������ button1 � ����� label1.

��� ����� ����� ������� ����� ��������� �� Gtk# � Glade#, � ����� ������� ����� ����� � ����� �����, � ������� ���������� ���� ���������.

// file: glade.cs
using System;
using Gtk;
using Glade;
public class GladeApp

{
public static void Main (string[] args)

{
new GladeApp (args);
}

public GladeApp (string[] args)
{

Application.Init();

Glade.XML gxml = new Glade.XML (null, "gui.glade", "window1", null);
gxml.Autoconnect (this);
Application.Run();
}

}

4.2.1 ��� ��������������?

������ �� ������ �������������� �������� ���� glade.cs �������� ������������ ���� ��� glade, ������� ��������� � ���������� glade-sharp. ������� ���������� ���������:

$ mcs -pkg:glade-sharp -resource:gui.glade glade.cs

��������� mcs -pkg:glade-sharp �� ������� ��������� glade.exe, � ����� -resource �������� ���� gui.glade � ����������� ���������.

��������� null ��� ������ �������� � ����������� Glade.XML, �� �������� ���������� libglade ��������� glade ���� �� ��������, ��� ������� ������������� ������������, ���� ����� ���� �������� �� �������� �������, ��� �������� ������� �����, ����� �� �� ������ ����������������� GUI ���������� ����� ������� ��������� .glade �����.

���� �� ��������� ��������� ��� GUI ����� ���������, ������, ������� �� ������ �� �� ��������� �������, ������ ��� �� �� ��������� ������� �������, ������������� � gui.glade �����. ������ ��������� ������ �� ��������� ��� ������.

��� 3. ��� ������������ Glade# � ���� ����

4.4 ��� ���������� � �������� ������������ � gui.glade

��� ������� � ��������, ������������ � gui.glade �����, �� ������ ����� ��� ������� � ��� ���, � ������ ����� ��������� ��� � C# ���. �������� ��� ��������� ������� (�������� �������� �� �������� [Widget]):

[Widget]
��� ���;

��������� ��� ����������� � ������ ������� ��� ������� ���� � ����:

using System;

using Gtk;
using Glade;
public class GladeApp
{
public static void Main (string[] args)

{
new GladeApp (args);
}

public GladeApp (string[] args)
{

Application.Init();

Glade.XML gxml = new Glade.XML (null, "gui.glade", "window1", null);
gxml.Autoconnect (this);
Application.Run();
}

[Widget]
Button button1;

[Widget]
Label label1;
}

4.5 ��� �������� �������

��� ���������� ������� ��� ���������� ��������� ������� ���� ����. �� ����� ������ ��������� ������� �� Glade.


using System;
using Gtk;
using Glade;
public class GladeApp

{
public static void Main (string[] args)

{
new GladeApp (args);
}

public GladeApp (string[] args)
{

Application.Init();

Glade.XML gxml = new Glade.XML (null, "gui.glade", "window1", null);
gxml.Autoconnect (this);

button1.Clicked += OnPressButtonEvent;

Application.Run();
}

[Glade.Widget]
Button button1;

[Glade.Widget]
Label label1;

public void OnPressButtonEvent( object o, EventArgs e)

{
Console.WriteLine("Button press");
label1.Text = "Mono";
}

}

������������ �� ������ ������� ��� ������������� ������� ��� ��������, ��������� � gui.glade �����.

4.5.1 ������ � ������ ����������� ��� ��������

  • Gtk# Screencast (http://nat.org/demos/gtksharp.html) — ��������� ���� ��������, ������� ���� ������������� ������������� Glade � C#/Mono
  • Gtk# website (http://gtk-sharp.sourceforge.net/) — ������������ ������� Gtk#
  • Glade website (http://glade.gnome.org/) — ������������ ������� Glade
  • Glade# and Gecko# (http://developer.novell.com/wiki/index.php/Glade-Sharp_and_Gecko-Sharp) — ������� ����������, ������������ ��� ������� ������� ���-������� ��������� Gtk#, Glade# � Gecko#
  • Steticzilla (http://mysterion.org/~danw/blog/2005/03/steticzilla.html) — ��������� danw (http://mysterion.org/~danw/blog/) ������������ ������� ����������� Mozilla-����������� �������� ��������� Stetic
  • Glade — ������� ���������� ���������� � Gnome2 (http://www.gotmono.com/docs/gnome/bindings/glade/glade.html) — ������ ����������� �� Glade#, �������� ������ ��� �������� .glade ����� � .exe

P.S. ������ �� ����� ������������ � Mono: �����, ��������� ������ — ������������� IronPython, Moma — Mono Migration Analysis Tool, Games, Second Life
TurboCharging Linux with Mono

На ХабраХабре наконец-то появился новый блог, посвящённый GTK. Присоединяйтесь! :-)

Привет, %username%!

В сети бытуют страшные слухи об этом фреймворке, однако серией статей о нём на ХабраХабре я попытаюсь разрушить сложившиеся стереотипы.

GTK+ — это фреймворк для создания кроссплатформенного графического интерфейса пользователя (GUI). Наряду с Qt он является одной из двух наиболее популярных на сегодняшний день библиотек для X Window System.

Изначально эта библиотека была частью графического редактора GIMP, но позже стала независимой и приобрела популярность. GTK+ — это свободное ПО, распространяемое на условиях GNU LGPL и позволяющее создавать как свободное, так и проприетарное программное обеспечение.

Как это работает

GTK+ написан на языке Си, однако несмотря на это, является объектно-ориентированным. Также можно использовать обёртки для следующих языков: Ada, C, C++, C#, D, Erlang, Fortran, GOB, Genie, Haskell, FreeBASIC, Free Pascal, Java, JavaScript, Lua, OCaml, Perl, PHP, PureBasic, Python, R, Ruby, Smalltalk, Tcl, Vala.

Внутри GTK+ состоит из двух компонентов: GTK, который содержит набор виджетов (кнопка, метка и т.д.) и GDK, который занят выводом результата на экран.

Внешний вид приложений может меняться программистом и/или пользователем. По-умолчанию приложения выглядят нативно, т.е. так же, как и другие приложение в этой системе. Кроме того, начиная с версии 3.0, можно менять внешний вид элементов с помощью CSS.

Делаем «Hello, World»

Для начала за основу возьмём вот такую заготовку:

#include <gtk/gtk.h> /* подключаем GTK+ */

/* эта функция будет выполнена первой */
int main( int argc, char *argv[])
{
        /* тут мы объявим переменные */

        /* запускаем GTK+ */
        gtk_init(&argc, &argv);

        /* тут будет код нашего приложения */

        /* передаём управление GTK+ */
        gtk_main();

        return 0;
}

Пожалуйста, не используйте одинарные комментарии (//), если как и я решили писать на Си.

Давайте для начала создадим окно нашего приложения. В GTK существует несколько типов окошек, но нам понадобится обычный GtkWindow. Вставьте в нашу заготовку следующий код:

        /* это вставьте вначале, хотя на самом деле порядок не так важен */
        GtkWidget *window;

        /* ... */

        /* создать новый виджет - окно */
        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        /* дать окну заголовок */
        gtk_window_set_title(GTK_WINDOW(window), "Введение в GTK");
        /* установить внутренние границы (читайте ниже) */
        gtk_container_set_border_width (GTK_CONTAINER(window), 50);

Прежде чем продолжить, несколько слов об упаковке.

В GTK+ виджеты принято размещать не по координатам, а упаковывать в специальные контейнеры. Окно, которое мы создали, также является контейнером, который может содержать только один виджет. Нам этого хватит, но в ином случае нам бы пришлось добавить специальный виджет-контейнер, который может представлять из себя сетку, а также горизонтальные или вертикальные поля. Но об этом я подробнее расскажу в следующем топике.

Пока остановимся на окне. Напомню, что окно — это контейнер, которому мы указали толщину границ в 50 пикселей. Что это значит?

Это значит, что мы создаём своего рода невидимую рамку вокруг этого контейнера и по этому ничего не сможем разместить в этой области.

Теперь рассмотрим сигналы.

Мы можем связать определённое событие, которое должно произойти с виджетом, со своей функцией.

        /* когда пользователь закроет окно, то выйти из приложения */
        g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);

В данном случае это стандартная фунция gtk_main_quit(), которая безопасно завершит наше приложение.

Теперь создадим кнопку, по нажатию на которую будет появляться окошко с надписью «И тебе привет, %username%!».

Кнопка (GtkButton) — это тоже контейнер, который также может содержать один виджет. Чтобы не усложнять код созданием метки и помещением её в кнопку, сделаем вот так:

        /* это вставьте вначале, хотя на самом деле порядок не так важен */
        GtkWidget *button;

        /* ... */

        /* создать кнопку с меткой */
        button = gtk_button_new_with_label("Привет, ХабраХабр!");
        /* упаковать нашу кнопку в окно */
        gtk_container_add(GTK_CONTAINER(window), button);

        /* когда пользователь кликнет по ней, то вызвать ф-цию welcome */
        g_signal_connect(GTK_BUTTON(button), "clicked", G_CALLBACK(welcome), NULL);

Выглядеть это будет так:

Теперь реализация функции welcome:

/* выводит приветствие */
void welcome (GtkButton *button, gpointer data)
{
        /* виджеты */
        GtkWidget *dialog;
        GtkWidget *label;
        GtkWidget *content_area;

        /* создать диалог */
        dialog = gtk_dialog_new_with_buttons("Ошибка LOL!!!111",
                                             NULL,
                                             GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                             GTK_STOCK_OK,
                                             GTK_RESPONSE_ACCEPT,
                                             NULL);

        /* получить контейнер, в который будем пихать метку */
        content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog));

        /* сама метка */
        label = gtk_label_new("nnИ тебе привет, %username!%");
        gtk_container_add(GTK_CONTAINER(content_area), label);
        gtk_widget_show(label);

        /* запускаем диалог */
        gtk_dialog_run(GTK_DIALOG(dialog));
        /* а потом прячем */
        gtk_widget_destroy(dialog);
}

Результат после нажатия:

Вот так просто и быстро мы создали рабочую программу. В следующих топиках я расскажу про использование Glade (программа, чтобы рисовать виджеты без кода) и создание собственных виджетов.

Компиляция

gcc file_name.c -o file_name `pkg-config --cflags --libs gtk+-3.0`

Не забудьте установить пакет GTK для разработчика (кончается на «-dev»).

Что-нибудь ещё?

Да, пожалуй, приведу несколько ссылок:

www.gtk.org — официальный сайт

www.gtkforums.com — англоязычный форум, посвящённый GTK

developer.gnome.org — информация для разработчиков под среду GNOME. Содержит много полезной информации о GTK, в том числе и на русском языке.

UPD: Полный код примера на PasteBin — pastebin.com/iPttWBne

From Wikipedia, the free encyclopedia

GTK

GTK logo.svg
Gtk4-widget-factory demos.png

GTK version 4 (gtk4-widget-factory, a collection of examples that demonstrate many of the GUI widgets)

Original author(s) Spencer Kimball, Peter Mattis
Developer(s) The GNOME Project, eXperimental Computing Facility (XCF)
Initial release April 14, 1998; 24 years ago
Stable release

4.8.3
/ December 22, 2022; 45 days ago

Preview release

4.9.2
/ December 26, 2022; 41 days ago

Repository
  • gitlab.gnome.org/GNOME/gtk Edit this at Wikidata
Written in C, CSS[1]
Operating system Linux, Unix-like, macOS, Windows
Type Widget toolkit
License LGPLv2.1+
Website gtk.org

GTK (formerly GTK+)[2] is a free and open-source cross-platform widget toolkit for creating graphical user interfaces (GUIs).[3] It is licensed under the terms of the GNU Lesser General Public License, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the Wayland and X11 windowing systems.[4]

The GTK team releases new versions on a regular basis.[5] GTK 4 and GTK 3 are maintained, while GTK 2 is end-of-life.[6]

Software architecture[edit]

The GTK library contains a set of graphical control elements (widgets); version 3.22.16 contains 186 active and 36 deprecated widgets.[7] GTK is an object-oriented widget toolkit written in the programming language C; it uses GObject, that is the GLib object system, for the object orientation. While GTK is mainly for windowing systems based on X11 and Wayland, it works on other platforms, including Microsoft Windows (interfaced with the Windows API), and macOS (interfaced with Quartz). There is also an HTML5 back-end named Broadway.[8][9]

GTK can be configured to change the look of the widgets drawn; this is done using different display engines. Several display engines exist which try to emulate the look of the native widgets on the platform in use.

Starting with version 2.8, released in 2005, GTK began the transition to using Cairo to render most of its graphical control elements widgets.[10] Since GTK version 3.0, all rendering is done using Cairo.[11]

On 26 January 2018 at DevConf.cz, Matthias Clasen gave an overview of the current state of GTK 4 development, including a high-level explanation of how rendering and input worked in GTK 3, what changes are being made in GTK 4 (>3.90), and why.[12] On 6 February 2019 it was announced that GTK 4 will drop the “+” from the project’s name.[2]

GTK Drawing Kit (GDK)[edit]

Main article: GDK

GDK acts as a wrapper around the low-level functions provided by the underlying windowing and graphics systems.

GDK is found in the /gdk directory.

GTK Scene Graph Kit (GSK)[edit]

GSK is the rendering and scene graph API for GTK. GSK lies between the graphical control elements (widgets) and the rendering. GSK was finally merged into GTK version 3.90 released March 2017.

GSK is found in the /gsk directory.

GtkInspector[edit]

GtkInspector was introduced with version 3.14.[13][14]
GtkInspector can only be invoked after installing the development package libgtk-3-dev/gtk+-devel[permanent dead link].

GUI designers[edit]

There are several GUI designers for GTK. The following projects are active as of July 2011:

  • Glade, supports GtkBuilder, which is a GTK built-in GUI description format.
  • Gazpacho, GUI builder for the GTK toolkit written in Python[15]
  • Crow Designer, relies on its own GuiXml format and GuiLoader library.[16]
  • Stetic, part of MonoDevelop, oriented toward Gtk#.
  • Gambas since version 2.0 atop BASIC
  • Xojo on Linux
  • Lazarus on Linux defaults to interfacing with GTK 2

GtkBuilder[edit]

GtkBuilder allows user interfaces to be designed without writing code. The interface is described in an Extensible Markup Language (XML) file, which is then loaded at runtime and the objects created automatically. The Glade Interface Designer allows creation of the user interface in a what you see is what you get (WYSIWYG) manner. The description of the user interface is independent from the programming language being used.

Language bindings[edit]

Language bindings are available for using GTK from languages other than C, including C++, Genie, JavaScript, Perl, Python, Vala, and others.[17]

GtkSharp, not to be confused with Gtk#, supports GTK 3.

Gtk#[edit]

Gtk#

Gtk Sharp Logo.png
Developer(s) Xamarin
Initial release March 12, 2004; 18 years ago
Stable release

2.12.41[18]
/ September 22, 2016; 6 years ago

Preview release

2.99.3 (for GTK3)[18]
/ June 6, 2014; 8 years ago

Repository
  • gitlab.gnome.org/GNOME/gtk Edit this at Wikidata
Written in C#, XML, Perl, C
Operating system Windows, macOS, Linux
Type Widget toolkit
License GNU Lesser General Public License
Website mono-project.com/GtkSharp

Gtk# is a set of .NET Framework bindings for the GTK graphical user interface (GUI) toolkit and assorted GNOME libraries. The library facilitates building graphical GNOME applications using Mono or any other compliant Common Language Runtime (CLR). Gtk# is an event-driven system like any other modern windowing library where every widget allows associating handler methods, which get called when certain events occur.

Applications built using Gtk# will run on many platforms including Linux, Windows and macOS. The Mono packages for Windows include GTK, Gtk# and a native theme to make applications look like native Windows applications. Starting with Mono 1.9, running Gtk# applications on macOS no longer requires running an X11 server.[19]

Glade Interface Designer can be used with the Glade# bindings to easily design GUI applications. A GUI designer named Stetic is integrated with the MonoDevelop integrated development environment (IDE).

In addition to support the standard GTK/GNOME stack of development tools, the gtk-dotnet.dll assembly provides a bridge to consume functionality available on the .NET stack. At this point this includes the functionality to use System.Drawing to draw on a widget.

As of September 2020, Gtk# support for Gtk3 remains in the preview phase and forked projects, such as GtkSharp, have been founded to provide full Gtk3 support for C# and other CLI languages. The lack of a released version of Gtk# with support for Gtk3 was cited as a reason to remove the Banshee media player in Ubuntu 12.04.[20]

Development[edit]

GTK is mainly developed by The GNOME Project, which also develops the GNOME Development Platform and the GNOME Desktop Environment.[21]

GTK development is loosely managed. Discussion chiefly occurs on several public mailing lists.[22] GNOME developers and users gather at an annual GNOME Users And Developers European Conference GUADEC meeting to discuss GNOME’s current state and future direction.[23] GNOME incorporates standards and programs from freedesktop.org to better interoperate with other desktops.

GTK is mainly written in C.[24] Many language bindings are available.

On 1 September 2016 a post on the GTK development blog denoted, among other things, the future numbering scheme of GTK.[25] GTK version 3.22, released in Autumn 2016, was planned to be the last 3.x release, although version 3.24 followed in Fall 2018 with the delay of GTK 4.[26]
The development of GTK 4 used version names 3.90, 3.92, etc. until the first GTK 4.0 stable release was launched in December 2020.[27] Despite the first stable GTK 4 release, some applications using GTK still rely on GTK 2. For example, as of January 2022, GIMP is still being ported to GTK 3.[28]

Build automation[edit]

GTK (and GNOME, GLib, etc.) formerly utilized the GNU Build System (named Autotools) as the build automation system of choice.

Since 14 Aug 2017, the master branch of GTK has been built with Meson, and the Autotools build system files have been dropped.[29]

Criticism[edit]

The most common criticism of GTK is the lack of backward-compatibility in major updates, most notably in the application programming interface (API)[30] and theming.[31]

The compatibility breaks between minor releases during the GTK 3.x development cycle was explained by Benjamin Otte as due to strong pressures to innovate, such as providing the features modern users expect and supporting the increasingly influential Wayland display server protocol. With the release of GTK 4, the pressure from the need to innovate will have been released and the balance between stability and innovation will tip toward stability.[32] Similarly, recent changes to theming are specifically intended to improve and stabilise that part of the API, meaning some investment now should be rewarded later.

  • Dirk Hohndel, codeveloper of Subsurface and member of Intel’s Open-Source Technology Center, criticized the GTK developers for being abrasive and ignoring most community requests.[33]
  • Hong Jen Yee, developer of LXDE (the GTK version of which was dropped and all efforts focused on the Qt port), expressed disdain for version 3 of the GTK toolkit’s radical API changes and increased memory usage, and ported PCMan File Manager (PCManFM) to Qt. PCManFM is being developed with a GTK and with a Qt backend at the same time.[34]
  • The Audacious music player moved to Qt in version 3.6.[35] The reasons stated by the developers for this include a transition to client-side window decorations, which they claim cause the application to look «GNOME-y and out of place.»[36]
  • Wireshark has switched to Qt due to not having a good experience with GTK’s cross-platform support.[37]

Use[edit]

The GTK support for Wayland, co-requisites applications to be adapted to Wayland also

Screenshot of GIMP 2.8 — GTK is responsible for managing the interface components of the program, including the menus, buttons, and input fields.

Applications[edit]

Some notable applications that use GTK as a widget toolkit include:

  • Ardour, a digital audio workstation (DAW)
  • Deluge, a Bit Torrent client
  • Foliate, an ebook reader
  • GIMP, a raster graphics editor
  • GNOME Builder, an integrated development environment (IDE)
  • GNOME Core Applications, a collection of applications as a standard bundle of the GNOME desktop environment
  • GNOME Evolution, a personal information manager
  • HandBrake, digital video transcoder
  • Inkscape, a vector graphics editor
  • LibreOffice, an office suite
  • Lutris, a game manager
  • Mozilla Firefox, a web browser
  • Mozilla Thunderbird, a personal information manager
  • Pitivi, a video editor
  • PCSX-Reloaded, a video game console emulator
  • Remmina, a remote desktop client
  • Transmission, a Bit Torrent client

Desktop environments[edit]

Several desktop environments utilize GTK as the widget toolkit.

Current[edit]

  • GNOME, based on GTK, meaning that programs native to GNOME use GTK
  • Budgie, built from scratch for the SolusOS successor, Solus Operating System
  • Cinnamon, a fork of GNOME 3 which uses GTK version 3
  • MATE, a fork of GNOME 2 which uses GTK 3 since version 1.18
  • Xfce, based on GTK 3 since version 4.14
  • Pantheon uses GTK 3 exclusively, being developed by elementary OS
  • Sugar, a desktop environment for youth primary education, which uses GTK, especially PyGTK
  • Phosh, a mobile UI designed for PureOS
  • LXDE (Lightweight X11 Desktop Environment) is based on GTK 2
  • Unity, the former default desktop environment of Ubuntu

Inactive[edit]

  • Access Linux Platform (successor of the Palm OS PDA platform)
  • Consort, the GNOME 3.4 Fallback Mode – fork from SolusOS
  • GPE, the GPE Palmtop Environment
  • ROX Desktop, a lightweight desktop, with features from the GUI of RISC OS

Miscellaneous[edit]

GTK programs can be run on desktop environments based on X11 and Wayland, or window managers even those not made with GTK, provided the needed libraries are installed; this includes macOS if X11.app is installed. GTK can be also run on Microsoft Windows, where it is used by some popular cross-platform applications like Pidgin and GIMP. wxWidgets, a cross-platform GUI tool-kit, uses GTK on Linux by default.[38] Other ports include DirectFB (used by the Debian installer, for example) and ncurses.[39]

Window managers[edit]

The following window managers use GTK:

  • Aewm
  • AfterStep
  • Amaterus
  • Consortium
  • IceWM
  • Marco
  • Metacity
  • Muffin
  • Mutter
  • Sawfish
  • Wmg
  • Xfwm

GtkSourceView[edit]

For syntax highlighting there is GtkSourceView, «source code editing widget». GtkSourceView is maintained by GNOME separately from GTK as a library: gtksourceview. There are plans to rename to gsv.

GtkSpell[edit]

GtkSpell is a library separate from GTK. GtkSpell depends on GTK and Enchant. Enchant is a wrapper for ispell, hunspell, etc., the actual spell checker engine/software. GtkSpell uses GTK’s GtkTextView widget, to highlight misspelled words and offer replacement.

  • gtkspell.sourceforge.net

Example[edit]

Documentation is available here:

  • developer.gnome.org/gtk4/stable/

The following code presents a graphical GTK hello-world program in the C programming language. This program has a window with the title «Hello, world!» and a label with similar text.

// helloworld.c
#include <gtk/gtk.h>

/* Callback that will be called when the application is activated */
static void
activate_callback(GApplication *app, gpointer user_data)
{
    GtkWidget *window;
    GtkWidget *label;

    /* Create the main, top level window */
    window = gtk_window_new();

    /* Give it the title */
    gtk_window_set_title(GTK_WINDOW(window), "Hello, world!");

    /* Set the window's default size */
    gtk_window_set_default_size(GTK_WINDOW(window), 200, 100);

    /* Assign the variable "label" to a new GTK label,
     * with the text "Hello, world!" */
    label = gtk_label_new("Hello, world!");

    /* Plot the label onto the main window */
    gtk_window_set_child(GTK_WINDOW(window), label);

    /* Make the application aware of the window.
     * The application process will continue to run until all
     * windows are closed */
    gtk_application_add_window(GTK_APPLICATION(app), GTK_WINDOW(window));

    /* Make sure that everything, window and label, are visible */
    gtk_widget_show(window);
}

int main (int argc, char *argv[])
{
    /* Create our test application */
    GtkApplication *application = gtk_application_new("org.wikipedia.gtktest", 0);

    /* Connect our handler to the "activate" callback, which will be called
     * when the application is activated by the user, e.g. on first start */
    g_signal_connect(application, "activate", G_CALLBACK(activate_callback), NULL);

    /* Run the application and return its status */
    return g_application_run(G_APPLICATION(application), argc, argv);
}

Needs installing the libraries first in Debian or derivatives:

$ sudo apt-get install libgtk-4-dev

Using pkg-config in a Unix shell, this code can be compiled with the following command:

$ cc -Wall $(pkg-config --cflags --libs gtk4) helloworld.c -o helloworld

Invoke the program:

$ ./helloworld

History[edit]

Linux[edit]

GTK was originally designed and used in the GNU Image Manipulation Program (GIMP) as a replacement of the Motif toolkit; at some point Peter Mattis became disenchanted with Motif and began to write his own GUI toolkit named the GIMP toolkit and had successfully replaced Motif by the 0.60 release of GIMP.[40] Finally GTK was re-written to be object-oriented and was renamed GTK+.[41] This was first used in the 0.99 release of GIMP. GTK was subsequently adopted for maintenance by the GNOME Foundation, which uses it in the GNOME desktop environment.

The GTK 2.0.0 release series introduced new features which include improved text rendering using Pango, a new theme engine, improved accessibility using the Accessibility Toolkit, transition to Unicode using UTF-8 strings, and a more flexible API. Starting with version 2.8, GTK 2 depends on the Cairo graphics library for rendering vector graphics.

GTK version 3.0.0 included revised input device handling, support for themes written with CSS-like syntax, and the ability to receive information about other opened GTK applications.

The ‘+’ was dropped returning to simply ‘GTK’ in February 2019 during a Hackathon.[42]

macOS[edit]

With Quartz-backend[43] GTK is available in macOS.[44]

Windows[edit]

  • After GTK 2.24.10 and 3.6.4 Development of Windows with Installer was closed by Gnome. Installation of MSYS2 on Windows is a good way to use actual GTK.[45]
  • GTK 2.24.10 and 3.6.4 is available in Internet, but very buggy and limited against actual versions.[46][47]
  • A version for Windows 64-bit is prepared by Tom Schoonjans with 2.24.33 (actual like Linux) and 3.24.24 (actual like Linux) from January 2021 available.[48]
  • Windows 10’s Fall Creators Update includes Windows Subsystem for Linux (WSL). With Linux distributions like Ubuntu or Debian available from the Microsoft Store and an X server like Xming or VcXsvr, thousands of programs like GTK 2 or 3 can run with X or terminal support.

OpenVMS[edit]

HP stated that their goal was to merge the needed OpenVMS changes into the GTK Version 1.3 development stream,[49] however this never materialised. The latest version of GTK for OpenVMS is version 1.2.10.[50]

GTK 4[edit]

One of the cardinal novelties implemented during the GTK 4 development cycle (i.e. GTK 3.92, etc.) has been the removal of customization option for the user side (like individual keyboard shortcuts that could be set in GTK+ 2), the delegation of functionality to ancillary objects instead of encoding it into the base classes provided by GTK.

  • the event handling from signal handlers described by GtkWidget is delegated to event controllers
  • the rendering is delegated to GtkSnapshot objects
  • the layout mechanism from GtkWidget is delegated to GtkLayoutManager

In 2018-Jan-26 at DevConf.cz Matthias Clasen gave an overview of the then current state of GTK 4 development, including a high-level explanation of how rendering and input worked in GTK 3, what changes were being made to GTK 4, and the reasons for those changes. Examples of things that have become possible with GTK 4 were given as well.[51]

Releases[edit]

Legend:

Old version

Older version, still maintained

Latest version

Latest preview version

Future release

Release series Initial release Major enhancements Latest minor version
1.0 1998-04-13[52] First stable version 1.0.6
1.2 1999-02-25[53] New widgets:

  • GtkFontSelector
  • GtkPacker
  • GtkItemFactory
  • GtkCTree
  • GtkInvisible
  • GtkCalendar
  • GtkLayout
  • GtkPlug
  • GtkSocket
1.2.10
2.0 2002-03-11[54] GObject

Overall support for UTF-8

2.0.9
2.2 2002-12-22[55] Multihead support 2.2.4
2.4 2004-03-16[56] New widgets:

  • GtkFileChooser
  • GtkComboBox
  • GtkComboBoxEntry
  • GtkExpander
  • GtkFontButton
  • GtkColorButton
2.4.14
2.6 2004-12-16[57] New widgets:

  • GtkIconView
  • GtkAboutDialog
  • GtkCellView

The last to support Windows 98/Me

2.6.10
2.8 2005-08-13[58] Most widgets are rendered by Cairo 2.8.20
2.10 2006-07-03[59] New widgets:

  • GtkStatusIcon
  • GtkAssistant
  • GtkLinkButton
  • GtkRecentChooser

Print support: GtkPrintOperation

2.10.14
2.12 2007-09-14[60] GtkBuilder 2.12.12
2.14 2008-09-04[61] JPEG 2000 load support 2.14.7
2.16 2009-03-13[62] New widget: GtkOrientable

Caps Lock warning in password entry

Improvements on GtkScale, GtkStatusIcon, GtkFileChooser

2.16.6
2.18 2009-09-23[63] New widget: GtkInfoBar

Improvement on file chooser, printing

To remove much of the necessary IPC between the X11 application and the X11 server, GDK is rewritten (mainly by Alexander Larsson) to use «client-side windows», i.e., the GdkWindow, which every widget must have, belongs now to the client

2.18.9
2.20 2010-03-23[64] New widgets:

  • GtkSpinner
  • GtkToolPalette
  • GtkOffscreenWindow

Improvement on file chooser, keyboard handling, GDK

Introspection data is now included in GTK

2.20.1
2.22 2010-09-23[65] GdkPixbuf moved to separate module

Most GDK drawing are based on Cairo

Many internal data are now private and can be sealed in preparation to GTK 3

2.22.1
2.24 2011-01-30[66] New widget: GtkComboBoxText which had previously been a custom widget shipped with Gtkmm

The CUPS print backend can send print jobs as PDF

GtkBuilder has gained support for text tags and menu toolbuttons and many introspection annotation fixes were added

Migrating from GTK+ 2.x to GTK+ 3

2.24.32
(2018-01-08)
3.0 2011-02-10[67] Development and design of the GTK 3 release of the toolkit started in February 2009 during the GTK Theming Hackfest held in Dublin[68]

  • The first draft of the development roadmap was released on 9 April 2009[69]

Completed mostly Project Ridley

  • the attempt to consolidate several libraries that were external to GTK+
  • including libgnome, libgnomeui, libgnomeprint22, libgnomeprintui22, libglade, libgnomecanvas, libegg, libeel, gtkglext, and libsexy[70]

All the rendering is done using Cairo

GDK became more X11 agnostic

XInput2, theme API is based on Cascading Style Sheets (CSS), worsening the achievable performance for 60 Hz frame rates

3.0.12
3.2 2011-09-25[71] New widgets:

  • GtkLockButton
  • GtkOverlay

New Font Chooser dialog

New experimental backends:

  • Wayland
  • HTML5 (named «Broadway»)
3.2.4
3.4 2012-03-26[72] Menu support in GtkApplication

A new color chooser

Added support for touch devices

Added support for smooth scrolling

GtkScrolledWindow will do kinetic scrolling with touch devices

macOS support is improved

This is the first version of GTK 3 that works well on Windows

The Wayland backend is updated to the current Wayland version

Spin buttons have received a new look

Accessibility: the treeview accessible support is rewritten

More complete CSS theming support

3.4.4
3.6 2012-09-24[73] New widgets:

  • GtkSearchEntry
  • GtkMenuButton
  • GtkLevelBar

Vertical spin buttons

CSS animations, blur shadows

Support for cross-fading and transitions in themes

3.6.5
3.8 2013-03-25[74] Wayland 1.0 stable support

Support for the broadwayd server

Improved theming

Better geometry management

Touch improvements

Support with the window manager for the frame synchronization protocol

GdkFrameClock added[75]

3.8.9
3.10 2013-09-23[76] New widgets:

  • GtkHeaderBar
  • GtkPlacesSidebar
  • GtkStack
  • GtkStackSwitcher
  • GtkRevealer
  • GtkSearchBar
  • GtkListBox

Support for Wayland 1.2

  • maximization
  • animated cursors
  • multiple monitors
  • settings
  • custom surfaces
  • frame synchronization

Added:

  • client-side decorations
  • scaled output support on high-dpi screens
  • fine-adjustment mode for scrolling

Removed:

  • support for the Motif DND protocol
  • support for multiple screens per display
  • gdk_window_get_display
  • gtk_widget_push_composite_child

Tear-off menu-items, plus many GTK settings

The modern GTK drawing model

3.10.9
3.12 2014-03-25[77] Client-side decorations[78]

Support for Wayland 1.5

New widget: GtkPopover (an alternative to menus and dialogs)

3.12.2
3.14 2014-09-22[79] GtkInspector (a copy of gtkparasite) introduced[80][81]

Improved support for gestures/multi-touch merged[82][83]

Deprecated:[84]

  • GtkMisc
  • GtkAlignment
  • GtkArrow
  • GdkColor
  • Style regions
  • support for .icon files
  • gdk_window_flush
  • drawing outside of begin/end paint

Most widgets converted to use gestures internally

Wayland supports GNOME Shell classic mode[85]

3.14.15
3.16 2015-03-22[86] GDK supports rendering windows using OpenGL for X11 and Wayland using libepoxy

New widgets:

  • GtkGLArea
  • GtkStackSidebar
  • GtkModelButton
  • GtkPopoverMenu

Scrolling overhauled (scrollbar hidden by default[87])

Experimental Mir backend[88]

3.16.7
3.18 2015-09-23[89] Add CSS node infrastructure

More filechooser design refresh and better filechooser search

Dropped Windows XP support

Model support for list and flow box

Kinetic touchpad scrolling

Touchpad gestures (Wayland)

gtk-builder-tool utility

Output-only windows

3.18.9
3.20 2016-03-21[90] Further Integration of CSS nodes[91]

Move drag and drop down to GDK

New widget: GtkShortcutsWindow (shows keyboard shortcuts and gestures of an application)

3.20.10
3.22 2016-09-21[92] Last 3.x release[25]

Wayland tablet support is merged,[93] support for graphics tablets is considered feature complete[94]

GTK 3.22 shall be as rock-stable (and hence «boring») as GTK 2[32][95][96]

for 3+ years
3.22.29
3.24 2018-09-03[97] 3.22 was supposed to be the last version of GTK 3 series

  • 3.24 was mainly released to ease migrating from GTK+ 3.x to GTK+ 4

Dependency bumps – require:

  • libepoxy 1.4
  • pango 1.41

New font chooser features:

  • allow setting OpenType font features
  • show examples for OpenType font features
  • allow selecting OpenType font variations
  • support levels of details for selection

New Emoji features:

  • support a completion popup for Emoji
  • drop Ctrl-Shift-e shortcut

Other new APIs: gdk_window_move_to_rect

Wayland: use anonymous shared memory on FreeBSD

Backported event controllers from GTK 4:

  • GtkEventControllerScroll
  • GtkEventControllerMotion
  • GtkEventControllerKey
  • GtkGestureStylus

Deprecate a few APIs that are gone in GTK 4:

  • focus chains in GtkContainer
  • stepper sensitivity in GtkRange
3.23.0
3.23.1
3.23.2
3.23.3
3.24.0
…3.24.5
3.24.14

3.24.29

3.90 2017-03-31[98] GTK Scene Graph Kit (GSK) merged[5]

Remove any API marked as deprecated

  • before (2016-09-22) vs. after

Heavy development

  • break API & ABI[95][96]

A new Vulkan-renderer augments the old Cairo-renderer[99]

3.89.1

3.89.2
3.89.4
3.89.5
3.90

3.92 2017-10-18[100][101] As GNOME 3.26 was released already on September 13, 2017,[102] it was not based on GTK 3.92.

GNU autotools was replaced with Meson.

3.91.0

3.91.1
3.91.2
3.92.1

3.94 2018-06-26[103] 3.93

  • GdkScreen, GdkVisual removed
  • GdkDeviceManager replaced by GdkSeat
  • Clipboard handling is moved from GTK to GDK
  • GdkEvent is converted to an opaque GObject
  • the GL renderer in GSK is substantially completed, and is now on par with the Vulkan renderer
  • the use of GdkPixbuf in APIs is reduced
    • and the GskTexture object is moved to GDK as GdkTexture, to take its place
  • the Wayland backend now implements the KDE server-side decoration protocol
  • Broadway is ported to GSK.

GdkWindow renamed to GdkSurface

New abstraction for drawable content: GdkPaintable

There is support for displaying media with:

  • GtkVideo
  • GtkMediaFile
  • GtkMediaStream
  • GtkMediaControls
3.93
3.94.0
3.96 2019-05-07[104] The gtk4-builder-tool simplify command has gained a --3to4 option to convert GTK3 ui files to GTK4; though with AMTK menus, toolbars or other objects like GtkShortcutsWindow are created programmatically (not with a *.ui file), but with convenient APIs.[105]

GtkWidget can now use a GtkLayoutManager for size allocation

  • layout managers can optionally use layout children holding layout properties
  • GtkBinLayout, GtkBoxLayout, GtkGridLayout, GtkFixedLayout and GtkCustomLayout are currently available
  • more layout manager implementations will appear in the future

Focus handling has been rewritten, and focus-change event generation has been unified with crossing events

Events have been simplified and are just used for input:

  • expose events have been replaced by a GdkSurface::render signal
  • configure events have been replaced by a GdkSurface::size-changed signal
  • map events have been replaced by a GdkSurface::mapped property
  • gdk_event_handler_set has been replaced by a GdkSurface::event signal
  • key events no longer contain a string
  • events on unmapped widgets are ignored
3.96.0
3.98 2020-02-10[104]
  • Performance improvements
  • Drag and drop refactoring
  • Moving GDK towards Wayland
  • Removals
    • GtkMenu, GtkToolbar and similar classes have been replaced by GMenu.
  • Additions
    • Emoji chooser
    • Text widgets now have undo stacks
    • A new layout manager[106]
3.98.5
3.99.0 2020-07-31[107]
  • Introduced successor to Accessibility Toolkit (ATK).[108] The new approach will implement WAI-ARIA (World Wide Web Consortium (W3C) Accessibility Initiative – Accessible Rich Internet Applications).
  • Updated headers to use standard C types instead of GLib types
  • New widgets
  • Fixes and improvements[107]
3.99.4
4.0 2020-12-16[109] 4.0.2
4.2 2021-03-30[110]
4.4 2021-08-23[111]
4.6 2021-12-30[112]
4.8 2021-12-30[113]

See also[edit]

  • Client-Side Decoration
  • List of widget toolkits
  • GDK – the GIMP Drawing Kit lies between the xlib and the GTK library, handling basic rendering such as drawing primitives, raster graphics (bitmaps), cursors, fonts, as well as window events and drag-and-drop functionality
  • gtkmm – C++ bindings for GTK
  • Qt – cross platform framework and toolkit
  • Xojo – cross-platform development tool and framework
  • Enlightenment Foundation Libraries (EFL) – widget toolkit written for the Enlightenment window manager
  • FLTK – a light, cross-platform, non-native widget toolkit
  • FOX toolkit – a fast, open source, cross-platform widget toolkit
  • IUP – a multi-platform toolkit for building native graphical user interfaces
  • Ultimate++
  • Visual Component Library (VCL)
  • Vala – an object-oriented programming language with a self-hosting compiler that generates C code and uses the GObject system.
  • wxWidgets — a cross-platform GUI toolkit whose goal is to directly use each platform’s native graphic API whenever possible.

References[edit]

  1. ^ «The GTK Open Source Project on Open Hub: Languages Page». www.openhub.net.
  2. ^ a b Bassi, Emmanuele (6 February 2019). «Project rename to «GTK»«. mail.gnome.org. GNOME mailinglist. Retrieved 7 February 2019.
  3. ^ The GTK+ Team. «GTK+ Features». Archived from the original on 25 May 2019. Retrieved 8 September 2014.
  4. ^ «Documentation». www.x.org.
  5. ^ a b «Projects/GTK/Roadmap — GNOME Wiki!». wiki.gnome.org.
  6. ^ «GTK 4.0 – GTK Development Blog». Retrieved 18 October 2021.
  7. ^ «GTK+ 3 Reference Manual». Retrieved 15 July 2017.
  8. ^ «Using GTK+ with Broadway». GNOME Developer. GNOME. Retrieved 6 March 2018.
  9. ^ «Broadway — GitHub symbiose/symbiose Wiki». GitHub. Retrieved 6 March 2018.
  10. ^ «GTK+ to Use Cairo Vector Engine». Retrieved 27 December 2009.
  11. ^ «Gtk: Migrating from GTK 2.x to GTK 3». docs.gtk.org. Retrieved 16 June 2022. All drawing in GTK 3 is done via Cairo.
  12. ^ «Matthias Clasen DevConf.cz 2018 talk about GTK+ 4» (PDF). 26 January 2018.
  13. ^ «Introducing GtkInspector». 15 May 2014.
  14. ^ «Another GtkInspector update». 11 July 2014.
  15. ^ «Debian — Package Search Results — gazpacho». packages.debian.org.
  16. ^ «Nothing-personal — A development site for Crow Designer, GuiLoader and Rally — Google Project Hosting». Archived from the original on 24 January 2013. Retrieved 17 February 2014.
  17. ^ The GTK+ Team. «GTK+ Language Bindings». www.gtk.org. Archived from the original on 25 May 2019. Retrieved 3 June 2017.
  18. ^ a b «Gtk# is a Mono/.NET binding to the cross platform Gtk+ GUI toolkit and the foundation of most GUI apps built with Mono: mono/gtk-sharp». 16 November 2019 – via GitHub.
  19. ^ «Download Gtk#». The GTK+ Project.
  20. ^ «‘Bansheegeddon’ may see Banshee, Mono dropped from Ubuntu default». ITWorld. Retrieved 31 August 2015.
  21. ^ «GNOME Quick SWOT Analysis». The GNOME Project. Retrieved 18 March 2014.
  22. ^ «GTK+ and GNOME Mailing Lists». The GNOME Project. Retrieved 4 December 2011.
  23. ^ «About». GNOME Users And Developers European Conference (GUADEC). Archived from the original on 4 October 2011. Retrieved 3 December 2011.
  24. ^ «GNOME Languages». Ohloh. Black Duck Software. Retrieved 22 May 2014.
  25. ^ a b «Versioning and long term stability promise in GTK». GTK development blog. 1 September 2016.
  26. ^ «GTK+ 3.24 To Deliver Some New Features While Waiting For GTK4». www.phoronix.com.
  27. ^ «GTK 4.0». GTK development blog. 16 December 2020.
  28. ^ «Development release GIMP 2.99.2 is out». Gimp news. 6 November 2020.
  29. ^ «Build system change GTK’s master branch». mail.gnome.org.
  30. ^ «How Does One Create A Gtk+ Application? – Morten Welinder». blogs.gnome.org. Retrieved 3 June 2017.
  31. ^ mclasen (20 November 2015). «A GTK+ update». Goings on.
  32. ^ a b «GUADEC2013: Benjamin Otte talks about GTK+». GUADEC.
  33. ^ Larabel, Michael (12 January 2014). «The Biggest Problem With GTK & What Qt Does Good». Phoronix. Retrieved 10 September 2014.
  34. ^ Hong Jen Yee (26 March 2013). «PCManFM Qt 0.1.0 released». Retrieved 10 September 2014.
  35. ^ «Audacious — An Advanced Audio Player». audacious-media-player.org.
  36. ^ Lindgren, John (6 May 2014). «Ugly window decorations and how to fix them (GTK 3.12)». Retrieved 21 October 2014.
  37. ^ Gerald Combs (15 October 2013). «We’re switching to Qt». Retrieved 19 August 2015.
  38. ^ «GTK+». WxWidgets Compared To Other Toolkits.
  39. ^ «GTK+ TTY Port». Slashdot. Retrieved 31 August 2010.
  40. ^ «LinuxWorld — Where did Spencer Kimball and Peter Mattis go?». Archived from the original on 17 April 1999. Retrieved 19 August 2013.{{cite web}}: CS1 maint: bot: original URL status unknown (link)
  41. ^ «What is the + in GTK+?». 2011. Archived from the original on 26 March 2012. Retrieved 18 March 2014.
  42. ^ «Rename some references to GTK+ (d080be3e) · Commits · GNOME / gtk». gitlab.gnome.org.
  43. ^ «Projects/GTK/OSX — GNOME Wiki!». wiki.gnome.org.
  44. ^ «GTK Download: Mac OS X». www.gtk.org.
  45. ^ «GTK Download: Windows». www.gtk.org.
  46. ^ «GTK+ for Windows Runtime Environment». SourceForge.
  47. ^ «GTK+». www.tarnyko.net.
  48. ^ «GTK+ for Windows Runtime Environment Installer (fork from http://gtk-win.sourceforge.net): tschoonj/GTK-for-Windows-Runtime-Environment-Installer». 19 November 2020 – via GitHub.
  49. ^ «HP OpenVMS systems — GTK+».
  50. ^ «HP OpenVMS systems — GTK+».
  51. ^ https://mclasen.fedorapeople.org/gtk4-devconf2018.pdf[bare URL PDF]
  52. ^ Amundson, Shawn T. (13 April 1998). «ANNOUNCE: GTK+ 1.0.0 Released!». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  53. ^ Amundson, Shawn T. (25 February 1999). «ANNOUNCE: GTK+ and GLib 1.2.0 Released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  54. ^ Taylor, Owen (11 March 2002). «GTK+-2.0.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  55. ^ Taylor, Owen (22 December 2002). «GTK+-2.2.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  56. ^ Taylor, Owen (16 March 2004). «GTK+-2.4.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  57. ^ Clasen, Matthias (16 December 2004). «GTK+-2.6.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  58. ^ Clasen, Matthias (13 August 2005). «GTK+ 2.8.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  59. ^ Clasen, Matthias (3 July 2006). «GTK+ 2.10 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  60. ^ Clasen, Matthias (14 September 2007). «GTK+ 2.12 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  61. ^ Clasen, Matthias (4 September 2008). «GTK+ 2.14.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  62. ^ Clasen, Matthias (13 March 2009). «GTK+ 2.16.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  63. ^ Clasen, Matthias (23 September 2009). «GTK+ 2.18.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  64. ^ Clasen, Matthias (23 March 2010). «GTK+ 2.20.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  65. ^ Clasen, Matthias (23 September 2010). «GTK+ 2.22.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  66. ^ Clasen, Matthias (20 January 2011). «GTK+ 2.24.0». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  67. ^ Clasen, Matthias (10 February 2011). «GTK+ 3.0.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  68. ^ «Gtk+ 3.0 Theming API Hackfest». Silicon Island. Retrieved 3 June 2017.
  69. ^ «Gtk+ 3 roadmap draft». Retrieved 3 June 2017.
  70. ^ «Attic/ProjectRidley — GNOME Wiki!». wiki.gnome.org.
  71. ^ Clasen, Matthias (25 September 2011). «GTK+ 3.2.0». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  72. ^ Clasen, Matthias (26 March 2012). «GTK+ 3.4.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  73. ^ Clasen, Matthias (24 September 2012). «GTK+ 3.6.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  74. ^ Clasen, Matthias (25 March 2013). «GTK+ 3.8.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  75. ^ «Frame clock: GDK 3 Reference Manual». developer.gnome.org.
  76. ^ Clasen, Matthias (23 September 2013). «GTK+ 3.10.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  77. ^ Clasen, Matthias (25 March 2014). «GTK+ 3.12 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  78. ^ «Client-side decorations in themes | Goings on».
  79. ^ Clasen, Matthias (22 September 2014). «GTK+ 3.14.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  80. ^ Matthias Clasen (15 May 2014). «GtkInspector Author’s blog entry». Retrieved 17 May 2014.
  81. ^ «GtkInspector in GNOME wiki». 15 May 2014. Retrieved 17 May 2014.
  82. ^ «Merging gestures into 3.14». 23 May 2014. Retrieved 23 May 2014.
  83. ^ «RFC: gestures». 4 March 2014. Retrieved 23 May 2014.
  84. ^ «gtk+ 3.13.2». 27 May 2014.
  85. ^ «gtk+ 3.13.3». 24 June 2014.
  86. ^ Clasen, Matthias (22 March 2015). «GTK+ 3.16.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  87. ^ online, heise. «Linux-Desktop: Neues Gnome zeigt Nachrichten oben». heise online. Retrieved 3 June 2017.
  88. ^ «GTK+ 3.16.0 released». mail.gnome.org. Retrieved 3 June 2017.
  89. ^ Nestor, Marius (24 September 2015). «GTK+ 3.18.0 Officially Released as Part of the GNOME 3.18 Desktop Environment». Softpedia. Retrieved 25 May 2019.
  90. ^ Clasen, Matthias (21 March 2016). «GTK+ 3.20». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  91. ^ «GTK+ 3.20 – Style Classes and Element Names». 20 November 2015.
  92. ^ Clasen, Matthias (21 September 2016). «GTK+ 3.22 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  93. ^ «GTK+ Wayland tablet support is merged – Carlos Garnacho».
  94. ^ «hutterer input». www.x.org.
  95. ^ a b «Gtk 4.0 will not be stable until Gtk 4.6». 13 June 2016.
  96. ^ a b «Gtk 5.0 will not be stable until Gtk 5.6». 14 June 2016.
  97. ^ Clasen, Matthias (3 September 2018). «gtk+ 3.24.0». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  98. ^ Clasen, Matthias (31 March 2017). «gtk+ 3.90.0». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  99. ^ «Commits · master · GNOME / gtk». GitLab.
  100. ^ Clasen, Matthias (18 October 2017). «gtk+ 3.92.1». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  101. ^ Clasen, Matthias (23 October 2017). «GTK+ 3.92». GTK Development Blog. Retrieved 25 May 2019.
  102. ^ «GNOME 3.26 Released». 13 September 2017.
  103. ^ Clasen, Matthias (26 June 2018). «gtk+ 3.94.0». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  104. ^ a b Clasen, Matthias (7 May 2019). «gtk 3.96». GNOME Mail Services (Mailing list). Retrieved 28 May 2019.
  105. ^ «Introducing amtk».
  106. ^ Clasen, Matthias (13 February 2020). «GTK 3.98». GTK+ Development Blog. Retrieved 18 February 2020.
  107. ^ a b Clasen, Matthias (9 June 2021). «gtk 4.3.1». FTP Releases (Mailing list). Retrieved 10 July 2021.
  108. ^ «Emmanuele Bassi / guadec-2020». GitLab.
  109. ^ Clasen, Matthias (16 December 2020). «gtk 4.0.0». GNOME Mail Services (Mailing list). Retrieved 16 December 2020.
  110. ^ Clasen, Matthias (30 March 2021). «gtk 4.2.0». GNOME Mail Services (Mailing list). Retrieved 30 March 2021.
  111. ^ Clasen, Matthias (23 August 2021). «gtk 4.4.0». GNOME Mail Services (Mailing list). Retrieved 23 January 2022.
  112. ^ Clasen, Matthias (30 December 2021). «gtk 4.6.0». FTP Releases (Mailing list). Retrieved 23 January 2022.
  113. ^ Clasen, Matthias (6 September 2022), gtk 4.8.0, retrieved 11 January 2023

Bibliography[edit]

  • Krause, Andrew (23 April 2007), Foundations of GTK+ Development (1st ed.), Apress, ISBN 978-1-59059-793-4
  • Wright, Peter (15 May 2000), Beginning GTK+ and GNOME (1st ed.), Peer Information, ISBN 978-1-86100-381-2
  • Logan, Syd (6 September 2001), Gtk+ Programming in C (1st ed.), Prentice Hall, ISBN 978-0-13-014264-1

External links[edit]

Wikimedia Commons has media related to GTK.

  • Official website Edit this at Wikidata

From Wikipedia, the free encyclopedia

GTK

GTK logo.svg
Gtk4-widget-factory demos.png

GTK version 4 (gtk4-widget-factory, a collection of examples that demonstrate many of the GUI widgets)

Original author(s) Spencer Kimball, Peter Mattis
Developer(s) The GNOME Project, eXperimental Computing Facility (XCF)
Initial release April 14, 1998; 24 years ago
Stable release

4.8.3
/ December 22, 2022; 45 days ago

Preview release

4.9.2
/ December 26, 2022; 41 days ago

Repository
  • gitlab.gnome.org/GNOME/gtk Edit this at Wikidata
Written in C, CSS[1]
Operating system Linux, Unix-like, macOS, Windows
Type Widget toolkit
License LGPLv2.1+
Website gtk.org

GTK (formerly GTK+)[2] is a free and open-source cross-platform widget toolkit for creating graphical user interfaces (GUIs).[3] It is licensed under the terms of the GNU Lesser General Public License, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the Wayland and X11 windowing systems.[4]

The GTK team releases new versions on a regular basis.[5] GTK 4 and GTK 3 are maintained, while GTK 2 is end-of-life.[6]

Software architecture[edit]

The GTK library contains a set of graphical control elements (widgets); version 3.22.16 contains 186 active and 36 deprecated widgets.[7] GTK is an object-oriented widget toolkit written in the programming language C; it uses GObject, that is the GLib object system, for the object orientation. While GTK is mainly for windowing systems based on X11 and Wayland, it works on other platforms, including Microsoft Windows (interfaced with the Windows API), and macOS (interfaced with Quartz). There is also an HTML5 back-end named Broadway.[8][9]

GTK can be configured to change the look of the widgets drawn; this is done using different display engines. Several display engines exist which try to emulate the look of the native widgets on the platform in use.

Starting with version 2.8, released in 2005, GTK began the transition to using Cairo to render most of its graphical control elements widgets.[10] Since GTK version 3.0, all rendering is done using Cairo.[11]

On 26 January 2018 at DevConf.cz, Matthias Clasen gave an overview of the current state of GTK 4 development, including a high-level explanation of how rendering and input worked in GTK 3, what changes are being made in GTK 4 (>3.90), and why.[12] On 6 February 2019 it was announced that GTK 4 will drop the “+” from the project’s name.[2]

GTK Drawing Kit (GDK)[edit]

Main article: GDK

GDK acts as a wrapper around the low-level functions provided by the underlying windowing and graphics systems.

GDK is found in the /gdk directory.

GTK Scene Graph Kit (GSK)[edit]

GSK is the rendering and scene graph API for GTK. GSK lies between the graphical control elements (widgets) and the rendering. GSK was finally merged into GTK version 3.90 released March 2017.

GSK is found in the /gsk directory.

GtkInspector[edit]

GtkInspector was introduced with version 3.14.[13][14]
GtkInspector can only be invoked after installing the development package libgtk-3-dev/gtk+-devel[permanent dead link].

GUI designers[edit]

There are several GUI designers for GTK. The following projects are active as of July 2011:

  • Glade, supports GtkBuilder, which is a GTK built-in GUI description format.
  • Gazpacho, GUI builder for the GTK toolkit written in Python[15]
  • Crow Designer, relies on its own GuiXml format and GuiLoader library.[16]
  • Stetic, part of MonoDevelop, oriented toward Gtk#.
  • Gambas since version 2.0 atop BASIC
  • Xojo on Linux
  • Lazarus on Linux defaults to interfacing with GTK 2

GtkBuilder[edit]

GtkBuilder allows user interfaces to be designed without writing code. The interface is described in an Extensible Markup Language (XML) file, which is then loaded at runtime and the objects created automatically. The Glade Interface Designer allows creation of the user interface in a what you see is what you get (WYSIWYG) manner. The description of the user interface is independent from the programming language being used.

Language bindings[edit]

Language bindings are available for using GTK from languages other than C, including C++, Genie, JavaScript, Perl, Python, Vala, and others.[17]

GtkSharp, not to be confused with Gtk#, supports GTK 3.

Gtk#[edit]

Gtk#

Gtk Sharp Logo.png
Developer(s) Xamarin
Initial release March 12, 2004; 18 years ago
Stable release

2.12.41[18]
/ September 22, 2016; 6 years ago

Preview release

2.99.3 (for GTK3)[18]
/ June 6, 2014; 8 years ago

Repository
  • gitlab.gnome.org/GNOME/gtk Edit this at Wikidata
Written in C#, XML, Perl, C
Operating system Windows, macOS, Linux
Type Widget toolkit
License GNU Lesser General Public License
Website mono-project.com/GtkSharp

Gtk# is a set of .NET Framework bindings for the GTK graphical user interface (GUI) toolkit and assorted GNOME libraries. The library facilitates building graphical GNOME applications using Mono or any other compliant Common Language Runtime (CLR). Gtk# is an event-driven system like any other modern windowing library where every widget allows associating handler methods, which get called when certain events occur.

Applications built using Gtk# will run on many platforms including Linux, Windows and macOS. The Mono packages for Windows include GTK, Gtk# and a native theme to make applications look like native Windows applications. Starting with Mono 1.9, running Gtk# applications on macOS no longer requires running an X11 server.[19]

Glade Interface Designer can be used with the Glade# bindings to easily design GUI applications. A GUI designer named Stetic is integrated with the MonoDevelop integrated development environment (IDE).

In addition to support the standard GTK/GNOME stack of development tools, the gtk-dotnet.dll assembly provides a bridge to consume functionality available on the .NET stack. At this point this includes the functionality to use System.Drawing to draw on a widget.

As of September 2020, Gtk# support for Gtk3 remains in the preview phase and forked projects, such as GtkSharp, have been founded to provide full Gtk3 support for C# and other CLI languages. The lack of a released version of Gtk# with support for Gtk3 was cited as a reason to remove the Banshee media player in Ubuntu 12.04.[20]

Development[edit]

GTK is mainly developed by The GNOME Project, which also develops the GNOME Development Platform and the GNOME Desktop Environment.[21]

GTK development is loosely managed. Discussion chiefly occurs on several public mailing lists.[22] GNOME developers and users gather at an annual GNOME Users And Developers European Conference GUADEC meeting to discuss GNOME’s current state and future direction.[23] GNOME incorporates standards and programs from freedesktop.org to better interoperate with other desktops.

GTK is mainly written in C.[24] Many language bindings are available.

On 1 September 2016 a post on the GTK development blog denoted, among other things, the future numbering scheme of GTK.[25] GTK version 3.22, released in Autumn 2016, was planned to be the last 3.x release, although version 3.24 followed in Fall 2018 with the delay of GTK 4.[26]
The development of GTK 4 used version names 3.90, 3.92, etc. until the first GTK 4.0 stable release was launched in December 2020.[27] Despite the first stable GTK 4 release, some applications using GTK still rely on GTK 2. For example, as of January 2022, GIMP is still being ported to GTK 3.[28]

Build automation[edit]

GTK (and GNOME, GLib, etc.) formerly utilized the GNU Build System (named Autotools) as the build automation system of choice.

Since 14 Aug 2017, the master branch of GTK has been built with Meson, and the Autotools build system files have been dropped.[29]

Criticism[edit]

The most common criticism of GTK is the lack of backward-compatibility in major updates, most notably in the application programming interface (API)[30] and theming.[31]

The compatibility breaks between minor releases during the GTK 3.x development cycle was explained by Benjamin Otte as due to strong pressures to innovate, such as providing the features modern users expect and supporting the increasingly influential Wayland display server protocol. With the release of GTK 4, the pressure from the need to innovate will have been released and the balance between stability and innovation will tip toward stability.[32] Similarly, recent changes to theming are specifically intended to improve and stabilise that part of the API, meaning some investment now should be rewarded later.

  • Dirk Hohndel, codeveloper of Subsurface and member of Intel’s Open-Source Technology Center, criticized the GTK developers for being abrasive and ignoring most community requests.[33]
  • Hong Jen Yee, developer of LXDE (the GTK version of which was dropped and all efforts focused on the Qt port), expressed disdain for version 3 of the GTK toolkit’s radical API changes and increased memory usage, and ported PCMan File Manager (PCManFM) to Qt. PCManFM is being developed with a GTK and with a Qt backend at the same time.[34]
  • The Audacious music player moved to Qt in version 3.6.[35] The reasons stated by the developers for this include a transition to client-side window decorations, which they claim cause the application to look «GNOME-y and out of place.»[36]
  • Wireshark has switched to Qt due to not having a good experience with GTK’s cross-platform support.[37]

Use[edit]

The GTK support for Wayland, co-requisites applications to be adapted to Wayland also

Screenshot of GIMP 2.8 — GTK is responsible for managing the interface components of the program, including the menus, buttons, and input fields.

Applications[edit]

Some notable applications that use GTK as a widget toolkit include:

  • Ardour, a digital audio workstation (DAW)
  • Deluge, a Bit Torrent client
  • Foliate, an ebook reader
  • GIMP, a raster graphics editor
  • GNOME Builder, an integrated development environment (IDE)
  • GNOME Core Applications, a collection of applications as a standard bundle of the GNOME desktop environment
  • GNOME Evolution, a personal information manager
  • HandBrake, digital video transcoder
  • Inkscape, a vector graphics editor
  • LibreOffice, an office suite
  • Lutris, a game manager
  • Mozilla Firefox, a web browser
  • Mozilla Thunderbird, a personal information manager
  • Pitivi, a video editor
  • PCSX-Reloaded, a video game console emulator
  • Remmina, a remote desktop client
  • Transmission, a Bit Torrent client

Desktop environments[edit]

Several desktop environments utilize GTK as the widget toolkit.

Current[edit]

  • GNOME, based on GTK, meaning that programs native to GNOME use GTK
  • Budgie, built from scratch for the SolusOS successor, Solus Operating System
  • Cinnamon, a fork of GNOME 3 which uses GTK version 3
  • MATE, a fork of GNOME 2 which uses GTK 3 since version 1.18
  • Xfce, based on GTK 3 since version 4.14
  • Pantheon uses GTK 3 exclusively, being developed by elementary OS
  • Sugar, a desktop environment for youth primary education, which uses GTK, especially PyGTK
  • Phosh, a mobile UI designed for PureOS
  • LXDE (Lightweight X11 Desktop Environment) is based on GTK 2
  • Unity, the former default desktop environment of Ubuntu

Inactive[edit]

  • Access Linux Platform (successor of the Palm OS PDA platform)
  • Consort, the GNOME 3.4 Fallback Mode – fork from SolusOS
  • GPE, the GPE Palmtop Environment
  • ROX Desktop, a lightweight desktop, with features from the GUI of RISC OS

Miscellaneous[edit]

GTK programs can be run on desktop environments based on X11 and Wayland, or window managers even those not made with GTK, provided the needed libraries are installed; this includes macOS if X11.app is installed. GTK can be also run on Microsoft Windows, where it is used by some popular cross-platform applications like Pidgin and GIMP. wxWidgets, a cross-platform GUI tool-kit, uses GTK on Linux by default.[38] Other ports include DirectFB (used by the Debian installer, for example) and ncurses.[39]

Window managers[edit]

The following window managers use GTK:

  • Aewm
  • AfterStep
  • Amaterus
  • Consortium
  • IceWM
  • Marco
  • Metacity
  • Muffin
  • Mutter
  • Sawfish
  • Wmg
  • Xfwm

GtkSourceView[edit]

For syntax highlighting there is GtkSourceView, «source code editing widget». GtkSourceView is maintained by GNOME separately from GTK as a library: gtksourceview. There are plans to rename to gsv.

GtkSpell[edit]

GtkSpell is a library separate from GTK. GtkSpell depends on GTK and Enchant. Enchant is a wrapper for ispell, hunspell, etc., the actual spell checker engine/software. GtkSpell uses GTK’s GtkTextView widget, to highlight misspelled words and offer replacement.

  • gtkspell.sourceforge.net

Example[edit]

Documentation is available here:

  • developer.gnome.org/gtk4/stable/

The following code presents a graphical GTK hello-world program in the C programming language. This program has a window with the title «Hello, world!» and a label with similar text.

// helloworld.c
#include <gtk/gtk.h>

/* Callback that will be called when the application is activated */
static void
activate_callback(GApplication *app, gpointer user_data)
{
    GtkWidget *window;
    GtkWidget *label;

    /* Create the main, top level window */
    window = gtk_window_new();

    /* Give it the title */
    gtk_window_set_title(GTK_WINDOW(window), "Hello, world!");

    /* Set the window's default size */
    gtk_window_set_default_size(GTK_WINDOW(window), 200, 100);

    /* Assign the variable "label" to a new GTK label,
     * with the text "Hello, world!" */
    label = gtk_label_new("Hello, world!");

    /* Plot the label onto the main window */
    gtk_window_set_child(GTK_WINDOW(window), label);

    /* Make the application aware of the window.
     * The application process will continue to run until all
     * windows are closed */
    gtk_application_add_window(GTK_APPLICATION(app), GTK_WINDOW(window));

    /* Make sure that everything, window and label, are visible */
    gtk_widget_show(window);
}

int main (int argc, char *argv[])
{
    /* Create our test application */
    GtkApplication *application = gtk_application_new("org.wikipedia.gtktest", 0);

    /* Connect our handler to the "activate" callback, which will be called
     * when the application is activated by the user, e.g. on first start */
    g_signal_connect(application, "activate", G_CALLBACK(activate_callback), NULL);

    /* Run the application and return its status */
    return g_application_run(G_APPLICATION(application), argc, argv);
}

Needs installing the libraries first in Debian or derivatives:

$ sudo apt-get install libgtk-4-dev

Using pkg-config in a Unix shell, this code can be compiled with the following command:

$ cc -Wall $(pkg-config --cflags --libs gtk4) helloworld.c -o helloworld

Invoke the program:

$ ./helloworld

History[edit]

Linux[edit]

GTK was originally designed and used in the GNU Image Manipulation Program (GIMP) as a replacement of the Motif toolkit; at some point Peter Mattis became disenchanted with Motif and began to write his own GUI toolkit named the GIMP toolkit and had successfully replaced Motif by the 0.60 release of GIMP.[40] Finally GTK was re-written to be object-oriented and was renamed GTK+.[41] This was first used in the 0.99 release of GIMP. GTK was subsequently adopted for maintenance by the GNOME Foundation, which uses it in the GNOME desktop environment.

The GTK 2.0.0 release series introduced new features which include improved text rendering using Pango, a new theme engine, improved accessibility using the Accessibility Toolkit, transition to Unicode using UTF-8 strings, and a more flexible API. Starting with version 2.8, GTK 2 depends on the Cairo graphics library for rendering vector graphics.

GTK version 3.0.0 included revised input device handling, support for themes written with CSS-like syntax, and the ability to receive information about other opened GTK applications.

The ‘+’ was dropped returning to simply ‘GTK’ in February 2019 during a Hackathon.[42]

macOS[edit]

With Quartz-backend[43] GTK is available in macOS.[44]

Windows[edit]

  • After GTK 2.24.10 and 3.6.4 Development of Windows with Installer was closed by Gnome. Installation of MSYS2 on Windows is a good way to use actual GTK.[45]
  • GTK 2.24.10 and 3.6.4 is available in Internet, but very buggy and limited against actual versions.[46][47]
  • A version for Windows 64-bit is prepared by Tom Schoonjans with 2.24.33 (actual like Linux) and 3.24.24 (actual like Linux) from January 2021 available.[48]
  • Windows 10’s Fall Creators Update includes Windows Subsystem for Linux (WSL). With Linux distributions like Ubuntu or Debian available from the Microsoft Store and an X server like Xming or VcXsvr, thousands of programs like GTK 2 or 3 can run with X or terminal support.

OpenVMS[edit]

HP stated that their goal was to merge the needed OpenVMS changes into the GTK Version 1.3 development stream,[49] however this never materialised. The latest version of GTK for OpenVMS is version 1.2.10.[50]

GTK 4[edit]

One of the cardinal novelties implemented during the GTK 4 development cycle (i.e. GTK 3.92, etc.) has been the removal of customization option for the user side (like individual keyboard shortcuts that could be set in GTK+ 2), the delegation of functionality to ancillary objects instead of encoding it into the base classes provided by GTK.

  • the event handling from signal handlers described by GtkWidget is delegated to event controllers
  • the rendering is delegated to GtkSnapshot objects
  • the layout mechanism from GtkWidget is delegated to GtkLayoutManager

In 2018-Jan-26 at DevConf.cz Matthias Clasen gave an overview of the then current state of GTK 4 development, including a high-level explanation of how rendering and input worked in GTK 3, what changes were being made to GTK 4, and the reasons for those changes. Examples of things that have become possible with GTK 4 were given as well.[51]

Releases[edit]

Legend:

Old version

Older version, still maintained

Latest version

Latest preview version

Future release

Release series Initial release Major enhancements Latest minor version
1.0 1998-04-13[52] First stable version 1.0.6
1.2 1999-02-25[53] New widgets:

  • GtkFontSelector
  • GtkPacker
  • GtkItemFactory
  • GtkCTree
  • GtkInvisible
  • GtkCalendar
  • GtkLayout
  • GtkPlug
  • GtkSocket
1.2.10
2.0 2002-03-11[54] GObject

Overall support for UTF-8

2.0.9
2.2 2002-12-22[55] Multihead support 2.2.4
2.4 2004-03-16[56] New widgets:

  • GtkFileChooser
  • GtkComboBox
  • GtkComboBoxEntry
  • GtkExpander
  • GtkFontButton
  • GtkColorButton
2.4.14
2.6 2004-12-16[57] New widgets:

  • GtkIconView
  • GtkAboutDialog
  • GtkCellView

The last to support Windows 98/Me

2.6.10
2.8 2005-08-13[58] Most widgets are rendered by Cairo 2.8.20
2.10 2006-07-03[59] New widgets:

  • GtkStatusIcon
  • GtkAssistant
  • GtkLinkButton
  • GtkRecentChooser

Print support: GtkPrintOperation

2.10.14
2.12 2007-09-14[60] GtkBuilder 2.12.12
2.14 2008-09-04[61] JPEG 2000 load support 2.14.7
2.16 2009-03-13[62] New widget: GtkOrientable

Caps Lock warning in password entry

Improvements on GtkScale, GtkStatusIcon, GtkFileChooser

2.16.6
2.18 2009-09-23[63] New widget: GtkInfoBar

Improvement on file chooser, printing

To remove much of the necessary IPC between the X11 application and the X11 server, GDK is rewritten (mainly by Alexander Larsson) to use «client-side windows», i.e., the GdkWindow, which every widget must have, belongs now to the client

2.18.9
2.20 2010-03-23[64] New widgets:

  • GtkSpinner
  • GtkToolPalette
  • GtkOffscreenWindow

Improvement on file chooser, keyboard handling, GDK

Introspection data is now included in GTK

2.20.1
2.22 2010-09-23[65] GdkPixbuf moved to separate module

Most GDK drawing are based on Cairo

Many internal data are now private and can be sealed in preparation to GTK 3

2.22.1
2.24 2011-01-30[66] New widget: GtkComboBoxText which had previously been a custom widget shipped with Gtkmm

The CUPS print backend can send print jobs as PDF

GtkBuilder has gained support for text tags and menu toolbuttons and many introspection annotation fixes were added

Migrating from GTK+ 2.x to GTK+ 3

2.24.32
(2018-01-08)
3.0 2011-02-10[67] Development and design of the GTK 3 release of the toolkit started in February 2009 during the GTK Theming Hackfest held in Dublin[68]

  • The first draft of the development roadmap was released on 9 April 2009[69]

Completed mostly Project Ridley

  • the attempt to consolidate several libraries that were external to GTK+
  • including libgnome, libgnomeui, libgnomeprint22, libgnomeprintui22, libglade, libgnomecanvas, libegg, libeel, gtkglext, and libsexy[70]

All the rendering is done using Cairo

GDK became more X11 agnostic

XInput2, theme API is based on Cascading Style Sheets (CSS), worsening the achievable performance for 60 Hz frame rates

3.0.12
3.2 2011-09-25[71] New widgets:

  • GtkLockButton
  • GtkOverlay

New Font Chooser dialog

New experimental backends:

  • Wayland
  • HTML5 (named «Broadway»)
3.2.4
3.4 2012-03-26[72] Menu support in GtkApplication

A new color chooser

Added support for touch devices

Added support for smooth scrolling

GtkScrolledWindow will do kinetic scrolling with touch devices

macOS support is improved

This is the first version of GTK 3 that works well on Windows

The Wayland backend is updated to the current Wayland version

Spin buttons have received a new look

Accessibility: the treeview accessible support is rewritten

More complete CSS theming support

3.4.4
3.6 2012-09-24[73] New widgets:

  • GtkSearchEntry
  • GtkMenuButton
  • GtkLevelBar

Vertical spin buttons

CSS animations, blur shadows

Support for cross-fading and transitions in themes

3.6.5
3.8 2013-03-25[74] Wayland 1.0 stable support

Support for the broadwayd server

Improved theming

Better geometry management

Touch improvements

Support with the window manager for the frame synchronization protocol

GdkFrameClock added[75]

3.8.9
3.10 2013-09-23[76] New widgets:

  • GtkHeaderBar
  • GtkPlacesSidebar
  • GtkStack
  • GtkStackSwitcher
  • GtkRevealer
  • GtkSearchBar
  • GtkListBox

Support for Wayland 1.2

  • maximization
  • animated cursors
  • multiple monitors
  • settings
  • custom surfaces
  • frame synchronization

Added:

  • client-side decorations
  • scaled output support on high-dpi screens
  • fine-adjustment mode for scrolling

Removed:

  • support for the Motif DND protocol
  • support for multiple screens per display
  • gdk_window_get_display
  • gtk_widget_push_composite_child

Tear-off menu-items, plus many GTK settings

The modern GTK drawing model

3.10.9
3.12 2014-03-25[77] Client-side decorations[78]

Support for Wayland 1.5

New widget: GtkPopover (an alternative to menus and dialogs)

3.12.2
3.14 2014-09-22[79] GtkInspector (a copy of gtkparasite) introduced[80][81]

Improved support for gestures/multi-touch merged[82][83]

Deprecated:[84]

  • GtkMisc
  • GtkAlignment
  • GtkArrow
  • GdkColor
  • Style regions
  • support for .icon files
  • gdk_window_flush
  • drawing outside of begin/end paint

Most widgets converted to use gestures internally

Wayland supports GNOME Shell classic mode[85]

3.14.15
3.16 2015-03-22[86] GDK supports rendering windows using OpenGL for X11 and Wayland using libepoxy

New widgets:

  • GtkGLArea
  • GtkStackSidebar
  • GtkModelButton
  • GtkPopoverMenu

Scrolling overhauled (scrollbar hidden by default[87])

Experimental Mir backend[88]

3.16.7
3.18 2015-09-23[89] Add CSS node infrastructure

More filechooser design refresh and better filechooser search

Dropped Windows XP support

Model support for list and flow box

Kinetic touchpad scrolling

Touchpad gestures (Wayland)

gtk-builder-tool utility

Output-only windows

3.18.9
3.20 2016-03-21[90] Further Integration of CSS nodes[91]

Move drag and drop down to GDK

New widget: GtkShortcutsWindow (shows keyboard shortcuts and gestures of an application)

3.20.10
3.22 2016-09-21[92] Last 3.x release[25]

Wayland tablet support is merged,[93] support for graphics tablets is considered feature complete[94]

GTK 3.22 shall be as rock-stable (and hence «boring») as GTK 2[32][95][96]

for 3+ years
3.22.29
3.24 2018-09-03[97] 3.22 was supposed to be the last version of GTK 3 series

  • 3.24 was mainly released to ease migrating from GTK+ 3.x to GTK+ 4

Dependency bumps – require:

  • libepoxy 1.4
  • pango 1.41

New font chooser features:

  • allow setting OpenType font features
  • show examples for OpenType font features
  • allow selecting OpenType font variations
  • support levels of details for selection

New Emoji features:

  • support a completion popup for Emoji
  • drop Ctrl-Shift-e shortcut

Other new APIs: gdk_window_move_to_rect

Wayland: use anonymous shared memory on FreeBSD

Backported event controllers from GTK 4:

  • GtkEventControllerScroll
  • GtkEventControllerMotion
  • GtkEventControllerKey
  • GtkGestureStylus

Deprecate a few APIs that are gone in GTK 4:

  • focus chains in GtkContainer
  • stepper sensitivity in GtkRange
3.23.0
3.23.1
3.23.2
3.23.3
3.24.0
…3.24.5
3.24.14

3.24.29

3.90 2017-03-31[98] GTK Scene Graph Kit (GSK) merged[5]

Remove any API marked as deprecated

  • before (2016-09-22) vs. after

Heavy development

  • break API & ABI[95][96]

A new Vulkan-renderer augments the old Cairo-renderer[99]

3.89.1

3.89.2
3.89.4
3.89.5
3.90

3.92 2017-10-18[100][101] As GNOME 3.26 was released already on September 13, 2017,[102] it was not based on GTK 3.92.

GNU autotools was replaced with Meson.

3.91.0

3.91.1
3.91.2
3.92.1

3.94 2018-06-26[103] 3.93

  • GdkScreen, GdkVisual removed
  • GdkDeviceManager replaced by GdkSeat
  • Clipboard handling is moved from GTK to GDK
  • GdkEvent is converted to an opaque GObject
  • the GL renderer in GSK is substantially completed, and is now on par with the Vulkan renderer
  • the use of GdkPixbuf in APIs is reduced
    • and the GskTexture object is moved to GDK as GdkTexture, to take its place
  • the Wayland backend now implements the KDE server-side decoration protocol
  • Broadway is ported to GSK.

GdkWindow renamed to GdkSurface

New abstraction for drawable content: GdkPaintable

There is support for displaying media with:

  • GtkVideo
  • GtkMediaFile
  • GtkMediaStream
  • GtkMediaControls
3.93
3.94.0
3.96 2019-05-07[104] The gtk4-builder-tool simplify command has gained a --3to4 option to convert GTK3 ui files to GTK4; though with AMTK menus, toolbars or other objects like GtkShortcutsWindow are created programmatically (not with a *.ui file), but with convenient APIs.[105]

GtkWidget can now use a GtkLayoutManager for size allocation

  • layout managers can optionally use layout children holding layout properties
  • GtkBinLayout, GtkBoxLayout, GtkGridLayout, GtkFixedLayout and GtkCustomLayout are currently available
  • more layout manager implementations will appear in the future

Focus handling has been rewritten, and focus-change event generation has been unified with crossing events

Events have been simplified and are just used for input:

  • expose events have been replaced by a GdkSurface::render signal
  • configure events have been replaced by a GdkSurface::size-changed signal
  • map events have been replaced by a GdkSurface::mapped property
  • gdk_event_handler_set has been replaced by a GdkSurface::event signal
  • key events no longer contain a string
  • events on unmapped widgets are ignored
3.96.0
3.98 2020-02-10[104]
  • Performance improvements
  • Drag and drop refactoring
  • Moving GDK towards Wayland
  • Removals
    • GtkMenu, GtkToolbar and similar classes have been replaced by GMenu.
  • Additions
    • Emoji chooser
    • Text widgets now have undo stacks
    • A new layout manager[106]
3.98.5
3.99.0 2020-07-31[107]
  • Introduced successor to Accessibility Toolkit (ATK).[108] The new approach will implement WAI-ARIA (World Wide Web Consortium (W3C) Accessibility Initiative – Accessible Rich Internet Applications).
  • Updated headers to use standard C types instead of GLib types
  • New widgets
  • Fixes and improvements[107]
3.99.4
4.0 2020-12-16[109] 4.0.2
4.2 2021-03-30[110]
4.4 2021-08-23[111]
4.6 2021-12-30[112]
4.8 2021-12-30[113]

See also[edit]

  • Client-Side Decoration
  • List of widget toolkits
  • GDK – the GIMP Drawing Kit lies between the xlib and the GTK library, handling basic rendering such as drawing primitives, raster graphics (bitmaps), cursors, fonts, as well as window events and drag-and-drop functionality
  • gtkmm – C++ bindings for GTK
  • Qt – cross platform framework and toolkit
  • Xojo – cross-platform development tool and framework
  • Enlightenment Foundation Libraries (EFL) – widget toolkit written for the Enlightenment window manager
  • FLTK – a light, cross-platform, non-native widget toolkit
  • FOX toolkit – a fast, open source, cross-platform widget toolkit
  • IUP – a multi-platform toolkit for building native graphical user interfaces
  • Ultimate++
  • Visual Component Library (VCL)
  • Vala – an object-oriented programming language with a self-hosting compiler that generates C code and uses the GObject system.
  • wxWidgets — a cross-platform GUI toolkit whose goal is to directly use each platform’s native graphic API whenever possible.

References[edit]

  1. ^ «The GTK Open Source Project on Open Hub: Languages Page». www.openhub.net.
  2. ^ a b Bassi, Emmanuele (6 February 2019). «Project rename to «GTK»«. mail.gnome.org. GNOME mailinglist. Retrieved 7 February 2019.
  3. ^ The GTK+ Team. «GTK+ Features». Archived from the original on 25 May 2019. Retrieved 8 September 2014.
  4. ^ «Documentation». www.x.org.
  5. ^ a b «Projects/GTK/Roadmap — GNOME Wiki!». wiki.gnome.org.
  6. ^ «GTK 4.0 – GTK Development Blog». Retrieved 18 October 2021.
  7. ^ «GTK+ 3 Reference Manual». Retrieved 15 July 2017.
  8. ^ «Using GTK+ with Broadway». GNOME Developer. GNOME. Retrieved 6 March 2018.
  9. ^ «Broadway — GitHub symbiose/symbiose Wiki». GitHub. Retrieved 6 March 2018.
  10. ^ «GTK+ to Use Cairo Vector Engine». Retrieved 27 December 2009.
  11. ^ «Gtk: Migrating from GTK 2.x to GTK 3». docs.gtk.org. Retrieved 16 June 2022. All drawing in GTK 3 is done via Cairo.
  12. ^ «Matthias Clasen DevConf.cz 2018 talk about GTK+ 4» (PDF). 26 January 2018.
  13. ^ «Introducing GtkInspector». 15 May 2014.
  14. ^ «Another GtkInspector update». 11 July 2014.
  15. ^ «Debian — Package Search Results — gazpacho». packages.debian.org.
  16. ^ «Nothing-personal — A development site for Crow Designer, GuiLoader and Rally — Google Project Hosting». Archived from the original on 24 January 2013. Retrieved 17 February 2014.
  17. ^ The GTK+ Team. «GTK+ Language Bindings». www.gtk.org. Archived from the original on 25 May 2019. Retrieved 3 June 2017.
  18. ^ a b «Gtk# is a Mono/.NET binding to the cross platform Gtk+ GUI toolkit and the foundation of most GUI apps built with Mono: mono/gtk-sharp». 16 November 2019 – via GitHub.
  19. ^ «Download Gtk#». The GTK+ Project.
  20. ^ «‘Bansheegeddon’ may see Banshee, Mono dropped from Ubuntu default». ITWorld. Retrieved 31 August 2015.
  21. ^ «GNOME Quick SWOT Analysis». The GNOME Project. Retrieved 18 March 2014.
  22. ^ «GTK+ and GNOME Mailing Lists». The GNOME Project. Retrieved 4 December 2011.
  23. ^ «About». GNOME Users And Developers European Conference (GUADEC). Archived from the original on 4 October 2011. Retrieved 3 December 2011.
  24. ^ «GNOME Languages». Ohloh. Black Duck Software. Retrieved 22 May 2014.
  25. ^ a b «Versioning and long term stability promise in GTK». GTK development blog. 1 September 2016.
  26. ^ «GTK+ 3.24 To Deliver Some New Features While Waiting For GTK4». www.phoronix.com.
  27. ^ «GTK 4.0». GTK development blog. 16 December 2020.
  28. ^ «Development release GIMP 2.99.2 is out». Gimp news. 6 November 2020.
  29. ^ «Build system change GTK’s master branch». mail.gnome.org.
  30. ^ «How Does One Create A Gtk+ Application? – Morten Welinder». blogs.gnome.org. Retrieved 3 June 2017.
  31. ^ mclasen (20 November 2015). «A GTK+ update». Goings on.
  32. ^ a b «GUADEC2013: Benjamin Otte talks about GTK+». GUADEC.
  33. ^ Larabel, Michael (12 January 2014). «The Biggest Problem With GTK & What Qt Does Good». Phoronix. Retrieved 10 September 2014.
  34. ^ Hong Jen Yee (26 March 2013). «PCManFM Qt 0.1.0 released». Retrieved 10 September 2014.
  35. ^ «Audacious — An Advanced Audio Player». audacious-media-player.org.
  36. ^ Lindgren, John (6 May 2014). «Ugly window decorations and how to fix them (GTK 3.12)». Retrieved 21 October 2014.
  37. ^ Gerald Combs (15 October 2013). «We’re switching to Qt». Retrieved 19 August 2015.
  38. ^ «GTK+». WxWidgets Compared To Other Toolkits.
  39. ^ «GTK+ TTY Port». Slashdot. Retrieved 31 August 2010.
  40. ^ «LinuxWorld — Where did Spencer Kimball and Peter Mattis go?». Archived from the original on 17 April 1999. Retrieved 19 August 2013.{{cite web}}: CS1 maint: bot: original URL status unknown (link)
  41. ^ «What is the + in GTK+?». 2011. Archived from the original on 26 March 2012. Retrieved 18 March 2014.
  42. ^ «Rename some references to GTK+ (d080be3e) · Commits · GNOME / gtk». gitlab.gnome.org.
  43. ^ «Projects/GTK/OSX — GNOME Wiki!». wiki.gnome.org.
  44. ^ «GTK Download: Mac OS X». www.gtk.org.
  45. ^ «GTK Download: Windows». www.gtk.org.
  46. ^ «GTK+ for Windows Runtime Environment». SourceForge.
  47. ^ «GTK+». www.tarnyko.net.
  48. ^ «GTK+ for Windows Runtime Environment Installer (fork from http://gtk-win.sourceforge.net): tschoonj/GTK-for-Windows-Runtime-Environment-Installer». 19 November 2020 – via GitHub.
  49. ^ «HP OpenVMS systems — GTK+».
  50. ^ «HP OpenVMS systems — GTK+».
  51. ^ https://mclasen.fedorapeople.org/gtk4-devconf2018.pdf[bare URL PDF]
  52. ^ Amundson, Shawn T. (13 April 1998). «ANNOUNCE: GTK+ 1.0.0 Released!». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  53. ^ Amundson, Shawn T. (25 February 1999). «ANNOUNCE: GTK+ and GLib 1.2.0 Released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  54. ^ Taylor, Owen (11 March 2002). «GTK+-2.0.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  55. ^ Taylor, Owen (22 December 2002). «GTK+-2.2.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  56. ^ Taylor, Owen (16 March 2004). «GTK+-2.4.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  57. ^ Clasen, Matthias (16 December 2004). «GTK+-2.6.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  58. ^ Clasen, Matthias (13 August 2005). «GTK+ 2.8.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  59. ^ Clasen, Matthias (3 July 2006). «GTK+ 2.10 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  60. ^ Clasen, Matthias (14 September 2007). «GTK+ 2.12 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  61. ^ Clasen, Matthias (4 September 2008). «GTK+ 2.14.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  62. ^ Clasen, Matthias (13 March 2009). «GTK+ 2.16.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  63. ^ Clasen, Matthias (23 September 2009). «GTK+ 2.18.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  64. ^ Clasen, Matthias (23 March 2010). «GTK+ 2.20.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  65. ^ Clasen, Matthias (23 September 2010). «GTK+ 2.22.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  66. ^ Clasen, Matthias (20 January 2011). «GTK+ 2.24.0». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  67. ^ Clasen, Matthias (10 February 2011). «GTK+ 3.0.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  68. ^ «Gtk+ 3.0 Theming API Hackfest». Silicon Island. Retrieved 3 June 2017.
  69. ^ «Gtk+ 3 roadmap draft». Retrieved 3 June 2017.
  70. ^ «Attic/ProjectRidley — GNOME Wiki!». wiki.gnome.org.
  71. ^ Clasen, Matthias (25 September 2011). «GTK+ 3.2.0». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  72. ^ Clasen, Matthias (26 March 2012). «GTK+ 3.4.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  73. ^ Clasen, Matthias (24 September 2012). «GTK+ 3.6.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  74. ^ Clasen, Matthias (25 March 2013). «GTK+ 3.8.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  75. ^ «Frame clock: GDK 3 Reference Manual». developer.gnome.org.
  76. ^ Clasen, Matthias (23 September 2013). «GTK+ 3.10.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  77. ^ Clasen, Matthias (25 March 2014). «GTK+ 3.12 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  78. ^ «Client-side decorations in themes | Goings on».
  79. ^ Clasen, Matthias (22 September 2014). «GTK+ 3.14.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  80. ^ Matthias Clasen (15 May 2014). «GtkInspector Author’s blog entry». Retrieved 17 May 2014.
  81. ^ «GtkInspector in GNOME wiki». 15 May 2014. Retrieved 17 May 2014.
  82. ^ «Merging gestures into 3.14». 23 May 2014. Retrieved 23 May 2014.
  83. ^ «RFC: gestures». 4 March 2014. Retrieved 23 May 2014.
  84. ^ «gtk+ 3.13.2». 27 May 2014.
  85. ^ «gtk+ 3.13.3». 24 June 2014.
  86. ^ Clasen, Matthias (22 March 2015). «GTK+ 3.16.0 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  87. ^ online, heise. «Linux-Desktop: Neues Gnome zeigt Nachrichten oben». heise online. Retrieved 3 June 2017.
  88. ^ «GTK+ 3.16.0 released». mail.gnome.org. Retrieved 3 June 2017.
  89. ^ Nestor, Marius (24 September 2015). «GTK+ 3.18.0 Officially Released as Part of the GNOME 3.18 Desktop Environment». Softpedia. Retrieved 25 May 2019.
  90. ^ Clasen, Matthias (21 March 2016). «GTK+ 3.20». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  91. ^ «GTK+ 3.20 – Style Classes and Element Names». 20 November 2015.
  92. ^ Clasen, Matthias (21 September 2016). «GTK+ 3.22 released». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  93. ^ «GTK+ Wayland tablet support is merged – Carlos Garnacho».
  94. ^ «hutterer input». www.x.org.
  95. ^ a b «Gtk 4.0 will not be stable until Gtk 4.6». 13 June 2016.
  96. ^ a b «Gtk 5.0 will not be stable until Gtk 5.6». 14 June 2016.
  97. ^ Clasen, Matthias (3 September 2018). «gtk+ 3.24.0». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  98. ^ Clasen, Matthias (31 March 2017). «gtk+ 3.90.0». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  99. ^ «Commits · master · GNOME / gtk». GitLab.
  100. ^ Clasen, Matthias (18 October 2017). «gtk+ 3.92.1». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  101. ^ Clasen, Matthias (23 October 2017). «GTK+ 3.92». GTK Development Blog. Retrieved 25 May 2019.
  102. ^ «GNOME 3.26 Released». 13 September 2017.
  103. ^ Clasen, Matthias (26 June 2018). «gtk+ 3.94.0». GNOME Mail Services (Mailing list). Retrieved 20 May 2019.
  104. ^ a b Clasen, Matthias (7 May 2019). «gtk 3.96». GNOME Mail Services (Mailing list). Retrieved 28 May 2019.
  105. ^ «Introducing amtk».
  106. ^ Clasen, Matthias (13 February 2020). «GTK 3.98». GTK+ Development Blog. Retrieved 18 February 2020.
  107. ^ a b Clasen, Matthias (9 June 2021). «gtk 4.3.1». FTP Releases (Mailing list). Retrieved 10 July 2021.
  108. ^ «Emmanuele Bassi / guadec-2020». GitLab.
  109. ^ Clasen, Matthias (16 December 2020). «gtk 4.0.0». GNOME Mail Services (Mailing list). Retrieved 16 December 2020.
  110. ^ Clasen, Matthias (30 March 2021). «gtk 4.2.0». GNOME Mail Services (Mailing list). Retrieved 30 March 2021.
  111. ^ Clasen, Matthias (23 August 2021). «gtk 4.4.0». GNOME Mail Services (Mailing list). Retrieved 23 January 2022.
  112. ^ Clasen, Matthias (30 December 2021). «gtk 4.6.0». FTP Releases (Mailing list). Retrieved 23 January 2022.
  113. ^ Clasen, Matthias (6 September 2022), gtk 4.8.0, retrieved 11 January 2023

Bibliography[edit]

  • Krause, Andrew (23 April 2007), Foundations of GTK+ Development (1st ed.), Apress, ISBN 978-1-59059-793-4
  • Wright, Peter (15 May 2000), Beginning GTK+ and GNOME (1st ed.), Peer Information, ISBN 978-1-86100-381-2
  • Logan, Syd (6 September 2001), Gtk+ Programming in C (1st ed.), Prentice Hall, ISBN 978-0-13-014264-1

External links[edit]

Wikimedia Commons has media related to GTK.

  • Official website Edit this at Wikidata

Содержание

  1. Установка платформы GTK
  2. Добавление приложения GTK
  3. Next Steps
  4. Особенности платформы
  5. Значок приложения
  6. Собственные формы
  7. Проблемы
  8. Как установить GTK + 3.0 на Windows?
  9. 6 ответов
  10. А как по-нормальному установить GTK3 на Windows?
  11. Установка библиотеки GTK+ в среде Code::Blocks под Windows
  12. Микро-мануал по Glade
  13. Как установить?
  14. Windows
  15. Arch Linux
  16. Ubuntu
  17. Приступаем к работе
  18. Написаник кода
  19. Пробный запуск

Установка платформы GTK

preview

Xamarin.Forms Поддержка GTK # предоставляется сообществом. Дополнительные сведения см. в разделе Xamarin.Forms поддержка платформ.

Прежде чем начать, создайте новое Xamarin.Forms решение или используйте существующее Xamarin.Forms решение, например гамеофлифе.

хотя в этой статье рассматривается добавление приложения GTK # в Xamarin.Forms решение в VS2017 и Visual Studio для Mac, его также можно выполнить в monodevelop для Linux.

Добавление приложения GTK

выполните эти инструкции, чтобы добавить приложение GTK #, которое будет выполняться на рабочем столе Windows:

add new project

в обозреватель решений щелкните правой кнопкой мыши новый проект GTK и выберите пункт управление NuGet пакетами. Перейдите на вкладку Обзор и выполните поиск Xamarin.Forms 3,0 или более.

select forms nuget package

Выберите пакет и нажмите кнопку » установить «.

select forms platform nuget package

Выберите пакет и нажмите кнопку » установить «.

в обозреватель решений щелкните правой кнопкой мыши имя решения и выберите пункт управление пакетами NuGet для решения. Выберите вкладку Обновление и Xamarin.Forms пакет. Выберите все проекты и обновите их до той же Xamarin.Forms версии, которая используется в проекте GTK.

reference shared project

В диалоговом окне Диспетчер ссылок нажмите кнопку Обзор и перейдите в папку C:Program Files (x86) GtkSharp2.12lib и выберите atk-sharp.dll, gdk-sharp.dll, glade-sharp.dll, glib-sharp.dll, gtk-dotnet.dll и gtk-sharp.dll файлов.

reference gtk libraries

В проекте GTK переименуйте Class1. CS в Program. CS.

Этот код инициализирует GTK # и Xamarin.Forms создает окно приложения и запускает приложение.

В Обозреватель решений щелкните правой кнопкой мыши проект GTK и выберите пункт свойства.

в окне свойства перейдите на вкладку приложение и измените раскрывающийся список тип выходных данных на Windows приложение.

change project output type

В Обозреватель решений щелкните правой кнопкой мыши проект GTK и выберите назначить Project запуска. нажмите клавишу F5, чтобы запустить программу с помощью отладчика Visual Studio на рабочем столе Windows:

gtk gameoflife

Выполните эти инструкции, чтобы добавить приложение GTK #, которое будет выполняться на рабочем столе Mac:

в Панель решения щелкните правой кнопкой мыши пакеты > добавить пакеты. для проекта GTK и добавьте Xamarin.Forms пакет NuGet предварительной версии 3,0 или выше.

select forms nuget package

select forms platform nuget package

Обновите другие проекты платформы для использования той же Xamarin.Forms версии, которая используется в проекте GTK.

В панель решения щелкните правой кнопкой мыши ссылки > изменить ссылки. для проекта GTK и добавьте ссылку на Xamarin.Forms проект (.NET Standard или Shared Project).

reference shared project

Измените файл Program. CS проекта GTK, чтобы он соответствовал следующему коду:

Этот код инициализирует GTK # и Xamarin.Forms создает окно приложения и запускает приложение.

В панель решения щелкните правой кнопкой мыши проект GTK и выберите назначить Project запуска.

на панели инструментов Visual Studio для Mac нажмите кнопку пуск (треугольная кнопка, напоминающая кнопку воспроизведения), чтобы запустить приложение.

gtk gameoflife

Next Steps

Особенности платформы

Вы можете определить, на какой платформе Xamarin.Forms выполняется приложение, с помощью XAML или кода. Это позволяет изменять характеристики программы при выполнении в GTK #. В коде Сравните значение Device.RuntimePlatform с Device.GTK константой (которая равна строке «GTK»). При наличии совпадения приложение будет выполняться в GTK #.

В XAML можно использовать OnPlatform тег для выбора значения свойства, характерного для платформы:

Значок приложения

Значок приложения можно задать при запуске:

Для GTK # доступны разнообразные темы, которые можно использовать из Xamarin.Forms приложения:

Собственные формы

Собственные формы позволяют Xamarin.Forms ContentPage использовать производные страницы в собственных проектах, включая проекты GTK #. Это можно сделать путем создания экземпляра страницы, производной от класса, ContentPage и преобразования ее в собственный тип GTK # с помощью CreateContainer метода расширения:

Дополнительные сведения о собственных формах см. в разделе собственные формы.

Проблемы

Это предварительная версия, поэтому следует рассчитывать на то, что все готово к производству. Сведения о текущем состоянии реализации см. в разделе состояние, а сведения о текущих известных проблемах см. в разделе ожидающие & известные проблемы.

Источник

Как установить GTK + 3.0 на Windows?

попытка настроить GTK + 3.0 на Codeblocks Win7. Имея некоторые проблемы с поиском, как именно это сделать.

веб-сайт GTK направляет вас в msys2. Кажется, когда-то была прямая загрузка на сайте GTK для пакета Windows all-in-one, которого больше нет.

следуя инструкциям, установленным и обновленным msys2, я не вижу ссылки на GTK+ в установленных файлах или на веб-сайте mysys, на который вас направляет GTK.

его, кажется, очень linuxy с точки зрения того, что излишне и глупо непонятно делать что-то, что должно быть простым. Может быть, я что-то пропустил, но не должно ли это быть так просто, как загрузка zip-папки, извлечение и настройка путей?

с этой скоростью id будет быстрее изучать C++ и идти с Qt.

вопрос в названии, я поражен, что мне нужно задать вопрос, похоже, что google должен был полностью охватить, но все, что я нахожу, относится к загрузке это больше не доступно на веб-сайте GTK. Я не могу найти информацию о msys2 и GTK+ 3.0.

6 ответов

Добро пожаловать, пользователи Google из будущего! Поскольку я написал этот ответ, сайт GTK+ теперь имеет официальные инструкции по установке это охватывает то, что я сказал ниже, но с более подробной информацией и меньше боли. Вместо этого обратитесь к этой странице. Приведенный ниже Ответ был сохранен по историческим причинам.

проблема с веб-сайтом GTK+ заключается в том, что некому поддерживать эти двоичные дистрибутивы. Предыдущий двоичный дистрибутив для Windows был для GTK+ 3.6, который был выпущен, я считаю, еще в 2012 году, если не раньше. Текущая версия 3.16 и 3.18 буквально дней от освобождения. MSYS2-единственный поддерживаемый механизм установки, и он обновляется достаточно часто.

это, как говорится, вам нужно установить GTK+ отдельно, если вы используете маршрут MSYS; MSYS не поставляется с GTK+ из коробки. Начать с

Это должно дать вам список возможных пакетов установите, включая библиотеки GTK+ как для 32-разрядного, так и для 64-разрядного MinGW. Я забыл их точные имена.

как только вы найдете тот, который вы хотите использовать

для ее установки. Затем откройте 32-разрядную или 64-разрядную оболочку MinGW из папки MSYS меню Пуск, чтобы начать разработку.

Если вы хотите традиционную IDE для программирования GTK+, найдите Gnome Builder или Anjuta. Для графического дизайнера GUI, посмотрите Поляну.

Аллилуйя, я нашел нормальную версию без linux для получения GTK для windows.

кто-то был достаточно любезен, чтобы загрузить в dropbox файлы GTK, просто загрузите и извлеките. Вот ссылка для всех, кто сталкивается с этой катастрофой GTK/msys2.

эти файлы действительно должны быть доступны на странице загрузки GTK Windows, это вызывает доверие.

закрыть нить, Вива-окна.

Я согласен, что сообщество GNOME немного нагло к этому моменту. Они сделали установку GTK+ почти такой же, как установка Linux, которая немного похожа на предоставление вам pepsi в mcdonalds.

хуже всего то, что это заставляет вас использовать свое собственное дерьмо до такой степени, что они даже говорят вам, какую IDE выбрать, как вы будете строить свое приложение, что будет в вашем приложении.. (Ничего личного, я на самом деле всегда предпочитаю Linux, я просто непредвзято)

теперь, чтобы быть конкретным, вы явно упомянули Codeblocks. Не используйте проект GTK+ code::block, он ужасно устарел. Вы можете, конечно, изменить скрипт или создать свой собственный, но он все равно будет чтобы замедлить вас, и мы, программисты, ценим наше время (я думаю)

процедура установки (по сей день) GTK3 ver. 3.22.16 в windows 7 для использования с Code:: Blocks оказывается довольно простым. Первая загрузка MSYS2 и введите в оболочке msys2:

(Enter y для подтверждения) Тогда

и получите такой результат:afa05e91ef56b5fd2d43403243a3289a

несколько дней назад я отправляю электронное письмо одному из сопровождающих gtk для помощи с vs 2017, и вот письмо. После этого я решил использовать gtk 2.0 в windows

gtk-3.0.lib (или gtk-3.lib)

gdk-3.0.lib (или ГДК-3.lib)

и, возможно, fontconfig.lib и freetype.lib, как, вероятно, msys64 сборки включают поддержку для них.

вы также потребуется ссылка на любые другие библиотеки, которые вы можете использовать для ваше задание. Добавьте эти библиотеки с помощью трейлинга’; ‘ перед %(AdditionalDependencies) (не удалять %(AdditionalDependencies))

с благословением и ура!

Если вы ищете проекты, которые, кроме Msys2, предоставляют современные, совместимые с MSVC GTK3 вещи, вы должны проверить gvsbuild и Microsoft vcpkg. Под капотом первый использует python, а позже использует cmake.

Источник

А как по-нормальному установить GTK3 на Windows?

38011:587767716

106730:584747104

собери dll-ки gtk+ и всех нужных либ, добавь их в архив/инсталлятор твоего приложения и никаких инструкций не надо.

38011:587767716

А нету готового пакета?

106730:584747104

p

Нужно было брать Qt.

38011:587767716

А потом еще все такие удивляются, а что это приложения на чисто виндовом WPF пишут, а не на таком хорошем и опенсорсном gtk. Потому что поставить gtk на винду это мозготрах. Почему нельзя было сделать виндовый msi для библиотеки и заголовочных файлов?

А вот и невероятно ценные советы подъехали. Старый добрый ЛОР.

55786:1122802619

Это действительно ценный совет, так как официальных сборок у gtk для windows нет.

Самое разумное написать авторам rawtherapee и darktable и попытаться выяснить у них, как они осуществляли сборку с gtk3 под виндоус. Остальные разработчики ряда софтину давно забили на портирование для виндоус из-за того, что из софтины используют gtk3.

p

Не благодари.
Кстати, на троечку так и не перешёл, разрабатываю под двойку. Со своими бурлениями подзабросил самого себя. =)

55786:1122802619

Он ж написал, что это не здорово.

66069: 1008545487

А потом еще все такие удивляются, а что это приложения на чисто виндовом WPF пишут, а не на таком хорошем и опенсорсном

Qt for Python, например.

p

будь программистом. Собери и заапрувь на chocolatey.org

p

Почему нельзя было сделать виндовый msi для библиотеки и заголовочных файлов?

Потому, что гному плевать на винду (и мак). Ваш КО.

p

Готового инсталлятора «under Windows» нет.

p

GNOME Foundation занимается организацией конференций и хакфестов а также раздает зарплату временно избранной дирекции и сисадминам. Разработкой GNOME занимается сообщество, каждый участник которого действует абсолютно независимо в своей компетенции.

55786:1122802619

Я знаю что нет, поэтому gtk3 за пределами linux почти никому и не нужен.

86121:847358151

А вот и невероятно ценные советы подъехали.

*делая вид, что не понимает сарказма*

Если б ТС выбрал Qt*, то его бы в начале треда сразу послали на https://qt.io/download и /thread

* Хотя скорее всего сего треда и не было бы вообще.

p

55786:1122802619

Счастливой оффлайн установки.

55786:1122802619

p

Не то скинул. Сделать Windows инсталятор для простых людей можно изменив скрипты для gedit на Windows например:

70760:22608379

Я CPack-ом копирую dll-ки из MSYS, CMakeLists.txt.

Сам MSYS ставлю отсюда http://www.msys2.org/ с pacman-ом.

Хз, есть ли способ проще.

38011:587767716

Потому что WPF под mono нет и не планируется.

38011:587767716

Тем не менее, в nuget gtk# таки добавили

38011:587767716

Ну так под винду Visual Studio это фактически стандарт

152187:231922283

Госпаде! Типичный лор. То «СТАВЬ КУЛЬТИ СТАВЬ КУЛЬТИ СТАВЬ КУЛЬТИ. 111!!», то «собирай генту GTK+».

55786:1122802619

Ну так под винду gtk+ далеко не стандарт.

55786:1122802619

А ты читал исходное сообщение ТС? Он знает об этом способе. Уж действительно типичный ЛОР.

На самом деле ему должны были посоветовать таскать собранные им либы со своим приложением в случае винды.

152187:231922283

P.S. А вы думали, что у Qt какие-то нанотехнологии? точно так же либо линковать статически, либо копипастить

P.S.S. Зависимости в винду бы, зависимости.

38011:587767716

Так потому и не дали ссылку, что далеко не все про нее в курсе.

124989: 1329017509

На Windows я без vcpkg не обхожусь. Прекрасная штука, оно устанавливает либы из сорцов и поддерживается CMake и Visual Studio. GTK+3 там тоже есть.

А если ты свой софт распространяешь, то делай как все вендузятники, кидай либы в директорию с софтом.

93413: 741110967

Попробуй gtk из vcpkg

75820: 720198039

Чем бы это помогло?

75820: 720198039

Да сделай ты по-человечески, собери сам, делов-то.

p

54109: 2054175765

Почему нельзя было сделать виндовый msi для библиотеки и заголовочных файлов?

Потому что разработчики не заинтересованы в поддержке этой ОС

Хм. Когда то давно ставил Gajim на windows. Так там инсталятор предлагал установить gtk в систему.

просто добавь dll-ки и всё, нашёл проблему.

Можешь из msys2, можешь из vcpkg.

63534: 1217599142

А как по-нормальному установить GTK3 на Windows?

Вообще-то ты должен забандлить GTK+-либу и все сопутствующие в установщике для Windows. Так делает Inkscape и тот же GIMP. GTK+ не является системной библиотекой Windows.

63534: 1217599142

И да, с Qt точно так же нужно будет тягать с собой все Qt-либы в дистрибутиве приложения. Или ты будешь рассматривать вариант аля сходи на официальный сайт скачай 1ГБ этих хрустящих файлов? Вот то-то и оно.

38011:587767716

А как насчет установить gtk в систему, если не установлена?

63534: 1217599142

Это не Windows Way. И не macOS Way.

Системные либы в этих ОС это то, что предоставляет сама корпорация, а не какие-то там частные компании или ты.

Методы аля «положите эти библиотеки в system32 и будет вам счастье» уже давно прошли.

Хочешь распространять своё приложение для пользователя удобно? Делай как все: создавай инсталлятор (или portable-архив), который содержит все необходимые библиотеки необходимых версий для запуска твоего приложения. В винде/макоси действует принцип «поставил и работает», а не обновил библиотеку и всё к херам поломалось, потому что приложение было заточено только под определённую версию либы.

Исключением из этого разве что Java является. Да и то, куча приложений под Windows (и кстати Linux тоже) бандлят с собой весь JRE, а то и JDK.

Остальные разработчики ряда софтину давно забили на портирование для виндоус из-за того, что из софтины используют gtk3.

Можно ещё посмотреть Meld, Gajim. Там всё в скриптах. Для Гаджим даже портабельный вариант.

p

Так там инсталятор предлагал установить gtk в систему.

Рунтайм скорее всего. Это несколько другая штука, чем та, о которой вопрошает ТС.

p

Методы аля «положите эти библиотеки в system32 и будет вам счастье» уже давно прошли.

Ничего не прошло. Ты вправе использовать систему как считаешь возможным. Другой вопрос, что среднестатистический юзверь обленился и не хочет совершать простые движения.

посмотрел на биндинги GTK к разным языкам и похоже программисты на D, тоже не любят таскать либы с собой.

Источник

Установка библиотеки GTK+ в среде Code::Blocks под Windows

Скачайте и установите Code::Blocks. Для установки удобно выбрать пакет с уже интегрированным компилятором MinGW (но не обязательно, MinGW можно установить отдельно). Скачайте библиотеку GTK+. Поскольку структура каталогов библиотеки совпадает со структурой MinGW, имеет смысл их объединить, т.е. произвести разархивирование в тот же каталог, куда установлен MinGW.

Для того чтобы Code::Blocks подхватил компилятор GCC из пакета MinGW достаточно прописать в системной переменной окружения PATH дополнительные пути.

Например, если MinGW установлен в корень диска C:, то пути следующие

в переменной PATH их необходимо дописать в конец существующей записи через символ «;», т.е. вот так:

set path 01

Поскольку библиотека GTK+ была разархивирована в папку MinGW, этих записей будет достаточно, в противном случае, необходимо добавить в PATH пути к библиотеке GTK+.

CB include

CB lib

Нажимаем кнопку «OK». Настройка завершена. Можно создать первый свой проект на С с использованием библиотеки GTK+.

Пройдите все шаги мастера, правильно выбирая и вписывая значения. В готовом файле main.c напишите следующую программу:

Источник

Микро-мануал по Glade

Glade — это приложение, позволяющее создавать GUI на Gtk+ не кодом, самостоятельно выделяя память для того или иного виджета, инициализируя его и помещая в контейнер, а при помощи визуального конструктора.

Данная программа имеет открытый исходный код, распространяется абсолютно бесплатно.

Как установить?

Windows

После установки, вы сможете найти glade.exe где-то в папке с msys или запустить его из того же терминала командой: glade

Arch Linux

Ubuntu

Тоже элементарно ^ sudo apt install glade

Приступаем к работе

Все инструкции по работе с Glade в посте выполнены в форме GIF и также описаны в текстовой форме

Для начала необходимо запустить программу и создать новый документ (форму пользовательского интерфейса). Это делается нажатием на кнопку в левом верхнем углу программы. После этого можно начинать создавать UI.

image loader

Давайте начнем с простого и создадим обычное окно(GtkWindow) с заголовком и дефолтным размером при создании, например 640*320px. Для этого дважды тыкаем в рабочей области программы и выбираем необходимый виджет из списка. Он появиться не только в рабочей области, но и в дереве виджетов(расположено в левой части программы). Так же откроются свойства только что созданного объекта(правая часть экрана).

Для каждого виджета необходимо задать ID (в качестве ID окна будем использовать ID:main_window), чтобы в дальнейшем имелась хоть какая-то возможность с ним работать. Это делается в свойствах виджета(правая часть программы). Там же мы установим Title(Заголовок) для окна(Пусть будет «Title for main window») и его Default Width(Стандартная ширина) и Default Height(Стандартная высота).

image loader

Как видите, в свойствах виджета есть несколько вкладок — General(основное), Packing(компоновка), Common(Общее) и Signals(Сигналы).

Во вкладке General находятся основные свойства того или иного виджета. Для Label — текст надписи и ее выравнивание, для Window — заголовок, стандартный размер и тд.

Вкладка Packing предназначена для виджета, помещенного в какой-либо контейнер и определяет положение этого виджета.

В Common расположены атрибуты стилей; там можно определить ID и класс объекта для того, чтобы задать какому-то виджету необходимый внешний вид при помощи CSS.

Signals предназначено для связывания сигналов со слотами. Тут можно указать, какая функция будет вызываться при нажатии на кнопку, вводе текста и тому подобному.

Так что же делать дальше? В Gtk+ виджет для его отображения необходимо помещать в контейнер(чтучка для компоновки виджетов). Window сам по себе является контейнером, но в него можно положить только что-то одно, а для наглядности нам нужно нечто большее, чем просто одинокая кнопка.

Попробуем создать сетку(GtkGrid) (контейнер, куда можно очень много чего положить). Для этого тыкаем на контейнер(в нашем случае окно), в который мы хотим положить новый виджет(сетка) дважды и выбираем из появившегося списка нужный. Для сетки установим количество столбцов и строк, а также сделаем так, чтобы столбцы были одинаковой ширины, а строки одинаковой высоты(сделаем их гомогенными).

image loader

Обратите внимание на дерево объектов. Оно явно показывает, что сетка(GtkGrid), которой я забыл назначить ID(сделайте это сами), помещена в окно main_window.

Теперь давайте создадим кнопку и наконец поэксперементируем с вкладкой Packing. Тыкаем ту клеточку сетки, куда хотим поместить кнопку, выбираем GtkButton в списке, устанавливаем ID и текст, отображаемый на кнопке, после чего идем во вкладку компоновки и экспериментируем с расположением кнопки в сетке. Можно задать координату клетки начала виджета и количество клеток, на которое этот виджет будет растянут в сетке. Кнопка в итоге будет находиться в самой верхней левой клетке и растянута на всю длину окна.

image loader

По аналогии создадим надпись(GtkLabel) с неким текстом. Разместим ее под кнопкой, но будем растягивать не на всю ширину окна, а лишь на 4/5 его часть…

image loader

Помним, что мы не забываем указывать ID для каждого виджета)

Теперь импортируем что-то из внешнего мира, например картинку. Для этого нам нужна сама картинка… Как насчет этого прекрасного гуся?

3f9bcacadea08760ca0d7

Создаем объект GtkImage и указываем путь до необходимой картинки(относительно от файла c ui. Там есть кнопочка с карандашиком, она открывает меню выбора файла, — используйте ее. Не удалось показать работу этим методом, так как при записи экрана эта менюшка странно себя ведет).

image loader

На данный момент она не отобразилась, но она есть. Не забываем про нее.

Еще в Gtk+ есть встроенные иконки. Давайте создадим картинку с такой иконкой. Для этого так же создаем GtkImage, но вместо FileName(Имя файла) необходимо будет выбрать IconName(Имя иконки).

image loader

Создадим еще парочку простых виджетов — поле для ввода текста(GtkEntry) и кнопку выбора цвета(GtkColorButton).

image loader

Теперь создадим еще кое-что интересное и перейдем непосредственно к тому, как сильно Glade сокращает код. Сделаем кнопку, по нажатию на которую, будет открываться всплывающее меню. Сначала показываю как, потом объясняю:

image loader

Для начала создаем GtkMenuButton — это как раз кнопка, с нужным функционалом, и присваиваем ей id. Потом переходим в меню popover (Именно popover. Popup является устаревшим) в свойствах этой кнопки. Этот параметр позволяет задать меню, которое будет открываться по нажатию. Так как такового мы еще не создали, нажимаем кнопку New.

Создастся новый виджет — виджет выпадающего меню. Положим в него просто надпись, хотя туда можно добавить контейнер, и тоже что-то с этим сделать.

Теперь сигналы. Подключим 2 штуки. Первый — сигнал выхода из приложения при закрытии окна. Для этого в дереве объектов выбираем нужный виджет и тыкаем на него. Переходим во вкладку signals, выбираем нужный сигнал и пишем к нему имя функции-обработчика. Имя сигнала закрытия окна(уничтожения виджета окна) — destroy. Функцию обработчик назовём onExit.

image loader

Теперь добавим также сигнал для кнопки с надписью привет. Он должен срабатывать при нажатии(clicked) и вызывать функцию onBtnClicked.

image loader

Теперь делаем предпросмотр и сохраняем файл с интерфейсом:

image loader

Был создан файл Unsaved1.glade. Это и есть наш интерфейс. Теперь перейдем к коду

Написаник кода

Для универсальности написан на C, но тем не менее работает там, где есть биндинг к Gtk+ (gtkmm, gtkd, gtkrust и тд).

Пробный запуск

Ну вот наконец мы и подабрались к окончанию статьи. Надеюсь она была полезной для вас. Вот, что в итоге вышло:

Источник

[ 中文 ]

gtkmm on Microsoft Windows

Contents

  1. gtkmm on Microsoft Windows

    1. Download
    2. Installer Descriptions
    3. Using the Installers

      1. MinGW DLLs
      2. MSVC++ DLLs
      3. GTK+ DLLs
      4. Using MinGW
      5. Using MSVC++ (Microsoft Visual Studio)
    4. Updating
    5. Installer Side Effects
    6. Silent Installs
    7. Redistributing

      1. gtkmm
      2. GTK+ runtime
      3. libxml++
      4. libglademm
    8. Rebuilding

Download

There is an Installer available for gtkmm on Microsoft Windows. Since version 2.22 there are also 64 bit versions available.

Installer Descriptions

gtkmm-win32-devel-*.exe contains the dynamic libraries (DLLs) of gtkmm, libxml++, libglademm and all their dependencies, plus header files, import libraries and documentation. You need this to compile applications or libraries that use gtkmm on Windows, with either MinGW or MSVC++.

gtkmm-win64-devel-*.exe contains the same for 64 bit builds with mingw-w64 or MSVC’s x64 target platform.

Using the Installers

To use the runtime environment, simply execute the installer and make sure the «Add the gtkmm runtime directory to the PATH variable» option is checked. This is required for Windows to find the gtkmm DLL files. If you know what you do, then you can also uncheck that option. This can be useful if you have multiple versions of gtkmm installed (for example, both runtime and development DLLs) and want to choose which one to use by setting the PATH variable manually. After installing, you are able to run programs using gtkmm.

First, execute the installer. When you intend to use MinGW, then install to a path not containing spaces (so C:Program FilesSomething is a bad idea) since pkg-config has problems with this. See also this mailing list post. To use the development environment, you need to know with which compiler you want to compile your application. MinGW-W64 (note that despite its name the MinGW-W64 project also provides a toolchain to build 32 bit executables) and Visual C++ 2005 (or later) are supported. Older versions of Visual C++ are not supported, and are not likely to work.

The package contains the GTK+ runtime and its dependencies, and also GTK+ header files, import libraries and documentation. You don’t need to install anything else to use the package.

All required DLLs are installed into the bin/ subfolder in the installation directory. Additional DLLs are installed into the redist/ subfolder. These are required when redistributing your application, see the section below.

MinGW DLLs

The DLLs prefixed with lib, such as libgtkmm-2.4-1.dll, are required if you build your application with MinGW.

The MinGW DLLs were built with the MinGW-W64 32 Bit or 64 Bit toolchain, respectively. It is not guaranteed that other versions of g++ will work with the built binaries, but they probably do if they are configured to use the same ABI (such as SJLJ stack unwinding). Please let us know if you make positive or negative experiences with these binaries and another version of the GNU compiler.

The DLLs from installer contain debug symbols which might be useful when debugging your application with gdb.

MSVC++ DLLs

The DLLs without a lib prefix, such as gtkmm-vc80-d-2_4.dll are MSVC++ DLLs. The DLL naming convention is moduletoolset-(d-)abiversion.dll, where module means the library the DLL contains (such as glibmm, cairomm or gtkmm), toolset means the compiler used to build the DLL (which implies the runtime it is linked against) and abiversion is the ABI version of the library.

Debug DLLs have a d between the toolset and the abiversion. They are required for running the Debug configuration of MSVC++-built applications whereas the DLLs without d are required for the Release configuration.

The MSVC++ DLLs with toolset vc80 (built with MSVC++ 2005) are linked against the runtime DLLs MSVCR80.DLL / MSVCP80.DLL, the ones with vc90 as toolset (built with MSVC++ 2008) are linked against the runtime DLLs MSVCR90.DLL / MSVCP90.DLL and the ones with vc100 as toolset (built with MSVC++ 2010) are linked against the runtime DLLs MSVCR100.DLL / MSVCP100.DLL.

The MSVC++ release DLLs are the same in the runtime and development installers.

GTK+ DLLs

For GTK+ and its dependencies (these are most DLLs that do not end on *mm, except libsigc-2.0.dll and xml++-toolset-2_6.dll) the convention mentioned above is not valid. There is only one DLL for each library, but this one works with both MinGW and MSVC++ (both Debug and Release Target), because they are C libraries, not C++.

Using MinGW

To build your application with MinGW, we recommend that you use the MSYS shell. With MSYS, you can compile your program as on Unix, for example via g++ foo.cc -o foo `pkg-config —cflags —libs gtkmm-2.4`.

You could also use the normal Windows command line to do this, but the backticks syntax would not work, so you would need to run pkg-config separately and insert the correct flags by hand.

The installer only provides native Windows DLLs, not Cygwin DLLs. Instructions on how to build native gtkmm Windows applications using cygwin would be welcome.

Using MSVC++ (Microsoft Visual Studio)

The following are rough instructions on how to setup MSVC++ to build gtkmm applications. There are more detailed instructions on the Using gtkmm with Microsoft Visual Studio page.

To build your application with MSVC++, open the «Property manager» via «View / Property Manager» in the menu, then right click the debug target, select «Add existing property sheet», then navigate to the location to which you installed gtkmm, descend into the MSVC directory and choose the corresponding .vsprops file (or .props for MSVC 2010) for your Visual Studio Version. Users of MSVC++ 2005 should use the gtkmm-vc80-d-2_4.vsprops file, users of MSVC++ 2008 should use the gtkmm-vc90-d-2_4.vsprops file and users of MSVC++ 2010 should use the gtkmm-vc100-d-2_4.vsprops file. Then, do the same for the release target, but choose the version without d in the filename. The gtkmm-2.4.vsprops and gtkmm-2.4d.vsprops should no longer be used. These are the same as the ones for MSVC++ 2005 (the vc80 ones) and are only provided for backwards compatability, so that MSVC can still find them for projects that are still using these.

gtkmm-win32-msvc-propsheet.png

To prevent random crashes with MSVC++ 2005 in the debug version, go to «Project / $MyProject properties» in the menu, make sure the Debug configuration is active (upper left corner of the dialog), then go to «Configuration Properties / C/C++ / Code generation» and choose «Multi-threaded Debug DLL» as Runtime Library. This is because your application needs to be built against the same runtime library as the gtkmm (debug) DLLs.

gtkmm-win32-msvc-codegen.png

You might also want to change «Generate Debug Info» in «Linker / Debugging» to Yes to be able to debug your application. Both options don’t seem to be default for the Debug configuration for new, empty projects in MSVC++ 2005. This seems to have been fixed in MSVC++ 2008 and MSVC++ 2010.

gtkmm-win32-msvc-debuginfo.png

To work around a compiler bug in Visual Studio (https://bugzilla.gnome.org/show_bug.cgi?id=158040), the /vd2 flag needs to be passed to the compiler. This is already done automatically for your application if you use the property sheets as mentioned above. However, you need to remember to do this if you don’t use the property sheets for some reason.

Updating

When new versions of the installers are released, you can simply execute the new installer to update your gtkmm installation. The installer will detect a previous version of gtkmm and uninstall it first.

Installer Side Effects

Apart from installing files and directories to the hard disk, the installer does the following:

  • Set the GTKMM_BASEPATH environment variable. This is used to refer to the gtkmm header and library files in the MSVC property sheets.

  • Add the path to the gtkmm DLLs to the PATH environment variable. This is required to be able to execute built gtkmm applications.

  • Add the HKEY_LOCAL_MACHINESoftwareMicrosoftWindowsCurrentVersionUninstallgtkmm key to the registry, with a few subkeys. This makes gtkmm appear in the list of installed applications in the «Add or Remove Programs» window.

  • Add the HKEY_LOCAL_MACHINESoftwaregtkmm key to the registry. This is used by the uninstaller to find the place where gtkmm has been installed.

  • Add the HKEY_CURRENT_USERSoftwaregtkmm key to the registry. This is used to remember the installer language to use for updates.

For user-local installation, the registry keys are stored under HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE.

Silent Installs

For silent installations (installation without requiring user intervention, using the /S flag) the following options can be used:

  • /D=GTKMM_PATH: Sets the installation path to GTKMM_PATH.

  • /SET_ENVVARS: If this flag is set, then the path to the gtkmm DLL files will be added to the PATH environment variable.
  • /ALLUSERS: Install for all users instead of a user-local installation.

This is mostly mentioned for completeness. When distributing your application, we suggest to redistribute the required gtkmm files with your application instead of running the gtkmm installer because this is less error-prone and more convenient to end users. See the section below for what files you need when redistributing gtkmm with your application.

Redistributing

For your application to work out of the box on other machines that don’t have GTK+ or gtkmm installed you need to ship the following files with your application, perhaps using an installer. We suggest that you keep the directory structure of the installed files, so that GTK+ can correctly find its configuration files and modules.

This means that you’ll have bin/, etc/, lib/ and share/ folders at the lop level of your package. Since all the DLLs are contained in bin/, this is were your application executable belongs as well. So it might end up in C:Program FilesYourApplicationbinYourApplication.exe on the target machine, depending on the installation directory. Most applications using GTK+ on Windows do this, such as GIMP.

When redistributing your application, use the DLLs from the redist/ directory in the gtkmm installation path, not from the bin/ directory. The redist/ ones are stripped, which means debugging symbols have been removed, so that the files are smaller in size. Also, they have been compiled with «-O2», which means they are optimized for speed. The DLLs in bin/ are built with «-O0 -g» which is required for debugging. Debugging optimizated code often confuses gdb. When you use MSVC++ instead of MinGW, then the MSVC++ gtkmm DLLs are in bin/ instead of redist/. This is because it is common to execute both Debug and Release versions from the IDE, so all the DLLs need to be in the PATH.

Please do not install the DLL files into a global system path, such as C:WindowsSystem32. Since GTK+ locates files it needs at runtime based on the path where the GTK+ DLL resides, you might also need to install other files, such as modules (image loaders, input modules, etc.) or theme settings into the same path. Also, if two different applications do this, then uninstalling one would need to make sure to keep the files in System32, so the other application does not break. Furthermore, the past has shown that new Glib or GTK+ versions on Windows are not always fully compatible with old ones, even though they try to be. This is improving, however.

gtkmm

You will need all these files for gtkmm:

  • binlibgtkmm-2.4-1.dll, bingtkmm-vc80-2_4.dll, bingtkmm-vc90-2_4.dll or bingtkmm-vc100-2_4.dll (depending on whether you built your application with MinGW, MSVC++ 2005, MSVC++ 2008 or MSVC++ 2010.)

  • binlibgdkmm-2.4-1.dll, bingdkmm-vc80-2_4.dll, bingdkmm-vc90-2_4.dll or bingdkmm-vc100-2_4.dll

  • binlibpangomm-1.4-1.dll, binpangomm-vc80-1_4.dll, binpangomm-vc90-1_4.dll or binpangomm-vc100-1_4.dll

  • binlibatkmm-1.6-1.dll, binatkmm-vc80-1_6.dll, binatkmm-vc90-1_6.dll or binatkmm-vc100-1_6.dll

  • binlibcairomm-1.0-1.dll, bincairomm-vc80-1_0.dll, bincairomm-vc90-1_0.dll or bincairomm-vc100-1_0.dll

  • binlibgiomm-2.4-1.dll, bingiomm-vc80-2_4.dll, bingiomm-vc90-2_4.dll or bingiomm-vc100-2_4.dll

  • binlibglibmm-2.4-1.dll, binglibmm-vc80-2_4.dll, binglibmm-vc90-2_4.dll, or binglibmm-vc100-2_4.dll

  • binlibsigc-2.0-0.dll, binsigc-vc80-2_0.dll, binsigc-vc90-2_0.dll, binsigc-vc100-2_0.dll

GTK+ runtime

This is required by gtkmm, so you will need all of these, too. A more detailed explanation of what all these libraries provide is available at the GTK+ for Windows page.

  • binlibgtk-win32-2.0-0.dll

  • binlibgdk-win32-2.0-0.dll

  • binlibgdk_pixbuf-2.0-0.dll

  • binlibpango-1.0-0.dll

  • binlibpangocairo-1.0-0.dll

  • binlibpangoft2-1.0-0.dll

  • binlibpangowin32-1.0-0.dll

  • binlibatk-1.0-0.dll

  • binlibcairo-2.dll

  • binlibgio-2.0-0.dll

  • binlibgmodule-2.0-0.dll

  • binlibgobject-2.0-0.dll

  • binlibgthread-2.0-0.dll

  • binlibglib-2.0-0.dll

  • binlibexpat-1.dll

  • binlibfontconfig-1.dll

  • binlibpng14-14.dll

  • binintl.dll (32 bit) or binlibintl-8.dll (64 bit)

  • binfreetype6.dll (32 bit) or binlibfreetype-6.dll (64 bit)

  • binzlib1.dll

  • binlibgcc_s_sjlj-1.dll (only when using the MinGW gtkmm DLLs)

  • etcpangopango.modules: List of registered pango modules.

  • etcgtk-2.0gtk.immodules: List of available input modules for GTK+.

  • etcgtkrc: Contains the GTK+ theme to use (the «MS-Windows» theme).

  • libgtk-2.02.10.0* (All files and directories within this directory): These are GTK+ modules such as image loaders and theme engines loaded at runtime.

  • sharethemesMS-Windowsgtk-2.0gtkrc: Theme settings for the MS-Windows GTK+ theme.

  • sharelocale*: Translations of glib and GTK+ into several languages.

libxml++

If your program uses libxml++ then you will additionally need:

  • binlibxml++-2.6-1.dll, binxml++-vc80-2_6.dll, binxml++-vc90-2_6.dll or binxml++-vc100-2_6.dll

  • binlibxml2-2.dll

libglademm

If your program uses libglademm, then you will additionally need:

  • binlibglademm-2.4-1.dll, binglademm-vc80-2_4.dll, binglademm-vc90-2_4.dll or binglademm-vc100-2_4.dll

  • binlibglade-2.0-0.dll

  • binlibxml2-2.dll

Rebuilding

To rebuild the gtkmm binaries or to recreate the installer, see the Building gtkmm on Windows.

«Дружим» open source библиотеку с Microsoft Visual Studio 2010. Будет немножко кода С/C++, займет минут 15-20, уровень подготовки  — включить мозг, немного английского, возможность скачать 30Мб с сайта, установленная студия. Приступаем…
Почитал Qt, понял, что лицензия, на которой нельзя официально зарабатывать (без вложений) совсем не катит, решил поглядеть GTK+. Напомню, это библиотеки для создания графического интерфейса пользователя («окошки»). Основные отличия от конкурента (по требованиям ВУЗа) MFC: простота, кроссплатформенность (переносимость кода без изменений с Windows на Linux или Mac). При этом у крайнего свойства один жирный «+» — подходят мануалы для любой платформы)

Хочу оставить себе на память, а может кого еще и просветить про установку и настройку библиотеки gtkmm и Microsoft Visual Studio 2010. Перво-наперво скачать библиотеку под свою платформу с оф. сайта (http://www.gtk.org), можно сразу все (All-in-one bundles). Куда-нибудь это «вываливаем», к примеру C:GTK, потом вас ждет долгий незабываемый «секас» с переназначением путей в MVS. Для начала, создайте консольный поект, внутри файл .cpp или .c (зависит от языка, ибо GTK работает в рамках стандарта C), в него закиньте тестовый текст:

#pragma comment(lib,»gthread-2.0.lib»)

#pragma comment(lib,»gtk-win32-2.0.lib»)

#pragma comment(lib,»glib-2.0.lib»)

#pragma comment(lib,»gobject-2.0.lib»)

#pragma comment(lib,»gdk-win32-2.0.lib»)

#pragma comment(lib,»gdk_pixbuf-2.0.lib»)

#pragma comment(lib,»pango-1.0.lib»)

#pragma comment(lib,»pangowin32-1.0.lib»)

#pragma comment(lib,»intl.lib»)

#pragma comment(lib,»gtk-win32-2.0.lib»)

#pragma comment(lib,»gobject-2.0.lib»)

int main (int argc, char *argv[])

{

GtkWidget* button;

gtk_init (&argc, &argv);

window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

gtk_widget_show(window);

gtk_main();

return 0;

}

Теперь необходимо зайти  настройки проекта и прописать пути линковщику на хэдеры библиотеки. (Project->ИМЯ_ПРОЕКТА Properties->Configuration Properties->VC++ Directories) Теперь в Include directories нужно вписать пути к хэдерам, если вы установили в C:GTK, то можете сэкономить минут 15-20 жизни и кучу нервов. Должно оказаться примерно так:
$(VCInstallDir)include;$(VCInstallDir)atlmfcinclude;$(WindowsSdkDir)include;$(FrameworkSDKDir)include;C:GTKincludeatk-1.0;C:GTKincludegdk-pixbuf-2.0;C:GTKlibgtk-2.0include;C:GTKincludepango-1.0;C:GTKlibglib-2.0include;C:GTKincludeglib-2.0;C:GTKincludecairo;C:GTKincludegtk-2.0;C:GTKincludegail-1.0;C:GTKincludegtk-2.0gtk;C:GTKinclude;$(IncludePath)

Library directories нужно указать на C:GTKlib, возможно bin

Как итог — компиляция должна успешно завершаться, но у меня выдало ошибки, ругалась, что не могла найти dll-файлы из C:GTKbin, хотя пытался и в Library directories это вписывать…ну так или иначе, файлы должны библиотеки необходимы исполняемому файлу для того, чтобы программа работала. Поэтому кинул все dll из bin в корень проекта, читал, что кто-то в System32 закидывают. Интересный шаг, но переустановку системы такая прога не переживет и нуждается в инсталляторе. Хз, прорвемся, сейчас не до этого)
В итоге у нас появилось самое квадратное в мире окно. И консоль, куда ошибки и отладочную информацию можно посылать. Полезно, но мешает глазу. Говорят, отца русской демократии должна спасти стока:

#pragma comment(linker,»/SUBSYSTEM:WINDOWS»)
и ее антипод
#pragma comment(linker,»/SUBSYSTEM:CONSOLE»)

Но, что-то не особо спасает. Точнее, дураку понятно, что это можно и в настройках проекта в линковщике найти и поменять изначально. Но привет в том, что тогда (как и любому приложению в Виндах) вместо main() нужно давать функцию WinMain(), у которого совсем другие параметры…. Проблема еще и в параметрах командной строки (argc, argv). Мой выход следующий:

#define DEBUG // Внимание сюда!

#pragma comment(lib,»gthread-2.0.lib»)

#pragma comment(lib,»gtk-win32-2.0.lib»)

#pragma comment(lib,»glib-2.0.lib»)

#pragma comment(lib,»gobject-2.0.lib»)

#pragma comment(lib,»gdk-win32-2.0.lib»)

#pragma comment(lib,»gdk_pixbuf-2.0.lib»)

#pragma comment(lib,»pango-1.0.lib»)

#pragma comment(lib,»pangowin32-1.0.lib»)

#pragma comment(lib,»intl.lib»)

#pragma comment(lib,»gtk-win32-2.0.lib»)

#pragma comment(lib,»gobject-2.0.lib»)

#pragma comment(linker,»/SUBSYSTEM:WINDOWS»)// компилировать в режиме Win, без консоли;

int argc;

char** argv;

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)

#pragma comment(linker,»/SUBSYSTEM:CONSOLE»)

int main (int argc, char *argv[])

{

GtkWidget* window;

const gchar* Title = «Title for window»;

gtk_init (&argc, &argv);

button = gtk_button_new_with_label(BtnText);

window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

gtk_window_set_title(GTK_WINDOW(window),Title);

gtk_widget_show(window);

gtk_main();

return 0;

}

Поясню. Когда у нас РАСКОМЕНТИРОВАНО объявление макроса DEBUG, то у нас проект собирается как консольный (с консолью на фоне и его вытекающими фенечками вроде отладочной печати), т.к. директивой это явно задается и используется заголовок обычной main().
Если же DEBUG оказывается не объявлено (закомментировано), то проект становится виндовой и активен заголовок функции WinMain со всеми ее параметрами. (При этом argc и argv инициализируются чушью, не знаю, на сколько это будет в последствии фатально, но цели я добился — окно появляется без всякой консоли).

Пожалуй, на сегодня все. Гугол рулезззз… =Р

P.S. Написал это скорее как памятку, в подробности функции не вдаюь (там просто создается окно и в крайнем варианте ему устанавливается заголовочная надпись).
В догонку: очень интересное приложение-пример находится в C:GTKbin, имя ему gtk-demo.exe . Программа на GTK, внутри куча подпрограмм и рядом инфо о них и форматированный исходник. Ляпота)

Обновлено

2018-10-27 00:26:11

Совместимость

Windows XP, Windows Vista, Windows 7

Язык

Русский,
Английский,
Немецкий,
Французский,
Украинский,
Белорусский

Описание

GTK+ — это кроссплатформенная библиотека элементов интерфейса. Наряду с Qt является одной из двух наиболее популярных на сегодняшний день библиотек для X Window System.

Внешний вид графических интерфейсов, созданных с использованием GTK+, может конфигурироваться пользователем и/или программистом. При этом настраиваются не только цвета и шрифты, но и способ отображения различных элементов. Достигается это за счёт использования «движков» для вывода на экран. Путём подключения другого движка можно кардинальным образом менять внешний вид программ. Например, некоторые движки могут использовать псевдо-трёхмерный вид, другие — более «плоский» и т. п.

Версии

gvsbuild

CI

This python script helps you build a full GTK library
stack for Windows using Visual Studio. Currently, GTK 3 and GTK 4 are supported.

The script supports multiple versions of Visual Studio — at the moment we are
focusing on VS 2022, but we include projects for other versions, and we gladly
accept patches.

The script focuses on GTK and the surrounding ecosystem (e.g. GStreamer).
However, we are open to adding more libraries as long as the contributor takes
on the responsibility for keeping it up to date. The supported projects are
modules in the
projects
directory.

The script requires a working installation of Visual Studio for Windows
Desktop, Python 3 and
msys2. The script will download any additional tools
required to build the libraries and will use them from a local directory,
without any installation. As of today these tools include cmake, meson, ninja,
nuget and perl.

The script fetches source tarballs for the projects from their original
locations, however in some cases it might be necessary to host a patched tarball
on GitHub. To ensure integrity of the downloaded files, the script checks the
SHA256 hash of each download. Downloads are done using TLS, using SSL
certificates provided by the system, but in case of error the download is tried
again ignoring certificate errors.

Development Environment

Choco

We recommend using Chocolately as a package manager
in Windows.

To install it, open PowerShell as an administrator, then execute:

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

To run local scripts in follow-on steps, also execute
Set-ExecutionPolicy RemoteSigned. This allows for local PowerShell scripts
to run without signing, but still requires signing for remote scripts.

Git

To setup a development environment in Windows install
Git by executing as an administrator:

MSYS2

Both of the development environments in the next steps need MSYS2 installed.

Install MSYS2:

Keep PowerShell open as administrator and execute:

Building GTK

First we will install the gvsbuild dependencies:

  1. Visual C++ build tools workload for Visual Studio 2022 Build Tools
  2. Python

Install Visual Studio 2022

With your admin PowerShell terminal:

choco install visualstudio2022-workload-vctools

Note: Visual Studio versions 2013 (not for all projects), 2015, 2017, 2019, and 2022 are currently supported.

Install the Latest Python

Download and install the latest version of Python:

  1. Install from Chocolately with choco install python with admin PowerShell
  2. Restart your PowerShell terminal as a normal user and check that python --version is correct.

Note: If you are going to install Python using an alternative means, like the
official Windows installers, we suggest to install Python in C:Python3x, for
example C:Python310. Other Python distributions like Miniconda
3
should also work.

Install gvsbuild

The recommended way to install gvsbuild is with pipx. Open a new regular user
PowerShell terminal and execute:

python -m pip install --user pipx
python -m pipx ensurepath
pipx install gvsbuild

Alternatively, you can also use git to clone the repository and install it.
Open a new regular user PowerShell terminal and execute:

mkdir C:gtk-buildgithub
cd C:gtk-buildgithub
git clone https://github.com/wingtk/gvsbuild.git
cd C:gtk-buildgithubgvsbuild
python -m venv .venv
..venvScriptsactivate.ps1
pip install .

Build GTK

In the same PowerShell terminal, execute:

Alternatively, if you want to build GTK 4, execute:

Grab a coffee, the build will take a few minutes to complete.

Add GTK to Your Environmental Variables

$env:Path = "C:gtk-buildgtkx64releasebin;" + $env:Path
$env:LIB = "C:gtk-buildgtkx64releaselib;" + $env:LIB
$env:INCLUDE = "C:gtk-buildgtkx64releaseinclude;C:gtk-buildgtkx64releaseincludecairo;C:gtk-buildgtkx64releaseincludeglib-2.0;C:gtk-buildgtkx64releaseincludegobject-introspection-1.0;C:gtk-buildgtkx64releaselibglib-2.0include;" + $env:INCLUDE

Other Options

For more information about the possible commands run:

To get detailed help on the build command run:

It is possible to set some parameters from a file, e.g. vs2015-release.pro, putting
the @ character before the file name. The file contains the option, one per
line, separated by a carriage return:

--vs-ver
14
--win-sdk
8.1
--configuration
release

Even if the format is not the easier to write or read in this way we eliminate
the problem of escaping spaces is file names and directories. Then you can use
it:

gvsbuild build @vs2015-release.pro gtk3-full

Troubleshooting

If the download of a tarball fails a partial file will not pass the hash check,
delete the file and try again.

OpenSSL

In addition to the setup instructions above, to build OpenSSL you also need the
Visual C++ 2013 Redistributable Package installed. To install it, open PowerShell
as administrator and execute:

choco install vcredist2013

Similar to other packages, you can build OpenSSL by executing:

Dependency Graph

To see and analyze the dependency between the various projects, in text or in a
Graphviz format, use the script deps.py:

gvsbuild deps --graph --gv-file test.gv

Without option a simple dependency of all the projects is printed, as usual with
—help a summary of the options/commands is printed.

License

This build script is licensed under the GPL2.0 license, see the COPYING file for
the full text.

The binaries produced by the build script are licensed under the license terms
of the project that is built (ie glib is LGPL so you can use glib.dll built
with this script under the terms of LGPL).

Patches included in the repository are licensed under the license terms of the
project they apply to.

Credits

This tool originated from a gtk-win32 PowerShell script created by the
HexChat developers for building it for Windows.
Although this project is now archived, you can explore the original project if you
are interested in the history at https://github.com/hexchat/gtk-win32.

Compiling the GTK stack on MSVC would not be possible without the incredible
work by Fan Chun-wei. If you are interested in more
details of how this works, please see Compiling the GTK+ (and Clutter) stack using
Visual C++ 2008 and
later.

Понравилась статья? Поделить с друзьями:
  • Двигающиеся обои на рабочий стол windows 10 космос
  • Дарксайдерс 2 не запускается на windows 10
  • Двигающиеся обои на рабочий стол windows 10 геншин
  • Дано окно папки windows выбери верный ответ
  • Двигающиеся обои на рабочий стол windows 10 аниме