summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2024-12-22 21:21:51 +1300
committerJedidiah Barber <contact@jedbarber.id.au>2024-12-22 21:21:51 +1300
commit28cbb294051d47a1dd0731333dd103132b6ae793 (patch)
treee47d1b8f0be8e549184455016ea51e3aafeff650
parentc7e4f58a5fb0d62c4af3b82dabb1b52e72f99743 (diff)
Added Fl_File_Browser
-rw-r--r--doc/fl_file_browser.html194
-rw-r--r--doc/index.html3
-rw-r--r--progress.txt2
-rw-r--r--src/c_fl_file_browser.cpp393
-rw-r--r--src/c_fl_file_browser.h83
-rw-r--r--src/fltk-widgets-groups-browsers-textline-file.adb567
-rw-r--r--src/fltk-widgets-groups-browsers-textline-file.ads118
-rw-r--r--src/fltk-widgets-groups-browsers-textline.adb8
8 files changed, 1365 insertions, 3 deletions
diff --git a/doc/fl_file_browser.html b/doc/fl_file_browser.html
new file mode 100644
index 0000000..9f9eddb
--- /dev/null
+++ b/doc/fl_file_browser.html
@@ -0,0 +1,194 @@
+<!DOCTYPE html>
+
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <title>Fl_File_Browser Binding Map</title>
+ <link href="map.css" rel="stylesheet">
+ </head>
+
+ <body>
+
+
+<h2>Fl_File_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_File_Browser</td>
+ <td>FLTK.Widgets.Groups.Browsers.Textline.File</td>
+ </tr>
+
+</table>
+
+
+
+<table class="type">
+ <tr><th colspan="2">Types</th></tr>
+
+ <tr>
+ <td>Fl_File_Browser</td>
+ <td>File_Browser</td>
+ </tr>
+
+ <tr>
+ <td>&nbsp;</td>
+ <td>File_Browser_Reference</td>
+ </tr>
+
+ <tr>
+ <td>enum {FILES, DIRECTORIES}</td>
+ <td>File_Kind</td>
+ </tr>
+
+ <tr>
+ <td>uchar</td>
+ <td>Icon_Size</td>
+ </tr>
+
+</table>
+
+
+
+<table class="function">
+ <tr><th colspan="2">Constructors</th></tr>
+
+ <tr>
+<td><pre>
+Fl_File_Browser(int, int, int, int, const char *=0);
+</pre></td>
+<td><pre>
+function Create
+ (X, Y, W, H : in Integer;
+ Text : in String := "")
+ return File_Browser;
+</pre></td>
+ </tr>
+
+</table>
+
+
+
+<table class="function">
+ <tr><th colspan="2">Functions and Procedures</th></tr>
+
+ <tr>
+<td><pre>
+int filetype() const;
+</pre></td>
+<td><pre>
+function Get_File_Kind
+ (This : in File_Browser)
+ return File_Kind;
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+void filetype(int t);
+</pre></td>
+<td><pre>
+procedure Set_File_Kind
+ (This : in out File_Browser;
+ Value : in File_Kind);
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+const char * filter() const;
+</pre></td>
+<td><pre>
+function Get_Filter
+ (This : in File_Browser)
+ return String;
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+void filter(const char *pattern);
+</pre></td>
+<td><pre>
+procedure Set_Filter
+ (This : in out File_Browser;
+ Value : in String);
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+uchar iconsize() const;
+</pre></td>
+<td><pre>
+function Get_Icon_Size
+ (This : in File_Browser)
+ return Icon_Size;
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+void iconsize(uchar s);
+</pre></td>
+<td><pre>
+procedure Set_Icon_Size
+ (This : in out File_Browser;
+ Value : in Icon_Size);
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+int load(const char *directory, Fl_File_Sort_F
+ *sort=fl_numericsort);
+</pre></td>
+<td><pre>
+function Load
+ (This : in out File_Browser;
+ Dir : in String;
+ Sort : in not null FLTK.Filenames.Compare_Function :=
+ FLTK.Filenames.Numeric_Sort'Access)
+ return Natural;
+
+procedure Load
+ (This : in out File_Browser;
+ Dir : in String;
+ Sort : in not null FLTK.Filenames.Compare_Function :=
+ FLTK.Filenames.Numeric_Sort'Access);
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+Fl_Fontsize textsize() const;
+</pre></td>
+<td><pre>
+function Get_Text_Size
+ (This : in File_Browser)
+ return Font_Size;
+</pre></td>
+ </tr>
+
+ <tr>
+<td><pre>
+void textsize(Fl_Fontsize s);
+</pre></td>
+<td><pre>
+procedure Set_Text_Size
+ (This : in out File_Browser;
+ Size : in Font_Size);
+</pre></td>
+ </tr>
+
+</table>
+
+
+ </body>
+</html>
+
diff --git a/doc/index.html b/doc/index.html
index db2679b..4e7357d 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -42,7 +42,7 @@
<li>Fl_Display_Device</li>
<li><a href="fl_double_window.html">Fl_Double_Window</a></li>
<li><a href="fl_draw.html">Fl_Draw</a></li>
- <li>Fl_File_Browser</li>
+ <li><a href="fl_file_browser.html">Fl_File_Browser</a></li>
<li><a href="fl_file_chooser.html">Fl_File_Chooser</a></li>
<li><a href="fl_file_input.html">Fl_File_Input</a></li>
<li><a href="fl_fill_dial.html">Fl_Fill_Dial</a></li>
@@ -191,6 +191,7 @@
<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_file_browser.html">FLTK.Widgets.Groups.Browsers.Textline.File</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 85cb77c..c604f6e 100644
--- a/progress.txt
+++ b/progress.txt
@@ -74,6 +74,7 @@ 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.File
FLTK.Widgets.Groups.Browsers.Textline.Hold
FLTK.Widgets.Groups.Browsers.Textline.Multi
FLTK.Widgets.Groups.Color_Choosers
@@ -146,7 +147,6 @@ FLTK.Devices.Surfaces (incomplete API, otherwise polished)
To-Do:
Fl_Display_Device
-Fl_File_Browser
Fl_Glut_Window
Fl_Postscript_File_Device
Fl_Table
diff --git a/src/c_fl_file_browser.cpp b/src/c_fl_file_browser.cpp
new file mode 100644
index 0000000..836a991
--- /dev/null
+++ b/src/c_fl_file_browser.cpp
@@ -0,0 +1,393 @@
+
+
+// Programmed by Jedidiah Barber
+// Released into the public domain
+
+
+#include <FL/Fl_File_Browser.H>
+#include <FL/filename.H>
+#include "c_fl_file_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_File_Browser : public Fl_File_Browser {
+public:
+ using Fl_File_Browser::Fl_File_Browser;
+
+ friend int fl_file_browser_item_width(FILEBROWSER b, void * item);
+ friend int fl_file_browser_item_height(FILEBROWSER b, void * item);
+ friend void * fl_file_browser_item_first(FILEBROWSER b);
+ friend void * fl_file_browser_item_last(FILEBROWSER b);
+ friend void * fl_file_browser_item_next(FILEBROWSER b, void * item);
+ friend void * fl_file_browser_item_prev(FILEBROWSER b, void * item);
+ friend void * fl_file_browser_item_at(FILEBROWSER b, int index);
+ friend void fl_file_browser_item_select(FILEBROWSER b, void * item, int val);
+ friend int fl_file_browser_item_selected(FILEBROWSER b, void * item);
+ friend void fl_file_browser_item_swap(FILEBROWSER b, void * x, void * y);
+ friend const char * fl_file_browser_item_text(FILEBROWSER b, void * item);
+ friend void fl_file_browser_item_draw(FILEBROWSER b, void * item, int x, int y, int w, int h);
+
+ friend int fl_file_browser_lineno(FILEBROWSER b, void * item);
+
+ friend void * fl_file_browser_selection(FILEBROWSER c);
+ friend int fl_file_browser_displayed2(FILEBROWSER c, void * i);
+ friend void * fl_file_browser_find_item(FILEBROWSER c, int y);
+ friend void * fl_file_browser_top(FILEBROWSER c);
+
+ friend void fl_file_browser_bbox(FILEBROWSER c, int &x, int &y, int &w, int &h);
+ friend int fl_file_browser_leftedge(FILEBROWSER c);
+ friend void fl_file_browser_redraw_line(FILEBROWSER c, void * i);
+ friend void fl_file_browser_redraw_lines(FILEBROWSER c);
+
+ friend int fl_file_browser_full_width(FILEBROWSER c);
+ friend int fl_file_browser_full_height(FILEBROWSER c);
+ friend int fl_file_browser_incr_height(FILEBROWSER c);
+ friend int fl_file_browser_item_quick_height(FILEBROWSER c, void * i);
+
+ friend void fl_file_browser_new_list(FILEBROWSER b);
+ friend void fl_file_browser_inserting(FILEBROWSER b, void * a1, void * a2);
+ friend void fl_file_browser_deleting(FILEBROWSER b, void * item);
+ friend void fl_file_browser_replacing(FILEBROWSER b, void * a1, void * a2);
+ friend void fl_file_browser_swapping(FILEBROWSER b, void * a1, void * a2);
+
+ friend void fl_file_browser_draw(FILEBROWSER 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_File_Browser::full_width() const {
+ return browser_full_width_hook(this->user_data());
+}
+
+int My_File_Browser::full_height() const {
+ return browser_full_height_hook(this->user_data());
+}
+
+int My_File_Browser::incr_height() const {
+ return browser_incr_height_hook(this->user_data());
+}
+
+int My_File_Browser::item_quick_height(void * item) const {
+ return browser_item_quick_height_hook(this->user_data(), item);
+}
+
+
+int My_File_Browser::item_width(void * item) const {
+ return browser_item_width_hook(this->user_data(), item);
+}
+
+int My_File_Browser::item_height(void * item) const {
+ return browser_item_height_hook(this->user_data(), item);
+}
+
+void * My_File_Browser::item_first() const {
+ return browser_item_first_hook(this->user_data());
+}
+
+void * My_File_Browser::item_last() const {
+ return browser_item_last_hook(this->user_data());
+}
+
+void * My_File_Browser::item_next(void * item) const {
+ return browser_item_next_hook(this->user_data(), item);
+}
+
+void * My_File_Browser::item_prev(void * item) const {
+ return browser_item_prev_hook(this->user_data(), item);
+}
+
+void * My_File_Browser::item_at(int index) const {
+ return browser_item_at_hook(this->user_data(), index);
+}
+
+void My_File_Browser::item_select(void * item, int val) {
+ browser_item_select_hook(this->user_data(), item, val);
+}
+
+int My_File_Browser::item_selected(void * item) const {
+ return browser_item_selected_hook(this->user_data(), item);
+}
+
+void My_File_Browser::item_swap(void * a, void * b) {
+ browser_item_swap_hook(this->user_data(), a, b);
+}
+
+const char * My_File_Browser::item_text(void * item) const {
+ return browser_item_text_hook(this->user_data(), item);
+}
+
+void My_File_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_File_Browser::draw() {
+ widget_draw_hook(this->user_data());
+}
+
+int My_File_Browser::handle(int e) {
+ return widget_handle_hook(this->user_data(), e);
+}
+
+
+
+
+// Flattened C API begins here
+
+FILEBROWSER new_fl_file_browser(int x, int y, int w, int h, char * label) {
+ My_File_Browser *b = new My_File_Browser(x, y, w, h, label);
+ return b;
+}
+
+void free_fl_file_browser(FILEBROWSER b) {
+ delete reinterpret_cast<My_File_Browser*>(b);
+}
+
+
+
+
+int fl_file_browser_load(FILEBROWSER b, const char * d, void * s) {
+ return reinterpret_cast<Fl_File_Browser*>(b)->load(d, reinterpret_cast<Fl_File_Sort_F*>(s));
+}
+
+
+
+
+int fl_file_browser_get_filetype(FILEBROWSER b) {
+ return reinterpret_cast<Fl_File_Browser*>(b)->filetype();
+}
+
+void fl_file_browser_set_filetype(FILEBROWSER b, int f) {
+ reinterpret_cast<Fl_File_Browser*>(b)->filetype(f);
+}
+
+const char * fl_file_browser_get_filter(FILEBROWSER b) {
+ return reinterpret_cast<Fl_File_Browser*>(b)->filter();
+}
+
+void fl_file_browser_set_filter(FILEBROWSER b, const char * f) {
+ reinterpret_cast<Fl_File_Browser*>(b)->filter(f);
+}
+
+unsigned char fl_file_browser_get_iconsize(FILEBROWSER b) {
+ return reinterpret_cast<Fl_File_Browser*>(b)->iconsize();
+}
+
+void fl_file_browser_set_iconsize(FILEBROWSER b, unsigned int i) {
+ reinterpret_cast<Fl_File_Browser*>(b)->iconsize(i);
+}
+
+int fl_file_browser_get_textsize(FILEBROWSER b) {
+ return reinterpret_cast<Fl_File_Browser*>(b)->textsize();
+}
+
+void fl_file_browser_set_textsize(FILEBROWSER b, int s) {
+ reinterpret_cast<Fl_File_Browser*>(b)->textsize(s);
+}
+
+
+
+
+// These have to be reimplemented due to relying on custom class extensions
+
+int fl_file_browser_full_height(FILEBROWSER c) {
+ return reinterpret_cast<My_File_Browser*>(c)->Fl_Browser::full_height();
+}
+
+int fl_file_browser_incr_height(FILEBROWSER c) {
+ return reinterpret_cast<My_File_Browser*>(c)->Fl_Browser::incr_height();
+}
+
+
+
+
+int fl_file_browser_item_width(FILEBROWSER b, void * item) {
+ return reinterpret_cast<My_File_Browser*>(b)->item_width(item);
+}
+
+int fl_file_browser_item_height(FILEBROWSER b, void * item) {
+ return reinterpret_cast<My_File_Browser*>(b)->item_height(item);
+}
+
+void * fl_file_browser_item_first(FILEBROWSER b) {
+ return reinterpret_cast<My_File_Browser*>(b)->item_first();
+}
+
+void * fl_file_browser_item_last(FILEBROWSER b) {
+ return reinterpret_cast<My_File_Browser*>(b)->item_last();
+}
+
+void * fl_file_browser_item_next(FILEBROWSER b, void * item) {
+ return reinterpret_cast<My_File_Browser*>(b)->item_next(item);
+}
+
+void * fl_file_browser_item_prev(FILEBROWSER b, void * item) {
+ return reinterpret_cast<My_File_Browser*>(b)->item_prev(item);
+}
+
+void * fl_file_browser_item_at(FILEBROWSER b, int index) {
+ return reinterpret_cast<My_File_Browser*>(b)->item_at(index);
+}
+
+void fl_file_browser_item_select(FILEBROWSER b, void * item, int val) {
+ reinterpret_cast<My_File_Browser*>(b)->item_select(item, val);
+}
+
+int fl_file_browser_item_selected(FILEBROWSER b, void * item) {
+ return reinterpret_cast<My_File_Browser*>(b)->item_selected(item);
+}
+
+void fl_file_browser_item_swap(FILEBROWSER b, void * x, void * y) {
+ reinterpret_cast<My_File_Browser*>(b)->item_swap(x, y);
+}
+
+const char * fl_file_browser_item_text(FILEBROWSER b, void * item) {
+ return reinterpret_cast<My_File_Browser*>(b)->item_text(item);
+}
+
+void fl_file_browser_item_draw(FILEBROWSER b, void * item, int x, int y, int w, int h) {
+ reinterpret_cast<My_File_Browser*>(b)->item_draw(item, x, y, w, h);
+}
+
+
+
+
+int fl_file_browser_lineno(FILEBROWSER b, void * item) {
+ return reinterpret_cast<My_File_Browser*>(b)->lineno(item);
+}
+
+
+
+
+void * fl_file_browser_selection(FILEBROWSER c) {
+ return reinterpret_cast<My_File_Browser*>(c)->selection();
+}
+
+int fl_file_browser_displayed2(FILEBROWSER c, void * i) {
+ return reinterpret_cast<My_File_Browser*>(c)->Fl_Browser_::displayed(i);
+}
+
+void * fl_file_browser_find_item(FILEBROWSER c, int y) {
+ return reinterpret_cast<My_File_Browser*>(c)->find_item(y);
+}
+
+void * fl_file_browser_top(FILEBROWSER c) {
+ return reinterpret_cast<My_File_Browser*>(c)->top();
+}
+
+
+
+
+void fl_file_browser_bbox(FILEBROWSER c, int &x, int &y, int &w, int &h) {
+ reinterpret_cast<My_File_Browser*>(c)->bbox(x, y, w, h);
+}
+
+int fl_file_browser_leftedge(FILEBROWSER c) {
+ return reinterpret_cast<My_File_Browser*>(c)->leftedge();
+}
+
+void fl_file_browser_redraw_line(FILEBROWSER c, void * i) {
+ reinterpret_cast<My_File_Browser*>(c)->redraw_line(i);
+}
+
+void fl_file_browser_redraw_lines(FILEBROWSER c) {
+ reinterpret_cast<My_File_Browser*>(c)->redraw_lines();
+}
+
+
+
+
+int fl_file_browser_full_width(FILEBROWSER c) {
+ return reinterpret_cast<My_File_Browser*>(c)->Fl_Browser::full_width();
+}
+
+int fl_file_browser_item_quick_height(FILEBROWSER c, void * i) {
+ return reinterpret_cast<My_File_Browser*>(c)->Fl_Browser::item_quick_height(i);
+}
+
+
+
+
+void fl_file_browser_new_list(FILEBROWSER b) {
+ reinterpret_cast<My_File_Browser*>(b)->new_list();
+}
+
+void fl_file_browser_inserting(FILEBROWSER b, void * a1, void * a2) {
+ reinterpret_cast<My_File_Browser*>(b)->inserting(a1, a2);
+}
+
+void fl_file_browser_deleting(FILEBROWSER b, void * item) {
+ reinterpret_cast<My_File_Browser*>(b)->deleting(item);
+}
+
+void fl_file_browser_replacing(FILEBROWSER b, void * a1, void * a2) {
+ reinterpret_cast<My_File_Browser*>(b)->replacing(a1, a2);
+}
+
+void fl_file_browser_swapping(FILEBROWSER b, void * a1, void * a2) {
+ reinterpret_cast<My_File_Browser*>(b)->swapping(a1, a2);
+}
+
+
+
+
+void fl_file_browser_draw(FILEBROWSER b) {
+ reinterpret_cast<My_File_Browser*>(b)->Fl_Browser::draw();
+}
+
+int fl_file_browser_handle(FILEBROWSER b, int e) {
+ return reinterpret_cast<My_File_Browser*>(b)->Fl_Browser::handle(e);
+}
+
+
diff --git a/src/c_fl_file_browser.h b/src/c_fl_file_browser.h
new file mode 100644
index 0000000..3ab5c61
--- /dev/null
+++ b/src/c_fl_file_browser.h
@@ -0,0 +1,83 @@
+
+
+// Programmed by Jedidiah Barber
+// Released into the public domain
+
+
+#ifndef FL_FILE_BROWSER_GUARD
+#define FL_FILE_BROWSER_GUARD
+
+
+typedef void* FILEBROWSER;
+
+
+extern "C" FILEBROWSER new_fl_file_browser(int x, int y, int w, int h, char * label);
+extern "C" void free_fl_file_browser(FILEBROWSER b);
+
+
+extern "C" int fl_file_browser_load(FILEBROWSER b, const char * d, void * s);
+
+
+extern "C" int fl_file_browser_get_filetype(FILEBROWSER b);
+extern "C" void fl_file_browser_set_filetype(FILEBROWSER b, int f);
+extern "C" const char * fl_file_browser_get_filter(FILEBROWSER b);
+extern "C" void fl_file_browser_set_filter(FILEBROWSER b, const char * f);
+extern "C" unsigned char fl_file_browser_get_iconsize(FILEBROWSER b);
+extern "C" void fl_file_browser_set_iconsize(FILEBROWSER b, unsigned int i);
+extern "C" int fl_file_browser_get_textsize(FILEBROWSER b);
+extern "C" void fl_file_browser_set_textsize(FILEBROWSER b, int s);
+
+
+// reimp below here
+
+extern "C" int fl_file_browser_full_height(FILEBROWSER c);
+extern "C" int fl_file_browser_incr_height(FILEBROWSER c);
+
+
+extern "C" int fl_file_browser_item_width(FILEBROWSER b, void * item);
+extern "C" int fl_file_browser_item_height(FILEBROWSER b, void * item);
+extern "C" void * fl_file_browser_item_first(FILEBROWSER b);
+extern "C" void * fl_file_browser_item_last(FILEBROWSER b);
+extern "C" void * fl_file_browser_item_next(FILEBROWSER b, void * item);
+extern "C" void * fl_file_browser_item_prev(FILEBROWSER b, void * item);
+extern "C" void * fl_file_browser_item_at(FILEBROWSER b, int index);
+extern "C" void fl_file_browser_item_select(FILEBROWSER b, void * item, int val=1);
+extern "C" int fl_file_browser_item_selected(FILEBROWSER b, void * item);
+extern "C" void fl_file_browser_item_swap(FILEBROWSER b, void * x, void * y);
+extern "C" const char * fl_file_browser_item_text(FILEBROWSER b, void * item);
+extern "C" void fl_file_browser_item_draw(FILEBROWSER b, void * item, int x, int y, int w, int h);
+
+
+extern "C" int fl_file_browser_lineno(FILEBROWSER b, void * item);
+
+
+extern "C" void * fl_file_browser_selection(FILEBROWSER c);
+extern "C" int fl_file_browser_displayed2(FILEBROWSER c, void * i);
+extern "C" void * fl_file_browser_find_item(FILEBROWSER c, int y);
+extern "C" void * fl_file_browser_top(FILEBROWSER c);
+
+
+extern "C" void fl_file_browser_bbox(FILEBROWSER c, int &x, int &y, int &w, int &h);
+extern "C" int fl_file_browser_leftedge(FILEBROWSER c);
+extern "C" void fl_file_browser_redraw_line(FILEBROWSER c, void * i);
+extern "C" void fl_file_browser_redraw_lines(FILEBROWSER c);
+
+
+extern "C" int fl_file_browser_full_width(FILEBROWSER c);
+extern "C" int fl_file_browser_item_quick_height(FILEBROWSER c, void * i);
+
+
+extern "C" void fl_file_browser_new_list(FILEBROWSER b);
+extern "C" void fl_file_browser_inserting(FILEBROWSER b, void * a1, void * a2);
+extern "C" void fl_file_browser_deleting(FILEBROWSER b, void * item);
+extern "C" void fl_file_browser_replacing(FILEBROWSER b, void * a1, void * a2);
+extern "C" void fl_file_browser_swapping(FILEBROWSER b, void * a1, void * a2);
+
+
+extern "C" void fl_file_browser_draw(FILEBROWSER b);
+extern "C" int fl_file_browser_handle(FILEBROWSER b, int e);
+
+
+#endif
+
+
diff --git a/src/fltk-widgets-groups-browsers-textline-file.adb b/src/fltk-widgets-groups-browsers-textline-file.adb
new file mode 100644
index 0000000..c73e5e4
--- /dev/null
+++ b/src/fltk-widgets-groups-browsers-textline-file.adb
@@ -0,0 +1,567 @@
+
+
+-- Programmed by Jedidiah Barber
+-- Released into the public domain
+
+
+with
+
+ Interfaces.C.Strings;
+
+use type
+
+ Interfaces.C.int,
+ Interfaces.C.Strings.chars_ptr;
+
+
+package body FLTK.Widgets.Groups.Browsers.Textline.File is
+
+
+ ------------------------
+ -- Functions From C --
+ ------------------------
+
+ function get_error_message
+ return Interfaces.C.Strings.chars_ptr;
+ pragma Import (C, get_error_message, "get_error_message");
+ pragma Inline (get_error_message);
+
+ function filename_dname
+ (L : in Storage.Integer_Address;
+ N : in Interfaces.C.int)
+ return Interfaces.C.Strings.chars_ptr;
+ pragma Import (C, filename_dname, "filename_dname");
+ pragma Inline (filename_dname);
+
+
+
+
+ function new_fl_file_browser
+ (X, Y, W, H : in Interfaces.C.int;
+ Text : in Interfaces.C.char_array)
+ return Storage.Integer_Address;
+ pragma Import (C, new_fl_file_browser, "new_fl_file_browser");
+ pragma Inline (new_fl_file_browser);
+
+ procedure free_fl_file_browser
+ (B : in Storage.Integer_Address);
+ pragma Import (C, free_fl_file_browser, "free_fl_file_browser");
+ pragma Inline (free_fl_file_browser);
+
+
+
+
+ function fl_file_browser_load
+ (B : in Storage.Integer_Address;
+ D : in Interfaces.C.char_array;
+ S : in Storage.Integer_Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_file_browser_load, "fl_file_browser_load");
+ pragma Inline (fl_file_browser_load);
+
+
+
+
+ function fl_file_browser_get_filetype
+ (B : in Storage.Integer_Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_file_browser_get_filetype, "fl_file_browser_get_filetype");
+ pragma Inline (fl_file_browser_get_filetype);
+
+ procedure fl_file_browser_set_filetype
+ (B : in Storage.Integer_Address;
+ F : in Interfaces.C.int);
+ pragma Import (C, fl_file_browser_set_filetype, "fl_file_browser_set_filetype");
+ pragma Inline (fl_file_browser_set_filetype);
+
+ function fl_file_browser_get_filter
+ (B : in Storage.Integer_Address)
+ return Interfaces.C.Strings.chars_ptr;
+ pragma Import (C, fl_file_browser_get_filter, "fl_file_browser_get_filter");
+ pragma Inline (fl_file_browser_get_filter);
+
+ procedure fl_file_browser_set_filter
+ (B : in Storage.Integer_Address;
+ F : in Interfaces.C.char_array);
+ pragma Import (C, fl_file_browser_set_filter, "fl_file_browser_set_filter");
+ pragma Inline (fl_file_browser_set_filter);
+
+ function fl_file_browser_get_iconsize
+ (B : in Storage.Integer_Address)
+ return Interfaces.C.unsigned_char;
+ pragma Import (C, fl_file_browser_get_iconsize, "fl_file_browser_get_iconsize");
+ pragma Inline (fl_file_browser_get_iconsize);
+
+ procedure fl_file_browser_set_iconsize
+ (B : in Storage.Integer_Address;
+ I : in Interfaces.C.unsigned_char);
+ pragma Import (C, fl_file_browser_set_iconsize, "fl_file_browser_set_iconsize");
+ pragma Inline (fl_file_browser_set_iconsize);
+
+ function fl_file_browser_get_textsize
+ (B : in Storage.Integer_Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_file_browser_get_textsize, "fl_file_browser_get_textsize");
+ pragma Inline (fl_file_browser_get_textsize);
+
+ procedure fl_file_browser_set_textsize
+ (B : in Storage.Integer_Address;
+ S : in Interfaces.C.int);
+ pragma Import (C, fl_file_browser_set_textsize, "fl_file_browser_set_textsize");
+ pragma Inline (fl_file_browser_set_textsize);
+
+
+
+
+ function fl_file_browser_item_width
+ (B, I : in Storage.Integer_Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_file_browser_item_width, "fl_file_browser_item_width");
+ pragma Inline (fl_file_browser_item_width);
+
+ function fl_file_browser_item_height
+ (B, I : in Storage.Integer_Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_file_browser_item_height, "fl_file_browser_item_height");
+ pragma Inline (fl_file_browser_item_height);
+
+ function fl_file_browser_item_first
+ (B : in Storage.Integer_Address)
+ return Storage.Integer_Address;
+ pragma Import (C, fl_file_browser_item_first, "fl_file_browser_item_first");
+ pragma Inline (fl_file_browser_item_first);
+
+ function fl_file_browser_item_last
+ (B : in Storage.Integer_Address)
+ return Storage.Integer_Address;
+ pragma Import (C, fl_file_browser_item_last, "fl_file_browser_item_last");
+ pragma Inline (fl_file_browser_item_last);
+
+ function fl_file_browser_item_next
+ (B, I : in Storage.Integer_Address)
+ return Storage.Integer_Address;
+ pragma Import (C, fl_file_browser_item_next, "fl_file_browser_item_next");
+ pragma Inline (fl_file_browser_item_next);
+
+ function fl_file_browser_item_prev
+ (B, I : in Storage.Integer_Address)
+ return Storage.Integer_Address;
+ pragma Import (C, fl_file_browser_item_prev, "fl_file_browser_item_prev");
+ pragma Inline (fl_file_browser_item_prev);
+
+ function fl_file_browser_item_at
+ (B : in Storage.Integer_Address;
+ N : in Interfaces.C.int)
+ return Storage.Integer_Address;
+ pragma Import (C, fl_file_browser_item_at, "fl_file_browser_item_at");
+ pragma Inline (fl_file_browser_item_at);
+
+ procedure fl_file_browser_item_select
+ (B, I : in Storage.Integer_Address;
+ V : in Interfaces.C.int);
+ pragma Import (C, fl_file_browser_item_select, "fl_file_browser_item_select");
+ pragma Inline (fl_file_browser_item_select);
+
+ function fl_file_browser_item_selected
+ (B, I : in Storage.Integer_Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_file_browser_item_selected, "fl_file_browser_item_selected");
+ pragma Inline (fl_file_browser_item_selected);
+
+ procedure fl_file_browser_item_swap
+ (B, X, Y : in Storage.Integer_Address);
+ pragma Import (C, fl_file_browser_item_swap, "fl_file_browser_item_swap");
+ pragma Inline (fl_file_browser_item_swap);
+
+ function fl_file_browser_item_text
+ (B, I : in Storage.Integer_Address)
+ return Interfaces.C.Strings.chars_ptr;
+ pragma Import (C, fl_file_browser_item_text, "fl_file_browser_item_text");
+ pragma Inline (fl_file_browser_item_text);
+
+ procedure fl_file_browser_item_draw
+ (B, I : in Storage.Integer_Address;
+ X, Y, W, H : in Interfaces.C.int);
+ pragma Import (C, fl_file_browser_item_draw, "fl_file_browser_item_draw");
+ pragma Inline (fl_file_browser_item_draw);
+
+
+
+
+
+ function fl_file_browser_selection
+ (B : in Storage.Integer_Address)
+ return Storage.Integer_Address;
+ pragma Import (C, fl_file_browser_selection, "fl_file_browser_selection");
+ pragma Inline (fl_file_browser_selection);
+
+ function fl_file_browser_displayed2
+ (B, I : in Storage.Integer_Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_file_browser_displayed2, "fl_file_browser_displayed2");
+ pragma Inline (fl_file_browser_displayed2);
+
+ function fl_file_browser_find_item
+ (B : in Storage.Integer_Address;
+ Y : in Interfaces.C.int)
+ return Storage.Integer_Address;
+ pragma Import (C, fl_file_browser_find_item, "fl_file_browser_find_item");
+ pragma Inline (fl_file_browser_find_item);
+
+ function fl_file_browser_top
+ (B : in Storage.Integer_Address)
+ return Storage.Integer_Address;
+ pragma Import (C, fl_file_browser_top, "fl_file_browser_top");
+ pragma Inline (fl_file_browser_top);
+
+
+
+
+ procedure fl_file_browser_bbox
+ (B : in Storage.Integer_Address;
+ X, Y, W, H : out Interfaces.C.int);
+ pragma Import (C, fl_file_browser_bbox, "fl_file_browser_bbox");
+ pragma Inline (fl_file_browser_bbox);
+
+ function fl_file_browser_leftedge
+ (B : in Storage.Integer_Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_file_browser_leftedge, "fl_file_browser_leftedge");
+ pragma Inline (fl_file_browser_leftedge);
+
+ procedure fl_file_browser_redraw_line
+ (B, I : in Storage.Integer_Address);
+ pragma Import (C, fl_file_browser_redraw_line, "fl_file_browser_redraw_line");
+ pragma Inline (fl_file_browser_redraw_line);
+
+ procedure fl_file_browser_redraw_lines
+ (B : in Storage.Integer_Address);
+ pragma Import (C, fl_file_browser_redraw_lines, "fl_file_browser_redraw_lines");
+ pragma Inline (fl_file_browser_redraw_lines);
+
+
+
+
+ function fl_file_browser_full_width
+ (B : in Storage.Integer_Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_file_browser_full_width, "fl_file_browser_full_width");
+ pragma Inline (fl_file_browser_full_width);
+
+ function fl_file_browser_full_height
+ (B : in Storage.Integer_Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_file_browser_full_height, "fl_file_browser_full_height");
+ pragma Inline (fl_file_browser_full_height);
+
+ function fl_file_browser_incr_height
+ (B : in Storage.Integer_Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_file_browser_incr_height, "fl_file_browser_incr_height");
+ pragma Inline (fl_file_browser_incr_height);
+
+ function fl_file_browser_item_quick_height
+ (B, I : in Storage.Integer_Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_file_browser_item_quick_height, "fl_file_browser_item_quick_height");
+ pragma Inline (fl_file_browser_item_quick_height);
+
+
+
+
+ function fl_file_browser_lineno
+ (B, I : in Storage.Integer_Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_file_browser_lineno, "fl_file_browser_lineno");
+ pragma Inline (fl_file_browser_lineno);
+
+
+
+
+ procedure fl_file_browser_new_list
+ (B : in Storage.Integer_Address);
+ pragma Import (C, fl_file_browser_new_list, "fl_file_browser_new_list");
+ pragma Inline (fl_file_browser_new_list);
+
+ procedure fl_file_browser_inserting
+ (B, A1, A2 : in Storage.Integer_Address);
+ pragma Import (C, fl_file_browser_inserting, "fl_file_browser_inserting");
+ pragma Inline (fl_file_browser_inserting);
+
+ procedure fl_file_browser_deleting
+ (B, I : in Storage.Integer_Address);
+ pragma Import (C, fl_file_browser_deleting, "fl_file_browser_deleting");
+ pragma Inline (fl_file_browser_deleting);
+
+ procedure fl_file_browser_replacing
+ (B, A1, A2 : in Storage.Integer_Address);
+ pragma Import (C, fl_file_browser_replacing, "fl_file_browser_replacing");
+ pragma Inline (fl_file_browser_replacing);
+
+ procedure fl_file_browser_swapping
+ (B, A1, A2 : in Storage.Integer_Address);
+ pragma Import (C, fl_file_browser_swapping, "fl_file_browser_swapping");
+ pragma Inline (fl_file_browser_swapping);
+
+
+
+
+ procedure fl_file_browser_draw
+ (B : in Storage.Integer_Address);
+ pragma Import (C, fl_file_browser_draw, "fl_file_browser_draw");
+ pragma Inline (fl_file_browser_draw);
+
+ function fl_file_browser_handle
+ (B : in Storage.Integer_Address;
+ E : in Interfaces.C.int)
+ return Interfaces.C.int;
+ pragma Import (C, fl_file_browser_handle, "fl_file_browser_handle");
+ pragma Inline (fl_file_browser_handle);
+
+
+
+
+ -------------------
+ -- Destructors --
+ -------------------
+
+ procedure Extra_Final
+ (This : in out File_Browser) is
+ begin
+ Extra_Final (Textline_Browser (This));
+ end Extra_Final;
+
+
+ procedure Finalize
+ (This : in out File_Browser) is
+ begin
+ Extra_Final (This);
+ if This.Void_Ptr /= Null_Pointer and This.Needs_Dealloc then
+ free_fl_file_browser (This.Void_Ptr);
+ This.Void_Ptr := Null_Pointer;
+ end if;
+ end Finalize;
+
+
+
+
+ --------------------
+ -- Constructors --
+ --------------------
+
+ procedure Extra_Init
+ (This : in out File_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 File_Browser) is
+ begin
+ This.Item_Override_Ptrs :=
+ (Item_Width_Ptr => fl_file_browser_item_width'Address,
+ Item_Height_Ptr => fl_file_browser_item_height'Address,
+ Item_First_Ptr => fl_file_browser_item_first'Address,
+ Item_Last_Ptr => fl_file_browser_item_last'Address,
+ Item_Next_Ptr => fl_file_browser_item_next'Address,
+ Item_Previous_Ptr => fl_file_browser_item_prev'Address,
+ Item_At_Ptr => fl_file_browser_item_at'Address,
+ Item_Select_Ptr => fl_file_browser_item_select'Address,
+ Item_Selected_Ptr => fl_file_browser_item_selected'Address,
+ Item_Swap_Ptr => fl_file_browser_item_swap'Address,
+ Item_Text_Ptr => fl_file_browser_item_text'Address,
+ Item_Draw_Ptr => fl_file_browser_item_draw'Address);
+ This.Item_Inherit_Ptrs :=
+ (Current_Selection_Ptr => fl_file_browser_selection'Address,
+ Is_Displayed_Ptr => fl_file_browser_displayed2'Address,
+ Find_Item_Ptr => fl_file_browser_find_item'Address,
+ Top_Item_Ptr => fl_file_browser_top'Address);
+ This.Redrawing_Ptrs :=
+ (Bounding_Box_Ptr => fl_file_browser_bbox'Address,
+ Left_Edge_Ptr => fl_file_browser_leftedge'Address,
+ Redraw_Line_Ptr => fl_file_browser_redraw_line'Address,
+ Redraw_List_Ptr => fl_file_browser_redraw_lines'Address);
+ This.Wide_High_Ptrs :=
+ (Full_List_Width_Ptr => fl_file_browser_full_width'Address,
+ Full_List_Height_Ptr => fl_file_browser_full_height'Address,
+ Average_Item_Height_Ptr => fl_file_browser_incr_height'Address,
+ Item_Quick_Height_Ptr => fl_file_browser_item_quick_height'Address);
+ This.Cache_Ptrs :=
+ (New_List_Ptr => fl_file_browser_new_list'Address,
+ Inserting_Ptr => fl_file_browser_inserting'Address,
+ Deleting_Ptr => fl_file_browser_deleting'Address,
+ Replacing_Ptr => fl_file_browser_replacing'Address,
+ Swapping_Ptr => fl_file_browser_swapping'Address);
+ This.Draw_Ptr := fl_file_browser_draw'Address;
+ This.Handle_Ptr := fl_file_browser_handle'Address;
+ This.Line_Number_Ptr := fl_file_browser_lineno'Address;
+ end Initialize;
+
+
+ package body Forge is
+
+ function Create
+ (X, Y, W, H : in Integer;
+ Text : in String := "")
+ return File_Browser is
+ begin
+ return This : File_Browser do
+ This.Void_Ptr := new_fl_file_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;
+
+
+
+
+ -----------------------
+ -- API Subprograms --
+ -----------------------
+
+ Current_Sort : FLTK.Filenames.Compare_Function;
+
+ function Compare_Hook
+ (DA, DB : in Storage.Integer_Address)
+ return Interfaces.C.int;
+
+ pragma Convention (C, Compare_Hook);
+
+ function Compare_Hook
+ (DA, DB : in Storage.Integer_Address)
+ return Interfaces.C.int
+ is
+ Result : FLTK.Filenames.Comparison := Current_Sort
+ (Interfaces.C.Strings.Value (filename_dname (DA, 0)),
+ Interfaces.C.Strings.Value (filename_dname (DB, 0)));
+ begin
+ return FLTK.Filenames.Comparison'Pos (Result) - 1;
+ end Compare_Hook;
+
+
+ function Load
+ (This : in out File_Browser;
+ Dir : in String;
+ Sort : in not null FLTK.Filenames.Compare_Function :=
+ FLTK.Filenames.Numeric_Sort'Access)
+ return Natural
+ is
+ Msg : Interfaces.C.Strings.chars_ptr;
+ Code : Interfaces.C.int;
+ begin
+ Current_Sort := Sort;
+ Code := fl_file_browser_load
+ (This.Void_Ptr,
+ Interfaces.C.To_C (Dir),
+ Storage.To_Integer (Compare_Hook'Address));
+ if Code = 0 then
+ Msg := get_error_message;
+ if Msg /= Interfaces.C.Strings.Null_Ptr then
+ raise Browser_Load_Error with Interfaces.C.Strings.Value (Msg);
+ end if;
+ end if;
+ return Natural (Code);
+ end Load;
+
+
+ procedure Load
+ (This : in out File_Browser;
+ Dir : in String;
+ Sort : in not null FLTK.Filenames.Compare_Function :=
+ FLTK.Filenames.Numeric_Sort'Access)
+ is
+ Result : Natural := This.Load (Dir, Sort);
+ begin
+ null;
+ end Load;
+
+
+
+
+ function Get_File_Kind
+ (This : in File_Browser)
+ return File_Kind
+ is
+ Code : Interfaces.C.int := fl_file_browser_get_filetype (This.Void_Ptr);
+ begin
+ if Code not in File_Kind'Pos (File_Kind'First) .. File_Kind'Pos (File_Kind'Last) then
+ raise Internal_FLTK_Error;
+ end if;
+ return File_Kind'Val (Code);
+ end Get_File_Kind;
+
+
+ procedure Set_File_Kind
+ (This : in out File_Browser;
+ Value : in File_Kind) is
+ begin
+ fl_file_browser_set_filetype (This.Void_Ptr, File_Kind'Pos (Value));
+ end Set_File_Kind;
+
+
+ function Get_Filter
+ (This : in File_Browser)
+ return String
+ is
+ Result : Interfaces.C.Strings.chars_ptr := fl_file_browser_get_filter (This.Void_Ptr);
+ begin
+ if Result = Interfaces.C.Strings.Null_Ptr then
+ return "";
+ else
+ return Interfaces.C.Strings.Value (Result);
+ end if;
+ end Get_Filter;
+
+
+ procedure Set_Filter
+ (This : in out File_Browser;
+ Value : in String) is
+ begin
+ fl_file_browser_set_filter (This.Void_Ptr, Interfaces.C.To_C (Value));
+ end Set_Filter;
+
+
+ function Get_Icon_Size
+ (This : in File_Browser)
+ return Icon_Size is
+ begin
+ return Icon_Size (fl_file_browser_get_iconsize (This.Void_Ptr));
+ end Get_Icon_Size;
+
+
+ procedure Set_Icon_Size
+ (This : in out File_Browser;
+ Value : in Icon_Size) is
+ begin
+ fl_file_browser_set_iconsize (This.Void_Ptr, Interfaces.C.unsigned_char (Value));
+ end Set_Icon_Size;
+
+
+ function Get_Text_Size
+ (This : in File_Browser)
+ return Font_Size is
+ begin
+ return Font_Size (fl_file_browser_get_textsize (This.Void_Ptr));
+ end Get_Text_Size;
+
+
+ procedure Set_Text_Size
+ (This : in out File_Browser;
+ Size : in Font_Size) is
+ begin
+ fl_file_browser_set_textsize (This.Void_Ptr, Interfaces.C.int (Size));
+ end Set_Text_Size;
+
+
+end FLTK.Widgets.Groups.Browsers.Textline.File;
+
+
diff --git a/src/fltk-widgets-groups-browsers-textline-file.ads b/src/fltk-widgets-groups-browsers-textline-file.ads
new file mode 100644
index 0000000..11093d3
--- /dev/null
+++ b/src/fltk-widgets-groups-browsers-textline-file.ads
@@ -0,0 +1,118 @@
+
+
+-- Programmed by Jedidiah Barber
+-- Released into the public domain
+
+
+with
+
+ FLTK.Filenames;
+
+
+package FLTK.Widgets.Groups.Browsers.Textline.File is
+
+
+ type File_Browser is new Textline_Browser with private;
+
+ type File_Browser_Reference (Data : not null access File_Browser'Class) is
+ limited null record with Implicit_Dereference => Data;
+
+ type File_Kind is (Files, Directories);
+
+ type Icon_Size is mod 256;
+
+
+
+
+ package Forge is
+
+ function Create
+ (X, Y, W, H : in Integer;
+ Text : in String := "")
+ return File_Browser;
+
+ end Forge;
+
+
+
+
+ function Load
+ (This : in out File_Browser;
+ Dir : in String;
+ Sort : in not null FLTK.Filenames.Compare_Function :=
+ FLTK.Filenames.Numeric_Sort'Access)
+ return Natural;
+
+ procedure Load
+ (This : in out File_Browser;
+ Dir : in String;
+ Sort : in not null FLTK.Filenames.Compare_Function :=
+ FLTK.Filenames.Numeric_Sort'Access);
+
+
+
+
+ function Get_File_Kind
+ (This : in File_Browser)
+ return File_Kind;
+
+ procedure Set_File_Kind
+ (This : in out File_Browser;
+ Value : in File_Kind);
+
+ function Get_Filter
+ (This : in File_Browser)
+ return String;
+
+ procedure Set_Filter
+ (This : in out File_Browser;
+ Value : in String);
+
+ function Get_Icon_Size
+ (This : in File_Browser)
+ return Icon_Size;
+
+ procedure Set_Icon_Size
+ (This : in out File_Browser;
+ Value : in Icon_Size);
+
+ function Get_Text_Size
+ (This : in File_Browser)
+ return Font_Size;
+
+ procedure Set_Text_Size
+ (This : in out File_Browser;
+ Size : in Font_Size);
+
+
+private
+
+
+ type File_Browser is new Textline_Browser with null record;
+
+ overriding procedure Initialize
+ (This : in out File_Browser);
+
+ overriding procedure Finalize
+ (This : in out File_Browser);
+
+ procedure Extra_Init
+ (This : in out File_Browser;
+ X, Y, W, H : in Integer;
+ Text : in String);
+
+ procedure Extra_Final
+ (This : in out File_Browser);
+
+
+ pragma Inline (Set_File_Kind);
+ pragma Inline (Set_Filter);
+ pragma Inline (Get_Icon_Size);
+ pragma Inline (Set_Icon_Size);
+ pragma Inline (Get_Text_Size);
+ pragma Inline (Set_Text_Size);
+
+
+end FLTK.Widgets.Groups.Browsers.Textline.File;
+
+
diff --git a/src/fltk-widgets-groups-browsers-textline.adb b/src/fltk-widgets-groups-browsers-textline.adb
index de3f339..7c8dc3b 100644
--- a/src/fltk-widgets-groups-browsers-textline.adb
+++ b/src/fltk-widgets-groups-browsers-textline.adb
@@ -682,10 +682,16 @@ package body FLTK.Widgets.Groups.Browsers.Textline is
(This : in out Textline_Browser;
File : in String)
is
+ Msg : Interfaces.C.Strings.chars_ptr;
Code : Interfaces.C.int := fl_browser_load (This.Void_Ptr, Interfaces.C.To_C (File));
begin
if Code = 0 then
- raise Browser_Load_Error with Interfaces.C.Strings.Value (get_error_message);
+ Msg := get_error_message;
+ if Msg = Interfaces.C.Strings.Null_Ptr then
+ raise Browser_Load_Error;
+ else
+ raise Browser_Load_Error with Interfaces.C.Strings.Value (Msg);
+ end if;
elsif Code /= 1 then
raise Internal_FLTK_Error;
end if;