summaryrefslogtreecommitdiff
path: root/project/templates/fltkada.xhtml
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2021-11-26 20:17:43 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2021-11-26 20:17:43 +1300
commit14025d22ce3d66c9d235e57221ec4653e00f972c (patch)
treedac7c0f2cd22007aa1c396b460a1f2d90445a4d3 /project/templates/fltkada.xhtml
parent03ea6ba48bfbb25dc74a0a369b5aa15bf10e91b9 (diff)
Switched to .xhtml extension, fixed some minor bugs
Diffstat (limited to 'project/templates/fltkada.xhtml')
-rw-r--r--project/templates/fltkada.xhtml112
1 files changed, 112 insertions, 0 deletions
diff --git a/project/templates/fltkada.xhtml b/project/templates/fltkada.xhtml
new file mode 100644
index 0000000..f68ea27
--- /dev/null
+++ b/project/templates/fltkada.xhtml
@@ -0,0 +1,112 @@
+
+{%- extends "base.xhtml" -%}
+
+
+
+{%- block title -%}FLTK Ada{%- endblock -%}
+
+
+
+{%- block content %}
+<h4>FLTK Ada Binding</h4>
+
+<p>Git repository: <a href="/cgi-bin/cgit.cgi/fltkada">Link</a><br />
+Estimated status: 80% complete</p>
+
+
+<h5>9/11/2021</h5>
+
+<p>A few noteworthy bugfixes have been applied to the binding.</p>
+
+<p>First, unbeknownst to me the Fl_Widget constructor doesn't copy the given label string inside
+FLTK and merely stores a pointer. This meant that declaring several Widgets in a row each with their
+own different label could have unexpected and erratic results. Easily fixed by ensuring the binding
+constructor also calls copy_label() afterwards.</p>
+
+<p>And second, somehow I had made an oversight with the type assigned to Color, using a signed
+Integer when it really needed an unsigned modular type with 32 bits of range. Again, easily fixed
+but even more annoying since it was my fault to begin with.</p>
+
+<p>I'm sure the other guy aside from me who takes an interest in this binding will be happy about
+these. You know who you are.</p>
+
+
+<h5>21/5/2018</h5>
+
+<p>This binding is now complete enough for most purposes. It certainly took more effort than
+expected, in part due to underestimation of how much needed binding. The vast majority of useful
+classes are now usable in Ada, with a few exceptions such as the Fl_Browser, Fl_Help_View, Fl_Table,
+and Fl_Tree widgets.</p>
+
+<p>Noteworthy features and modifications include:</p>
+<ul>
+ <li>Constructors are not primitive operations and are not inherited</li>
+ <li>Additional types have been defined and used to clean up the API</li>
+ <li>No heap allocation/deallocation necessary</li>
+ <li>Ada 2012 iterators are implemented for Group and Menu widgets</li>
+ <li>The API for Menu and Menu_Item has been rearranged to better reflect a container/item
+ dichotomy</li>
+ <li>The Draw and Handle widget methods are easily overridable</li>
+ <li>Static methods from the base Fl.H header have been split up into multiple packages</li>
+ <li>Automatic addition of widgets to a Group with fl_group_begin and fl_group_end is not
+ supported</li>
+</ul>
+
+<p>A mapping of what C++ headers and methods correspond to what Ada packages, functions, and
+procedures is included. Also, the below "Hello world" code sample has been modified to work with the
+updated binding.</p>
+
+
+<h5>25/6/2017</h5>
+
+<p>FLTK, or by its full name the <a href="http://www.fltk.org/" class="external">Fast Light Toolkit
+</a>, is a graphical widget toolkit noteworthy for being so lightweight that it is commonly
+statically linked. Projects that make use of it include the <a href="http://www.dillo.org/"
+class="external">Dillo</a> web browser, the <a href="http://flwm.sourceforge.net/" class="external">
+FLWM</a> X window manager, and the <a href="http://www.equinox-project.org/" class="external">
+Equinox Desktop Environment</a>. There are bindings for it in several languages, including Python,
+Perl and Ruby, but not Ada. Until now!</p>
+
+<p>This is a spinoff from Adapad, and so despite not yet being complete it can be at least
+guaranteed to be enough to write a text editor. It's a thick, loosely coupled binding, accomplished
+by first exporting the interface to C, then importing that to Ada. Attempted usage of the internal C
+interface as a binding on its own is not supported.</p>
+
+<p>A typical FLTK Hello World program in Ada:</p>
+<div class="precontain">
+<code>
+with
+ FLTK.Widgets.Groups.Windows,
+ FLTK.Widgets.Boxes;
+
+function Hello_World return Integer is
+
+ My_Win : FLTK.Widgets.Groups.Windows.Window :=
+ FLTK.Widgets.Groups.Windows.Forge.Create (100, 100, 200, 200, "Untitled");
+
+ My_Box : FLTK.Widgets.Boxes.Box :=
+ FLTK.Widgets.Boxes.Forge.Create (50, 50, 100, 100, "Hello, World!");
+
+begin
+
+ My_Win.Add (My_Box);
+ My_Win.Show;
+
+ return FLTK.Run;
+
+end Hello_World;
+</code>
+</div>
+
+<p>Aside from reworking the types to better fit the strongly typed philosophy of Ada, the entire
+library has been structured to avoid explicit heap usage. As you can see from the above example, the
+intended use is to declare FLTK objects on the stack. Allocation and deallocation of the C++
+internals is handled automatically.</p>
+
+<p>A few other minor changes were involved, such as requiring widgets to be explicitly added to a
+group rather than implicitly being added to the last group not yet ended. At the moment the package
+specifications should provide sufficient information to allow programmers to work with the library.
+</p>
+{% endblock -%}
+
+