1. What is this document?

This document is the index to the djnn Perl recipes. This cookbook is made for programmers who wish to learn from examples. It contains fragments of code that each show how to a achieve a given task: drawing a rectangle, opening multiple windows, connecting components, etc. Most examples are executable as is, some are not. Some address basic needs, while others are more complex recipes.

This cookbook is structured by topics. You can access the examples by following the links. In theory, your browser should think that the examples are pure text and display them. Otherwise, you will need to save them to disk and open them with a text editor.

Some examples are executable. If you want to test them, you will need to save them to disk and execute them, supposing that djnn is properly installed on your computer.

2. Drawing

2.1. Windowing

How to open windows on the screen.

- Opening a frame: the mandatory Hello World

- Opening multiple windows: how to create several windows and draw in them.

2.2. Graphical objects

How to create shapes, gradients, etc.

- Drawing simple shapes: how to draw and position various shapes in a frame

- Add style: how to add style to your shapes

- Loading SVG: loading a component from a file.

3. Behaviors

4. Creating the component tree

4.1. Building components

- To be written: creating a simple component

- A Button component: Creating and using a Perl component class that you can instantiate at will.

4.2. Importing components

- Importing external components: Combining a component from an external Perl file, an XML file, and a binary library file (INCOMPLETE).

5. Execution

6. Creating djnn extensions in Perl

How to add external code to your djnn application or create new modules in Perl.

6.1. Wrapping Perl callbacks

to be written

6.2. Managing native resources

to be written

6.3. Creating new native components

- Creating and using a beeper: A component with its rendering implemented in Perl, and its use.

- Tracking file contents: A source component that registers file handles with the system hook, and updates a text property with the additional file contents.

6.4. Using Perl components from other djnn APIs

- Importing a Perl component: Loading a component from a Perl file into an djnn tree otherwise built in C code. This is the only C sample in this cookbook. This can be replicated from other djnn APIs as soon as the PerlLoader component is available in these APIs.