[SCM] Lisaac library iup-binding branch, master, updated. 6b17e7dfb7b053aade730acd8f5fd86a5ca41d05
Jeremy Cowgar
jeremy at cowgar.com
Tue Aug 25 17:32:54 UTC 2009
The following commit has been merged in the master branch:
commit 6b17e7dfb7b053aade730acd8f5fd86a5ca41d05
Author: Jeremy Cowgar <jeremy at cowgar.com>
Date: Tue Aug 25 13:32:41 2009 -0400
A *very* incomplete, but functioning, wrapper around Iup.
diff --git a/README b/README
index e69de29..cc06c87 100644
--- a/README
+++ b/README
@@ -0,0 +1,18 @@
+This is the very early stages of a wrapper for IUP.
+
+It has been tested only on Windows but should work on Linux/Unix
+systems fairly easy. You will need to edit the lip slot iup.li and
+add the correct library definitions for your OS. That should be
+all that is necessary.
+
+To compile this on Windows, you need to download the Iup, Cd and Img
+libraries for your version of MinGW. Place the libraries into your
+MinGW/lib directory and the include files into your MinGW/include
+directory.
+
+You can test the interface by compiling and running the example:
+
+ lisaac example.li
+
+When complete, this will be an entire wrapping around Iup, Cd and Img
+complete with a fully Object Oriented interface.
diff --git a/button.li b/button.li
new file mode 100644
index 0000000..34bb730
--- /dev/null
+++ b/button.li
@@ -0,0 +1,62 @@
+Section Header
+ // Button
+
+ + name := BUTTON;
+
+ - copyright := "2009, Jeremy Cowgar";
+
+ - comment := "IUP Button";
+
+Section Inherit
+
+ + parent:Expanded CONTROL := CONTROL;
+
+Section Private
+
+ + action_block:{INTEGER};
+
+Section External
+
+ - perform_action h:POINTER :INTEGER <-
+ ( + b:BUTTON;
+ b := CONVERT(POINTER,BUTTON).on (`IupGetCallback(@h, "LISAAC_OBJ")`:POINTER);
+ b.action_block.value
+ );
+
+Section Public
+ // Creation
+
+ - make title:ABSTRACT_STRING :SELF <-
+ ( + result:SELF;
+ + h:POINTER;
+ + n_title:NATIVE_ARRAY(CHARACTER);
+
+ n_title := title.to_external;
+
+ h := `IupButton(@n_title, NULL)`:POINTER;
+
+ result := SELF.clone;
+ result.set_handle h;
+ `IupSetAttribute(@h, "LISAAC_OBJ", (char *) @result)`;
+ result
+ );
+
+Section Public
+ // Callbacks
+
+ - set_action b:{INTEGER} <-
+ ( + h:POINTER;
+
+ `
+ #if 0
+ `;
+ perform_action NULL;
+ `
+ #endif
+ `;
+
+ h := handle;
+ `IupSetCallback(@h, "ACTION", (Icallback) perform_action)`;
+
+ action_block := b;
+ );
diff --git a/container_control.li b/container_control.li
new file mode 100644
index 0000000..8269c1d
--- /dev/null
+++ b/container_control.li
@@ -0,0 +1,24 @@
+Section Header
+ // Base container control
+
+ + name := CONTAINER_CONTROL;
+
+ - copyright := "2009, Jeremy Cowgar";
+
+ - comment := "IUP Container Control";
+
+Section Inherit
+
+ + parent:Expanded CONTROL := CONTROL;
+
+Section Public
+
+ - add child:CONTROL <-
+ ( + h:POINTER;
+ + ch:POINTER;
+
+ h := handle;
+ ch := child.handle;
+
+ `IupAppend(@h, @ch)`;
+ );
diff --git a/control.li b/control.li
new file mode 100644
index 0000000..c6e41e6
--- /dev/null
+++ b/control.li
@@ -0,0 +1,45 @@
+Section Header
+ // Base control
+
+ + name := CONTROL;
+
+ - copyright := "2009, Jeremy Cowgar";
+
+ - comment := "IUP Control";
+
+Section Inherit
+
+ - parent:IUP := IUP;
+
+Section Public
+
+ + handle:POINTER;
+
+ - set_handle p:POINTER <-
+ (
+ handle := p;
+ );
+
+Section Public
+ // Attributes
+
+ - store name:ABSTRACT_STRING value v:ABSTRACT_STRING <-
+ ( + n_name:NATIVE_ARRAY(CHARACTER);
+ + n_v:NATIVE_ARRAY(CHARACTER);
+ + h:POINTER;
+
+ h := handle;
+ n_name := name.to_external;
+ n_v := v.to_external;
+
+ `IupStoreAttribute(@h, @n_name, @n_v)`;
+ );
+
+ - set_callback name:ABSTRACT_STRING slot v:POINTER <-
+ ( + n_name:NATIVE_ARRAY(CHARACTER);
+
+ h := handle;
+ n_name := name.to_external;
+
+ `IupSetCallback(@h, @n_name, @v)`;
+ );
diff --git a/dialog.li b/dialog.li
new file mode 100644
index 0000000..b20b6e1
--- /dev/null
+++ b/dialog.li
@@ -0,0 +1,77 @@
+Section Header
+ // Dialog
+
+ + name := DIALOG;
+
+ - copyright := "2009, Jeremy Cowgar";
+
+ - comment := "IUP Dialog";
+
+Section Inherit
+
+ + parent:Expanded CONTROL := CONTROL;
+
+Section Public
+
+ + child:CONTROL;
+
+Section Public
+ // popup and show_xy possible values
+
+ - show_center :INTEGER := `IUP_CENTER`:INTEGER;
+ - show_left :INTEGER := `IUP_LEFT`:INTEGER;
+ - show_right :INTEGER := `IUP_RIGHT`:INTEGER;
+ - show_mousepos :INTEGER := `IUP_MOUSEPOS`:INTEGER;
+ - show_current :INTEGER := `IUP_CURRENT`:INTEGER;
+ - show_centerparent :INTEGER := `IUP_CENTER_PARENT`:INTEGER;
+ - show_top :INTEGER := `IUP_TOP`:INTEGER;
+ - show_bottom :INTEGER := `IUP_BOTTOM`:INTEGER;
+
+Section Public
+
+ - make title:ABSTRACT_STRING child control:CONTROL :SELF <-
+ ( + result:SELF;
+ + h, child_h:POINTER;
+
+ child := control;
+ child_h := control.handle;
+ h := `IupDialog(@child_h)`:POINTER;
+
+ result := SELF.clone;
+ result.set_handle h;
+ result.store "TITLE" value title;
+ result
+ );
+
+ - popup (x:INTEGER,y:INTEGER) :INTEGER <-
+ // Display the dialog as a modal popup dialog. You may wish to refer
+ // to the documentation section "popup and show_xy possible values" for
+ // other possible values to popup.
+ ( + h:POINTER;
+
+ h := handle;
+ `IupPopup(@h, @x, @y)`:INTEGER
+ );
+
+ - show :INTEGER <-
+ // Show the dialog as a non-modal dialog
+ ( + h:POINTER;
+ h := handle;
+ `IupShow(@h)`:INTEGER
+ );
+
+ - show x:INTEGER y y:INTEGER :INTEGER <-
+ // Show the dialog as a non-modal dialog at X and Y. You may wish to refer
+ // to the documentation section "popup and show_xy possible values" for
+ // other possible values to show x y.
+ ( + h:POINTER;
+ h := handle;
+ `IupShowXY(@h, @x, @y)`:INTEGER
+ );
+
+ - hide <-
+ // Hide the dialog
+ ( + h:POINTER;
+ h := handle;
+ `IupHide(@h)`;
+ );
diff --git a/example.li b/example.li
new file mode 100644
index 0000000..6924bb9
--- /dev/null
+++ b/example.li
@@ -0,0 +1,33 @@
+Section Header
+
+ + name := EXAMPLE;
+
+Section Inherit
+
+ - parent:OBJECT := OBJECT;
+
+Section Public
+
+ - main <-
+ ( + dlg:DIALOG;
+ + main_box:HORIZONTAL_BOX;
+ + hello, goodbye:BUTTON;
+
+ IUP.open.println;
+
+ hello := BUTTON.make "Say Hello";
+ hello.set_action { "Hello, World!".println; IUP.cb_default };
+
+ goodbye := BUTTON.make "Say Goodbye";
+ goodbye.set_action { "Goodbye, World!".println; IUP.cb_close };
+
+ main_box := HORIZONTAL_BOX.make;
+ main_box.add hello;
+ main_box.add goodbye;
+
+ dlg := DIALOG.make "Simple" child main_box;
+ dlg.show.println;
+
+ IUP.main_loop;
+ IUP.close;
+ );
diff --git a/horizontal_box.li b/horizontal_box.li
new file mode 100644
index 0000000..3d82b20
--- /dev/null
+++ b/horizontal_box.li
@@ -0,0 +1,25 @@
+Section Header
+ // Base container control
+
+ + name := HORIZONTAL_BOX;
+
+ - copyright := "2009, Jeremy Cowgar";
+
+ - comment := "IUP Horizontal Box";
+
+Section Inherit
+
+ + parent:Expanded CONTAINER_CONTROL := CONTAINER_CONTROL;
+
+Section Public
+
+ - make :SELF <-
+ ( + result:SELF;
+ + h:POINTER;
+
+ h := `IupHbox(NULL)`:POINTER;
+
+ result := SELF.clone;
+ result.set_handle h;
+ result
+ );
diff --git a/iup.li b/iup.li
new file mode 100644
index 0000000..04c85af
--- /dev/null
+++ b/iup.li
@@ -0,0 +1,204 @@
+Section Header
+ // Binding of IUP (http://www.tecgraf.puc-rio.br/iup/) for Lisaac
+
+ + name := IUP;
+
+ - copyright := "2009, Jeremy Cowgar";
+
+ - comment := "IUP binding";
+
+ - external := `
+ #include "iup.h"
+ `;
+
+ - lip <-
+ (
+ (target = "windows").if {
+ add_lib "-Wl,--start-group -lgdi32 -lcomdlg32 -lcomctl32 -lopengl32 -lglu32 -lcd -liupcd -liup -liupcontrols -liupim -lim -lfreetype6 -lcomctl32 -lole32 -Wl,--end-group";
+ };
+ );
+
+Section Inherit
+
+ - parent_object:OBJECT := OBJECT;
+
+Section Public
+ // Error information
+
+ - error_message :ABSTRACT_STRING;
+ - error_code :INTEGER := `IUP_NOERROR`:INTEGER;
+
+ - error_none :INTEGER := `IUP_NOERROR`:INTEGER;
+ - error :INTEGER := `IUP_ERROR`:INTEGER;
+ - error_opened :INTEGER := `IUP_OPENED`:INTEGER;
+
+Section Public
+ // Callback return values
+
+ - cb_ignore :INTEGER := `IUP_IGNORE`:INTEGER;
+ - cb_default :INTEGER := `IUP_DEFAULT`:INTEGER;
+ - cb_close :INTEGER := `IUP_CLOSE`:INTEGER;
+ - cb_continue :INTEGER := `IUP_CONTINUE`:INTEGER;
+
+Section Private
+
+ - set_error code:INTEGER message message:ABSTRACT_STRING <-
+ (
+ error_message := message.clone;
+ error_code := code;
+ );
+
+Section Public
+ // System
+
+ - open :BOOLEAN <-
+ ( + result:BOOLEAN;
+ (`IupOpen(NULL, NULL)`:INTEGER = error_none).if {
+ result := TRUE;
+ } else {
+ result := FALSE;
+ };
+
+ result
+ );
+
+ - close <-
+ (
+ `IupClose()`;
+ );
+
+ - version :STRING <-
+ ( + n_version : NATIVE_ARRAY(CHARACTER);
+ + result : STRING;
+
+ n_version := `IupVersion()`:NATIVE_ARRAY(CHARACTER);
+
+ result := STRING.clone;
+ result.from_external(n_version);
+ result
+ );
+
+ - load filename:ABSTRACT_STRING :BOOLEAN <-
+ ( + n_filename : NATIVE_ARRAY(CHARACTER);
+ + n_message : NATIVE_ARRAY(CHARACTER);
+ + message : STRING;
+ + result : BOOLEAN;
+
+ n_filename := filename.to_external;
+ n_message := `IupLoad(@n_filename)`:NATIVE_ARRAY(CHARACTER);
+ (n_message = NULL).if {
+ result := TRUE;
+ } else {
+ result := FALSE;
+ message := STRING.clone;
+ message.from_external(n_message);
+ set_error (-1) message message;
+ };
+
+ result
+ );
+
+ - set_language language:ABSTRACT_STRING <-
+ ( + n_language : NATIVE_ARRAY(CHARACTER);
+ n_language := language.to_external;
+ `IupSetLanguage(@n_language)`;
+ );
+
+ - get_language :ABSTRACT_STRING <-
+ ( + n_lang : NATIVE_ARRAY(CHARACTER);
+ + result : STRING;
+
+ n_lang := `IupGetLanguage()`:NATIVE_ARRAY(CHARACTER);
+
+ result := STRING.clone;
+ result.from_external(n_lang);
+ result
+ );
+
+Section Public
+ // Attributes
+
+Section Public
+ // Events
+
+ - main_loop <-
+ (
+ `IupMainLoop()`;
+ );
+
+ - main_loop_level :INTEGER <-
+ (
+ `IupMainLoopLevel()`:INTEGER
+ );
+
+ - loop_step :INTEGER <-
+ (
+ `IupLoopStep()`:INTEGER
+ );
+
+ - exit_loop <-
+ (
+ `IupExitLoop()`;
+ );
+
+ - flush <-
+ (
+ `IupFlush()`;
+ );
+
+Section Public
+ // Layout Construction
+
+Section Public
+ // Layout Composition
+
+Section Public
+ // Layout Hierarchy
+
+Section Public
+ // Layout Utilities
+
+Section Public
+ // Dialogs
+
+Section Public
+ // Predefined Dialogs
+
+ - message msg:ABSTRACT_STRING title title:ABSTRACT_STRING <-
+ (
+ + n_msg:NATIVE_ARRAY(CHARACTER);
+ + n_title:NATIVE_ARRAY(CHARACTER);
+
+ n_msg := msg.to_external;
+ n_title := title.to_external;
+
+ `IupMessage(@n_title, @n_msg)`;
+ );
+
+Section Public
+ // Standard Controls
+
+Section Public
+ // Additional Controls
+
+Section Public
+ // Matrix Utilities
+
+Section Public
+ // Keyboard
+
+Section Public
+ // Menus
+
+Section Public
+ // Images
+
+Section Public
+ // Names
+
+Section Public
+ // Fonts
+
+Section Public
+ // Miscellaneous
+
diff --git a/label.li b/label.li
new file mode 100644
index 0000000..42ec97e
--- /dev/null
+++ b/label.li
@@ -0,0 +1,28 @@
+Section Header
+ // Label
+
+ + name := LABEL;
+
+ - copyright := "2009, Jeremy Cowgar";
+
+ - comment := "IUP Label";
+
+Section Inherit
+
+ + parent:Expanded CONTROL := CONTROL;
+
+Section Public
+
+ - make title:ABSTRACT_STRING :SELF <-
+ ( + result:SELF;
+ + hndl:POINTER;
+ + n_title:NATIVE_ARRAY(CHARACTER);
+
+ n_title := title.to_external;
+
+ hndl := `IupLabel(@n_title)`:POINTER;
+
+ result := SELF.clone;
+ result.set_handle hndl;
+ result
+ );
diff --git a/vertical_box.li b/vertical_box.li
new file mode 100644
index 0000000..f096651
--- /dev/null
+++ b/vertical_box.li
@@ -0,0 +1,25 @@
+Section Header
+ // Base container control
+
+ + name := VERTICAL_BOX;
+
+ - copyright := "2009, Jeremy Cowgar";
+
+ - comment := "IUP Vertical Box";
+
+Section Inherit
+
+ + parent:Expanded CONTAINER_CONTROL := CONTAINER_CONTROL;
+
+Section Public
+
+ - make :SELF <-
+ ( + result:SELF;
+ + h:POINTER;
+
+ h := `IupVbox(NULL)`:POINTER;
+
+ result := SELF.clone;
+ result.set_handle h;
+ result
+ );
--
Lisaac library iup-binding
More information about the Lisaac-commits
mailing list