1 <!-- WSDG Chapter User Interface -->
4 <chapter id="ChapterUserInterface">
5 <title>User Interface</title>
7 <section id="ChUIIntro">
8 <title>Introduction</title>
10 Wireshark can be "logically" separated into the backend (dissecting of
11 protocols, file load/save, capturing, ...) and the frontend (the user
12 interface). However, there's currently no clear separation between
13 these two parts (no clear API definition), but this might change in the
17 The following frontends are currently maintained by the Wireshark
21 Wireshark, GTK 2.x based
27 Wireshark, GTK 1.x based (was removed with the Wireshark 1.2.0 release)
30 There exist other Wireshark frontends, not developed nor
31 maintained by the Wireshark development team:
34 Packetyzer (Win32 native interface, written in Delphi and released
36 <ulink url="http://www.paglo.com/opensource/packetyzer"/>)
39 hethereal (web based frontend, not actively maintained and not
43 This chapter is focused on the Wireshark frontend, and especially on
44 the GTK specific things.
48 <section id="ChUIGTK">
49 <title>The GTK library</title>
51 Wireshark is based on the GTK toolkit, see: <ulink url="http://www.gtk.org"/>
52 for details. GTK is designed to hide the details of the underlying GUI in
53 a platform independent way. As this is appreciated for a
54 multiplatform tool, this has some drawbacks, as it will result in a
55 somewhat "non native" look and feel.
58 GTK is available for a lot of different platforms including, but not
59 limited to: Unix/Linux, Mac OS X and Win32. It's the foundation of
60 the famous GNOME desktop, so the future development of GTK should be
62 GTK is implemented in plain C (as is Wireshark itself), and available under
63 the LGPL (Lesser General Public License), being free to used by
64 commercial and noncommercial applications.
67 There are other similar toolkits like Qt, wxwidgets, ..., which could
68 also be used for Wireshark. There's no "one and only" reason for or against
69 any of these toolkits. However, the decision towards GTK was made a
73 At the time this document is written there are two major GTK versions
78 <section id="ChUIGTK1x">
79 <title>GTK Version 1.x</title>
81 Please note: After the creation of the 1.0 branch further development
82 removed support for GTK 1.x!
85 GTK 1.x was the first major release. Today there are 1.2.x and 1.3.x
86 versions "in the wild", with only very limited differences in the API.
89 Advantages (compared to GTK 2.x):
92 available on a lot of different platforms
95 very stable as it's matured for quite a while now
101 the look and feel is a bit old-fashioned
104 not recommended for future developments (last GTK 1.x release in 2004)
107 GTK 1.x depends on the following libraries:
110 GDK (GDK is the abstraction layer
111 that allows GTK+ to support multiple
112 windowing systems. GDK provides drawing and window system facilities
113 on X11, Windows, and the Linux framebuffer device.)
116 GLib (A general-purpose utility
117 library, not specific to graphical user interfaces.
118 GLib provides many useful data types, macros, type conversions,
119 string utilities, file utilities, a main loop abstraction, and so on.)
122 GTK 1.x is working on GLib 1.x (typical for Unix like systems) or 2.x
123 (typical for Win32 like systems).
126 XXX: include Wireshark GTK1 screenshot
131 <section id="ChUIGTK2x">
132 <title>GTK Version 2.x</title>
134 Advantages (compared to GTK 1.x):
137 nice look and feel (compared to version 1.x)
140 recommended for future developments
143 stable (in productive code for years now)
149 not available on all platforms (compared to version 1.x)
152 more dependencies compared to 1.x, see below
155 GTK 2.x depends on the following libraries:
158 GObject (Object library. Basis for GTK and others)
161 GLib (A general-purpose utility
162 library, not specific to graphical user interfaces.
163 GLib provides many useful data types, macros, type conversions,
164 string utilities, file utilities, a main loop abstraction, and so on.)
167 Pango (Pango is a library for internationalized text handling. It centers
168 around the #PangoLayout object, representing a paragraph of text.
169 Pango provides the engine for #GtkTextView, #GtkLabel, #GtkEntry, and
170 other widgets that display text.)
173 ATK (ATK is the Accessibility Toolkit. It provides a set of generic
174 interfaces allowing accessibility technologies to interact with a
175 graphical user interface. For example, a screen reader uses ATK to
176 discover the text in an interface and read it to blind users. GTK+
177 widgets have built-in support for accessibility using the ATK
181 GdkPixbuf (This is a small library which allows you to create #GdkPixbuf
182 ("pixel buffer") objects from image data or image files. Use a
183 #GdkPixbuf in combination with #GtkImage to display images.)
186 GDK (GDK is the abstraction layer that allows GTK+ to support multiple
187 windowing systems. GDK provides drawing and window system facilities
188 on X11, Windows, and the Linux framebuffer device.)
191 XXX: include Wireshark GTK2 screenshot
195 <section id="ChUIGTKCompat">
196 <title>Compatibility GTK versions</title>
198 The GTK library itself defines some values which makes it easy to
199 distinguish between the versions, e.g.:
200 GTK_MAJOR_VERSION and GTK_MINOR_VERSION
201 will be set to the GTK version at compile time inside the gtkversion.h header.
205 <section id="ChUIGTKWeb">
206 <title>GTK resources on the web</title>
208 You can find several resources about GTK.
211 First of all, have a look at: <ulink url="http://www.gtk.org"/> as this
212 will be the first place to look at. If you want to develop GTK related
213 things for Wireshark, the most important place might be the GTK API
214 documentation at: <ulink url="http://library.gnome.org/devel/gtk/stable/"/>.
217 Several mailing lists are available about GTK development, see <ulink
218 url="http://mail.gnome.org/mailman/listinfo"/>, the gtk-app-devel-list
222 As it's often done wrong: You should post a mail to *help* the developers
223 there instead of only complaining. Posting such a thing like "I don't like
224 your dialog, it looks ugly" won't be of much help. You might think about
225 what you dislike and describe why you dislike it and provide a suggestion
232 <section id="ChUIGUIDocs">
233 <title>GUI Reference documents</title>
235 Although the GUI development of Wireshark is platform independent, the
236 Wireshark development team tries to
237 follow the GNOME Human Interface Guidelines (HIG) where appropriate.
238 This is the case, because both GNOME and Wireshark are based on the GTK+
239 toolkit and the GNOME HIG is excellently written and easy to understand.
242 For further reference, see the following documents:
245 GNOME Human Interface Guidelines at:
246 <ulink url="http://library.gnome.org/devel/hig-book/stable/"/>
249 KDE user interface related documents at:
250 <ulink url="http://developer.kde.org/documentation/standards/kde/style/basics/index.html"/>
253 Win32 styleguides available at:
254 <ulink url="http://msdn.microsoft.com/en-us/library/aa511258.aspx"/>
260 <section id="ChUIGTKDialogs">
261 <title>Adding/Extending Dialogs</title>
263 This is usually the main area for contributing new user interface features.
266 XXX: add the various functions from gtk/dlg_utils.h
270 <section id="ChUIGTKWidgetNamings">
271 <title>Widget naming</title>
273 It seems to be common sense to name the widgets with some
274 descriptive trailing characters, like:
277 xy_lb = gtk_label_new();
280 xy_cb = gtk_checkbox_new();
283 XXX: add more examples
286 However, this schema isn't used at all places inside the code.
291 <section id="ChUIGTKPitfalls">
292 <title>Common GTK programming pitfalls</title>
294 There are some common pitfalls in GTK programming.
297 <section id="ChUIGTKShowAll">
298 <title>Usage of gtk_widget_show() / gtk_widget_show_all()</title>
300 When a GTK widget is created it will be hidden by default. In order to
301 show it, a call to gtk_widget_show() has to be done.
304 It isn't necessary to do this for each and every widget created. A call
305 to gtk_widget_show_all() on the parent of all the widgets in question
306 (e.g. a dialog window) can be done, so all of its child widgets will
314 <!-- End of WSDG Chapter User Interface -->