diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2025-01-06 23:46:40 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2025-01-06 23:46:40 +1300 |
commit | 49f2a539cdc77b504ddef00162625531b659c767 (patch) | |
tree | 30a90d61fa1a2c545f0da92f1cb7779fb802610b | |
parent | 02a3af82e69848af64955b4c646f3fe5f1738a8b (diff) |
Revised Browser subhierarchy, mostly protected method bindings
29 files changed, 597 insertions, 2141 deletions
diff --git a/doc/fl_browser.html b/doc/fl_browser.html index f4168a9..f06f1e9 100644 --- a/doc/fl_browser.html +++ b/doc/fl_browser.html @@ -169,21 +169,21 @@ procedure Set_Column_Widths <td><pre> void * data(int line) const; </pre></td> -<td>Not used</td> +<td>Not used.</td> </tr> <tr> <td><pre> void data(int line, void *d); </pre></td> -<td>Not used</td> +<td>Not used.</td> </tr> <tr> <td><pre> void display(int line, int val=1); </pre></td> -<td>Deprecated, see show / Show_Line and hide / Hide_Line</td> +<td>Deprecated, see show / Show_Line and hide / Hide_Line.</td> </tr> <tr> @@ -364,7 +364,7 @@ procedure Remove_Icon <td><pre> void replace(int a, const char *b); </pre></td> -<td>Deprecated, see text / Set_Line_Text</td> +<td>Deprecated, see text / Set_Line_Text.</td> </tr> <tr> @@ -428,7 +428,7 @@ function Number_Of_Lines <td><pre> void size(int W, int H); </pre></td> -<td>Falls through to Fl_Widget::size(int, int) anyway so binding unnecessary</td> +<td>Falls through to Fl_Widget::size(int, int) anyway so binding unnecessary.</td> </tr> <tr> @@ -556,14 +556,14 @@ function Is_Visible <td><pre> FL_BLINE * _remove(int line); </pre></td> -<td>Intentionally left unbound</td> +<td>Intentionally left unbound.</td> </tr> <tr> <td><pre> FL_BLINE * find_line(int line) const; </pre></td> -<td>Intentionally left unbound</td> +<td>Intentionally left unbound.</td> </tr> <tr> @@ -592,7 +592,7 @@ function Average_Item_Height <td><pre> void insert(int line, FL_BLINE *item); </pre></td> -<td>Intentionally left unbound</td> +<td>Intentionally left unbound.</td> </tr> <tr> @@ -752,7 +752,7 @@ function Line_Number <td><pre> void swap(FL_BLINE *a, FL_BLINE *b); </pre></td> -<td>Intentionally left unbound</td> +<td>Intentionally left unbound.</td> </tr> </table> diff --git a/doc/fl_browser_.html b/doc/fl_browser_.html index 0f8c5fa..8eb131a 100644 --- a/doc/fl_browser_.html +++ b/doc/fl_browser_.html @@ -278,14 +278,14 @@ procedure Set_Scrollbar_Size <td><pre> int scrollbar_width() const; </pre></td> -<td>Deprecated, see scrollbar_size();</td> +<td>Deprecated, see scrollbar_size / Get_Scrollbar_Size.</td> </tr> <tr> <td><pre> void scrollbar_width(int width); </pre></td> -<td>Deprecated, see scrollbar_size(int width);</td> +<td>Deprecated, see scrollbar_size / Set_Scrollbar_Size.</td> </tr> <tr> diff --git a/doc/fl_check_browser.html b/doc/fl_check_browser.html index 016d86b..3c172eb 100644 --- a/doc/fl_check_browser.html +++ b/doc/fl_check_browser.html @@ -176,7 +176,7 @@ procedure Remove <td><pre> void set_checked(int item); </pre></td> -<td>See checked(int item, int b);</td> +<td>See checked / Set_Checked.</td> </tr> <tr> @@ -211,84 +211,6 @@ function Selected_Index <tr> <td><pre> -void bbox(int &X, int &Y, int &W, int &H) const; -</pre>(Inherited from Fl_Browser_)</td> -<td><pre> -procedure Bounding_Box - (This : in Check_Browser; - X, Y, W, H : out Integer); -</pre></td> - </tr> - - <tr> -<td><pre> -void deleting(void *item); -</pre>(Inherited from Fl_Browser_)</td> -<td><pre> -procedure Deleting - (This : in out Check_Browser; - Item : in Item_Cursor); -</pre></td> - </tr> - - <tr> -<td><pre> -int displayed(void *item) const; -</pre>(Inherited from Fl_Browser_)</td> -<td><pre> -function Is_Displayed - (This : in Check_Browser; - Item : in Item_Cursor) - return Boolean; -</pre></td> - </tr> - - <tr> -<td><pre> -void draw(); -</pre>(Inherited from Fl_Browser_)</td> -<td><pre> -procedure Draw - (This : in out Check_Browser); -</pre></td> - </tr> - - <tr> -<td><pre> -void * find_item(int ypos); -</pre>(Inherited from Fl_Browser_)</td> -<td><pre> -function Find_Item - (This : in Check_Browser; - Y_Pos : in Integer) - return Item_Cursor; -</pre></td> - </tr> - - <tr> -<td><pre> -virtual int full_height() const; -</pre>(Inherited from Fl_Browser_)</td> -<td><pre> -function Full_List_Height - (This : in Check_Browser) - return Integer; -</pre></td> - </tr> - - <tr> -<td><pre> -virtual int full_width() const; -</pre>(Inherited from Fl_Browser_)</td> -<td><pre> -function Full_List_Width - (This : in Check_Browser) - return Integer; -</pre></td> - </tr> - - <tr> -<td><pre> int handle(int); </pre></td> <td><pre> @@ -301,32 +223,33 @@ function Handle <tr> <td><pre> -virtual int incr_height() const; -</pre>(Inherited from Fl_Browser_)</td> +void item_draw(void *, int, int, int, int) const; +</pre>(Actually private in 1.3)</td> <td><pre> -function Average_Item_Height - (This : in Check_Browser) - return Integer; +procedure Item_Draw + (This : in Check_Browser; + Item : in Item_Cursor; + X, Y, W, H : in Integer); </pre></td> </tr> <tr> <td><pre> -void inserting(void *a, void *b); -</pre>(Inherited from Fl_Browser_)</td> +void * item_first() const; +</pre>(Actually private in 1.3)</td> <td><pre> -procedure Inserting - (This : in out Check_Browser; - A, B : in Item_Cursor); +function Item_First + (This : in Check_Browser) + return Item_Cursor; </pre></td> </tr> <tr> <td><pre> -virtual int item_quick_height(void *item) const; -</pre>(Inherited from Fl_Browser_)</td> +int item_height(void *) const; +</pre>(Actually private in 1.3)</td> <td><pre> -function Item_Quick_Height +function Item_Height (This : in Check_Browser; Item : in Item_Cursor) return Integer; @@ -335,87 +258,61 @@ function Item_Quick_Height <tr> <td><pre> -int leftedge() const; -</pre>(Inherited from Fl_Browser_)</td> -<td><pre> -function Left_Edge - (This : in Check_Browser) - return Integer; -</pre></td> - </tr> - - <tr> -<td><pre> -void new_list(); -</pre>(Inherited from Fl_Browser_)</td> -<td><pre> -procedure New_List - (This : in out Check_Browser); -</pre></td> - </tr> - - <tr> -<td><pre> -void redraw_line(void *item); -</pre>(Inherited from Fl_Browser_)</td> +void * item_next(void *) const; +</pre>(Actually private in 1.3)</td> <td><pre> -procedure Redraw_Line - (This : in out Check_Browser; - Item : in Item_Cursor); -</pre></td> - </tr> - - <tr> -<td><pre> -void redraw_lines(); -</pre>(Inherited from Fl_Browser_)</td> -<td><pre> -procedure Redraw_List - (This : in out Check_Browser); +function Item_Next + (This : in Check_Browser; + Item : in Item_Cursor) + return Item_Cursor; </pre></td> </tr> <tr> <td><pre> -void replacing(void *a, void *b); -</pre>(Inherited from Fl_Browser_)</td> +void * item_prev(void *) const; +</pre>(Actually private in 1.3)</td> <td><pre> -procedure Replacing - (This : in out Check_Browser; - A, B : in Item_Cursor); +function Item_Previous + (This : in Check_Browser; + Item : in Item_Cursor) + return Item_Cursor; </pre></td> </tr> <tr> <td><pre> -void * selection() const; -</pre>(Inherited from Fl_Browser_)</td> +void item_select(void *, int); +</pre>(Actually private in 1.3)</td> <td><pre> -function Current_Selection - (This : in Check_Browser) - return Item_Cursor; +procedure Item_Select + (This : in out Check_Browser; + Item : in Item_Cursor; + State : in Boolean := True); </pre></td> </tr> <tr> <td><pre> -void swapping(void *a, void *b); -</pre>(Inherited from Fl_Browser_)</td> +int item_selected(void *) const; +</pre>(Actually private in 1.3)</td> <td><pre> -procedure Swapping - (This : in out Check_Browser; - A, B : in Item_Cursor); +function Item_Selected + (This : in Check_Browser; + Item : in Item_Cursor) + return Boolean; </pre></td> </tr> <tr> <td><pre> -void * top() const; -</pre>(Inherited from Fl_Browser_)</td> +int item_width(void *) const; +</pre>(Actually private in 1.3)</td> <td><pre> -function Top_Item - (This : in Check_Browser) - return Item_Cursor; +function Item_Width + (This : in Check_Browser; + Item : in Item_Cursor) + return Integer; </pre></td> </tr> diff --git a/doc/fl_file_browser.html b/doc/fl_file_browser.html index 9f9eddb..f90bbea 100644 --- a/doc/fl_file_browser.html +++ b/doc/fl_file_browser.html @@ -189,6 +189,71 @@ procedure Set_Text_Size </table> + +<table class="function"> + <tr><th colspan="2">Protected Functions and Procedures</th></tr> + + <tr> +<td><pre> +int full_height() const; +</pre>(Actually private in 1.3)</td> +<td><pre> +function Full_List_Height + (This : in File_Browser) + return Integer; +</pre></td> + </tr> + + <tr> +<td><pre> +int incr_height() const; +</pre>(Actually private in 1.3)</td> +<td><pre> +function Average_Item_Height + (This : in File_Browser) + return Integer; +</pre></td> + </tr> + + <tr> +<td><pre> +void item_draw(void *, int, int, int, int) const; +</pre>(Actually private in 1.3)</td> +<td><pre> +procedure Item_Draw + (This : in File_Browser; + Item : in Item_Cursor; + X, Y, W, H : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +int item_height(void *) const; +</pre>(Actually private in 1.3)</td> +<td><pre> +function Item_Height + (This : in File_Browser; + Item : in Item_Cursor) + return Integer; +</pre></td> + </tr> + + <tr> +<td><pre> +int item_width(void *) const; +</pre>(Actually private in 1.3)</td> +<td><pre> +function Item_Width + (This : in File_Browser; + Item : in Item_Cursor) + return Integer; +</pre></td> + </tr> + +</table> + + </body> </html> diff --git a/src/c_fl_browser.cpp b/src/c_fl_browser.cpp index ba74715..8bd7c96 100644 --- a/src/c_fl_browser.cpp +++ b/src/c_fl_browser.cpp @@ -37,6 +37,16 @@ extern "C" int widget_handle_hook(void * ud, int e); +// Non-friend protected access + +class Friend_Browser : Fl_Browser { +public: + using Fl_Browser::lineno; +}; + + + + // Attaching all relevant hooks and friends class My_Browser : public Fl_Browser { @@ -56,29 +66,11 @@ public: friend const char * fl_browser_item_text(BROWSER b, void * item); friend void fl_browser_item_draw(BROWSER b, void * item, int x, int y, int w, int h); - friend int fl_browser_lineno(BROWSER b, void * item); - - friend void * fl_browser_selection(BROWSER c); - friend int fl_browser_displayed2(BROWSER c, void * i); - friend void * fl_browser_find_item(BROWSER c, int y); - friend void * fl_browser_top(BROWSER c); - - friend void fl_browser_bbox(BROWSER c, int &x, int &y, int &w, int &h); - friend int fl_browser_leftedge(BROWSER c); - friend void fl_browser_redraw_line(BROWSER c, void * i); - friend void fl_browser_redraw_lines(BROWSER c); - friend int fl_browser_full_width(BROWSER c); friend int fl_browser_full_height(BROWSER c); friend int fl_browser_incr_height(BROWSER c); friend int fl_browser_item_quick_height(BROWSER c, void * i); - friend void fl_browser_new_list(BROWSER b); - friend void fl_browser_inserting(BROWSER b, void * a1, void * a2); - friend void fl_browser_deleting(BROWSER b, void * item); - friend void fl_browser_replacing(BROWSER b, void * a1, void * a2); - friend void fl_browser_swapping(BROWSER b, void * a1, void * a2); - friend void fl_browser_draw(BROWSER b); int handle(int e); @@ -367,58 +359,58 @@ int fl_browser_incr_height(BROWSER c) { int fl_browser_item_width(BROWSER b, void * item) { - return reinterpret_cast<My_Browser*>(b)->item_width(item); + return reinterpret_cast<My_Browser*>(b)->Fl_Browser::item_width(item); } int fl_browser_item_height(BROWSER b, void * item) { - return reinterpret_cast<My_Browser*>(b)->item_height(item); + return reinterpret_cast<My_Browser*>(b)->Fl_Browser::item_height(item); } void * fl_browser_item_first(BROWSER b) { - return reinterpret_cast<My_Browser*>(b)->item_first(); + return reinterpret_cast<My_Browser*>(b)->Fl_Browser::item_first(); } void * fl_browser_item_last(BROWSER b) { - return reinterpret_cast<My_Browser*>(b)->item_last(); + return reinterpret_cast<My_Browser*>(b)->Fl_Browser::item_last(); } void * fl_browser_item_next(BROWSER b, void * item) { - return reinterpret_cast<My_Browser*>(b)->item_next(item); + return reinterpret_cast<My_Browser*>(b)->Fl_Browser::item_next(item); } void * fl_browser_item_prev(BROWSER b, void * item) { - return reinterpret_cast<My_Browser*>(b)->item_prev(item); + return reinterpret_cast<My_Browser*>(b)->Fl_Browser::item_prev(item); } void * fl_browser_item_at(BROWSER b, int index) { - return reinterpret_cast<My_Browser*>(b)->item_at(index); + return reinterpret_cast<My_Browser*>(b)->Fl_Browser::item_at(index); } void fl_browser_item_select(BROWSER b, void * item, int val) { - reinterpret_cast<My_Browser*>(b)->item_select(item, val); + reinterpret_cast<My_Browser*>(b)->Fl_Browser::item_select(item, val); } int fl_browser_item_selected(BROWSER b, void * item) { - return reinterpret_cast<My_Browser*>(b)->item_selected(item); + return reinterpret_cast<My_Browser*>(b)->Fl_Browser::item_selected(item); } void fl_browser_item_swap(BROWSER b, void * x, void * y) { - reinterpret_cast<My_Browser*>(b)->item_swap(x, y); + reinterpret_cast<My_Browser*>(b)->Fl_Browser::item_swap(x, y); } const char * fl_browser_item_text(BROWSER b, void * item) { - return reinterpret_cast<My_Browser*>(b)->item_text(item); + return reinterpret_cast<My_Browser*>(b)->Fl_Browser::item_text(item); } void fl_browser_item_draw(BROWSER b, void * item, int x, int y, int w, int h) { - reinterpret_cast<My_Browser*>(b)->item_draw(item, x, y, w, h); + reinterpret_cast<My_Browser*>(b)->Fl_Browser::item_draw(item, x, y, w, h); } int fl_browser_lineno(BROWSER b, void * item) { - return reinterpret_cast<My_Browser*>(b)->lineno(item); + return (reinterpret_cast<Fl_Browser*>(b)->*(&Friend_Browser::lineno))(item); } @@ -426,43 +418,6 @@ int fl_browser_lineno(BROWSER b, void * item) { // These have to be reimplemented due to relying on custom class extensions -void * fl_browser_selection(BROWSER c) { - return reinterpret_cast<My_Browser*>(c)->selection(); -} - -int fl_browser_displayed2(BROWSER c, void * i) { - return reinterpret_cast<My_Browser*>(c)->Fl_Browser_::displayed(i); -} - -void * fl_browser_find_item(BROWSER c, int y) { - return reinterpret_cast<My_Browser*>(c)->find_item(y); -} - -void * fl_browser_top(BROWSER c) { - return reinterpret_cast<My_Browser*>(c)->top(); -} - - - - -void fl_browser_bbox(BROWSER c, int &x, int &y, int &w, int &h) { - reinterpret_cast<My_Browser*>(c)->bbox(x, y, w, h); -} - -int fl_browser_leftedge(BROWSER c) { - return reinterpret_cast<My_Browser*>(c)->leftedge(); -} - -void fl_browser_redraw_line(BROWSER c, void * i) { - reinterpret_cast<My_Browser*>(c)->redraw_line(i); -} - -void fl_browser_redraw_lines(BROWSER c) { - reinterpret_cast<My_Browser*>(c)->redraw_lines(); -} - - - int fl_browser_full_width(BROWSER c) { return reinterpret_cast<My_Browser*>(c)->Fl_Browser::full_width(); @@ -475,29 +430,6 @@ int fl_browser_item_quick_height(BROWSER c, void * i) { -void fl_browser_new_list(BROWSER b) { - reinterpret_cast<My_Browser*>(b)->new_list(); -} - -void fl_browser_inserting(BROWSER b, void * a1, void * a2) { - reinterpret_cast<My_Browser*>(b)->inserting(a1, a2); -} - -void fl_browser_deleting(BROWSER b, void * item) { - reinterpret_cast<My_Browser*>(b)->deleting(item); -} - -void fl_browser_replacing(BROWSER b, void * a1, void * a2) { - reinterpret_cast<My_Browser*>(b)->replacing(a1, a2); -} - -void fl_browser_swapping(BROWSER b, void * a1, void * a2) { - reinterpret_cast<My_Browser*>(b)->swapping(a1, a2); -} - - - - void fl_browser_draw(BROWSER b) { reinterpret_cast<My_Browser*>(b)->Fl_Browser::draw(); } diff --git a/src/c_fl_browser.h b/src/c_fl_browser.h index 98beec6..f1603bc 100644 --- a/src/c_fl_browser.h +++ b/src/c_fl_browser.h @@ -86,29 +86,10 @@ extern "C" int fl_browser_lineno(BROWSER b, void * item); // reimp below here -extern "C" void * fl_browser_selection(BROWSER c); -extern "C" int fl_browser_displayed2(BROWSER c, void * i); -extern "C" void * fl_browser_find_item(BROWSER c, int y); -extern "C" void * fl_browser_top(BROWSER c); - - -extern "C" void fl_browser_bbox(BROWSER c, int &x, int &y, int &w, int &h); -extern "C" int fl_browser_leftedge(BROWSER c); -extern "C" void fl_browser_redraw_line(BROWSER c, void * i); -extern "C" void fl_browser_redraw_lines(BROWSER c); - - extern "C" int fl_browser_full_width(BROWSER c); extern "C" int fl_browser_item_quick_height(BROWSER c, void * i); -extern "C" void fl_browser_new_list(BROWSER b); -extern "C" void fl_browser_inserting(BROWSER b, void * a1, void * a2); -extern "C" void fl_browser_deleting(BROWSER b, void * item); -extern "C" void fl_browser_replacing(BROWSER b, void * a1, void * a2); -extern "C" void fl_browser_swapping(BROWSER b, void * a1, void * a2); - - extern "C" void fl_browser_draw(BROWSER b); extern "C" int fl_browser_handle(BROWSER b, int e); diff --git a/src/c_fl_browser_.cpp b/src/c_fl_browser_.cpp index 9d8678f..3c0812c 100644 --- a/src/c_fl_browser_.cpp +++ b/src/c_fl_browser_.cpp @@ -42,35 +42,42 @@ extern "C" int widget_handle_hook(void * ud, int e); +// Non-friend protected access + +class Friend_Browser_ : Fl_Browser_ { +public: + using Fl_Browser_::selection; + using Fl_Browser_::displayed; + using Fl_Browser_::find_item; + using Fl_Browser_::top; + + using Fl_Browser_::bbox; + using Fl_Browser_::leftedge; + using Fl_Browser_::redraw_line; + using Fl_Browser_::redraw_lines; + + using Fl_Browser_::new_list; + using Fl_Browser_::inserting; + using Fl_Browser_::deleting; + using Fl_Browser_::replacing; + using Fl_Browser_::swapping; +}; + + + + // Attaching all relevant hooks and friends class My_Browser_ : public Fl_Browser_ { public: using Fl_Browser_::Fl_Browser_; - friend ABSTRACTBROWSER new_fl_abstract_browser(int x, int y, int w, int h, char * label); - friend void * fl_abstract_browser_selection(ABSTRACTBROWSER b); - friend int fl_abstract_browser_displayed(ABSTRACTBROWSER b, void * i); - friend void * fl_abstract_browser_find_item(ABSTRACTBROWSER b, int y); - friend void * fl_abstract_browser_top(ABSTRACTBROWSER b); - - friend void fl_abstract_browser_bbox(ABSTRACTBROWSER b, int &x, int &y, int &w, int &h); - friend int fl_abstract_browser_leftedge(ABSTRACTBROWSER b); - friend void fl_abstract_browser_redraw_line(ABSTRACTBROWSER b, void * i); - friend void fl_abstract_browser_redraw_lines(ABSTRACTBROWSER b); - friend int fl_abstract_browser_full_width(ABSTRACTBROWSER b); friend int fl_abstract_browser_full_height(ABSTRACTBROWSER b); friend int fl_abstract_browser_incr_height(ABSTRACTBROWSER b); friend int fl_abstract_browser_item_quick_height(ABSTRACTBROWSER b, void * i); - friend void fl_abstract_browser_new_list(ABSTRACTBROWSER b); - friend void fl_abstract_browser_inserting(ABSTRACTBROWSER b, void * a1, void * a2); - friend void fl_abstract_browser_deleting(ABSTRACTBROWSER b, void * item); - friend void fl_abstract_browser_replacing(ABSTRACTBROWSER b, void * a1, void * a2); - friend void fl_abstract_browser_swapping(ABSTRACTBROWSER b, void * a1, void * a2); - friend void fl_abstract_browser_draw(ABSTRACTBROWSER b); friend int fl_abstract_browser_handle(ABSTRACTBROWSER b, int e); @@ -209,7 +216,7 @@ int fl_abstract_browser_select_only(ABSTRACTBROWSER b, void * i, int c) { } void * fl_abstract_browser_selection(ABSTRACTBROWSER b) { - return reinterpret_cast<My_Browser_*>(b)->selection(); + return (reinterpret_cast<Fl_Browser_*>(b)->*(&Friend_Browser_::selection))(); } int fl_abstract_browser_deselect(ABSTRACTBROWSER b, int c) { @@ -221,15 +228,15 @@ void fl_abstract_browser_display(ABSTRACTBROWSER b, void * i) { } int fl_abstract_browser_displayed(ABSTRACTBROWSER b, void * i) { - return reinterpret_cast<My_Browser_*>(b)->displayed(i); + return (reinterpret_cast<Fl_Browser_*>(b)->*(&Friend_Browser_::displayed))(i); } void * fl_abstract_browser_find_item(ABSTRACTBROWSER b, int y) { - return reinterpret_cast<My_Browser_*>(b)->find_item(y); + return (reinterpret_cast<Fl_Browser_*>(b)->*(&Friend_Browser_::find_item))(y); } void * fl_abstract_browser_top(ABSTRACTBROWSER b) { - return reinterpret_cast<My_Browser_*>(b)->top(); + return (reinterpret_cast<Fl_Browser_*>(b)->*(&Friend_Browser_::top))(); } void fl_abstract_browser_sort(ABSTRACTBROWSER b, int f) { @@ -314,19 +321,19 @@ void fl_abstract_browser_resize(ABSTRACTBROWSER b, int x, int y, int w, int h) { } void fl_abstract_browser_bbox(ABSTRACTBROWSER b, int &x, int &y, int &w, int &h) { - reinterpret_cast<My_Browser_*>(b)->bbox(x, y, w, h); + (reinterpret_cast<Fl_Browser_*>(b)->*(&Friend_Browser_::bbox))(x, y, w, h); } int fl_abstract_browser_leftedge(ABSTRACTBROWSER b) { - return reinterpret_cast<My_Browser_*>(b)->leftedge(); + return (reinterpret_cast<Fl_Browser_*>(b)->*(&Friend_Browser_::leftedge))(); } void fl_abstract_browser_redraw_line(ABSTRACTBROWSER b, void * i) { - reinterpret_cast<My_Browser_*>(b)->redraw_line(i); + (reinterpret_cast<Fl_Browser_*>(b)->*(&Friend_Browser_::redraw_line))(i); } void fl_abstract_browser_redraw_lines(ABSTRACTBROWSER b) { - reinterpret_cast<My_Browser_*>(b)->redraw_lines(); + (reinterpret_cast<Fl_Browser_*>(b)->*(&Friend_Browser_::redraw_lines))(); } @@ -352,23 +359,23 @@ int fl_abstract_browser_item_quick_height(ABSTRACTBROWSER b, void * i) { void fl_abstract_browser_new_list(ABSTRACTBROWSER b) { - reinterpret_cast<My_Browser_*>(b)->new_list(); + (reinterpret_cast<Fl_Browser_*>(b)->*(&Friend_Browser_::new_list))(); } void fl_abstract_browser_inserting(ABSTRACTBROWSER b, void * a1, void * a2) { - reinterpret_cast<My_Browser_*>(b)->inserting(a1, a2); + (reinterpret_cast<Fl_Browser_*>(b)->*(&Friend_Browser_::inserting))(a1, a2); } void fl_abstract_browser_deleting(ABSTRACTBROWSER b, void * item) { - reinterpret_cast<My_Browser_*>(b)->deleting(item); + (reinterpret_cast<Fl_Browser_*>(b)->*(&Friend_Browser_::deleting))(item); } void fl_abstract_browser_replacing(ABSTRACTBROWSER b, void * a1, void * a2) { - reinterpret_cast<My_Browser_*>(b)->replacing(a1, a2); + (reinterpret_cast<Fl_Browser_*>(b)->*(&Friend_Browser_::replacing))(a1, a2); } void fl_abstract_browser_swapping(ABSTRACTBROWSER b, void * a1, void * a2) { - reinterpret_cast<My_Browser_*>(b)->swapping(a1, a2); + (reinterpret_cast<Fl_Browser_*>(b)->*(&Friend_Browser_::swapping))(a1, a2); } diff --git a/src/c_fl_check_browser.cpp b/src/c_fl_check_browser.cpp index 4788f07..cfb5658 100644 --- a/src/c_fl_check_browser.cpp +++ b/src/c_fl_check_browser.cpp @@ -5,6 +5,7 @@ #include <FL/Fl_Check_Browser.H> +#include <FL/Fl_Browser_.H> #include "c_fl_check_browser.h" @@ -43,22 +44,29 @@ extern "C" int widget_handle_hook(void * ud, int e); +// Non-friend protected / private access + +class Friend_Browser : Fl_Browser_ { +public: + using Fl_Browser_::item_width; + using Fl_Browser_::item_height; + using Fl_Browser_::item_first; + using Fl_Browser_::item_next; + using Fl_Browser_::item_prev; + using Fl_Browser_::item_select; + using Fl_Browser_::item_selected; + using Fl_Browser_::item_draw; +}; + + + + // Attaching all relevant hooks and friends class My_Check_Browser : public Fl_Check_Browser { public: using Fl_Check_Browser::Fl_Check_Browser; - friend void * fl_check_browser_selection(CHECKBROWSER c); - friend int fl_check_browser_displayed(CHECKBROWSER c, void * i); - friend void * fl_check_browser_find_item(CHECKBROWSER c, int y); - friend void * fl_check_browser_top(CHECKBROWSER c); - - friend void fl_check_browser_bbox(CHECKBROWSER c, int &x, int &y, int &w, int &h); - friend int fl_check_browser_leftedge(CHECKBROWSER c); - friend void fl_check_browser_redraw_line(CHECKBROWSER c, void * i); - friend void fl_check_browser_redraw_lines(CHECKBROWSER c); - friend int fl_check_browser_full_width(CHECKBROWSER c); friend int fl_check_browser_full_height(CHECKBROWSER c); friend int fl_check_browser_incr_height(CHECKBROWSER c); @@ -77,12 +85,6 @@ public: // item_text goes here friend void fl_check_browser_item_draw(CHECKBROWSER c, void * item, int x, int y, int w, int h); - friend void fl_check_browser_new_list(CHECKBROWSER c); - friend void fl_check_browser_inserting(CHECKBROWSER c, void * a1, void * a2); - friend void fl_check_browser_deleting(CHECKBROWSER c, void * item); - friend void fl_check_browser_replacing(CHECKBROWSER c, void * a1, void * a2); - friend void fl_check_browser_swapping(CHECKBROWSER c, void * a1, void * a2); - friend void fl_check_browser_draw(CHECKBROWSER c); friend int fl_check_browser_handle(CHECKBROWSER c, int e); @@ -254,47 +256,6 @@ int fl_check_browser_value(CHECKBROWSER c) { -// These have to be reimplemented due to relying on custom class extensions - -void * fl_check_browser_selection(CHECKBROWSER c) { - return reinterpret_cast<My_Check_Browser*>(c)->selection(); -} - -int fl_check_browser_displayed(CHECKBROWSER c, void * i) { - return reinterpret_cast<My_Check_Browser*>(c)->displayed(i); -} - -void * fl_check_browser_find_item(CHECKBROWSER c, int y) { - // For whatever reason the Fl_Check_Browser version of find_item is private - return reinterpret_cast<My_Check_Browser*>(c)->Fl_Browser_::find_item(y); -} - -void * fl_check_browser_top(CHECKBROWSER c) { - return reinterpret_cast<My_Check_Browser*>(c)->top(); -} - - - - -void fl_check_browser_bbox(CHECKBROWSER c, int &x, int &y, int &w, int &h) { - reinterpret_cast<My_Check_Browser*>(c)->bbox(x, y, w, h); -} - -int fl_check_browser_leftedge(CHECKBROWSER c) { - return reinterpret_cast<My_Check_Browser*>(c)->leftedge(); -} - -void fl_check_browser_redraw_line(CHECKBROWSER c, void * i) { - reinterpret_cast<My_Check_Browser*>(c)->redraw_line(i); -} - -void fl_check_browser_redraw_lines(CHECKBROWSER c) { - reinterpret_cast<My_Check_Browser*>(c)->redraw_lines(); -} - - - - int fl_check_browser_full_width(CHECKBROWSER c) { return reinterpret_cast<My_Check_Browser*>(c)->Fl_Check_Browser::full_width(); } @@ -315,47 +276,41 @@ int fl_check_browser_item_quick_height(CHECKBROWSER c, void * i) { int fl_check_browser_item_width(CHECKBROWSER c, void * i) { - (void)c; (void)i; - return 0; + return (reinterpret_cast<Fl_Check_Browser*>(c)->*(&Friend_Browser::item_width))(i); // return reinterpret_cast<My_Check_Browser*>(c)->Fl_Check_Browser::item_width(i); } int fl_check_browser_item_height(CHECKBROWSER c, void * i) { - (void)c; (void)i; - return 0; + return (reinterpret_cast<Fl_Check_Browser*>(c)->*(&Friend_Browser::item_height))(i); // return reinterpret_cast<My_Check_Browser*>(c)->Fl_Check_Browser::item_height(i); } void * fl_check_browser_item_first(CHECKBROWSER c) { - (void)c; - return 0; + return (reinterpret_cast<Fl_Check_Browser*>(c)->*(&Friend_Browser::item_first))(); // return reinterpret_cast<My_Check_Browser*>(c)->Fl_Check_Browser::item_first(); } // missing item_last void * fl_check_browser_item_next(CHECKBROWSER c, void * i) { - (void)c; (void)i; - return 0; + return (reinterpret_cast<Fl_Check_Browser*>(c)->*(&Friend_Browser::item_next))(i); // return reinterpret_cast<My_Check_Browser*>(c)->Fl_Check_Browser::item_next(i); } void * fl_check_browser_item_prev(CHECKBROWSER c, void * i) { - (void)c; (void)i; - return 0; + return (reinterpret_cast<Fl_Check_Browser*>(c)->*(&Friend_Browser::item_prev))(i); // return reinterpret_cast<My_Check_Browser*>(c)->Fl_Check_Browser::item_prev(i); } // missing item_at void fl_check_browser_item_select(CHECKBROWSER c, void * i, int v) { - (void)c; (void)i; (void)v; + (reinterpret_cast<Fl_Check_Browser*>(c)->*(&Friend_Browser::item_select))(i, v); // reinterpret_cast<My_Check_Browser*>(c)->Fl_Check_Browser::item_select(i, v); } int fl_check_browser_item_selected(CHECKBROWSER c, void * i) { - (void)c; (void)i; - return 0; + return (reinterpret_cast<Fl_Check_Browser*>(c)->*(&Friend_Browser::item_selected))(i); // return reinterpret_cast<My_Check_Browser*>(c)->Fl_Check_Browser::item_selected(i); } @@ -363,36 +318,13 @@ int fl_check_browser_item_selected(CHECKBROWSER c, void * i) { // missing item_text void fl_check_browser_item_draw(CHECKBROWSER c, void * item, int x, int y, int w, int h) { - (void)c; (void)item; (void)x; (void)y; (void)w; (void)h; + (reinterpret_cast<Fl_Check_Browser*>(c)->*(&Friend_Browser::item_draw))(item, x, y, w, h); // reinterpret_cast<My_Check_Browser*>(c)->Fl_Check_Browser::item_draw(item, x, y, w, h); } -void fl_check_browser_new_list(CHECKBROWSER c) { - reinterpret_cast<My_Check_Browser*>(c)->new_list(); -} - -void fl_check_browser_inserting(CHECKBROWSER c, void * a1, void * a2) { - reinterpret_cast<My_Check_Browser*>(c)->inserting(a1, a2); -} - -void fl_check_browser_deleting(CHECKBROWSER c, void * item) { - reinterpret_cast<My_Check_Browser*>(c)->deleting(item); -} - -void fl_check_browser_replacing(CHECKBROWSER c, void * a1, void * a2) { - reinterpret_cast<My_Check_Browser*>(c)->replacing(a1, a2); -} - -void fl_check_browser_swapping(CHECKBROWSER c, void * a1, void * a2) { - reinterpret_cast<My_Check_Browser*>(c)->swapping(a1, a2); -} - - - - void fl_check_browser_draw(CHECKBROWSER c) { reinterpret_cast<My_Check_Browser*>(c)->Fl_Check_Browser::draw(); } diff --git a/src/c_fl_check_browser.h b/src/c_fl_check_browser.h index c74808b..e9e832e 100644 --- a/src/c_fl_check_browser.h +++ b/src/c_fl_check_browser.h @@ -32,20 +32,6 @@ extern "C" const char * fl_check_browser_text(CHECKBROWSER c, int i); extern "C" int fl_check_browser_value(CHECKBROWSER c); -// reimp below here - -extern "C" void * fl_check_browser_selection(CHECKBROWSER c); -extern "C" int fl_check_browser_displayed(CHECKBROWSER c, void * i); -extern "C" void * fl_check_browser_find_item(CHECKBROWSER c, int y); -extern "C" void * fl_check_browser_top(CHECKBROWSER c); - - -extern "C" void fl_check_browser_bbox(CHECKBROWSER c, int &x, int &y, int &w, int &h); -extern "C" int fl_check_browser_leftedge(CHECKBROWSER c); -extern "C" void fl_check_browser_redraw_line(CHECKBROWSER c, void * i); -extern "C" void fl_check_browser_redraw_lines(CHECKBROWSER c); - - extern "C" int fl_check_browser_full_width(CHECKBROWSER c); extern "C" int fl_check_browser_full_height(CHECKBROWSER c); extern "C" int fl_check_browser_incr_height(CHECKBROWSER c); @@ -66,13 +52,6 @@ extern "C" int fl_check_browser_item_selected(CHECKBROWSER c, void * i); extern "C" void fl_check_browser_item_draw(CHECKBROWSER c, void * item, int x, int y, int w, int h); -extern "C" void fl_check_browser_new_list(CHECKBROWSER c); -extern "C" void fl_check_browser_inserting(CHECKBROWSER c, void * a1, void * a2); -extern "C" void fl_check_browser_deleting(CHECKBROWSER c, void * item); -extern "C" void fl_check_browser_replacing(CHECKBROWSER c, void * a1, void * a2); -extern "C" void fl_check_browser_swapping(CHECKBROWSER c, void * a1, void * a2); - - extern "C" void fl_check_browser_draw(CHECKBROWSER c); extern "C" int fl_check_browser_handle(CHECKBROWSER c, int e); diff --git a/src/c_fl_file_browser.cpp b/src/c_fl_file_browser.cpp index 836a991..8b5b632 100644 --- a/src/c_fl_file_browser.cpp +++ b/src/c_fl_file_browser.cpp @@ -5,6 +5,7 @@ #include <FL/Fl_File_Browser.H> +#include <FL/Fl_Browser.H> #include <FL/filename.H> #include "c_fl_file_browser.h" @@ -14,12 +15,12 @@ // 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_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" 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); @@ -29,7 +30,7 @@ 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 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); @@ -37,6 +38,23 @@ extern "C" int widget_handle_hook(void * ud, int e); +// Non-friend protected / private access + +// Should check these in future versions of FLTK to see whether +// it is possible to change them back to being overridden properly. + +class Friend_Browser : Fl_Browser { +public: + using Fl_Browser::full_height; + using Fl_Browser::incr_height; + using Fl_Browser::item_width; + using Fl_Browser::item_height; + using Fl_Browser::item_draw; +}; + + + + // Attaching all relevant hooks and friends class My_File_Browser : public Fl_File_Browser { @@ -56,41 +74,23 @@ public: 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 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; + // 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; @@ -100,7 +100,7 @@ protected: 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 item_draw(void * item, int x, int y, int w, int h) const; void draw(); }; @@ -110,26 +110,26 @@ 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::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::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_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); -} +// 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()); @@ -167,9 +167,9 @@ 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::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() { @@ -241,153 +241,91 @@ void fl_file_browser_set_textsize(FILEBROWSER b, int 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(); + // return reinterpret_cast<My_File_Browser*>(c)->Fl_File_Browser::full_height(); + return (reinterpret_cast<Fl_File_Browser*>(c)->*(&Friend_Browser::full_height))(); } int fl_file_browser_incr_height(FILEBROWSER c) { - return reinterpret_cast<My_File_Browser*>(c)->Fl_Browser::incr_height(); + // return reinterpret_cast<My_File_Browser*>(c)->Fl_File_Browser::incr_height(); + return (reinterpret_cast<Fl_File_Browser*>(c)->*(&Friend_Browser::incr_height))(); } int fl_file_browser_item_width(FILEBROWSER b, void * item) { - return reinterpret_cast<My_File_Browser*>(b)->item_width(item); + // return reinterpret_cast<My_File_Browser*>(b)->Fl_File_Browser::item_width(item); + return (reinterpret_cast<Fl_File_Browser*>(b)->*(&Friend_Browser::item_width))(item); } int fl_file_browser_item_height(FILEBROWSER b, void * item) { - return reinterpret_cast<My_File_Browser*>(b)->item_height(item); + // return reinterpret_cast<My_File_Browser*>(b)->Fl_File_Browser::item_height(item); + return (reinterpret_cast<My_File_Browser*>(b)->*(&Friend_Browser::item_height))(item); } void * fl_file_browser_item_first(FILEBROWSER b) { - return reinterpret_cast<My_File_Browser*>(b)->item_first(); + return reinterpret_cast<My_File_Browser*>(b)->Fl_File_Browser::item_first(); } void * fl_file_browser_item_last(FILEBROWSER b) { - return reinterpret_cast<My_File_Browser*>(b)->item_last(); + return reinterpret_cast<My_File_Browser*>(b)->Fl_File_Browser::item_last(); } void * fl_file_browser_item_next(FILEBROWSER b, void * item) { - return reinterpret_cast<My_File_Browser*>(b)->item_next(item); + return reinterpret_cast<My_File_Browser*>(b)->Fl_File_Browser::item_next(item); } void * fl_file_browser_item_prev(FILEBROWSER b, void * item) { - return reinterpret_cast<My_File_Browser*>(b)->item_prev(item); + return reinterpret_cast<My_File_Browser*>(b)->Fl_File_Browser::item_prev(item); } void * fl_file_browser_item_at(FILEBROWSER b, int index) { - return reinterpret_cast<My_File_Browser*>(b)->item_at(index); + return reinterpret_cast<My_File_Browser*>(b)->Fl_File_Browser::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); + reinterpret_cast<My_File_Browser*>(b)->Fl_File_Browser::item_select(item, val); } int fl_file_browser_item_selected(FILEBROWSER b, void * item) { - return reinterpret_cast<My_File_Browser*>(b)->item_selected(item); + return reinterpret_cast<My_File_Browser*>(b)->Fl_File_Browser::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); + reinterpret_cast<My_File_Browser*>(b)->Fl_File_Browser::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); + return reinterpret_cast<My_File_Browser*>(b)->Fl_File_Browser::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(); + // reinterpret_cast<My_File_Browser*>(b)->Fl_File_Browser::item_draw(item, x, y, w, h); + (reinterpret_cast<Fl_File_Browser*>(b)->*(&Friend_Browser::item_draw))(item, x, y, w, h); } int fl_file_browser_full_width(FILEBROWSER c) { - return reinterpret_cast<My_File_Browser*>(c)->Fl_Browser::full_width(); + return reinterpret_cast<My_File_Browser*>(c)->Fl_File_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); + return reinterpret_cast<My_File_Browser*>(c)->Fl_File_Browser::item_quick_height(i); } void fl_file_browser_draw(FILEBROWSER b) { - reinterpret_cast<My_File_Browser*>(b)->Fl_Browser::draw(); + reinterpret_cast<My_File_Browser*>(b)->Fl_File_Browser::draw(); } int fl_file_browser_handle(FILEBROWSER b, int e) { - return reinterpret_cast<My_File_Browser*>(b)->Fl_Browser::handle(e); + return reinterpret_cast<My_File_Browser*>(b)->Fl_File_Browser::handle(e); } diff --git a/src/c_fl_file_browser.h b/src/c_fl_file_browser.h index 3ab5c61..67e1489 100644 --- a/src/c_fl_file_browser.h +++ b/src/c_fl_file_browser.h @@ -48,32 +48,10 @@ 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); diff --git a/src/c_fl_hold_browser.cpp b/src/c_fl_hold_browser.cpp index a087ea5..e9ccae0 100644 --- a/src/c_fl_hold_browser.cpp +++ b/src/c_fl_hold_browser.cpp @@ -55,29 +55,11 @@ public: friend const char * fl_hold_browser_item_text(HOLDBROWSER b, void * item); friend void fl_hold_browser_item_draw(HOLDBROWSER b, void * item, int x, int y, int w, int h); - friend int fl_hold_browser_lineno(HOLDBROWSER b, void * item); - - friend void * fl_hold_browser_selection(HOLDBROWSER c); - friend int fl_hold_browser_displayed2(HOLDBROWSER c, void * i); - friend void * fl_hold_browser_find_item(HOLDBROWSER c, int y); - friend void * fl_hold_browser_top(HOLDBROWSER c); - - friend void fl_hold_browser_bbox(HOLDBROWSER c, int &x, int &y, int &w, int &h); - friend int fl_hold_browser_leftedge(HOLDBROWSER c); - friend void fl_hold_browser_redraw_line(HOLDBROWSER c, void * i); - friend void fl_hold_browser_redraw_lines(HOLDBROWSER c); - friend int fl_hold_browser_full_width(HOLDBROWSER c); friend int fl_hold_browser_full_height(HOLDBROWSER c); friend int fl_hold_browser_incr_height(HOLDBROWSER c); friend int fl_hold_browser_item_quick_height(HOLDBROWSER c, void * i); - friend void fl_hold_browser_new_list(HOLDBROWSER b); - friend void fl_hold_browser_inserting(HOLDBROWSER b, void * a1, void * a2); - friend void fl_hold_browser_deleting(HOLDBROWSER b, void * item); - friend void fl_hold_browser_replacing(HOLDBROWSER b, void * a1, void * a2); - friend void fl_hold_browser_swapping(HOLDBROWSER b, void * a1, void * a2); - friend void fl_hold_browser_draw(HOLDBROWSER b); int handle(int e); @@ -198,153 +180,86 @@ void free_fl_hold_browser(HOLDBROWSER b) { // These have to be reimplemented due to relying on custom class extensions + int fl_hold_browser_full_height(HOLDBROWSER c) { - return reinterpret_cast<My_Hold_Browser*>(c)->Fl_Browser::full_height(); + return reinterpret_cast<My_Hold_Browser*>(c)->Fl_Hold_Browser::full_height(); } int fl_hold_browser_incr_height(HOLDBROWSER c) { - return reinterpret_cast<My_Hold_Browser*>(c)->Fl_Browser::incr_height(); + return reinterpret_cast<My_Hold_Browser*>(c)->Fl_Hold_Browser::incr_height(); } int fl_hold_browser_item_width(HOLDBROWSER b, void * item) { - return reinterpret_cast<My_Hold_Browser*>(b)->item_width(item); + return reinterpret_cast<My_Hold_Browser*>(b)->Fl_Hold_Browser::item_width(item); } int fl_hold_browser_item_height(HOLDBROWSER b, void * item) { - return reinterpret_cast<My_Hold_Browser*>(b)->item_height(item); + return reinterpret_cast<My_Hold_Browser*>(b)->Fl_Hold_Browser::item_height(item); } void * fl_hold_browser_item_first(HOLDBROWSER b) { - return reinterpret_cast<My_Hold_Browser*>(b)->item_first(); + return reinterpret_cast<My_Hold_Browser*>(b)->Fl_Hold_Browser::item_first(); } void * fl_hold_browser_item_last(HOLDBROWSER b) { - return reinterpret_cast<My_Hold_Browser*>(b)->item_last(); + return reinterpret_cast<My_Hold_Browser*>(b)->Fl_Hold_Browser::item_last(); } void * fl_hold_browser_item_next(HOLDBROWSER b, void * item) { - return reinterpret_cast<My_Hold_Browser*>(b)->item_next(item); + return reinterpret_cast<My_Hold_Browser*>(b)->Fl_Hold_Browser::item_next(item); } void * fl_hold_browser_item_prev(HOLDBROWSER b, void * item) { - return reinterpret_cast<My_Hold_Browser*>(b)->item_prev(item); + return reinterpret_cast<My_Hold_Browser*>(b)->Fl_Hold_Browser::item_prev(item); } void * fl_hold_browser_item_at(HOLDBROWSER b, int index) { - return reinterpret_cast<My_Hold_Browser*>(b)->item_at(index); + return reinterpret_cast<My_Hold_Browser*>(b)->Fl_Hold_Browser::item_at(index); } void fl_hold_browser_item_select(HOLDBROWSER b, void * item, int val) { - reinterpret_cast<My_Hold_Browser*>(b)->item_select(item, val); + reinterpret_cast<My_Hold_Browser*>(b)->Fl_Hold_Browser::item_select(item, val); } int fl_hold_browser_item_selected(HOLDBROWSER b, void * item) { - return reinterpret_cast<My_Hold_Browser*>(b)->item_selected(item); + return reinterpret_cast<My_Hold_Browser*>(b)->Fl_Hold_Browser::item_selected(item); } void fl_hold_browser_item_swap(HOLDBROWSER b, void * x, void * y) { - reinterpret_cast<My_Hold_Browser*>(b)->item_swap(x, y); + reinterpret_cast<My_Hold_Browser*>(b)->Fl_Hold_Browser::item_swap(x, y); } const char * fl_hold_browser_item_text(HOLDBROWSER b, void * item) { - return reinterpret_cast<My_Hold_Browser*>(b)->item_text(item); + return reinterpret_cast<My_Hold_Browser*>(b)->Fl_Hold_Browser::item_text(item); } void fl_hold_browser_item_draw(HOLDBROWSER b, void * item, int x, int y, int w, int h) { - reinterpret_cast<My_Hold_Browser*>(b)->item_draw(item, x, y, w, h); -} - - - - -int fl_hold_browser_lineno(HOLDBROWSER b, void * item) { - return reinterpret_cast<My_Hold_Browser*>(b)->lineno(item); -} - - - - -void * fl_hold_browser_selection(HOLDBROWSER c) { - return reinterpret_cast<My_Hold_Browser*>(c)->selection(); -} - -int fl_hold_browser_displayed2(HOLDBROWSER c, void * i) { - return reinterpret_cast<My_Hold_Browser*>(c)->Fl_Browser_::displayed(i); -} - -void * fl_hold_browser_find_item(HOLDBROWSER c, int y) { - return reinterpret_cast<My_Hold_Browser*>(c)->find_item(y); -} - -void * fl_hold_browser_top(HOLDBROWSER c) { - return reinterpret_cast<My_Hold_Browser*>(c)->top(); -} - - - - -void fl_hold_browser_bbox(HOLDBROWSER c, int &x, int &y, int &w, int &h) { - reinterpret_cast<My_Hold_Browser*>(c)->bbox(x, y, w, h); -} - -int fl_hold_browser_leftedge(HOLDBROWSER c) { - return reinterpret_cast<My_Hold_Browser*>(c)->leftedge(); -} - -void fl_hold_browser_redraw_line(HOLDBROWSER c, void * i) { - reinterpret_cast<My_Hold_Browser*>(c)->redraw_line(i); -} - -void fl_hold_browser_redraw_lines(HOLDBROWSER c) { - reinterpret_cast<My_Hold_Browser*>(c)->redraw_lines(); + reinterpret_cast<My_Hold_Browser*>(b)->Fl_Hold_Browser::item_draw(item, x, y, w, h); } int fl_hold_browser_full_width(HOLDBROWSER c) { - return reinterpret_cast<My_Hold_Browser*>(c)->Fl_Browser::full_width(); + return reinterpret_cast<My_Hold_Browser*>(c)->Fl_Hold_Browser::full_width(); } int fl_hold_browser_item_quick_height(HOLDBROWSER c, void * i) { - return reinterpret_cast<My_Hold_Browser*>(c)->Fl_Browser::item_quick_height(i); -} - - - - -void fl_hold_browser_new_list(HOLDBROWSER b) { - reinterpret_cast<My_Hold_Browser*>(b)->new_list(); -} - -void fl_hold_browser_inserting(HOLDBROWSER b, void * a1, void * a2) { - reinterpret_cast<My_Hold_Browser*>(b)->inserting(a1, a2); -} - -void fl_hold_browser_deleting(HOLDBROWSER b, void * item) { - reinterpret_cast<My_Hold_Browser*>(b)->deleting(item); -} - -void fl_hold_browser_replacing(HOLDBROWSER b, void * a1, void * a2) { - reinterpret_cast<My_Hold_Browser*>(b)->replacing(a1, a2); -} - -void fl_hold_browser_swapping(HOLDBROWSER b, void * a1, void * a2) { - reinterpret_cast<My_Hold_Browser*>(b)->swapping(a1, a2); + return reinterpret_cast<My_Hold_Browser*>(c)->Fl_Hold_Browser::item_quick_height(i); } void fl_hold_browser_draw(HOLDBROWSER b) { - reinterpret_cast<My_Hold_Browser*>(b)->Fl_Browser::draw(); + reinterpret_cast<My_Hold_Browser*>(b)->Fl_Hold_Browser::draw(); } int fl_hold_browser_handle(HOLDBROWSER b, int e) { - return reinterpret_cast<My_Hold_Browser*>(b)->Fl_Browser::handle(e); + return reinterpret_cast<My_Hold_Browser*>(b)->Fl_Hold_Browser::handle(e); } diff --git a/src/c_fl_hold_browser.h b/src/c_fl_hold_browser.h index 866949d..6f295c6 100644 --- a/src/c_fl_hold_browser.h +++ b/src/c_fl_hold_browser.h @@ -35,32 +35,10 @@ extern "C" const char * fl_hold_browser_item_text(HOLDBROWSER b, void * item); extern "C" void fl_hold_browser_item_draw(HOLDBROWSER b, void * item, int x, int y, int w, int h); -extern "C" int fl_hold_browser_lineno(HOLDBROWSER b, void * item); - - -extern "C" void * fl_hold_browser_selection(HOLDBROWSER c); -extern "C" int fl_hold_browser_displayed2(HOLDBROWSER c, void * i); -extern "C" void * fl_hold_browser_find_item(HOLDBROWSER c, int y); -extern "C" void * fl_hold_browser_top(HOLDBROWSER c); - - -extern "C" void fl_hold_browser_bbox(HOLDBROWSER c, int &x, int &y, int &w, int &h); -extern "C" int fl_hold_browser_leftedge(HOLDBROWSER c); -extern "C" void fl_hold_browser_redraw_line(HOLDBROWSER c, void * i); -extern "C" void fl_hold_browser_redraw_lines(HOLDBROWSER c); - - extern "C" int fl_hold_browser_full_width(HOLDBROWSER c); extern "C" int fl_hold_browser_item_quick_height(HOLDBROWSER c, void * i); -extern "C" void fl_hold_browser_new_list(HOLDBROWSER b); -extern "C" void fl_hold_browser_inserting(HOLDBROWSER b, void * a1, void * a2); -extern "C" void fl_hold_browser_deleting(HOLDBROWSER b, void * item); -extern "C" void fl_hold_browser_replacing(HOLDBROWSER b, void * a1, void * a2); -extern "C" void fl_hold_browser_swapping(HOLDBROWSER b, void * a1, void * a2); - - extern "C" void fl_hold_browser_draw(HOLDBROWSER b); extern "C" int fl_hold_browser_handle(HOLDBROWSER b, int e); diff --git a/src/c_fl_multi_browser.cpp b/src/c_fl_multi_browser.cpp index 4ffb838..82fbdfb 100644 --- a/src/c_fl_multi_browser.cpp +++ b/src/c_fl_multi_browser.cpp @@ -55,29 +55,11 @@ public: friend const char * fl_multi_browser_item_text(MULTIBROWSER b, void * item); friend void fl_multi_browser_item_draw(MULTIBROWSER b, void * item, int x, int y, int w, int h); - friend int fl_multi_browser_lineno(MULTIBROWSER b, void * item); - - friend void * fl_multi_browser_selection(MULTIBROWSER c); - friend int fl_multi_browser_displayed2(MULTIBROWSER c, void * i); - friend void * fl_multi_browser_find_item(MULTIBROWSER c, int y); - friend void * fl_multi_browser_top(MULTIBROWSER c); - - friend void fl_multi_browser_bbox(MULTIBROWSER c, int &x, int &y, int &w, int &h); - friend int fl_multi_browser_leftedge(MULTIBROWSER c); - friend void fl_multi_browser_redraw_line(MULTIBROWSER c, void * i); - friend void fl_multi_browser_redraw_lines(MULTIBROWSER c); - friend int fl_multi_browser_full_width(MULTIBROWSER c); friend int fl_multi_browser_full_height(MULTIBROWSER c); friend int fl_multi_browser_incr_height(MULTIBROWSER c); friend int fl_multi_browser_item_quick_height(MULTIBROWSER c, void * i); - friend void fl_multi_browser_new_list(MULTIBROWSER b); - friend void fl_multi_browser_inserting(MULTIBROWSER b, void * a1, void * a2); - friend void fl_multi_browser_deleting(MULTIBROWSER b, void * item); - friend void fl_multi_browser_replacing(MULTIBROWSER b, void * a1, void * a2); - friend void fl_multi_browser_swapping(MULTIBROWSER b, void * a1, void * a2); - friend void fl_multi_browser_draw(MULTIBROWSER b); int handle(int e); @@ -198,153 +180,86 @@ void free_fl_multi_browser(MULTIBROWSER b) { // These have to be reimplemented due to relying on custom class extensions + int fl_multi_browser_full_height(MULTIBROWSER c) { - return reinterpret_cast<My_Multi_Browser*>(c)->Fl_Browser::full_height(); + return reinterpret_cast<My_Multi_Browser*>(c)->Fl_Multi_Browser::full_height(); } int fl_multi_browser_incr_height(MULTIBROWSER c) { - return reinterpret_cast<My_Multi_Browser*>(c)->Fl_Browser::incr_height(); + return reinterpret_cast<My_Multi_Browser*>(c)->Fl_Multi_Browser::incr_height(); } int fl_multi_browser_item_width(MULTIBROWSER b, void * item) { - return reinterpret_cast<My_Multi_Browser*>(b)->item_width(item); + return reinterpret_cast<My_Multi_Browser*>(b)->Fl_Multi_Browser::item_width(item); } int fl_multi_browser_item_height(MULTIBROWSER b, void * item) { - return reinterpret_cast<My_Multi_Browser*>(b)->item_height(item); + return reinterpret_cast<My_Multi_Browser*>(b)->Fl_Multi_Browser::item_height(item); } void * fl_multi_browser_item_first(MULTIBROWSER b) { - return reinterpret_cast<My_Multi_Browser*>(b)->item_first(); + return reinterpret_cast<My_Multi_Browser*>(b)->Fl_Multi_Browser::item_first(); } void * fl_multi_browser_item_last(MULTIBROWSER b) { - return reinterpret_cast<My_Multi_Browser*>(b)->item_last(); + return reinterpret_cast<My_Multi_Browser*>(b)->Fl_Multi_Browser::item_last(); } void * fl_multi_browser_item_next(MULTIBROWSER b, void * item) { - return reinterpret_cast<My_Multi_Browser*>(b)->item_next(item); + return reinterpret_cast<My_Multi_Browser*>(b)->Fl_Multi_Browser::item_next(item); } void * fl_multi_browser_item_prev(MULTIBROWSER b, void * item) { - return reinterpret_cast<My_Multi_Browser*>(b)->item_prev(item); + return reinterpret_cast<My_Multi_Browser*>(b)->Fl_Multi_Browser::item_prev(item); } void * fl_multi_browser_item_at(MULTIBROWSER b, int index) { - return reinterpret_cast<My_Multi_Browser*>(b)->item_at(index); + return reinterpret_cast<My_Multi_Browser*>(b)->Fl_Multi_Browser::item_at(index); } void fl_multi_browser_item_select(MULTIBROWSER b, void * item, int val) { - reinterpret_cast<My_Multi_Browser*>(b)->item_select(item, val); + reinterpret_cast<My_Multi_Browser*>(b)->Fl_Multi_Browser::item_select(item, val); } int fl_multi_browser_item_selected(MULTIBROWSER b, void * item) { - return reinterpret_cast<My_Multi_Browser*>(b)->item_selected(item); + return reinterpret_cast<My_Multi_Browser*>(b)->Fl_Multi_Browser::item_selected(item); } void fl_multi_browser_item_swap(MULTIBROWSER b, void * x, void * y) { - reinterpret_cast<My_Multi_Browser*>(b)->item_swap(x, y); + reinterpret_cast<My_Multi_Browser*>(b)->Fl_Multi_Browser::item_swap(x, y); } const char * fl_multi_browser_item_text(MULTIBROWSER b, void * item) { - return reinterpret_cast<My_Multi_Browser*>(b)->item_text(item); + return reinterpret_cast<My_Multi_Browser*>(b)->Fl_Multi_Browser::item_text(item); } void fl_multi_browser_item_draw(MULTIBROWSER b, void * item, int x, int y, int w, int h) { - reinterpret_cast<My_Multi_Browser*>(b)->item_draw(item, x, y, w, h); -} - - - - -int fl_multi_browser_lineno(MULTIBROWSER b, void * item) { - return reinterpret_cast<My_Multi_Browser*>(b)->lineno(item); -} - - - - -void * fl_multi_browser_selection(MULTIBROWSER c) { - return reinterpret_cast<My_Multi_Browser*>(c)->selection(); -} - -int fl_multi_browser_displayed2(MULTIBROWSER c, void * i) { - return reinterpret_cast<My_Multi_Browser*>(c)->Fl_Browser_::displayed(i); -} - -void * fl_multi_browser_find_item(MULTIBROWSER c, int y) { - return reinterpret_cast<My_Multi_Browser*>(c)->find_item(y); -} - -void * fl_multi_browser_top(MULTIBROWSER c) { - return reinterpret_cast<My_Multi_Browser*>(c)->top(); -} - - - - -void fl_multi_browser_bbox(MULTIBROWSER c, int &x, int &y, int &w, int &h) { - reinterpret_cast<My_Multi_Browser*>(c)->bbox(x, y, w, h); -} - -int fl_multi_browser_leftedge(MULTIBROWSER c) { - return reinterpret_cast<My_Multi_Browser*>(c)->leftedge(); -} - -void fl_multi_browser_redraw_line(MULTIBROWSER c, void * i) { - reinterpret_cast<My_Multi_Browser*>(c)->redraw_line(i); -} - -void fl_multi_browser_redraw_lines(MULTIBROWSER c) { - reinterpret_cast<My_Multi_Browser*>(c)->redraw_lines(); + reinterpret_cast<My_Multi_Browser*>(b)->Fl_Multi_Browser::item_draw(item, x, y, w, h); } int fl_multi_browser_full_width(MULTIBROWSER c) { - return reinterpret_cast<My_Multi_Browser*>(c)->Fl_Browser::full_width(); + return reinterpret_cast<My_Multi_Browser*>(c)->Fl_Multi_Browser::full_width(); } int fl_multi_browser_item_quick_height(MULTIBROWSER c, void * i) { - return reinterpret_cast<My_Multi_Browser*>(c)->Fl_Browser::item_quick_height(i); -} - - - - -void fl_multi_browser_new_list(MULTIBROWSER b) { - reinterpret_cast<My_Multi_Browser*>(b)->new_list(); -} - -void fl_multi_browser_inserting(MULTIBROWSER b, void * a1, void * a2) { - reinterpret_cast<My_Multi_Browser*>(b)->inserting(a1, a2); -} - -void fl_multi_browser_deleting(MULTIBROWSER b, void * item) { - reinterpret_cast<My_Multi_Browser*>(b)->deleting(item); -} - -void fl_multi_browser_replacing(MULTIBROWSER b, void * a1, void * a2) { - reinterpret_cast<My_Multi_Browser*>(b)->replacing(a1, a2); -} - -void fl_multi_browser_swapping(MULTIBROWSER b, void * a1, void * a2) { - reinterpret_cast<My_Multi_Browser*>(b)->swapping(a1, a2); + return reinterpret_cast<My_Multi_Browser*>(c)->Fl_Multi_Browser::item_quick_height(i); } void fl_multi_browser_draw(MULTIBROWSER b) { - reinterpret_cast<My_Multi_Browser*>(b)->Fl_Browser::draw(); + reinterpret_cast<My_Multi_Browser*>(b)->Fl_Multi_Browser::draw(); } int fl_multi_browser_handle(MULTIBROWSER b, int e) { - return reinterpret_cast<My_Multi_Browser*>(b)->Fl_Browser::handle(e); + return reinterpret_cast<My_Multi_Browser*>(b)->Fl_Multi_Browser::handle(e); } diff --git a/src/c_fl_multi_browser.h b/src/c_fl_multi_browser.h index c607857..29d18ec 100644 --- a/src/c_fl_multi_browser.h +++ b/src/c_fl_multi_browser.h @@ -35,32 +35,10 @@ extern "C" const char * fl_multi_browser_item_text(MULTIBROWSER b, void * item); extern "C" void fl_multi_browser_item_draw(MULTIBROWSER b, void * item, int x, int y, int w, int h); -extern "C" int fl_multi_browser_lineno(MULTIBROWSER b, void * item); - - -extern "C" void * fl_multi_browser_selection(MULTIBROWSER c); -extern "C" int fl_multi_browser_displayed2(MULTIBROWSER c, void * i); -extern "C" void * fl_multi_browser_find_item(MULTIBROWSER c, int y); -extern "C" void * fl_multi_browser_top(MULTIBROWSER c); - - -extern "C" void fl_multi_browser_bbox(MULTIBROWSER c, int &x, int &y, int &w, int &h); -extern "C" int fl_multi_browser_leftedge(MULTIBROWSER c); -extern "C" void fl_multi_browser_redraw_line(MULTIBROWSER c, void * i); -extern "C" void fl_multi_browser_redraw_lines(MULTIBROWSER c); - - extern "C" int fl_multi_browser_full_width(MULTIBROWSER c); extern "C" int fl_multi_browser_item_quick_height(MULTIBROWSER c, void * i); -extern "C" void fl_multi_browser_new_list(MULTIBROWSER b); -extern "C" void fl_multi_browser_inserting(MULTIBROWSER b, void * a1, void * a2); -extern "C" void fl_multi_browser_deleting(MULTIBROWSER b, void * item); -extern "C" void fl_multi_browser_replacing(MULTIBROWSER b, void * a1, void * a2); -extern "C" void fl_multi_browser_swapping(MULTIBROWSER b, void * a1, void * a2); - - extern "C" void fl_multi_browser_draw(MULTIBROWSER b); extern "C" int fl_multi_browser_handle(MULTIBROWSER b, int e); diff --git a/src/c_fl_select_browser.cpp b/src/c_fl_select_browser.cpp index ef1a671..78e7412 100644 --- a/src/c_fl_select_browser.cpp +++ b/src/c_fl_select_browser.cpp @@ -55,29 +55,11 @@ public: 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); @@ -199,152 +181,84 @@ void free_fl_select_browser(SELECTBROWSER 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(); + return reinterpret_cast<My_Select_Browser*>(c)->Fl_Select_Browser::full_height(); } int fl_select_browser_incr_height(SELECTBROWSER c) { - return reinterpret_cast<My_Select_Browser*>(c)->Fl_Browser::incr_height(); + return reinterpret_cast<My_Select_Browser*>(c)->Fl_Select_Browser::incr_height(); } int fl_select_browser_item_width(SELECTBROWSER b, void * item) { - return reinterpret_cast<My_Select_Browser*>(b)->item_width(item); + return reinterpret_cast<My_Select_Browser*>(b)->Fl_Select_Browser::item_width(item); } int fl_select_browser_item_height(SELECTBROWSER b, void * item) { - return reinterpret_cast<My_Select_Browser*>(b)->item_height(item); + return reinterpret_cast<My_Select_Browser*>(b)->Fl_Select_Browser::item_height(item); } void * fl_select_browser_item_first(SELECTBROWSER b) { - return reinterpret_cast<My_Select_Browser*>(b)->item_first(); + return reinterpret_cast<My_Select_Browser*>(b)->Fl_Select_Browser::item_first(); } void * fl_select_browser_item_last(SELECTBROWSER b) { - return reinterpret_cast<My_Select_Browser*>(b)->item_last(); + return reinterpret_cast<My_Select_Browser*>(b)->Fl_Select_Browser::item_last(); } void * fl_select_browser_item_next(SELECTBROWSER b, void * item) { - return reinterpret_cast<My_Select_Browser*>(b)->item_next(item); + return reinterpret_cast<My_Select_Browser*>(b)->Fl_Select_Browser::item_next(item); } void * fl_select_browser_item_prev(SELECTBROWSER b, void * item) { - return reinterpret_cast<My_Select_Browser*>(b)->item_prev(item); + return reinterpret_cast<My_Select_Browser*>(b)->Fl_Select_Browser::item_prev(item); } void * fl_select_browser_item_at(SELECTBROWSER b, int index) { - return reinterpret_cast<My_Select_Browser*>(b)->item_at(index); + return reinterpret_cast<My_Select_Browser*>(b)->Fl_Select_Browser::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); + reinterpret_cast<My_Select_Browser*>(b)->Fl_Select_Browser::item_select(item, val); } int fl_select_browser_item_selected(SELECTBROWSER b, void * item) { - return reinterpret_cast<My_Select_Browser*>(b)->item_selected(item); + return reinterpret_cast<My_Select_Browser*>(b)->Fl_Select_Browser::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); + reinterpret_cast<My_Select_Browser*>(b)->Fl_Select_Browser::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); + return reinterpret_cast<My_Select_Browser*>(b)->Fl_Select_Browser::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(); + reinterpret_cast<My_Select_Browser*>(b)->Fl_Select_Browser::item_draw(item, x, y, w, h); } int fl_select_browser_full_width(SELECTBROWSER c) { - return reinterpret_cast<My_Select_Browser*>(c)->Fl_Browser::full_width(); + return reinterpret_cast<My_Select_Browser*>(c)->Fl_Select_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); + return reinterpret_cast<My_Select_Browser*>(c)->Fl_Select_Browser::item_quick_height(i); } void fl_select_browser_draw(SELECTBROWSER b) { - reinterpret_cast<My_Select_Browser*>(b)->Fl_Browser::draw(); + reinterpret_cast<My_Select_Browser*>(b)->Fl_Select_Browser::draw(); } int fl_select_browser_handle(SELECTBROWSER b, int e) { - return reinterpret_cast<My_Select_Browser*>(b)->Fl_Browser::handle(e); + return reinterpret_cast<My_Select_Browser*>(b)->Fl_Select_Browser::handle(e); } diff --git a/src/c_fl_select_browser.h b/src/c_fl_select_browser.h index 80d2437..f72b8de 100644 --- a/src/c_fl_select_browser.h +++ b/src/c_fl_select_browser.h @@ -35,32 +35,10 @@ 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); diff --git a/src/fltk-widgets-groups-browsers-check.adb b/src/fltk-widgets-groups-browsers-check.adb index 3c9dd90..b377a25 100644 --- a/src/fltk-widgets-groups-browsers-check.adb +++ b/src/fltk-widgets-groups-browsers-check.adb @@ -112,59 +112,6 @@ package body FLTK.Widgets.Groups.Browsers.Check is - function fl_check_browser_selection - (B : in Storage.Integer_Address) - return Storage.Integer_Address; - pragma Import (C, fl_check_browser_selection, "fl_check_browser_selection"); - pragma Inline (fl_check_browser_selection); - - function fl_check_browser_displayed - (B, I : in Storage.Integer_Address) - return Interfaces.C.int; - pragma Import (C, fl_check_browser_displayed, "fl_check_browser_displayed"); - pragma Inline (fl_check_browser_displayed); - - function fl_check_browser_find_item - (B : in Storage.Integer_Address; - Y : in Interfaces.C.int) - return Storage.Integer_Address; - pragma Import (C, fl_check_browser_find_item, "fl_check_browser_find_item"); - pragma Inline (fl_check_browser_find_item); - - function fl_check_browser_top - (B : in Storage.Integer_Address) - return Storage.Integer_Address; - pragma Import (C, fl_check_browser_top, "fl_check_browser_top"); - pragma Inline (fl_check_browser_top); - - - - - procedure fl_check_browser_bbox - (B : in Storage.Integer_Address; - X, Y, W, H : out Interfaces.C.int); - pragma Import (C, fl_check_browser_bbox, "fl_check_browser_bbox"); - pragma Inline (fl_check_browser_bbox); - - function fl_check_browser_leftedge - (B : in Storage.Integer_Address) - return Interfaces.C.int; - pragma Import (C, fl_check_browser_leftedge, "fl_check_browser_leftedge"); - pragma Inline (fl_check_browser_leftedge); - - procedure fl_check_browser_redraw_line - (B, I : in Storage.Integer_Address); - pragma Import (C, fl_check_browser_redraw_line, "fl_check_browser_redraw_line"); - pragma Inline (fl_check_browser_redraw_line); - - procedure fl_check_browser_redraw_lines - (B : in Storage.Integer_Address); - pragma Import (C, fl_check_browser_redraw_lines, "fl_check_browser_redraw_lines"); - pragma Inline (fl_check_browser_redraw_lines); - - - - function fl_check_browser_full_width (B : in Storage.Integer_Address) return Interfaces.C.int; @@ -249,34 +196,6 @@ package body FLTK.Widgets.Groups.Browsers.Check is - procedure fl_check_browser_new_list - (B : in Storage.Integer_Address); - pragma Import (C, fl_check_browser_new_list, "fl_check_browser_new_list"); - pragma Inline (fl_check_browser_new_list); - - procedure fl_check_browser_inserting - (B, A1, A2 : in Storage.Integer_Address); - pragma Import (C, fl_check_browser_inserting, "fl_check_browser_inserting"); - pragma Inline (fl_check_browser_inserting); - - procedure fl_check_browser_deleting - (B, I : in Storage.Integer_Address); - pragma Import (C, fl_check_browser_deleting, "fl_check_browser_deleting"); - pragma Inline (fl_check_browser_deleting); - - procedure fl_check_browser_replacing - (B, A1, A2 : in Storage.Integer_Address); - pragma Import (C, fl_check_browser_replacing, "fl_check_browser_replacing"); - pragma Inline (fl_check_browser_replacing); - - procedure fl_check_browser_swapping - (B, A1, A2 : in Storage.Integer_Address); - pragma Import (C, fl_check_browser_swapping, "fl_check_browser_swapping"); - pragma Inline (fl_check_browser_swapping); - - - - procedure fl_check_browser_draw (B : in Storage.Integer_Address); pragma Import (C, fl_check_browser_draw, "fl_check_browser_draw"); @@ -329,6 +248,19 @@ package body FLTK.Widgets.Groups.Browsers.Check is end Extra_Init; + procedure Initialize + (This : in out Check_Browser) is + begin + This.Wide_High_Ptrs := + (Full_List_Width_Ptr => fl_check_browser_full_width'Address, + Full_List_Height_Ptr => fl_check_browser_full_height'Address, + Average_Item_Height_Ptr => fl_check_browser_incr_height'Address, + Item_Quick_Height_Ptr => fl_check_browser_item_quick_height'Address); + This.Draw_Ptr := fl_check_browser_draw'Address; + This.Handle_Ptr := fl_check_browser_handle'Address; + end Initialize; + + package body Forge is function Create @@ -464,291 +396,101 @@ package body FLTK.Widgets.Groups.Browsers.Check is - function Current_Selection - (This : in Check_Browser) - return Item_Cursor is - begin - return Address_To_Cursor (fl_check_browser_selection (This.Void_Ptr)); - end Current_Selection; - - - function Is_Displayed + function Item_Width (This : in Check_Browser; Item : in Item_Cursor) - return Boolean - is - Code : Interfaces.C.int := fl_check_browser_displayed - (This.Void_Ptr, - Cursor_To_Address (Item)); - begin - if Code not in 0 .. 1 then - raise Internal_FLTK_Error; - end if; - return Boolean'Val (Code); - end Is_Displayed; - - - function Find_Item - (This : in Check_Browser; - Y_Pos : in Integer) - return Item_Cursor is - begin - return Address_To_Cursor - (fl_check_browser_find_item (This.Void_Ptr, Interfaces.C.int (Y_Pos))); - end Find_Item; - - - function Top_Item - (This : in Check_Browser) - return Item_Cursor is - begin - return Address_To_Cursor (fl_check_browser_top (This.Void_Ptr)); - end Top_Item; - - - - - procedure Bounding_Box - (This : in Check_Browser; - X, Y, W, H : out Integer) is + return Integer is begin - fl_check_browser_bbox + return Integer (fl_check_browser_item_width (This.Void_Ptr, - Interfaces.C.int (X), - Interfaces.C.int (Y), - Interfaces.C.int (W), - Interfaces.C.int (H)); - end Bounding_Box; + Cursor_To_Address (Item))); + end Item_Width; - function Left_Edge - (This : in Check_Browser) + function Item_Height + (This : in Check_Browser; + Item : in Item_Cursor) return Integer is begin - return Integer (fl_check_browser_leftedge (This.Void_Ptr)); - end Left_Edge; - - - procedure Redraw_Line - (This : in out Check_Browser; - Item : in Item_Cursor) is - begin - fl_check_browser_redraw_line (This.Void_Ptr, Cursor_To_Address (Item)); - end Redraw_Line; - - - procedure Redraw_List - (This : in out Check_Browser) is - begin - fl_check_browser_redraw_lines (This.Void_Ptr); - end Redraw_List; - - + return Integer (fl_check_browser_item_height + (This.Void_Ptr, + Cursor_To_Address (Item))); + end Item_Height; - function Full_List_Width + function Item_First (This : in Check_Browser) - return Integer is + return Item_Cursor is begin - return Integer (fl_check_browser_full_width (This.Void_Ptr)); - end Full_List_Width; + return Address_To_Cursor (fl_check_browser_item_first (This.Void_Ptr)); + end Item_First; - function Full_List_Height - (This : in Check_Browser) - return Integer is - begin - return Integer (fl_check_browser_full_height (This.Void_Ptr)); - end Full_List_Height; + -- Note that Item_Last is not implemented - function Average_Item_Height - (This : in Check_Browser) - return Integer is + function Item_Next + (This : in Check_Browser; + Item : in Item_Cursor) + return Item_Cursor is begin - return Integer (fl_check_browser_incr_height (This.Void_Ptr)); - end Average_Item_Height; + return Address_To_Cursor (fl_check_browser_item_next + (This.Void_Ptr, + Cursor_To_Address (Item))); + end Item_Next; - function Item_Quick_Height + function Item_Previous (This : in Check_Browser; Item : in Item_Cursor) - return Integer is + return Item_Cursor is begin - return Integer (fl_check_browser_item_quick_height + return Address_To_Cursor (fl_check_browser_item_prev (This.Void_Ptr, Cursor_To_Address (Item))); - end Item_Quick_Height; - - - - - -- function Item_Width - -- (This : in Check_Browser; - -- Item : in Item_Cursor) - -- return Integer is - -- begin - -- return Integer (fl_check_browser_item_width - -- (This.Void_Ptr, - -- Cursor_To_Address (Item))); - -- end Item_Width; - - - -- function Item_Height - -- (This : in Check_Browser; - -- Item : in Item_Cursor) - -- return Integer is - -- begin - -- return Integer (fl_check_browser_item_height - -- (This.Void_Ptr, - -- Cursor_To_Address (Item))); - -- end Item_Height; - - - -- function Item_First - -- (This : in Check_Browser) - -- return Item_Cursor is - -- begin - -- return Address_To_Cursor (fl_check_browser_item_first (This.Void_Ptr)); - -- end Item_First; - - - -- Note that Item_Last is not implemented - - - -- function Item_Next - -- (This : in Check_Browser; - -- Item : in Item_Cursor) - -- return Item_Cursor is - -- begin - -- return Address_To_Cursor (fl_check_browser_item_next - -- (This.Void_Ptr, - -- Cursor_To_Address (Item))); - -- end Item_Next; - - - -- function Item_Previous - -- (This : in Check_Browser; - -- Item : in Item_Cursor) - -- return Item_Cursor is - -- begin - -- return Address_To_Cursor (fl_check_browser_item_prev - -- (This.Void_Ptr, - -- Cursor_To_Address (Item))); - -- end Item_Previous; + end Item_Previous; -- Note that Item_At is not implemented - -- procedure Item_Select - -- (This : in out Check_Browser; - -- Item : in Item_Cursor; - -- State : in Boolean := True) is - -- begin - -- fl_check_browser_item_select - -- (This.Void_Ptr, - -- Cursor_To_Address (Item), - -- Boolean'Pos (State)); - -- end Item_Select; - - - -- function Item_Selected - -- (This : in Check_Browser; - -- Item : in Item_Cursor) - -- return Boolean is - -- begin - -- return fl_check_browser_selected (This.Void_Ptr, Cursor_To_Address (Item)) /= 0; - -- end Item_Selected; - - - -- Note that Item_Swap and Item_Text are not implemented - - - -- procedure Item_Draw - -- (This : in Check_Browser; - -- Item : in Item_Cursor; - -- X, Y, W, H : in Integer) is - -- begin - -- fl_check_browser_item_draw - -- (This.Void_Ptr, - -- Cursor_To_Address (Item), - -- Interfaces.C.int (X), - -- Interfaces.C.int (Y), - -- Interfaces.C.int (W), - -- Interfaces.C.int (H)); - -- end Item_Draw; - - - - - procedure New_List - (This : in out Check_Browser) is - begin - fl_check_browser_new_list (This.Void_Ptr); - end New_List; - - - procedure Inserting - (This : in out Check_Browser; - A, B : in Item_Cursor) is + procedure Item_Select + (This : in out Check_Browser; + Item : in Item_Cursor; + State : in Boolean := True) is begin - fl_check_browser_inserting + fl_check_browser_item_select (This.Void_Ptr, - Cursor_To_Address (A), - Cursor_To_Address (B)); - end Inserting; + Cursor_To_Address (Item), + Boolean'Pos (State)); + end Item_Select; - procedure Deleting - (This : in out Check_Browser; - Item : in Item_Cursor) is + function Item_Selected + (This : in Check_Browser; + Item : in Item_Cursor) + return Boolean is begin - fl_check_browser_deleting - (This.Void_Ptr, - Cursor_To_Address (Item)); - end Deleting; + return fl_check_browser_item_selected (This.Void_Ptr, Cursor_To_Address (Item)) /= 0; + end Item_Selected; - procedure Replacing - (This : in out Check_Browser; - A, B : in Item_Cursor) is - begin - fl_check_browser_replacing - (This.Void_Ptr, - Cursor_To_Address (A), - Cursor_To_Address (B)); - end Replacing; + -- Note that Item_Swap and Item_Text are not implemented - procedure Swapping - (This : in out Check_Browser; - A, B : in Item_Cursor) is + procedure Item_Draw + (This : in Check_Browser; + Item : in Item_Cursor; + X, Y, W, H : in Integer) is begin - fl_check_browser_swapping + fl_check_browser_item_draw (This.Void_Ptr, - Cursor_To_Address (A), - Cursor_To_Address (B)); - end Swapping; - - - - - procedure Draw - (This : in out Check_Browser) is - begin - fl_check_browser_draw (This.Void_Ptr); - end Draw; - - - function Handle - (This : in out Check_Browser; - Event : in Event_Kind) - return Event_Outcome is - begin - return Event_Outcome'Val - (fl_check_browser_handle (This.Void_Ptr, Event_Kind'Pos (Event))); - end Handle; + Cursor_To_Address (Item), + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H)); + end Item_Draw; end FLTK.Widgets.Groups.Browsers.Check; diff --git a/src/fltk-widgets-groups-browsers-check.ads b/src/fltk-widgets-groups-browsers-check.ads index 7a5cfc7..8ceacd7 100644 --- a/src/fltk-widgets-groups-browsers-check.ads +++ b/src/fltk-widgets-groups-browsers-check.ads @@ -15,14 +15,10 @@ package FLTK.Widgets.Groups.Browsers.Check is -- item_text / Item_Text -- -- You can't use Sort on a Check_Browser unless you want a crash. The item_* - -- methods in C++ are also private which makes it nigh impossible to properly - -- bind to Ada, so you can't use those either. + -- methods in C++ are also private which means with the way they had to be bound, + -- if you override those subprograms in Ada the behaviour in FLTK will not change. -- - -- Find_Item is also private in C++ in 1.3 for whatever reason, so that might - -- have unexpected behaviour. - -- - -- So, uh, be aware of all that, I guess? Or wait until I get around to 1.4. - -- Using the equivalent of the C++ public API should still work fine right now. + -- These problems are fixed in 1.4 so they will go away once I get there. type Check_Browser is new Browser with private; @@ -106,157 +102,54 @@ package FLTK.Widgets.Groups.Browsers.Check is - -- Item related stuff reimplemented for binding-related reasons. - -- These subprograms are protected on the C++ side. + -- As mentioned at the start, due to issues with FLTK 1.3 if you override + -- these subprograms the behaviour in FLTK will not change. Should be able + -- to bind them properly once 1.4 comes around. - function Current_Selection - (This : in Check_Browser) - return Item_Cursor; - - function Is_Displayed + function Item_Width (This : in Check_Browser; Item : in Item_Cursor) - return Boolean; - - function Find_Item - (This : in Check_Browser; - Y_Pos : in Integer) - return Item_Cursor; - - function Top_Item - (This : in Check_Browser) - return Item_Cursor; - - - - - -- Graphical dimensions and redrawing reimplemented for binding-related reasons. - -- These subprograms are protected on the C++ side. - - procedure Bounding_Box - (This : in Check_Browser; - X, Y, W, H : out Integer); - - function Left_Edge - (This : in Check_Browser) return Integer; - procedure Redraw_Line - (This : in out Check_Browser; - Item : in Item_Cursor); - - procedure Redraw_List - (This : in out Check_Browser); - - - - - -- Optional overrides reimplemented for binding-related reasons. - -- These subprograms are protected on the C++ side. - - function Full_List_Width - (This : in Check_Browser) - return Integer; - - function Full_List_Height - (This : in Check_Browser) - return Integer; - - function Average_Item_Height - (This : in Check_Browser) - return Integer; - - function Item_Quick_Height + function Item_Height (This : in Check_Browser; Item : in Item_Cursor) return Integer; - - - - -- These Item_* subprograms are disabled due to a bug in FLTK 1.3. - -- Should be able to bind them properly when 1.4 comes around. - - -- function Item_Width - -- (This : in Check_Browser; - -- Item : in Item_Cursor) - -- return Integer; - - -- function Item_Height - -- (This : in Check_Browser; - -- Item : in Item_Cursor) - -- return Integer; - - -- function Item_First - -- (This : in Check_Browser) - -- return Item_Cursor; + function Item_First + (This : in Check_Browser) + return Item_Cursor; -- Item_Last missing in 1.3 - -- function Item_Next - -- (This : in Check_Browser; - -- Item : in Item_Cursor) - -- return Item_Cursor; + function Item_Next + (This : in Check_Browser; + Item : in Item_Cursor) + return Item_Cursor; - -- function Item_Previous - -- (This : in Check_Browser; - -- Item : in Item_Cursor) - -- return Item_Cursor; + function Item_Previous + (This : in Check_Browser; + Item : in Item_Cursor) + return Item_Cursor; -- Item_At missing in 1.3 - -- procedure Item_Select - -- (This : in out Check_Browser; - -- Item : in Item_Cursor; - -- State : in Boolean := True); + procedure Item_Select + (This : in out Check_Browser; + Item : in Item_Cursor; + State : in Boolean := True); - -- function Item_Selected - -- (This : in Check_Browser; - -- Item : in Item_Cursor) - -- return Boolean; + function Item_Selected + (This : in Check_Browser; + Item : in Item_Cursor) + return Boolean; -- Item_Swap and Item_Text missing in 1.3 - -- procedure Item_Draw - -- (This : in Check_Browser; - -- Item : in Item_Cursor; - -- X, Y, W, H : in Integer); - - - - - -- Cache invalidation reimplemented for binding-related reasons. - -- These subprograms are protected on the C++ side. - - procedure New_List - (This : in out Check_Browser); - - procedure Inserting - (This : in out Check_Browser; - A, B : in Item_Cursor); - - procedure Deleting - (This : in out Check_Browser; - Item : in Item_Cursor); - - procedure Replacing - (This : in out Check_Browser; - A, B : in Item_Cursor); - - procedure Swapping - (This : in out Check_Browser; - A, B : in Item_Cursor); - - - - - procedure Draw - (This : in out Check_Browser); - - function Handle - (This : in out Check_Browser; - Event : in Event_Kind) - return Event_Outcome; + procedure Item_Draw + (This : in Check_Browser; + Item : in Item_Cursor; + X, Y, W, H : in Integer); private @@ -264,6 +157,9 @@ private type Check_Browser is new Browser with null record; + overriding procedure Initialize + (This : in out Check_Browser); + overriding procedure Finalize (This : in out Check_Browser); @@ -290,37 +186,14 @@ private pragma Inline (Item_Text); pragma Inline (Selected_Index); - pragma Inline (Current_Selection); - pragma Inline (Find_Item); - pragma Inline (Top_Item); - - pragma Inline (Bounding_Box); - pragma Inline (Left_Edge); - pragma Inline (Redraw_Line); - pragma Inline (Redraw_List); - - pragma Inline (Full_List_Width); - pragma Inline (Full_List_Height); - pragma Inline (Average_Item_Height); - pragma Inline (Item_Quick_Height); - - -- pragma Inline (Item_Width); - -- pragma Inline (Item_Height); - -- pragma Inline (Item_First); - -- pragma Inline (Item_Next); - -- pragma Inline (Item_Previous); - -- pragma Inline (Item_Select); - -- pragma Inline (Item_Selected); - -- pragma Inline (Item_Draw); - - pragma Inline (New_List); - pragma Inline (Inserting); - pragma Inline (Deleting); - pragma Inline (Replacing); - pragma Inline (Swapping); - - pragma Inline (Draw); - pragma Inline (Handle); + pragma Inline (Item_Width); + pragma Inline (Item_Height); + pragma Inline (Item_First); + pragma Inline (Item_Next); + pragma Inline (Item_Previous); + pragma Inline (Item_Select); + pragma Inline (Item_Selected); + pragma Inline (Item_Draw); end FLTK.Widgets.Groups.Browsers.Check; diff --git a/src/fltk-widgets-groups-browsers-textline-choice.adb b/src/fltk-widgets-groups-browsers-textline-choice.adb index 565eba5..24b1317 100644 --- a/src/fltk-widgets-groups-browsers-textline-choice.adb +++ b/src/fltk-widgets-groups-browsers-textline-choice.adb @@ -31,7 +31,6 @@ package body FLTK.Widgets.Groups.Browsers.Textline.Choice is - function fl_select_browser_item_width (B, I : in Storage.Integer_Address) return Interfaces.C.int; @@ -107,60 +106,6 @@ package body FLTK.Widgets.Groups.Browsers.Textline.Choice is - - 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; @@ -188,43 +133,6 @@ package body FLTK.Widgets.Groups.Browsers.Textline.Choice is - 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"); @@ -293,30 +201,13 @@ package body FLTK.Widgets.Groups.Browsers.Textline.Choice is 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.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; diff --git a/src/fltk-widgets-groups-browsers-textline-file.adb b/src/fltk-widgets-groups-browsers-textline-file.adb index c73e5e4..c48e0be 100644 --- a/src/fltk-widgets-groups-browsers-textline-file.adb +++ b/src/fltk-widgets-groups-browsers-textline-file.adb @@ -188,60 +188,6 @@ package body FLTK.Widgets.Groups.Browsers.Textline.File is - - 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; @@ -269,43 +215,6 @@ package body FLTK.Widgets.Groups.Browsers.Textline.File is - 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"); @@ -374,30 +283,13 @@ package body FLTK.Widgets.Groups.Browsers.Textline.File is 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.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; @@ -562,6 +454,53 @@ package body FLTK.Widgets.Groups.Browsers.Textline.File is end Set_Text_Size; + + + function Full_List_Height + (This : in File_Browser) + return Integer is + begin + return Textline_Browser (This).Full_List_Height; + end Full_List_Height; + + + function Average_Item_Height + (This : in File_Browser) + return Integer is + begin + return Textline_Browser (This).Average_Item_Height; + end Average_Item_Height; + + + + + function Item_Width + (This : in File_Browser; + Item : in Item_Cursor) + return Integer is + begin + return Textline_Browser (This).Item_Width (Item); + end Item_Width; + + + function Item_Height + (This : in File_Browser; + Item : in Item_Cursor) + return Integer is + begin + return Textline_Browser (This).Item_Height (Item); + end Item_Height; + + + procedure Item_Draw + (This : in File_Browser; + Item : in Item_Cursor; + X, Y, W, H : in Integer) is + begin + Textline_Browser (This).Item_Draw (Item, X, Y, W, H); + end Item_Draw; + + 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 index 11093d3..ed5a4a5 100644 --- a/src/fltk-widgets-groups-browsers-textline-file.ads +++ b/src/fltk-widgets-groups-browsers-textline-file.ads @@ -12,6 +12,19 @@ with package FLTK.Widgets.Groups.Browsers.Textline.File is + -- Due to the inherited methods being made private in C++, overriding + -- + -- Item_Width + -- Item_Height + -- Item_Draw + -- Full_List_Height + -- Average_Item_Height + -- + -- will have no effect on the behaviour of this widget in FLTK. + -- + -- This may change in versions beyond 1.3. + + type File_Browser is new Textline_Browser with private; type File_Browser_Reference (Data : not null access File_Browser'Class) is @@ -85,6 +98,35 @@ package FLTK.Widgets.Groups.Browsers.Textline.File is Size : in Font_Size); + + + function Full_List_Height + (This : in File_Browser) + return Integer; + + function Average_Item_Height + (This : in File_Browser) + return Integer; + + + + + function Item_Width + (This : in File_Browser; + Item : in Item_Cursor) + return Integer; + + function Item_Height + (This : in File_Browser; + Item : in Item_Cursor) + return Integer; + + procedure Item_Draw + (This : in File_Browser; + Item : in Item_Cursor; + X, Y, W, H : in Integer); + + private @@ -112,6 +154,13 @@ private pragma Inline (Get_Text_Size); pragma Inline (Set_Text_Size); + pragma Inline (Full_List_Height); + pragma Inline (Average_Item_Height); + + pragma Inline (Item_Width); + pragma Inline (Item_Height); + pragma Inline (Item_Draw); + end FLTK.Widgets.Groups.Browsers.Textline.File; diff --git a/src/fltk-widgets-groups-browsers-textline-hold.adb b/src/fltk-widgets-groups-browsers-textline-hold.adb index 80058d5..52465ed 100644 --- a/src/fltk-widgets-groups-browsers-textline-hold.adb +++ b/src/fltk-widgets-groups-browsers-textline-hold.adb @@ -107,60 +107,6 @@ package body FLTK.Widgets.Groups.Browsers.Textline.Hold is - - function fl_hold_browser_selection - (B : in Storage.Integer_Address) - return Storage.Integer_Address; - pragma Import (C, fl_hold_browser_selection, "fl_hold_browser_selection"); - pragma Inline (fl_hold_browser_selection); - - function fl_hold_browser_displayed2 - (B, I : in Storage.Integer_Address) - return Interfaces.C.int; - pragma Import (C, fl_hold_browser_displayed2, "fl_hold_browser_displayed2"); - pragma Inline (fl_hold_browser_displayed2); - - function fl_hold_browser_find_item - (B : in Storage.Integer_Address; - Y : in Interfaces.C.int) - return Storage.Integer_Address; - pragma Import (C, fl_hold_browser_find_item, "fl_hold_browser_find_item"); - pragma Inline (fl_hold_browser_find_item); - - function fl_hold_browser_top - (B : in Storage.Integer_Address) - return Storage.Integer_Address; - pragma Import (C, fl_hold_browser_top, "fl_hold_browser_top"); - pragma Inline (fl_hold_browser_top); - - - - - procedure fl_hold_browser_bbox - (B : in Storage.Integer_Address; - X, Y, W, H : out Interfaces.C.int); - pragma Import (C, fl_hold_browser_bbox, "fl_hold_browser_bbox"); - pragma Inline (fl_hold_browser_bbox); - - function fl_hold_browser_leftedge - (B : in Storage.Integer_Address) - return Interfaces.C.int; - pragma Import (C, fl_hold_browser_leftedge, "fl_hold_browser_leftedge"); - pragma Inline (fl_hold_browser_leftedge); - - procedure fl_hold_browser_redraw_line - (B, I : in Storage.Integer_Address); - pragma Import (C, fl_hold_browser_redraw_line, "fl_hold_browser_redraw_line"); - pragma Inline (fl_hold_browser_redraw_line); - - procedure fl_hold_browser_redraw_lines - (B : in Storage.Integer_Address); - pragma Import (C, fl_hold_browser_redraw_lines, "fl_hold_browser_redraw_lines"); - pragma Inline (fl_hold_browser_redraw_lines); - - - - function fl_hold_browser_full_width (B : in Storage.Integer_Address) return Interfaces.C.int; @@ -188,43 +134,6 @@ package body FLTK.Widgets.Groups.Browsers.Textline.Hold is - function fl_hold_browser_lineno - (B, I : in Storage.Integer_Address) - return Interfaces.C.int; - pragma Import (C, fl_hold_browser_lineno, "fl_hold_browser_lineno"); - pragma Inline (fl_hold_browser_lineno); - - - - - procedure fl_hold_browser_new_list - (B : in Storage.Integer_Address); - pragma Import (C, fl_hold_browser_new_list, "fl_hold_browser_new_list"); - pragma Inline (fl_hold_browser_new_list); - - procedure fl_hold_browser_inserting - (B, A1, A2 : in Storage.Integer_Address); - pragma Import (C, fl_hold_browser_inserting, "fl_hold_browser_inserting"); - pragma Inline (fl_hold_browser_inserting); - - procedure fl_hold_browser_deleting - (B, I : in Storage.Integer_Address); - pragma Import (C, fl_hold_browser_deleting, "fl_hold_browser_deleting"); - pragma Inline (fl_hold_browser_deleting); - - procedure fl_hold_browser_replacing - (B, A1, A2 : in Storage.Integer_Address); - pragma Import (C, fl_hold_browser_replacing, "fl_hold_browser_replacing"); - pragma Inline (fl_hold_browser_replacing); - - procedure fl_hold_browser_swapping - (B, A1, A2 : in Storage.Integer_Address); - pragma Import (C, fl_hold_browser_swapping, "fl_hold_browser_swapping"); - pragma Inline (fl_hold_browser_swapping); - - - - procedure fl_hold_browser_draw (B : in Storage.Integer_Address); pragma Import (C, fl_hold_browser_draw, "fl_hold_browser_draw"); @@ -293,30 +202,13 @@ package body FLTK.Widgets.Groups.Browsers.Textline.Hold is Item_Swap_Ptr => fl_hold_browser_item_swap'Address, Item_Text_Ptr => fl_hold_browser_item_text'Address, Item_Draw_Ptr => fl_hold_browser_item_draw'Address); - This.Item_Inherit_Ptrs := - (Current_Selection_Ptr => fl_hold_browser_selection'Address, - Is_Displayed_Ptr => fl_hold_browser_displayed2'Address, - Find_Item_Ptr => fl_hold_browser_find_item'Address, - Top_Item_Ptr => fl_hold_browser_top'Address); - This.Redrawing_Ptrs := - (Bounding_Box_Ptr => fl_hold_browser_bbox'Address, - Left_Edge_Ptr => fl_hold_browser_leftedge'Address, - Redraw_Line_Ptr => fl_hold_browser_redraw_line'Address, - Redraw_List_Ptr => fl_hold_browser_redraw_lines'Address); This.Wide_High_Ptrs := (Full_List_Width_Ptr => fl_hold_browser_full_width'Address, Full_List_Height_Ptr => fl_hold_browser_full_height'Address, Average_Item_Height_Ptr => fl_hold_browser_incr_height'Address, Item_Quick_Height_Ptr => fl_hold_browser_item_quick_height'Address); - This.Cache_Ptrs := - (New_List_Ptr => fl_hold_browser_new_list'Address, - Inserting_Ptr => fl_hold_browser_inserting'Address, - Deleting_Ptr => fl_hold_browser_deleting'Address, - Replacing_Ptr => fl_hold_browser_replacing'Address, - Swapping_Ptr => fl_hold_browser_swapping'Address); - This.Draw_Ptr := fl_hold_browser_draw'Address; + This.Draw_Ptr := fl_hold_browser_draw'Address; This.Handle_Ptr := fl_hold_browser_handle'Address; - This.Line_Number_Ptr := fl_hold_browser_lineno'Address; end Initialize; diff --git a/src/fltk-widgets-groups-browsers-textline-multi.adb b/src/fltk-widgets-groups-browsers-textline-multi.adb index 670cbed..9d3fbf8 100644 --- a/src/fltk-widgets-groups-browsers-textline-multi.adb +++ b/src/fltk-widgets-groups-browsers-textline-multi.adb @@ -31,7 +31,6 @@ package body FLTK.Widgets.Groups.Browsers.Textline.Multi is - function fl_multi_browser_item_width (B, I : in Storage.Integer_Address) return Interfaces.C.int; @@ -107,60 +106,6 @@ package body FLTK.Widgets.Groups.Browsers.Textline.Multi is - - function fl_multi_browser_selection - (B : in Storage.Integer_Address) - return Storage.Integer_Address; - pragma Import (C, fl_multi_browser_selection, "fl_multi_browser_selection"); - pragma Inline (fl_multi_browser_selection); - - function fl_multi_browser_displayed2 - (B, I : in Storage.Integer_Address) - return Interfaces.C.int; - pragma Import (C, fl_multi_browser_displayed2, "fl_multi_browser_displayed2"); - pragma Inline (fl_multi_browser_displayed2); - - function fl_multi_browser_find_item - (B : in Storage.Integer_Address; - Y : in Interfaces.C.int) - return Storage.Integer_Address; - pragma Import (C, fl_multi_browser_find_item, "fl_multi_browser_find_item"); - pragma Inline (fl_multi_browser_find_item); - - function fl_multi_browser_top - (B : in Storage.Integer_Address) - return Storage.Integer_Address; - pragma Import (C, fl_multi_browser_top, "fl_multi_browser_top"); - pragma Inline (fl_multi_browser_top); - - - - - procedure fl_multi_browser_bbox - (B : in Storage.Integer_Address; - X, Y, W, H : out Interfaces.C.int); - pragma Import (C, fl_multi_browser_bbox, "fl_multi_browser_bbox"); - pragma Inline (fl_multi_browser_bbox); - - function fl_multi_browser_leftedge - (B : in Storage.Integer_Address) - return Interfaces.C.int; - pragma Import (C, fl_multi_browser_leftedge, "fl_multi_browser_leftedge"); - pragma Inline (fl_multi_browser_leftedge); - - procedure fl_multi_browser_redraw_line - (B, I : in Storage.Integer_Address); - pragma Import (C, fl_multi_browser_redraw_line, "fl_multi_browser_redraw_line"); - pragma Inline (fl_multi_browser_redraw_line); - - procedure fl_multi_browser_redraw_lines - (B : in Storage.Integer_Address); - pragma Import (C, fl_multi_browser_redraw_lines, "fl_multi_browser_redraw_lines"); - pragma Inline (fl_multi_browser_redraw_lines); - - - - function fl_multi_browser_full_width (B : in Storage.Integer_Address) return Interfaces.C.int; @@ -188,43 +133,6 @@ package body FLTK.Widgets.Groups.Browsers.Textline.Multi is - function fl_multi_browser_lineno - (B, I : in Storage.Integer_Address) - return Interfaces.C.int; - pragma Import (C, fl_multi_browser_lineno, "fl_multi_browser_lineno"); - pragma Inline (fl_multi_browser_lineno); - - - - - procedure fl_multi_browser_new_list - (B : in Storage.Integer_Address); - pragma Import (C, fl_multi_browser_new_list, "fl_multi_browser_new_list"); - pragma Inline (fl_multi_browser_new_list); - - procedure fl_multi_browser_inserting - (B, A1, A2 : in Storage.Integer_Address); - pragma Import (C, fl_multi_browser_inserting, "fl_multi_browser_inserting"); - pragma Inline (fl_multi_browser_inserting); - - procedure fl_multi_browser_deleting - (B, I : in Storage.Integer_Address); - pragma Import (C, fl_multi_browser_deleting, "fl_multi_browser_deleting"); - pragma Inline (fl_multi_browser_deleting); - - procedure fl_multi_browser_replacing - (B, A1, A2 : in Storage.Integer_Address); - pragma Import (C, fl_multi_browser_replacing, "fl_multi_browser_replacing"); - pragma Inline (fl_multi_browser_replacing); - - procedure fl_multi_browser_swapping - (B, A1, A2 : in Storage.Integer_Address); - pragma Import (C, fl_multi_browser_swapping, "fl_multi_browser_swapping"); - pragma Inline (fl_multi_browser_swapping); - - - - procedure fl_multi_browser_draw (B : in Storage.Integer_Address); pragma Import (C, fl_multi_browser_draw, "fl_multi_browser_draw"); @@ -293,30 +201,13 @@ package body FLTK.Widgets.Groups.Browsers.Textline.Multi is Item_Swap_Ptr => fl_multi_browser_item_swap'Address, Item_Text_Ptr => fl_multi_browser_item_text'Address, Item_Draw_Ptr => fl_multi_browser_item_draw'Address); - This.Item_Inherit_Ptrs := - (Current_Selection_Ptr => fl_multi_browser_selection'Address, - Is_Displayed_Ptr => fl_multi_browser_displayed2'Address, - Find_Item_Ptr => fl_multi_browser_find_item'Address, - Top_Item_Ptr => fl_multi_browser_top'Address); - This.Redrawing_Ptrs := - (Bounding_Box_Ptr => fl_multi_browser_bbox'Address, - Left_Edge_Ptr => fl_multi_browser_leftedge'Address, - Redraw_Line_Ptr => fl_multi_browser_redraw_line'Address, - Redraw_List_Ptr => fl_multi_browser_redraw_lines'Address); This.Wide_High_Ptrs := (Full_List_Width_Ptr => fl_multi_browser_full_width'Address, Full_List_Height_Ptr => fl_multi_browser_full_height'Address, Average_Item_Height_Ptr => fl_multi_browser_incr_height'Address, Item_Quick_Height_Ptr => fl_multi_browser_item_quick_height'Address); - This.Cache_Ptrs := - (New_List_Ptr => fl_multi_browser_new_list'Address, - Inserting_Ptr => fl_multi_browser_inserting'Address, - Deleting_Ptr => fl_multi_browser_deleting'Address, - Replacing_Ptr => fl_multi_browser_replacing'Address, - Swapping_Ptr => fl_multi_browser_swapping'Address); - This.Draw_Ptr := fl_multi_browser_draw'Address; + This.Draw_Ptr := fl_multi_browser_draw'Address; This.Handle_Ptr := fl_multi_browser_handle'Address; - This.Line_Number_Ptr := fl_multi_browser_lineno'Address; end Initialize; diff --git a/src/fltk-widgets-groups-browsers-textline.adb b/src/fltk-widgets-groups-browsers-textline.adb index 7c8dc3b..1e8988e 100644 --- a/src/fltk-widgets-groups-browsers-textline.adb +++ b/src/fltk-widgets-groups-browsers-textline.adb @@ -353,59 +353,6 @@ package body FLTK.Widgets.Groups.Browsers.Textline is - function fl_browser_selection - (B : in Storage.Integer_Address) - return Storage.Integer_Address; - pragma Import (C, fl_browser_selection, "fl_browser_selection"); - pragma Inline (fl_browser_selection); - - function fl_browser_displayed2 - (B, I : in Storage.Integer_Address) - return Interfaces.C.int; - pragma Import (C, fl_browser_displayed2, "fl_browser_displayed2"); - pragma Inline (fl_browser_displayed2); - - function fl_browser_find_item - (B : in Storage.Integer_Address; - Y : in Interfaces.C.int) - return Storage.Integer_Address; - pragma Import (C, fl_browser_find_item, "fl_browser_find_item"); - pragma Inline (fl_browser_find_item); - - function fl_browser_top - (B : in Storage.Integer_Address) - return Storage.Integer_Address; - pragma Import (C, fl_browser_top, "fl_browser_top"); - pragma Inline (fl_browser_top); - - - - - procedure fl_browser_bbox - (B : in Storage.Integer_Address; - X, Y, W, H : out Interfaces.C.int); - pragma Import (C, fl_browser_bbox, "fl_browser_bbox"); - pragma Inline (fl_browser_bbox); - - function fl_browser_leftedge - (B : in Storage.Integer_Address) - return Interfaces.C.int; - pragma Import (C, fl_browser_leftedge, "fl_browser_leftedge"); - pragma Inline (fl_browser_leftedge); - - procedure fl_browser_redraw_line - (B, I : in Storage.Integer_Address); - pragma Import (C, fl_browser_redraw_line, "fl_browser_redraw_line"); - pragma Inline (fl_browser_redraw_line); - - procedure fl_browser_redraw_lines - (B : in Storage.Integer_Address); - pragma Import (C, fl_browser_redraw_lines, "fl_browser_redraw_lines"); - pragma Inline (fl_browser_redraw_lines); - - - - function fl_browser_full_width (B : in Storage.Integer_Address) return Interfaces.C.int; @@ -442,34 +389,6 @@ package body FLTK.Widgets.Groups.Browsers.Textline is - procedure fl_browser_new_list - (B : in Storage.Integer_Address); - pragma Import (C, fl_browser_new_list, "fl_browser_new_list"); - pragma Inline (fl_browser_new_list); - - procedure fl_browser_inserting - (B, A1, A2 : in Storage.Integer_Address); - pragma Import (C, fl_browser_inserting, "fl_browser_inserting"); - pragma Inline (fl_browser_inserting); - - procedure fl_browser_deleting - (B, I : in Storage.Integer_Address); - pragma Import (C, fl_browser_deleting, "fl_browser_deleting"); - pragma Inline (fl_browser_deleting); - - procedure fl_browser_replacing - (B, A1, A2 : in Storage.Integer_Address); - pragma Import (C, fl_browser_replacing, "fl_browser_replacing"); - pragma Inline (fl_browser_replacing); - - procedure fl_browser_swapping - (B, A1, A2 : in Storage.Integer_Address); - pragma Import (C, fl_browser_swapping, "fl_browser_swapping"); - pragma Inline (fl_browser_swapping); - - - - procedure fl_browser_draw (B : in Storage.Integer_Address); pragma Import (C, fl_browser_draw, "fl_browser_draw"); @@ -551,30 +470,13 @@ package body FLTK.Widgets.Groups.Browsers.Textline is Item_Swap_Ptr => fl_browser_item_swap'Address, Item_Text_Ptr => fl_browser_item_text'Address, Item_Draw_Ptr => fl_browser_item_draw'Address); - This.Item_Inherit_Ptrs := - (Current_Selection_Ptr => fl_browser_selection'Address, - Is_Displayed_Ptr => fl_browser_displayed2'Address, - Find_Item_Ptr => fl_browser_find_item'Address, - Top_Item_Ptr => fl_browser_top'Address); - This.Redrawing_Ptrs := - (Bounding_Box_Ptr => fl_browser_bbox'Address, - Left_Edge_Ptr => fl_browser_leftedge'Address, - Redraw_Line_Ptr => fl_browser_redraw_line'Address, - Redraw_List_Ptr => fl_browser_redraw_lines'Address); This.Wide_High_Ptrs := (Full_List_Width_Ptr => fl_browser_full_width'Address, Full_List_Height_Ptr => fl_browser_full_height'Address, Average_Item_Height_Ptr => fl_browser_incr_height'Address, Item_Quick_Height_Ptr => fl_browser_item_quick_height'Address); - This.Cache_Ptrs := - (New_List_Ptr => fl_browser_new_list'Address, - Inserting_Ptr => fl_browser_inserting'Address, - Deleting_Ptr => fl_browser_deleting'Address, - Replacing_Ptr => fl_browser_replacing'Address, - Swapping_Ptr => fl_browser_swapping'Address); This.Draw_Ptr := fl_browser_draw'Address; This.Handle_Ptr := fl_browser_handle'Address; - This.Line_Number_Ptr := fl_browser_lineno'Address; end Initialize; @@ -1244,15 +1146,9 @@ package body FLTK.Widgets.Groups.Browsers.Textline is function Line_Number (This : in Textline_Browser; Item : in Item_Cursor) - return Natural - is - function my_lineno - (B, I : in Storage.Integer_Address) - return Interfaces.C.int; - for my_lineno'Address use This.Line_Number_Ptr; - pragma Import (Ada, my_lineno); + return Natural is begin - return Natural (my_lineno (This.Void_Ptr, Cursor_To_Address (Item))); + return Natural (fl_browser_lineno (This.Void_Ptr, Cursor_To_Address (Item))); end Line_Number; diff --git a/src/fltk-widgets-groups-browsers-textline.ads b/src/fltk-widgets-groups-browsers-textline.ads index e9749dc..dac7ad9 100644 --- a/src/fltk-widgets-groups-browsers-textline.ads +++ b/src/fltk-widgets-groups-browsers-textline.ads @@ -342,11 +342,20 @@ private Element_Type => Image_Access); + type Item_Override_Fun is + (Item_Width_Ptr, Item_Height_Ptr, + Item_First_Ptr, Item_Last_Ptr, + Item_Next_Ptr, Item_Previous_Ptr, + Item_At_Ptr, Item_Select_Ptr, + Item_Selected_Ptr, Item_Swap_Ptr, + Item_Text_Ptr, Item_Draw_Ptr); + type Item_Override_Fun_Ptr_Array is array (Item_Override_Fun) of System.Address; + + type Textline_Browser is new Browser with record Columns : C_Col_Widths_Access; Icons : Image_Vectors.Vector; Item_Override_Ptrs : Item_Override_Fun_Ptr_Array; - Line_Number_Ptr : System.Address; end record; overriding procedure Initialize @@ -399,11 +408,6 @@ private pragma Inline (Has_Icon); pragma Inline (Get_Icon); - pragma Inline (Bounding_Box); - pragma Inline (Left_Edge); - pragma Inline (Redraw_Line); - pragma Inline (Redraw_List); - pragma Inline (Full_List_Height); pragma Inline (Average_Item_Height); diff --git a/src/fltk-widgets-groups-browsers.adb b/src/fltk-widgets-groups-browsers.adb index ea38b67..360c4f5 100644 --- a/src/fltk-widgets-groups-browsers.adb +++ b/src/fltk-widgets-groups-browsers.adb @@ -622,9 +622,9 @@ package body FLTK.Widgets.Groups.Browsers is - ----------------------------------- - -- Controlled Type Subprograms -- - ----------------------------------- + ------------------- + -- Destructors -- + ------------------- procedure Extra_Final (This : in out Browser) is @@ -651,9 +651,9 @@ package body FLTK.Widgets.Groups.Browsers is - --------------------------- - -- Abstract Browser API -- - --------------------------- + -------------------- + -- Constructors -- + -------------------- procedure Extra_Init (This : in out Browser; @@ -685,27 +685,11 @@ package body FLTK.Widgets.Groups.Browsers is procedure Initialize (This : in out Browser) is begin - This.Item_Inherit_Ptrs := - (Current_Selection_Ptr => fl_abstract_browser_selection'Address, - Is_Displayed_Ptr => fl_abstract_browser_displayed'Address, - Find_Item_Ptr => fl_abstract_browser_find_item'Address, - Top_Item_Ptr => fl_abstract_browser_top'Address); - This.Redrawing_Ptrs := - (Bounding_Box_Ptr => fl_abstract_browser_bbox'Address, - Left_Edge_Ptr => fl_abstract_browser_leftedge'Address, - Redraw_Line_Ptr => fl_abstract_browser_redraw_line'Address, - Redraw_List_Ptr => fl_abstract_browser_redraw_lines'Address); This.Wide_High_Ptrs := (Full_List_Width_Ptr => fl_abstract_browser_full_width'Address, Full_List_Height_Ptr => fl_abstract_browser_full_height'Address, Average_Item_Height_Ptr => fl_abstract_browser_incr_height'Address, Item_Quick_Height_Ptr => fl_abstract_browser_item_quick_height'Address); - This.Cache_Ptrs := - (New_List_Ptr => fl_abstract_browser_new_list'Address, - Inserting_Ptr => fl_abstract_browser_inserting'Address, - Deleting_Ptr => fl_abstract_browser_deleting'Address, - Replacing_Ptr => fl_abstract_browser_replacing'Address, - Swapping_Ptr => fl_abstract_browser_swapping'Address); This.Draw_Ptr := fl_abstract_browser_draw'Address; This.Handle_Ptr := fl_abstract_browser_handle'Address; end Initialize; @@ -734,6 +718,10 @@ package body FLTK.Widgets.Groups.Browsers is + ----------------------- + -- API Subprograms -- + ----------------------- + -- Access to the Browser's self contained scrollbars function H_Bar @@ -830,15 +818,9 @@ package body FLTK.Widgets.Groups.Browsers is function Current_Selection (This : in Browser) - return Item_Cursor - is - function my_selection - (V : in Storage.Integer_Address) - return Storage.Integer_Address; - for my_selection'Address use This.Item_Inherit_Ptrs (Current_Selection_Ptr); - pragma Import (Ada, my_selection); + return Item_Cursor is begin - return Address_To_Cursor (my_selection (This.Void_Ptr)); + return Address_To_Cursor (fl_abstract_browser_selection (This.Void_Ptr)); end Current_Selection; @@ -885,12 +867,8 @@ package body FLTK.Widgets.Groups.Browsers is Item : in Item_Cursor) return Boolean is - function my_displayed - (V, I : in Storage.Integer_Address) - return Interfaces.C.int; - for my_displayed'Address use This.Item_Inherit_Ptrs (Is_Displayed_Ptr); - pragma Import (Ada, my_displayed); - Code : Interfaces.C.int := my_displayed (This.Void_Ptr, Cursor_To_Address (Item)); + Code : Interfaces.C.int := fl_abstract_browser_displayed + (This.Void_Ptr, Cursor_To_Address (Item)); begin if Code not in 0 .. 1 then raise Internal_FLTK_Error; @@ -902,30 +880,19 @@ package body FLTK.Widgets.Groups.Browsers is function Find_Item (This : in Browser; Y_Pos : in Integer) - return Item_Cursor - is - function my_find_item - (V : in Storage.Integer_Address; - N : in Interfaces.C.int) - return Storage.Integer_Address; - for my_find_item'Address use This.Item_Inherit_Ptrs (Find_Item_Ptr); - pragma Import (Ada, my_find_item); + return Item_Cursor is begin - return Address_To_Cursor (my_find_item (This.Void_Ptr, Interfaces.C.int (Y_Pos))); + return Address_To_Cursor (fl_abstract_browser_find_item + (This.Void_Ptr, + Interfaces.C.int (Y_Pos))); end Find_Item; function Top_Item (This : in Browser) - return Item_Cursor - is - function my_top - (V : in Storage.Integer_Address) - return Storage.Integer_Address; - for my_top'Address use This.Item_Inherit_Ptrs (Top_Item_Ptr); - pragma Import (Ada, my_top); + return Item_Cursor is begin - return Address_To_Cursor (my_top (This.Void_Ptr)); + return Address_To_Cursor (fl_abstract_browser_top (This.Void_Ptr)); end Top_Item; @@ -1101,15 +1068,9 @@ package body FLTK.Widgets.Groups.Browsers is procedure Bounding_Box (This : in Browser; - X, Y, W, H : out Integer) - is - procedure my_bbox - (V : in Storage.Integer_Address; - X, Y, W, H : out Interfaces.C.int); - for my_bbox'Address use This.Redrawing_Ptrs (Bounding_Box_Ptr); - pragma Import (Ada, my_bbox); + X, Y, W, H : out Integer) is begin - my_bbox + fl_abstract_browser_bbox (This.Void_Ptr, Interfaces.C.int (X), Interfaces.C.int (Y), @@ -1120,40 +1081,24 @@ package body FLTK.Widgets.Groups.Browsers is function Left_Edge (This : in Browser) - return Integer - is - function my_leftedge - (V : in Storage.Integer_Address) - return Interfaces.C.int; - for my_leftedge'Address use This.Redrawing_Ptrs (Left_Edge_Ptr); - pragma Import (Ada, my_leftedge); + return Integer is begin - return Integer (my_leftedge (This.Void_Ptr)); + return Integer (fl_abstract_browser_leftedge (This.Void_Ptr)); end Left_Edge; procedure Redraw_Line (This : in out Browser; - Item : in Item_Cursor) - is - procedure my_redraw_line - (V, I : in Storage.Integer_Address); - for my_redraw_line'Address use This.Redrawing_Ptrs (Redraw_Line_Ptr); - pragma Import (Ada, my_redraw_line); + Item : in Item_Cursor) is begin - my_redraw_line (This.Void_Ptr, Cursor_To_Address (Item)); + fl_abstract_browser_redraw_line (This.Void_Ptr, Cursor_To_Address (Item)); end Redraw_Line; procedure Redraw_List - (This : in out Browser) - is - procedure my_redraw_lines - (V : in Storage.Integer_Address); - for my_redraw_lines'Address use This.Redrawing_Ptrs (Redraw_List_Ptr); - pragma Import (Ada, my_redraw_lines); + (This : in out Browser) is begin - my_redraw_lines (This.Void_Ptr); + fl_abstract_browser_redraw_lines (This.Void_Ptr); end Redraw_List; @@ -1323,27 +1268,17 @@ package body FLTK.Widgets.Groups.Browsers is -- Cache invalidation procedure New_List - (This : in out Browser) - is - procedure my_new_list - (V : in Storage.Integer_Address); - for my_new_list'Address use This.Cache_Ptrs (New_List_Ptr); - pragma Import (Ada, my_new_list); + (This : in out Browser) is begin - my_new_list (This.Void_Ptr); + fl_abstract_browser_new_list (This.Void_Ptr); end New_List; procedure Inserting (This : in out Browser; - A, B : in Item_Cursor) - is - procedure my_inserting - (V, A, B : in Storage.Integer_Address); - for my_inserting'Address use This.Cache_Ptrs (Inserting_Ptr); - pragma Import (Ada, my_inserting); + A, B : in Item_Cursor) is begin - my_inserting + fl_abstract_browser_inserting (This.Void_Ptr, Cursor_To_Address (A), Cursor_To_Address (B)); @@ -1352,14 +1287,9 @@ package body FLTK.Widgets.Groups.Browsers is procedure Deleting (This : in out Browser; - Item : in Item_Cursor) - is - procedure my_deleting - (V, I : in Storage.Integer_Address); - for my_deleting'Address use This.Cache_Ptrs (Deleting_Ptr); - pragma Import (Ada, my_deleting); + Item : in Item_Cursor) is begin - my_deleting + fl_abstract_browser_deleting (This.Void_Ptr, Cursor_To_Address (Item)); end Deleting; @@ -1367,14 +1297,9 @@ package body FLTK.Widgets.Groups.Browsers is procedure Replacing (This : in out Browser; - A, B : in Item_Cursor) - is - procedure my_replacing - (V, A, B : in Storage.Integer_Address); - for my_replacing'Address use This.Cache_Ptrs (Replacing_Ptr); - pragma Import (Ada, my_replacing); + A, B : in Item_Cursor) is begin - my_replacing + fl_abstract_browser_replacing (This.Void_Ptr, Cursor_To_Address (A), Cursor_To_Address (B)); @@ -1383,14 +1308,9 @@ package body FLTK.Widgets.Groups.Browsers is procedure Swapping (This : in out Browser; - A, B : in Item_Cursor) - is - procedure my_swapping - (V, A, B : in Storage.Integer_Address); - for my_swapping'Address use This.Cache_Ptrs (Swapping_Ptr); - pragma Import (Ada, my_swapping); + A, B : in Item_Cursor) is begin - my_swapping + fl_abstract_browser_swapping (This.Void_Ptr, Cursor_To_Address (A), Cursor_To_Address (B)); diff --git a/src/fltk-widgets-groups-browsers.ads b/src/fltk-widgets-groups-browsers.ads index 1c511a9..6b0619e 100644 --- a/src/fltk-widgets-groups-browsers.ads +++ b/src/fltk-widgets-groups-browsers.ads @@ -351,48 +351,18 @@ package FLTK.Widgets.Groups.Browsers is private - type Item_Override_Fun is - (Item_Width_Ptr, Item_Height_Ptr, - Item_First_Ptr, Item_Last_Ptr, - Item_Next_Ptr, Item_Previous_Ptr, - Item_At_Ptr, Item_Select_Ptr, - Item_Selected_Ptr, Item_Swap_Ptr, - Item_Text_Ptr, Item_Draw_Ptr); - type Item_Override_Fun_Ptr_Array is array (Item_Override_Fun) of System.Address; - - - type Item_Inherit_Fun is - (Current_Selection_Ptr, Is_Displayed_Ptr, - Find_Item_Ptr, Top_Item_Ptr); - type Item_Inherit_Fun_Ptr_Array is array (Item_Inherit_Fun) of System.Address; - - type Redrawing_Fun is - (Bounding_Box_Ptr, Left_Edge_Ptr, - Redraw_Line_Ptr, Redraw_List_Ptr); - type Redrawing_Fun_Ptr_Array is array (Redrawing_Fun) of System.Address; - type Wide_High_Fun is (Full_List_Width_Ptr, Full_List_Height_Ptr, Average_Item_Height_Ptr, Item_Quick_Height_Ptr); type Wide_High_Fun_Ptr_Array is array (Wide_High_Fun) of System.Address; - type Cache_Fun is - (New_List_Ptr, Inserting_Ptr, - Deleting_Ptr, Replacing_Ptr, Swapping_Ptr); - type Cache_Fun_Ptr_Array is array (Cache_Fun) of System.Address; - type Browser is new Group with record - Horizon : aliased Valuators.Sliders.Scrollbars.Scrollbar; - Vertigo : aliased Valuators.Sliders.Scrollbars.Scrollbar; - Text_Store : Interfaces.C.Strings.chars_ptr_array (1 .. 2); - Current : Interfaces.C.size_t := 1; - Item_Inherit_Ptrs : Item_Inherit_Fun_Ptr_Array; - Redrawing_Ptrs : Redrawing_Fun_Ptr_Array; - Wide_High_Ptrs : Wide_High_Fun_Ptr_Array; - Cache_Ptrs : Cache_Fun_Ptr_Array; - Draw_Ptr : System.Address; - Handle_Ptr : System.Address; + Horizon : aliased Valuators.Sliders.Scrollbars.Scrollbar; + Vertigo : aliased Valuators.Sliders.Scrollbars.Scrollbar; + Text_Store : Interfaces.C.Strings.chars_ptr_array (1 .. 2); + Current : Interfaces.C.size_t := 1; + Wide_High_Ptrs : Wide_High_Fun_Ptr_Array; end record; overriding procedure Initialize diff --git a/src/fltk-widgets.ads b/src/fltk-widgets.ads index d7cbca8..9a8537b 100644 --- a/src/fltk-widgets.ads +++ b/src/fltk-widgets.ads @@ -356,6 +356,8 @@ private Callback : Widget_Callback; Current_Image : access FLTK.Images.Image'Class; Inactive_Image : access FLTK.Images.Image'Class; + Draw_Ptr : System.Address; + Handle_Ptr : System.Address; end record; overriding procedure Finalize |