diff options
author | Jed Barber <jjbarber@y7mail.com> | 2017-06-17 11:28:39 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2017-06-17 11:28:39 +1000 |
commit | fb37523537cdb69a31dede401a604981ce8b7b9d (patch) | |
tree | 9d8f8dc3a00ce27b69aa4b7d7696b49d659fcbe1 | |
parent | 33c3691b571ce4b6a2aa6997b70c3bc5d991ca9d (diff) |
Updated coding style, added progress log
165 files changed, 1671 insertions, 1311 deletions
diff --git a/progress.txt b/progress.txt new file mode 100644 index 0000000..1b68352 --- /dev/null +++ b/progress.txt @@ -0,0 +1,127 @@ + + +Approximate Progress List (Incomplete) + + + + +Overall estimate: 40-45% + + + + +Done: + +FLTK.Widgets.Boxes +FLTK.Widgets.Buttons.Enter +FLTK.Widgets.Buttons.Light +FLTK.Widgets.Buttons.Light.Check +FLTK.Widgets.Buttons.Light.Radio +FLTK.Widgets.Buttons.Light.Round +FLTK.Widgets.Buttons.Light.Round.Radio +FLTK.Widgets.Buttons.Radio +FLTK.Widgets.Buttons.Repeat +FLTK.Widgets.Buttons.Toggle +FLTK.Widgets.Groups.Scrolls +FLTK.Widgets.Groups.Text_Displays.Text_Editors +FLTK.Widgets.Groups.Windows.Double +FLTK.Widgets.Groups.Windows.Single +FLTK.Widgets.Groups.Windows.Single.Menu +FLTK.Widgets.Inputs.Float +FLTK.Widgets.Inputs.Integer +FLTK.Widgets.Inputs.Multiline +FLTK.Widgets.Inputs.Outputs +FLTK.Widgets.Inputs.Outputs.Multiline +FLTK.Widgets.Inputs.Secret +FLTK.Widgets.Menus.Menu_Bars + + + + +Partially Done: + +FLTK +FLTK.Dialogs +FLTK.Images +FLTK.Images.Bitmaps +FLTK.Images.Bitmaps.XBM +FLTK.Images.RGB +FLTK.Images.RGB.BMP +FLTK.Images.RGB.JPEG +FLTK.Images.RGB.PNG +FLTK.Images.RGB.PNM +FLTK.Menu_Items +FLTK.Text_Buffers; +FLTK.Widgets +FLTK.Widgets.Buttons (70%) +FLTK.Widgets.Groups +FLTK.Widgets.Groups.Text_Displays (94%) +FLTK.Widgets.Groups.Windows +FLTK.Widgets.Inputs +FLTK.Widgets.Inputs.File +FLTK.Widgets.Menus +FLTK.Widgets.Menus.Menu_Buttons + + + + +To-Do: + +FL_Pixmap +FL_GIF_Image +FL_XPM_Image +FL_Shared_Image +FL_Tiled_Image +FL_Chart +FL_Clock_Output +FL_Clock +FL_Round_Clock +FL_Browser +FL_Check_Browser +FL_File_Browser +FL_Hold_Browser +FL_Multi_Browser +FL_Select_Browser +FL_Color_Chooser +FL_Help_View +FL_Input_Choice +FL_Pack +FL_Spinner +FL_Table +FL_Table_Row +FL_Tabs +FL_Tile +FL_Tree +FL_Wizard +FL_Progress +FL_Valuator +FL_Adjuster +FL_Counter +FL_Simple_Counter +FL_Dial +FL_Fill_Dial +FL_Line_Dial +FL_Roller +FL_Slider +FL_Fill_Slider +FL_Hor_Fill_Slider +FL_Hor_Nice_Slider +FL_Hor_Slider +FL_Nice_Slider +FL_Scrollbar +FL_Value_Slider +FL_Hor_Value_Slider + + + + +Never: + +FL_FormsBitmap +FL_FormsPixmap +FL_FormsText +FL_Free +FL_Sys_Menu_Bar +FL_Positioner +FL_Timer + diff --git a/src/c_fl_bitmap.cpp b/src/c_fl_bitmap.cpp index 2481062..fe5fd99 100644 --- a/src/c_fl_bitmap.cpp +++ b/src/c_fl_bitmap.cpp @@ -8,12 +8,10 @@ void free_fl_bitmap(BITMAP b) { delete reinterpret_cast<Fl_Bitmap*>(b); } - BITMAP fl_bitmap_copy(BITMAP b, int w, int h) { return reinterpret_cast<Fl_Bitmap*>(b)->copy(w, h); } - BITMAP fl_bitmap_copy2(BITMAP b) { return reinterpret_cast<Fl_Bitmap*>(b)->copy(); } diff --git a/src/c_fl_bitmap.h b/src/c_fl_bitmap.h index e132347..3a0aa64 100644 --- a/src/c_fl_bitmap.h +++ b/src/c_fl_bitmap.h @@ -4,9 +4,13 @@ #define FL_BITMAP_GUARD + + typedef void* BITMAP; + + extern "C" void free_fl_bitmap(BITMAP b); extern "C" BITMAP fl_bitmap_copy(BITMAP b, int w, int h); extern "C" BITMAP fl_bitmap_copy2(BITMAP b); diff --git a/src/c_fl_bmp_image.cpp b/src/c_fl_bmp_image.cpp index 23ec928..fe12cc7 100644 --- a/src/c_fl_bmp_image.cpp +++ b/src/c_fl_bmp_image.cpp @@ -9,7 +9,6 @@ BMP_IMAGE new_fl_bmp_image(const char * f) { return b; } - void free_fl_bmp_image(BMP_IMAGE b) { delete reinterpret_cast<Fl_BMP_Image*>(b); } diff --git a/src/c_fl_bmp_image.h b/src/c_fl_bmp_image.h index 84e7987..1f9b8df 100644 --- a/src/c_fl_bmp_image.h +++ b/src/c_fl_bmp_image.h @@ -4,9 +4,13 @@ #define FL_BMP_IMAGE_GUARD + + typedef void* BMP_IMAGE; + + extern "C" BMP_IMAGE new_fl_bmp_image(const char * f); extern "C" void free_fl_bmp_image(BMP_IMAGE b); diff --git a/src/c_fl_box.cpp b/src/c_fl_box.cpp index 7e2cc22..3af626f 100644 --- a/src/c_fl_box.cpp +++ b/src/c_fl_box.cpp @@ -23,42 +23,34 @@ class My_Box : public Fl_Box { h_hook_p handle_hook; }; - void My_Box::draw() { (*draw_hook)(this->user_data()); } - void My_Box::real_draw() { Fl_Box::draw(); } - int My_Box::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Box::real_handle(int e) { return Fl_Box::handle(e); } - void box_set_draw_hook(BOX n, void * d) { reinterpret_cast<My_Box*>(n)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_box_draw(BOX n) { reinterpret_cast<My_Box*>(n)->real_draw(); } - void box_set_handle_hook(BOX n, void * h) { reinterpret_cast<My_Box*>(n)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_box_handle(BOX n, int e) { return reinterpret_cast<My_Box*>(n)->real_handle(e); } @@ -71,7 +63,6 @@ BOX new_fl_box(int x, int y, int w, int h, char* label) { return b; } - void free_fl_box(BOX b) { delete reinterpret_cast<My_Box*>(b); } diff --git a/src/c_fl_box.h b/src/c_fl_box.h index 22ab587..4c61c4e 100644 --- a/src/c_fl_box.h +++ b/src/c_fl_box.h @@ -4,15 +4,21 @@ #define FL_BOX_GUARD + + typedef void* BOX; + + extern "C" void box_set_draw_hook(BOX n, void * d); extern "C" void fl_box_draw(BOX n); extern "C" void box_set_handle_hook(BOX n, void * h); extern "C" int fl_box_handle(BOX n, int e); + + extern "C" BOX new_fl_box(int x, int y, int w, int h, char * label); extern "C" void free_fl_box(BOX b); diff --git a/src/c_fl_button.cpp b/src/c_fl_button.cpp index d164fb0..5aa06c4 100644 --- a/src/c_fl_button.cpp +++ b/src/c_fl_button.cpp @@ -23,42 +23,34 @@ class My_Button : public Fl_Button { h_hook_p handle_hook; }; - void My_Button::draw() { (*draw_hook)(this->user_data()); } - void My_Button::real_draw() { Fl_Button::draw(); } - int My_Button::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Button::real_handle(int e) { return Fl_Button::handle(e); } - void button_set_draw_hook(BUTTON b, void * d) { reinterpret_cast<My_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_button_draw(BUTTON b) { reinterpret_cast<My_Button*>(b)->real_draw(); } - void button_set_handle_hook(BUTTON b, void * h) { reinterpret_cast<My_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_button_handle(BUTTON b, int e) { return reinterpret_cast<My_Button*>(b)->real_handle(e); } @@ -71,7 +63,6 @@ BUTTON new_fl_button(int x, int y, int w, int h, char* label) { return b; } - void free_fl_button(BUTTON b) { delete reinterpret_cast<My_Button*>(b); } @@ -83,12 +74,10 @@ int fl_button_get_state(BUTTON b) { return reinterpret_cast<Fl_Button*>(b)->value(); } - void fl_button_set_state(BUTTON b, int s) { reinterpret_cast<Fl_Button*>(b)->value(s); } - void fl_button_set_only(BUTTON b) { reinterpret_cast<Fl_Button*>(b)->setonly(); } diff --git a/src/c_fl_button.h b/src/c_fl_button.h index 002c173..7209ab6 100644 --- a/src/c_fl_button.h +++ b/src/c_fl_button.h @@ -4,17 +4,27 @@ #define FL_BUTTON_GUARD + + typedef void* BUTTON; + + extern "C" void button_set_draw_hook(BUTTON b, void * d); extern "C" void fl_button_draw(BUTTON b); extern "C" void button_set_handle_hook(BUTTON b, void * h); extern "C" int fl_button_handle(BUTTON b, int e); + + + extern "C" BUTTON new_fl_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_button(BUTTON b); + + + extern "C" int fl_button_get_state(BUTTON b); extern "C" void fl_button_set_state(BUTTON b, int s); extern "C" void fl_button_set_only(BUTTON b); diff --git a/src/c_fl_check_button.cpp b/src/c_fl_check_button.cpp index 2b5bdf1..8c576f6 100644 --- a/src/c_fl_check_button.cpp +++ b/src/c_fl_check_button.cpp @@ -23,42 +23,34 @@ class My_Check_Button : public Fl_Check_Button { h_hook_p handle_hook; }; - void My_Check_Button::draw() { (*draw_hook)(this->user_data()); } - void My_Check_Button::real_draw() { Fl_Check_Button::draw(); } - int My_Check_Button::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Check_Button::real_handle(int e) { return Fl_Check_Button::handle(e); } - void check_button_set_draw_hook(CHECKBUTTON b, void * d) { reinterpret_cast<My_Check_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_check_button_draw(CHECKBUTTON b) { reinterpret_cast<My_Check_Button*>(b)->real_draw(); } - void check_button_set_handle_hook(CHECKBUTTON b, void * h) { reinterpret_cast<My_Check_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_check_button_handle(CHECKBUTTON b, int e) { return reinterpret_cast<My_Check_Button*>(b)->real_handle(e); } @@ -71,7 +63,6 @@ CHECKBUTTON new_fl_check_button(int x, int y, int w, int h, char* label) { return b; } - void free_fl_check_button(CHECKBUTTON b) { delete reinterpret_cast<My_Check_Button*>(b); } diff --git a/src/c_fl_check_button.h b/src/c_fl_check_button.h index 2d6e5da..24fff48 100644 --- a/src/c_fl_check_button.h +++ b/src/c_fl_check_button.h @@ -4,14 +4,21 @@ #define FL_CHECK_BUTTON_GUARD + + typedef void* CHECKBUTTON; + + extern "C" void check_button_set_draw_hook(CHECKBUTTON b, void * d); extern "C" void fl_check_button_draw(CHECKBUTTON b); extern "C" void check_button_set_handle_hook(CHECKBUTTON b, void * h); extern "C" int fl_check_button_handle(CHECKBUTTON b, int e); + + + extern "C" CHECKBUTTON new_fl_check_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_check_button(CHECKBUTTON b); diff --git a/src/c_fl_double_window.cpp b/src/c_fl_double_window.cpp index 4b7b925..4bed936 100644 --- a/src/c_fl_double_window.cpp +++ b/src/c_fl_double_window.cpp @@ -23,42 +23,34 @@ class My_Double_Window : public Fl_Double_Window { h_hook_p handle_hook; }; - void My_Double_Window::draw() { (*draw_hook)(this->user_data()); } - void My_Double_Window::real_draw() { Fl_Double_Window::draw(); } - int My_Double_Window::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Double_Window::real_handle(int e) { return Fl_Double_Window::handle(e); } - void double_window_set_draw_hook(DOUBLEWINDOW n, void * d) { reinterpret_cast<My_Double_Window*>(n)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_double_window_draw(DOUBLEWINDOW n) { reinterpret_cast<My_Double_Window*>(n)->real_draw(); } - void double_window_set_handle_hook(DOUBLEWINDOW n, void * h) { reinterpret_cast<My_Double_Window*>(n)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_double_window_handle(DOUBLEWINDOW n, int e) { return reinterpret_cast<My_Double_Window*>(n)->real_handle(e); } @@ -71,13 +63,11 @@ DOUBLEWINDOW new_fl_double_window(int x, int y, int w, int h, char* label) { return d; } - DOUBLEWINDOW new_fl_double_window2(int w, int h) { My_Double_Window *d = new My_Double_Window(w, h); return d; } - void free_fl_double_window(DOUBLEWINDOW d) { delete reinterpret_cast<My_Double_Window*>(d); } @@ -89,12 +79,10 @@ void fl_double_window_show(DOUBLEWINDOW d) { reinterpret_cast<Fl_Double_Window*>(d)->show(); } - void fl_double_window_hide(DOUBLEWINDOW d) { reinterpret_cast<Fl_Double_Window*>(d)->hide(); } - void fl_double_window_flush(DOUBLEWINDOW d) { reinterpret_cast<Fl_Double_Window*>(d)->flush(); } diff --git a/src/c_fl_double_window.h b/src/c_fl_double_window.h index 4b93b03..96b6a1d 100644 --- a/src/c_fl_double_window.h +++ b/src/c_fl_double_window.h @@ -4,20 +4,28 @@ #define FL_DOUBLE_WINDOW_GUARD + + typedef void* DOUBLEWINDOW; + + extern "C" void double_window_set_draw_hook(DOUBLEWINDOW n, void * d); extern "C" void fl_double_window_draw(DOUBLEWINDOW n); extern "C" void double_window_set_handle_hook(DOUBLEWINDOW n, void * h); extern "C" int fl_double_window_handle(DOUBLEWINDOW n, int e); + + extern "C" DOUBLEWINDOW new_fl_double_window(int x, int y, int w, int h, char* label); extern "C" DOUBLEWINDOW new_fl_double_window2(int w, int h); extern "C" void free_fl_double_window(DOUBLEWINDOW d); + + extern "C" void fl_double_window_show(DOUBLEWINDOW d); extern "C" void fl_double_window_hide(DOUBLEWINDOW d); extern "C" void fl_double_window_flush(DOUBLEWINDOW d); diff --git a/src/c_fl_file_input.cpp b/src/c_fl_file_input.cpp index 1af9e19..03f941c 100644 --- a/src/c_fl_file_input.cpp +++ b/src/c_fl_file_input.cpp @@ -23,42 +23,34 @@ class My_File_Input : public Fl_File_Input { h_hook_p handle_hook; }; - void My_File_Input::draw() { (*draw_hook)(this->user_data()); } - void My_File_Input::real_draw() { Fl_File_Input::draw(); } - int My_File_Input::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_File_Input::real_handle(int e) { return Fl_File_Input::handle(e); } - void file_input_set_draw_hook(FILE_INPUT i, void * d) { reinterpret_cast<My_File_Input*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_file_input_draw(FILE_INPUT i) { reinterpret_cast<My_File_Input*>(i)->real_draw(); } - void file_input_set_handle_hook(FILE_INPUT i, void * h) { reinterpret_cast<My_File_Input*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_file_input_handle(FILE_INPUT i, int e) { return reinterpret_cast<My_File_Input*>(i)->real_handle(e); } @@ -71,7 +63,6 @@ FILE_INPUT new_fl_file_input(int x, int y, int w, int h, char* label) { return i; } - void free_fl_file_input(FILE_INPUT i) { delete reinterpret_cast<My_File_Input*>(i); } diff --git a/src/c_fl_file_input.h b/src/c_fl_file_input.h index d771389..d2a7b73 100644 --- a/src/c_fl_file_input.h +++ b/src/c_fl_file_input.h @@ -4,15 +4,21 @@ #define FL_FILE_INPUT_GUARD + + typedef void* FILE_INPUT; + + extern "C" void file_input_set_draw_hook(FILE_INPUT i, void * d); extern "C" void fl_file_input_draw(FILE_INPUT i); extern "C" void file_input_set_handle_hook(FILE_INPUT i, void * h); extern "C" int fl_file_input_handle(FILE_INPUT i, int e); + + extern "C" FILE_INPUT new_fl_file_input(int x, int y, int w, int h, char* label); extern "C" void free_fl_file_input(FILE_INPUT i); diff --git a/src/c_fl_float_input.cpp b/src/c_fl_float_input.cpp index a9ac50e..8a8ab7c 100644 --- a/src/c_fl_float_input.cpp +++ b/src/c_fl_float_input.cpp @@ -23,42 +23,34 @@ class My_Float_Input : public Fl_Float_Input { h_hook_p handle_hook; }; - void My_Float_Input::draw() { (*draw_hook)(this->user_data()); } - void My_Float_Input::real_draw() { Fl_Float_Input::draw(); } - int My_Float_Input::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Float_Input::real_handle(int e) { return Fl_Float_Input::handle(e); } - void float_input_set_draw_hook(FLOAT_INPUT i, void * d) { reinterpret_cast<My_Float_Input*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_float_input_draw(FLOAT_INPUT i) { reinterpret_cast<My_Float_Input*>(i)->real_draw(); } - void float_input_set_handle_hook(FLOAT_INPUT i, void * h) { reinterpret_cast<My_Float_Input*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_float_input_handle(FLOAT_INPUT i, int e) { return reinterpret_cast<My_Float_Input*>(i)->real_handle(e); } @@ -71,7 +63,6 @@ FLOAT_INPUT new_fl_float_input(int x, int y, int w, int h, char* label) { return i; } - void free_fl_float_input(FLOAT_INPUT i) { delete reinterpret_cast<My_Float_Input*>(i); } diff --git a/src/c_fl_float_input.h b/src/c_fl_float_input.h index caba3a1..a49d0f7 100644 --- a/src/c_fl_float_input.h +++ b/src/c_fl_float_input.h @@ -4,15 +4,21 @@ #define FL_FLOAT_INPUT_GUARD + + typedef void* FLOAT_INPUT; + + extern "C" void float_input_set_draw_hook(FLOAT_INPUT i, void * d); extern "C" void fl_float_input_draw(FLOAT_INPUT i); extern "C" void float_input_set_handle_hook(FLOAT_INPUT i, void * h); extern "C" int fl_float_input_handle(FLOAT_INPUT i, int e); + + extern "C" FLOAT_INPUT new_fl_float_input(int x, int y, int w, int h, char* label); extern "C" void free_fl_float_input(FLOAT_INPUT i); diff --git a/src/c_fl_group.cpp b/src/c_fl_group.cpp index db3b9b3..2cfb444 100644 --- a/src/c_fl_group.cpp +++ b/src/c_fl_group.cpp @@ -25,42 +25,34 @@ class My_Group : public Fl_Group { h_hook_p handle_hook; }; - void My_Group::draw() { (*draw_hook)(this->user_data()); } - void My_Group::real_draw() { Fl_Group::draw(); } - int My_Group::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Group::real_handle(int e) { return Fl_Group::handle(e); } - void group_set_draw_hook(GROUP g, void * d) { reinterpret_cast<My_Group*>(g)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_group_draw(GROUP g) { reinterpret_cast<My_Group*>(g)->real_draw(); } - void group_set_handle_hook(GROUP g, void * h) { reinterpret_cast<My_Group*>(g)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_group_handle(GROUP g, int e) { return reinterpret_cast<My_Group*>(g)->real_handle(e); } @@ -73,7 +65,6 @@ GROUP new_fl_group(int x, int y, int w, int h, char* label) { return g; } - void free_fl_group(GROUP g) { delete reinterpret_cast<My_Group*>(g); } @@ -92,57 +83,38 @@ void fl_group_add(GROUP g, WIDGET item) { reinterpret_cast<Fl_Group*>(g)->add(reinterpret_cast<Fl_Widget*>(item)); } - -int fl_group_find(GROUP g, WIDGET item) { - return reinterpret_cast<Fl_Group*>(g)->find(reinterpret_cast<Fl_Widget*>(item)); -} - - -void fl_group_init_sizes(GROUP g) { - reinterpret_cast<Fl_Group*>(g)->init_sizes(); -} - - void fl_group_insert(GROUP g, WIDGET item, int place) { reinterpret_cast<Fl_Group*>(g)->insert(*(reinterpret_cast<Fl_Widget*>(item)), place); } - void fl_group_insert2(GROUP g, WIDGET item, WIDGET before) { reinterpret_cast<Fl_Group*>(g)->insert(*(reinterpret_cast<Fl_Widget*>(item)), reinterpret_cast<Fl_Widget*>(before)); } - void fl_group_remove(GROUP g, WIDGET item) { reinterpret_cast<Fl_Group*>(g)->remove(reinterpret_cast<Fl_Widget*>(item)); } - void fl_group_remove2(GROUP g, int place) { reinterpret_cast<Fl_Group*>(g)->remove(place); } -void * fl_group_get_resizable(GROUP g) { - return reinterpret_cast<Fl_Group*>(g)->resizable(); -} -void fl_group_set_resizable(GROUP g, WIDGET item) { - reinterpret_cast<Fl_Group*>(g)->resizable(reinterpret_cast<Fl_Widget*>(item)); +void * fl_group_child(GROUP g, int place) { + return reinterpret_cast<Fl_Group*>(g)->child(place); } - - +int fl_group_find(GROUP g, WIDGET item) { + return reinterpret_cast<Fl_Group*>(g)->find(reinterpret_cast<Fl_Widget*>(item)); +} int fl_group_children(GROUP g) { return reinterpret_cast<Fl_Group*>(g)->children(); } -void * fl_group_child(GROUP g, int place) { - return reinterpret_cast<Fl_Group*>(g)->child(place); -} //unsigned int flt_group_get_clip_children(GROUP g) { @@ -154,3 +126,18 @@ void * fl_group_child(GROUP g, int place) { // reinterpret_cast<Fl_Group*>(g)->clip_children(c); //} + + + +void * fl_group_get_resizable(GROUP g) { + return reinterpret_cast<Fl_Group*>(g)->resizable(); +} + +void fl_group_set_resizable(GROUP g, WIDGET item) { + reinterpret_cast<Fl_Group*>(g)->resizable(reinterpret_cast<Fl_Widget*>(item)); +} + +void fl_group_init_sizes(GROUP g) { + reinterpret_cast<Fl_Group*>(g)->init_sizes(); +} + diff --git a/src/c_fl_group.h b/src/c_fl_group.h index ddd8ef0..d00fe61 100644 --- a/src/c_fl_group.h +++ b/src/c_fl_group.h @@ -6,34 +6,50 @@ #include "c_fl_widget.h" + + typedef void* GROUP; + + extern "C" void group_set_draw_hook(GROUP g, void * d); extern "C" void fl_group_draw(GROUP g); extern "C" void group_set_handle_hook(GROUP g, void * h); extern "C" int fl_group_handle(GROUP g, int e); + + + extern "C" GROUP new_fl_group(int x, int y, int w, int h, char* label); extern "C" void free_fl_group(GROUP g); + + + extern "C" void fl_group_end(GROUP g); + extern "C" void fl_group_add(GROUP g, WIDGET item); -extern "C" int fl_group_find(GROUP g, WIDGET item); -extern "C" void fl_group_init_sizes(GROUP g); extern "C" void fl_group_insert(GROUP g, WIDGET item, int place); extern "C" void fl_group_insert2(GROUP g, WIDGET item, WIDGET before); extern "C" void fl_group_remove(GROUP g, WIDGET item); extern "C" void fl_group_remove2(GROUP g, int place); -extern "C" void * fl_group_get_resizable(GROUP g); -extern "C" void fl_group_set_resizable(GROUP g, WIDGET item); -extern "C" int fl_group_children(GROUP g); + extern "C" void * fl_group_child(GROUP g, int place); +extern "C" int fl_group_find(GROUP g, WIDGET item); +extern "C" int fl_group_children(GROUP g); + + //extern "C" unsigned int fl_group_get_clip_children(GROUP g); //extern "C" void fl_group_set_clip_children(GROUP g, int c); +extern "C" void * fl_group_get_resizable(GROUP g); +extern "C" void fl_group_set_resizable(GROUP g, WIDGET item); +extern "C" void fl_group_init_sizes(GROUP g); + + #endif diff --git a/src/c_fl_image.cpp b/src/c_fl_image.cpp index a02c683..3323c25 100644 --- a/src/c_fl_image.cpp +++ b/src/c_fl_image.cpp @@ -4,22 +4,21 @@ #include "c_fl_image.h" + + IMAGE new_fl_image(int w, int h, int d) { Fl_Image *i = new Fl_Image(w, h, d); return i; } - void free_fl_image(IMAGE i) { delete reinterpret_cast<Fl_Image*>(i); } - IMAGE fl_image_copy(IMAGE i, int w, int h) { return reinterpret_cast<Fl_Image*>(i)->copy(w, h); } - IMAGE fl_image_copy2(IMAGE i) { return reinterpret_cast<Fl_Image*>(i)->copy(); } @@ -31,27 +30,28 @@ void fl_image_color_average(IMAGE i, int c, float b) { reinterpret_cast<Fl_Image*>(i)->color_average(c, b); } - void fl_image_desaturate(IMAGE i) { reinterpret_cast<Fl_Image*>(i)->desaturate(); } + + void fl_image_inactive(IMAGE i) { reinterpret_cast<Fl_Image*>(i)->inactive(); } + + int fl_image_w(IMAGE i) { return reinterpret_cast<Fl_Image*>(i)->w(); } - int fl_image_h(IMAGE i) { return reinterpret_cast<Fl_Image*>(i)->h(); } - int fl_image_d(IMAGE i) { return reinterpret_cast<Fl_Image*>(i)->d(); } diff --git a/src/c_fl_image.h b/src/c_fl_image.h index ce4a8ba..bdd71a3 100644 --- a/src/c_fl_image.h +++ b/src/c_fl_image.h @@ -4,18 +4,28 @@ #define FL_IMAGE_GUARD + + typedef void* IMAGE; + + extern "C" IMAGE new_fl_image(int w, int h, int d); extern "C" void free_fl_image(IMAGE i); extern "C" IMAGE fl_image_copy(IMAGE i, int w, int h); extern "C" IMAGE fl_image_copy2(IMAGE i); + + extern "C" void fl_image_color_average(IMAGE i, int c, float b); extern "C" void fl_image_desaturate(IMAGE i); + + extern "C" void fl_image_inactive(IMAGE i); + + extern "C" int fl_image_w(IMAGE i); extern "C" int fl_image_h(IMAGE i); extern "C" int fl_image_d(IMAGE i); diff --git a/src/c_fl_input.cpp b/src/c_fl_input.cpp index 7afc5b6..cb0b849 100644 --- a/src/c_fl_input.cpp +++ b/src/c_fl_input.cpp @@ -23,42 +23,34 @@ class My_Input : public Fl_Input { h_hook_p handle_hook; }; - void My_Input::draw() { (*draw_hook)(this->user_data()); } - void My_Input::real_draw() { Fl_Input::draw(); } - int My_Input::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Input::real_handle(int e) { return Fl_Input::handle(e); } - void input_set_draw_hook(INPUT i, void * d) { reinterpret_cast<My_Input*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_input_draw(INPUT i) { reinterpret_cast<My_Input*>(i)->real_draw(); } - void input_set_handle_hook(INPUT i, void * h) { reinterpret_cast<My_Input*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_input_handle(INPUT i, int e) { return reinterpret_cast<My_Input*>(i)->real_handle(e); } @@ -71,7 +63,6 @@ INPUT new_fl_input(int x, int y, int w, int h, char* label) { return i; } - void free_fl_input(INPUT i) { delete reinterpret_cast<My_Input*>(i); } diff --git a/src/c_fl_input.h b/src/c_fl_input.h index 231d84e..cb9935a 100644 --- a/src/c_fl_input.h +++ b/src/c_fl_input.h @@ -4,19 +4,27 @@ #define FL_INPUT_GUARD + + typedef void* INPUT; + + extern "C" void input_set_draw_hook(INPUT n, void * d); extern "C" void fl_input_draw(INPUT n); extern "C" void input_set_handle_hook(INPUT i, void * h); extern "C" int fl_input_handle(INPUT i, int e); + + extern "C" INPUT new_fl_input(int x, int y, int w, int h, char* label); extern "C" void free_fl_input(INPUT i); + + extern "C" const char * fl_input_get_value(INPUT i); diff --git a/src/c_fl_int_input.cpp b/src/c_fl_int_input.cpp index 1497c0d..5dab998 100644 --- a/src/c_fl_int_input.cpp +++ b/src/c_fl_int_input.cpp @@ -23,42 +23,34 @@ class My_Int_Input : public Fl_Int_Input { h_hook_p handle_hook; }; - void My_Int_Input::draw() { (*draw_hook)(this->user_data()); } - void My_Int_Input::real_draw() { Fl_Int_Input::draw(); } - int My_Int_Input::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Int_Input::real_handle(int e) { return Fl_Int_Input::handle(e); } - void int_input_set_draw_hook(INT_INPUT i, void * d) { reinterpret_cast<My_Int_Input*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_int_input_draw(INT_INPUT i) { reinterpret_cast<My_Int_Input*>(i)->real_draw(); } - void int_input_set_handle_hook(INT_INPUT i, void * h) { reinterpret_cast<My_Int_Input*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_int_input_handle(INT_INPUT i, int e) { return reinterpret_cast<My_Int_Input*>(i)->real_handle(e); } @@ -71,7 +63,6 @@ INT_INPUT new_fl_int_input(int x, int y, int w, int h, char* label) { return i; } - void free_fl_int_input(INT_INPUT i) { delete reinterpret_cast<My_Int_Input*>(i); } diff --git a/src/c_fl_int_input.h b/src/c_fl_int_input.h index e9f4926..907c041 100644 --- a/src/c_fl_int_input.h +++ b/src/c_fl_int_input.h @@ -4,15 +4,21 @@ #define FL_INT_INPUT_GUARD + + typedef void* INT_INPUT; + + extern "C" void int_input_set_draw_hook(INT_INPUT i, void * d); extern "C" void fl_int_input_draw(INT_INPUT i); extern "C" void int_input_set_handle_hook(INT_INPUT i, void * h); extern "C" int fl_int_input_handle(INT_INPUT i, int e); + + extern "C" INT_INPUT new_fl_int_input(int x, int y, int w, int h, char* label); extern "C" void free_fl_int_input(INT_INPUT i); diff --git a/src/c_fl_jpeg_image.cpp b/src/c_fl_jpeg_image.cpp index 763c55f..93ab22d 100644 --- a/src/c_fl_jpeg_image.cpp +++ b/src/c_fl_jpeg_image.cpp @@ -4,12 +4,13 @@ #include "c_fl_jpeg_image.h" + + JPEG_IMAGE new_fl_jpeg_image(const char * f) { Fl_JPEG_Image *j = new Fl_JPEG_Image(f); return j; } - void free_fl_jpeg_image(JPEG_IMAGE j) { delete reinterpret_cast<Fl_JPEG_Image*>(j); } diff --git a/src/c_fl_jpeg_image.h b/src/c_fl_jpeg_image.h index 1086f34..c81bd6f 100644 --- a/src/c_fl_jpeg_image.h +++ b/src/c_fl_jpeg_image.h @@ -4,9 +4,13 @@ #define FL_JPEG_IMAGE_GUARD + + typedef void* JPEG_IMAGE; + + extern "C" JPEG_IMAGE new_fl_jpeg_image(const char * f); extern "C" void free_fl_jpeg_image(JPEG_IMAGE j); diff --git a/src/c_fl_light_button.cpp b/src/c_fl_light_button.cpp index df1a02e..e1ffe84 100644 --- a/src/c_fl_light_button.cpp +++ b/src/c_fl_light_button.cpp @@ -23,42 +23,34 @@ class My_Light_Button : public Fl_Light_Button { h_hook_p handle_hook; }; - void My_Light_Button::draw() { (*draw_hook)(this->user_data()); } - void My_Light_Button::real_draw() { Fl_Light_Button::draw(); } - int My_Light_Button::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Light_Button::real_handle(int e) { return Fl_Light_Button::handle(e); } - void light_button_set_draw_hook(LIGHTBUTTON b, void * d) { reinterpret_cast<My_Light_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_light_button_draw(LIGHTBUTTON b) { reinterpret_cast<My_Light_Button*>(b)->real_draw(); } - void light_button_set_handle_hook(LIGHTBUTTON b, void * h) { reinterpret_cast<My_Light_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_light_button_handle(LIGHTBUTTON b, int e) { return reinterpret_cast<My_Light_Button*>(b)->real_handle(e); } @@ -71,7 +63,6 @@ LIGHTBUTTON new_fl_light_button(int x, int y, int w, int h, char* label) { return b; } - void free_fl_light_button(LIGHTBUTTON b) { delete reinterpret_cast<My_Light_Button*>(b); } diff --git a/src/c_fl_light_button.h b/src/c_fl_light_button.h index 4faa9e9..1a9fab4 100644 --- a/src/c_fl_light_button.h +++ b/src/c_fl_light_button.h @@ -4,14 +4,21 @@ #define FL_LIGHT_BUTTON_GUARD + + typedef void* LIGHTBUTTON; + + extern "C" void light_button_set_draw_hook(LIGHTBUTTON b, void * d); extern "C" void fl_light_button_draw(LIGHTBUTTON b); extern "C" void light_button_set_handle_hook(LIGHTBUTTON b, void * h); extern "C" int fl_light_button_handle(LIGHTBUTTON b, int e); + + + extern "C" LIGHTBUTTON new_fl_light_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_light_button(LIGHTBUTTON b); diff --git a/src/c_fl_menu.cpp b/src/c_fl_menu.cpp index 5b5fe8f..e68be4c 100644 --- a/src/c_fl_menu.cpp +++ b/src/c_fl_menu.cpp @@ -19,22 +19,18 @@ class My_Menu : public Fl_Menu_ { h_hook_p handle_hook; }; - void My_Menu::draw() { (*draw_hook)(this->user_data()); } - int My_Menu::handle(int e) { return (*handle_hook)(this->user_data(), e); } - void menu_set_draw_hook(MENU m, void * d) { reinterpret_cast<My_Menu*>(m)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void menu_set_handle_hook(MENU m, void * h) { reinterpret_cast<My_Menu*>(m)->handle_hook = reinterpret_cast<h_hook_p>(h); } @@ -47,7 +43,6 @@ MENU new_fl_menu(int x, int y, int w, int h, char* label) { return m; } - void free_fl_menu(MENU m) { delete reinterpret_cast<My_Menu*>(m); } @@ -59,12 +54,10 @@ int fl_menu_add(MENU m, const char * t, unsigned long s, void * c, void * u, uns return reinterpret_cast<Fl_Menu_*>(m)->add(t, s, reinterpret_cast<Fl_Callback_p>(c), u, f); } - const void * fl_menu_find_item(MENU m, const char * t) { return reinterpret_cast<Fl_Menu_*>(m)->find_item(t); } - const void * fl_menu_mvalue(MENU m) { return reinterpret_cast<Fl_Menu_*>(m)->mvalue(); } diff --git a/src/c_fl_menu.h b/src/c_fl_menu.h index ba1fc56..e173e8e 100644 --- a/src/c_fl_menu.h +++ b/src/c_fl_menu.h @@ -4,18 +4,26 @@ #define FL_MENU_GUARD + + typedef void* MENU; // typedef void* MENUITEM; + + extern "C" void menu_set_draw_hook(MENU m, void * d); extern "C" void menu_set_handle_hook(MENU m, void * h); + + extern "C" MENU new_fl_menu(int x, int y, int w, int h, char* label); extern "C" void free_fl_menu(MENU m); + + extern "C" int fl_menu_add(MENU m, const char * t, unsigned long s, void * c, void * u, unsigned long f); extern "C" const void * fl_menu_find_item(MENU m, const char * t); extern "C" const void * fl_menu_mvalue(MENU m); diff --git a/src/c_fl_menu_bar.cpp b/src/c_fl_menu_bar.cpp index ec94607..98b61f2 100644 --- a/src/c_fl_menu_bar.cpp +++ b/src/c_fl_menu_bar.cpp @@ -23,42 +23,34 @@ class My_Menu_Bar : public Fl_Menu_Bar { h_hook_p handle_hook; }; - void My_Menu_Bar::draw() { (*draw_hook)(this->user_data()); } - void My_Menu_Bar::real_draw() { Fl_Menu_Bar::draw(); } - int My_Menu_Bar::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Menu_Bar::real_handle(int e) { return Fl_Menu_Bar::handle(e); } - void menu_bar_set_draw_hook(MENUBAR m, void * d) { reinterpret_cast<My_Menu_Bar*>(m)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_menu_bar_draw(MENUBAR m) { reinterpret_cast<My_Menu_Bar*>(m)->real_draw(); } - void menu_bar_set_handle_hook(MENUBAR m, void * h) { reinterpret_cast<My_Menu_Bar*>(m)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_menu_bar_handle(MENUBAR m, int e) { return reinterpret_cast<My_Menu_Bar*>(m)->real_handle(e); } @@ -71,7 +63,6 @@ MENUBAR new_fl_menu_bar(int x, int y, int w, int h, char* label) { return m; } - void free_fl_menu_bar(MENUBAR m) { delete reinterpret_cast<My_Menu_Bar*>(m); } diff --git a/src/c_fl_menu_bar.h b/src/c_fl_menu_bar.h index 93b1220..60d2e06 100644 --- a/src/c_fl_menu_bar.h +++ b/src/c_fl_menu_bar.h @@ -4,15 +4,21 @@ #define FL_MENU_BAR_GUARD + + typedef void* MENUBAR; + + extern "C" void menu_bar_set_draw_hook(MENUBAR m, void * d); extern "C" void fl_menu_bar_draw(MENUBAR m); extern "C" void menu_bar_set_handle_hook(MENUBAR m, void * h); extern "C" int fl_menu_bar_handle(MENUBAR m, int e); + + extern "C" MENUBAR new_fl_menu_bar(int x, int y, int w, int h, char* label); extern "C" void free_fl_menu_bar(MENUBAR m); diff --git a/src/c_fl_menu_button.cpp b/src/c_fl_menu_button.cpp index c09cf37..d4ff176 100644 --- a/src/c_fl_menu_button.cpp +++ b/src/c_fl_menu_button.cpp @@ -23,42 +23,34 @@ class My_Menu_Button : public Fl_Menu_Button { h_hook_p handle_hook; }; - void My_Menu_Button::draw() { (*draw_hook)(this->user_data()); } - void My_Menu_Button::real_draw() { Fl_Menu_Button::draw(); } - int My_Menu_Button::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Menu_Button::real_handle(int e) { return Fl_Menu_Button::handle(e); } - void menu_button_set_draw_hook(MENUBUTTON m, void * d) { reinterpret_cast<My_Menu_Button*>(m)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_menu_button_draw(MENUBUTTON m) { reinterpret_cast<My_Menu_Button*>(m)->real_draw(); } - void menu_button_set_handle_hook(MENUBUTTON m, void * h) { reinterpret_cast<My_Menu_Button*>(m)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_menu_button_handle(MENUBUTTON m, int e) { return reinterpret_cast<My_Menu_Button*>(m)->real_handle(e); } @@ -71,7 +63,6 @@ MENUBUTTON new_fl_menu_button(int x, int y, int w, int h, char* label) { return m; } - void free_fl_menu_button(MENUBUTTON m) { delete reinterpret_cast<My_Menu_Button*>(m); } diff --git a/src/c_fl_menu_button.h b/src/c_fl_menu_button.h index 2ccdb51..505723d 100644 --- a/src/c_fl_menu_button.h +++ b/src/c_fl_menu_button.h @@ -4,19 +4,27 @@ #define FL_MENU_BUTTON_GUARD + + typedef void* MENUBUTTON; + + extern "C" void menu_button_set_draw_hook(MENUBUTTON m, void * d); extern "C" void fl_menu_button_draw(MENUBUTTON m); extern "C" void menu_button_set_handle_hook(MENUBUTTON m, void * h); extern "C" int fl_menu_button_handle(MENUBUTTON m, int e); + + extern "C" MENUBUTTON new_fl_menu_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_menu_button(MENUBUTTON m); + + extern "C" void fl_menu_button_type(MENUBUTTON m, unsigned int t); diff --git a/src/c_fl_menu_window.cpp b/src/c_fl_menu_window.cpp index 7e186d7..3505483 100644 --- a/src/c_fl_menu_window.cpp +++ b/src/c_fl_menu_window.cpp @@ -23,42 +23,34 @@ class My_Menu_Window : public Fl_Menu_Window { h_hook_p handle_hook; }; - void My_Menu_Window::draw() { (*draw_hook)(this->user_data()); } - void My_Menu_Window::real_draw() { Fl_Menu_Window::draw(); } - int My_Menu_Window::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Menu_Window::real_handle(int e) { return Fl_Menu_Window::handle(e); } - void menu_window_set_draw_hook(MENUWINDOW n, void * d) { reinterpret_cast<My_Menu_Window*>(n)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_menu_window_draw(MENUWINDOW n) { reinterpret_cast<My_Menu_Window*>(n)->real_draw(); } - void menu_window_set_handle_hook(MENUWINDOW n, void * h) { reinterpret_cast<My_Menu_Window*>(n)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_menu_window_handle(MENUWINDOW n, int e) { return reinterpret_cast<My_Menu_Window*>(n)->real_handle(e); } @@ -71,13 +63,11 @@ MENUWINDOW new_fl_menu_window(int x, int y, int w, int h, char* label) { return m; } - MENUWINDOW new_fl_menu_window2(int w, int h) { My_Menu_Window *m = new My_Menu_Window(w, h); return m; } - void free_fl_menu_window(MENUWINDOW m) { delete reinterpret_cast<My_Menu_Window*>(m); } @@ -89,27 +79,25 @@ void fl_menu_window_show(MENUWINDOW m) { reinterpret_cast<Fl_Menu_Window*>(m)->show(); } - void fl_menu_window_hide(MENUWINDOW m) { reinterpret_cast<Fl_Menu_Window*>(m)->hide(); } - void fl_menu_window_flush(MENUWINDOW m) { reinterpret_cast<Fl_Menu_Window*>(m)->flush(); } + + void fl_menu_window_set_overlay(MENUWINDOW m) { reinterpret_cast<Fl_Menu_Window*>(m)->set_overlay(); } - void fl_menu_window_clear_overlay(MENUWINDOW m) { reinterpret_cast<Fl_Menu_Window*>(m)->clear_overlay(); } - unsigned int fl_menu_window_overlay(MENUWINDOW m) { return reinterpret_cast<Fl_Menu_Window*>(m)->overlay(); } diff --git a/src/c_fl_menu_window.h b/src/c_fl_menu_window.h index 5331a6c..402f50a 100644 --- a/src/c_fl_menu_window.h +++ b/src/c_fl_menu_window.h @@ -4,23 +4,33 @@ #define FL_MENU_WINDOW_GUARD + + typedef void* MENUWINDOW; + + extern "C" void menu_window_set_draw_hook(MENUWINDOW n, void * d); extern "C" void fl_menu_window_draw(MENUWINDOW n); extern "C" void menu_window_set_handle_hook(MENUWINDOW n, void * h); extern "C" int fl_menu_window_handle(MENUWINDOW n, int e); + + extern "C" MENUWINDOW new_fl_menu_window(int x, int y, int w, int h, char* label); extern "C" MENUWINDOW new_fl_menu_window2(int w, int h); extern "C" void free_fl_menu_window(MENUWINDOW m); + + extern "C" void fl_menu_window_show(MENUWINDOW m); extern "C" void fl_menu_window_hide(MENUWINDOW m); extern "C" void fl_menu_window_flush(MENUWINDOW m); + + extern "C" void fl_menu_window_set_overlay(MENUWINDOW m); extern "C" void fl_menu_window_clear_overlay(MENUWINDOW m); extern "C" unsigned int fl_menu_window_overlay(MENUWINDOW m); diff --git a/src/c_fl_menuitem.cpp b/src/c_fl_menuitem.cpp index 12f0d71..631fdd4 100644 --- a/src/c_fl_menuitem.cpp +++ b/src/c_fl_menuitem.cpp @@ -11,11 +11,12 @@ int fl_menuitem_value(MENUITEM mi) { } + + void fl_menuitem_activate(MENUITEM mi) { reinterpret_cast<Fl_Menu_Item*>(mi)->activate(); } - void fl_menuitem_deactivate(MENUITEM mi) { reinterpret_cast<Fl_Menu_Item*>(mi)->deactivate(); } diff --git a/src/c_fl_menuitem.h b/src/c_fl_menuitem.h index e381e27..c720557 100644 --- a/src/c_fl_menuitem.h +++ b/src/c_fl_menuitem.h @@ -4,10 +4,16 @@ #define FL_MENUITEM_GUARD + + typedef void* MENUITEM; + + extern "C" int fl_menuitem_value(MENUITEM mi); + + extern "C" void fl_menuitem_activate(MENUITEM mi); extern "C" void fl_menuitem_deactivate(MENUITEM mi); diff --git a/src/c_fl_multiline_input.cpp b/src/c_fl_multiline_input.cpp index b726310..f6ee055 100644 --- a/src/c_fl_multiline_input.cpp +++ b/src/c_fl_multiline_input.cpp @@ -23,42 +23,34 @@ class My_Multiline_Input : public Fl_Multiline_Input { h_hook_p handle_hook; }; - void My_Multiline_Input::draw() { (*draw_hook)(this->user_data()); } - void My_Multiline_Input::real_draw() { Fl_Multiline_Input::draw(); } - int My_Multiline_Input::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Multiline_Input::real_handle(int e) { return Fl_Multiline_Input::handle(e); } - void multiline_input_set_draw_hook(MULTILINE_INPUT i, void * d) { reinterpret_cast<My_Multiline_Input*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_multiline_input_draw(MULTILINE_INPUT i) { reinterpret_cast<My_Multiline_Input*>(i)->real_draw(); } - void multiline_input_set_handle_hook(MULTILINE_INPUT i, void * h) { reinterpret_cast<My_Multiline_Input*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_multiline_input_handle(MULTILINE_INPUT i, int e) { return reinterpret_cast<My_Multiline_Input*>(i)->real_handle(e); } @@ -71,7 +63,6 @@ MULTILINE_INPUT new_fl_multiline_input(int x, int y, int w, int h, char* label) return i; } - void free_fl_multiline_input(MULTILINE_INPUT i) { delete reinterpret_cast<My_Multiline_Input*>(i); } diff --git a/src/c_fl_multiline_input.h b/src/c_fl_multiline_input.h index f6b3113..177567b 100644 --- a/src/c_fl_multiline_input.h +++ b/src/c_fl_multiline_input.h @@ -4,15 +4,21 @@ #define FL_MULTILINE_INPUT_GUARD + + typedef void* MULTILINE_INPUT; + + extern "C" void multiline_input_set_draw_hook(MULTILINE_INPUT i, void * d); extern "C" void fl_multiline_input_draw(MULTILINE_INPUT i); extern "C" void multiline_input_set_handle_hook(MULTILINE_INPUT i, void * h); extern "C" int fl_multiline_input_handle(MULTILINE_INPUT i, int e); + + extern "C" MULTILINE_INPUT new_fl_multiline_input(int x, int y, int w, int h, char* label); extern "C" void free_fl_multiline_input(MULTILINE_INPUT i); diff --git a/src/c_fl_multiline_output.cpp b/src/c_fl_multiline_output.cpp index c7da41e..5f39e23 100644 --- a/src/c_fl_multiline_output.cpp +++ b/src/c_fl_multiline_output.cpp @@ -23,42 +23,34 @@ class My_Multiline_Output : public Fl_Multiline_Output { h_hook_p handle_hook; }; - void My_Multiline_Output::draw() { (*draw_hook)(this->user_data()); } - void My_Multiline_Output::real_draw() { Fl_Multiline_Output::draw(); } - int My_Multiline_Output::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Multiline_Output::real_handle(int e) { return Fl_Multiline_Output::handle(e); } - void multiline_output_set_draw_hook(MULTILINE_OUTPUT i, void * d) { reinterpret_cast<My_Multiline_Output*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_multiline_output_draw(MULTILINE_OUTPUT i) { reinterpret_cast<My_Multiline_Output*>(i)->real_draw(); } - void multiline_output_set_handle_hook(MULTILINE_OUTPUT i, void * h) { reinterpret_cast<My_Multiline_Output*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_multiline_output_handle(MULTILINE_OUTPUT i, int e) { return reinterpret_cast<My_Multiline_Output*>(i)->real_handle(e); } @@ -71,7 +63,6 @@ MULTILINE_OUTPUT new_fl_multiline_output(int x, int y, int w, int h, char* label return i; } - void free_fl_multiline_output(MULTILINE_OUTPUT i) { delete reinterpret_cast<My_Multiline_Output*>(i); } diff --git a/src/c_fl_multiline_output.h b/src/c_fl_multiline_output.h index a81c3e4..fae3da8 100644 --- a/src/c_fl_multiline_output.h +++ b/src/c_fl_multiline_output.h @@ -4,15 +4,21 @@ #define FL_MULTILINE_OUTPUT_GUARD + + typedef void* MULTILINE_OUTPUT; + + extern "C" void multiline_output_set_draw_hook(MULTILINE_OUTPUT i, void * d); extern "C" void fl_multiline_output_draw(MULTILINE_OUTPUT i); extern "C" void multiline_output_set_handle_hook(MULTILINE_OUTPUT i, void * h); extern "C" int fl_multiline_output_handle(MULTILINE_OUTPUT i, int e); + + extern "C" MULTILINE_OUTPUT new_fl_multiline_output(int x, int y, int w, int h, char* label); extern "C" void free_fl_multiline_output(MULTILINE_OUTPUT i); diff --git a/src/c_fl_output.cpp b/src/c_fl_output.cpp index da4ba3f..a367ac5 100644 --- a/src/c_fl_output.cpp +++ b/src/c_fl_output.cpp @@ -23,42 +23,34 @@ class My_Output : public Fl_Output { h_hook_p handle_hook; }; - void My_Output::draw() { (*draw_hook)(this->user_data()); } - void My_Output::real_draw() { Fl_Output::draw(); } - int My_Output::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Output::real_handle(int e) { return Fl_Output::handle(e); } - void output_set_draw_hook(OUTPUTT i, void * d) { reinterpret_cast<My_Output*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_output_draw(OUTPUTT i) { reinterpret_cast<My_Output*>(i)->real_draw(); } - void output_set_handle_hook(OUTPUTT i, void * h) { reinterpret_cast<My_Output*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_output_handle(OUTPUTT i, int e) { return reinterpret_cast<My_Output*>(i)->real_handle(e); } @@ -71,7 +63,6 @@ OUTPUTT new_fl_output(int x, int y, int w, int h, char* label) { return i; } - void free_fl_output(OUTPUTT i) { delete reinterpret_cast<My_Output*>(i); } diff --git a/src/c_fl_output.h b/src/c_fl_output.h index 8684d05..002240c 100644 --- a/src/c_fl_output.h +++ b/src/c_fl_output.h @@ -4,16 +4,22 @@ #define FL_OUTPUT_GUARD + + // using just "OUTPUT" doesn't compile for some reason typedef void* OUTPUTT; + + extern "C" void output_set_draw_hook(OUTPUTT i, void * d); extern "C" void fl_output_draw(OUTPUTT i); extern "C" void output_set_handle_hook(OUTPUTT i, void * h); extern "C" int fl_output_handle(OUTPUTT i, int e); + + extern "C" OUTPUTT new_fl_output(int x, int y, int w, int h, char* label); extern "C" void free_fl_output(OUTPUTT i); diff --git a/src/c_fl_png_image.cpp b/src/c_fl_png_image.cpp index 16d5927..132c567 100644 --- a/src/c_fl_png_image.cpp +++ b/src/c_fl_png_image.cpp @@ -4,12 +4,13 @@ #include "c_fl_png_image.h" + + PNG_IMAGE new_fl_png_image(const char * f) { Fl_PNG_Image *p = new Fl_PNG_Image(f); return p; } - void free_fl_png_image(PNG_IMAGE p) { delete reinterpret_cast<Fl_PNG_Image*>(p); } diff --git a/src/c_fl_png_image.h b/src/c_fl_png_image.h index a67a5aa..b9901ea 100644 --- a/src/c_fl_png_image.h +++ b/src/c_fl_png_image.h @@ -4,9 +4,13 @@ #define FL_PNG_IMAGE_GUARD + + typedef void* PNG_IMAGE; + + extern "C" PNG_IMAGE new_fl_png_image(const char * f); extern "C" void free_fl_png_image(PNG_IMAGE p); diff --git a/src/c_fl_pnm_image.cpp b/src/c_fl_pnm_image.cpp index ce79413..18303e3 100644 --- a/src/c_fl_pnm_image.cpp +++ b/src/c_fl_pnm_image.cpp @@ -4,12 +4,13 @@ #include "c_fl_pnm_image.h" + + PNM_IMAGE new_fl_pnm_image(const char * f) { Fl_PNM_Image *p = new Fl_PNM_Image(f); return p; } - void free_fl_pnm_image(PNM_IMAGE p) { delete reinterpret_cast<Fl_PNM_Image*>(p); } diff --git a/src/c_fl_pnm_image.h b/src/c_fl_pnm_image.h index cf4eb4c..558780c 100644 --- a/src/c_fl_pnm_image.h +++ b/src/c_fl_pnm_image.h @@ -4,9 +4,13 @@ #define FL_PNM_IMAGE_GUARD + + typedef void* PNM_IMAGE; + + extern "C" PNM_IMAGE new_fl_pnm_image(const char * f); extern "C" void free_fl_pnm_image(PNM_IMAGE p); diff --git a/src/c_fl_radio_button.cpp b/src/c_fl_radio_button.cpp index 643e8e1..3ae1ca4 100644 --- a/src/c_fl_radio_button.cpp +++ b/src/c_fl_radio_button.cpp @@ -23,42 +23,34 @@ class My_Radio_Button : public Fl_Radio_Button { h_hook_p handle_hook; }; - void My_Radio_Button::draw() { (*draw_hook)(this->user_data()); } - void My_Radio_Button::real_draw() { Fl_Radio_Button::draw(); } - int My_Radio_Button::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Radio_Button::real_handle(int e) { return Fl_Radio_Button::handle(e); } - void radio_button_set_draw_hook(RADIOBUTTON b, void * d) { reinterpret_cast<My_Radio_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_radio_button_draw(RADIOBUTTON b) { reinterpret_cast<My_Radio_Button*>(b)->real_draw(); } - void radio_button_set_handle_hook(RADIOBUTTON b, void * h) { reinterpret_cast<My_Radio_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_radio_button_handle(RADIOBUTTON b, int e) { return reinterpret_cast<My_Radio_Button*>(b)->real_handle(e); } @@ -71,7 +63,6 @@ RADIOBUTTON new_fl_radio_button(int x, int y, int w, int h, char* label) { return b; } - void free_fl_radio_button(RADIOBUTTON b) { delete reinterpret_cast<My_Radio_Button*>(b); } diff --git a/src/c_fl_radio_button.h b/src/c_fl_radio_button.h index 7c6ed35..0a517e8 100644 --- a/src/c_fl_radio_button.h +++ b/src/c_fl_radio_button.h @@ -4,14 +4,21 @@ #define FL_RADIO_BUTTON_GUARD + + typedef void* RADIOBUTTON; + + extern "C" void radio_button_set_draw_hook(RADIOBUTTON b, void * d); extern "C" void fl_radio_button_draw(RADIOBUTTON b); extern "C" void radio_button_set_handle_hook(RADIOBUTTON b, void * h); extern "C" int fl_radio_button_handle(RADIOBUTTON b, int e); + + + extern "C" RADIOBUTTON new_fl_radio_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_radio_button(RADIOBUTTON b); diff --git a/src/c_fl_radio_light_button.cpp b/src/c_fl_radio_light_button.cpp index ae071a3..e750712 100644 --- a/src/c_fl_radio_light_button.cpp +++ b/src/c_fl_radio_light_button.cpp @@ -23,42 +23,34 @@ class My_Radio_Light_Button : public Fl_Radio_Light_Button { h_hook_p handle_hook; }; - void My_Radio_Light_Button::draw() { (*draw_hook)(this->user_data()); } - void My_Radio_Light_Button::real_draw() { Fl_Radio_Light_Button::draw(); } - int My_Radio_Light_Button::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Radio_Light_Button::real_handle(int e) { return Fl_Radio_Light_Button::handle(e); } - void radio_light_button_set_draw_hook(RADIOLIGHTBUTTON b, void * d) { reinterpret_cast<My_Radio_Light_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_radio_light_button_draw(RADIOLIGHTBUTTON b) { reinterpret_cast<My_Radio_Light_Button*>(b)->real_draw(); } - void radio_light_button_set_handle_hook(RADIOLIGHTBUTTON b, void * h) { reinterpret_cast<My_Radio_Light_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_radio_light_button_handle(RADIOLIGHTBUTTON b, int e) { return reinterpret_cast<My_Radio_Light_Button*>(b)->real_handle(e); } @@ -71,7 +63,6 @@ RADIOLIGHTBUTTON new_fl_radio_light_button(int x, int y, int w, int h, char* lab return b; } - void free_fl_radio_light_button(RADIOLIGHTBUTTON b) { delete reinterpret_cast<My_Radio_Light_Button*>(b); } diff --git a/src/c_fl_radio_light_button.h b/src/c_fl_radio_light_button.h index 6947ce6..57d56b0 100644 --- a/src/c_fl_radio_light_button.h +++ b/src/c_fl_radio_light_button.h @@ -4,14 +4,21 @@ #define FL_RADIO_LIGHT_BUTTON_GUARD + + typedef void* RADIOLIGHTBUTTON; + + extern "C" void radio_light_button_set_draw_hook(RADIOLIGHTBUTTON b, void * d); extern "C" void fl_radio_light_button_draw(RADIOLIGHTBUTTON b); extern "C" void radio_light_button_set_handle_hook(RADIOLIGHTBUTTON b, void * h); extern "C" int fl_radio_light_button_handle(RADIOLIGHTBUTTON b, int e); + + + extern "C" RADIOLIGHTBUTTON new_fl_radio_light_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_radio_light_button(RADIOLIGHTBUTTON b); diff --git a/src/c_fl_radio_round_button.cpp b/src/c_fl_radio_round_button.cpp index 1a69432..d51cacb 100644 --- a/src/c_fl_radio_round_button.cpp +++ b/src/c_fl_radio_round_button.cpp @@ -23,42 +23,34 @@ class My_Radio_Round_Button : public Fl_Radio_Round_Button { h_hook_p handle_hook; }; - void My_Radio_Round_Button::draw() { (*draw_hook)(this->user_data()); } - void My_Radio_Round_Button::real_draw() { Fl_Radio_Round_Button::draw(); } - int My_Radio_Round_Button::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Radio_Round_Button::real_handle(int e) { return Fl_Radio_Round_Button::handle(e); } - void radio_round_button_set_draw_hook(RADIOROUNDBUTTON b, void * d) { reinterpret_cast<My_Radio_Round_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_radio_round_button_draw(RADIOROUNDBUTTON b) { reinterpret_cast<My_Radio_Round_Button*>(b)->real_draw(); } - void radio_round_button_set_handle_hook(RADIOROUNDBUTTON b, void * h) { reinterpret_cast<My_Radio_Round_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_radio_round_button_handle(RADIOROUNDBUTTON b, int e) { return reinterpret_cast<My_Radio_Round_Button*>(b)->real_handle(e); } @@ -71,7 +63,6 @@ RADIOROUNDBUTTON new_fl_radio_round_button(int x, int y, int w, int h, char* lab return b; } - void free_fl_radio_round_button(RADIOROUNDBUTTON b) { delete reinterpret_cast<My_Radio_Round_Button*>(b); } diff --git a/src/c_fl_radio_round_button.h b/src/c_fl_radio_round_button.h index 2b220f5..04c8748 100644 --- a/src/c_fl_radio_round_button.h +++ b/src/c_fl_radio_round_button.h @@ -4,14 +4,21 @@ #define FL_RADIO_ROUND_BUTTON_GUARD + + typedef void* RADIOROUNDBUTTON; + + extern "C" void radio_round_button_set_draw_hook(RADIOROUNDBUTTON b, void * d); extern "C" void fl_radio_round_button_draw(RADIOROUNDBUTTON b); extern "C" void radio_round_button_set_handle_hook(RADIOROUNDBUTTON b, void * h); extern "C" int fl_radio_round_button_handle(RADIOROUNDBUTTON b, int e); + + + extern "C" RADIOROUNDBUTTON new_fl_radio_round_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_radio_round_button(RADIOROUNDBUTTON b); diff --git a/src/c_fl_repeat_button.cpp b/src/c_fl_repeat_button.cpp index 59bdc4a..d8fef46 100644 --- a/src/c_fl_repeat_button.cpp +++ b/src/c_fl_repeat_button.cpp @@ -23,42 +23,34 @@ class My_Repeat_Button : public Fl_Repeat_Button { h_hook_p handle_hook; }; - void My_Repeat_Button::draw() { (*draw_hook)(this->user_data()); } - void My_Repeat_Button::real_draw() { Fl_Repeat_Button::draw(); } - int My_Repeat_Button::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Repeat_Button::real_handle(int e) { return Fl_Repeat_Button::handle(e); } - void repeat_button_set_draw_hook(REPEATBUTTON b, void * d) { reinterpret_cast<My_Repeat_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_repeat_button_draw(REPEATBUTTON b) { reinterpret_cast<My_Repeat_Button*>(b)->real_draw(); } - void repeat_button_set_handle_hook(REPEATBUTTON b, void * h) { reinterpret_cast<My_Repeat_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_repeat_button_handle(REPEATBUTTON b, int e) { return reinterpret_cast<My_Repeat_Button*>(b)->real_handle(e); } @@ -71,7 +63,6 @@ REPEATBUTTON new_fl_repeat_button(int x, int y, int w, int h, char* label) { return b; } - void free_fl_repeat_button(REPEATBUTTON b) { delete reinterpret_cast<My_Repeat_Button*>(b); } diff --git a/src/c_fl_repeat_button.h b/src/c_fl_repeat_button.h index 2aa44c7..fdc3320 100644 --- a/src/c_fl_repeat_button.h +++ b/src/c_fl_repeat_button.h @@ -4,14 +4,21 @@ #define FL_REPEAT_BUTTON_GUARD + + typedef void* REPEATBUTTON; + + extern "C" void repeat_button_set_draw_hook(REPEATBUTTON b, void * d); extern "C" void fl_repeat_button_draw(REPEATBUTTON b); extern "C" void repeat_button_set_handle_hook(REPEATBUTTON b, void * h); extern "C" int fl_repeat_button_handle(REPEATBUTTON b, int e); + + + extern "C" REPEATBUTTON new_fl_repeat_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_repeat_button(REPEATBUTTON b); diff --git a/src/c_fl_return_button.cpp b/src/c_fl_return_button.cpp index 5b03ebf..eced86d 100644 --- a/src/c_fl_return_button.cpp +++ b/src/c_fl_return_button.cpp @@ -23,42 +23,34 @@ class My_Return_Button : public Fl_Return_Button { h_hook_p handle_hook; }; - void My_Return_Button::draw() { (*draw_hook)(this->user_data()); } - void My_Return_Button::real_draw() { Fl_Return_Button::draw(); } - int My_Return_Button::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Return_Button::real_handle(int e) { return Fl_Return_Button::handle(e); } - void return_button_set_draw_hook(RETURNBUTTON b, void * d) { reinterpret_cast<My_Return_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_return_button_draw(RETURNBUTTON b) { reinterpret_cast<My_Return_Button*>(b)->real_draw(); } - void return_button_set_handle_hook(RETURNBUTTON b, void * h) { reinterpret_cast<My_Return_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_return_button_handle(RETURNBUTTON b, int e) { return reinterpret_cast<My_Return_Button*>(b)->real_handle(e); } @@ -71,7 +63,6 @@ RETURNBUTTON new_fl_return_button(int x, int y, int w, int h, char* label) { return b; } - void free_fl_return_button(RETURNBUTTON b) { delete reinterpret_cast<My_Return_Button*>(b); } diff --git a/src/c_fl_return_button.h b/src/c_fl_return_button.h index a688eb0..59928a7 100644 --- a/src/c_fl_return_button.h +++ b/src/c_fl_return_button.h @@ -4,14 +4,21 @@ #define FL_RETURN_BUTTON_GUARD + + typedef void* RETURNBUTTON; + + extern "C" void return_button_set_draw_hook(RETURNBUTTON b, void * d); extern "C" void fl_return_button_draw(RETURNBUTTON b); extern "C" void return_button_set_handle_hook(RETURNBUTTON b, void * h); extern "C" int fl_return_button_handle(RETURNBUTTON b, int e); + + + extern "C" RETURNBUTTON new_fl_return_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_return_button(RETURNBUTTON b); diff --git a/src/c_fl_rgb_image.cpp b/src/c_fl_rgb_image.cpp index 83a89ac..96b5266 100644 --- a/src/c_fl_rgb_image.cpp +++ b/src/c_fl_rgb_image.cpp @@ -4,16 +4,16 @@ #include "c_fl_rgb_image.h" + + void free_fl_rgb_image(RGB_IMAGE i) { delete reinterpret_cast<Fl_RGB_Image*>(i); } - RGB_IMAGE fl_rgb_image_copy(RGB_IMAGE i, int w, int h) { return reinterpret_cast<Fl_RGB_Image*>(i)->copy(w, h); } - RGB_IMAGE fl_rgb_image_copy2(RGB_IMAGE i) { return reinterpret_cast<Fl_RGB_Image*>(i)->copy(); } @@ -25,7 +25,6 @@ void fl_rgb_image_color_average(RGB_IMAGE i, int c, float b) { reinterpret_cast<Fl_RGB_Image*>(i)->color_average(c, b); } - void fl_rgb_image_desaturate(RGB_IMAGE i) { reinterpret_cast<Fl_RGB_Image*>(i)->desaturate(); } diff --git a/src/c_fl_rgb_image.h b/src/c_fl_rgb_image.h index 3209909..2879be1 100644 --- a/src/c_fl_rgb_image.h +++ b/src/c_fl_rgb_image.h @@ -4,14 +4,20 @@ #define FL_RGB_IMAGE_GUARD + + typedef void* RGB_IMAGE; + + extern "C" void free_fl_rgb_image(RGB_IMAGE i); extern "C" RGB_IMAGE fl_rgb_image_copy(RGB_IMAGE i, int w, int h); extern "C" RGB_IMAGE fl_rgb_image_copy2(RGB_IMAGE i); + + extern "C" void fl_rgb_image_color_average(RGB_IMAGE i, int c, float b); extern "C" void fl_rgb_image_desaturate(RGB_IMAGE i); diff --git a/src/c_fl_round_button.cpp b/src/c_fl_round_button.cpp index cbe5f19..9c82173 100644 --- a/src/c_fl_round_button.cpp +++ b/src/c_fl_round_button.cpp @@ -23,42 +23,34 @@ class My_Round_Button : public Fl_Round_Button { h_hook_p handle_hook; }; - void My_Round_Button::draw() { (*draw_hook)(this->user_data()); } - void My_Round_Button::real_draw() { Fl_Round_Button::draw(); } - int My_Round_Button::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Round_Button::real_handle(int e) { return Fl_Round_Button::handle(e); } - void round_button_set_draw_hook(ROUNDBUTTON b, void * d) { reinterpret_cast<My_Round_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_round_button_draw(ROUNDBUTTON b) { reinterpret_cast<My_Round_Button*>(b)->real_draw(); } - void round_button_set_handle_hook(ROUNDBUTTON b, void * h) { reinterpret_cast<My_Round_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_round_button_handle(ROUNDBUTTON b, int e) { return reinterpret_cast<My_Round_Button*>(b)->real_handle(e); } @@ -71,7 +63,6 @@ ROUNDBUTTON new_fl_round_button(int x, int y, int w, int h, char* label) { return b; } - void free_fl_round_button(ROUNDBUTTON b) { delete reinterpret_cast<My_Round_Button*>(b); } diff --git a/src/c_fl_round_button.h b/src/c_fl_round_button.h index 55fc691..f812746 100644 --- a/src/c_fl_round_button.h +++ b/src/c_fl_round_button.h @@ -4,14 +4,21 @@ #define FL_ROUND_BUTTON_GUARD + + typedef void* ROUNDBUTTON; + + extern "C" void round_button_set_draw_hook(ROUNDBUTTON b, void * d); extern "C" void fl_round_button_draw(ROUNDBUTTON b); extern "C" void round_button_set_handle_hook(ROUNDBUTTON b, void * h); extern "C" int fl_round_button_handle(ROUNDBUTTON b, int e); + + + extern "C" ROUNDBUTTON new_fl_round_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_round_button(ROUNDBUTTON b); diff --git a/src/c_fl_scroll.cpp b/src/c_fl_scroll.cpp index 999c3a4..659b042 100644 --- a/src/c_fl_scroll.cpp +++ b/src/c_fl_scroll.cpp @@ -23,42 +23,34 @@ class My_Scroll : public Fl_Scroll { h_hook_p handle_hook; }; - void My_Scroll::draw() { (*draw_hook)(this->user_data()); } - void My_Scroll::real_draw() { Fl_Scroll::draw(); } - int My_Scroll::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Scroll::real_handle(int e) { return Fl_Scroll::handle(e); } - void scroll_set_draw_hook(SCROLL s, void * d) { reinterpret_cast<My_Scroll*>(s)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_scroll_draw(SCROLL s) { reinterpret_cast<My_Scroll*>(s)->real_draw(); } - void scroll_set_handle_hook(SCROLL s, void * h) { reinterpret_cast<My_Scroll*>(s)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_scroll_handle(SCROLL s, int e) { return reinterpret_cast<My_Scroll*>(s)->real_handle(e); } @@ -71,7 +63,6 @@ SCROLL new_fl_scroll(int x, int y, int w, int h, char* label) { return s; } - void free_fl_scroll(SCROLL s) { delete reinterpret_cast<My_Scroll*>(s); } @@ -83,28 +74,26 @@ void fl_scroll_to(SCROLL s, int x, int y) { reinterpret_cast<Fl_Scroll*>(s)->scroll_to(x, y); } +void fl_scroll_set_type(SCROLL s, int t) { + reinterpret_cast<Fl_Scroll*>(s)->type(t); +} + + + int fl_scroll_get_size(SCROLL s) { return reinterpret_cast<Fl_Scroll*>(s)->scrollbar_size(); } - void fl_scroll_set_size(SCROLL s, int t) { reinterpret_cast<Fl_Scroll*>(s)->scrollbar_size(t); } - int fl_scroll_xposition(SCROLL s) { return reinterpret_cast<Fl_Scroll*>(s)->xposition(); } - int fl_scroll_yposition(SCROLL s) { return reinterpret_cast<Fl_Scroll*>(s)->yposition(); } - -void fl_scroll_set_type(SCROLL s, int t) { - reinterpret_cast<Fl_Scroll*>(s)->type(t); -} - diff --git a/src/c_fl_scroll.h b/src/c_fl_scroll.h index 3379063..35528f6 100644 --- a/src/c_fl_scroll.h +++ b/src/c_fl_scroll.h @@ -4,25 +4,35 @@ #define FL_SCROLL_GUARD + + typedef void* SCROLL; + + extern "C" void scroll_set_draw_hook(SCROLL s, void * d); extern "C" void fl_scroll_draw(SCROLL s); extern "C" void scroll_set_handle_hook(SCROLL s, void * h); extern "C" int fl_scroll_handle(SCROLL s, int e); + + extern "C" SCROLL new_fl_scroll(int x, int y, int w, int h, char* label); extern "C" void free_fl_scroll(SCROLL s); + + extern "C" void fl_scroll_to(SCROLL s, int x, int y); +extern "C" void fl_scroll_set_type(SCROLL s, int t); + + extern "C" int fl_scroll_get_size(SCROLL s); extern "C" void fl_scroll_set_size(SCROLL s, int t); extern "C" int fl_scroll_xposition(SCROLL s); extern "C" int fl_scroll_yposition(SCROLL s); -extern "C" void fl_scroll_set_type(SCROLL s, int t); #endif diff --git a/src/c_fl_secret_input.cpp b/src/c_fl_secret_input.cpp index c86e7b2..1c91370 100644 --- a/src/c_fl_secret_input.cpp +++ b/src/c_fl_secret_input.cpp @@ -23,42 +23,34 @@ class My_Secret_Input : public Fl_Secret_Input { h_hook_p handle_hook; }; - void My_Secret_Input::draw() { (*draw_hook)(this->user_data()); } - void My_Secret_Input::real_draw() { Fl_Secret_Input::draw(); } - int My_Secret_Input::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Secret_Input::real_handle(int e) { return Fl_Secret_Input::handle(e); } - void secret_input_set_draw_hook(SECRET_INPUT i, void * d) { reinterpret_cast<My_Secret_Input*>(i)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_secret_input_draw(SECRET_INPUT i) { reinterpret_cast<My_Secret_Input*>(i)->real_draw(); } - void secret_input_set_handle_hook(SECRET_INPUT i, void * h) { reinterpret_cast<My_Secret_Input*>(i)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_secret_input_handle(SECRET_INPUT i, int e) { return reinterpret_cast<My_Secret_Input*>(i)->real_handle(e); } @@ -71,7 +63,6 @@ SECRET_INPUT new_fl_secret_input(int x, int y, int w, int h, char* label) { return i; } - void free_fl_secret_input(SECRET_INPUT i) { delete reinterpret_cast<My_Secret_Input*>(i); } diff --git a/src/c_fl_secret_input.h b/src/c_fl_secret_input.h index 05a97fc..604626d 100644 --- a/src/c_fl_secret_input.h +++ b/src/c_fl_secret_input.h @@ -4,15 +4,21 @@ #define FL_SECRET_INPUT_GUARD + + typedef void* SECRET_INPUT; + + extern "C" void secret_input_set_draw_hook(SECRET_INPUT i, void * d); extern "C" void fl_secret_input_draw(SECRET_INPUT i); extern "C" void secret_input_set_handle_hook(SECRET_INPUT i, void * h); extern "C" int fl_secret_input_handle(SECRET_INPUT i, int e); + + extern "C" SECRET_INPUT new_fl_secret_input(int x, int y, int w, int h, char* label); extern "C" void free_fl_secret_input(SECRET_INPUT i); diff --git a/src/c_fl_single_window.cpp b/src/c_fl_single_window.cpp index 2b66b3d..f51fb92 100644 --- a/src/c_fl_single_window.cpp +++ b/src/c_fl_single_window.cpp @@ -23,42 +23,34 @@ class My_Single_Window : public Fl_Single_Window { h_hook_p handle_hook; }; - void My_Single_Window::draw() { (*draw_hook)(this->user_data()); } - void My_Single_Window::real_draw() { Fl_Single_Window::draw(); } - int My_Single_Window::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Single_Window::real_handle(int e) { return Fl_Single_Window::handle(e); } - void single_window_set_draw_hook(SINGLEWINDOW n, void * d) { reinterpret_cast<My_Single_Window*>(n)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_single_window_draw(SINGLEWINDOW n) { reinterpret_cast<My_Single_Window*>(n)->real_draw(); } - void single_window_set_handle_hook(SINGLEWINDOW n, void * h) { reinterpret_cast<My_Single_Window*>(n)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_single_window_handle(SINGLEWINDOW n, int e) { return reinterpret_cast<My_Single_Window*>(n)->real_handle(e); } @@ -71,13 +63,11 @@ SINGLEWINDOW new_fl_single_window(int x, int y, int w, int h, char* label) { return sw; } - SINGLEWINDOW new_fl_single_window2(int x, int y) { My_Single_Window *sw = new My_Single_Window(x, y); return sw; } - void free_fl_single_window(SINGLEWINDOW w) { delete reinterpret_cast<My_Single_Window*>(w); } @@ -89,7 +79,6 @@ void fl_single_window_show(SINGLEWINDOW w) { reinterpret_cast<Fl_Single_Window*>(w)->show(); } - void fl_single_window_flush(SINGLEWINDOW w) { reinterpret_cast<Fl_Single_Window*>(w)->flush(); } diff --git a/src/c_fl_single_window.h b/src/c_fl_single_window.h index 72db038..02a6619 100644 --- a/src/c_fl_single_window.h +++ b/src/c_fl_single_window.h @@ -4,20 +4,28 @@ #define FL_SINGLE_WINDOW_GUARD + + typedef void* SINGLEWINDOW; + + extern "C" void single_window_set_draw_hook(SINGLEWINDOW n, void * d); extern "C" void fl_single_window_draw(SINGLEWINDOW n); extern "C" void single_window_set_handle_hook(SINGLEWINDOW n, void * h); extern "C" int fl_single_window_handle(SINGLEWINDOW n, int e); + + extern "C" SINGLEWINDOW new_fl_single_window(int x, int y, int w, int h, char* label); extern "C" SINGLEWINDOW new_fl_single_window2(int x, int y); extern "C" void free_fl_single_window(SINGLEWINDOW w); + + extern "C" void fl_single_window_show(SINGLEWINDOW w); extern "C" void fl_single_window_flush(SINGLEWINDOW w); diff --git a/src/c_fl_text_buffer.cpp b/src/c_fl_text_buffer.cpp index 71f04d2..46d7700 100644 --- a/src/c_fl_text_buffer.cpp +++ b/src/c_fl_text_buffer.cpp @@ -4,108 +4,106 @@ #include "c_fl_text_buffer.h" + + TEXTBUFFER new_fl_text_buffer(int rs, int pgs) { Fl_Text_Buffer *tb = new Fl_Text_Buffer(rs, pgs); return tb; } - void free_fl_text_buffer(TEXTBUFFER tb) { delete reinterpret_cast<Fl_Text_Buffer*>(tb); } + + void fl_text_buffer_add_modify_callback(TEXTBUFFER tb, void * cb, void * ud) { reinterpret_cast<Fl_Text_Buffer*>(tb)->add_modify_callback(reinterpret_cast<Fl_Text_Modify_Cb>(cb), ud); } - void fl_text_buffer_add_predelete_callback(TEXTBUFFER tb, void * cb, void * ud) { reinterpret_cast<Fl_Text_Buffer*>(tb)->add_predelete_callback(reinterpret_cast<Fl_Text_Predelete_Cb>(cb), ud); } - void fl_text_buffer_call_modify_callbacks(TEXTBUFFER tb) { reinterpret_cast<Fl_Text_Buffer*>(tb)->call_modify_callbacks(); } - void fl_text_buffer_call_predelete_callbacks(TEXTBUFFER tb) { reinterpret_cast<Fl_Text_Buffer*>(tb)->call_predelete_callbacks(); } -void fl_text_buffer_insert(TEXTBUFFER tb, int p, const char * item) { - reinterpret_cast<Fl_Text_Buffer*>(tb)->insert(p, item); -} -void fl_text_buffer_remove(TEXTBUFFER tb, int s, int f) { - reinterpret_cast<Fl_Text_Buffer*>(tb)->remove(s, f); +int fl_text_buffer_loadfile(TEXTBUFFER tb, char * n) { + return reinterpret_cast<Fl_Text_Buffer*>(tb)->loadfile(n); } - -int fl_text_buffer_length(TEXTBUFFER tb) { - return reinterpret_cast<Fl_Text_Buffer*>(tb)->length(); +int fl_text_buffer_savefile(TEXTBUFFER tb, char * n) { + return reinterpret_cast<Fl_Text_Buffer*>(tb)->savefile(n); } -int fl_text_buffer_loadfile(TEXTBUFFER tb, char * n) { - return reinterpret_cast<Fl_Text_Buffer*>(tb)->loadfile(n); -} -void fl_text_buffer_remove_selection(TEXTBUFFER tb) { - reinterpret_cast<Fl_Text_Buffer*>(tb)->remove_selection(); +void fl_text_buffer_insert(TEXTBUFFER tb, int p, const char * item) { + reinterpret_cast<Fl_Text_Buffer*>(tb)->insert(p, item); } - -int fl_text_buffer_savefile(TEXTBUFFER tb, char * n) { - return reinterpret_cast<Fl_Text_Buffer*>(tb)->savefile(n); +void fl_text_buffer_remove(TEXTBUFFER tb, int s, int f) { + reinterpret_cast<Fl_Text_Buffer*>(tb)->remove(s, f); } - -int fl_text_buffer_search_forward(TEXTBUFFER tb, int start, const char * item, int * found, int mcase) { - return reinterpret_cast<Fl_Text_Buffer*>(tb)->search_forward(start, item, found, mcase); +unsigned int fl_text_buffer_char_at(TEXTBUFFER tb, int p) { + return reinterpret_cast<Fl_Text_Buffer*>(tb)->char_at(p); } +char * fl_text_buffer_text_range(TEXTBUFFER tb, int s, int f) { + return reinterpret_cast<Fl_Text_Buffer*>(tb)->text_range(s, f); +} -int fl_text_buffer_search_backward(TEXTBUFFER tb, int start, const char * item, int * found, int mcase) { - return reinterpret_cast<Fl_Text_Buffer*>(tb)->search_backward(start, item, found, mcase); +int fl_text_buffer_length(TEXTBUFFER tb) { + return reinterpret_cast<Fl_Text_Buffer*>(tb)->length(); } -void fl_text_buffer_select(TEXTBUFFER tb, int s, int e) { - reinterpret_cast<Fl_Text_Buffer*>(tb)->select(s, e); -} int fl_text_buffer_selection_position(TEXTBUFFER tb, int * s, int * e) { return reinterpret_cast<Fl_Text_Buffer*>(tb)->selection_position(s, e); } +void fl_text_buffer_select(TEXTBUFFER tb, int s, int e) { + reinterpret_cast<Fl_Text_Buffer*>(tb)->select(s, e); +} int fl_text_buffer_selected(TEXTBUFFER tb) { return reinterpret_cast<Fl_Text_Buffer*>(tb)->selected(); } - -int fl_text_buffer_skip_lines(TEXTBUFFER tb, int s, int l) { - return reinterpret_cast<Fl_Text_Buffer*>(tb)->skip_lines(s, l); +void fl_text_buffer_remove_selection(TEXTBUFFER tb) { + reinterpret_cast<Fl_Text_Buffer*>(tb)->remove_selection(); } -int fl_text_buffer_rewind_lines(TEXTBUFFER tb, int s, int l) { - return reinterpret_cast<Fl_Text_Buffer*>(tb)->rewind_lines(s, l); -} -unsigned int fl_text_buffer_char_at(TEXTBUFFER tb, int p) { - return reinterpret_cast<Fl_Text_Buffer*>(tb)->char_at(p); + +int fl_text_buffer_search_forward(TEXTBUFFER tb, int start, const char * item, int * found, int mcase) { + return reinterpret_cast<Fl_Text_Buffer*>(tb)->search_forward(start, item, found, mcase); +} + +int fl_text_buffer_search_backward(TEXTBUFFER tb, int start, const char * item, int * found, int mcase) { + return reinterpret_cast<Fl_Text_Buffer*>(tb)->search_backward(start, item, found, mcase); } +int fl_text_buffer_skip_lines(TEXTBUFFER tb, int s, int l) { + return reinterpret_cast<Fl_Text_Buffer*>(tb)->skip_lines(s, l); +} -char * fl_text_buffer_text_range(TEXTBUFFER tb, int s, int f) { - return reinterpret_cast<Fl_Text_Buffer*>(tb)->text_range(s, f); +int fl_text_buffer_rewind_lines(TEXTBUFFER tb, int s, int l) { + return reinterpret_cast<Fl_Text_Buffer*>(tb)->rewind_lines(s, l); } diff --git a/src/c_fl_text_buffer.h b/src/c_fl_text_buffer.h index 1551d2b..757a132 100644 --- a/src/c_fl_text_buffer.h +++ b/src/c_fl_text_buffer.h @@ -4,32 +4,46 @@ #define FL_TEXT_BUFFER_GUARD + + typedef void* TEXTBUFFER; + + extern "C" TEXTBUFFER new_fl_text_buffer(int rs, int pgs); extern "C" void free_fl_text_buffer(TEXTBUFFER tb); + + extern "C" void fl_text_buffer_add_modify_callback(TEXTBUFFER tb, void * cb, void * ud); extern "C" void fl_text_buffer_add_predelete_callback(TEXTBUFFER tb, void * cb, void * ud); extern "C" void fl_text_buffer_call_modify_callbacks(TEXTBUFFER tb); extern "C" void fl_text_buffer_call_predelete_callbacks(TEXTBUFFER tb); + + +extern "C" int fl_text_buffer_loadfile(TEXTBUFFER tb, char * n); +extern "C" int fl_text_buffer_savefile(TEXTBUFFER tb, char * n); + + extern "C" void fl_text_buffer_insert(TEXTBUFFER tb, int p, const char * item); extern "C" void fl_text_buffer_remove(TEXTBUFFER tb, int s, int f); +extern "C" unsigned int fl_text_buffer_char_at(TEXTBUFFER tb, int p); +extern "C" char * fl_text_buffer_text_range(TEXTBUFFER tb, int s, int f); extern "C" int fl_text_buffer_length(TEXTBUFFER tb); -extern "C" int fl_text_buffer_loadfile(TEXTBUFFER tb, char * n); + + +extern "C" int fl_text_buffer_selection_position(TEXTBUFFER tb, int * s, int * e); +extern "C" void fl_text_buffer_select(TEXTBUFFER tb, int s, int e); +extern "C" int fl_text_buffer_selected(TEXTBUFFER tb); extern "C" void fl_text_buffer_remove_selection(TEXTBUFFER tb); -extern "C" int fl_text_buffer_savefile(TEXTBUFFER tb, char * n); + + extern "C" int fl_text_buffer_search_forward(TEXTBUFFER tb, int start, const char * item, int * found, int mcase); extern "C" int fl_text_buffer_search_backward(TEXTBUFFER tb, int start, const char * item, int * found, int mcase); -extern "C" void fl_text_buffer_select(TEXTBUFFER tb, int s, int e); -extern "C" int fl_text_buffer_selection_position(TEXTBUFFER tb, int * s, int * e); -extern "C" int fl_text_buffer_selected(TEXTBUFFER tb); extern "C" int fl_text_buffer_skip_lines(TEXTBUFFER tb, int s, int l); extern "C" int fl_text_buffer_rewind_lines(TEXTBUFFER tb, int s, int l); -extern "C" unsigned int fl_text_buffer_char_at(TEXTBUFFER tb, int p); -extern "C" char * fl_text_buffer_text_range(TEXTBUFFER tb, int s, int f); #endif diff --git a/src/c_fl_text_editor.h b/src/c_fl_text_editor.h index 03a57c3..5f73cbc 100644 --- a/src/c_fl_text_editor.h +++ b/src/c_fl_text_editor.h @@ -4,6 +4,8 @@ #define FL_TEXT_EDITOR_GUARD + + typedef void* TEXTEDITOR; diff --git a/src/c_fl_toggle_button.cpp b/src/c_fl_toggle_button.cpp index 2ecfb70..6a631c3 100644 --- a/src/c_fl_toggle_button.cpp +++ b/src/c_fl_toggle_button.cpp @@ -23,42 +23,34 @@ class My_Toggle_Button : public Fl_Toggle_Button { h_hook_p handle_hook; }; - void My_Toggle_Button::draw() { (*draw_hook)(this->user_data()); } - void My_Toggle_Button::real_draw() { Fl_Toggle_Button::draw(); } - int My_Toggle_Button::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Toggle_Button::real_handle(int e) { return Fl_Toggle_Button::handle(e); } - void toggle_button_set_draw_hook(TOGGLEBUTTON b, void * d) { reinterpret_cast<My_Toggle_Button*>(b)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_toggle_button_draw(TOGGLEBUTTON b) { reinterpret_cast<My_Toggle_Button*>(b)->real_draw(); } - void toggle_button_set_handle_hook(TOGGLEBUTTON b, void * h) { reinterpret_cast<My_Toggle_Button*>(b)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_toggle_button_handle(TOGGLEBUTTON b, int e) { return reinterpret_cast<My_Toggle_Button*>(b)->real_handle(e); } @@ -71,7 +63,6 @@ TOGGLEBUTTON new_fl_toggle_button(int x, int y, int w, int h, char* label) { return b; } - void free_fl_toggle_button(TOGGLEBUTTON b) { delete reinterpret_cast<My_Toggle_Button*>(b); } diff --git a/src/c_fl_toggle_button.h b/src/c_fl_toggle_button.h index 28ad4ec..88dcbae 100644 --- a/src/c_fl_toggle_button.h +++ b/src/c_fl_toggle_button.h @@ -4,14 +4,21 @@ #define FL_TOGGLE_BUTTON_GUARD + + typedef void* TOGGLEBUTTON; + + extern "C" void toggle_button_set_draw_hook(TOGGLEBUTTON b, void * d); extern "C" void fl_toggle_button_draw(TOGGLEBUTTON b); extern "C" void toggle_button_set_handle_hook(TOGGLEBUTTON b, void * h); extern "C" int fl_toggle_button_handle(TOGGLEBUTTON b, int e); + + + extern "C" TOGGLEBUTTON new_fl_toggle_button(int x, int y, int w, int h, char* label); extern "C" void free_fl_toggle_button(TOGGLEBUTTON b); diff --git a/src/c_fl_widget.cpp b/src/c_fl_widget.cpp index 1f383de..832d7fe 100644 --- a/src/c_fl_widget.cpp +++ b/src/c_fl_widget.cpp @@ -21,22 +21,18 @@ class My_Widget : public Fl_Widget { h_hook_p handle_hook; }; - void My_Widget::draw() { (*draw_hook)(this->user_data()); } - int My_Widget::handle(int e) { return (*handle_hook)(this->user_data(), e); } - void widget_set_draw_hook(WIDGET w, void * d) { reinterpret_cast<My_Widget*>(w)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void widget_set_handle_hook(WIDGET w, void * h) { reinterpret_cast<My_Widget*>(w)->handle_hook = reinterpret_cast<h_hook_p>(h); } @@ -49,7 +45,6 @@ WIDGET new_fl_widget(int x, int y, int w, int h, char* label) { return wd; } - void free_fl_widget(WIDGET w) { delete reinterpret_cast<My_Widget*>(w); } @@ -61,7 +56,6 @@ void * fl_widget_get_user_data(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->user_data(); } - void fl_widget_set_user_data(WIDGET w, void * d) { reinterpret_cast<Fl_Widget*>(w)->user_data(d); } @@ -73,32 +67,29 @@ void fl_widget_activate(WIDGET w) { reinterpret_cast<Fl_Widget*>(w)->activate(); } - void fl_widget_deactivate(WIDGET w) { reinterpret_cast<Fl_Widget*>(w)->deactivate(); } - int fl_widget_active(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->active(); } - int fl_widget_active_r(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->active_r(); } - void fl_widget_clear_active(WIDGET w) { reinterpret_cast<Fl_Widget*>(w)->clear_active(); } + + unsigned int fl_widget_changed(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->changed(); } - void fl_widget_clear_changed(WIDGET w) { reinterpret_cast<Fl_Widget*>(w)->clear_changed(); } @@ -110,7 +101,6 @@ void * fl_widget_get_parent(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->parent(); } - int fl_widget_contains(WIDGET w, WIDGET i) { return reinterpret_cast<Fl_Widget*>(w)->contains(reinterpret_cast<Fl_Widget*>(i)); } @@ -122,64 +112,50 @@ unsigned int fl_widget_get_align(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->align(); } - void fl_widget_set_align(WIDGET w, unsigned int a) { reinterpret_cast<Fl_Widget*>(w)->align(a); } - int fl_widget_get_box(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->box(); } - void fl_widget_set_box(WIDGET w, int b) { reinterpret_cast<Fl_Widget*>(w)->box(static_cast<Fl_Boxtype>(b)); } - const char* fl_widget_get_label(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->label(); } - void fl_widget_set_label(WIDGET w, const char* t) { reinterpret_cast<Fl_Widget*>(w)->copy_label(t); } - int fl_widget_get_label_font(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->labelfont(); } - void fl_widget_set_label_font(WIDGET w, int f) { reinterpret_cast<Fl_Widget*>(w)->labelfont(static_cast<Fl_Font>(f)); } - int fl_widget_get_label_size(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->labelsize(); } - void fl_widget_set_label_size(WIDGET w, int s) { reinterpret_cast<Fl_Widget*>(w)->labelsize(static_cast<Fl_Fontsize>(s)); } - int fl_widget_get_label_type(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->labeltype(); } - void fl_widget_set_label_type(WIDGET w, int l) { reinterpret_cast<Fl_Widget*>(w)->labeltype(static_cast<Fl_Labeltype>(l)); } - - - void fl_widget_set_callback(WIDGET w, void * cb) { reinterpret_cast<Fl_Widget*>(w)->callback(reinterpret_cast<Fl_Callback_p>(cb)); } @@ -191,27 +167,22 @@ int fl_widget_get_x(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->x(); } - int fl_widget_get_y(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->y(); } - int fl_widget_get_w(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->w(); } - int fl_widget_get_h(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->h(); } - void fl_widget_size(WIDGET w, int d, int h) { reinterpret_cast<Fl_Widget*>(w)->size(d, h); } - void fl_widget_position(WIDGET w, int x, int y) { reinterpret_cast<Fl_Widget*>(w)->position(x, y); } diff --git a/src/c_fl_widget.h b/src/c_fl_widget.h index 8d17485..26f0ebe 100644 --- a/src/c_fl_widget.h +++ b/src/c_fl_widget.h @@ -4,17 +4,25 @@ #define FL_WIDGET_GUARD + + typedef void* WIDGET; + + extern "C" void widget_set_draw_hook(WIDGET w, void * d); extern "C" void widget_set_handle_hook(WIDGET w, void * h); + + extern "C" WIDGET new_fl_widget(int x, int y, int w, int h, char* label); extern "C" void free_fl_widget(WIDGET w); + + extern "C" void * fl_widget_get_user_data(WIDGET w); extern "C" void fl_widget_set_user_data(WIDGET w, void * d); @@ -24,6 +32,8 @@ extern "C" void fl_widget_deactivate(WIDGET w); extern "C" int fl_widget_active(WIDGET w); extern "C" int fl_widget_active_r(WIDGET w); extern "C" void fl_widget_clear_active(WIDGET w); + + extern "C" unsigned int fl_widget_changed(WIDGET w); extern "C" void fl_widget_clear_changed(WIDGET w); @@ -44,8 +54,6 @@ extern "C" int fl_widget_get_label_size(WIDGET w); extern "C" void fl_widget_set_label_size(WIDGET w, int s); extern "C" int fl_widget_get_label_type(WIDGET w); extern "C" void fl_widget_set_label_type(WIDGET w, int l); - - extern "C" void fl_widget_set_callback(WIDGET w, void * cb); diff --git a/src/c_fl_window.cpp b/src/c_fl_window.cpp index 00f4fff..83f19f1 100644 --- a/src/c_fl_window.cpp +++ b/src/c_fl_window.cpp @@ -24,42 +24,34 @@ class My_Window : public Fl_Window { h_hook_p handle_hook; }; - void My_Window::draw() { (*draw_hook)(this->user_data()); } - void My_Window::real_draw() { Fl_Window::draw(); } - int My_Window::handle(int e) { return (*handle_hook)(this->user_data(), e); } - int My_Window::real_handle(int e) { return Fl_Window::handle(e); } - void window_set_draw_hook(WINDOW n, void * d) { reinterpret_cast<My_Window*>(n)->draw_hook = reinterpret_cast<d_hook_p>(d); } - void fl_window_draw(WINDOW n) { reinterpret_cast<My_Window*>(n)->real_draw(); } - void window_set_handle_hook(WINDOW n, void * h) { reinterpret_cast<My_Window*>(n)->handle_hook = reinterpret_cast<h_hook_p>(h); } - int fl_window_handle(WINDOW n, int e) { return reinterpret_cast<My_Window*>(n)->real_handle(e); } @@ -72,13 +64,11 @@ WINDOW new_fl_window(int x, int y, int w, int h, char* label) { return n; } - WINDOW new_fl_window2(int w, int h) { My_Window *n = new My_Window(w, h); return n; } - void free_fl_window(WINDOW n) { delete reinterpret_cast<My_Window*>(n); } @@ -90,57 +80,49 @@ void fl_window_show(WINDOW n) { reinterpret_cast<Fl_Window*>(n)->show(); } - void fl_window_hide(WINDOW n) { reinterpret_cast<Fl_Window*>(n)->hide(); } - void fl_window_make_current(WINDOW n) { reinterpret_cast<Fl_Window*>(n)->make_current(); } + + unsigned int fl_window_get_border(WINDOW n) { return reinterpret_cast<Fl_Window*>(n)->border(); } - void fl_window_set_border(WINDOW n, int b) { reinterpret_cast<Fl_Window*>(n)->border(b); } - void fl_window_set_label(WINDOW n, char* text) { reinterpret_cast<Fl_Window*>(n)->copy_label(text); } - void fl_window_size_range(WINDOW n, int lw, int lh, int hw, int hh, int dw, int dh, int a) { reinterpret_cast<Fl_Window*>(n)->size_range(lw, lh, hw, hh, dw, dh, a); } - void fl_window_set_icon(WINDOW n, void * img) { reinterpret_cast<Fl_Window*>(n)->icon(reinterpret_cast<Fl_RGB_Image*>(img)); } - void fl_window_set_modal(WINDOW n) { reinterpret_cast<Fl_Window*>(n)->set_modal(); } - void fl_window_set_non_modal(WINDOW n) { reinterpret_cast<Fl_Window*>(n)->set_non_modal(); } - void fl_window_set_cursor(WINDOW n, int c) { reinterpret_cast<Fl_Window*>(n)->cursor(static_cast<Fl_Cursor>(c)); } - void fl_window_set_default_cursor(WINDOW n, int c) { reinterpret_cast<Fl_Window*>(n)->default_cursor(static_cast<Fl_Cursor>(c)); } @@ -152,17 +134,14 @@ int fl_window_get_x_root(WINDOW n) { return reinterpret_cast<Fl_Window*>(n)->x_root(); } - int fl_window_get_y_root(WINDOW n) { return reinterpret_cast<Fl_Window*>(n)->y_root(); } - int fl_window_get_decorated_w(WINDOW n) { return reinterpret_cast<Fl_Window*>(n)->decorated_w(); } - int fl_window_get_decorated_h(WINDOW n) { return reinterpret_cast<Fl_Window*>(n)->decorated_h(); } diff --git a/src/c_fl_window.h b/src/c_fl_window.h index 97f3712..bbf4448 100644 --- a/src/c_fl_window.h +++ b/src/c_fl_window.h @@ -4,23 +4,33 @@ #define FL_WINDOW_GUARD + + typedef void* WINDOW; + + extern "C" void window_set_draw_hook(WINDOW n, void * d); extern "C" void fl_window_draw(WINDOW n); extern "C" void window_set_handle_hook(WINDOW n, void * h); extern "C" int fl_window_handle(WINDOW n, int e); + + extern "C" WINDOW new_fl_window(int x, int y, int w, int h, char* label); extern "C" WINDOW new_fl_window2(int w, int h); extern "C" void free_fl_window(WINDOW n); + + extern "C" void fl_window_show(WINDOW n); extern "C" void fl_window_hide(WINDOW n); extern "C" void fl_window_make_current(WINDOW n); + + extern "C" unsigned int fl_window_get_border(WINDOW n); extern "C" void fl_window_set_border(WINDOW n, int b); extern "C" void fl_window_set_label(WINDOW n, char* text); diff --git a/src/c_fl_xbm_image.cpp b/src/c_fl_xbm_image.cpp index 4f3ee47..e44cbb2 100644 --- a/src/c_fl_xbm_image.cpp +++ b/src/c_fl_xbm_image.cpp @@ -4,12 +4,13 @@ #include "c_fl_xbm_image.h" + + XBM_IMAGE new_fl_xbm_image(const char * f) { Fl_XBM_Image *b = new Fl_XBM_Image(f); return b; } - void free_fl_xbm_image(XBM_IMAGE b) { delete reinterpret_cast<Fl_XBM_Image*>(b); } diff --git a/src/c_fl_xbm_image.h b/src/c_fl_xbm_image.h index 72f27fa..9b0c967 100644 --- a/src/c_fl_xbm_image.h +++ b/src/c_fl_xbm_image.h @@ -4,9 +4,13 @@ #define FL_XBM_IMAGE_GUARD + + typedef void* XBM_IMAGE; + + extern "C" XBM_IMAGE new_fl_xbm_image(const char * f); extern "C" void free_fl_xbm_image(XBM_IMAGE b); diff --git a/src/fltk-dialogs.adb b/src/fltk-dialogs.adb index 0c9adcf..0f724c0 100644 --- a/src/fltk-dialogs.adb +++ b/src/fltk-dialogs.adb @@ -1,8 +1,12 @@ -with Interfaces.C; -with Interfaces.C.Strings; -use type Interfaces.C.Strings.chars_ptr; +with + + Interfaces.C.Strings; + +use type + + Interfaces.C.Strings.chars_ptr; package body FLTK.Dialogs is diff --git a/src/fltk-images-bitmaps-xbm.adb b/src/fltk-images-bitmaps-xbm.adb index 2241332..c7f3023 100644 --- a/src/fltk-images-bitmaps-xbm.adb +++ b/src/fltk-images-bitmaps-xbm.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Images.Bitmaps.XBM is diff --git a/src/fltk-images-bitmaps-xbm.ads b/src/fltk-images-bitmaps-xbm.ads index fedbd69..4848576 100644 --- a/src/fltk-images-bitmaps-xbm.ads +++ b/src/fltk-images-bitmaps-xbm.ads @@ -6,6 +6,8 @@ package FLTK.Images.Bitmaps.XBM is type XBM_Image is new Bitmap with private; + + function Create (Filename : in String) return XBM_Image; @@ -16,7 +18,6 @@ private type XBM_Image is new Bitmap with null record; - overriding procedure Finalize (This : in out XBM_Image); diff --git a/src/fltk-images-bitmaps.adb b/src/fltk-images-bitmaps.adb index 280d327..f8c954c 100644 --- a/src/fltk-images-bitmaps.adb +++ b/src/fltk-images-bitmaps.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Images.Bitmaps is @@ -55,8 +60,6 @@ package body FLTK.Images.Bitmaps is end Copy; - - function Copy (This : in Bitmap) return Bitmap is diff --git a/src/fltk-images-bitmaps.ads b/src/fltk-images-bitmaps.ads index d209b4a..ce688f1 100644 --- a/src/fltk-images-bitmaps.ads +++ b/src/fltk-images-bitmaps.ads @@ -6,12 +6,13 @@ package FLTK.Images.Bitmaps is type Bitmap is new Image with private; + + function Copy (This : in Bitmap; Width, Height : in Natural) return Bitmap; - function Copy (This : in Bitmap) return Bitmap; @@ -22,7 +23,6 @@ private type Bitmap is new Image with null record; - overriding procedure Finalize (This : in out Bitmap); diff --git a/src/fltk-images-rgb-bmp.adb b/src/fltk-images-rgb-bmp.adb index 8d112c8..be6deb6 100644 --- a/src/fltk-images-rgb-bmp.adb +++ b/src/fltk-images-rgb-bmp.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Images.RGB.BMP is diff --git a/src/fltk-images-rgb-bmp.ads b/src/fltk-images-rgb-bmp.ads index 7b9da93..8d68d97 100644 --- a/src/fltk-images-rgb-bmp.ads +++ b/src/fltk-images-rgb-bmp.ads @@ -6,6 +6,8 @@ package FLTK.Images.RGB.BMP is type BMP_Image is new RGB_Image with private; + + function Create (Filename : in String) return BMP_Image; @@ -16,7 +18,6 @@ private type BMP_Image is new RGB_Image with null record; - overriding procedure Finalize (This : in out BMP_Image); diff --git a/src/fltk-images-rgb-jpeg.adb b/src/fltk-images-rgb-jpeg.adb index 2cb0e1f..47ea386 100644 --- a/src/fltk-images-rgb-jpeg.adb +++ b/src/fltk-images-rgb-jpeg.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Images.RGB.JPEG is diff --git a/src/fltk-images-rgb-jpeg.ads b/src/fltk-images-rgb-jpeg.ads index 9d06e28..f467245 100644 --- a/src/fltk-images-rgb-jpeg.ads +++ b/src/fltk-images-rgb-jpeg.ads @@ -6,6 +6,8 @@ package FLTK.Images.RGB.JPEG is type JPEG_Image is new RGB_Image with private; + + function Create (Filename : in String) return JPEG_Image; @@ -16,7 +18,6 @@ private type JPEG_Image is new RGB_Image with null record; - overriding procedure Finalize (This : in out JPEG_Image); diff --git a/src/fltk-images-rgb-png.adb b/src/fltk-images-rgb-png.adb index f6d9870..9606e74 100644 --- a/src/fltk-images-rgb-png.adb +++ b/src/fltk-images-rgb-png.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Images.RGB.PNG is diff --git a/src/fltk-images-rgb-png.ads b/src/fltk-images-rgb-png.ads index 0b44cb0..9dcb09d 100644 --- a/src/fltk-images-rgb-png.ads +++ b/src/fltk-images-rgb-png.ads @@ -6,6 +6,8 @@ package FLTK.Images.RGB.PNG is type PNG_Image is new RGB_Image with private; + + function Create (Filename : in String) return PNG_Image; @@ -16,7 +18,6 @@ private type PNG_Image is new RGB_Image with null record; - overriding procedure Finalize (This : in out PNG_Image); diff --git a/src/fltk-images-rgb-pnm.adb b/src/fltk-images-rgb-pnm.adb index ec325ce..dd6ae26 100644 --- a/src/fltk-images-rgb-pnm.adb +++ b/src/fltk-images-rgb-pnm.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Images.RGB.PNM is diff --git a/src/fltk-images-rgb-pnm.ads b/src/fltk-images-rgb-pnm.ads index 144dd08..2cd8c02 100644 --- a/src/fltk-images-rgb-pnm.ads +++ b/src/fltk-images-rgb-pnm.ads @@ -6,6 +6,8 @@ package FLTK.Images.RGB.PNM is type PNM_Image is new RGB_Image with private; + + function Create (Filename : in String) return PNM_Image; @@ -16,7 +18,6 @@ private type PNM_Image is new RGB_Image with null record; - overriding procedure Finalize (This : in out PNM_Image); diff --git a/src/fltk-images-rgb.adb b/src/fltk-images-rgb.adb index 0287914..fbbf23e 100644 --- a/src/fltk-images-rgb.adb +++ b/src/fltk-images-rgb.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Images.RGB is @@ -24,6 +29,8 @@ package body FLTK.Images.RGB is pragma Import (C, fl_rgb_image_copy2, "fl_rgb_image_copy2"); + + procedure fl_rgb_image_color_average (I : in System.Address; C : in Interfaces.C.int; @@ -66,8 +73,6 @@ package body FLTK.Images.RGB is end Copy; - - function Copy (This : in RGB_Image) return RGB_Image is @@ -92,8 +97,6 @@ package body FLTK.Images.RGB is end Color_Average; - - procedure Desaturate (This : in out RGB_Image) is begin diff --git a/src/fltk-images-rgb.ads b/src/fltk-images-rgb.ads index ea47c2b..6d0a1fc 100644 --- a/src/fltk-images-rgb.ads +++ b/src/fltk-images-rgb.ads @@ -6,23 +6,25 @@ package FLTK.Images.RGB is type RGB_Image is new Image with private; + + function Copy (This : in RGB_Image; Width, Height : in Natural) return RGB_Image; - function Copy (This : in RGB_Image) return RGB_Image; + + procedure Color_Average (This : in out RGB_Image; Col : in Color; Amount : in Blend); - procedure Desaturate (This : in out RGB_Image); @@ -32,7 +34,6 @@ private type RGB_Image is new Image with null record; - overriding procedure Finalize (This : in out RGB_Image); diff --git a/src/fltk-images.adb b/src/fltk-images.adb index 906fc46..f99c760 100644 --- a/src/fltk-images.adb +++ b/src/fltk-images.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Images is @@ -29,6 +34,8 @@ package body FLTK.Images is pragma Import (C, fl_image_copy2, "fl_image_copy2"); + + procedure fl_image_color_average (I : in System.Address; C : in Interfaces.C.int; @@ -39,10 +46,16 @@ package body FLTK.Images is (I : in System.Address); pragma Import (C, fl_image_desaturate, "fl_image_desaturate"); + + + procedure fl_image_inactive (I : in System.Address); pragma Import (C, fl_image_inactive, "fl_image_inactive"); + + + function fl_image_w (I : in System.Address) return Interfaces.C.int; @@ -88,8 +101,6 @@ package body FLTK.Images is end Create; - - function Copy (This : in Image; Width, Height : in Natural) @@ -104,8 +115,6 @@ package body FLTK.Images is end Copy; - - function Copy (This : in Image) return Image is @@ -130,8 +139,6 @@ package body FLTK.Images is end Color_Average; - - procedure Desaturate (This : in out Image) is begin @@ -158,8 +165,6 @@ package body FLTK.Images is end Get_W; - - function Get_H (This : in Image) return Natural is @@ -168,8 +173,6 @@ package body FLTK.Images is end Get_H; - - function Get_D (This : in Image) return Natural is diff --git a/src/fltk-images.ads b/src/fltk-images.ads index d2cb9f2..51f8443 100644 --- a/src/fltk-images.ads +++ b/src/fltk-images.ads @@ -5,50 +5,52 @@ package FLTK.Images is type Image is new Wrapper with private; - type Blend is new Float range 0.0 .. 1.0; + + function Create (Width, Height, Depth : in Natural) return Image; - function Copy (This : in Image; Width, Height : in Natural) return Image; - function Copy (This : in Image) return Image; + + procedure Color_Average (This : in out Image; Col : in Color; Amount : in Blend); - procedure Desaturate (This : in out Image); + + procedure Inactive (This : in out Image); + + function Get_W (This : in Image) return Natural; - function Get_H (This : in Image) return Natural; - function Get_D (This : in Image) return Natural; @@ -59,7 +61,6 @@ private type Image is new Wrapper with null record; - overriding procedure Finalize (This : in out Image); diff --git a/src/fltk-menu_items.adb b/src/fltk-menu_items.adb index 4c42efc..80bcea7 100644 --- a/src/fltk-menu_items.adb +++ b/src/fltk-menu_items.adb @@ -1,7 +1,12 @@ -with Interfaces.C; -use type Interfaces.C.int; +with + + Interfaces.C; + +use type + + Interfaces.C.int; package body FLTK.Menu_Items is @@ -12,6 +17,9 @@ package body FLTK.Menu_Items is return Interfaces.C.int; pragma Import (C, fl_menuitem_value, "fl_menuitem_value"); + + + procedure fl_menuitem_activate (MI : in System.Address); pragma Import (C, fl_menuitem_activate, "fl_menuitem_activate"); @@ -40,8 +48,6 @@ package body FLTK.Menu_Items is end Activate; - - procedure Deactivate (Item : in Menu_Item) is begin diff --git a/src/fltk-menu_items.ads b/src/fltk-menu_items.ads index 98a9d9d..51aba8b 100644 --- a/src/fltk-menu_items.ads +++ b/src/fltk-menu_items.ads @@ -6,15 +6,18 @@ package FLTK.Menu_Items is type Menu_Item is new Wrapper with private; + + function Value (Item : in Menu_Item) return Boolean; + + procedure Activate (Item : in Menu_Item); - procedure Deactivate (Item : in Menu_Item); diff --git a/src/fltk-text_buffers.adb b/src/fltk-text_buffers.adb index 086ec03..a91f7e1 100644 --- a/src/fltk-text_buffers.adb +++ b/src/fltk-text_buffers.adb @@ -1,13 +1,22 @@ -with Interfaces.C.Strings; -with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; -with Ada.Containers; -with System; -use type System.Address; -use type Interfaces.C.int; -use type Interfaces.C.Strings.chars_ptr; -use type Ada.Containers.Count_Type; +with + + Interfaces.C.Strings, + Ada.Strings.Unbounded, + Ada.Containers, + System; + +use + + Ada.Strings.Unbounded; + +use type + + System.Address, + Interfaces.C.int, + Interfaces.C.Strings.chars_ptr, + Ada.Containers.Count_Type; package body FLTK.Text_Buffers is @@ -22,6 +31,9 @@ package body FLTK.Text_Buffers is (TB : in System.Address); pragma Import (C, free_fl_text_buffer, "free_fl_text_buffer"); + + + procedure fl_text_buffer_add_modify_callback (TB, CB, UD : in System.Address); pragma Import (C, fl_text_buffer_add_modify_callback, @@ -42,6 +54,24 @@ package body FLTK.Text_Buffers is pragma Import (C, fl_text_buffer_call_predelete_callbacks, "fl_text_buffer_call_predelete_callbacks"); + + + + function fl_text_buffer_loadfile + (TB : in System.Address; + N : in Interfaces.C.char_array) + return Interfaces.C.int; + pragma Import (C, fl_text_buffer_loadfile, "fl_text_buffer_loadfile"); + + function fl_text_buffer_savefile + (TB : in System.Address; + N : in Interfaces.C.char_array) + return Interfaces.C.int; + pragma Import (C, fl_text_buffer_savefile, "fl_text_buffer_savefile"); + + + + procedure fl_text_buffer_insert (TB : in System.Address; P : in Interfaces.C.int; @@ -53,26 +83,48 @@ package body FLTK.Text_Buffers is S, F : in Interfaces.C.int); pragma Import (C, fl_text_buffer_remove, "fl_text_buffer_remove"); + function fl_text_buffer_char_at + (TB : in System.Address; + P : in Interfaces.C.int) + return Interfaces.C.unsigned; + pragma Import (C, fl_text_buffer_char_at, "fl_text_buffer_char_at"); + + function fl_text_buffer_text_range + (TB : in System.Address; + S, F : in Interfaces.C.int) + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, fl_text_buffer_text_range, "fl_text_buffer_text_range"); + function fl_text_buffer_length (TB : in System.Address) return Interfaces.C.int; pragma Import (C, fl_text_buffer_length, "fl_text_buffer_length"); - function fl_text_buffer_loadfile - (TB : in System.Address; - N : in Interfaces.C.char_array) + + + + function fl_text_buffer_selection_position + (TB : in System.Address; + S, E : out Interfaces.C.int) return Interfaces.C.int; - pragma Import (C, fl_text_buffer_loadfile, "fl_text_buffer_loadfile"); + pragma Import (C, fl_text_buffer_selection_position, "fl_text_buffer_selection_position"); + + procedure fl_text_buffer_select + (TB : in System.Address; + S, E : in Interfaces.C.int); + pragma Import (C, fl_text_buffer_select, "fl_text_buffer_select"); + + function fl_text_buffer_selected + (TB : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_text_buffer_selected, "fl_text_buffer_selected"); procedure fl_text_buffer_remove_selection (TB : in System.Address); pragma Import (C, fl_text_buffer_remove_selection, "fl_text_buffer_remove_selection"); - function fl_text_buffer_savefile - (TB : in System.Address; - N : in Interfaces.C.char_array) - return Interfaces.C.int; - pragma Import (C, fl_text_buffer_savefile, "fl_text_buffer_savefile"); + + function fl_text_buffer_search_forward (TB : in System.Address; @@ -92,22 +144,6 @@ package body FLTK.Text_Buffers is return Interfaces.C.int; pragma Import (C, fl_text_buffer_search_backward, "fl_text_buffer_search_backward"); - procedure fl_text_buffer_select - (TB : in System.Address; - S, E : in Interfaces.C.int); - pragma Import (C, fl_text_buffer_select, "fl_text_buffer_select"); - - function fl_text_buffer_selection_position - (TB : in System.Address; - S, E : out Interfaces.C.int) - return Interfaces.C.int; - pragma Import (C, fl_text_buffer_selection_position, "fl_text_buffer_selection_position"); - - function fl_text_buffer_selected - (TB : in System.Address) - return Interfaces.C.int; - pragma Import (C, fl_text_buffer_selected, "fl_text_buffer_selected"); - function fl_text_buffer_skip_lines (TB : in System.Address; S, L : in Interfaces.C.int) @@ -120,42 +156,10 @@ package body FLTK.Text_Buffers is return Interfaces.C.int; pragma Import (C, fl_text_buffer_rewind_lines, "fl_text_buffer_rewind_lines"); - function fl_text_buffer_char_at - (TB : in System.Address; - P : in Interfaces.C.int) - return Interfaces.C.unsigned; - pragma Import (C, fl_text_buffer_char_at, "fl_text_buffer_char_at"); - - function fl_text_buffer_text_range - (TB : in System.Address; - S, F : in Interfaces.C.int) - return Interfaces.C.Strings.chars_ptr; - pragma Import (C, fl_text_buffer_text_range, "fl_text_buffer_text_range"); - - - - - procedure Finalize - (This : in out Text_Buffer) is - begin - if This.Void_Ptr /= System.Null_Address and then - This in Text_Buffer'Class - then - free_fl_text_buffer (This.Void_Ptr); - This.Void_Ptr := System.Null_Address; - end if; - end Finalize; - procedure Modify_Callback_Hook - (Pos, Inserted, Deleted, Restyled : in Interfaces.C.int; - Text : in Interfaces.C.Strings.chars_ptr; - UD : in System.Address); - pragma Convention (C, Modify_Callback_Hook); - - procedure Modify_Callback_Hook (Pos : in Interfaces.C.int; Inserted, Deleted, Restyled : in Interfaces.C.int; Text : in Interfaces.C.Strings.chars_ptr; @@ -194,13 +198,6 @@ package body FLTK.Text_Buffers is end Modify_Callback_Hook; - - - procedure Predelete_Callback_Hook - (Pos, Deleted : in Interfaces.C.int; - UD : in System.Address); - pragma Convention (C, Predelete_Callback_Hook); - procedure Predelete_Callback_Hook (Pos, Deleted : in Interfaces.C.int; UD : in System.Address) @@ -221,6 +218,20 @@ package body FLTK.Text_Buffers is + procedure Finalize + (This : in out Text_Buffer) is + begin + if This.Void_Ptr /= System.Null_Address and then + This in Text_Buffer'Class + then + free_fl_text_buffer (This.Void_Ptr); + This.Void_Ptr := System.Null_Address; + end if; + end Finalize; + + + + function Create (Requested_Size : in Natural := 0; Preferred_Gap_Size : in Natural := 1024) @@ -254,8 +265,6 @@ package body FLTK.Text_Buffers is end Add_Modify_Callback; - - procedure Add_Predelete_Callback (This : in out Text_Buffer; Func : in Predelete_Callback) is @@ -270,8 +279,6 @@ package body FLTK.Text_Buffers is end Add_Predelete_Callback; - - procedure Call_Modify_Callbacks (This : in out Text_Buffer) is begin @@ -279,8 +286,6 @@ package body FLTK.Text_Buffers is end Call_Modify_Callbacks; - - procedure Call_Predelete_Callbacks (This : in out Text_Buffer) is begin @@ -288,8 +293,6 @@ package body FLTK.Text_Buffers is end Call_Predelete_Callbacks; - - procedure Enable_Callbacks (This : in out Text_Buffer) is begin @@ -297,8 +300,6 @@ package body FLTK.Text_Buffers is end Enable_Callbacks; - - procedure Disable_Callbacks (This : in out Text_Buffer) is begin @@ -308,6 +309,36 @@ package body FLTK.Text_Buffers is + procedure Load_File + (This : in Text_Buffer; + Name : in String) + is + Err_No : Interfaces.C.int := fl_text_buffer_loadfile + (This.Void_Ptr, + Interfaces.C.To_C (Name)); + begin + if Err_No /= 0 then + raise Storage_Error; + end if; + end Load_File; + + + procedure Save_File + (This : in Text_Buffer; + Name : in String) + is + Err_No : Interfaces.C.int := fl_text_buffer_savefile + (This.Void_Ptr, + Interfaces.C.To_C (Name)); + begin + if Err_No /= 0 then + raise Storage_Error; + end if; + end Save_File; + + + + procedure Insert_Text (This : in out Text_Buffer; Pos : in Natural; @@ -320,8 +351,6 @@ package body FLTK.Text_Buffers is end Insert_Text; - - procedure Remove_Text (This : in out Text_Buffer; Start, Finish : in Natural) is @@ -333,6 +362,31 @@ package body FLTK.Text_Buffers is end Remove_Text; + function Character_At + (This : in Text_Buffer; + Pos : in Natural) + return Character is + begin + return Character'Val (fl_text_buffer_char_at + (This.Void_Ptr, + Interfaces.C.int (Pos))); + end Character_At; + + + function Text_At + (This : in Text_Buffer; + Start, Finish : in Natural) + return String + is + C_Str : Interfaces.C.Strings.chars_ptr := fl_text_buffer_text_range + (This.Void_Ptr, + Interfaces.C.int (Start), + Interfaces.C.int (Finish)); + The_Text : String := Interfaces.C.Strings.Value (C_Str); + begin + Interfaces.C.Strings.Free (C_Str); + return The_Text; + end Text_At; function Length @@ -345,20 +399,42 @@ package body FLTK.Text_Buffers is - procedure Load_File - (This : in Text_Buffer; - Name : in String) + function Get_Selection + (This : in Text_Buffer; + Start, Finish : out Natural) + return Boolean is - Err_No : Interfaces.C.int := fl_text_buffer_loadfile - (This.Void_Ptr, - Interfaces.C.To_C (Name)); + Result, Start_Raw, Finish_Raw : Interfaces.C.int; begin - if Err_No /= 0 then - raise Storage_Error; + Result := fl_text_buffer_selection_position + (This.Void_Ptr, + Start_Raw, + Finish_Raw); + if Result /= 0 then + Start := Natural (Start_Raw); + Finish := Natural (Finish_Raw); end if; - end Load_File; + return Result /= 0; + end Get_Selection; + procedure Set_Selection + (This : in out Text_Buffer; + Start, Finish : in Natural) is + begin + fl_text_buffer_select + (This.Void_Ptr, + Interfaces.C.int (Start), + Interfaces.C.int (Finish)); + end Set_Selection; + + + function Has_Selection + (This : in Text_Buffer) + return Boolean is + begin + return fl_text_buffer_selected (This.Void_Ptr) /= 0; + end Has_Selection; procedure Remove_Selected_Text @@ -370,22 +446,6 @@ package body FLTK.Text_Buffers is - procedure Save_File - (This : in Text_Buffer; - Name : in String) - is - Err_No : Interfaces.C.int := fl_text_buffer_savefile - (This.Void_Ptr, - Interfaces.C.To_C (Name)); - begin - if Err_No /= 0 then - raise Storage_Error; - end if; - end Save_File; - - - - function Search_Forward (This : in Text_Buffer; Start_At : in Natural; @@ -409,8 +469,6 @@ package body FLTK.Text_Buffers is end Search_Forward; - - function Search_Backward (This : in Text_Buffer; Start_At : in Natural; @@ -434,52 +492,6 @@ package body FLTK.Text_Buffers is end Search_Backward; - - - procedure Set_Selection - (This : in out Text_Buffer; - Start, Finish : in Natural) is - begin - fl_text_buffer_select - (This.Void_Ptr, - Interfaces.C.int (Start), - Interfaces.C.int (Finish)); - end Set_Selection; - - - - - function Get_Selection - (This : in Text_Buffer; - Start, Finish : out Natural) - return Boolean - is - Result, Start_Raw, Finish_Raw : Interfaces.C.int; - begin - Result := fl_text_buffer_selection_position - (This.Void_Ptr, - Start_Raw, - Finish_Raw); - if Result /= 0 then - Start := Natural (Start_Raw); - Finish := Natural (Finish_Raw); - end if; - return Result /= 0; - end Get_Selection; - - - - - function Has_Selection - (This : in Text_Buffer) - return Boolean is - begin - return fl_text_buffer_selected (This.Void_Ptr) /= 0; - end Has_Selection; - - - - function Skip_Lines (This : in out Text_Buffer; Start, Lines : in Natural) @@ -492,8 +504,6 @@ package body FLTK.Text_Buffers is end Skip_Lines; - - function Rewind_Lines (This : in out Text_Buffer; Start, Lines : in Natural) @@ -506,36 +516,5 @@ package body FLTK.Text_Buffers is end Rewind_Lines; - - - function Character_At - (This : in Text_Buffer; - Pos : in Natural) - return Character is - begin - return Character'Val (fl_text_buffer_char_at - (This.Void_Ptr, - Interfaces.C.int (Pos))); - end Character_At; - - - - - function Text_At - (This : in Text_Buffer; - Start, Finish : in Natural) - return String - is - C_Str : Interfaces.C.Strings.chars_ptr := fl_text_buffer_text_range - (This.Void_Ptr, - Interfaces.C.int (Start), - Interfaces.C.int (Finish)); - The_Text : String := Interfaces.C.Strings.Value (C_Str); - begin - Interfaces.C.Strings.Free (C_Str); - return The_Text; - end Text_At; - - end FLTK.Text_Buffers; diff --git a/src/fltk-text_buffers.ads b/src/fltk-text_buffers.ads index d3e1bab..1648915 100644 --- a/src/fltk-text_buffers.ads +++ b/src/fltk-text_buffers.ads @@ -1,20 +1,23 @@ -private with Ada.Containers.Vectors; -private with System.Address_To_Access_Conversions; +private with + + Ada.Containers.Vectors, + System.Address_To_Access_Conversions, + Interfaces.C.Strings; package FLTK.Text_Buffers is type Text_Buffer is new Wrapper with private; + type Text_Buffer_Cursor (Data : access Text_Buffer'Class) is limited null record with Implicit_Dereference => Data; - type Position is new Natural; - type Modification is (Insert, Restyle, Delete, None); + type Modification is (Insert, Restyle, Delete, None); type Modify_Callback is access procedure (Action : in Modification; @@ -22,72 +25,98 @@ package FLTK.Text_Buffers is Length : in Natural; Deleted_Text : in String); - type Predelete_Callback is access procedure (Place : in Position; Length : in Natural); + + function Create (Requested_Size : in Natural := 0; Preferred_Gap_Size : in Natural := 1024) return Text_Buffer; + + procedure Add_Modify_Callback (This : in out Text_Buffer; Func : in Modify_Callback); - procedure Add_Predelete_Callback (This : in out Text_Buffer; Func : in Predelete_Callback); - procedure Call_Modify_Callbacks (This : in out Text_Buffer); - procedure Call_Predelete_Callbacks (This : in out Text_Buffer); - procedure Enable_Callbacks (This : in out Text_Buffer); - procedure Disable_Callbacks (This : in out Text_Buffer); + + + procedure Load_File + (This : in Text_Buffer; + Name : in String); + + procedure Save_File + (This : in Text_Buffer; + Name : in String); + + + + procedure Insert_Text (This : in out Text_Buffer; Pos : in Natural; Item : in String); - procedure Remove_Text (This : in out Text_Buffer; Start, Finish : in Natural); + function Character_At + (This : in Text_Buffer; + Pos : in Natural) + return Character; + + function Text_At + (This : in Text_Buffer; + Start, Finish : in Natural) + return String; function Length (This : in Text_Buffer) return Natural; - procedure Load_File - (This : in Text_Buffer; - Name : in String); + function Get_Selection + (This : in Text_Buffer; + Start, Finish : out Natural) + return Boolean; + + procedure Set_Selection + (This : in out Text_Buffer; + Start, Finish : in Natural); + + function Has_Selection + (This : in Text_Buffer) + return Boolean; + procedure Remove_Selected_Text (This : in out Text_Buffer); - procedure Save_File - (This : in Text_Buffer; - Name : in String); function Search_Forward @@ -98,7 +127,6 @@ package FLTK.Text_Buffers is Match_Case : in Boolean) return Boolean; - function Search_Backward (This : in Text_Buffer; Start_At : in Natural; @@ -107,30 +135,12 @@ package FLTK.Text_Buffers is Match_Case : in Boolean) return Boolean; - - procedure Set_Selection - (This : in out Text_Buffer; - Start, Finish : in Natural); - - - function Get_Selection - (This : in Text_Buffer; - Start, Finish : out Natural) - return Boolean; - - - function Has_Selection - (This : in Text_Buffer) - return Boolean; - - -- only takes into account newline characters, not word wrap function Skip_Lines (This : in out Text_Buffer; Start, Lines : in Natural) return Natural; - -- only takes into account newline characters, not word wrap function Rewind_Lines (This : in out Text_Buffer; @@ -138,18 +148,6 @@ package FLTK.Text_Buffers is return Natural; - function Character_At - (This : in Text_Buffer; - Pos : in Natural) - return Character; - - - function Text_At - (This : in Text_Buffer; - Start, Finish : in Natural) - return String; - - private @@ -161,6 +159,8 @@ private Element_Type => Predelete_Callback); + + type Text_Buffer is new Wrapper with record CB_Active : Boolean; @@ -168,11 +168,26 @@ private Predelete_CBs : Predelete_Vectors.Vector; end record; - overriding procedure Finalize (This : in out Text_Buffer); + + + procedure Modify_Callback_Hook + (Pos, Inserted, Deleted, Restyled : in Interfaces.C.int; + Text : in Interfaces.C.Strings.chars_ptr; + UD : in System.Address); + pragma Convention (C, Modify_Callback_Hook); + + procedure Predelete_Callback_Hook + (Pos, Deleted : in Interfaces.C.int; + UD : in System.Address); + pragma Convention (C, Predelete_Callback_Hook); + + + + package Text_Buffer_Convert is new System.Address_To_Access_Conversions (Text_Buffer); diff --git a/src/fltk-widgets-boxes.adb b/src/fltk-widgets-boxes.adb index 95b8c85..c8ef70b 100644 --- a/src/fltk-widgets-boxes.adb +++ b/src/fltk-widgets-boxes.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Boxes is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Boxes is pragma Import (C, box_set_handle_hook, "box_set_handle_hook"); + + function new_fl_box (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Boxes is pragma Import (C, free_fl_box, "free_fl_box"); + + procedure fl_box_draw (W : in System.Address); pragma Import (C, fl_box_draw, "fl_box_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Boxes is end Draw; - - function Handle (This : in out Box; Event : in Event_Kind) diff --git a/src/fltk-widgets-boxes.ads b/src/fltk-widgets-boxes.ads index b3d2abd..b31bdf5 100644 --- a/src/fltk-widgets-boxes.ads +++ b/src/fltk-widgets-boxes.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Boxes is type Box is new Widget with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Box; + + procedure Draw (This : in out Box); - function Handle (This : in out Box; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type Box is new Widget with null record; - overriding procedure Finalize (This : in out Box); diff --git a/src/fltk-widgets-buttons-enter.adb b/src/fltk-widgets-buttons-enter.adb index 94ac313..71acd7f 100644 --- a/src/fltk-widgets-buttons-enter.adb +++ b/src/fltk-widgets-buttons-enter.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Buttons.Enter is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Buttons.Enter is pragma Import (C, return_button_set_handle_hook, "return_button_set_handle_hook"); + + function new_fl_return_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Buttons.Enter is pragma Import (C, free_fl_return_button, "free_fl_return_button"); + + procedure fl_return_button_draw (W : in System.Address); pragma Import (C, fl_return_button_draw, "fl_return_button_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Buttons.Enter is end Draw; - - function Handle (This : in out Enter_Button; Event : in Event_Kind) diff --git a/src/fltk-widgets-buttons-enter.ads b/src/fltk-widgets-buttons-enter.ads index 73e2c01..e56e141 100644 --- a/src/fltk-widgets-buttons-enter.ads +++ b/src/fltk-widgets-buttons-enter.ads @@ -9,16 +9,19 @@ package FLTK.Widgets.Buttons.Enter is type Enter_Button is new Button with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Enter_Button; + + procedure Draw (This : in out Enter_Button); - function Handle (This : in out Enter_Button; Event : in Event_Kind) @@ -30,7 +33,6 @@ private type Enter_Button is new Button with null record; - overriding procedure Finalize (This : in out Enter_Button); diff --git a/src/fltk-widgets-buttons-light-check.adb b/src/fltk-widgets-buttons-light-check.adb index e0e25b4..b367cd3 100644 --- a/src/fltk-widgets-buttons-light-check.adb +++ b/src/fltk-widgets-buttons-light-check.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Buttons.Light.Check is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Buttons.Light.Check is pragma Import (C, check_button_set_handle_hook, "check_button_set_handle_hook"); + + function new_fl_check_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Buttons.Light.Check is pragma Import (C, free_fl_check_button, "free_fl_check_button"); + + procedure fl_check_button_draw (W : in System.Address); pragma Import (C, fl_check_button_draw, "fl_check_button_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Buttons.Light.Check is end Draw; - - function Handle (This : in out Check_Button; Event : in Event_Kind) diff --git a/src/fltk-widgets-buttons-light-check.ads b/src/fltk-widgets-buttons-light-check.ads index f6d63d7..f4351ef 100644 --- a/src/fltk-widgets-buttons-light-check.ads +++ b/src/fltk-widgets-buttons-light-check.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Buttons.Light.Check is type Check_Button is new Light_Button with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Check_Button; + + procedure Draw (This : in out Check_Button); - function Handle (This : in out Check_Button; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type Check_Button is new Light_Button with null record; - overriding procedure Finalize (This : in out Check_Button); diff --git a/src/fltk-widgets-buttons-light-radio.adb b/src/fltk-widgets-buttons-light-radio.adb index 8da2958..0317616 100644 --- a/src/fltk-widgets-buttons-light-radio.adb +++ b/src/fltk-widgets-buttons-light-radio.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Buttons.Light.Radio is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Buttons.Light.Radio is pragma Import (C, radio_light_button_set_handle_hook, "radio_light_button_set_handle_hook"); + + function new_fl_radio_light_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Buttons.Light.Radio is pragma Import (C, free_fl_radio_light_button, "free_fl_radio_light_button"); + + procedure fl_radio_light_button_draw (W : in System.Address); pragma Import (C, fl_radio_light_button_draw, "fl_radio_light_button_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Buttons.Light.Radio is end Draw; - - function Handle (This : in out Radio_Light_Button; Event : in Event_Kind) diff --git a/src/fltk-widgets-buttons-light-radio.ads b/src/fltk-widgets-buttons-light-radio.ads index 46e4e3b..47d5236 100644 --- a/src/fltk-widgets-buttons-light-radio.ads +++ b/src/fltk-widgets-buttons-light-radio.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Buttons.Light.Radio is type Radio_Light_Button is new Light_Button with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Radio_Light_Button; + + procedure Draw (This : in out Radio_Light_Button); - function Handle (This : in out Radio_Light_Button; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type Radio_Light_Button is new Light_Button with null record; - overriding procedure Finalize (This : in out Radio_Light_Button); diff --git a/src/fltk-widgets-buttons-light-round-radio.adb b/src/fltk-widgets-buttons-light-round-radio.adb index 58d92e4..f8ce436 100644 --- a/src/fltk-widgets-buttons-light-round-radio.adb +++ b/src/fltk-widgets-buttons-light-round-radio.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Buttons.Light.Round.Radio is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Buttons.Light.Round.Radio is pragma Import (C, radio_round_button_set_handle_hook, "radio_round_button_set_handle_hook"); + + function new_fl_radio_round_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Buttons.Light.Round.Radio is pragma Import (C, free_fl_radio_round_button, "free_fl_radio_round_button"); + + procedure fl_radio_round_button_draw (W : in System.Address); pragma Import (C, fl_radio_round_button_draw, "fl_radio_round_button_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Buttons.Light.Round.Radio is end Draw; - - function Handle (This : in out Radio_Round_Button; Event : in Event_Kind) diff --git a/src/fltk-widgets-buttons-light-round-radio.ads b/src/fltk-widgets-buttons-light-round-radio.ads index 9bdb669..8c0ec28 100644 --- a/src/fltk-widgets-buttons-light-round-radio.ads +++ b/src/fltk-widgets-buttons-light-round-radio.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Buttons.Light.Round.Radio is type Radio_Round_Button is new Round_Button with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Radio_Round_Button; + + procedure Draw (This : in out Radio_Round_Button); - function Handle (This : in out Radio_Round_Button; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type Radio_Round_Button is new Round_Button with null record; - overriding procedure Finalize (This : in out Radio_Round_Button); diff --git a/src/fltk-widgets-buttons-light-round.adb b/src/fltk-widgets-buttons-light-round.adb index d047603..7b10003 100644 --- a/src/fltk-widgets-buttons-light-round.adb +++ b/src/fltk-widgets-buttons-light-round.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Buttons.Light.Round is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Buttons.Light.Round is pragma Import (C, round_button_set_handle_hook, "round_button_set_handle_hook"); + + function new_fl_round_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Buttons.Light.Round is pragma Import (C, free_fl_round_button, "free_fl_round_button"); + + procedure fl_round_button_draw (W : in System.Address); pragma Import (C, fl_round_button_draw, "fl_round_button_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Buttons.Light.Round is end Draw; - - function Handle (This : in out Round_Button; Event : in Event_Kind) diff --git a/src/fltk-widgets-buttons-light-round.ads b/src/fltk-widgets-buttons-light-round.ads index 7e993a2..183e953 100644 --- a/src/fltk-widgets-buttons-light-round.ads +++ b/src/fltk-widgets-buttons-light-round.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Buttons.Light.Round is type Round_Button is new Light_Button with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Round_Button; + + procedure Draw (This : in out Round_Button); - function Handle (This : in out Round_Button; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type Round_Button is new Light_Button with null record; - overriding procedure Finalize (This : in out Round_Button); diff --git a/src/fltk-widgets-buttons-light.adb b/src/fltk-widgets-buttons-light.adb index de88e85..9029b3b 100644 --- a/src/fltk-widgets-buttons-light.adb +++ b/src/fltk-widgets-buttons-light.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Buttons.Light is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Buttons.Light is pragma Import (C, light_button_set_handle_hook, "light_button_set_handle_hook"); + + function new_fl_light_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Buttons.Light is pragma Import (C, free_fl_light_button, "free_fl_light_button"); + + procedure fl_light_button_draw (W : in System.Address); pragma Import (C, fl_light_button_draw, "fl_light_button_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Buttons.Light is end Draw; - - function Handle (This : in out Light_Button; Event : in Event_Kind) diff --git a/src/fltk-widgets-buttons-light.ads b/src/fltk-widgets-buttons-light.ads index 77d8186..e999536 100644 --- a/src/fltk-widgets-buttons-light.ads +++ b/src/fltk-widgets-buttons-light.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Buttons.Light is type Light_Button is new Button with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Light_Button; + + procedure Draw (This : in out Light_Button); - function Handle (This : in out Light_Button; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type Light_Button is new Button with null record; - overriding procedure Finalize (This : in out Light_Button); diff --git a/src/fltk-widgets-buttons-radio.adb b/src/fltk-widgets-buttons-radio.adb index 2a9849c..26388a8 100644 --- a/src/fltk-widgets-buttons-radio.adb +++ b/src/fltk-widgets-buttons-radio.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Buttons.Radio is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Buttons.Radio is pragma Import (C, radio_button_set_handle_hook, "radio_button_set_handle_hook"); + + function new_fl_radio_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Buttons.Radio is pragma Import (C, free_fl_radio_button, "free_fl_radio_button"); + + procedure fl_radio_button_draw (W : in System.Address); pragma Import (C, fl_radio_button_draw, "fl_radio_button_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Buttons.Radio is end Draw; - - function Handle (This : in out Radio_Button; Event : in Event_Kind) diff --git a/src/fltk-widgets-buttons-radio.ads b/src/fltk-widgets-buttons-radio.ads index 08e007c..97be6fb 100644 --- a/src/fltk-widgets-buttons-radio.ads +++ b/src/fltk-widgets-buttons-radio.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Buttons.Radio is type Radio_Button is new Button with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Radio_Button; + + procedure Draw (This : in out Radio_Button); - function Handle (This : in out Radio_Button; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type Radio_Button is new Button with null record; - overriding procedure Finalize (This : in out Radio_Button); diff --git a/src/fltk-widgets-buttons-repeat.adb b/src/fltk-widgets-buttons-repeat.adb index 02c391c..3d1ca90 100644 --- a/src/fltk-widgets-buttons-repeat.adb +++ b/src/fltk-widgets-buttons-repeat.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Buttons.Repeat is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Buttons.Repeat is pragma Import (C, repeat_button_set_handle_hook, "repeat_button_set_handle_hook"); + + function new_fl_repeat_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Buttons.Repeat is pragma Import (C, free_fl_repeat_button, "free_fl_repeat_button"); + + procedure fl_repeat_button_draw (W : in System.Address); pragma Import (C, fl_repeat_button_draw, "fl_repeat_button_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Buttons.Repeat is end Draw; - - function Handle (This : in out Repeat_Button; Event : in Event_Kind) diff --git a/src/fltk-widgets-buttons-repeat.ads b/src/fltk-widgets-buttons-repeat.ads index 55f3b78..179e92e 100644 --- a/src/fltk-widgets-buttons-repeat.ads +++ b/src/fltk-widgets-buttons-repeat.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Buttons.Repeat is type Repeat_Button is new Button with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Repeat_Button; + + procedure Draw (This : in out Repeat_Button); - function Handle (This : in out Repeat_Button; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type Repeat_Button is new Button with null record; - overriding procedure Finalize (This : in out Repeat_Button); diff --git a/src/fltk-widgets-buttons-toggle.adb b/src/fltk-widgets-buttons-toggle.adb index 2734077..bf4074a 100644 --- a/src/fltk-widgets-buttons-toggle.adb +++ b/src/fltk-widgets-buttons-toggle.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Buttons.Toggle is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Buttons.Toggle is pragma Import (C, toggle_button_set_handle_hook, "toggle_button_set_handle_hook"); + + function new_fl_toggle_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Buttons.Toggle is pragma Import (C, free_fl_toggle_button, "free_fl_toggle_button"); + + procedure fl_toggle_button_draw (W : in System.Address); pragma Import (C, fl_toggle_button_draw, "fl_toggle_button_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Buttons.Toggle is end Draw; - - function Handle (This : in out Toggle_Button; Event : in Event_Kind) diff --git a/src/fltk-widgets-buttons-toggle.ads b/src/fltk-widgets-buttons-toggle.ads index f916df0..5d75cf9 100644 --- a/src/fltk-widgets-buttons-toggle.ads +++ b/src/fltk-widgets-buttons-toggle.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Buttons.Toggle is type Toggle_Button is new Button with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Toggle_Button; + + procedure Draw (This : in out Toggle_Button); - function Handle (This : in out Toggle_Button; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type Toggle_Button is new Button with null record; - overriding procedure Finalize (This : in out Toggle_Button); diff --git a/src/fltk-widgets-buttons.adb b/src/fltk-widgets-buttons.adb index b28449f..45b3a6e 100644 --- a/src/fltk-widgets-buttons.adb +++ b/src/fltk-widgets-buttons.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Buttons is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Buttons is pragma Import (C, button_set_handle_hook, "button_set_handle_hook"); + + function new_fl_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Buttons is pragma Import (C, free_fl_button, "free_fl_button"); + + function fl_button_get_state (B : in System.Address) return Interfaces.C.int; @@ -42,6 +51,9 @@ package body FLTK.Widgets.Buttons is (B : in System.Address); pragma Import (C, fl_button_set_only, "fl_button_set_only"); + + + procedure fl_button_draw (W : in System.Address); pragma Import (C, fl_button_draw, "fl_button_draw"); @@ -101,8 +113,6 @@ package body FLTK.Widgets.Buttons is end Get_State; - - procedure Set_State (This : in out Button; St : in State) is @@ -111,8 +121,6 @@ package body FLTK.Widgets.Buttons is end Set_State; - - procedure Set_Only (This : in out Button) is begin @@ -129,8 +137,6 @@ package body FLTK.Widgets.Buttons is end Draw; - - function Handle (This : in out Button; Event : in Event_Kind) diff --git a/src/fltk-widgets-buttons.ads b/src/fltk-widgets-buttons.ads index 981c313..0cf2c61 100644 --- a/src/fltk-widgets-buttons.ads +++ b/src/fltk-widgets-buttons.ads @@ -5,34 +5,36 @@ package FLTK.Widgets.Buttons is type Button is new Widget with private; - type State is (Off, On); + + function Create (X, Y, W, H : in Integer; Text : in String) return Button; + + function Get_State (This : in Button) return State; - procedure Set_State (This : in out Button; St : in State); - procedure Set_Only (This : in out Button); + + procedure Draw (This : in out Button); - function Handle (This : in out Button; Event : in Event_Kind) @@ -44,7 +46,6 @@ private type Button is new Widget with null record; - overriding procedure Finalize (This : in out Button); diff --git a/src/fltk-widgets-groups-scrolls.adb b/src/fltk-widgets-groups-scrolls.adb index 09aae1e..376a2ac 100644 --- a/src/fltk-widgets-groups-scrolls.adb +++ b/src/fltk-widgets-groups-scrolls.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Groups.Scrolls is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Groups.Scrolls is pragma Import (C, scroll_set_handle_hook, "scroll_set_handle_hook"); + + function new_fl_scroll (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,11 +35,21 @@ package body FLTK.Widgets.Groups.Scrolls is pragma Import (C, free_fl_scroll, "free_fl_scroll"); + + procedure fl_scroll_to (S : in System.Address; X, Y : in Interfaces.C.int); pragma Import (C, fl_scroll_to, "fl_scroll_to"); + procedure fl_scroll_set_type + (S : in System.Address; + T : in Interfaces.C.int); + pragma Import (C, fl_scroll_set_type, "fl_scroll_set_type"); + + + + function fl_scroll_get_size (S : in System.Address) return Interfaces.C.int; @@ -53,10 +70,8 @@ package body FLTK.Widgets.Groups.Scrolls is return Interfaces.C.int; pragma Import (C, fl_scroll_yposition, "fl_scroll_yposition"); - procedure fl_scroll_set_type - (S : in System.Address; - T : in Interfaces.C.int); - pragma Import (C, fl_scroll_set_type, "fl_scroll_set_type"); + + procedure fl_scroll_draw (S : in System.Address); @@ -111,7 +126,6 @@ package body FLTK.Widgets.Groups.Scrolls is - procedure Scroll_To (This : in out Scroll; X, Y : in Integer) is @@ -120,6 +134,14 @@ package body FLTK.Widgets.Groups.Scrolls is end Scroll_To; + procedure Set_Type + (This : in out Scroll; + Mode : in Scroll_Kind) is + begin + fl_scroll_set_type (This.Void_Ptr, Scroll_Kind'Pos (Mode)); + end Set_Type; + + function Get_Scrollbar_Size @@ -130,8 +152,6 @@ package body FLTK.Widgets.Groups.Scrolls is end Get_Scrollbar_Size; - - procedure Set_Scrollbar_Size (This : in out Scroll; To : in Integer) is @@ -140,8 +160,6 @@ package body FLTK.Widgets.Groups.Scrolls is end Set_Scrollbar_Size; - - function Get_Scroll_X (This : in Scroll) return Integer is @@ -150,8 +168,6 @@ package body FLTK.Widgets.Groups.Scrolls is end Get_Scroll_X; - - function Get_Scroll_Y (This : in Scroll) return Integer is @@ -162,16 +178,6 @@ package body FLTK.Widgets.Groups.Scrolls is - procedure Set_Type - (This : in out Scroll; - Mode : in Scroll_Kind) is - begin - fl_scroll_set_type (This.Void_Ptr, Scroll_Kind'Pos (Mode)); - end Set_Type; - - - - procedure Draw (This : in out Scroll) is begin @@ -179,8 +185,6 @@ package body FLTK.Widgets.Groups.Scrolls is end Draw; - - function Handle (This : in out Scroll; Event : in Event_Kind) diff --git a/src/fltk-widgets-groups-scrolls.ads b/src/fltk-widgets-groups-scrolls.ads index e4ead1b..5299cf8 100644 --- a/src/fltk-widgets-groups-scrolls.ads +++ b/src/fltk-widgets-groups-scrolls.ads @@ -5,7 +5,6 @@ package FLTK.Widgets.Groups.Scrolls is type Scroll is new Group with private; - type Scroll_Kind is (Horizontal, Vertical, @@ -16,48 +15,51 @@ package FLTK.Widgets.Groups.Scrolls is Both_Always); + + function Create (X, Y, W, H : in Integer; Text : in String) return Scroll; + + procedure Scroll_To (This : in out Scroll; X, Y : in Integer); + procedure Set_Type + (This : in out Scroll; + Mode : in Scroll_Kind); + + + function Get_Scrollbar_Size (This : in Scroll) return Integer; - procedure Set_Scrollbar_Size (This : in out Scroll; To : in Integer); - -- These two functions are far too similar in name and -- function to the Get_X and Get_Y for Widgets. function Get_Scroll_X (This : in Scroll) return Integer; - function Get_Scroll_Y (This : in Scroll) return Integer; - procedure Set_Type - (This : in out Scroll; - Mode : in Scroll_Kind); procedure Draw (This : in out Scroll); - function Handle (This : in out Scroll; Event : in Event_Kind) @@ -69,7 +71,6 @@ private type Scroll is new Group with null record; - overriding procedure Finalize (This : in out Scroll); diff --git a/src/fltk-widgets-groups-text_displays-text_editors.adb b/src/fltk-widgets-groups-text_displays-text_editors.adb index a3395ba..f54fac8 100644 --- a/src/fltk-widgets-groups-text_displays-text_editors.adb +++ b/src/fltk-widgets-groups-text_displays-text_editors.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is diff --git a/src/fltk-widgets-groups-text_displays-text_editors.ads b/src/fltk-widgets-groups-text_displays-text_editors.ads index 4f9f183..b21cc3b 100644 --- a/src/fltk-widgets-groups-text_displays-text_editors.ads +++ b/src/fltk-widgets-groups-text_displays-text_editors.ads @@ -1,7 +1,9 @@ -private with Interfaces.C; -private with Ada.Containers.Vectors; +private with + + Interfaces.C, + Ada.Containers.Vectors; package FLTK.Widgets.Groups.Text_Displays.Text_Editors is @@ -327,17 +329,20 @@ private (Index_Type => Positive, Element_Type => Key_Binding); + + type Text_Editor is new Text_Display with record Bindings : Binding_Vectors.Vector; Default_Func : Default_Key_Func; end record; - overriding procedure Finalize (This : in out Text_Editor); + + function Key_Func_Hook (K : in Interfaces.C.int; E : in System.Address) @@ -345,6 +350,8 @@ private pragma Convention (C, Key_Func_Hook); + + package Editor_Convert is new System.Address_To_Access_Conversions (Text_Editor'Class); diff --git a/src/fltk-widgets-groups-text_displays.adb b/src/fltk-widgets-groups-text_displays.adb index fbff6ef..42ad88c 100644 --- a/src/fltk-widgets-groups-text_displays.adb +++ b/src/fltk-widgets-groups-text_displays.adb @@ -1,10 +1,15 @@ -with Interfaces.C; -with System; -with FLTK.Text_Buffers; -use type Interfaces.C.int; -use type System.Address; +with + + Interfaces.C, + System, + FLTK.Text_Buffers; + +use type + + Interfaces.C.int, + System.Address; package body FLTK.Widgets.Groups.Text_Displays is diff --git a/src/fltk-widgets-groups-text_displays.ads b/src/fltk-widgets-groups-text_displays.ads index 09cf31c..473a974 100644 --- a/src/fltk-widgets-groups-text_displays.ads +++ b/src/fltk-widgets-groups-text_displays.ads @@ -1,6 +1,8 @@ -with FLTK.Text_Buffers; +with + + FLTK.Text_Buffers; package FLTK.Widgets.Groups.Text_Displays is diff --git a/src/fltk-widgets-groups-windows-double.adb b/src/fltk-widgets-groups-windows-double.adb index 2e51b58..3462582 100644 --- a/src/fltk-widgets-groups-windows-double.adb +++ b/src/fltk-widgets-groups-windows-double.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Groups.Windows.Double is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Groups.Windows.Double is pragma Import (C, double_window_set_handle_hook, "double_window_set_handle_hook"); + + function new_fl_double_window (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -33,6 +40,8 @@ package body FLTK.Widgets.Groups.Windows.Double is pragma Import (C, free_fl_double_window, "free_fl_double_window"); + + procedure fl_double_window_show (W : in System.Address); pragma Import (C, fl_double_window_show, "fl_double_window_show"); @@ -45,6 +54,9 @@ package body FLTK.Widgets.Groups.Windows.Double is (W : in System.Address); pragma Import (C, fl_double_window_flush, "fl_double_window_flush"); + + + procedure fl_double_window_draw (W : in System.Address); pragma Import (C, fl_double_window_draw, "fl_double_window_draw"); @@ -96,8 +108,6 @@ package body FLTK.Widgets.Groups.Windows.Double is end Create; - - function Create (W, H : in Integer) return Double_Window is @@ -124,8 +134,6 @@ package body FLTK.Widgets.Groups.Windows.Double is end Show; - - procedure Hide (This : in out Double_Window) is begin @@ -133,8 +141,6 @@ package body FLTK.Widgets.Groups.Windows.Double is end Hide; - - procedure Flush (This : in out Double_Window) is begin @@ -151,8 +157,6 @@ package body FLTK.Widgets.Groups.Windows.Double is end Draw; - - function Handle (This : in out Double_Window; Event : in Event_Kind) diff --git a/src/fltk-widgets-groups-windows-double.ads b/src/fltk-widgets-groups-windows-double.ads index 4d06c0e..02576e1 100644 --- a/src/fltk-widgets-groups-windows-double.ads +++ b/src/fltk-widgets-groups-windows-double.ads @@ -6,33 +6,35 @@ package FLTK.Widgets.Groups.Windows.Double is type Double_Window is new Window with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Double_Window; - function Create (W, H : in Integer) return Double_Window; + + procedure Show (This : in out Double_Window); - procedure Hide (This : in out Double_Window); - procedure Flush (This : in out Double_Window); + + procedure Draw (This : in out Double_Window); - function Handle (This : in out Double_Window; Event : in Event_Kind) @@ -44,7 +46,6 @@ private type Double_Window is new Window with null record; - overriding procedure Finalize (This : in out Double_Window); diff --git a/src/fltk-widgets-groups-windows-single-menu.adb b/src/fltk-widgets-groups-windows-single-menu.adb index 9c69d9c..9c4d1f4 100644 --- a/src/fltk-widgets-groups-windows-single-menu.adb +++ b/src/fltk-widgets-groups-windows-single-menu.adb @@ -1,9 +1,14 @@ -with Interfaces.C; -with System; -use type System.Address; -use type Interfaces.C.unsigned; +with + + Interfaces.C, + System; + +use type + + System.Address, + Interfaces.C.unsigned; package body FLTK.Widgets.Groups.Windows.Single.Menu is @@ -18,6 +23,8 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is pragma Import (C, menu_window_set_handle_hook, "menu_window_set_handle_hook"); + + function new_fl_menu_window (X, Y, W, H : in Interfaces.C.int; Label : in Interfaces.C.char_array) @@ -34,6 +41,8 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is pragma Import (C, free_fl_menu_window, "free_fl_menu_window"); + + procedure fl_menu_window_show (M : in System.Address); pragma Import (C, fl_menu_window_show, "fl_menu_window_show"); @@ -46,6 +55,9 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is (M : in System.Address); pragma Import (C, fl_menu_window_flush, "fl_menu_window_flush"); + + + procedure fl_menu_window_set_overlay (M : in System.Address); pragma Import (C, fl_menu_window_set_overlay, "fl_menu_window_set_overlay"); @@ -59,6 +71,9 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is return Interfaces.C.unsigned; pragma Import (C, fl_menu_window_overlay, "fl_menu_window_overlay"); + + + procedure fl_menu_window_draw (W : in System.Address); pragma Import (C, fl_menu_window_draw, "fl_menu_window_draw"); @@ -110,8 +125,6 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is end Create; - - function Create (W, H : in Integer) return Menu_Window is @@ -138,8 +151,6 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is end Show; - - procedure Hide (This : in out Menu_Window) is begin @@ -147,8 +158,6 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is end Hide; - - procedure Flush (This : in out Menu_Window) is begin @@ -166,7 +175,6 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is end Get_Overlay; - procedure Set_Overlay (This : in out Menu_Window; Value : in Boolean) is @@ -188,8 +196,6 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is end Draw; - - function Handle (This : in out Menu_Window; Event : in Event_Kind) diff --git a/src/fltk-widgets-groups-windows-single-menu.ads b/src/fltk-widgets-groups-windows-single-menu.ads index 1934632..8f5ea00 100644 --- a/src/fltk-widgets-groups-windows-single-menu.ads +++ b/src/fltk-widgets-groups-windows-single-menu.ads @@ -6,43 +6,46 @@ package FLTK.Widgets.Groups.Windows.Single.Menu is type Menu_Window is new Single_Window with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Menu_Window; - function Create (W, H : in Integer) return Menu_Window; + + procedure Show (This : in out Menu_Window); - procedure Hide (This : in out Menu_Window); - procedure Flush (This : in out Menu_Window); + + function Get_Overlay (This : in Menu_Window) return Boolean; - procedure Set_Overlay (This : in out Menu_Window; Value : in Boolean); + + procedure Draw (This : in out Menu_Window); - function Handle (This : in out Menu_Window; Event : in Event_Kind) @@ -54,7 +57,6 @@ private type Menu_Window is new Single_Window with null record; - overriding procedure Finalize (This : in out Menu_Window); diff --git a/src/fltk-widgets-groups-windows-single.adb b/src/fltk-widgets-groups-windows-single.adb index 284e506..31b73fa 100644 --- a/src/fltk-widgets-groups-windows-single.adb +++ b/src/fltk-widgets-groups-windows-single.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Groups.Windows.Single is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Groups.Windows.Single is pragma Import (C, single_window_set_handle_hook, "single_window_set_handle_hook"); + + function new_fl_single_window (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -33,6 +40,8 @@ package body FLTK.Widgets.Groups.Windows.Single is pragma Import (C, free_fl_single_window, "free_fl_single_window"); + + procedure fl_single_window_show (S : in System.Address); pragma Import (C, fl_single_window_show, "fl_single_window_show"); @@ -41,6 +50,9 @@ package body FLTK.Widgets.Groups.Windows.Single is (S : in System.Address); pragma Import (C, fl_single_window_flush, "fl_single_window_flush"); + + + procedure fl_single_window_draw (W : in System.Address); pragma Import (C, fl_single_window_draw, "fl_single_window_draw"); @@ -92,8 +104,6 @@ package body FLTK.Widgets.Groups.Windows.Single is end Create; - - function Create (W, H : in Integer) return Single_Window is @@ -120,8 +130,6 @@ package body FLTK.Widgets.Groups.Windows.Single is end Show; - - procedure Flush (This : in out Single_Window) is begin @@ -138,8 +146,6 @@ package body FLTK.Widgets.Groups.Windows.Single is end Draw; - - function Handle (This : in out Single_Window; Event : in Event_Kind) diff --git a/src/fltk-widgets-groups-windows-single.ads b/src/fltk-widgets-groups-windows-single.ads index 442844f..4765ce7 100644 --- a/src/fltk-widgets-groups-windows-single.ads +++ b/src/fltk-widgets-groups-windows-single.ads @@ -6,29 +6,32 @@ package FLTK.Widgets.Groups.Windows.Single is type Single_Window is new Window with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Single_Window; - function Create (W, H : in Integer) return Single_Window; + + procedure Show (This : in out Single_Window); - procedure Flush (This : in out Single_Window); + + procedure Draw (This : in out Single_Window); - function Handle (This : in out Single_Window; Event : in Event_Kind) @@ -40,7 +43,6 @@ private type Single_Window is new Window with null record; - overriding procedure Finalize (This : in out Single_Window); diff --git a/src/fltk-widgets-groups-windows.adb b/src/fltk-widgets-groups-windows.adb index 97a640a..7ada504 100644 --- a/src/fltk-widgets-groups-windows.adb +++ b/src/fltk-widgets-groups-windows.adb @@ -1,9 +1,14 @@ -with Interfaces.C; -with System; -with FLTK.Images.RGB; -use type System.Address; +with + + Interfaces.C, + System, + FLTK.Images.RGB; + +use type + + System.Address; package body FLTK.Widgets.Groups.Windows is @@ -18,6 +23,8 @@ package body FLTK.Widgets.Groups.Windows is pragma Import (C, window_set_handle_hook, "window_set_handle_hook"); + + function new_fl_window (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -34,6 +41,8 @@ package body FLTK.Widgets.Groups.Windows is pragma Import (C, free_fl_window, "free_fl_window"); + + procedure fl_window_show (W : in System.Address); pragma Import (C, fl_window_show, "fl_window_show"); @@ -46,6 +55,9 @@ package body FLTK.Widgets.Groups.Windows is (W : in System.Address); pragma Import (C, fl_window_make_current, "fl_window_make_current"); + + + function fl_window_get_border (W : in System.Address) return Interfaces.C.unsigned; @@ -88,6 +100,9 @@ package body FLTK.Widgets.Groups.Windows is C : in Interfaces.C.int); pragma Import (C, fl_window_set_default_cursor, "fl_window_set_default_cursor"); + + + function fl_window_get_x_root (W : in System.Address) return Interfaces.C.int; @@ -108,6 +123,9 @@ package body FLTK.Widgets.Groups.Windows is return Interfaces.C.int; pragma Import (C, fl_window_get_decorated_h, "fl_window_get_decorated_h"); + + + procedure fl_window_draw (W : in System.Address); pragma Import (C, fl_window_draw, "fl_window_draw"); @@ -159,8 +177,6 @@ package body FLTK.Widgets.Groups.Windows is end Create; - - function Create (W, H : in Integer) return Window is @@ -187,8 +203,6 @@ package body FLTK.Widgets.Groups.Windows is end Show; - - procedure Hide (This : in out Window) is begin @@ -196,8 +210,6 @@ package body FLTK.Widgets.Groups.Windows is end Hide; - - procedure Make_Current (This : in out Window) is begin @@ -215,7 +227,6 @@ package body FLTK.Widgets.Groups.Windows is end Get_Border; - procedure Set_Border (This : in out Window; To : in Border_State) is @@ -224,8 +235,6 @@ package body FLTK.Widgets.Groups.Windows is end Set_Border; - - procedure Set_Label (This : in out Window; Text : in String) is @@ -234,8 +243,6 @@ package body FLTK.Widgets.Groups.Windows is end Set_Label; - - procedure Set_Size_Range (This : in out Window; Min_W, Min_H : in Integer; @@ -254,8 +261,6 @@ package body FLTK.Widgets.Groups.Windows is end Set_Size_Range; - - procedure Set_Icon (This : in out Window; Pic : in out FLTK.Images.RGB.RGB_Image'Class) is @@ -266,8 +271,6 @@ package body FLTK.Widgets.Groups.Windows is end Set_Icon; - - procedure Set_Modal (This : in out Window) is begin @@ -275,8 +278,6 @@ package body FLTK.Widgets.Groups.Windows is end Set_Modal; - - procedure Set_Non_Modal (This : in out Window) is begin @@ -284,8 +285,6 @@ package body FLTK.Widgets.Groups.Windows is end Set_Non_Modal; - - procedure Set_Cursor (This : in out Window; To : in Cursor) is @@ -294,8 +293,6 @@ package body FLTK.Widgets.Groups.Windows is end Set_Cursor; - - procedure Set_Default_Cursor (This : in out Window; To : in Cursor) is @@ -314,8 +311,6 @@ package body FLTK.Widgets.Groups.Windows is end Get_X_Root; - - function Get_Y_Root (This : in Window) return Integer is @@ -324,8 +319,6 @@ package body FLTK.Widgets.Groups.Windows is end Get_Y_Root; - - function Get_Decorated_W (This : in Window) return Integer is @@ -334,8 +327,6 @@ package body FLTK.Widgets.Groups.Windows is end Get_Decorated_W; - - function Get_Decorated_H (This : in Window) return Integer is @@ -353,8 +344,6 @@ package body FLTK.Widgets.Groups.Windows is end Draw; - - function Handle (This : in out Window; Event : in Event_Kind) diff --git a/src/fltk-widgets-groups-windows.ads b/src/fltk-widgets-groups-windows.ads index d132cbf..9d1cefc 100644 --- a/src/fltk-widgets-groups-windows.ads +++ b/src/fltk-widgets-groups-windows.ads @@ -1,7 +1,12 @@ -with FLTK.Images.RGB; -private with Interfaces.C; +with + + FLTK.Images.RGB; + +private with + + Interfaces.C; package FLTK.Widgets.Groups.Windows is @@ -9,10 +14,8 @@ package FLTK.Widgets.Groups.Windows is type Window is new Group with private; - type Border_State is (None, Visible); - type Cursor is (Default, Arrow, Crosshair, Wait, Insert, Hand, Help, Move, @@ -21,98 +24,93 @@ package FLTK.Widgets.Groups.Windows is None); + + function Create (X, Y, W, H : in Integer; Text : in String) return Window; - function Create (W, H : in Integer) return Window; + + procedure Show (This : in out Window); - procedure Hide (This : in out Window); - procedure Make_Current (This : in out Window); + + function Get_Border (This : in Window) return Border_State; - procedure Set_Border (This : in out Window; To : in Border_State); - procedure Set_Label (This : in out Window; Text : in String); - procedure Set_Size_Range (This : in out Window; Min_W, Min_H : in Integer; Max_W, Max_H, Incre_W, Incre_H : in Integer := 0; Keep_Aspect : in Boolean := False); - procedure Set_Icon (This : in out Window; Pic : in out FLTK.Images.RGB.RGB_Image'Class); - procedure Set_Modal (This : in out Window); - procedure Set_Non_Modal (This : in out Window); - procedure Set_Cursor (This : in out Window; To : in Cursor); - procedure Set_Default_Cursor (This : in out Window; To : in Cursor); + + function Get_X_Root (This : in Window) return Integer; - function Get_Y_Root (This : in Window) return Integer; - function Get_Decorated_W (This : in Window) return Integer; - function Get_Decorated_H (This : in Window) return Integer; + + procedure Draw (This : in out Window); - function Handle (This : in out Window; Event : in Event_Kind) @@ -124,11 +122,12 @@ private type Window is new Group with null record; - overriding procedure Finalize (This : in out Window); + + -- What delightful magic numbers FLTK cursors are! -- (These correspond to the enum found in Enumerations.H) Cursor_Values : array (Cursor) of Interfaces.C.int := diff --git a/src/fltk-widgets-groups.adb b/src/fltk-widgets-groups.adb index d5b8197..5d21d1f 100644 --- a/src/fltk-widgets-groups.adb +++ b/src/fltk-widgets-groups.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Groups is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Groups is pragma Import (C, group_set_handle_hook, "group_set_handle_hook"); + + function new_fl_group (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,19 +35,12 @@ package body FLTK.Widgets.Groups is pragma Import (C, free_fl_group, "free_fl_group"); + + procedure fl_group_add (G, W : in System.Address); pragma Import (C, fl_group_add, "fl_group_add"); - function fl_group_find - (G, W : in System.Address) - return Interfaces.C.int; - pragma Import (C, fl_group_find, "fl_group_find"); - - procedure fl_group_init_sizes - (G : in System.Address); - pragma Import (C, fl_group_init_sizes, "fl_group_init_sizes"); - procedure fl_group_insert (G, W : in System.Address; P : in Interfaces.C.int); @@ -59,10 +59,8 @@ package body FLTK.Widgets.Groups is P : in Interfaces.C.int); pragma Import (C, fl_group_remove2, "fl_group_remove2"); - function fl_group_children - (G : in System.Address) - return Interfaces.C.int; - pragma Import (C, fl_group_children, "fl_group_children"); + + function fl_group_child (G : in System.Address; @@ -70,15 +68,31 @@ package body FLTK.Widgets.Groups is return System.Address; pragma Import (C, fl_group_child, "fl_group_child"); - function fl_group_get_clip_children + function fl_group_find + (G, W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_group_find, "fl_group_find"); + + function fl_group_children (G : in System.Address) - return Interfaces.C.unsigned; - pragma Import (C, fl_group_get_clip_children, "fl_group_get_clip_children"); + return Interfaces.C.int; + pragma Import (C, fl_group_children, "fl_group_children"); + + + + + -- function fl_group_get_clip_children + -- (G : in System.Address) + -- return Interfaces.C.unsigned; + -- pragma Import (C, fl_group_get_clip_children, "fl_group_get_clip_children"); + + -- procedure fl_group_set_clip_children + -- (G : in System.Address; + -- C : in Interfaces.C.unsigned); + -- pragma Import (C, fl_group_set_clip_children, "fl_group_set_clip_children"); + + - procedure fl_group_set_clip_children - (G : in System.Address; - C : in Interfaces.C.unsigned); - pragma Import (C, fl_group_set_clip_children, "fl_group_set_clip_children"); function fl_group_get_resizable (G : in System.Address) @@ -89,6 +103,13 @@ package body FLTK.Widgets.Groups is (G, W : in System.Address); pragma Import (C, fl_group_set_resizable, "fl_group_set_resizable"); + procedure fl_group_init_sizes + (G : in System.Address); + pragma Import (C, fl_group_init_sizes, "fl_group_init_sizes"); + + + + procedure fl_group_draw (W : in System.Address); pragma Import (C, fl_group_draw, "fl_group_draw"); @@ -150,6 +171,55 @@ package body FLTK.Widgets.Groups is end Add; + procedure Insert + (This : in out Group; + Item : in out Widget'Class; + Place : in Index) is + begin + fl_group_insert + (This.Void_Ptr, + Item.Void_Ptr, + Interfaces.C.int (Place)); + end Insert; + + + procedure Insert + (This : in out Group; + Item : in out Widget'Class; + Before : in Widget'Class) is + begin + fl_group_insert2 + (This.Void_Ptr, + Item.Void_Ptr, + Before.Void_Ptr); + end Insert; + + + procedure Remove + (This : in out Group; + Item : in out Widget'Class) is + begin + fl_group_remove (This.Void_Ptr, Item.Void_Ptr); + end Remove; + + + procedure Remove + (This : in out Group; + Place : in Index) is + begin + fl_group_remove2 (This.Void_Ptr, Interfaces.C.int (Place - 1)); + end Remove; + + + procedure Clear + (This : in out Group) is + begin + for I in reverse 1 .. This.Number_Of_Children loop + This.Remove (Index (I)); + end loop; + end Clear; + + function Child @@ -167,6 +237,14 @@ package body FLTK.Widgets.Groups is end Child; + function Find + (This : in Group; + Item : in out Widget'Class) + return Index is + begin + -- should set this up to throw an exception if not found + return Index (fl_group_find (This.Void_Ptr, Item.Void_Ptr)); + end Find; function Number_Of_Children @@ -187,8 +265,6 @@ package body FLTK.Widgets.Groups is -- end Get_Clip_Mode; - - -- procedure Set_Clip_Mode -- (This : in out Group; -- Mode : in Clip_Mode) is @@ -199,86 +275,6 @@ package body FLTK.Widgets.Groups is - procedure Clear - (This : in out Group) is - begin - for I in reverse 1 .. This.Number_Of_Children loop - This.Remove (Index (I)); - end loop; - end Clear; - - - - - function Find - (This : in Group; - Item : in out Widget'Class) - return Index is - begin - -- should set this up to throw an exception if not found - return Index (fl_group_find (This.Void_Ptr, Item.Void_Ptr)); - end Find; - - - - - procedure Reset_Initial_Sizes - (This : in out Group) is - begin - fl_group_init_sizes (This.Void_Ptr); - end Reset_Initial_Sizes; - - - - - procedure Insert - (This : in out Group; - Item : in out Widget'Class; - Place : in Index) is - begin - fl_group_insert - (This.Void_Ptr, - Item.Void_Ptr, - Interfaces.C.int (Place)); - end Insert; - - - - - procedure Insert - (This : in out Group; - Item : in out Widget'Class; - Before : in Widget'Class) is - begin - fl_group_insert2 - (This.Void_Ptr, - Item.Void_Ptr, - Before.Void_Ptr); - end Insert; - - - - - procedure Remove - (This : in out Group; - Item : in out Widget'Class) is - begin - fl_group_remove (This.Void_Ptr, Item.Void_Ptr); - end Remove; - - - - - procedure Remove - (This : in out Group; - Place : in Index) is - begin - fl_group_remove2 (This.Void_Ptr, Interfaces.C.int (Place - 1)); - end Remove; - - - - function Get_Resizable (This : in Group) return access Widget'Class @@ -293,8 +289,6 @@ package body FLTK.Widgets.Groups is end Get_Resizable; - - procedure Set_Resizable (This : in out Group; Item : in Widget'Class) is @@ -303,6 +297,13 @@ package body FLTK.Widgets.Groups is end Set_Resizable; + procedure Reset_Initial_Sizes + (This : in out Group) is + begin + fl_group_init_sizes (This.Void_Ptr); + end Reset_Initial_Sizes; + + procedure Draw @@ -312,8 +313,6 @@ package body FLTK.Widgets.Groups is end Draw; - - function Handle (This : in out Group; Event : in Event_Kind) diff --git a/src/fltk-widgets-groups.ads b/src/fltk-widgets-groups.ads index d7fbdb5..eeeb564 100644 --- a/src/fltk-widgets-groups.ads +++ b/src/fltk-widgets-groups.ads @@ -1,6 +1,8 @@ -private with System; +private with + + System; package FLTK.Widgets.Groups is @@ -8,93 +10,93 @@ package FLTK.Widgets.Groups is type Group is new Widget with private; - type Index is new Positive; -- type Clip_Mode is (No_Clip, Clip); + + function Create (X, Y, W, H : in Integer; Text : in String) return Group; + + procedure Add (This : in out Group; Item : in out Widget'Class); + procedure Insert + (This : in out Group; + Item : in out Widget'Class; + Place : in Index); - function Child - (This : in Group; - Place : in Index) - return access Widget'Class; - - - function Number_Of_Children - (This : in Group) - return Natural; + procedure Insert + (This : in out Group; + Item : in out Widget'Class; + Before : in Widget'Class); + procedure Remove + (This : in out Group; + Item : in out Widget'Class); - -- function Get_Clip_Mode - -- (This : in Group) - -- return Clip_Mode; + procedure Remove + (This : in out Group; + Place : in Index); + procedure Clear + (This : in out Group); - -- procedure Set_Clip_Mode - -- (This : in out Group; - -- Mode : in Clip_Mode); - procedure Clear - (This : in out Group); + function Child + (This : in Group; + Place : in Index) + return access Widget'Class; function Find (This : in Group; Item : in out Widget'Class) return Index; + function Number_Of_Children + (This : in Group) + return Natural; - procedure Reset_Initial_Sizes - (This : in out Group); - - - procedure Insert - (This : in out Group; - Item : in out Widget'Class; - Place : in Index); - procedure Insert - (This : in out Group; - Item : in out Widget'Class; - Before : in Widget'Class); + -- function Get_Clip_Mode + -- (This : in Group) + -- return Clip_Mode; - procedure Remove - (This : in out Group; - Item : in out Widget'Class); + -- procedure Set_Clip_Mode + -- (This : in out Group; + -- Mode : in Clip_Mode); - procedure Remove - (This : in out Group; - Place : in Index); function Get_Resizable (This : in Group) return access Widget'Class; - procedure Set_Resizable (This : in out Group; Item : in Widget'Class); + procedure Reset_Initial_Sizes + (This : in out Group); + + + procedure Draw (This : in out Group); - function Handle (This : in out Group; Event : in Event_Kind) @@ -106,11 +108,12 @@ private type Group is new Widget with null record; - overriding procedure Finalize (This : in out Group); + + procedure fl_group_end (G : in System.Address); pragma Import (C, fl_group_end, "fl_group_end"); diff --git a/src/fltk-widgets-inputs-file.adb b/src/fltk-widgets-inputs-file.adb index 187ec8d..7f9d6ad 100644 --- a/src/fltk-widgets-inputs-file.adb +++ b/src/fltk-widgets-inputs-file.adb @@ -1,8 +1,13 @@ -with Interfaces.C.Strings; -with System; -use type System.Address; +with + + Interfaces.C.Strings, + System; + +use type + + System.Address; package body FLTK.Widgets.Inputs.File is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Inputs.File is pragma Import (C, file_input_set_handle_hook, "file_input_set_handle_hook"); + + function new_fl_file_input (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Inputs.File is pragma Import (C, free_fl_file_input, "free_fl_file_input"); + + procedure fl_file_input_draw (W : in System.Address); pragma Import (C, fl_file_input_draw, "fl_file_input_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Inputs.File is end Draw; - - function Handle (This : in out File_Input; Event : in Event_Kind) diff --git a/src/fltk-widgets-inputs-file.ads b/src/fltk-widgets-inputs-file.ads index 9d7ef8a..87d42bf 100644 --- a/src/fltk-widgets-inputs-file.ads +++ b/src/fltk-widgets-inputs-file.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Inputs.File is type File_Input is new Input with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return File_Input; + + procedure Draw (This : in out File_Input); - function Handle (This : in out File_Input; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type File_Input is new Input with null record; - overriding procedure Finalize (This : in out File_Input); diff --git a/src/fltk-widgets-inputs-float.adb b/src/fltk-widgets-inputs-float.adb index 6115939..02f491f 100644 --- a/src/fltk-widgets-inputs-float.adb +++ b/src/fltk-widgets-inputs-float.adb @@ -1,8 +1,13 @@ -with Interfaces.C.Strings; -with System; -use type System.Address; +with + + Interfaces.C.Strings, + System; + +use type + + System.Address; package body FLTK.Widgets.Inputs.Float is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Inputs.Float is pragma Import (C, float_input_set_handle_hook, "float_input_set_handle_hook"); + + function new_fl_float_input (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Inputs.Float is pragma Import (C, free_fl_float_input, "free_fl_float_input"); + + procedure fl_float_input_draw (W : in System.Address); pragma Import (C, fl_float_input_draw, "fl_float_input_draw"); @@ -97,8 +106,6 @@ package body FLTK.Widgets.Inputs.Float is end Draw; - - function Handle (This : in out Float_Input; Event : in Event_Kind) diff --git a/src/fltk-widgets-inputs-float.ads b/src/fltk-widgets-inputs-float.ads index 09d3a0f..68c07f4 100644 --- a/src/fltk-widgets-inputs-float.ads +++ b/src/fltk-widgets-inputs-float.ads @@ -6,21 +6,26 @@ package FLTK.Widgets.Inputs.Float is type Float_Input is new Input with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Float_Input; + + function Get_Value (This : in Float_Input) return Standard.Float; + + procedure Draw (This : in out Float_Input); - function Handle (This : in out Float_Input; Event : in Event_Kind) @@ -32,7 +37,6 @@ private type Float_Input is new Input with null record; - overriding procedure Finalize (This : in out Float_Input); diff --git a/src/fltk-widgets-inputs-integer.adb b/src/fltk-widgets-inputs-integer.adb index f0fb7b9..b9b4eff 100644 --- a/src/fltk-widgets-inputs-integer.adb +++ b/src/fltk-widgets-inputs-integer.adb @@ -1,8 +1,13 @@ -with Interfaces.C.Strings; -with System; -use type System.Address; +with + + Interfaces.C.Strings, + System; + +use type + + System.Address; package body FLTK.Widgets.Inputs.Integer is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Inputs.Integer is pragma Import (C, int_input_set_handle_hook, "int_input_set_handle_hook"); + + function new_fl_int_input (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Inputs.Integer is pragma Import (C, free_fl_int_input, "free_fl_int_input"); + + procedure fl_int_input_draw (W : in System.Address); pragma Import (C, fl_int_input_draw, "fl_int_input_draw"); @@ -97,8 +106,6 @@ package body FLTK.Widgets.Inputs.Integer is end Draw; - - function Handle (This : in out Integer_Input; Event : in Event_Kind) diff --git a/src/fltk-widgets-inputs-integer.ads b/src/fltk-widgets-inputs-integer.ads index f8ed415..c32615b 100644 --- a/src/fltk-widgets-inputs-integer.ads +++ b/src/fltk-widgets-inputs-integer.ads @@ -6,21 +6,26 @@ package FLTK.Widgets.Inputs.Integer is type Integer_Input is new Input with private; + + function Create (X, Y, W, H : in Standard.Integer; Text : in String) return Integer_Input; + + function Get_Value (This : in Integer_Input) return Standard.Integer; + + procedure Draw (This : in out Integer_Input); - function Handle (This : in out Integer_Input; Event : in Event_Kind) @@ -32,7 +37,6 @@ private type Integer_Input is new Input with null record; - overriding procedure Finalize (This : in out Integer_Input); diff --git a/src/fltk-widgets-inputs-multiline.adb b/src/fltk-widgets-inputs-multiline.adb index 957af65..e36414d 100644 --- a/src/fltk-widgets-inputs-multiline.adb +++ b/src/fltk-widgets-inputs-multiline.adb @@ -1,8 +1,13 @@ -with Interfaces.C.Strings; -with System; -use type System.Address; +with + + Interfaces.C.Strings, + System; + +use type + + System.Address; package body FLTK.Widgets.Inputs.Multiline is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Inputs.Multiline is pragma Import (C, multiline_input_set_handle_hook, "multiline_input_set_handle_hook"); + + function new_fl_multiline_input (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Inputs.Multiline is pragma Import (C, free_fl_multiline_input, "free_fl_multiline_input"); + + procedure fl_multiline_input_draw (W : in System.Address); pragma Import (C, fl_multiline_input_draw, "fl_multiline_input_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Inputs.Multiline is end Draw; - - function Handle (This : in out Multiline_Input; Event : in Event_Kind) diff --git a/src/fltk-widgets-inputs-multiline.ads b/src/fltk-widgets-inputs-multiline.ads index 69382ca..f9ba49b 100644 --- a/src/fltk-widgets-inputs-multiline.ads +++ b/src/fltk-widgets-inputs-multiline.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Inputs.Multiline is type Multiline_Input is new Input with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Multiline_Input; + + procedure Draw (This : in out Multiline_Input); - function Handle (This : in out Multiline_Input; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type Multiline_Input is new Input with null record; - overriding procedure Finalize (This : in out Multiline_Input); diff --git a/src/fltk-widgets-inputs-outputs-multiline.adb b/src/fltk-widgets-inputs-outputs-multiline.adb index 48a0411..41748ff 100644 --- a/src/fltk-widgets-inputs-outputs-multiline.adb +++ b/src/fltk-widgets-inputs-outputs-multiline.adb @@ -1,8 +1,13 @@ -with Interfaces.C.Strings; -with System; -use type System.Address; +with + + Interfaces.C.Strings, + System; + +use type + + System.Address; package body FLTK.Widgets.Inputs.Outputs.Multiline is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Inputs.Outputs.Multiline is pragma Import (C, multiline_output_set_handle_hook, "multiline_output_set_handle_hook"); + + function new_fl_multiline_output (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Inputs.Outputs.Multiline is pragma Import (C, free_fl_multiline_output, "free_fl_multiline_output"); + + procedure fl_multiline_output_draw (W : in System.Address); pragma Import (C, fl_multiline_output_draw, "fl_multiline_output_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Inputs.Outputs.Multiline is end Draw; - - function Handle (This : in out Multiline_Output; Event : in Event_Kind) diff --git a/src/fltk-widgets-inputs-outputs-multiline.ads b/src/fltk-widgets-inputs-outputs-multiline.ads index 38f36e9..4d53fa0 100644 --- a/src/fltk-widgets-inputs-outputs-multiline.ads +++ b/src/fltk-widgets-inputs-outputs-multiline.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Inputs.Outputs.Multiline is type Multiline_Output is new Output with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Multiline_Output; + + procedure Draw (This : in out Multiline_Output); - function Handle (This : in out Multiline_Output; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type Multiline_Output is new Output with null record; - overriding procedure Finalize (This : in out Multiline_Output); diff --git a/src/fltk-widgets-inputs-outputs.adb b/src/fltk-widgets-inputs-outputs.adb index b1eb353..8db5671 100644 --- a/src/fltk-widgets-inputs-outputs.adb +++ b/src/fltk-widgets-inputs-outputs.adb @@ -1,8 +1,13 @@ -with Interfaces.C.Strings; -with System; -use type System.Address; +with + + Interfaces.C.Strings, + System; + +use type + + System.Address; package body FLTK.Widgets.Inputs.Outputs is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Inputs.Outputs is pragma Import (C, output_set_handle_hook, "output_set_handle_hook"); + + function new_fl_output (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Inputs.Outputs is pragma Import (C, free_fl_output, "free_fl_output"); + + procedure fl_output_draw (W : in System.Address); pragma Import (C, fl_output_draw, "fl_output_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Inputs.Outputs is end Draw; - - function Handle (This : in out Output; Event : in Event_Kind) diff --git a/src/fltk-widgets-inputs-outputs.ads b/src/fltk-widgets-inputs-outputs.ads index 13ef279..677c746 100644 --- a/src/fltk-widgets-inputs-outputs.ads +++ b/src/fltk-widgets-inputs-outputs.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Inputs.Outputs is type Output is new Input with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Output; + + procedure Draw (This : in out Output); - function Handle (This : in out Output; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type Output is new Input with null record; - overriding procedure Finalize (This : in out Output); diff --git a/src/fltk-widgets-inputs-secret.adb b/src/fltk-widgets-inputs-secret.adb index eb2bec4..ba04668 100644 --- a/src/fltk-widgets-inputs-secret.adb +++ b/src/fltk-widgets-inputs-secret.adb @@ -1,8 +1,13 @@ -with Interfaces.C.Strings; -with System; -use type System.Address; +with + + Interfaces.C.Strings, + System; + +use type + + System.Address; package body FLTK.Widgets.Inputs.Secret is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Inputs.Secret is pragma Import (C, secret_input_set_handle_hook, "secret_input_set_handle_hook"); + + function new_fl_secret_input (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Inputs.Secret is pragma Import (C, free_fl_secret_input, "free_fl_secret_input"); + + procedure fl_secret_input_draw (W : in System.Address); pragma Import (C, fl_secret_input_draw, "fl_secret_input_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Inputs.Secret is end Draw; - - function Handle (This : in out Secret_Input; Event : in Event_Kind) diff --git a/src/fltk-widgets-inputs-secret.ads b/src/fltk-widgets-inputs-secret.ads index 3fe7ae1..142cfcc 100644 --- a/src/fltk-widgets-inputs-secret.ads +++ b/src/fltk-widgets-inputs-secret.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Inputs.Secret is type Secret_Input is new Input with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Secret_Input; + + procedure Draw (This : in out Secret_Input); - function Handle (This : in out Secret_Input; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type Secret_Input is new Input with null record; - overriding procedure Finalize (This : in out Secret_Input); diff --git a/src/fltk-widgets-inputs.adb b/src/fltk-widgets-inputs.adb index 479d82e..633ede7 100644 --- a/src/fltk-widgets-inputs.adb +++ b/src/fltk-widgets-inputs.adb @@ -1,9 +1,13 @@ -with Interfaces.C; -with Interfaces.C.Strings; -with System; -use type System.Address; +with + + Interfaces.C.Strings, + System; + +use type + + System.Address; package body FLTK.Widgets.Inputs is @@ -18,6 +22,8 @@ package body FLTK.Widgets.Inputs is pragma Import (C, input_set_handle_hook, "input_set_handle_hook"); + + function new_fl_input (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -29,6 +35,8 @@ package body FLTK.Widgets.Inputs is pragma Import (C, free_fl_input, "free_fl_input"); + + procedure fl_input_draw (W : in System.Address); pragma Import (C, fl_input_draw, "fl_input_draw"); @@ -97,8 +105,6 @@ package body FLTK.Widgets.Inputs is end Draw; - - function Handle (This : in out Input; Event : in Event_Kind) diff --git a/src/fltk-widgets-inputs.ads b/src/fltk-widgets-inputs.ads index 90d6bb5..9f69795 100644 --- a/src/fltk-widgets-inputs.ads +++ b/src/fltk-widgets-inputs.ads @@ -1,7 +1,9 @@ -private with Interfaces.C.Strings; -private with System; +private with + + Interfaces.C.Strings, + System; package FLTK.Widgets.Inputs is @@ -10,21 +12,26 @@ package FLTK.Widgets.Inputs is type Input is new Widget with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Input; + + function Get_Value (This : in Input) return String; + + procedure Draw (This : in out Input); - function Handle (This : in out Input; Event : in Event_Kind) @@ -36,11 +43,12 @@ private type Input is new Widget with null record; - overriding procedure Finalize (This : in out Input); + + function fl_input_get_value (F : in System.Address) return Interfaces.C.Strings.chars_ptr; diff --git a/src/fltk-widgets-menus-menu_bars.adb b/src/fltk-widgets-menus-menu_bars.adb index f7993e1..c21e6e9 100644 --- a/src/fltk-widgets-menus-menu_bars.adb +++ b/src/fltk-widgets-menus-menu_bars.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Menus.Menu_Bars is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Menus.Menu_Bars is pragma Import (C, menu_bar_set_handle_hook, "menu_bar_set_handle_hook"); + + function new_fl_menu_bar (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,6 +35,8 @@ package body FLTK.Widgets.Menus.Menu_Bars is pragma Import (C, free_fl_menu_bar, "free_fl_menu_bar"); + + procedure fl_menu_bar_draw (W : in System.Address); pragma Import (C, fl_menu_bar_draw, "fl_menu_bar_draw"); @@ -86,8 +95,6 @@ package body FLTK.Widgets.Menus.Menu_Bars is end Draw; - - function Handle (This : in out Menu_Bar; Event : in Event_Kind) diff --git a/src/fltk-widgets-menus-menu_bars.ads b/src/fltk-widgets-menus-menu_bars.ads index c5b20fe..d273b75 100644 --- a/src/fltk-widgets-menus-menu_bars.ads +++ b/src/fltk-widgets-menus-menu_bars.ads @@ -6,16 +6,19 @@ package FLTK.Widgets.Menus.Menu_Bars is type Menu_Bar is new Menu with private; + + function Create (X, Y, W, H : in Integer; Text : in String) return Menu_Bar; + + procedure Draw (This : in out Menu_Bar); - function Handle (This : in out Menu_Bar; Event : in Event_Kind) @@ -27,7 +30,6 @@ private type Menu_Bar is new Menu with null record; - overriding procedure Finalize (This : in out Menu_Bar); diff --git a/src/fltk-widgets-menus-menu_buttons.adb b/src/fltk-widgets-menus-menu_buttons.adb index 7bdb32d..947147d 100644 --- a/src/fltk-widgets-menus-menu_buttons.adb +++ b/src/fltk-widgets-menus-menu_buttons.adb @@ -1,8 +1,13 @@ -with Interfaces.C; -with System; -use type System.Address; +with + + Interfaces.C, + System; + +use type + + System.Address; package body FLTK.Widgets.Menus.Menu_Buttons is @@ -17,6 +22,8 @@ package body FLTK.Widgets.Menus.Menu_Buttons is pragma Import (C, menu_button_set_handle_hook, "menu_button_set_handle_hook"); + + function new_fl_menu_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -28,11 +35,16 @@ package body FLTK.Widgets.Menus.Menu_Buttons is pragma Import (C, free_fl_menu_button, "free_fl_menu_button"); + + procedure fl_menu_button_type (M : in System.Address; T : in Interfaces.C.unsigned); pragma Import (C, fl_menu_button_type, "fl_menu_button_type"); + + + procedure fl_menu_button_draw (W : in System.Address); pragma Import (C, fl_menu_button_draw, "fl_menu_button_draw"); @@ -101,8 +113,6 @@ package body FLTK.Widgets.Menus.Menu_Buttons is end Draw; - - function Handle (This : in out Menu_Button; Event : in Event_Kind) diff --git a/src/fltk-widgets-menus-menu_buttons.ads b/src/fltk-widgets-menus-menu_buttons.ads index 174019a..47b1e1c 100644 --- a/src/fltk-widgets-menus-menu_buttons.ads +++ b/src/fltk-widgets-menus-menu_buttons.ads @@ -5,26 +5,30 @@ package FLTK.Widgets.Menus.Menu_Buttons is type Menu_Button is new Menu with private; - -- signifies which mouse buttons cause the menu to appear type Popup_Buttons is (No_Popup, Popup1, Popup2, Popup12, Popup3, Popup13, Popup23, Popup123); + + function Create (X, Y, W, H : in Integer; Text : in String) return Menu_Button; + + procedure Set_Popup_Kind (This : in out Menu_Button; Pop : in Popup_Buttons); + + procedure Draw (This : in out Menu_Button); - function Handle (This : in out Menu_Button; Event : in Event_Kind) @@ -36,7 +40,6 @@ private type Menu_Button is new Menu with null record; - overriding procedure Finalize (This : in out Menu_Button); diff --git a/src/fltk-widgets-menus.adb b/src/fltk-widgets-menus.adb index d0c0ed7..ddfc934 100644 --- a/src/fltk-widgets-menus.adb +++ b/src/fltk-widgets-menus.adb @@ -1,11 +1,16 @@ -with Interfaces.C; -with System; -with FLTK.Menu_Items; -use type System.Address; -use type Interfaces.C.int; -use type Interfaces.C.unsigned_long; +with + + Interfaces.C, + System, + FLTK.Menu_Items; + +use type + + System.Address, + Interfaces.C.int, + Interfaces.C.unsigned_long; package body FLTK.Widgets.Menus is @@ -30,6 +35,8 @@ package body FLTK.Widgets.Menus is pragma Import (C, menu_set_handle_hook, "menu_set_handle_hook"); + + function new_fl_menu (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -41,6 +48,8 @@ package body FLTK.Widgets.Menus is pragma Import (C, free_fl_menu, "free_fl_menu"); + + function fl_menu_add (M : in System.Address; T : in Interfaces.C.char_array; @@ -143,8 +152,6 @@ package body FLTK.Widgets.Menus is end Add; - - function Find_Item (This : in Menu'Class; Name : in String) @@ -158,8 +165,6 @@ package body FLTK.Widgets.Menus is end Find_Item; - - function Chosen (This : in Menu'Class) return FLTK.Menu_Items.Menu_Item is diff --git a/src/fltk-widgets-menus.ads b/src/fltk-widgets-menus.ads index 706d188..ddd8c51 100644 --- a/src/fltk-widgets-menus.ads +++ b/src/fltk-widgets-menus.ads @@ -1,8 +1,13 @@ -private with Interfaces; -private with System; -with FLTK.Menu_Items; +with + + FLTK.Menu_Items; + +private with + + Interfaces, + System; package FLTK.Widgets.Menus is @@ -10,14 +15,11 @@ package FLTK.Widgets.Menus is type Menu is new Widget with private; - type Menu_Cursor (Data : access Menu'Class) is limited null record with Implicit_Dereference => Data; - type Index is new Positive; - type Menu_Flag is private; function "+" (Left, Right : in Menu_Flag) return Menu_Flag; Flag_Normal : constant Menu_Flag; @@ -30,12 +32,16 @@ package FLTK.Widgets.Menus is Flag_Divider : constant Menu_Flag; + + function Create (X, Y, W, H : in Integer; Text : in String) return Menu; + + procedure Add (This : in out Menu; Text : in String; @@ -43,22 +49,21 @@ package FLTK.Widgets.Menus is Shortcut : in Shortcut_Key := No_Key; Flags : in Menu_Flag := Flag_Normal); - function Find_Item (This : in Menu'Class; Name : in String) return FLTK.Menu_Items.Menu_Item; - function Chosen (This : in Menu'Class) return FLTK.Menu_Items.Menu_Item; + + procedure Draw (This : in out Menu) is null; - function Handle (This : in out Menu; Event : in Event_Kind) @@ -70,13 +75,16 @@ private type Menu is new Widget with null record; + overriding procedure Finalize + (This : in out Menu); + + + procedure Item_Hook (M, U : in System.Address); pragma Convention (C, Item_Hook); - overriding procedure Finalize - (This : in out Menu); type Menu_Flag is new Interfaces.Unsigned_8; diff --git a/src/fltk-widgets.adb b/src/fltk-widgets.adb index dfb0c9c..8d6bec2 100644 --- a/src/fltk-widgets.adb +++ b/src/fltk-widgets.adb @@ -1,14 +1,17 @@ -with Interfaces.C; -with Interfaces.C.Strings; -with System; -with System.Address_To_Access_Conversions; -with FLTK.Widgets.Groups; -with FLTK.Images; -use type Interfaces.C.int; -use type Interfaces.C.unsigned; -use type System.Address; +with + + Interfaces.C.Strings, + System.Address_To_Access_Conversions, + FLTK.Widgets.Groups, + FLTK.Images; + +use type + + Interfaces.C.int, + Interfaces.C.unsigned, + System.Address; package body FLTK.Widgets is @@ -29,6 +32,8 @@ package body FLTK.Widgets is pragma Import (C, widget_set_handle_hook, "widget_set_handle_hook"); + + function new_fl_widget (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) @@ -40,6 +45,8 @@ package body FLTK.Widgets is pragma Import (C, free_fl_widget, "free_fl_widget"); + + procedure fl_widget_activate (W : in System.Address); pragma Import (C, fl_widget_activate, "fl_widget_activate"); @@ -62,6 +69,9 @@ package body FLTK.Widgets is (W : in System.Address); pragma Import (C, fl_widget_clear_active, "fl_widget_clear_active"); + + + function fl_widget_changed (W : in System.Address) return Interfaces.C.unsigned; @@ -71,6 +81,9 @@ package body FLTK.Widgets is (W : in System.Address); pragma Import (C, fl_widget_clear_changed, "fl_widget_clear_changed"); + + + function fl_widget_get_parent (W : in System.Address) return System.Address; @@ -81,6 +94,9 @@ package body FLTK.Widgets is return Interfaces.C.int; pragma Import (C, fl_widget_contains, "fl_widget_contains"); + + + function fl_widget_get_align (W : in System.Address) return Interfaces.C.unsigned; @@ -145,6 +161,9 @@ package body FLTK.Widgets is (W, C : in System.Address); pragma Import (C, fl_widget_set_callback, "fl_widget_set_callback"); + + + function fl_widget_get_x (W : in System.Address) return Interfaces.C.int; @@ -175,6 +194,9 @@ package body FLTK.Widgets is X, Y : in Interfaces.C.int); pragma Import (C, fl_widget_position, "fl_widget_position"); + + + procedure fl_widget_set_image (W, I : in System.Address); pragma Import (C, fl_widget_set_image, "fl_widget_set_image"); @@ -192,8 +214,6 @@ package body FLTK.Widgets is end Callback_Hook; - - procedure Draw_Hook (U : in System.Address) is @@ -204,8 +224,6 @@ package body FLTK.Widgets is end Draw_Hook; - - function Handle_Hook (U : in System.Address; E : in Interfaces.C.int) @@ -264,8 +282,6 @@ package body FLTK.Widgets is end Activate; - - procedure Deactivate (This : in out Widget) is begin @@ -273,8 +289,6 @@ package body FLTK.Widgets is end Deactivate; - - function Is_Active (This : in Widget) return Boolean is @@ -283,8 +297,6 @@ package body FLTK.Widgets is end Is_Active; - - function Is_Tree_Active (This : in Widget) return Boolean is @@ -293,8 +305,6 @@ package body FLTK.Widgets is end Is_Tree_Active; - - procedure Clear_Active (This : in out Widget) is begin @@ -312,8 +322,6 @@ package body FLTK.Widgets is end Has_Changed; - - procedure Clear_Changed (This : in out Widget) is begin @@ -338,8 +346,6 @@ package body FLTK.Widgets is end Parent; - - function Contains (This : in Widget; Item : in Widget'Class) @@ -359,8 +365,6 @@ package body FLTK.Widgets is end Get_Alignment; - - procedure Set_Alignment (This : in out Widget; New_Align : in Alignment) is @@ -369,8 +373,6 @@ package body FLTK.Widgets is end Set_Alignment; - - function Get_Box (This : in Widget) return Box_Kind is @@ -379,8 +381,6 @@ package body FLTK.Widgets is end Get_Box; - - procedure Set_Box (This : in out Widget; Box : in Box_Kind) is @@ -389,8 +389,6 @@ package body FLTK.Widgets is end Set_Box; - - function Get_Label (This : in out Widget) return String is @@ -399,8 +397,6 @@ package body FLTK.Widgets is end Get_Label; - - procedure Set_Label (This : in out Widget; Text : in String) is @@ -409,8 +405,6 @@ package body FLTK.Widgets is end Set_Label; - - function Get_Label_Font (This : in Widget) return Font_Kind is @@ -419,8 +413,6 @@ package body FLTK.Widgets is end Get_Label_Font; - - procedure Set_Label_Font (This : in out Widget; Font : in Font_Kind) is @@ -429,8 +421,6 @@ package body FLTK.Widgets is end Set_Label_Font; - - function Get_Label_Size (This : in Widget) return Font_Size is @@ -439,8 +429,6 @@ package body FLTK.Widgets is end Get_Label_Size; - - procedure Set_Label_Size (This : in out Widget; Size : in Font_Size) is @@ -449,8 +437,6 @@ package body FLTK.Widgets is end Set_Label_Size; - - function Get_Label_Type (This : in Widget) return Label_Kind is @@ -459,8 +445,6 @@ package body FLTK.Widgets is end Get_Label_Type; - - procedure Set_Label_Type (This : in out Widget; Label : in Label_Kind) is @@ -469,8 +453,6 @@ package body FLTK.Widgets is end Set_Label_Type; - - function Get_Callback (This : in Widget) return Widget_Callback is @@ -479,8 +461,6 @@ package body FLTK.Widgets is end Get_Callback; - - procedure Set_Callback (This : in out Widget; Func : in Widget_Callback) is @@ -502,8 +482,6 @@ package body FLTK.Widgets is end Get_X; - - function Get_Y (This : in Widget) return Integer is @@ -512,8 +490,6 @@ package body FLTK.Widgets is end Get_Y; - - function Get_W (This : in Widget) return Integer is @@ -522,8 +498,6 @@ package body FLTK.Widgets is end Get_W; - - function Get_H (This : in Widget) return Integer is @@ -532,8 +506,6 @@ package body FLTK.Widgets is end Get_H; - - procedure Resize (This : in out Widget; W, H : in Integer) is @@ -545,8 +517,6 @@ package body FLTK.Widgets is end Resize; - - procedure Reposition (This : in out Widget; X, Y : in Integer) is @@ -568,8 +538,6 @@ package body FLTK.Widgets is end Get_Image; - - procedure Set_Image (This : in out Widget; Pic : in out FLTK.Images.Image'Class) is diff --git a/src/fltk-widgets.ads b/src/fltk-widgets.ads index f4d0280..895ffc3 100644 --- a/src/fltk-widgets.ads +++ b/src/fltk-widgets.ads @@ -1,11 +1,18 @@ -with FLTK.Images; -limited with FLTK.Widgets.Groups; -private with System; -private with System.Address_To_Access_Conversions; -private with Ada.Unchecked_Conversion; -private with Interfaces.C; +with + + FLTK.Images; + +limited with + + FLTK.Widgets.Groups; + +private with + + System.Address_To_Access_Conversions, + Ada.Unchecked_Conversion, + Interfaces.C; package FLTK.Widgets is @@ -13,180 +20,167 @@ package FLTK.Widgets is type Widget is new Wrapper with private; - type Widget_Callback is access procedure (Item : in out Widget'Class); - type Font_Size is new Natural; Normal_Size : constant Font_Size := 14; - type Event_Outcome is (Not_Handled, Handled); + + function Create (X, Y, W, H : in Integer; Text : in String) return Widget; + + procedure Activate (This : in out Widget); - procedure Deactivate (This : in out Widget); - function Is_Active (This : in Widget) return Boolean; - function Is_Tree_Active (This : in Widget) return Boolean; - procedure Clear_Active (This : in out Widget); + + function Has_Changed (This : in Widget) return Boolean; - procedure Clear_Changed (This : in out Widget); + + function Parent (This : in Widget) return access FLTK.Widgets.Groups.Group'Class; - function Contains (This : in Widget; Item : in Widget'Class) return Boolean; + + function Get_Alignment (This : in Widget) return Alignment; - procedure Set_Alignment (This : in out Widget; New_Align : in Alignment); - function Get_Box (This : in Widget) return Box_Kind; - procedure Set_Box (This : in out Widget; Box : in Box_Kind); - function Get_Label (This : in out Widget) return String; - procedure Set_Label (This : in out Widget; Text : in String); - function Get_Label_Font (This : in Widget) return Font_Kind; - procedure Set_Label_Font (This : in out Widget; Font : in Font_Kind); - function Get_Label_Size (This : in Widget) return Font_Size; - procedure Set_Label_Size (This : in out Widget; Size : in Font_Size); - function Get_Label_Type (This : in Widget) return Label_Kind; - procedure Set_Label_Type (This : in out Widget; Label : in Label_Kind); - function Get_Callback (This : in Widget) return Widget_Callback; - procedure Set_Callback (This : in out Widget; Func : in Widget_Callback); + + function Get_X (This : in Widget) return Integer; - function Get_Y (This : in Widget) return Integer; - function Get_W (This : in Widget) return Integer; - function Get_H (This : in Widget) return Integer; - procedure Resize (This : in out Widget; W, H : in Integer); - procedure Reposition (This : in out Widget; X, Y : in Integer); + + function Get_Image (This : in Widget) return access FLTK.Images.Image'Class; - procedure Set_Image (This : in out Widget; Pic : in out FLTK.Images.Image'Class); + + procedure Draw (This : in out Widget) is null; - function Handle (This : in out Widget; Event : in Event_Kind) @@ -202,18 +196,21 @@ private Current_Image : access FLTK.Images.Image'Class; end record; + overriding procedure Finalize + (This : in out Widget); + + + -- the user data portion should always be a reference back to the Ada binding procedure Callback_Hook (W, U : in System.Address); pragma Convention (C, Callback_Hook); - procedure Draw_Hook (U : in System.Address); pragma Convention (C, Draw_Hook); - function Handle_Hook (U : in System.Address; E : in Interfaces.C.int) @@ -221,8 +218,6 @@ private pragma Convention (C, Handle_Hook); - overriding procedure Finalize - (This : in out Widget); package Widget_Convert is new System.Address_To_Access_Conversions (Widget'Class); @@ -232,12 +227,13 @@ private end Callback_Convert; + + function fl_widget_get_user_data (W : in System.Address) return System.Address; pragma Import (C, fl_widget_get_user_data, "fl_widget_get_user_data"); - procedure fl_widget_set_user_data (W, D : in System.Address); pragma Import (C, fl_widget_set_user_data, "fl_widget_set_user_data"); diff --git a/src/fltk.adb b/src/fltk.adb index ad70379..8970efd 100644 --- a/src/fltk.adb +++ b/src/fltk.adb @@ -1,9 +1,14 @@ -with Interfaces.C; -with System; -use type System.Address; -use type Interfaces.C.unsigned_long; +with + + Interfaces.C, + System; + +use type + + Interfaces.C.unsigned_long, + System.Address; package body FLTK is @@ -32,8 +37,6 @@ package body FLTK is end Has_Valid_Ptr; - - procedure Initialize (This : in out Wrapper) is begin @@ -65,8 +68,6 @@ package body FLTK is end "+"; - - function "+" (Left : in Modifier_Key; Right : in Pressable_Key) @@ -79,8 +80,6 @@ package body FLTK is end "+"; - - function "+" (Left : in Modifier_Key; Right : in Shortcut_Key) @@ -104,8 +103,6 @@ package body FLTK is end Key_To_C; - - function C_To_Key (Key : in Interfaces.C.unsigned_long) return Shortcut_Key is diff --git a/src/fltk.ads b/src/fltk.ads index 6c66352..203ee5e 100644 --- a/src/fltk.ads +++ b/src/fltk.ads @@ -1,8 +1,13 @@ -with Ada.Finalization; -private with Interfaces.C; -private with System; +with + + Ada.Finalization; + +private with + + Interfaces.C, + System; package FLTK is @@ -187,7 +192,6 @@ private (This : in Wrapper) return Boolean; - type Wrapper is abstract new Ada.Finalization.Limited_Controlled with record Void_Ptr : System.Address; @@ -197,7 +201,6 @@ private -- unsure if the above invariant is doing what I'm after -- oh well, something to work on - overriding procedure Initialize (This : in out Wrapper); @@ -219,12 +222,10 @@ private Keypress : Interfaces.Unsigned_16; end record; - function Key_To_C (Key : in Shortcut_Key) return Interfaces.C.unsigned_long; - function C_To_Key (Key : in Interfaces.C.unsigned_long) return Shortcut_Key; |