Skip to content

User Guide : Introduction

Martin Corino edited this page Mar 19, 2024 · 2 revisions
     About      HowTo      FAQ      Reference documentation

Introduction

wxRuby3 is a cross-platform GUI library for Ruby, based on the popular wxWidgets cross platform GUI toolkit for C++. It uses native widgets wherever possible, providing the correct look, feel and behaviour to GUI applications on Windows, OS X and Linux/GTK. wxRuby aims to provide a comprehensive solution to developing professional-standard desktop applications in Ruby.

Like Ruby and wxWidgets, wxRuby3 is Open Source, which means that it is free for anyone to use and the source code is available for anyone to look at and use in any way they like. Also, anyone can contribute (tested) fixes, additions and enhancements to the project.

Like wxWidgets wxRuby3 is a cross platform toolkit. This means that the same program will run on multiple platforms without modification. Currently Supported platforms are Microsoft Windows, MacOSX and Linux or other unix-like systems with GTK2 or GTK3 libraries. Contributions to achieve support for other wxWidgets supported platforms are appreciated.

Since the programming language is Ruby, wxRuby3 programs are simple and easy to write and understand. To accomplish the full Ruby experience wxRuby3 has not ported the wxWidgets API 1 on 1 to Ruby but has made an effort to make the wxRuby3 API typically Ruby-ish. This means all method signatures (names, arguments) have been transformed to conform to common Ruby naming rules as well as other Ruby programming practices. Also does wxRuby3 introduce iterators in favor of getters returning arrays or lists. Check out the samples and the documentation for details.

What is wxRuby3?

The wxRuby3 project is a new, rebooted, implementation of wxRuby (as compared to wxRuby2 and earlier versions) with the clear intent to make this implementation better maintainable and extensible.

To this end wxRuby3 adopted much of the approach of the wxPython Phoenix project in that the wxRuby API is generated from the wxWidgets XML interface definitions. Unlike the Phoenix project however, wxRuby does not use a home-grown interface code generator but rather still relies on SWIG for that (with Ruby tooling to configure and post-process). The wxRuby generation process more or less conforms to:

  1. build wxWidgets interface XML
  2. parse interface XML
  3. generate SWIG interface definitions
  4. generate Ruby extension code with SWIG
  5. post-process Ruby extension code

As the wxRuby tooling is already parsing the full wxWidgets interface specs (from which wxWidgets generates it's own reference documentation) it also uses the parsed information to generate matching reference documentation for the wxRuby API. This documentation is not (yet) perfect but should go a long way in helping people using wxRuby to build GUI applications.

The wxRuby3 API is largely compatible with the earlier wxRuby incarnations but not 100% mostly due to more modularization and more explicit typing of (especially) enums. Also wxRuby3 exclusively targets a lot more modern versions of wxWidgets (>= 3.2) and Ruby (>= 2.5) so there are some shifts from that as well. All in all though, people that once took a stab at looking at wxRuby(2) should not have much problems getting up to speed again.

For simplicity we will refer to wxRuby3 as wxRuby from now on.

Read Quick start to learn about how to start writing wxRuby applications.

Clone this wiki locally