diff options
-rw-r--r-- | doc/fl_select_browser.html | 68 | ||||
-rw-r--r-- | doc/index.html | 3 | ||||
-rw-r--r-- | progress.txt | 2 | ||||
-rw-r--r-- | src/c_fl_select_browser.cpp | 350 | ||||
-rw-r--r-- | src/c_fl_select_browser.h | 70 | ||||
-rw-r--r-- | src/fltk-widgets-groups-browsers-textline-choice.adb | 346 | ||||
-rw-r--r-- | src/fltk-widgets-groups-browsers-textline-choice.ads | 48 |
7 files changed, 885 insertions, 2 deletions
diff --git a/doc/fl_select_browser.html b/doc/fl_select_browser.html new file mode 100644 index 0000000..e3cb96c --- /dev/null +++ b/doc/fl_select_browser.html @@ -0,0 +1,68 @@ +<!DOCTYPE html> + +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Fl_Select_Browser Binding Map</title> + <link href="map.css" rel="stylesheet"> + </head> + + <body> + + +<h2>Fl_Select_Browser Binding Map</h2> + + +<a href="index.html">Back to Index</a> + + +<table class="package"> + <tr><th colspan="2">Package name</th></tr> + + <tr> + <td>Fl_Select_Browser</td> + <td>FLTK.Widgets.Groups.Browsers.Textline.Choice</td> + </tr> + +</table> + + + +<table class="type"> + <tr><th colspan="2">Types</th></tr> + + <tr> + <td>Fl_Select_Browser</td> + <td>Choice_Browser</td> + </tr> + + <tr> + <td> </td> + <td>Choice_Browser_Reference</td> + </tr> + +</table> + + + +<table class="function"> + <tr><th colspan="2">Functions and Procedures</th></tr> + + <tr> +<td><pre> +Fl_Select_Browser(int X, int Y, int W, int H, const char *L=0); +</pre></td> +<td><pre> +function Create + (X, Y, W, H : in Integer; + Text : in String := "") + return Choice_Browser; +</pre></td> + </tr> + +</table> + + + </body> +</html> + diff --git a/doc/index.html b/doc/index.html index 27c3a13..db2679b 100644 --- a/doc/index.html +++ b/doc/index.html @@ -102,7 +102,7 @@ <li><a href="fl_scroll.html">Fl_Scroll</a></li> <li><a href="fl_scrollbar.html">Fl_Scrollbar</a></li> <li><a href="fl_secret_input.html">Fl_Secret_Input</a></li> - <li>Fl_Select_Browser</li> + <li><a href="fl_select_browser.html">Fl_Select_Browser</a></li> <li><a href="fl_shared_image.html">Fl_Shared_Image</a></li> <li><a href="fl_simple_counter.html">Fl_Simple_Counter</a></li> <li><a href="fl_single_window.html">Fl_Single_Window</a></li> @@ -190,6 +190,7 @@ <li><a href="fl_browser_.html">FLTK.Widgets.Groups.Browsers</a></li> <li><a href="fl_check_browser.html">FLTK.Widgets.Groups.Browsers.Check</a></li> <li><a href="fl_browser.html">FLTK.Widgets.Groups.Browsers.Textline</a></li> + <li><a href="fl_select_browser.html">FLTK.Widgets.Groups.Browsers.Textline.Choice</a></li> <li><a href="fl_hold_browser.html">FLTK.Widgets.Groups.Browsers.Textline.Hold</a></li> <li><a href="fl_multi_browser.html">FLTK.Widgets.Groups.Browsers.Textline.Multi</a></li> <li><a href="fl_color_chooser.html">FLTK.Widgets.Groups.Color_Choosers</a></li> diff --git a/progress.txt b/progress.txt index 8877ffd..85cb77c 100644 --- a/progress.txt +++ b/progress.txt @@ -73,6 +73,7 @@ FLTK.Widgets.Groups FLTK.Widgets.Groups.Browsers FLTK.Widgets.Groups.Browsers.Check FLTK.Widgets.Groups.Browsers.Textline +FLTK.Widgets.Groups.Browsers.Textline.Choice FLTK.Widgets.Groups.Browsers.Textline.Hold FLTK.Widgets.Groups.Browsers.Textline.Multi FLTK.Widgets.Groups.Color_Choosers @@ -148,7 +149,6 @@ Fl_Display_Device Fl_File_Browser Fl_Glut_Window Fl_Postscript_File_Device -Fl_Select_Browser Fl_Table Fl_Table_Row Fl_Tree diff --git a/src/c_fl_select_browser.cpp b/src/c_fl_select_browser.cpp new file mode 100644 index 0000000..ef1a671 --- /dev/null +++ b/src/c_fl_select_browser.cpp @@ -0,0 +1,350 @@ + + +// Programmed by Jedidiah Barber +// Released into the public domain + + +#include <FL/Fl_Select_Browser.H> +#include "c_fl_select_browser.h" + + + + +// Exports from Ada + +extern "C" int browser_full_width_hook(void * b); +extern "C" int browser_full_height_hook(void * b); +extern "C" int browser_incr_height_hook(void * b); +extern "C" int browser_item_quick_height_hook(void * b, void * i); + +extern "C" int browser_item_width_hook(void * b, void * i); +extern "C" int browser_item_height_hook(void * b, void * i); +extern "C" void * browser_item_first_hook(void * b); +extern "C" void * browser_item_last_hook(void * b); +extern "C" void * browser_item_next_hook(void * b, void * i); +extern "C" void * browser_item_prev_hook(void * b, void * i); +extern "C" void * browser_item_at_hook(void * b, int n); +extern "C" void browser_item_select_hook(void * b, void * i, int s); +extern "C" int browser_item_selected_hook(void * b, void * i); +extern "C" void browser_item_swap_hook(void * b, void * one, void * two); +extern "C" const char * browser_item_text_hook(void * b, void * i); +extern "C" void browser_item_draw_hook(void * b, void * i, int x, int y, int w, int h); + +extern "C" void widget_draw_hook(void * ud); +extern "C" int widget_handle_hook(void * ud, int e); + + + + +// Attaching all relevant hooks and friends + +class My_Select_Browser : public Fl_Select_Browser { +public: + using Fl_Select_Browser::Fl_Select_Browser; + + friend int fl_select_browser_item_width(SELECTBROWSER b, void * item); + friend int fl_select_browser_item_height(SELECTBROWSER b, void * item); + friend void * fl_select_browser_item_first(SELECTBROWSER b); + friend void * fl_select_browser_item_last(SELECTBROWSER b); + friend void * fl_select_browser_item_next(SELECTBROWSER b, void * item); + friend void * fl_select_browser_item_prev(SELECTBROWSER b, void * item); + friend void * fl_select_browser_item_at(SELECTBROWSER b, int index); + friend void fl_select_browser_item_select(SELECTBROWSER b, void * item, int val); + friend int fl_select_browser_item_selected(SELECTBROWSER b, void * item); + friend void fl_select_browser_item_swap(SELECTBROWSER b, void * x, void * y); + friend const char * fl_select_browser_item_text(SELECTBROWSER b, void * item); + friend void fl_select_browser_item_draw(SELECTBROWSER b, void * item, int x, int y, int w, int h); + + friend int fl_select_browser_lineno(SELECTBROWSER b, void * item); + + friend void * fl_select_browser_selection(SELECTBROWSER c); + friend int fl_select_browser_displayed2(SELECTBROWSER c, void * i); + friend void * fl_select_browser_find_item(SELECTBROWSER c, int y); + friend void * fl_select_browser_top(SELECTBROWSER c); + + friend void fl_select_browser_bbox(SELECTBROWSER c, int &x, int &y, int &w, int &h); + friend int fl_select_browser_leftedge(SELECTBROWSER c); + friend void fl_select_browser_redraw_line(SELECTBROWSER c, void * i); + friend void fl_select_browser_redraw_lines(SELECTBROWSER c); + + friend int fl_select_browser_full_width(SELECTBROWSER c); + friend int fl_select_browser_full_height(SELECTBROWSER c); + friend int fl_select_browser_incr_height(SELECTBROWSER c); + friend int fl_select_browser_item_quick_height(SELECTBROWSER c, void * i); + + friend void fl_select_browser_new_list(SELECTBROWSER b); + friend void fl_select_browser_inserting(SELECTBROWSER b, void * a1, void * a2); + friend void fl_select_browser_deleting(SELECTBROWSER b, void * item); + friend void fl_select_browser_replacing(SELECTBROWSER b, void * a1, void * a2); + friend void fl_select_browser_swapping(SELECTBROWSER b, void * a1, void * a2); + + friend void fl_select_browser_draw(SELECTBROWSER b); + + int handle(int e); + +protected: + int full_width() const; + int full_height() const; + int incr_height() const; + int item_quick_height(void * item) const; + + int item_width(void * item) const; + int item_height(void * item) const; + void * item_first() const; + void * item_last() const; + void * item_next(void * item) const; + void * item_prev(void * item) const; + void * item_at(int index) const; + void item_select(void * item, int val=1); + int item_selected(void * item) const; + void item_swap(void * a, void * b); + const char * item_text(void * item) const; + void item_draw(void * item, int x, int y, int w, int h) const; + + void draw(); +}; + + +int My_Select_Browser::full_width() const { + return browser_full_width_hook(this->user_data()); +} + +int My_Select_Browser::full_height() const { + return browser_full_height_hook(this->user_data()); +} + +int My_Select_Browser::incr_height() const { + return browser_incr_height_hook(this->user_data()); +} + +int My_Select_Browser::item_quick_height(void * item) const { + return browser_item_quick_height_hook(this->user_data(), item); +} + + +int My_Select_Browser::item_width(void * item) const { + return browser_item_width_hook(this->user_data(), item); +} + +int My_Select_Browser::item_height(void * item) const { + return browser_item_height_hook(this->user_data(), item); +} + +void * My_Select_Browser::item_first() const { + return browser_item_first_hook(this->user_data()); +} + +void * My_Select_Browser::item_last() const { + return browser_item_last_hook(this->user_data()); +} + +void * My_Select_Browser::item_next(void * item) const { + return browser_item_next_hook(this->user_data(), item); +} + +void * My_Select_Browser::item_prev(void * item) const { + return browser_item_prev_hook(this->user_data(), item); +} + +void * My_Select_Browser::item_at(int index) const { + return browser_item_at_hook(this->user_data(), index); +} + +void My_Select_Browser::item_select(void * item, int val) { + browser_item_select_hook(this->user_data(), item, val); +} + +int My_Select_Browser::item_selected(void * item) const { + return browser_item_selected_hook(this->user_data(), item); +} + +void My_Select_Browser::item_swap(void * a, void * b) { + browser_item_swap_hook(this->user_data(), a, b); +} + +const char * My_Select_Browser::item_text(void * item) const { + return browser_item_text_hook(this->user_data(), item); +} + +void My_Select_Browser::item_draw(void * item, int x, int y, int w, int h) const { + browser_item_draw_hook(this->user_data(), item, x, y, w, h); +} + + +void My_Select_Browser::draw() { + widget_draw_hook(this->user_data()); +} + +int My_Select_Browser::handle(int e) { + return widget_handle_hook(this->user_data(), e); +} + + + + +// Flattened C API begins here + +SELECTBROWSER new_fl_select_browser(int x, int y, int w, int h, char * label) { + My_Select_Browser *b = new My_Select_Browser(x, y, w, h, label); + return b; +} + +void free_fl_select_browser(SELECTBROWSER b) { + delete reinterpret_cast<My_Select_Browser*>(b); +} + + + + +// These have to be reimplemented due to relying on custom class extensions + +int fl_select_browser_full_height(SELECTBROWSER c) { + return reinterpret_cast<My_Select_Browser*>(c)->Fl_Browser::full_height(); +} + +int fl_select_browser_incr_height(SELECTBROWSER c) { + return reinterpret_cast<My_Select_Browser*>(c)->Fl_Browser::incr_height(); +} + + + + +int fl_select_browser_item_width(SELECTBROWSER b, void * item) { + return reinterpret_cast<My_Select_Browser*>(b)->item_width(item); +} + +int fl_select_browser_item_height(SELECTBROWSER b, void * item) { + return reinterpret_cast<My_Select_Browser*>(b)->item_height(item); +} + +void * fl_select_browser_item_first(SELECTBROWSER b) { + return reinterpret_cast<My_Select_Browser*>(b)->item_first(); +} + +void * fl_select_browser_item_last(SELECTBROWSER b) { + return reinterpret_cast<My_Select_Browser*>(b)->item_last(); +} + +void * fl_select_browser_item_next(SELECTBROWSER b, void * item) { + return reinterpret_cast<My_Select_Browser*>(b)->item_next(item); +} + +void * fl_select_browser_item_prev(SELECTBROWSER b, void * item) { + return reinterpret_cast<My_Select_Browser*>(b)->item_prev(item); +} + +void * fl_select_browser_item_at(SELECTBROWSER b, int index) { + return reinterpret_cast<My_Select_Browser*>(b)->item_at(index); +} + +void fl_select_browser_item_select(SELECTBROWSER b, void * item, int val) { + reinterpret_cast<My_Select_Browser*>(b)->item_select(item, val); +} + +int fl_select_browser_item_selected(SELECTBROWSER b, void * item) { + return reinterpret_cast<My_Select_Browser*>(b)->item_selected(item); +} + +void fl_select_browser_item_swap(SELECTBROWSER b, void * x, void * y) { + reinterpret_cast<My_Select_Browser*>(b)->item_swap(x, y); +} + +const char * fl_select_browser_item_text(SELECTBROWSER b, void * item) { + return reinterpret_cast<My_Select_Browser*>(b)->item_text(item); +} + +void fl_select_browser_item_draw(SELECTBROWSER b, void * item, int x, int y, int w, int h) { + reinterpret_cast<My_Select_Browser*>(b)->item_draw(item, x, y, w, h); +} + + + + +int fl_select_browser_lineno(SELECTBROWSER b, void * item) { + return reinterpret_cast<My_Select_Browser*>(b)->lineno(item); +} + + + + +void * fl_select_browser_selection(SELECTBROWSER c) { + return reinterpret_cast<My_Select_Browser*>(c)->selection(); +} + +int fl_select_browser_displayed2(SELECTBROWSER c, void * i) { + return reinterpret_cast<My_Select_Browser*>(c)->Fl_Browser_::displayed(i); +} + +void * fl_select_browser_find_item(SELECTBROWSER c, int y) { + return reinterpret_cast<My_Select_Browser*>(c)->find_item(y); +} + +void * fl_select_browser_top(SELECTBROWSER c) { + return reinterpret_cast<My_Select_Browser*>(c)->top(); +} + + + + +void fl_select_browser_bbox(SELECTBROWSER c, int &x, int &y, int &w, int &h) { + reinterpret_cast<My_Select_Browser*>(c)->bbox(x, y, w, h); +} + +int fl_select_browser_leftedge(SELECTBROWSER c) { + return reinterpret_cast<My_Select_Browser*>(c)->leftedge(); +} + +void fl_select_browser_redraw_line(SELECTBROWSER c, void * i) { + reinterpret_cast<My_Select_Browser*>(c)->redraw_line(i); +} + +void fl_select_browser_redraw_lines(SELECTBROWSER c) { + reinterpret_cast<My_Select_Browser*>(c)->redraw_lines(); +} + + + + +int fl_select_browser_full_width(SELECTBROWSER c) { + return reinterpret_cast<My_Select_Browser*>(c)->Fl_Browser::full_width(); +} + +int fl_select_browser_item_quick_height(SELECTBROWSER c, void * i) { + return reinterpret_cast<My_Select_Browser*>(c)->Fl_Browser::item_quick_height(i); +} + + + + +void fl_select_browser_new_list(SELECTBROWSER b) { + reinterpret_cast<My_Select_Browser*>(b)->new_list(); +} + +void fl_select_browser_inserting(SELECTBROWSER b, void * a1, void * a2) { + reinterpret_cast<My_Select_Browser*>(b)->inserting(a1, a2); +} + +void fl_select_browser_deleting(SELECTBROWSER b, void * item) { + reinterpret_cast<My_Select_Browser*>(b)->deleting(item); +} + +void fl_select_browser_replacing(SELECTBROWSER b, void * a1, void * a2) { + reinterpret_cast<My_Select_Browser*>(b)->replacing(a1, a2); +} + +void fl_select_browser_swapping(SELECTBROWSER b, void * a1, void * a2) { + reinterpret_cast<My_Select_Browser*>(b)->swapping(a1, a2); +} + + + + +void fl_select_browser_draw(SELECTBROWSER b) { + reinterpret_cast<My_Select_Browser*>(b)->Fl_Browser::draw(); +} + +int fl_select_browser_handle(SELECTBROWSER b, int e) { + return reinterpret_cast<My_Select_Browser*>(b)->Fl_Browser::handle(e); +} + + diff --git a/src/c_fl_select_browser.h b/src/c_fl_select_browser.h new file mode 100644 index 0000000..80d2437 --- /dev/null +++ b/src/c_fl_select_browser.h @@ -0,0 +1,70 @@ + + +// Programmed by Jedidiah Barber +// Released into the public domain + + +#ifndef FL_SELECT_BROWSER_GUARD +#define FL_SELECT_BROWSER_GUARD + + +typedef void* SELECTBROWSER; + + +extern "C" SELECTBROWSER new_fl_select_browser(int x, int y, int w, int h, char * label); +extern "C" void free_fl_select_browser(SELECTBROWSER b); + + +// reimp below here + +extern "C" int fl_select_browser_full_height(SELECTBROWSER c); +extern "C" int fl_select_browser_incr_height(SELECTBROWSER c); + + +extern "C" int fl_select_browser_item_width(SELECTBROWSER b, void * item); +extern "C" int fl_select_browser_item_height(SELECTBROWSER b, void * item); +extern "C" void * fl_select_browser_item_first(SELECTBROWSER b); +extern "C" void * fl_select_browser_item_last(SELECTBROWSER b); +extern "C" void * fl_select_browser_item_next(SELECTBROWSER b, void * item); +extern "C" void * fl_select_browser_item_prev(SELECTBROWSER b, void * item); +extern "C" void * fl_select_browser_item_at(SELECTBROWSER b, int index); +extern "C" void fl_select_browser_item_select(SELECTBROWSER b, void * item, int val=1); +extern "C" int fl_select_browser_item_selected(SELECTBROWSER b, void * item); +extern "C" void fl_select_browser_item_swap(SELECTBROWSER b, void * x, void * y); +extern "C" const char * fl_select_browser_item_text(SELECTBROWSER b, void * item); +extern "C" void fl_select_browser_item_draw(SELECTBROWSER b, void * item, int x, int y, int w, int h); + + +extern "C" int fl_select_browser_lineno(SELECTBROWSER b, void * item); + + +extern "C" void * fl_select_browser_selection(SELECTBROWSER c); +extern "C" int fl_select_browser_displayed2(SELECTBROWSER c, void * i); +extern "C" void * fl_select_browser_find_item(SELECTBROWSER c, int y); +extern "C" void * fl_select_browser_top(SELECTBROWSER c); + + +extern "C" void fl_select_browser_bbox(SELECTBROWSER c, int &x, int &y, int &w, int &h); +extern "C" int fl_select_browser_leftedge(SELECTBROWSER c); +extern "C" void fl_select_browser_redraw_line(SELECTBROWSER c, void * i); +extern "C" void fl_select_browser_redraw_lines(SELECTBROWSER c); + + +extern "C" int fl_select_browser_full_width(SELECTBROWSER c); +extern "C" int fl_select_browser_item_quick_height(SELECTBROWSER c, void * i); + + +extern "C" void fl_select_browser_new_list(SELECTBROWSER b); +extern "C" void fl_select_browser_inserting(SELECTBROWSER b, void * a1, void * a2); +extern "C" void fl_select_browser_deleting(SELECTBROWSER b, void * item); +extern "C" void fl_select_browser_replacing(SELECTBROWSER b, void * a1, void * a2); +extern "C" void fl_select_browser_swapping(SELECTBROWSER b, void * a1, void * a2); + + +extern "C" void fl_select_browser_draw(SELECTBROWSER b); +extern "C" int fl_select_browser_handle(SELECTBROWSER b, int e); + + +#endif + + diff --git a/src/fltk-widgets-groups-browsers-textline-choice.adb b/src/fltk-widgets-groups-browsers-textline-choice.adb new file mode 100644 index 0000000..565eba5 --- /dev/null +++ b/src/fltk-widgets-groups-browsers-textline-choice.adb @@ -0,0 +1,346 @@ + + +-- Programmed by Jedidiah Barber +-- Released into the public domain + + +with + + Interfaces.C.Strings; + + +package body FLTK.Widgets.Groups.Browsers.Textline.Choice is + + + ------------------------ + -- Functions From C -- + ------------------------ + + function new_fl_select_browser + (X, Y, W, H : in Interfaces.C.int; + Text : in Interfaces.C.char_array) + return Storage.Integer_Address; + pragma Import (C, new_fl_select_browser, "new_fl_select_browser"); + pragma Inline (new_fl_select_browser); + + procedure free_fl_select_browser + (B : in Storage.Integer_Address); + pragma Import (C, free_fl_select_browser, "free_fl_select_browser"); + pragma Inline (free_fl_select_browser); + + + + + + function fl_select_browser_item_width + (B, I : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_select_browser_item_width, "fl_select_browser_item_width"); + pragma Inline (fl_select_browser_item_width); + + function fl_select_browser_item_height + (B, I : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_select_browser_item_height, "fl_select_browser_item_height"); + pragma Inline (fl_select_browser_item_height); + + function fl_select_browser_item_first + (B : in Storage.Integer_Address) + return Storage.Integer_Address; + pragma Import (C, fl_select_browser_item_first, "fl_select_browser_item_first"); + pragma Inline (fl_select_browser_item_first); + + function fl_select_browser_item_last + (B : in Storage.Integer_Address) + return Storage.Integer_Address; + pragma Import (C, fl_select_browser_item_last, "fl_select_browser_item_last"); + pragma Inline (fl_select_browser_item_last); + + function fl_select_browser_item_next + (B, I : in Storage.Integer_Address) + return Storage.Integer_Address; + pragma Import (C, fl_select_browser_item_next, "fl_select_browser_item_next"); + pragma Inline (fl_select_browser_item_next); + + function fl_select_browser_item_prev + (B, I : in Storage.Integer_Address) + return Storage.Integer_Address; + pragma Import (C, fl_select_browser_item_prev, "fl_select_browser_item_prev"); + pragma Inline (fl_select_browser_item_prev); + + function fl_select_browser_item_at + (B : in Storage.Integer_Address; + N : in Interfaces.C.int) + return Storage.Integer_Address; + pragma Import (C, fl_select_browser_item_at, "fl_select_browser_item_at"); + pragma Inline (fl_select_browser_item_at); + + procedure fl_select_browser_item_select + (B, I : in Storage.Integer_Address; + V : in Interfaces.C.int); + pragma Import (C, fl_select_browser_item_select, "fl_select_browser_item_select"); + pragma Inline (fl_select_browser_item_select); + + function fl_select_browser_item_selected + (B, I : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_select_browser_item_selected, "fl_select_browser_item_selected"); + pragma Inline (fl_select_browser_item_selected); + + procedure fl_select_browser_item_swap + (B, X, Y : in Storage.Integer_Address); + pragma Import (C, fl_select_browser_item_swap, "fl_select_browser_item_swap"); + pragma Inline (fl_select_browser_item_swap); + + function fl_select_browser_item_text + (B, I : in Storage.Integer_Address) + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, fl_select_browser_item_text, "fl_select_browser_item_text"); + pragma Inline (fl_select_browser_item_text); + + procedure fl_select_browser_item_draw + (B, I : in Storage.Integer_Address; + X, Y, W, H : in Interfaces.C.int); + pragma Import (C, fl_select_browser_item_draw, "fl_select_browser_item_draw"); + pragma Inline (fl_select_browser_item_draw); + + + + + + function fl_select_browser_selection + (B : in Storage.Integer_Address) + return Storage.Integer_Address; + pragma Import (C, fl_select_browser_selection, "fl_select_browser_selection"); + pragma Inline (fl_select_browser_selection); + + function fl_select_browser_displayed2 + (B, I : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_select_browser_displayed2, "fl_select_browser_displayed2"); + pragma Inline (fl_select_browser_displayed2); + + function fl_select_browser_find_item + (B : in Storage.Integer_Address; + Y : in Interfaces.C.int) + return Storage.Integer_Address; + pragma Import (C, fl_select_browser_find_item, "fl_select_browser_find_item"); + pragma Inline (fl_select_browser_find_item); + + function fl_select_browser_top + (B : in Storage.Integer_Address) + return Storage.Integer_Address; + pragma Import (C, fl_select_browser_top, "fl_select_browser_top"); + pragma Inline (fl_select_browser_top); + + + + + procedure fl_select_browser_bbox + (B : in Storage.Integer_Address; + X, Y, W, H : out Interfaces.C.int); + pragma Import (C, fl_select_browser_bbox, "fl_select_browser_bbox"); + pragma Inline (fl_select_browser_bbox); + + function fl_select_browser_leftedge + (B : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_select_browser_leftedge, "fl_select_browser_leftedge"); + pragma Inline (fl_select_browser_leftedge); + + procedure fl_select_browser_redraw_line + (B, I : in Storage.Integer_Address); + pragma Import (C, fl_select_browser_redraw_line, "fl_select_browser_redraw_line"); + pragma Inline (fl_select_browser_redraw_line); + + procedure fl_select_browser_redraw_lines + (B : in Storage.Integer_Address); + pragma Import (C, fl_select_browser_redraw_lines, "fl_select_browser_redraw_lines"); + pragma Inline (fl_select_browser_redraw_lines); + + + + + function fl_select_browser_full_width + (B : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_select_browser_full_width, "fl_select_browser_full_width"); + pragma Inline (fl_select_browser_full_width); + + function fl_select_browser_full_height + (B : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_select_browser_full_height, "fl_select_browser_full_height"); + pragma Inline (fl_select_browser_full_height); + + function fl_select_browser_incr_height + (B : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_select_browser_incr_height, "fl_select_browser_incr_height"); + pragma Inline (fl_select_browser_incr_height); + + function fl_select_browser_item_quick_height + (B, I : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_select_browser_item_quick_height, "fl_select_browser_item_quick_height"); + pragma Inline (fl_select_browser_item_quick_height); + + + + + function fl_select_browser_lineno + (B, I : in Storage.Integer_Address) + return Interfaces.C.int; + pragma Import (C, fl_select_browser_lineno, "fl_select_browser_lineno"); + pragma Inline (fl_select_browser_lineno); + + + + + procedure fl_select_browser_new_list + (B : in Storage.Integer_Address); + pragma Import (C, fl_select_browser_new_list, "fl_select_browser_new_list"); + pragma Inline (fl_select_browser_new_list); + + procedure fl_select_browser_inserting + (B, A1, A2 : in Storage.Integer_Address); + pragma Import (C, fl_select_browser_inserting, "fl_select_browser_inserting"); + pragma Inline (fl_select_browser_inserting); + + procedure fl_select_browser_deleting + (B, I : in Storage.Integer_Address); + pragma Import (C, fl_select_browser_deleting, "fl_select_browser_deleting"); + pragma Inline (fl_select_browser_deleting); + + procedure fl_select_browser_replacing + (B, A1, A2 : in Storage.Integer_Address); + pragma Import (C, fl_select_browser_replacing, "fl_select_browser_replacing"); + pragma Inline (fl_select_browser_replacing); + + procedure fl_select_browser_swapping + (B, A1, A2 : in Storage.Integer_Address); + pragma Import (C, fl_select_browser_swapping, "fl_select_browser_swapping"); + pragma Inline (fl_select_browser_swapping); + + + + + procedure fl_select_browser_draw + (B : in Storage.Integer_Address); + pragma Import (C, fl_select_browser_draw, "fl_select_browser_draw"); + pragma Inline (fl_select_browser_draw); + + function fl_select_browser_handle + (B : in Storage.Integer_Address; + E : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_select_browser_handle, "fl_select_browser_handle"); + pragma Inline (fl_select_browser_handle); + + + + + ------------------- + -- Destructors -- + ------------------- + + procedure Extra_Final + (This : in out Choice_Browser) is + begin + Extra_Final (Textline_Browser (This)); + end Extra_Final; + + + procedure Finalize + (This : in out Choice_Browser) is + begin + Extra_Final (This); + if This.Void_Ptr /= Null_Pointer and This.Needs_Dealloc then + free_fl_select_browser (This.Void_Ptr); + This.Void_Ptr := Null_Pointer; + end if; + end Finalize; + + + + + -------------------- + -- Constructors -- + -------------------- + + procedure Extra_Init + (This : in out Choice_Browser; + X, Y, W, H : in Integer; + Text : in String) is + begin + Extra_Init (Textline_Browser (This), X, Y, W, H, Text); + end Extra_Init; + + + procedure Initialize + (This : in out Choice_Browser) is + begin + This.Item_Override_Ptrs := + (Item_Width_Ptr => fl_select_browser_item_width'Address, + Item_Height_Ptr => fl_select_browser_item_height'Address, + Item_First_Ptr => fl_select_browser_item_first'Address, + Item_Last_Ptr => fl_select_browser_item_last'Address, + Item_Next_Ptr => fl_select_browser_item_next'Address, + Item_Previous_Ptr => fl_select_browser_item_prev'Address, + Item_At_Ptr => fl_select_browser_item_at'Address, + Item_Select_Ptr => fl_select_browser_item_select'Address, + Item_Selected_Ptr => fl_select_browser_item_selected'Address, + Item_Swap_Ptr => fl_select_browser_item_swap'Address, + Item_Text_Ptr => fl_select_browser_item_text'Address, + Item_Draw_Ptr => fl_select_browser_item_draw'Address); + This.Item_Inherit_Ptrs := + (Current_Selection_Ptr => fl_select_browser_selection'Address, + Is_Displayed_Ptr => fl_select_browser_displayed2'Address, + Find_Item_Ptr => fl_select_browser_find_item'Address, + Top_Item_Ptr => fl_select_browser_top'Address); + This.Redrawing_Ptrs := + (Bounding_Box_Ptr => fl_select_browser_bbox'Address, + Left_Edge_Ptr => fl_select_browser_leftedge'Address, + Redraw_Line_Ptr => fl_select_browser_redraw_line'Address, + Redraw_List_Ptr => fl_select_browser_redraw_lines'Address); + This.Wide_High_Ptrs := + (Full_List_Width_Ptr => fl_select_browser_full_width'Address, + Full_List_Height_Ptr => fl_select_browser_full_height'Address, + Average_Item_Height_Ptr => fl_select_browser_incr_height'Address, + Item_Quick_Height_Ptr => fl_select_browser_item_quick_height'Address); + This.Cache_Ptrs := + (New_List_Ptr => fl_select_browser_new_list'Address, + Inserting_Ptr => fl_select_browser_inserting'Address, + Deleting_Ptr => fl_select_browser_deleting'Address, + Replacing_Ptr => fl_select_browser_replacing'Address, + Swapping_Ptr => fl_select_browser_swapping'Address); + This.Draw_Ptr := fl_select_browser_draw'Address; + This.Handle_Ptr := fl_select_browser_handle'Address; + This.Line_Number_Ptr := fl_select_browser_lineno'Address; + end Initialize; + + + package body Forge is + + function Create + (X, Y, W, H : in Integer; + Text : in String := "") + return Choice_Browser is + begin + return This : Choice_Browser do + This.Void_Ptr := new_fl_select_browser + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.To_C (Text)); + Extra_Init (This, X, Y, W, H, Text); + end return; + end Create; + + end Forge; + + +end FLTK.Widgets.Groups.Browsers.Textline.Choice; + + diff --git a/src/fltk-widgets-groups-browsers-textline-choice.ads b/src/fltk-widgets-groups-browsers-textline-choice.ads new file mode 100644 index 0000000..a1b78af --- /dev/null +++ b/src/fltk-widgets-groups-browsers-textline-choice.ads @@ -0,0 +1,48 @@ + + +-- Programmed by Jedidiah Barber +-- Released into the public domain + + +package FLTK.Widgets.Groups.Browsers.Textline.Choice is + + + type Choice_Browser is new Textline_Browser with private; + + type Choice_Browser_Reference (Data : not null access Choice_Browser'Class) is + limited null record with Implicit_Dereference => Data; + + + package Forge is + + function Create + (X, Y, W, H : in Integer; + Text : in String := "") + return Choice_Browser; + + end Forge; + + +private + + + type Choice_Browser is new Textline_Browser with null record; + + overriding procedure Initialize + (This : in out Choice_Browser); + + overriding procedure Finalize + (This : in out Choice_Browser); + + procedure Extra_Init + (This : in out Choice_Browser; + X, Y, W, H : in Integer; + Text : in String); + + procedure Extra_Final + (This : in out Choice_Browser); + + +end FLTK.Widgets.Groups.Browsers.Textline.Choice; + + |