While the majority of FXRuby is in fact implemented by an extension module, some parts are provided instead by "pure Ruby" code. This section describes the classes and modules available in the FXRuby standard library.
The fox/undolist.rb
file provides the FXCommand
and FXUndoList
classes. These serve the same purpose as the FXCommand
and FXUndoList
classes from the standard FOX distribution, but they're implemented entirely in Ruby.
For a complete description of these classes and how to use them, see the RD documentation in fox/undolist.rb
.
The fox/aliases.rb
implements most of the accessor-style aliases for methods. This file is loaded automatically when you
require 'fox'
and so you should never need to load it directly.
The fox/colors.rb
file, contributed by Jeff
Heard, provides a bunch of predefined color values (based on the standard
X11 color names). You can use these color constants anywhere that FOX
expects an RGB color value, e.g.
dc = FXDCWindow.new(drawable, ev) dc.foreground = FXColor::MistyRose # instead of FXRGB(255, 228, 225) dc.background = FXColor::MidnightBlue # instead of FXRGB( 25, 25, 112)
The fox/glshapes.rb
library provides Ruby
implementations of a number of basic 3-D shapes (all derived from the
built-in FXGLShape
class) that can be used with
the FXGLViewer
. Several of these shapes are used
in the glviewer.rb
example program. These shapes
were originally implemented in C++ and wrapped using SWIG, but they are
straightforward enough to implement in Ruby so they were moved out to
this library instead.
The fox/iterators.rb
library just adds an
each
instance method for the
FXComboBox
, FXGLGroup
,
FXHeader
, FXIconList
,
FXList
, FXListBox
,
FXTable
, FXTreeItem
,
FXTreeList
and FXTreeListBox
classes,
so that you can iterate over their members in a Ruby-friendly way. It
also mixes the Enumerable
module into each of
these classes.
The fox/keys.rb
library file defines all of the
key codes (e.g. KEY_space
) that might show up in the
code field of an FXEvent
instance. This file is
loaded automatically when you
require 'fox'
and so you should never need to load it directly.