Gtk Marries Ada: the GUI Technology Revolution

Total Page:16

File Type:pdf, Size:1020Kb

Gtk Marries Ada: the GUI Technology Revolution GtkGtk MarriesMarries AdaAda:: TheThe GUIGUI TechnologyTechnology RevolutionRevolution [email protected] OverviewOverview History of GtkAda GtkAda Features Why Gtk Rather Than Other Toolkits? Why GtkAda rather than Gtk+? GtkAdaGtkAda -- HistoryHistory á The GIMP – GNU Photoshop clone á The Gtk+ library – Becomes independent á GtkGlade: a Gtk+ GUI builder á Gnome: a desktop manager á GVD: the GNU Visual Debugger GtkAdaGtkAda FeaturesFeatures ááHigh-level binding to the Gtk+ library – object-oriented – type safety – small and efficient ááHighly portable – Unixes: Linux, Solaris, … – Windows NT ááNative GtkAdaGtkAda FeaturesFeatures (2)(2) ááEvent handling ááDrawing services – Lines, rectangles, … – OpenGL (3D graphics) ááStyle support ááLarge set of widgets GtkAdaGtkAda -- WidgetWidget setset á Two types of widgets – containers and visual objects á About 100 widgets are provided á High-level widgets – notebook, text widget, tree, spin button, table, toolbar, ... GtkAdaGtkAda -- ScreenshotsScreenshots á Ctree GtkAdaGtkAda -- ScreenshotsScreenshots (2)(2) á OpenGL WhyWhy Gtk+?Gtk+? á Portable á Native á Extensible á Open Source á Actively developped á Thread-safe WhyWhy Gtk+?Gtk+? (2)(2) á High level widgets á Easy to use scrolling capabilities á Wide range of users á Very powerful layout capabilities – Complete set of containers á Powerful and easy to use GUI builder á Easy to bind TheThe GUIGUI BuilderBuilder ááMulti-language GUI builder – Language-independent save file (XML). – Code-generation specific to each language. – Dynamic loading of XML files WhyWhy GtkAda?GtkAda? á Compile time checks á Real Object Oriented hierarchy á Code readability á Group most popular Gtk widgets á Can create new types and extend widgets á More extensive documentation GtkAdaGtkAda vsvs Gtk+:Gtk+: ExampleExample #include <gtk/gtk.h> with Gtk.Main; use Gtk.Main; #include <gtk/gtk.h> withwithGtk.Button;Gtk.Main; useuseGtk.Button;Gtk.Main; *HQHULFZLGJHW withwithGtk.Window;Gtk.Button; useuseGtk.Window;Gtk.Button; void main (int argc, 7\SHG:LGJHWwithwithGtk.Enums;Gtk.Window; useuseGtk.Enums;Gtk.Window; void main (charint *argv[])argc, with Gtk.Enums; use Gtk.Enums; { char *argv[]) procedure Hello is {GtkWidget *window; procedureWindow :Hello Gtk_Window; is GtkWidgetGtkWidget *button;*window;8QLTXHQDPHVSDFH ButtonWindow :8VHFODXVHV: Gtk_Button;Gtk_Window; GtkWidget *button; beginButton : Gtk_Button; gtk_init (&argc, &argv); beginInit; windowgtk_init = gtk_window_new(&argc, &argv); (GTK_WINDOW_TOPLEVEL); Gtk_NewInit; (Window, Window_Toplevel); gtk_container_set_border_widthwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL); Set_Border_WidthGtk_New (Window, (Window,Window_Toplevel); 10); gtk_container_set_border_width(GTK_CONTAINER (window), 10); Set_Border_Width (Window, 10); button(GTK_CONTAINER = gtk_button_new_with_label (window), 10); ("Hello World"); Gtk_New (Button, "Hello World"); gtk_container_addbutton = gtk_button_new_with_label (GTK_CONTAINER (window), ("Hello button);World"); AddGtk_New (Window, (Button, Button); "Hello World"); gtk_widget_show_allgtk_container_add (GTK_CONTAINER (window); (window), button); Show_AllAdd (Window,%XLOW (Window); Button);LQ22 gtk_maingtk_widget_show_all ();1RGLVSDWFKLQJ (window); Main;Show_All (Window); } gtk_main (); end Main;Hello; } end Hello; GUIGUI BuilderBuilder SupportSupport withwith GtkAdaGtkAda ááSupport built-in ááTakes advantage of object-oriented features. – Each widget generates its own code ááGenerated sources – easy to read sources (generates new composite widgets) – sources can be modified and regenerated GtkAdaGtkAda:: aa completecomplete GUIGUI SolutionSolution ááPortable ááNative ááEasy to use ááSafe ááObject Oriented ááComes with a GUI builder ááSame look-and-feel.
Recommended publications
  • The Glib/GTK+ Development Platform
    The GLib/GTK+ Development Platform A Getting Started Guide Version 0.8 Sébastien Wilmet March 29, 2019 Contents 1 Introduction 3 1.1 License . 3 1.2 Financial Support . 3 1.3 Todo List for this Book and a Quick 2019 Update . 4 1.4 What is GLib and GTK+? . 4 1.5 The GNOME Desktop . 5 1.6 Prerequisites . 6 1.7 Why and When Using the C Language? . 7 1.7.1 Separate the Backend from the Frontend . 7 1.7.2 Other Aspects to Keep in Mind . 8 1.8 Learning Path . 9 1.9 The Development Environment . 10 1.10 Acknowledgments . 10 I GLib, the Core Library 11 2 GLib, the Core Library 12 2.1 Basics . 13 2.1.1 Type Definitions . 13 2.1.2 Frequently Used Macros . 13 2.1.3 Debugging Macros . 14 2.1.4 Memory . 16 2.1.5 String Handling . 18 2.2 Data Structures . 20 2.2.1 Lists . 20 2.2.2 Trees . 24 2.2.3 Hash Tables . 29 2.3 The Main Event Loop . 31 2.4 Other Features . 33 II Object-Oriented Programming in C 35 3 Semi-Object-Oriented Programming in C 37 3.1 Header Example . 37 3.1.1 Project Namespace . 37 3.1.2 Class Namespace . 39 3.1.3 Lowercase, Uppercase or CamelCase? . 39 3.1.4 Include Guard . 39 3.1.5 C++ Support . 39 1 3.1.6 #include . 39 3.1.7 Type Definition . 40 3.1.8 Object Constructor . 40 3.1.9 Object Destructor .
    [Show full text]
  • Development Environment for the Raspberry Pi Using a Cross Compiling Toolchain and Eclipse | Hertaville 07.10.13 13:37
    Development Environment for the Raspberry Pi using a Cross Compiling Toolchain and Eclipse | Hertaville 07.10.13 13:37 Hertaville Welcome to Hertaville! Development Environment for the Raspberry Pi using a Cross Compiling Toolchain and Eclipse Posted on September 28, 2012 by halherta UPDATED July 15th 2013 In this blog entry the setup of a cross-compiling development environment for the Raspberry Pi will be demonstrated. This will include the Official Raspbian (armhf) cross compiling toolchain (available from github) Eclipse for C/C++ Developers (Linux) We will finally write a simple Hello World program on our development PC, compile it using the cross compiler and then deploy it onto our Raspberry Pi board to run it. I’m going to assume that you have already installed a Raspbian Wheezy image on your RPi board and that you have Linux installed on your desktop PC. For this tutorial I am using the Crunchbang 11 Linux OS (64-bit) on my PC. The instructions provided should work on most Debian/Ubuntu based Linux distributions running directly on a PC or as a a guest operating system via VMWare/ VirtualBox . A remote debugging tutorial; which I consider to be the continuation of this tutorial, can be found here. Finally, Derek Molloy has a great video tutorial on setting up a similar environment for the Beaglebone. Watching this video was incredibly informative and helped me set up this tutorial. So what is a cross compiling toolchain and why use one ? A native compiler such as the default gcc tool on the PC is a compiler that runs on an Intel machine, as well as creates binaries intended to be run on an Intel machine.
    [Show full text]
  • Drawing in GTK+
    CSci493.70 Graphical User Interface Programming Prof. Stewart Weiss Drawing in GTK+ Drawing in GTK+ Background In order to understand how to draw in GTK, you rst have to understand something about how GTK draws widgets, because how GTK draws widgets has an important role in how you design your drawing application. An understanding of how GTK draws widgets is also required if you ever plan to build your own custom widgets. Windows and Clipping Most windowing systems are designed around the idea that an application's visual display lies within a rectangular region on the screen called its window. The windowing system, e.g. Gnome or KDE or Explorer, does not automatically save the graphical content of an application's windows; instead it asks the application itself to repaint 1 its windows whenever it is needed. For example, if a window that is stacked below other windows gets raised to the top, then a client program has to repaint the area that was previously obscured. When the windowing system asks a client program to redraw part of a window, it sends an exposure event to the program that contains that window. An exposure event is simply an event sent from the underlying windowing system to a widget to notify it that it must redraw itself. In this context, a "window" means "a rectangular region with automatic clipping", not a top-level application window. Clipping is the act of removing portions of a window that do not need to be redrawn, or looked at the other way, it is determining which are the only regions of a window that must be redrawn.
    [Show full text]
  • Gnustep-Gui Improvements
    GNUstep-gui Improvements Author: Eric Wasylishen Presenter: Fred Kiefer Overview ● Introduction ● Recent Improvements ● Resolution Independence ● NSImage ● Text System ● Miscellaneous ● Work in Progress ● Open Projects 2012-02-04 GNUstep-gui Improvements 2 Introduction ● Cross-platform (X11, Windows) GUI toolkit, fills a role similar to gtk ● Uses cairo as the drawing backend ● License: LGPLv2+; bundled tools: GPLv3+ ● Code is copyright FSF (contributors must sign copyright agreement) ● Latest release: 0.20.0 (2011/04) ● New release coming out soon 2012-02-04 GNUstep-gui Improvements 3 Introduction: Nice Features ● Objective-C is a good compromise language ● Readable, Smalltalk-derived syntax ● Object-Oriented features easy to learn ● Superset of C ● OpenStep/Cocoa API, which GNUstep-gui follows, is generally well-designed 2012-02-04 GNUstep-gui Improvements 4 Recent Improvements: Resolution Independence ● Basic problem: pixel resolution of computer displays varies widely 2012-02-04 GNUstep-gui Improvements 5 Resolution Independence ● In GNUstep-gui we draw everything with Display PostScript commands and all graphics coordinates are floating-point, so it would seem to be easy to scale UI graphics up or down ● Drawing elements ● Geometry ● Images ● Text 2012-02-04 GNUstep-gui Improvements 6 Resolution Independence ● Challenges: ● Auto-sized/auto-positioned UI elements should be aligned on pixel boundaries ● Need a powerful image object which can select between multiple versions of an image depending on the destination resolution (luckily NSImage is capable) 2012-02-04 GNUstep-gui Improvements 7 Recent Improvements: NSImage ● An NSImage is a lightweight container which holds one or more image representations (NSImageRep) ● Some convenience code for choosing which representation to use, drawing it, caching..
    [Show full text]
  • Printing Support in GNOME and Gtk+
    Printing support in GNOME and Gtk+ Gtk+ Print Dialog Print dialog used in Gtk+ applications. Gtk+ Print Dialog Basics ● Gtk+ print dialog allows users to set printing options at one place before actual print ● Paper size and format ● Page layout (multiple pages per sheet, odd / even pages, duplex printing, ...) ● Job informations (priority, time, cover pages, ...) ● Print quality ● Color profile ● Options specific to selected printer (stapling) Gtk+ Print Dialog Backends ● CUPS backend ● Uses IPP operations ● It still uses PPD files for getting printer options ● File backend ● Prints to PDF, Postscript and SVG files ● Pages are arranged by Gtk+ on the output sheets (e.g. multiple pages per sheet) Gtk+ Print Dialog Backends ● LPR backend ● Not enabled by default ● PAPI backend ● Not enabled by default Gtk+ Print Dialog's DNS-SD Support ● Gtk+ supports direct printing to DNS-SD printers from 3.8 ● Lists printers advertised by DNS-SD protocol – Uses Avahi library ● Shows basic options of DNS-SD printers – Uses IPP protocol implemented in CUPS ● Prints to DNS-SD printers – Uses IPP protocol implemented in CUPS Common Printing Dialog and Gtk+ Print Dialog ● DBUS – Gtk+ print dialog uses direct calls not DBus ● Option Icons – Gtk+ print dialog doesn't show icons for options ● Preview format – Gtk+ uses “cairo_t” together with some other info for getting pages for preview and passes them to an external application as PDF Common Printing Dialog and Gtk+ Print Dialog ● DBus Service Name – Gtk+ print dialog doesn't expose its functionality over
    [Show full text]
  • Create User Interfaces with Glade 9/29/09 7:18 AM
    Create User Interfaces with Glade 9/29/09 7:18 AM Home Topics Community Forums Magazine Shop Buyer's Guide Archive CD Search Home Create User Interfaces with Glade Subscribe Renew Free Issue Customer service July 1st, 2001 by Mitch Chapman in Software Mitch shows how to use gnome-python's libglade binding to build Python-based GUI applications with little manual coding. Digg submit Average: Your rating: None Average: 2.3 (3 votes) Glade is a GUI builder for the Gtk+ toolkit. Glade makes it easy to create user interfaces interactively, and it can generate source code for those interfaces as well as stubs for user interface callbacks. The libglade library allows programs to instantiate widget hierarchies defined in Glade project files easily. It includes a way to bind callbacks named in the project file to program-supplied callback routines. The Latest James Henstridge maintains both libglade and the gnome-python package, which is a Python binding to the Gtk+ toolkit, the GNOME user interface libraries and libglade itself. Using libglade Without Free Software, Open Source Would Lose Sep-28- binding to build Python-based GUI applications can provide significant savings in development and its Meaning 09 maintenance costs. Sep-25- Flip Flops Are Evil 09 All code examples in this article have been developed using Glade 0.5.11, gnome-python 1.0.53 Sep-24- and Python 2.1b1 running on Mandrake Linux 7.2. The Linux Desktop - The View from LinuxCon 09 Running Glade Sep-24- Create Image Galleries With Konqueror 09 When launched, Glade displays three top-level windows (see Figure 1).
    [Show full text]
  • Building a 3D Graphic User Interface in Linux
    Freescale Semiconductor Document Number: AN4045 Application Note Rev. 0, 01/2010 Building a 3D Graphic User Interface in Linux Building Appealing, Eye-Catching, High-End 3D UIs with i.MX31 by Multimedia Application Division Freescale Semiconductor, Inc. Austin, TX To compete in the market, apart from aesthetics, mobile Contents 1. X Window System . 2 devices are expected to provide simplicity, functionality, and 1.1. UI Issues . 2 elegance. Customers prefer attractive mobile devices and 2. Overview of GUI Options for Linux . 3 expect new models to be even more attractive. For embedded 2.1. Graphics Toolkit . 3 devices, a graphic user interface is essential as it enhances 2.2. Open Graphics Library® . 4 3. Clutter Toolkit - Solution for GUIs . 5 the ease of use. Customers expect the following qualities 3.1. Features . 5 when they use a Graphical User Interface (GUI): 3.2. Clutter Overview . 6 3.3. Creating the Scenegraph . 7 • Quick and responsive feedback for user actions that 3.4. Behaviors . 8 clarifies what the device is doing. 3.5. Animation by Frames . 9 • Natural animations. 3.6. Event Handling . 10 4. Conclusion . 10 • Provide cues, whenever appropriate, instead of 5. Revision History . 11 lengthy textual descriptions. • Quick in resolving distractions when the system is loading or processing. • Elegant and beautiful UI design. This application note provides an overview and a guide for creating a complex 3D User Interface (UI) in Linux® for the embedded devices. © Freescale Semiconductor, Inc., 2010. All rights reserved. X Window System 1 X Window System The X Window system (commonly X11 or X) is a computer software system and network protocol that implements X display protocol and provides windowing on bitmap displays.
    [Show full text]
  • Webkit and Blink: Open Development Powering the HTML5 Revolution
    WebKit and Blink: Open Development Powering the HTML5 Revolution Juan J. Sánchez LinuxCon 2013, New Orleans Myself, Igalia and WebKit Co-founder, member of the WebKit/Blink/Browsers team Igalia is an open source consultancy founded in 2001 Igalia is Top 5 contributor to upstream WebKit/Blink Working with many industry actors: tablets, phones, smart tv, set-top boxes, IVI and home automation. WebKit and Blink Juan J. Sánchez Outline The WebKit technology: goals, features, architecture, code structure, ports, webkit2, ongoing work The WebKit community: contributors, committers, reviewers, tools, events How to contribute to WebKit: bugfixing, features, new ports Blink: history, motivations for the fork, differences, status and impact in the WebKit community WebKit and Blink Juan J. Sánchez WebKit: The technology WebKit and Blink Juan J. Sánchez The WebKit project Web rendering engine (HTML, JavaScript, CSS...) The engine is the product Started as a fork of KHTML and KJS in 2001 Open Source since 2005 Among other things, it’s useful for: Web browsers Using web technologies for UI development WebKit and Blink Juan J. Sánchez Goals of the project Web Content Engine: HTML, CSS, JavaScript, DOM Open Source: BSD-style and LGPL licenses Compatibility: regression testing Standards Compliance Stability Performance Security Portability: desktop, mobile, embedded... Usability Hackability WebKit and Blink Juan J. Sánchez Goals of the project NON-goals: “It’s an engine, not a browser” “It’s an engineering project not a science project” “It’s not a bundle of maximally general and reusable code” “It’s not the solution to every problem” http://www.webkit.org/projects/goals.html WebKit and Blink Juan J.
    [Show full text]
  • Embassies: Radically Refactoring the Web Jon Howell, Bryan Parno, John R
    Embassies: Radically Refactoring the Web Jon Howell, Bryan Parno, John R. Douceur, Microsoft Research Abstract of evolving complexity. On the Internet, application Web browsers ostensibly provide strong isolation for providers, or vendors, run server-side applications over the client-side components of web applications. Unfor- which they exercise total control, from the app down tunately, this isolation is weak in practice; as browsers to the network stack, firewall, and OS. Even when ven- add increasingly rich APIs to please developers, these dors are tenants of a shared datacenter, each tenant au- complex interfaces bloat the trusted computing base and tonomously controls its software stack down to the ma- erode cross-app isolation boundaries. chine code, and each tenant is accessible only via IP. We reenvision the web interface based on the notion The strong isolation among virtualized Infrastructure-as- of a pico-datacenter, the client-side version of a shared a-Service datacenter tenants derives not from physical server datacenter. Mutually untrusting vendors run their separation but from the execution interface’s simplicity. code on the user’s computer in low-level native code con- This paper extends the semantics of datacenter rela- tainers that communicate with the outside world only via tionships to the client’s web experience. Suspending dis- IP. Just as in the cloud datacenter, the simple semantics belief momentarily, suppose every client had ubiquitous makes isolation tractable, yet native code gives vendors high-performance Internet connectivity. In such a world, the freedom to run any software stack. Since the datacen- exploiting datacenter semantics is easy: The client is ter model is designed to be robust to malicious tenants, it merely a screencast (VNC) viewer; every app runs on is never dangerous for the user to click a link and invite its vendor’s servers and streams a video of its display to a possibly-hostile party onto the client.
    [Show full text]
  • Geanypy Documentation Release 1.0
    GeanyPy Documentation Release 1.0 Matthew Brush <[email protected]> February 17, 2017 Contents 1 Introduction 3 2 Installation 5 2.1 Getting the Source............................................5 2.2 Dependencies and where to get them..................................5 2.3 And finally ... installing GeanyPy....................................7 3 Getting Started 9 3.1 What the heck is GeanyPy, really?....................................9 3.2 Python Console..............................................9 3.3 Future Plans............................................... 10 4 Writing a Plugin - Quick Start Guide 11 4.1 The Plugin Interface........................................... 11 4.2 Real-world Example........................................... 12 4.3 Logging.................................................. 13 5 API Documentation 15 5.1 The app module............................................. 15 5.2 The dialogs module.......................................... 16 5.3 The document module......................................... 17 5.4 The geany package and module.................................... 19 6 Indices and tables 21 Python Module Index 23 i ii GeanyPy Documentation, Release 1.0 Contents: Contents 1 GeanyPy Documentation, Release 1.0 2 Contents CHAPTER 1 Introduction GeanyPy allows people to write their Geany plugins in Python making authoring a plugin much more accessible to non C programmers. What follows is a description of installing and using the GeanyPy plugin, paving the way for the rest of the documentation to covert the details of programming with the GeanyPy bindings of the Geany API. 3 GeanyPy Documentation, Release 1.0 4 Chapter 1. Introduction CHAPTER 2 Installation Currently there are no binary packages available for installing GeanyPy so it must be installed from source. The following instructions will describe how to do this. Getting the Source The best way currently to get GeanyPy is to check it out from it’s repository on GitHub.com.
    [Show full text]
  • About a FOSS for the Teaching of FORTRAN Programming Language Course
    FREE AND OPEN SOURCE SOFTWARE CONFERENCE (FOSSC-15) MUSCAT, FEBRUARY 18-19, 2015 About a FOSS for the Teaching of FORTRAN Programming Language Course Afaq Ahmad1, Tariq Jamil1, Saad Ahmad2 and Amer Arshad Abdulghani1 proprietary software is secret, restricted knowledge, which is the opposite of the mission of educational institutions. Free Abstract— The FORTRAN programming language has its Software supports education, proprietary software forbids revival phase. Majority of the science colleges of the world education [1] – [2]. universities are teaching FORTRAN programming as a To this direction we moved towards FOSS and primary language. At Sultan Qaboos University, FORTRAN developed many laboratory experiments [3] – [22] along programming language is taught using the Free Open Source with teaching of FORTRAN language programming. Software (GFORTRAN compiler with Geany editor) since 2009. We share our knowledge about this Free Open Source Software for the benefits of scientists and engineers. LIII. FORTRAN LANGUAGE HISTORICAL VIEW FORTRAN (Formula Translation) was originally Index Terms— FORTRAN, Geany, GFORTRAN, High developed in the 1950s, is one of the most popular Level Language, Scientific Language, Support file-types, languages in the field of numerical and scientific Plugins. computation, and especially in High Performance Computing (HPC). Among the earliest High Level LII. INTRODUCTION Languages (HLL) FORTRAN played a key role in REE Open Source Software (FOSS) drive a free computation, and is still in widespread use today. F software is program that provides users a certain levels FORTRAN 66 released in 1966 was the first of all of essential freedoms. Those freedoms are of kinds as: programming language standards. Hence, after the release of - The freedom to run the program, the first standard the following rapid developments came in - The freedom to study how the program works and existence.
    [Show full text]
  • Fancy and Fast Guis on Embedded Devices
    FancyFancy andand FastFast GUIsGUIs onon EmbeddedEmbedded DevicesDevices Using the Enlightenment Foundation Libraries to achieve maximum performance on embedded devices. Gustavo Sverzut Barbieri <[email protected]> INdT/Recife CELF Embedded Linux Conference - November 3rd, 2007 Now costumers are used to fancy devices and expect newer to be even fancier... UsersUsers ExpectationsExpectations ● Quick feedback: responsive; ● Natural animations: – Matches real life; – Clarifies the work flow; – Clue whenever device is working or frozen; – Quick distraction while system is processing; ● Beauty. TechnologiesTechnologies X11X11 WindowWindow SystemSystem ● Input/Output communication with Hardware; ● Networked protocol to communicate with Apps; ● Used in every UNIX system since 1987; ● Very basic primitives; ● Very difficult to get right; ● Often used through high-level abstraction libs: – GTK, Qt, SDL, Evas, Tk, Xaw, Motif, ... OpenGLOpenGL -- OpenOpen GraphicsGraphics LibraryLibrary ● Industry standard for Hardware and Software; ● Focus on 3D (2D is handled as consequence); ● Fast triangle/rectangle/polygon drawing; ● Fast matrix transformations (scale, rotate, shear, perspective); ● Fast alpha blend; ● High-end cards support programs-per-pixel (pixel shaders): advanced render, light and effects; GTKGTK -- TheThe GIMPGIMP ToolkitToolkit ● Created in order to help development of The GIMP (Photoshop-like tool) with X11; ● Focus on visual widgets (buttons, text box, ...); ● Some efforts to run on non-X11 platforms; ● Basic free-drawing
    [Show full text]