From ca9cca53a19145216cb0e00462db239e1194696d Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sun, 29 Apr 2018 00:39:36 +1000 Subject: FLTK.Event done, a whole bunch more polishing --- doc/fl_chart.html | 291 +++++++++++ doc/fl_copy_surface.html | 128 +++++ doc/fl_image_surface.html | 129 +++++ doc/fl_menu_bar.html | 88 ++++ doc/fl_menu_button.html | 113 +++++ doc/fl_pack.html | 120 +++++ doc/fl_paged_device.html | 255 ++++++++++ doc/fl_progress.html | 152 ++++++ doc/fl_scroll.html | 174 +++++++ doc/fl_spinner.html | 361 ++++++++++++++ doc/fl_tabs.html | 156 ++++++ doc/fl_tile.html | 105 ++++ doc/fl_wizard.html | 126 +++++ progress.txt | 29 +- src/c_fl_chart.cpp | 41 +- src/c_fl_chart.h | 49 +- src/c_fl_copy_surface.h | 14 +- src/c_fl_event.cpp | 161 +++++- src/c_fl_event.h | 57 ++- src/c_fl_image_surface.h | 14 +- src/c_fl_menu_bar.h | 12 +- src/c_fl_menu_button.h | 16 +- src/c_fl_pack.cpp | 4 +- src/c_fl_pack.h | 16 +- src/c_fl_paged_device.cpp | 45 +- src/c_fl_paged_device.h | 36 +- src/c_fl_progress.cpp | 12 +- src/c_fl_progress.h | 24 +- src/c_fl_screen.cpp | 47 ++ src/c_fl_screen.h | 29 +- src/c_fl_scroll.cpp | 7 + src/c_fl_scroll.h | 27 +- src/c_fl_spinner.cpp | 42 +- src/c_fl_spinner.h | 54 +- src/c_fl_tabs.cpp | 12 +- src/c_fl_tabs.h | 24 +- src/c_fl_tile.cpp | 2 +- src/c_fl_tile.h | 14 +- src/c_fl_wizard.cpp | 8 +- src/c_fl_wizard.h | 20 +- src/fltk-devices-surfaces-copy.adb | 7 + src/fltk-devices-surfaces-copy.ads | 16 + src/fltk-devices-surfaces-image.adb | 7 + src/fltk-devices-surfaces-image.ads | 19 + src/fltk-devices-surfaces-paged.adb | 54 +- src/fltk-devices-surfaces-paged.ads | 26 + src/fltk-event.adb | 551 ++++++++++++++++++++- src/fltk-event.ads | 181 ++++++- src/fltk-screen.adb | 210 +++++++- src/fltk-screen.ads | 72 ++- src/fltk-widgets-buttons.adb | 8 +- src/fltk-widgets-buttons.ads | 4 +- src/fltk-widgets-charts.adb | 53 +- src/fltk-widgets-charts.ads | 42 ++ src/fltk-widgets-groups-input_choices.adb | 2 +- src/fltk-widgets-groups-input_choices.ads | 2 +- src/fltk-widgets-groups-packed.adb | 8 + src/fltk-widgets-groups-packed.ads | 13 + src/fltk-widgets-groups-scrolls.adb | 29 ++ src/fltk-widgets-groups-scrolls.ads | 28 ++ src/fltk-widgets-groups-spinners.adb | 44 +- src/fltk-widgets-groups-spinners.ads | 42 +- src/fltk-widgets-groups-tabbed.adb | 68 +-- src/fltk-widgets-groups-tabbed.ads | 47 +- ...k-widgets-groups-text_displays-text_editors.adb | 68 +-- ...k-widgets-groups-text_displays-text_editors.ads | 38 +- src/fltk-widgets-groups-tiled.adb | 7 + src/fltk-widgets-groups-tiled.ads | 12 + src/fltk-widgets-groups-wizards.adb | 18 +- src/fltk-widgets-groups-wizards.ads | 19 +- src/fltk-widgets-inputs.adb | 8 +- src/fltk-widgets-inputs.ads | 4 +- src/fltk-widgets-menus-menu_bars.adb | 6 + src/fltk-widgets-menus-menu_bars.ads | 9 + src/fltk-widgets-menus-menu_buttons.adb | 8 + src/fltk-widgets-menus-menu_buttons.ads | 12 +- src/fltk-widgets-menus.adb | 4 +- src/fltk-widgets-menus.ads | 2 +- src/fltk-widgets-progress_bars.adb | 12 + src/fltk-widgets-progress_bars.ads | 17 + src/fltk.adb | 178 +++++-- src/fltk.ads | 149 +++--- 82 files changed, 4591 insertions(+), 527 deletions(-) create mode 100644 doc/fl_chart.html create mode 100644 doc/fl_copy_surface.html create mode 100644 doc/fl_image_surface.html create mode 100644 doc/fl_menu_bar.html create mode 100644 doc/fl_menu_button.html create mode 100644 doc/fl_pack.html create mode 100644 doc/fl_paged_device.html create mode 100644 doc/fl_progress.html create mode 100644 doc/fl_scroll.html create mode 100644 doc/fl_spinner.html create mode 100644 doc/fl_tabs.html create mode 100644 doc/fl_tile.html create mode 100644 doc/fl_wizard.html diff --git a/doc/fl_chart.html b/doc/fl_chart.html new file mode 100644 index 0000000..a9041e7 --- /dev/null +++ b/doc/fl_chart.html @@ -0,0 +1,291 @@ + + + + + + + Fl_Chart Binding Map + + + + + + +

Fl_Chart Binding Map

+ + + + + + + + + + +
Package name
Fl_ChartFLTK.Widgets.Charts
+ + + + + + + + + + + + + + + + +
Types
Fl_ChartChart
 Chart_Reference
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Chart(int X, int Y, int W, int H, const char *L=0);
+
+function Create
+       (X, Y, W, H : in Integer;
+        Text       : in String)
+    return Chart;
+
+void add(double val, const char *str=0, unsigned col=0);
+
+procedure Add
+       (This       : in out Chart;
+        Data_Value : in     Long_Float;
+        Data_Label : in     String := "";
+        Data_Color : in     Color := No_Color);
+
+uchar autosize() const;
+
+function Will_Autosize
+       (This : in Chart)
+    return Boolean;
+
+void autosize(uchar n);
+
+procedure Set_Autosize
+       (This : in out Chart;
+        To   : in     Boolean);
+
+void bounds(double *a, double *b) const;
+
+procedure Get_Bounds
+       (This         : in     Chart;
+        Lower, Upper :    out Long_Float);
+
+void bounds(double a, double b);
+
+procedure Set_Bounds
+       (This         : in out Chart;
+        Lower, Upper : in     Long_Float);
+
+void clear();
+
+procedure Clear
+       (This : in out Chart);
+
+void draw();
+
+procedure Draw
+       (This : in out Chart);
+
 
+function Handle
+       (This  : in out Chart;
+        Event : in     Event_Kind)
+    return Event_Outcome;
+
+void insert(int ind, double val, const char *str=0, unsigned col=0);
+
+procedure Insert
+       (This       : in out Chart;
+        Position   : in     Natural;
+        Data_Value : in     Long_Float;
+        Data_Label : in     String := "";
+        Data_Color : in     Color := No_Color);
+
+int maxsize() const;
+
+function Get_Maximum_Size
+       (This : in Chart)
+    return Natural;
+
+void maxsize(int m);
+
+procedure Set_Maximum_Size
+       (This : in out Chart;
+        To   : in     Natural);
+
+void replace(int ind, double val, const char *str=0, unsigned col=0);
+
+procedure Replace
+       (This       : in out Chart;
+        Position   : in     Natural;
+        Data_Value : in     Long_Float;
+        Data_Label : in     String := "";
+        Data_Color : in     Color := No_Color);
+
+int size() const;
+
+function Get_Size
+       (This : in Chart)
+    return Natural;
+
+void size(int W, int H);
+
+procedure Resize
+       (This : in out Chart;
+        W, H : in     Integer);
+
+Fl_Color textcolor() const;
+
+function Get_Text_Color
+       (This : in Chart)
+    return Color;
+
+void textcolor(Fl_Color n);
+
+procedure Set_Text_Color
+       (This : in out Chart;
+        To   : in     Color);
+
+Fl_Font textfont() const;
+
+function Get_Text_Font
+       (This : in Chart)
+    return Font_Kind;
+
+void textfont(Fl_Font s);
+
+procedure Set_Text_Font
+       (This : in out Chart;
+        To   : in     Font_Kind);
+
+Fl_Fontsize textsize() const;
+
+function Get_Text_Size
+       (This : in Chart)
+    return Font_Size;
+
+void textsize(Fl_Fontsize s);
+
+procedure Set_Text_Size
+       (This : in out Chart;
+        To   : in     Font_Size);
+
+ + + + + diff --git a/doc/fl_copy_surface.html b/doc/fl_copy_surface.html new file mode 100644 index 0000000..2fc1451 --- /dev/null +++ b/doc/fl_copy_surface.html @@ -0,0 +1,128 @@ + + + + + + + Fl_Copy_Surface Binding Map + + + + + + +

Fl_Copy_Surface Binding Map

+ + + + + + + + + + +
Package name
Fl_Copy_SurfaceFLTK.Devices.Surfaces.Copy
+ + + + + + + + + + + + + + + + +
Types
Fl_Copy_SurfaceCopy_Surface
 Copy_Surface_Reference
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Copy_Surface(int w, int h);
+
+function Create
+       (W, H : in Natural)
+    return Copy_Surface;
+
+const char * class_name();
+
 
+void draw(Fl_Widget *widget, int delta_x=0, int delta_y=0);
+
+procedure Draw_Widget
+       (This               : in out Copy_Surface;
+        Item               : in     FLTK.Widgets.Widget'Class;
+        Offset_X, Offset_Y : in     Integer := 0);
+
+void draw_decorated_window(Fl_Window *win, int delta_x=0, int delta_y=0);
+
+procedure Draw_Decorated_Window
+       (This               : in out Copy_Surface;
+        Item               : in     FLTK.Widgets.Groups.Windows.Window'Class;
+        Offset_X, Offset_Y : in     Integer := 0);
+
+int h();
+
+function Get_H
+       (This : in Copy_Surface)
+    return Integer;
+
+void set_current();
+
+procedure Set_Current
+       (This : in out Copy_Surface);
+
+int w();
+
+function Get_W
+       (This : in Copy_Surface)
+    return Integer;
+
+ + + + + diff --git a/doc/fl_image_surface.html b/doc/fl_image_surface.html new file mode 100644 index 0000000..4450127 --- /dev/null +++ b/doc/fl_image_surface.html @@ -0,0 +1,129 @@ + + + + + + + Fl_Image_Surface Binding Map + + + + + + +

Fl_Image_Surface Binding Map

+ + + + + + + + + + +
Package name
Fl_Image_SurfaceFLTK.Devices.Surfaces.Image
+ + + + + + + + + + + + + + + + +
Types
Fl_Image_SurfaceImage_Surface
 Image_Surface_Reference
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Image_Surface(int w, int h, int highres=0);
+
+function Create
+       (W, H    : in Integer;
+        Highres : in Boolean := False)
+    return Image_Surface;
+
+const char * class_name();
+
 
+void draw(Fl_Widget *, int delta_x=0, int delta_y=0);
+
+procedure Draw_Widget
+       (This               : in out Image_Surface;
+        Item               : in     FLTK.Widgets.Widget'Class;
+        Offset_X, Offset_Y : in     Integer := 0);
+
+void draw_decorated_window(Fl_Window *win, int delta_x=0, int delta_y=0);
+
+procedure Draw_Decorated_Window
+       (This               : in out Image_Surface;
+        Item               : in     FLTK.Widgets.Groups.Windows.Window'Class;
+        Offset_X, Offset_Y : in     Integer := 0);
+
+Fl_Shared_Image * highres_image();
+
+function Get_Highres_Image
+       (This : in Image_Surface)
+    return FLTK.Images.Shared.Shared_Image;
+
+Fl_RGB_Image * image();
+
+function Get_Image
+       (This : in Image_Surface)
+    return FLTK.Images.RGB.RGB_Image;
+
+void set_current();
+
+procedure Set_Current
+       (This : in out Image_Surface);
+
+ + + + + diff --git a/doc/fl_menu_bar.html b/doc/fl_menu_bar.html new file mode 100644 index 0000000..3ff571b --- /dev/null +++ b/doc/fl_menu_bar.html @@ -0,0 +1,88 @@ + + + + + + + Fl_Menu_Bar Binding Map + + + + + + +

Fl_Menu_Bar Binding Map

+ + + + + + + + + + +
Package name
Fl_Menu_BarFLTK.Widgets.Menus.Menu_Bars
+ + + + + + + + + + + + + + + + +
Types
Fl_Menu_BarMenu_Bar
 Menu_Bar_Reference
+ + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Menu_Bar(int X, int Y, int W, int H, const char *L=0);
+
+function Create
+       (X, Y, W, H : in Integer;
+        Text       : in String)
+    return Menu_Bar;
+
+void draw();
+
+procedure Draw
+       (This : in out Menu_Bar);
+
+int handle(int);
+
+function Handle
+       (This  : in out Menu_Bar;
+        Event : in     Event_Kind)
+    return Event_Outcome;
+
+ + + + + diff --git a/doc/fl_menu_button.html b/doc/fl_menu_button.html new file mode 100644 index 0000000..55b9e57 --- /dev/null +++ b/doc/fl_menu_button.html @@ -0,0 +1,113 @@ + + + + + + + Fl_Menu_Button Binding Map + + + + + + +

Fl_Menu_Button Binding Map

+ + + + + + + + + + +
Package name
Fl_Menu_ButtonFLTK.Widgets.Menus.Menu_Buttons
+ + + + + + + + + + + + + + + + + + + + + +
Types
Fl_Menu_ButtonMenu_Button
 Menu_Button_Reference
popup_buttonsPopup_Buttons
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Menu_Button(int, int, int, int, const char *=0);
+
+function Create
+       (X, Y, W, H : in Integer;
+        Text       : in String)
+    return Menu_Button;
+
+void draw();
+
+procedure Draw
+       (This : in out Menu_Button);
+
+int handle(int);
+
+function Handle
+       (This  : in out Menu_Button;
+        Event : in     Event_Kind)
+    return Event_Outcome;
+
+const Fl_Menu_Item * popup();
+
+function Popup
+       (This : in out Menu_Button)
+    return FLTK.Menu_Items.Menu_Item;
+
 
+procedure Set_Popup_Kind
+       (This : in out Menu_Button;
+        Pop  : in     Popup_Buttons);
+
+ + + + + diff --git a/doc/fl_pack.html b/doc/fl_pack.html new file mode 100644 index 0000000..e48a791 --- /dev/null +++ b/doc/fl_pack.html @@ -0,0 +1,120 @@ + + + + + + + Fl_Pack Binding Map + + + + + + +

Fl_Pack Binding Map

+ + + + + + + + + + +
Package name
Fl_PackFLTK.Widgets.Groups.Packed
+ + + + + + + + + + + + + + + + + + + + + +
Types
Fl_PackPacked_Group
 Packed_Group_Reference
enum { VERTICAL = 0, HORIZONTAL = 1 } 
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Pack(int x, int y, int w, int h, const char *l=0);
+
+function Create
+       (X, Y, W, H : in Integer;
+        Text       : in String)
+    return Packed_Group;
+
+void draw();
+
+procedure Draw
+       (This : in out Packed_Group);
+
 
+function Handle
+       (This  : in out Packed_Group;
+        Event : in     Event_Kind)
+    return Event_Outcome;
+
+uchar horizontal() const;
+
 
+int spacing() const;
+
+function Get_Spacing
+       (This : in Packed_Group)
+    return Integer;
+
+void spacing(int i);
+
+procedure Set_Spacing
+       (This : in out Packed_Group;
+        To   : in     Integer);
+
+ + + + + diff --git a/doc/fl_paged_device.html b/doc/fl_paged_device.html new file mode 100644 index 0000000..e919ac0 --- /dev/null +++ b/doc/fl_paged_device.html @@ -0,0 +1,255 @@ + + + + + + + Fl_Paged_Device Binding Map + + + + + + +

Fl_Paged_Device Binding Map

+ + + + + + + + + + +
Package name
Fl_Paged_DeviceFLTK.Devices.Surfaces.Paged
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Types
Fl_Paged_DevicePaged_Surface
 Paged_Surface_Reference
Page_FormatPage_Format
Page_LayoutPage_Layout
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Paged_Device();
+
+function Create
+    return Paged_Surface;
+
+const char * class_name();
+
 
+virtual void end_job(void);
+
+procedure End_Job
+       (This : in out Paged_Surface);
+
+virtual int end_page(void);
+
+procedure End_Page
+       (This : in out Paged_Surface);
+
+virtual void margins(int *left, int *top, int *right, int *bottom);
+
+procedure Get_Margins
+       (This                     : in     Paged_Surface;
+        Left, Top, Right, Bottom :    out Integer);
+
+virtual void origin(int x, int y);
+
+procedure Set_Origin
+       (This : in out Paged_Surface;
+        X, Y : in     Integer);
+
+virtual void origin(int *x, int *y);
+
+procedure Get_Origin
+       (This : in     Paged_Surface;
+        X, Y :    out Integer);
+
+virtual void print_widget(Fl_Widget *widget, int delta_x=0, int delta_y=0);
+
+procedure Print_Widget
+       (This               : in out Paged_Surface;
+        Item               : in     FLTK.Widgets.Widget'Class;
+        Offset_X, Offset_Y : in     Integer := 0);
+
+void print_window(Fl_Window *win, int x_offset=0, int y_offset=0);
+
+procedure Print_Window
+       (This               : in out Paged_Surface;
+        Item               : in     FLTK.Widgets.Groups.Windows.Window'Class;
+        Offset_X, Offset_Y : in     Integer := 0);
+
+virtual void print_window_part(Fl_Window *win, int x, int y, int w, int h, int delta_x=0, int delta_y=0);
+
+procedure Print_Window_Part
+       (This               : in out Paged_Surface;
+        Item               : in     FLTK.Widgets.Groups.Windows.Window'Class;
+        X, Y, W, H         : in     Integer;
+        Offset_X, Offset_Y : in     Integer := 0);
+
+virtual int printable_rect(int *w, int *h);
+
+procedure Get_Printable_Rect
+       (This : in     Paged_Surface;
+        W, H :    out Integer);
+
+virtual void rotate(float angle);
+
+procedure Rotate
+       (This    : in out Paged_Surface;
+        Degrees : in     Float);
+
+virtual void scale(float scale_x, float scale_y=0);
+
+procedure Scale
+       (This   : in out Paged_Surface;
+        Factor : in     Float);
+
+procedure Scale
+       (This               : in out Paged_Surface;
+        Factor_X, Factor_Y : in     Float);
+
+virtual int start_job(int pagecount, int *frompage=NULL, int *topage=NULL);
+
+procedure Start_Job
+       (This  : in out Paged_Surface;
+        Count : in     Natural);
+
+procedure Start_Job
+       (This     : in out Paged_Surface;
+        Count    : in     Natural;
+        From, To : in     Positive);
+
+virtual int start_page(void);
+
+procedure Start_Page
+       (This : in out Paged_Surface);
+
+virtual void translate(int x, int y);
+
+procedure Translate
+       (This             : in out Paged_Surface;
+        Delta_X, Delta_Y : in     Integer);
+
+virtual void untranslate(void);
+
+procedure Untranslate
+       (This : in out Paged_Surface);
+
+ + + + + diff --git a/doc/fl_progress.html b/doc/fl_progress.html new file mode 100644 index 0000000..8718ce0 --- /dev/null +++ b/doc/fl_progress.html @@ -0,0 +1,152 @@ + + + + + + + Fl_Progress Binding Map + + + + + + +

Fl_Progress Binding Map

+ + + + + + + + + + +
Package name
Fl_ProgressFLTK.Widgets.Progress_Bars
+ + + + + + + + + + + + + + + + +
Types
Fl_ProgressProgress_Bar
 Progress_Bar_Reference
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Progress(int x, int y, int w, int h, const char *l=0);
+
+function Create
+       (X, Y, W, H : in Integer;
+        Text       : in String)
+    return Progress_Bar;
+
+virtual void draw();
+
+procedure Draw
+       (This : in out Progress_Bar);
+
 
+function Handle
+       (This  : in out Progress_Bar;
+        Event : in     Event_Kind)
+    return Event_Outcome;
+
+void maximum(float v);
+
+procedure Set_Maximum
+       (This : in out Progress_Bar;
+        To   : in     Float);
+
+float maximum() const;
+
+function Get_Maximum
+       (This : in Progress_Bar)
+    return Float;
+
+void minimum(float v);
+
+procedure Set_Minimum
+       (This : in out Progress_Bar;
+        To   : in     Float);
+
+float minimum() const;
+
+function Get_Minimum
+       (This : in Progress_Bar)
+    return Float;
+
+void value(float v);
+
+procedure Set_Value
+       (This : in out Progress_Bar;
+        To   : in     Float);
+
+float value() const;
+
+function Get_Value
+       (This : in Progress_Bar)
+    return Float;
+
+ + + + + diff --git a/doc/fl_scroll.html b/doc/fl_scroll.html new file mode 100644 index 0000000..3cc9087 --- /dev/null +++ b/doc/fl_scroll.html @@ -0,0 +1,174 @@ + + + + + + + Fl_Scroll Binding Map + + + + + + +

Fl_Scroll Binding Map

+ + + + + + + + + + +
Package name
Fl_ScrollFLTK.Widgets.Groups.Scrolls
+ + + + + + + + + + + + + + + + + + + + +
Types
Fl_ScrollScroll
 Scroll_Reference
enum { HORIZONTAL = 1, VERTICAL = 2, BOTH = 3, ALWAYS_ON = 4, HORIZONTAL_ALWAYS = 5, VERTICAL_ALWAYS = 6, BOTH_ALWAYS = 7 } + Scroll_Kind
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Scroll(int X, int Y, int W, int H, const char *L=0);
+
+function Create
+       (X, Y, W, H : in Integer;
+        Text       : in String)
+    return Scroll;
+
+void clear();
+
+procedure Clear
+       (This : in out Scroll);
+
+void draw();
+
+procedure Draw
+       (This : in out Scroll);
+
+int handle(int);
+
+function Handle
+       (This  : in out Scroll;
+        Event : in     Event_Kind)
+    return Event_Outcome;
+
+void resize(int X, int Y, int W, int H);
+
 
+void scroll_to(int, int);
+
+procedure Scroll_To
+       (This : in out Scroll;
+        X, Y : in     Integer);
+
+int scrollbar_size() const;
+
+function Get_Scrollbar_Size
+       (This : in Scroll)
+    return Integer;
+
+void scrollbar_size(int newSize);
+
+procedure Set_Scrollbar_Size
+       (This : in out Scroll;
+        To   : in     Integer);
+
+int xposition() const;
+
+function Get_Scroll_X
+       (This : in Scroll)
+    return Integer;
+
+int yposition() const;
+
+function Get_Scroll_Y
+       (This : in Scroll)
+    return Integer;
+
 
+procedure Set_Type
+       (This : in out Scroll;
+        Mode : in     Scroll_Kind);
+
+ + + + + diff --git a/doc/fl_spinner.html b/doc/fl_spinner.html new file mode 100644 index 0000000..8c726ae --- /dev/null +++ b/doc/fl_spinner.html @@ -0,0 +1,361 @@ + + + + + + + Fl_Spinner Binding Map + + + + + + +

Fl_Spinner Binding Map

+ + + + + + + + + + +
Package name
Fl_SpinnerFLTK.Widgets.Groups.Spinners
+ + + + + + + + + + + + + + + + +
Types
Fl_SpinnerSpinner
 Spinner_Reference
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Spinner(int X, int Y, int W, int H, const char *L=0);
+
+function Create
+       (X, Y, W, H : in Integer;
+        Text       : in String)
+    return Spinner;
+
+void color(Fl_Color v);
+
+procedure Set_Background_Color
+       (This : in out Spinner;
+        To   : in     Color);
+
+Fl_Color color() const;
+
+function Get_Background_Color
+       (This : in Spinner)
+    return Color;
+
 
+procedure Draw
+       (This : in out Spinner);
+
+const char * format();
+
 
+void format(const char *f);
+
 
+int handle(int event);
+
+function Handle
+       (This  : in out Spinner;
+        Event : in     Event_Kind)
+    return Event_Outcome;
+
+double maximum() const;
+
+function Get_Maximum
+       (This : in Spinner)
+    return Long_Float;
+
+void maximum(double m);
+
+procedure Set_Maximum
+       (This : in out Spinner;
+        To   : in     Long_Float);
+
+double maxinum() const;
+
 
+double minimum() const;
+
+function Get_Minimum
+       (This : in Spinner)
+    return Long_Float;
+
+void minimum(double m);
+
+procedure Set_Minimum
+       (This : in out Spinner;
+        To   : in     Long_Float);
+
+double mininum() const;
+
 
 
+procedure Get_Range
+       (This     : in     Spinner;
+        Min, Max :    out Long_Float);
+
+void range(double a, double b);
+
+procedure Set_Range
+       (This     : in out Spinner;
+        Min, Max : in     Long_Float);
+
+void resize(int X, int Y, int W, int H);
+
 
+void selection_color(Fl_Color val);
+
+procedure Set_Selection_Color
+       (This : in out Spinner;
+        To   : in     Color);
+
+Fl_Color selection_color() const;
+
+function Get_Selection_Color
+       (This : in Spinner)
+    return Color;
+
+double step() const;
+
+function Get_Step
+       (This : in Spinner)
+    return Long_Float;
+
+void step(double s);
+
+procedure Set_Step
+       (This : in out Spinner;
+        To   : in     Long_Float);
+
+Fl_Color textcolor() const;
+
+function Get_Text_Color
+       (This : in Spinner)
+    return Color;
+
+void textcolor(Fl_Color c);
+
+procedure Set_Text_Color
+       (This : in out Spinner;
+        To   : in     Color);
+
+Fl_Font textfont() const;
+
+function Get_Text_Font
+       (This : in Spinner)
+    return Font_Kind;
+
+void textfont(Fl_Font f);
+
+procedure Set_Text_Font
+       (This : in out Spinner;
+        To   : in     Font_Kind);
+
+Fl_Fontsize textsize() const;
+
+function Get_Text_Size
+       (This : in Spinner)
+    return Font_Size;
+
+void textsize(Fl_Fontsize s);
+
+procedure Set_Text_Size
+       (This : in out Spinner;
+        To   : in     Font_Size);
+
+uchar type() const;
+
+function Get_Type
+       (This : in Spinner)
+    return Spinner_Kind;
+
+void type(uchar v);
+
+procedure Set_Type
+       (This : in out Spinner;
+        To   : in     Spinner_Kind);
+
+double value() const;
+
+function Get_Value
+       (This : in Spinner)
+    return Long_Float;
+
+void value(double v);
+
+procedure Set_Value
+       (This : in out Spinner;
+        To   : in     Long_Float);
+
+ + + + + diff --git a/doc/fl_tabs.html b/doc/fl_tabs.html new file mode 100644 index 0000000..048c356 --- /dev/null +++ b/doc/fl_tabs.html @@ -0,0 +1,156 @@ + + + + + + + Fl_Tabs Binding Map + + + + + + +

Fl_Tabs Binding Map

+ + + + + + + + + + +
Package name
Fl_TabsFLTK.Widgets.Groups.Tabbed
+ + + + + + + + + + + + + + + + +
Types
Fl_TabsTabbed_Group
 Tabbed_Group_Reference
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Tabs(int, int, int, int, const char *=0);
+
+function Create
+       (X, Y, W, H : in Integer;
+        Text       : in String)
+    return Tabbed_Group;
+
+void client_area(int &rx, int &ry, int &rw, int &rh, int tabh=0);
+
+procedure Get_Client_Area
+       (This       : in     Tabbed_Group;
+        Tab_Height : in     Natural;
+        X, Y, W, H :    out Integer);
+
+void draw();
+
+procedure Draw
+       (This : in out Tabbed_Group);
+
+int handle(int);
+
+function Handle
+       (This  : in out Tabbed_Group;
+        Event : in     Event_Kind)
+    return Event_Outcome;
+
+Fl_Widget * push() const;
+
+function Get_Push
+       (This : in Tabbed_Group)
+    return access Widget'Class;
+
+int push(Fl_WIdget *);
+
+procedure Set_Push
+       (This : in out Tabbed_Group;
+        Item : in out Widget'Class);
+
+Fl_Widget * value();
+
+function Get_Visible
+       (This : in Tabbed_Group)
+    return access Widget'Class;
+
+int value(Fl_Widget *);
+
+procedure Set_Visible
+       (This : in out Tabbed_Group;
+        Item : in out Widget'Class);
+
+Fl_Widget * which(int event_x, int event_y);
+
+function Get_Which
+       (This             : in Tabbed_Group;
+        Event_X, Event_Y : in Integer)
+    return access Widget'Class;
+
+ + + + + diff --git a/doc/fl_tile.html b/doc/fl_tile.html new file mode 100644 index 0000000..0aab994 --- /dev/null +++ b/doc/fl_tile.html @@ -0,0 +1,105 @@ + + + + + + + Fl_Tile Binding Map + + + + + + +

Fl_Tile Binding Map

+ + + + + + + + + + +
Package name
Fl_TileFLTK.Widgets.Groups.Tiled
+ + + + + + + + + + + + + + + + +
Types
Fl_TileTiled_Group
 Tiled_Group_Reference
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Tile(int X, int Y, int W, int H, const char *L=0);
+
+function Create
+       (X, Y, W, H : in Integer;
+        Text       : in String)
+    return Tiled_Group;
+
 
+procedure Draw
+       (This : in out Tiled_Group);
+
+int handle(int event);
+
+function Handle
+       (This  : in out Tiled_Group;
+        Event : in     Event_Kind)
+    return Event_Outcome;
+
+void position(int oldx, int oldy, int newx, int newy);
+
+procedure Position
+       (This         : in out Tiled_Group;
+        Old_X, Old_Y : in     Integer;
+        New_X, New_Y : in     Integer);
+
+void resize(int X, int Y, int W, int H);
+
 
+ + + + + diff --git a/doc/fl_wizard.html b/doc/fl_wizard.html new file mode 100644 index 0000000..313924a --- /dev/null +++ b/doc/fl_wizard.html @@ -0,0 +1,126 @@ + + + + + + + Fl_Wizard Binding Map + + + + + + +

Fl_Wizard Binding Map

+ + + + + + + + + + +
Package name
Fl_WizardFLTK.Widgets.Groups.Wizards
+ + + + + + + + + + + + + + + + +
Types
Fl_WizardWizard
 Wizard_Reference
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Functions and Procedures
+Fl_Wizard(int, int, int, int, const char *=0);
+
+function Create
+       (X, Y, W, H : in Integer;
+        Text       : in String)
+    return Wizard;
+
 
+procedure Draw
+       (This : in out Wizard);
+
 
+function Handle
+       (This  : in out Wizard;
+        Event : in     Event_Kind)
+    return Event_Outcome;
+
+void next();
+
+procedure Next
+       (This : in out Wizard);
+
+void prev();
+
+procedure Prev
+       (This : in out Wizard);
+
+Fl_Widget * value();
+
+function Get_Visible
+       (This : in Wizard)
+    return access Widget'Class;
+
+void value(Fl_Widget *);
+
+procedure Set_Visible
+       (This : in out Wizard;
+        Item : in out Widget'Class);
+
+ + + + + diff --git a/progress.txt b/progress.txt index 2f306ca..c1dd896 100644 --- a/progress.txt +++ b/progress.txt @@ -13,6 +13,9 @@ Overall estimate: ???% Polished: FLTK.Devices +FLTK.Devices.Surfaces.Copy +FLTK.Devices.Surfaces.Image +FLTK.Devices.Surfaces.Paged FLTK.Dialogs FLTK.Images FLTK.Images.Bitmaps @@ -35,13 +38,20 @@ FLTK.Widgets.Buttons.Light.Round.Radio FLTK.Widgets.Buttons.Radio FLTK.Widgets.Buttons.Repeat FLTK.Widgets.Buttons.Toggle +FLTK.Widgets.Charts FLTK.Widgets.Clocks FLTK.Widgets.Clocks.Updated FLTK.Widgets.Clocks.Updated.Round +FLTK.Widgets.Groups.Packed +FLTK.Widgets.Groups.Scrolls +FLTK.Widgets.Groups.Spinners +FLTK.Widgets.Groups.Tabbed +FLTK.Widgets.Groups.Tiled FLTK.Widgets.Groups.Windows FLTK.Widgets.Groups.Windows.Double FLTK.Widgets.Groups.Windows.Single FLTK.Widgets.Groups.Windows.Single.Menu +FLTK.Widgets.Groups.Wizards FLTK.Widgets.Inputs FLTK.Widgets.Inputs.File FLTK.Widgets.Inputs.Float @@ -50,6 +60,9 @@ FLTK.Widgets.Inputs.Multiline FLTK.Widgets.Inputs.Outputs FLTK.Widgets.Inputs.Outputs.Multiline FLTK.Widgets.Inputs.Secret +FLTK.Widgets.Menus.Menu_Bars +FLTK.Widgets.Menus.Menu_Buttons +FLTK.Widgets.Progress_Bars FLTK.Widgets.Valuators FLTK.Widgets.Valuators.Adjusters FLTK.Widgets.Valuators.Counters @@ -73,23 +86,12 @@ FLTK.Widgets.Valuators.Sliders.Horizontal Done: -FLTK.Devices.Surfaces.Copy -FLTK.Devices.Surfaces.Image -FLTK.Devices.Surfaces.Paged FLTK.Devices.Surfaces.Paged.Printers -FLTK.Widgets.Charts +FLTK.Event +FLTK.Screen FLTK.Widgets.Groups.Color_Choosers FLTK.Widgets.Groups.Input_Choices -FLTK.Widgets.Groups.Packed -FLTK.Widgets.Groups.Scrolls -FLTK.Widgets.Groups.Spinners -FLTK.Widgets.Groups.Tabbed FLTK.Widgets.Groups.Text_Displays.Text_Editors -FLTK.Widgets.Groups.Tiled -FLTK.Widgets.Groups.Wizards -FLTK.Widgets.Menus.Menu_Bars -FLTK.Widgets.Menus.Menu_Buttons -FLTK.Widgets.Progress_Bars @@ -101,7 +103,6 @@ FLTK.Devices.Graphics FLTK.Devices.Surfaces FLTK.Environment FLTK.Menu_Items -FLTK.Screen FLTK.Text_Buffers FLTK.Widgets FLTK.Widgets.Groups diff --git a/src/c_fl_chart.cpp b/src/c_fl_chart.cpp index ac79731..0389b6e 100644 --- a/src/c_fl_chart.cpp +++ b/src/c_fl_chart.cpp @@ -71,77 +71,84 @@ void free_fl_chart(CHART b) { void fl_chart_add(CHART b, double v, char * s, unsigned int c) { - reinterpret_cast(b)->add(v,s,c); + reinterpret_cast(b)->add(v,s,c); } void fl_chart_insert(CHART b, int i, double v, char * s, unsigned int c) { - reinterpret_cast(b)->insert(i,v,s,c); + reinterpret_cast(b)->insert(i,v,s,c); } void fl_chart_replace(CHART b, int i, double v, char * s, unsigned int c) { - reinterpret_cast(b)->replace(i,v,s,c); + reinterpret_cast(b)->replace(i,v,s,c); } void fl_chart_clear(CHART b) { - reinterpret_cast(b)->clear(); + reinterpret_cast(b)->clear(); } int fl_chart_get_autosize(CHART b) { - return reinterpret_cast(b)->autosize(); + return reinterpret_cast(b)->autosize(); } void fl_chart_set_autosize(CHART b, int a) { - reinterpret_cast(b)->autosize(a); + reinterpret_cast(b)->autosize(a); } void fl_chart_get_bounds(CHART b, double * l, double * u) { - reinterpret_cast(b)->bounds(l,u); + reinterpret_cast(b)->bounds(l,u); } void fl_chart_set_bounds(CHART b, double l, double u) { - reinterpret_cast(b)->bounds(l,u); + reinterpret_cast(b)->bounds(l,u); } int fl_chart_get_maxsize(CHART b) { - return reinterpret_cast(b)->maxsize(); + return reinterpret_cast(b)->maxsize(); } void fl_chart_set_maxsize(CHART b, int m) { - reinterpret_cast(b)->maxsize(m); + reinterpret_cast(b)->maxsize(m); } int fl_chart_size(CHART b) { - return reinterpret_cast(b)->size(); + return reinterpret_cast(b)->size(); +} + + + + +void fl_chart_size2(CHART b, int w, int h) { + reinterpret_cast(b)->size(w, h); } unsigned int fl_chart_get_textcolor(CHART b) { - return reinterpret_cast(b)->textcolor(); + return reinterpret_cast(b)->textcolor(); } void fl_chart_set_textcolor(CHART b, unsigned int c) { - reinterpret_cast(b)->textcolor(c); + reinterpret_cast(b)->textcolor(c); } int fl_chart_get_textfont(CHART b) { - return reinterpret_cast(b)->textfont(); + return reinterpret_cast(b)->textfont(); } void fl_chart_set_textfont(CHART b, int f) { - reinterpret_cast(b)->textfont(f); + reinterpret_cast(b)->textfont(f); } int fl_chart_get_textsize(CHART b) { - return reinterpret_cast(b)->textsize(); + return reinterpret_cast(b)->textsize(); } void fl_chart_set_textsize(CHART b, int s) { - reinterpret_cast(b)->textsize(s); + reinterpret_cast(b)->textsize(s); } diff --git a/src/c_fl_chart.h b/src/c_fl_chart.h index 76e8e26..cd0b458 100644 --- a/src/c_fl_chart.h +++ b/src/c_fl_chart.h @@ -11,41 +11,44 @@ typedef void* CHART; -extern "C" void chart_set_draw_hook(CHART n, void * d); -extern "C" void fl_chart_draw(CHART n); -extern "C" void chart_set_handle_hook(CHART n, void * h); -extern "C" int fl_chart_handle(CHART n, int e); +extern "C" inline void chart_set_draw_hook(CHART n, void * d); +extern "C" inline void fl_chart_draw(CHART n); +extern "C" inline void chart_set_handle_hook(CHART n, void * h); +extern "C" inline int fl_chart_handle(CHART n, int e); -extern "C" CHART new_fl_chart(int x, int y, int w, int h, char * label); -extern "C" void free_fl_chart(CHART b); +extern "C" inline CHART new_fl_chart(int x, int y, int w, int h, char * label); +extern "C" inline void free_fl_chart(CHART b); -extern "C" void fl_chart_add(CHART b, double v, char * s, unsigned int c); -extern "C" void fl_chart_insert(CHART b, int i, double v, char * s, unsigned int c); -extern "C" void fl_chart_replace(CHART b, int i, double v, char * s, unsigned int c); -extern "C" void fl_chart_clear(CHART b); +extern "C" inline void fl_chart_add(CHART b, double v, char * s, unsigned int c); +extern "C" inline void fl_chart_insert(CHART b, int i, double v, char * s, unsigned int c); +extern "C" inline void fl_chart_replace(CHART b, int i, double v, char * s, unsigned int c); +extern "C" inline void fl_chart_clear(CHART b); -extern "C" int fl_chart_get_autosize(CHART b); -extern "C" void fl_chart_set_autosize(CHART b, int a); -extern "C" void fl_chart_get_bounds(CHART b, double * l, double * u); -extern "C" void fl_chart_set_bounds(CHART b, double l, double u); -extern "C" int fl_chart_get_maxsize(CHART b); -extern "C" void fl_chart_set_maxsize(CHART b, int m); -extern "C" int fl_chart_size(CHART b); +extern "C" inline int fl_chart_get_autosize(CHART b); +extern "C" inline void fl_chart_set_autosize(CHART b, int a); +extern "C" inline void fl_chart_get_bounds(CHART b, double * l, double * u); +extern "C" inline void fl_chart_set_bounds(CHART b, double l, double u); +extern "C" inline int fl_chart_get_maxsize(CHART b); +extern "C" inline void fl_chart_set_maxsize(CHART b, int m); +extern "C" inline int fl_chart_size(CHART b); -extern "C" unsigned int fl_chart_get_textcolor(CHART b); -extern "C" void fl_chart_set_textcolor(CHART b, unsigned int c); -extern "C" int fl_chart_get_textfont(CHART b); -extern "C" void fl_chart_set_textfont(CHART b, int f); -extern "C" int fl_chart_get_textsize(CHART b); -extern "C" void fl_chart_set_textsize(CHART b, int s); +extern "C" inline void fl_chart_size2(CHART b, int w, int h); + + +extern "C" inline unsigned int fl_chart_get_textcolor(CHART b); +extern "C" inline void fl_chart_set_textcolor(CHART b, unsigned int c); +extern "C" inline int fl_chart_get_textfont(CHART b); +extern "C" inline void fl_chart_set_textfont(CHART b, int f); +extern "C" inline int fl_chart_get_textsize(CHART b); +extern "C" inline void fl_chart_set_textsize(CHART b, int s); #endif diff --git a/src/c_fl_copy_surface.h b/src/c_fl_copy_surface.h index c323533..6de2f56 100644 --- a/src/c_fl_copy_surface.h +++ b/src/c_fl_copy_surface.h @@ -11,21 +11,21 @@ typedef void* COPY_SURFACE; -extern "C" COPY_SURFACE new_fl_copy_surface(int w, int h); -extern "C" void free_fl_copy_surface(COPY_SURFACE c); +extern "C" inline COPY_SURFACE new_fl_copy_surface(int w, int h); +extern "C" inline void free_fl_copy_surface(COPY_SURFACE c); -extern "C" int fl_copy_surface_get_w(COPY_SURFACE c); -extern "C" int fl_copy_surface_get_h(COPY_SURFACE c); +extern "C" inline int fl_copy_surface_get_w(COPY_SURFACE c); +extern "C" inline int fl_copy_surface_get_h(COPY_SURFACE c); -extern "C" void fl_copy_surface_draw(COPY_SURFACE c, void * w, int dx, int dy); -extern "C" void fl_copy_surface_draw_decorated_window(COPY_SURFACE c, void * w, int dx, int dy); +extern "C" inline void fl_copy_surface_draw(COPY_SURFACE c, void * w, int dx, int dy); +extern "C" inline void fl_copy_surface_draw_decorated_window(COPY_SURFACE c, void * w, int dx, int dy); -extern "C" void fl_copy_surface_set_current(COPY_SURFACE c); +extern "C" inline void fl_copy_surface_set_current(COPY_SURFACE c); #endif diff --git a/src/c_fl_event.cpp b/src/c_fl_event.cpp index 17f3ee8..e1c83ef 100644 --- a/src/c_fl_event.cpp +++ b/src/c_fl_event.cpp @@ -1,11 +1,92 @@ #include +#include +#include #include "c_fl_event.h" -int fl_event_key() { - return Fl::event_key(); + + +void fl_event_add_handler(void * f) { + Fl::add_handler(reinterpret_cast(f)); +} + +void fl_event_set_event_dispatch(void * f) { + Fl::event_dispatch(reinterpret_cast(f)); +} + +int fl_event_handle(int e, void * w) { + return Fl::handle_(e, reinterpret_cast(w)); +} + + + + +void * fl_event_get_grab() { + return Fl::grab(); +} + +void fl_event_set_grab(void * w) { + Fl::grab(reinterpret_cast(w)); +} + +void * fl_event_get_pushed() { + return Fl::pushed(); +} + +void fl_event_set_pushed(void * w) { + Fl::pushed(reinterpret_cast(w)); +} + +void * fl_event_get_belowmouse() { + return Fl::belowmouse(); +} + +void fl_event_set_belowmouse(void * w) { + Fl::belowmouse(reinterpret_cast(w)); +} + +void * fl_event_get_focus() { + return Fl::focus(); +} + +void fl_event_set_focus(void * w) { + Fl::focus(reinterpret_cast(w)); +} + + + + +int fl_event_compose(int &d) { + return Fl::compose(d); +} + +void fl_event_compose_reset() { + Fl::compose_reset(); +} + +const char * fl_event_text() { + return Fl::event_text(); +} + +int fl_event_length() { + return Fl::event_length(); +} + + + + +int fl_event_get() { + return Fl::event(); +} + +unsigned long fl_event_state() { + return Fl::event_state(); +} + +int fl_event_check_state(unsigned long s) { + return Fl::event_state(s); } @@ -27,7 +108,83 @@ int fl_event_y_root() { return Fl::event_y_root(); } +int fl_event_dx() { + return Fl::event_dx(); +} + +int fl_event_dy() { + return Fl::event_dy(); +} + +void fl_event_get_mouse(int &x, int &y) { + Fl::get_mouse(x, y); +} + int fl_event_is_click() { return Fl::event_is_click(); } +int fl_event_is_clicks() { + return Fl::event_clicks(); +} + +void fl_event_set_clicks(int c) { + Fl::event_clicks(c); +} + +int fl_event_button() { + return Fl::event_button(); +} + +int fl_event_button1() { + return Fl::event_button1(); +} + +int fl_event_button2() { + return Fl::event_button2(); +} + +int fl_event_button3() { + return Fl::event_button3(); +} + +int fl_event_inside(int x, int y, int w, int h) { + return Fl::event_inside(x, y, w, h); +} + + + + +unsigned long fl_event_key() { + return Fl::event_key(); +} + +unsigned long fl_event_original_key() { + return Fl::event_original_key(); +} + +int fl_event_key_during(unsigned long k) { + return Fl::event_key(k); +} + +int fl_event_get_key(unsigned long k) { + return Fl::get_key(k); +} + +int fl_event_ctrl() { + return Fl::event_ctrl(); +} + +int fl_event_alt() { + return Fl::event_alt(); +} + +int fl_event_command() { + return Fl::event_command(); +} + +int fl_event_shift() { + return Fl::event_shift(); +} + + diff --git a/src/c_fl_event.h b/src/c_fl_event.h index 6889eed..c126b56 100644 --- a/src/c_fl_event.h +++ b/src/c_fl_event.h @@ -4,14 +4,59 @@ #define FL_EVENT_GUARD -extern "C" int fl_event_key(); -extern "C" int fl_event_x(); -extern "C" int fl_event_x_root(); -extern "C" int fl_event_y(); -extern "C" int fl_event_y_root(); -extern "C" int fl_event_is_click(); +extern "C" inline void fl_event_add_handler(void * f); +extern "C" inline void fl_event_set_event_dispatch(void * f); +extern "C" inline int fl_event_handle(int e, void * w); + + +extern "C" inline void * fl_event_get_grab(); +extern "C" inline void fl_event_set_grab(void * w); +extern "C" inline void * fl_event_get_pushed(); +extern "C" inline void fl_event_set_pushed(void * w); +extern "C" inline void * fl_event_get_belowmouse(); +extern "C" inline void fl_event_set_belowmouse(void * w); +extern "C" inline void * fl_event_get_focus(); +extern "C" inline void fl_event_set_focus(void * w); + + +extern "C" inline int fl_event_compose(int &d); +extern "C" inline void fl_event_compose_reset(); +extern "C" inline const char * fl_event_text(); +extern "C" inline int fl_event_length(); + + +extern "C" inline int fl_event_get(); +extern "C" inline unsigned long fl_event_state(); +extern "C" inline int fl_event_check_state(unsigned long s); + + +extern "C" inline int fl_event_x(); +extern "C" inline int fl_event_x_root(); +extern "C" inline int fl_event_y(); +extern "C" inline int fl_event_y_root(); +extern "C" inline int fl_event_dx(); +extern "C" inline int fl_event_dy(); +extern "C" inline void fl_event_get_mouse(int &x, int &y); +extern "C" inline int fl_event_is_click(); +extern "C" inline int fl_event_is_clicks(); +extern "C" inline void fl_event_set_clicks(int c); +extern "C" inline int fl_event_button(); +extern "C" inline int fl_event_button1(); +extern "C" inline int fl_event_button2(); +extern "C" inline int fl_event_button3(); +extern "C" inline int fl_event_inside(int x, int y, int w, int h); + + +extern "C" inline unsigned long fl_event_key(); +extern "C" inline unsigned long fl_event_original_key(); +extern "C" inline int fl_event_key_during(unsigned long k); +extern "C" inline int fl_event_get_key(unsigned long k); +extern "C" inline int fl_event_ctrl(); +extern "C" inline int fl_event_alt(); +extern "C" inline int fl_event_command(); +extern "C" inline int fl_event_shift(); #endif diff --git a/src/c_fl_image_surface.h b/src/c_fl_image_surface.h index 0ad97a3..a021993 100644 --- a/src/c_fl_image_surface.h +++ b/src/c_fl_image_surface.h @@ -11,21 +11,21 @@ typedef void* IMAGE_SURFACE; -extern "C" IMAGE_SURFACE new_fl_image_surface(int w, int h, int r); -extern "C" void free_fl_image_surface(IMAGE_SURFACE s); +extern "C" inline IMAGE_SURFACE new_fl_image_surface(int w, int h, int r); +extern "C" inline void free_fl_image_surface(IMAGE_SURFACE s); -extern "C" void fl_image_surface_draw(IMAGE_SURFACE s, void * w, int dx, int dy); -extern "C" void fl_image_surface_draw_decorated_window(IMAGE_SURFACE s, void * w, int dx, int dy); +extern "C" inline void fl_image_surface_draw(IMAGE_SURFACE s, void * w, int dx, int dy); +extern "C" inline void fl_image_surface_draw_decorated_window(IMAGE_SURFACE s, void * w, int dx, int dy); -extern "C" void * fl_image_surface_image(IMAGE_SURFACE s); -extern "C" void * fl_image_surface_highres_image(IMAGE_SURFACE s); +extern "C" inline void * fl_image_surface_image(IMAGE_SURFACE s); +extern "C" inline void * fl_image_surface_highres_image(IMAGE_SURFACE s); -extern "C" void fl_image_surface_set_current(IMAGE_SURFACE s); +extern "C" inline void fl_image_surface_set_current(IMAGE_SURFACE s); #endif diff --git a/src/c_fl_menu_bar.h b/src/c_fl_menu_bar.h index 60d2e06..ed5a9d0 100644 --- a/src/c_fl_menu_bar.h +++ b/src/c_fl_menu_bar.h @@ -11,16 +11,16 @@ 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" inline void menu_bar_set_draw_hook(MENUBAR m, void * d); +extern "C" inline void fl_menu_bar_draw(MENUBAR m); +extern "C" inline void menu_bar_set_handle_hook(MENUBAR m, void * h); +extern "C" inline 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); +extern "C" inline MENUBAR new_fl_menu_bar(int x, int y, int w, int h, char* label); +extern "C" inline void free_fl_menu_bar(MENUBAR m); #endif diff --git a/src/c_fl_menu_button.h b/src/c_fl_menu_button.h index 8013bf9..fe44c2a 100644 --- a/src/c_fl_menu_button.h +++ b/src/c_fl_menu_button.h @@ -11,22 +11,22 @@ 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" inline void menu_button_set_draw_hook(MENUBUTTON m, void * d); +extern "C" inline void fl_menu_button_draw(MENUBUTTON m); +extern "C" inline void menu_button_set_handle_hook(MENUBUTTON m, void * h); +extern "C" inline 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" inline MENUBUTTON new_fl_menu_button(int x, int y, int w, int h, char* label); +extern "C" inline void free_fl_menu_button(MENUBUTTON m); -extern "C" void fl_menu_button_type(MENUBUTTON m, unsigned int t); -extern "C" const void * fl_menu_button_popup(MENUBUTTON m); +extern "C" inline void fl_menu_button_type(MENUBUTTON m, unsigned int t); +extern "C" inline const void * fl_menu_button_popup(MENUBUTTON m); #endif diff --git a/src/c_fl_pack.cpp b/src/c_fl_pack.cpp index 26e3a7b..ca52172 100644 --- a/src/c_fl_pack.cpp +++ b/src/c_fl_pack.cpp @@ -71,11 +71,11 @@ void free_fl_pack(PACK p) { int fl_pack_get_spacing(PACK p) { - return reinterpret_cast(p)->spacing(); + return reinterpret_cast(p)->spacing(); } void fl_pack_set_spacing(PACK p, int t) { - reinterpret_cast(p)->spacing(t); + reinterpret_cast(p)->spacing(t); } diff --git a/src/c_fl_pack.h b/src/c_fl_pack.h index debb69c..6695708 100644 --- a/src/c_fl_pack.h +++ b/src/c_fl_pack.h @@ -11,22 +11,22 @@ typedef void* PACK; -extern "C" void pack_set_draw_hook(PACK n, void * d); -extern "C" void fl_pack_draw(PACK n); -extern "C" void pack_set_handle_hook(PACK n, void * h); -extern "C" int fl_pack_handle(PACK n, int e); +extern "C" inline void pack_set_draw_hook(PACK n, void * d); +extern "C" inline void fl_pack_draw(PACK n); +extern "C" inline void pack_set_handle_hook(PACK n, void * h); +extern "C" inline int fl_pack_handle(PACK n, int e); -extern "C" PACK new_fl_pack(int x, int y, int w, int h, char * label); -extern "C" void free_fl_pack(PACK p); +extern "C" inline PACK new_fl_pack(int x, int y, int w, int h, char * label); +extern "C" inline void free_fl_pack(PACK p); -extern "C" int fl_pack_get_spacing(PACK p); -extern "C" void fl_pack_set_spacing(PACK p, int t); +extern "C" inline int fl_pack_get_spacing(PACK p); +extern "C" inline void fl_pack_set_spacing(PACK p, int t); #endif diff --git a/src/c_fl_paged_device.cpp b/src/c_fl_paged_device.cpp index 6c56c75..2f60c23 100644 --- a/src/c_fl_paged_device.cpp +++ b/src/c_fl_paged_device.cpp @@ -30,65 +30,79 @@ void free_fl_paged_device(PAGED_DEVICE p) { int fl_paged_device_start_job(PAGED_DEVICE p, int c) { - return reinterpret_cast(p)->start_job(c,0,0); + // virtual so disable dispatch + return reinterpret_cast(p)->Fl_Paged_Device::start_job(c,0,0); } int fl_paged_device_start_job2(PAGED_DEVICE p, int c, int f, int t) { - return reinterpret_cast(p)->start_job(c,&f,&t); + // virtual so disable dispatch + return reinterpret_cast(p)->Fl_Paged_Device::start_job(c,&f,&t); } void fl_paged_device_end_job(PAGED_DEVICE p) { - reinterpret_cast(p)->end_job(); + // virtual so disable dispatch + reinterpret_cast(p)->Fl_Paged_Device::end_job(); } int fl_paged_device_start_page(PAGED_DEVICE p) { - return reinterpret_cast(p)->start_page(); + // virtual so disable dispatch + return reinterpret_cast(p)->Fl_Paged_Device::start_page(); } int fl_paged_device_end_page(PAGED_DEVICE p) { - return reinterpret_cast(p)->end_page(); + // virtual so disable dispatch + return reinterpret_cast(p)->Fl_Paged_Device::end_page(); } void fl_paged_device_margins(PAGED_DEVICE p, int * l, int * t, int * r, int * b) { - reinterpret_cast(p)->margins(l,t,r,b); + // virtual so disable dispatch + reinterpret_cast(p)->Fl_Paged_Device::margins(l,t,r,b); } int fl_paged_device_printable_rect(PAGED_DEVICE p, int * w, int * h) { - return reinterpret_cast(p)->printable_rect(w,h); + // virtual so disable dispatch + return reinterpret_cast(p)->Fl_Paged_Device::printable_rect(w,h); } void fl_paged_device_get_origin(PAGED_DEVICE p, int * x, int * y) { - reinterpret_cast(p)->origin(x,y); + // virtual so disable dispatch + reinterpret_cast(p)->Fl_Paged_Device::origin(x,y); } void fl_paged_device_set_origin(PAGED_DEVICE p, int x, int y) { - reinterpret_cast(p)->origin(x,y); + // virtual so disable dispatch + reinterpret_cast(p)->Fl_Paged_Device::origin(x,y); } void fl_paged_device_rotate(PAGED_DEVICE p, float r) { - reinterpret_cast(p)->rotate(r); + // virtual so disable dispatch + reinterpret_cast(p)->Fl_Paged_Device::rotate(r); } void fl_paged_device_scale(PAGED_DEVICE p, float x, float y) { - reinterpret_cast(p)->scale(x,y); + // virtual so disable dispatch + reinterpret_cast(p)->Fl_Paged_Device::scale(x,y); } void fl_paged_device_translate(PAGED_DEVICE p, int x, int y) { - reinterpret_cast(p)->translate(x,y); + // virtual so disable dispatch + reinterpret_cast(p)->Fl_Paged_Device::translate(x,y); } void fl_paged_device_untranslate(PAGED_DEVICE p) { - reinterpret_cast(p)->untranslate(); + // virtual so disable dispatch + reinterpret_cast(p)->Fl_Paged_Device::untranslate(); } void fl_paged_device_print_widget(PAGED_DEVICE p, void * i, int dx, int dy) { - reinterpret_cast(p)->print_widget(reinterpret_cast(i),dx,dy); + // virtual so disable dispatch + reinterpret_cast(p)->Fl_Paged_Device::print_widget(reinterpret_cast(i),dx,dy); } void fl_paged_device_print_window(PAGED_DEVICE p, void * i, int dx, int dy) { @@ -96,7 +110,8 @@ void fl_paged_device_print_window(PAGED_DEVICE p, void * i, int dx, int dy) { } void fl_paged_device_print_window_part(PAGED_DEVICE p, void * i, int x, int y, int w, int h, int dx, int dy) { - reinterpret_cast(p)->print_window_part(reinterpret_cast(i),x,y,w,h,dx,dy); + // virtual so disable dispatch + reinterpret_cast(p)->Fl_Paged_Device::print_window_part(reinterpret_cast(i),x,y,w,h,dx,dy); } diff --git a/src/c_fl_paged_device.h b/src/c_fl_paged_device.h index 0d4a7f1..f83dbaa 100644 --- a/src/c_fl_paged_device.h +++ b/src/c_fl_paged_device.h @@ -11,32 +11,32 @@ typedef void* PAGED_DEVICE; -extern "C" PAGED_DEVICE new_fl_paged_device(void); -extern "C" void free_fl_paged_device(PAGED_DEVICE p); +extern "C" inline PAGED_DEVICE new_fl_paged_device(void); +extern "C" inline void free_fl_paged_device(PAGED_DEVICE p); -extern "C" int fl_paged_device_start_job(PAGED_DEVICE p, int c); -extern "C" int fl_paged_device_start_job2(PAGED_DEVICE p, int c, int f, int t); -extern "C" void fl_paged_device_end_job(PAGED_DEVICE p); -extern "C" int fl_paged_device_start_page(PAGED_DEVICE p); -extern "C" int fl_paged_device_end_page(PAGED_DEVICE p); +extern "C" inline int fl_paged_device_start_job(PAGED_DEVICE p, int c); +extern "C" inline int fl_paged_device_start_job2(PAGED_DEVICE p, int c, int f, int t); +extern "C" inline void fl_paged_device_end_job(PAGED_DEVICE p); +extern "C" inline int fl_paged_device_start_page(PAGED_DEVICE p); +extern "C" inline int fl_paged_device_end_page(PAGED_DEVICE p); -extern "C" void fl_paged_device_margins(PAGED_DEVICE p, int * l, int * t, int * r, int * b); -extern "C" int fl_paged_device_printable_rect(PAGED_DEVICE p, int * w, int * h); -extern "C" void fl_paged_device_get_origin(PAGED_DEVICE p, int * x, int * y); -extern "C" void fl_paged_device_set_origin(PAGED_DEVICE p, int x, int y); -extern "C" void fl_paged_device_rotate(PAGED_DEVICE p, float r); -extern "C" void fl_paged_device_scale(PAGED_DEVICE p, float x, float y); -extern "C" void fl_paged_device_translate(PAGED_DEVICE p, int x, int y); -extern "C" void fl_paged_device_untranslate(PAGED_DEVICE p); +extern "C" inline void fl_paged_device_margins(PAGED_DEVICE p, int * l, int * t, int * r, int * b); +extern "C" inline int fl_paged_device_printable_rect(PAGED_DEVICE p, int * w, int * h); +extern "C" inline void fl_paged_device_get_origin(PAGED_DEVICE p, int * x, int * y); +extern "C" inline void fl_paged_device_set_origin(PAGED_DEVICE p, int x, int y); +extern "C" inline void fl_paged_device_rotate(PAGED_DEVICE p, float r); +extern "C" inline void fl_paged_device_scale(PAGED_DEVICE p, float x, float y); +extern "C" inline void fl_paged_device_translate(PAGED_DEVICE p, int x, int y); +extern "C" inline void fl_paged_device_untranslate(PAGED_DEVICE p); -extern "C" void fl_paged_device_print_widget(PAGED_DEVICE p, void * i, int dx, int dy); -extern "C" void fl_paged_device_print_window(PAGED_DEVICE p, void * i, int dx, int dy); -extern "C" void fl_paged_device_print_window_part(PAGED_DEVICE p, void * i, int x, int y, int w, int h, int dx, int dy); +extern "C" inline void fl_paged_device_print_widget(PAGED_DEVICE p, void * i, int dx, int dy); +extern "C" inline void fl_paged_device_print_window(PAGED_DEVICE p, void * i, int dx, int dy); +extern "C" inline void fl_paged_device_print_window_part(PAGED_DEVICE p, void * i, int x, int y, int w, int h, int dx, int dy); #endif diff --git a/src/c_fl_progress.cpp b/src/c_fl_progress.cpp index 5fff1ae..342e08b 100644 --- a/src/c_fl_progress.cpp +++ b/src/c_fl_progress.cpp @@ -71,26 +71,26 @@ void free_fl_progress(PROGRESS p) { float fl_progress_get_minimum(PROGRESS p) { - return reinterpret_cast(p)->minimum(); + return reinterpret_cast(p)->minimum(); } void fl_progress_set_minimum(PROGRESS p, float t) { - reinterpret_cast(p)->minimum(t); + reinterpret_cast(p)->minimum(t); } float fl_progress_get_maximum(PROGRESS p) { - return reinterpret_cast(p)->maximum(); + return reinterpret_cast(p)->maximum(); } void fl_progress_set_maximum(PROGRESS p, float t) { - reinterpret_cast(p)->maximum(t); + reinterpret_cast(p)->maximum(t); } float fl_progress_get_value(PROGRESS p) { - return reinterpret_cast(p)->value(); + return reinterpret_cast(p)->value(); } void fl_progress_set_value(PROGRESS p, float t) { - reinterpret_cast(p)->value(t); + reinterpret_cast(p)->value(t); } diff --git a/src/c_fl_progress.h b/src/c_fl_progress.h index 0254bfd..94e4149 100644 --- a/src/c_fl_progress.h +++ b/src/c_fl_progress.h @@ -11,26 +11,26 @@ typedef void* PROGRESS; -extern "C" void progress_set_draw_hook(PROGRESS p, void * d); -extern "C" void fl_progress_draw(PROGRESS p); -extern "C" void progress_set_handle_hook(PROGRESS p, void * h); -extern "C" int fl_progress_handle(PROGRESS p, int e); +extern "C" inline void progress_set_draw_hook(PROGRESS p, void * d); +extern "C" inline void fl_progress_draw(PROGRESS p); +extern "C" inline void progress_set_handle_hook(PROGRESS p, void * h); +extern "C" inline int fl_progress_handle(PROGRESS p, int e); -extern "C" PROGRESS new_fl_progress(int x, int y, int w, int h, char* label); -extern "C" void free_fl_progress(PROGRESS p); +extern "C" inline PROGRESS new_fl_progress(int x, int y, int w, int h, char* label); +extern "C" inline void free_fl_progress(PROGRESS p); -extern "C" float fl_progress_get_minimum(PROGRESS p); -extern "C" void fl_progress_set_minimum(PROGRESS p, float t); -extern "C" float fl_progress_get_maximum(PROGRESS p); -extern "C" void fl_progress_set_maximum(PROGRESS p, float t); -extern "C" float fl_progress_get_value(PROGRESS p); -extern "C" void fl_progress_set_value(PROGRESS p, float t); +extern "C" inline float fl_progress_get_minimum(PROGRESS p); +extern "C" inline void fl_progress_set_minimum(PROGRESS p, float t); +extern "C" inline float fl_progress_get_maximum(PROGRESS p); +extern "C" inline void fl_progress_set_maximum(PROGRESS p, float t); +extern "C" inline float fl_progress_get_value(PROGRESS p); +extern "C" inline void fl_progress_set_value(PROGRESS p, float t); #endif diff --git a/src/c_fl_screen.cpp b/src/c_fl_screen.cpp index 4b13602..7db7741 100644 --- a/src/c_fl_screen.cpp +++ b/src/c_fl_screen.cpp @@ -31,3 +31,50 @@ void fl_screen_dpi(float &h, float &v, int n) { Fl::screen_dpi(h, v, n); } + + + +int fl_screen_num(int x, int y) { + return Fl::screen_num(x, y); +} + + +int fl_screen_num2(int x, int y, int w, int h) { + return Fl::screen_num(x, y, w, h); +} + + + + +void fl_screen_work_area(int &x, int &y, int &w, int &h, int px, int py) { + Fl::screen_work_area(x, y, w, h, px, py); +} + +void fl_screen_work_area2(int &x, int &y, int &w, int &h, int n) { + Fl::screen_work_area(x, y, w, h, n); +} + +void fl_screen_work_area3(int &x, int &y, int &w, int &h) { + Fl::screen_work_area(x, y, w, h); +} + + + + +void fl_screen_xywh(int &x, int &y, int &w, int &h, int px, int py) { + Fl::screen_xywh(x, y, w, h, px, py); +} + +void fl_screen_xywh2(int &x, int &y, int &w, int &h, int n) { + Fl::screen_xywh(x, y, w, h, n); +} + +void fl_screen_xywh3(int &x, int &y, int &w, int &h) { + Fl::screen_xywh(x, y, w, h); +} + +void fl_screen_xywh4(int &x, int &y, int &w, int &h, int px, int py, int pw, int ph) { + Fl::screen_xywh(x, y, w, h, px, py, pw, ph); +} + + diff --git a/src/c_fl_screen.h b/src/c_fl_screen.h index 287f170..fd92e5d 100644 --- a/src/c_fl_screen.h +++ b/src/c_fl_screen.h @@ -4,14 +4,31 @@ #define FL_SCREEN_GUARD -extern "C" int fl_screen_x(); -extern "C" int fl_screen_y(); -extern "C" int fl_screen_w(); -extern "C" int fl_screen_h(); -extern "C" int fl_screen_count(); -extern "C" void fl_screen_dpi(float &h, float &v, int n); +extern "C" inline int fl_screen_x(); +extern "C" inline int fl_screen_y(); +extern "C" inline int fl_screen_w(); +extern "C" inline int fl_screen_h(); + + +extern "C" inline int fl_screen_count(); +extern "C" inline void fl_screen_dpi(float &h, float &v, int n); + + +extern "C" inline int fl_screen_num(int x, int y); +extern "C" inline int fl_screen_num2(int x, int y, int w, int h); + + +extern "C" inline void fl_screen_work_area(int &x, int &y, int &w, int &h, int px, int py); +extern "C" inline void fl_screen_work_area2(int &x, int &y, int &w, int &h, int n); +extern "C" inline void fl_screen_work_area3(int &x, int &y, int &w, int &h); + + +extern "C" inline void fl_screen_xywh(int &x, int &y, int &w, int &h, int px, int py); +extern "C" inline void fl_screen_xywh2(int &x, int &y, int &w, int &h, int n); +extern "C" inline void fl_screen_xywh3(int &x, int &y, int &w, int &h); +extern "C" inline void fl_screen_xywh4(int &x, int &y, int &w, int &h, int px, int py, int pw, int ph); #endif diff --git a/src/c_fl_scroll.cpp b/src/c_fl_scroll.cpp index 659b042..281446a 100644 --- a/src/c_fl_scroll.cpp +++ b/src/c_fl_scroll.cpp @@ -70,6 +70,13 @@ void free_fl_scroll(SCROLL s) { +void fl_scroll_clear(SCROLL s) { + reinterpret_cast(s)->clear(); +} + + + + void fl_scroll_to(SCROLL s, int x, int y) { reinterpret_cast(s)->scroll_to(x, y); } diff --git a/src/c_fl_scroll.h b/src/c_fl_scroll.h index 35528f6..36bc0d4 100644 --- a/src/c_fl_scroll.h +++ b/src/c_fl_scroll.h @@ -11,28 +11,31 @@ 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" inline void scroll_set_draw_hook(SCROLL s, void * d); +extern "C" inline void fl_scroll_draw(SCROLL s); +extern "C" inline void scroll_set_handle_hook(SCROLL s, void * h); +extern "C" inline 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" inline SCROLL new_fl_scroll(int x, int y, int w, int h, char* label); +extern "C" inline 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" inline void fl_scroll_clear(SCROLL s); -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" inline void fl_scroll_to(SCROLL s, int x, int y); +extern "C" inline void fl_scroll_set_type(SCROLL s, int t); + + +extern "C" inline int fl_scroll_get_size(SCROLL s); +extern "C" inline void fl_scroll_set_size(SCROLL s, int t); +extern "C" inline int fl_scroll_xposition(SCROLL s); +extern "C" inline int fl_scroll_yposition(SCROLL s); #endif diff --git a/src/c_fl_spinner.cpp b/src/c_fl_spinner.cpp index e006b2c..7fd5938 100644 --- a/src/c_fl_spinner.cpp +++ b/src/c_fl_spinner.cpp @@ -71,89 +71,89 @@ void free_fl_spinner(SPINNER n) { unsigned int fl_spinner_get_color(SPINNER n) { - return reinterpret_cast(n)->color(); + return reinterpret_cast(n)->color(); } void fl_spinner_set_color(SPINNER n, unsigned int t) { - reinterpret_cast(n)->color(t); + reinterpret_cast(n)->color(t); } unsigned int fl_spinner_get_selection_color(SPINNER n) { - return reinterpret_cast(n)->selection_color(); + return reinterpret_cast(n)->selection_color(); } void fl_spinner_set_selection_color(SPINNER n, unsigned int t) { - reinterpret_cast(n)->selection_color(t); + reinterpret_cast(n)->selection_color(t); } unsigned int fl_spinner_get_textcolor(SPINNER n) { - return reinterpret_cast(n)->textcolor(); + return reinterpret_cast(n)->textcolor(); } void fl_spinner_set_textcolor(SPINNER n, unsigned int t) { - reinterpret_cast(n)->textcolor(t); + reinterpret_cast(n)->textcolor(t); } int fl_spinner_get_textfont(SPINNER n) { - return reinterpret_cast(n)->textfont(); + return reinterpret_cast(n)->textfont(); } void fl_spinner_set_textfont(SPINNER n, int t) { - reinterpret_cast(n)->textfont(t); + reinterpret_cast(n)->textfont(t); } int fl_spinner_get_textsize(SPINNER n) { - return reinterpret_cast(n)->textsize(); + return reinterpret_cast(n)->textsize(); } void fl_spinner_set_textsize(SPINNER n, int t) { - reinterpret_cast(n)->textsize(t); + reinterpret_cast(n)->textsize(t); } double fl_spinner_get_minimum(SPINNER n) { - return reinterpret_cast(n)->minimum(); + return reinterpret_cast(n)->minimum(); } void fl_spinner_set_minimum(SPINNER n, double t) { - reinterpret_cast(n)->minimum(t); + reinterpret_cast(n)->minimum(t); } double fl_spinner_get_maximum(SPINNER n) { - return reinterpret_cast(n)->maximum(); + return reinterpret_cast(n)->maximum(); } void fl_spinner_set_maximum(SPINNER n, double t) { - reinterpret_cast(n)->maximum(t); + reinterpret_cast(n)->maximum(t); } void fl_spinner_range(SPINNER n, double a, double b) { - reinterpret_cast(n)->range(a,b); + reinterpret_cast(n)->range(a,b); } double fl_spinner_get_step(SPINNER n) { - return reinterpret_cast(n)->step(); + return reinterpret_cast(n)->step(); } void fl_spinner_set_step(SPINNER n, double t) { - reinterpret_cast(n)->step(t); + reinterpret_cast(n)->step(t); } int fl_spinner_get_type(SPINNER n) { - return reinterpret_cast(n)->type(); + return reinterpret_cast(n)->type(); } void fl_spinner_set_type(SPINNER n, int t) { - reinterpret_cast(n)->type(t); + reinterpret_cast(n)->type(t); } double fl_spinner_get_value(SPINNER n) { - return reinterpret_cast(n)->value(); + return reinterpret_cast(n)->value(); } void fl_spinner_set_value(SPINNER n, double t) { - reinterpret_cast(n)->value(t); + reinterpret_cast(n)->value(t); } diff --git a/src/c_fl_spinner.h b/src/c_fl_spinner.h index 81fb26f..d16b765 100644 --- a/src/c_fl_spinner.h +++ b/src/c_fl_spinner.h @@ -11,43 +11,43 @@ typedef void* SPINNER; -extern "C" void spinner_set_draw_hook(SPINNER n, void * d); -extern "C" void fl_spinner_draw(SPINNER n); -extern "C" void spinner_set_handle_hook(SPINNER n, void * h); -extern "C" int fl_spinner_handle(SPINNER n, int e); +extern "C" inline void spinner_set_draw_hook(SPINNER n, void * d); +extern "C" inline void fl_spinner_draw(SPINNER n); +extern "C" inline void spinner_set_handle_hook(SPINNER n, void * h); +extern "C" inline int fl_spinner_handle(SPINNER n, int e); -extern "C" SPINNER new_fl_spinner(int x, int y, int w, int h, char* label); -extern "C" void free_fl_spinner(SPINNER n); +extern "C" inline SPINNER new_fl_spinner(int x, int y, int w, int h, char* label); +extern "C" inline void free_fl_spinner(SPINNER n); -extern "C" unsigned int fl_spinner_get_color(SPINNER n); -extern "C" void fl_spinner_set_color(SPINNER n, unsigned int t); -extern "C" unsigned int fl_spinner_get_selection_color(SPINNER n); -extern "C" void fl_spinner_set_selection_color(SPINNER n, unsigned int t); -extern "C" unsigned int fl_spinner_get_textcolor(SPINNER n); -extern "C" void fl_spinner_set_textcolor(SPINNER n, unsigned int t); -extern "C" int fl_spinner_get_textfont(SPINNER n); -extern "C" void fl_spinner_set_textfont(SPINNER n, int t); -extern "C" int fl_spinner_get_textsize(SPINNER n); -extern "C" void fl_spinner_set_textsize(SPINNER n, int t); +extern "C" inline unsigned int fl_spinner_get_color(SPINNER n); +extern "C" inline void fl_spinner_set_color(SPINNER n, unsigned int t); +extern "C" inline unsigned int fl_spinner_get_selection_color(SPINNER n); +extern "C" inline void fl_spinner_set_selection_color(SPINNER n, unsigned int t); +extern "C" inline unsigned int fl_spinner_get_textcolor(SPINNER n); +extern "C" inline void fl_spinner_set_textcolor(SPINNER n, unsigned int t); +extern "C" inline int fl_spinner_get_textfont(SPINNER n); +extern "C" inline void fl_spinner_set_textfont(SPINNER n, int t); +extern "C" inline int fl_spinner_get_textsize(SPINNER n); +extern "C" inline void fl_spinner_set_textsize(SPINNER n, int t); -extern "C" double fl_spinner_get_minimum(SPINNER n); -extern "C" void fl_spinner_set_minimum(SPINNER n, double t); -extern "C" double fl_spinner_get_maximum(SPINNER n); -extern "C" void fl_spinner_set_maximum(SPINNER n, double t); -extern "C" void fl_spinner_range(SPINNER n, double a, double b); -extern "C" double fl_spinner_get_step(SPINNER n); -extern "C" void fl_spinner_set_step(SPINNER n, double t); -extern "C" int fl_spinner_get_type(SPINNER n); -extern "C" void fl_spinner_set_type(SPINNER n, int t); -extern "C" double fl_spinner_get_value(SPINNER n); -extern "C" void fl_spinner_set_value(SPINNER n, double t); +extern "C" inline double fl_spinner_get_minimum(SPINNER n); +extern "C" inline void fl_spinner_set_minimum(SPINNER n, double t); +extern "C" inline double fl_spinner_get_maximum(SPINNER n); +extern "C" inline void fl_spinner_set_maximum(SPINNER n, double t); +extern "C" inline void fl_spinner_range(SPINNER n, double a, double b); +extern "C" inline double fl_spinner_get_step(SPINNER n); +extern "C" inline void fl_spinner_set_step(SPINNER n, double t); +extern "C" inline int fl_spinner_get_type(SPINNER n); +extern "C" inline void fl_spinner_set_type(SPINNER n, int t); +extern "C" inline double fl_spinner_get_value(SPINNER n); +extern "C" inline void fl_spinner_set_value(SPINNER n, double t); #endif diff --git a/src/c_fl_tabs.cpp b/src/c_fl_tabs.cpp index 452be6d..3d8e7bc 100644 --- a/src/c_fl_tabs.cpp +++ b/src/c_fl_tabs.cpp @@ -71,29 +71,29 @@ void free_fl_tabs(TABS t) { void fl_tabs_client_area(TABS t, int * x, int * y, int * w, int * h, int i) { - reinterpret_cast(t)->client_area(*x,*y,*w,*h,i); + reinterpret_cast(t)->client_area(*x,*y,*w,*h,i); } void * fl_tabs_get_push(TABS t) { - return reinterpret_cast(t)->push(); + return reinterpret_cast(t)->push(); } void fl_tabs_set_push(TABS t, void * w) { - reinterpret_cast(t)->push(reinterpret_cast(w)); + reinterpret_cast(t)->push(reinterpret_cast(w)); } void * fl_tabs_get_value(TABS t) { - return reinterpret_cast(t)->value(); + return reinterpret_cast(t)->value(); } void fl_tabs_set_value(TABS t, void * w) { - reinterpret_cast(t)->value(reinterpret_cast(w)); + reinterpret_cast(t)->value(reinterpret_cast(w)); } void * fl_tabs_which(TABS t, int x, int y) { - return reinterpret_cast(t)->which(x,y); + return reinterpret_cast(t)->which(x,y); } diff --git a/src/c_fl_tabs.h b/src/c_fl_tabs.h index 2d12500..97b2039 100644 --- a/src/c_fl_tabs.h +++ b/src/c_fl_tabs.h @@ -11,28 +11,28 @@ typedef void* TABS; -extern "C" void tabs_set_draw_hook(TABS t, void * d); -extern "C" void fl_tabs_draw(TABS t); -extern "C" void tabs_set_handle_hook(TABS t, void * h); -extern "C" int fl_tabs_handle(TABS t, int e); +extern "C" inline void tabs_set_draw_hook(TABS t, void * d); +extern "C" inline void fl_tabs_draw(TABS t); +extern "C" inline void tabs_set_handle_hook(TABS t, void * h); +extern "C" inline int fl_tabs_handle(TABS t, int e); -extern "C" TABS new_fl_tabs(int x, int y, int w, int h, char* label); -extern "C" void free_fl_tabs(TABS t); +extern "C" inline TABS new_fl_tabs(int x, int y, int w, int h, char* label); +extern "C" inline void free_fl_tabs(TABS t); -extern "C" void fl_tabs_client_area(TABS t, int * x, int * y, int * w, int * h, int i); +extern "C" inline void fl_tabs_client_area(TABS t, int * x, int * y, int * w, int * h, int i); -extern "C" void * fl_tabs_get_push(TABS t); -extern "C" void fl_tabs_set_push(TABS t, void * w); -extern "C" void * fl_tabs_get_value(TABS t); -extern "C" void fl_tabs_set_value(TABS t, void * w); -extern "C" void * fl_tabs_which(TABS t, int x, int y); +extern "C" inline void * fl_tabs_get_push(TABS t); +extern "C" inline void fl_tabs_set_push(TABS t, void * w); +extern "C" inline void * fl_tabs_get_value(TABS t); +extern "C" inline void fl_tabs_set_value(TABS t, void * w); +extern "C" inline void * fl_tabs_which(TABS t, int x, int y); #endif diff --git a/src/c_fl_tile.cpp b/src/c_fl_tile.cpp index 32dc7a0..c891164 100644 --- a/src/c_fl_tile.cpp +++ b/src/c_fl_tile.cpp @@ -71,7 +71,7 @@ void free_fl_tile(TILE t) { void fl_tile_position(TILE t, int ox, int oy, int nx, int ny) { - reinterpret_cast(t)->position(ox,oy,nx,ny); + reinterpret_cast(t)->position(ox,oy,nx,ny); } diff --git a/src/c_fl_tile.h b/src/c_fl_tile.h index b87e806..88e72d9 100644 --- a/src/c_fl_tile.h +++ b/src/c_fl_tile.h @@ -11,21 +11,21 @@ typedef void* TILE; -extern "C" void tile_set_draw_hook(TILE n, void * d); -extern "C" void fl_tile_draw(TILE n); -extern "C" void tile_set_handle_hook(TILE n, void * h); -extern "C" int fl_tile_handle(TILE n, int e); +extern "C" inline void tile_set_draw_hook(TILE n, void * d); +extern "C" inline void fl_tile_draw(TILE n); +extern "C" inline void tile_set_handle_hook(TILE n, void * h); +extern "C" inline int fl_tile_handle(TILE n, int e); -extern "C" TILE new_fl_tile(int x, int y, int w, int h, char * label); -extern "C" void free_fl_tile(TILE t); +extern "C" inline TILE new_fl_tile(int x, int y, int w, int h, char * label); +extern "C" inline void free_fl_tile(TILE t); -extern "C" void fl_tile_position(TILE t, int ox, int oy, int nx, int ny); +extern "C" inline void fl_tile_position(TILE t, int ox, int oy, int nx, int ny); #endif diff --git a/src/c_fl_wizard.cpp b/src/c_fl_wizard.cpp index 7ed33db..0d7ba4b 100644 --- a/src/c_fl_wizard.cpp +++ b/src/c_fl_wizard.cpp @@ -85,22 +85,22 @@ void free_fl_wizard(WIZARD w) { void fl_wizard_next(WIZARD w) { - reinterpret_cast(w)->next(); + reinterpret_cast(w)->next(); } void fl_wizard_prev(WIZARD w) { - reinterpret_cast(w)->prev(); + reinterpret_cast(w)->prev(); } void * fl_wizard_get_visible(WIZARD w) { - return reinterpret_cast(w)->value(); + return reinterpret_cast(w)->value(); } void fl_wizard_set_visible(WIZARD w, void * i) { - reinterpret_cast(w)->value(reinterpret_cast(i)); + reinterpret_cast(w)->value(reinterpret_cast(i)); } diff --git a/src/c_fl_wizard.h b/src/c_fl_wizard.h index 2068683..205f2cd 100644 --- a/src/c_fl_wizard.h +++ b/src/c_fl_wizard.h @@ -11,26 +11,26 @@ typedef void* WIZARD; -extern "C" void wizard_set_draw_hook(WIZARD w, void * d); -extern "C" void fl_wizard_draw(WIZARD w); -extern "C" void wizard_set_handle_hook(WIZARD w, void * h); -extern "C" int fl_wizard_handle(WIZARD w, int e); +extern "C" inline void wizard_set_draw_hook(WIZARD w, void * d); +extern "C" inline void fl_wizard_draw(WIZARD w); +extern "C" inline void wizard_set_handle_hook(WIZARD w, void * h); +extern "C" inline int fl_wizard_handle(WIZARD w, int e); -extern "C" WIZARD new_fl_wizard(int x, int y, int w, int h, char* label); -extern "C" void free_fl_wizard(WIZARD w); +extern "C" inline WIZARD new_fl_wizard(int x, int y, int w, int h, char* label); +extern "C" inline void free_fl_wizard(WIZARD w); -extern "C" void fl_wizard_next(WIZARD w); -extern "C" void fl_wizard_prev(WIZARD w); +extern "C" inline void fl_wizard_next(WIZARD w); +extern "C" inline void fl_wizard_prev(WIZARD w); -extern "C" void * fl_wizard_get_visible(WIZARD w); -extern "C" void fl_wizard_set_visible(WIZARD w, void * i); +extern "C" inline void * fl_wizard_get_visible(WIZARD w); +extern "C" inline void fl_wizard_set_visible(WIZARD w, void * i); #endif diff --git a/src/fltk-devices-surfaces-copy.adb b/src/fltk-devices-surfaces-copy.adb index d5a31f1..cceb945 100644 --- a/src/fltk-devices-surfaces-copy.adb +++ b/src/fltk-devices-surfaces-copy.adb @@ -17,10 +17,12 @@ package body FLTK.Devices.Surfaces.Copy is (W, H : in Interfaces.C.int) return System.Address; pragma Import (C, new_fl_copy_surface, "new_fl_copy_surface"); + pragma Inline (new_fl_copy_surface); procedure free_fl_copy_surface (S : in System.Address); pragma Import (C, free_fl_copy_surface, "free_fl_copy_surface"); + pragma Inline (free_fl_copy_surface); @@ -29,11 +31,13 @@ package body FLTK.Devices.Surfaces.Copy is (S : in System.Address) return Interfaces.C.int; pragma Import (C, fl_copy_surface_get_w, "fl_copy_surface_get_w"); + pragma Inline (fl_copy_surface_get_w); function fl_copy_surface_get_h (S : in System.Address) return Interfaces.C.int; pragma Import (C, fl_copy_surface_get_h, "fl_copy_surface_get_h"); + pragma Inline (fl_copy_surface_get_h); @@ -42,12 +46,14 @@ package body FLTK.Devices.Surfaces.Copy is (S, W : in System.Address; OX, OY : in Interfaces.C.int); pragma Import (C, fl_copy_surface_draw, "fl_copy_surface_draw"); + pragma Inline (fl_copy_surface_draw); procedure fl_copy_surface_draw_decorated_window (S, W : in System.Address; OX, OY : in Interfaces.C.int); pragma Import (C, fl_copy_surface_draw_decorated_window, "fl_copy_surface_draw_decorated_window"); + pragma Inline (fl_copy_surface_draw_decorated_window); @@ -55,6 +61,7 @@ package body FLTK.Devices.Surfaces.Copy is procedure fl_copy_surface_set_current (S : in System.Address); pragma Import (C, fl_copy_surface_set_current, "fl_copy_surface_set_current"); + pragma Inline (fl_copy_surface_set_current); diff --git a/src/fltk-devices-surfaces-copy.ads b/src/fltk-devices-surfaces-copy.ads index deafe8d..d0a0d2f 100644 --- a/src/fltk-devices-surfaces-copy.ads +++ b/src/fltk-devices-surfaces-copy.ads @@ -10,6 +10,9 @@ package FLTK.Devices.Surfaces.Copy is type Copy_Surface is new Surface_Device with private; + type Copy_Surface_Reference (Data : not null access Copy_Surface'Class) is + limited null record with Implicit_Dereference => Data; + @@ -61,5 +64,18 @@ private (This : in out Copy_Surface); + + + pragma Inline (Get_W); + pragma Inline (Get_H); + + + pragma Inline (Draw_Widget); + pragma Inline (Draw_Decorated_Window); + + + pragma Inline (Set_Current); + + end FLTK.Devices.Surfaces.Copy; diff --git a/src/fltk-devices-surfaces-image.adb b/src/fltk-devices-surfaces-image.adb index 1955bf3..570f729 100644 --- a/src/fltk-devices-surfaces-image.adb +++ b/src/fltk-devices-surfaces-image.adb @@ -17,10 +17,12 @@ package body FLTK.Devices.Surfaces.Image is (W, H, R : in Interfaces.C.int) return System.Address; pragma Import (C, new_fl_image_surface, "new_fl_image_surface"); + pragma Inline (new_fl_image_surface); procedure free_fl_image_surface (S : in System.Address); pragma Import (C, free_fl_image_surface, "free_fl_image_surface"); + pragma Inline (free_fl_image_surface); @@ -29,12 +31,14 @@ package body FLTK.Devices.Surfaces.Image is (S, I : in System.Address; OX, OY : in Interfaces.C.int); pragma Import (C, fl_image_surface_draw, "fl_image_surface_draw"); + pragma Inline (fl_image_surface_draw); procedure fl_image_surface_draw_decorated_window (S, I : in System.Address; OX, OY : in Interfaces.C.int); pragma Import (C, fl_image_surface_draw_decorated_window, "fl_image_surface_draw_decorated_window"); + pragma Inline (fl_image_surface_draw_decorated_window); @@ -43,11 +47,13 @@ package body FLTK.Devices.Surfaces.Image is (S : in System.Address) return System.Address; pragma Import (C, fl_image_surface_image, "fl_image_surface_image"); + pragma Inline (fl_image_surface_image); function fl_image_surface_highres_image (S : in System.Address) return System.Address; pragma Import (C, fl_image_surface_highres_image, "fl_image_surface_highres_image"); + pragma Inline (fl_image_surface_highres_image); @@ -55,6 +61,7 @@ package body FLTK.Devices.Surfaces.Image is procedure fl_image_surface_set_current (S : in System.Address); pragma Import (C, fl_image_surface_set_current, "fl_image_surface_set_current"); + pragma Inline (fl_image_surface_set_current); diff --git a/src/fltk-devices-surfaces-image.ads b/src/fltk-devices-surfaces-image.ads index 6023af2..21870dd 100644 --- a/src/fltk-devices-surfaces-image.ads +++ b/src/fltk-devices-surfaces-image.ads @@ -12,6 +12,9 @@ package FLTK.Devices.Surfaces.Image is type Image_Surface is new Surface_Device with private; + type Image_Surface_Reference (Data : not null access Image_Surface'Class) is + limited null record with Implicit_Dereference => Data; + @@ -73,5 +76,21 @@ private (This : in out Image_Surface); + + + pragma Inline (Is_Highres); + + + pragma Inline (Draw_Widget); + pragma Inline (Draw_Decorated_Window); + + + pragma Inline (Get_Image); + pragma Inline (Get_Highres_Image); + + + pragma Inline (Set_Current); + + end FLTK.Devices.Surfaces.Image; diff --git a/src/fltk-devices-surfaces-paged.adb b/src/fltk-devices-surfaces-paged.adb index f21dd3c..c615078 100644 --- a/src/fltk-devices-surfaces-paged.adb +++ b/src/fltk-devices-surfaces-paged.adb @@ -17,10 +17,12 @@ package body FLTK.Devices.Surfaces.Paged is function new_fl_paged_device return System.Address; pragma Import (C, new_fl_paged_device, "new_fl_paged_device"); + pragma Inline (new_fl_paged_device); procedure free_fl_paged_device (D : in System.Address); pragma Import (C, free_fl_paged_device, "free_fl_paged_device"); + pragma Inline (free_fl_paged_device); @@ -30,26 +32,31 @@ package body FLTK.Devices.Surfaces.Paged is C : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_paged_device_start_job, "fl_paged_device_start_job"); + pragma Inline (fl_paged_device_start_job); function fl_paged_device_start_job2 (D : in System.Address; C, F, T : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_paged_device_start_job2, "fl_paged_device_start_job2"); + pragma Inline (fl_paged_device_start_job2); procedure fl_paged_device_end_job (D : in System.Address); pragma Import (C, fl_paged_device_end_job, "fl_paged_device_end_job"); + pragma Inline (fl_paged_device_end_job); function fl_paged_device_start_page (D : in System.Address) return Interfaces.C.int; pragma Import (C, fl_paged_device_start_page, "fl_paged_device_start_page"); + pragma Inline (fl_paged_device_start_page); function fl_paged_device_end_page (D : in System.Address) return Interfaces.C.int; pragma Import (C, fl_paged_device_end_page, "fl_paged_device_end_page"); + pragma Inline (fl_paged_device_end_page); @@ -58,41 +65,49 @@ package body FLTK.Devices.Surfaces.Paged is (D : in System.Address; L, T, R, B : out Interfaces.C.int); pragma Import (C, fl_paged_device_margins, "fl_paged_device_margins"); + pragma Inline (fl_paged_device_margins); function fl_paged_device_printable_rect (D : in System.Address; W, H : out Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_paged_device_printable_rect, "fl_paged_device_printable_rect"); + pragma Inline (fl_paged_device_printable_rect); procedure fl_paged_device_get_origin (D : in System.Address; X, Y : out Interfaces.C.int); pragma Import (C, fl_paged_device_get_origin, "fl_paged_device_get_origin"); + pragma Inline (fl_paged_device_get_origin); procedure fl_paged_device_set_origin (D : in System.Address; X, Y : in Interfaces.C.int); pragma Import (C, fl_paged_device_set_origin, "fl_paged_device_set_origin"); + pragma Inline (fl_paged_device_set_origin); procedure fl_paged_device_rotate (D : in System.Address; R : in Interfaces.C.C_float); pragma Import (C, fl_paged_device_rotate, "fl_paged_device_rotate"); + pragma Inline (fl_paged_device_rotate); procedure fl_paged_device_scale (D : in System.Address; X, Y : in Interfaces.C.C_float); pragma Import (C, fl_paged_device_scale, "fl_paged_device_scale"); + pragma Inline (fl_paged_device_scale); procedure fl_paged_device_translate (D : in System.Address; X, Y : in Interfaces.C.int); pragma Import (C, fl_paged_device_translate, "fl_paged_device_translate"); + pragma Inline (fl_paged_device_translate); procedure fl_paged_device_untranslate (D : in System.Address); pragma Import (C, fl_paged_device_untranslate, "fl_paged_device_untranslate"); + pragma Inline (fl_paged_device_untranslate); @@ -101,16 +116,19 @@ package body FLTK.Devices.Surfaces.Paged is (D, I : in System.Address; DX, DY : in Interfaces.C.int); pragma Import (C, fl_paged_device_print_widget, "fl_paged_device_print_widget"); + pragma Inline (fl_paged_device_print_widget); procedure fl_paged_device_print_window (D, I : in System.Address; DX, DY : in Interfaces.C.int); pragma Import (C, fl_paged_device_print_window, "fl_paged_device_print_window"); + pragma Inline (fl_paged_device_print_window); procedure fl_paged_device_print_window_part (D, I : in System.Address; X, Y, W, H, DX, DY : in Interfaces.C.int); pragma Import (C, fl_paged_device_print_window_part, "fl_paged_device_print_window_part"); + pragma Inline (fl_paged_device_print_window_part); @@ -140,6 +158,8 @@ package body FLTK.Devices.Surfaces.Paged is end return; end Create; + pragma Inline (Create); + end Forge; @@ -202,42 +222,34 @@ package body FLTK.Devices.Surfaces.Paged is procedure Get_Margins (This : in Paged_Surface; - Left, Top, Right, Bottom : out Integer) - is - L, T, R, B : Interfaces.C.int; + Left, Top, Right, Bottom : out Integer) is begin - fl_paged_device_margins (This.Void_Ptr, L, T, R, B); - Left := Integer (L); - Top := Integer (T); - Right := Integer (R); - Bottom := Integer (B); + fl_paged_device_margins + (This.Void_Ptr, + Interfaces.C.int (Left), + Interfaces.C.int (Top), + Interfaces.C.int (Right), + Interfaces.C.int (Bottom)); end Get_Margins; procedure Get_Printable_Rect (This : in Paged_Surface; - W, H : out Integer) - is - Wid, Hei : Interfaces.C.int; + W, H : out Integer) is begin - if fl_paged_device_printable_rect (This.Void_Ptr, Wid, Hei) /= 0 then + if fl_paged_device_printable_rect + (This.Void_Ptr, Interfaces.C.int (W), Interfaces.C.int (H)) /= 0 + then raise Page_Error; - else - W := Integer (Wid); - H := Integer (Hei); end if; end Get_Printable_Rect; procedure Get_Origin (This : in Paged_Surface; - X, Y : out Integer) - is - Eks, Why : Interfaces.C.int; + X, Y : out Integer) is begin - fl_paged_device_get_origin (This.Void_Ptr, Eks, Why); - X := Integer (Eks); - Y := Integer (Why); + fl_paged_device_get_origin (This.Void_Ptr, Interfaces.C.int (X), Interfaces.C.int (Y)); end Get_Origin; diff --git a/src/fltk-devices-surfaces-paged.ads b/src/fltk-devices-surfaces-paged.ads index 908c8d1..15d0276 100644 --- a/src/fltk-devices-surfaces-paged.ads +++ b/src/fltk-devices-surfaces-paged.ads @@ -10,6 +10,9 @@ package FLTK.Devices.Surfaces.Paged is type Paged_Surface is new Surface_Device with private; + type Paged_Surface_Reference (Data : not null access Paged_Surface'Class) is + limited null record with Implicit_Dereference => Data; + type Page_Format is (A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10, @@ -122,5 +125,28 @@ private (This : in out Paged_Surface); + + + pragma Inline (Start_Job); + pragma Inline (End_Job); + pragma Inline (Start_Page); + pragma Inline (End_Page); + + + pragma Inline (Get_Margins); + pragma Inline (Get_Printable_Rect); + pragma Inline (Get_Origin); + pragma Inline (Set_Origin); + pragma Inline (Rotate); + pragma Inline (Scale); + pragma Inline (Translate); + pragma Inline (Untranslate); + + + pragma Inline (Print_Widget); + pragma Inline (Print_Window); + pragma Inline (Print_Window_Part); + + end FLTK.Devices.Surfaces.Paged; diff --git a/src/fltk-event.adb b/src/fltk-event.adb index 398021d..34a86e1 100644 --- a/src/fltk-event.adb +++ b/src/fltk-event.adb @@ -2,7 +2,7 @@ with - Interfaces.C; + Interfaces.C.Strings; use type @@ -12,9 +12,108 @@ use type package body FLTK.Event is - function fl_event_key + procedure fl_event_add_handler + (F : in System.Address); + pragma Import (C, fl_event_add_handler, "fl_event_add_handler"); + pragma Inline (fl_event_add_handler); + + procedure fl_event_set_event_dispatch + (F : in System.Address); + pragma Import (C, fl_event_set_event_dispatch, "fl_event_set_event_dispatch"); + pragma Inline (fl_event_set_event_dispatch); + + -- actually handle_ but can't have an underscore on the end of an identifier + function fl_event_handle + (E : in Interfaces.C.int; + W : in System.Address) return Interfaces.C.int; - pragma Import (C, fl_event_key, "fl_event_key"); + pragma Import (C, fl_event_handle, "fl_event_handle"); + pragma Inline (fl_event_handle); + + + + + function fl_event_get_grab + return System.Address; + pragma Import (C, fl_event_get_grab, "fl_event_get_grab"); + pragma Inline (fl_event_get_grab); + + procedure fl_event_set_grab + (T : in System.Address); + pragma Import (C, fl_event_set_grab, "fl_event_set_grab"); + pragma Inline (fl_event_set_grab); + + function fl_event_get_pushed + return System.Address; + pragma Import (C, fl_event_get_pushed, "fl_event_get_pushed"); + pragma Inline (fl_event_get_pushed); + + procedure fl_event_set_pushed + (T : in System.Address); + pragma Import (C, fl_event_set_pushed, "fl_event_set_pushed"); + pragma Inline (fl_event_set_pushed); + + function fl_event_get_belowmouse + return System.Address; + pragma Import (C, fl_event_get_belowmouse, "fl_event_get_belowmouse"); + pragma Inline (fl_event_get_belowmouse); + + procedure fl_event_set_belowmouse + (T : in System.Address); + pragma Import (C, fl_event_set_belowmouse, "fl_event_set_belowmouse"); + pragma Inline (fl_event_set_belowmouse); + + function fl_event_get_focus + return System.Address; + pragma Import (C, fl_event_get_focus, "fl_event_get_focus"); + pragma Inline (fl_event_get_focus); + + procedure fl_event_set_focus + (To : in System.Address); + pragma Import (C, fl_event_set_focus, "fl_event_set_focus"); + pragma Inline (fl_event_set_focus); + + + + + function fl_event_compose + (D : out Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_event_compose, "fl_event_compose"); + pragma Inline (fl_event_compose); + + procedure fl_event_compose_reset; + pragma Import (C, fl_event_compose_reset, "fl_event_compose_reset"); + pragma Inline (fl_event_compose_reset); + + function fl_event_text + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, fl_event_text, "fl_event_text"); + pragma Inline (fl_event_text); + + function fl_event_length + return Interfaces.C.int; + pragma Import (C, fl_event_length, "fl_event_length"); + pragma Inline (fl_event_length); + + + + + function fl_event_get + return Interfaces.C.int; + pragma Import (C, fl_event_get, "fl_event_get"); + pragma Inline (fl_event_get); + + function fl_event_state + return Interfaces.C.unsigned_long; + pragma Import (C, fl_event_state, "fl_event_state"); + pragma Inline (fl_event_state); + + function fl_event_check_state + (S : in Interfaces.C.unsigned_long) + return Interfaces.C.int; + pragma Import (C, fl_event_check_state, "fl_event_check_state"); + pragma Inline (fl_event_check_state); @@ -22,31 +121,326 @@ package body FLTK.Event is function fl_event_x return Interfaces.C.int; pragma Import (C, fl_event_x, "fl_event_x"); + pragma Inline (fl_event_x); function fl_event_x_root return Interfaces.C.int; pragma Import (C, fl_event_x_root, "fl_event_x_root"); + pragma Inline (fl_event_x_root); function fl_event_y return Interfaces.C.int; pragma Import (C, fl_event_y, "fl_event_y"); + pragma Inline (fl_event_y); function fl_event_y_root return Interfaces.C.int; pragma Import (C, fl_event_y_root, "fl_event_y_root"); + pragma Inline (fl_event_y_root); + + function fl_event_dx + return Interfaces.C.int; + pragma Import (C, fl_event_dx, "fl_event_dx"); + pragma Inline (fl_event_dx); + + function fl_event_dy + return Interfaces.C.int; + pragma Import (C, fl_event_dy, "fl_event_dy"); + pragma Inline (fl_event_dy); + + procedure fl_event_get_mouse + (X, Y : out Interfaces.C.int); + pragma Import (C, fl_event_get_mouse, "fl_event_get_mouse"); + pragma Inline (fl_event_get_mouse); function fl_event_is_click return Interfaces.C.int; pragma Import (C, fl_event_is_click, "fl_event_is_click"); + pragma Inline (fl_event_is_click); + + function fl_event_is_clicks + return Interfaces.C.int; + pragma Import (C, fl_event_is_clicks, "fl_event_is_clicks"); + pragma Inline (fl_event_is_clicks); + + procedure fl_event_set_clicks + (C : in Interfaces.C.int); + pragma Import (C, fl_event_set_clicks, "fl_event_set_clicks"); + pragma Inline (fl_event_set_clicks); + + function fl_event_button + return Interfaces.C.int; + pragma Import (C, fl_event_button, "fl_event_button"); + pragma Inline (fl_event_button); + + function fl_event_button1 + return Interfaces.C.int; + pragma Import (C, fl_event_button1, "fl_event_button1"); + pragma Inline (fl_event_button1); + + function fl_event_button2 + return Interfaces.C.int; + pragma Import (C, fl_event_button2, "fl_event_button2"); + pragma Inline (fl_event_button2); + + function fl_event_button3 + return Interfaces.C.int; + pragma Import (C, fl_event_button3, "fl_event_button3"); + pragma Inline (fl_event_button3); + + function fl_event_inside + (X, Y, W, H : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_event_inside, "fl_event_inside"); + pragma Inline (fl_event_inside); + + + + + function fl_event_key + return Interfaces.C.unsigned_long; + pragma Import (C, fl_event_key, "fl_event_key"); + pragma Inline (fl_event_key); + + function fl_event_original_key + return Interfaces.C.unsigned_long; + pragma Import (C, fl_event_original_key, "fl_event_original_key"); + pragma Inline (fl_event_original_key); + + function fl_event_key_during + (K : in Interfaces.C.unsigned_long) + return Interfaces.C.int; + pragma Import (C, fl_event_key_during, "fl_event_key_during"); + pragma Inline (fl_event_key_during); + + function fl_event_get_key + (K : in Interfaces.C.unsigned_long) + return Interfaces.C.int; + pragma Import (C, fl_event_get_key, "fl_event_get_key"); + pragma Inline (fl_event_get_key); + + function fl_event_ctrl + return Interfaces.C.int; + pragma Import (C, fl_event_ctrl, "fl_event_ctrl"); + pragma Inline (fl_event_ctrl); + + function fl_event_alt + return Interfaces.C.int; + pragma Import (C, fl_event_alt, "fl_event_alt"); + pragma Inline (fl_event_alt); + + function fl_event_command + return Interfaces.C.int; + pragma Import (C, fl_event_command, "fl_event_command"); + pragma Inline (fl_event_command); + + function fl_event_shift + return Interfaces.C.int; + pragma Import (C, fl_event_shift, "fl_event_shift"); + pragma Inline (fl_event_shift); + + + + + function Event_Handler_Hook + (Num : in Interfaces.C.int) + return Interfaces.C.int + is + Ret_Val : Event_Outcome; + begin + for Func of reverse Handlers loop + Ret_Val := Func (Event_Kind'Val (Num)); + if Ret_Val /= Not_Handled then + return Event_Outcome'Pos (Ret_Val); + end if; + end loop; + return Event_Outcome'Pos (Not_Handled); + end Event_Handler_Hook; + + + function Dispatch_Hook + (Num : in Interfaces.C.int; + Ptr : in System.Address) + return Interfaces.C.int + is + Ret_Val : Event_Outcome; + Actual_Window : access FLTK.Widgets.Groups.Windows.Window'Class := + Window_Convert.To_Pointer (fl_widget_get_user_data (Ptr)); + begin + if Current_Dispatch = null then + Ret_Val := Default_Dispatch (Event_Kind'Val (Num), Actual_Window.all); + else + Ret_Val := Current_Dispatch (Event_Kind'Val (Num), Actual_Window.all); + end if; + return Event_Outcome'Pos (Ret_Val); + end Dispatch_Hook; + + + + + procedure Add_Handler + (Func : in Event_Handler) is + begin + Handlers.Append (Func); + end Add_Handler; + + + procedure Remove_Handler + (Func : in Event_Handler) is + begin + for I in reverse Handlers.First_Index .. Handlers.Last_Index loop + if Handlers (I) = Func then + Handlers.Delete (I); + return; + end if; + end loop; + end Remove_Handler; + + + function Get_Dispatch + return Event_Dispatch is + begin + if Current_Dispatch = null then + return Default_Dispatch'Access; + else + return Current_Dispatch; + end if; + end Get_Dispatch; + + + procedure Set_Dispatch + (Func : in Event_Dispatch) is + begin + Current_Dispatch := Func; + end Set_Dispatch; + + + function Default_Dispatch + (Event : in Event_Kind; + Win : in out FLTK.Widgets.Groups.Windows.Window'Class) + return Event_Outcome is + begin + return Event_Outcome'Val (fl_event_handle + (Event_Kind'Pos (Event), + Wrapper (Win).Void_Ptr)); + end Default_Dispatch; + + + + + function Get_Grab + return access FLTK.Widgets.Groups.Windows.Window'Class is + begin + return Window_Convert.To_Pointer (fl_widget_get_user_data (fl_event_get_grab)); + end Get_Grab; + + + procedure Set_Grab + (To : in FLTK.Widgets.Groups.Windows.Window'Class) is + begin + fl_event_set_grab (Wrapper (To).Void_Ptr); + end Set_Grab; + + + procedure Release_Grab is + begin + fl_event_set_grab (System.Null_Address); + end Release_Grab; + + + function Get_Pushed + return access FLTK.Widgets.Widget'Class is + begin + return Widget_Convert.To_Pointer (fl_widget_get_user_data (fl_event_get_pushed)); + end Get_Pushed; + + + procedure Set_Pushed + (To : in FLTK.Widgets.Widget'Class) is + begin + fl_event_set_pushed (Wrapper (To).Void_Ptr); + end Set_Pushed; + + + function Get_Below_Mouse + return access FLTK.Widgets.Widget'Class is + begin + return Widget_Convert.To_Pointer (fl_widget_get_user_data (fl_event_get_belowmouse)); + end Get_Below_Mouse; + + + procedure Set_Below_Mouse + (To : in FLTK.Widgets.Widget'Class) is + begin + fl_event_set_belowmouse (Wrapper (To).Void_Ptr); + end Set_Below_Mouse; + + + function Get_Focus + return access FLTK.Widgets.Widget'Class is + begin + return Widget_Convert.To_Pointer (fl_widget_get_user_data (fl_event_get_focus)); + end Get_Focus; + + + procedure Set_Focus + (To : in FLTK.Widgets.Widget'Class) is + begin + fl_event_set_focus (Wrapper (To).Void_Ptr); + end Set_Focus; + + + + + function Compose + (Del : out Natural) + return Boolean is + begin + return fl_event_compose (Interfaces.C.int (Del)) /= 0; + end Compose; + + procedure Compose_Reset is + begin + fl_event_compose_reset; + end Compose_Reset; + + + function Text + return String is + begin + return Interfaces.C.Strings.Value (fl_event_text, Interfaces.C.size_t (fl_event_length)); + end Text; + + + function Text_Length + return Natural is + begin + return Natural (fl_event_length); + end Text_Length; - function Last_Keypress - return Shortcut_Key is + function Last + return Event_Kind is begin - return C_To_Key (Interfaces.C.unsigned_long (fl_event_key)); - end Last_Keypress; + return Event_Kind'Val (fl_event_get); + end Last; + + + function Last_Modifier + return Modifier is + begin + return To_Ada (fl_event_state); + end Last_Modifier; + + + function Last_Modifier + (Had : in Modifier) + return Boolean is + begin + return fl_event_check_state (To_C (Had)) /= 0; + end Last_Modifier; @@ -79,6 +473,28 @@ package body FLTK.Event is end Mouse_Y_Root; + + function Mouse_DX + return Integer is + begin + return Integer (fl_event_dx); + end Mouse_DX; + + + function Mouse_DY + return Integer is + begin + return Integer (fl_event_dy); + end Mouse_DY; + + + procedure Get_Mouse + (X, Y : out Integer) is + begin + fl_event_get_mouse (Interfaces.C.int (X), Interfaces.C.int (Y)); + end Get_Mouse; + + function Is_Click return Boolean is begin @@ -86,5 +502,126 @@ package body FLTK.Event is end Is_Click; + function Is_Multi_Click + return Boolean is + begin + return fl_event_is_clicks /= 0; + end Is_Multi_Click; + + + procedure Set_Clicks + (To : in Natural) is + begin + fl_event_set_clicks (Interfaces.C.int (To)); + end Set_Clicks; + + + function Last_Button + return Mouse_Button is + begin + return Mouse_Button'Val (fl_event_button); + end Last_Button; + + + function Mouse_Left + return Boolean is + begin + return fl_event_button1 /= 0; + end Mouse_Left; + + + function Mouse_Middle + return Boolean is + begin + return fl_event_button2 /= 0; + end Mouse_Middle; + + + function Mouse_Right + return Boolean is + begin + return fl_event_button3 /= 0; + end Mouse_Right; + + + function Is_Inside + (X, Y, W, H : in Integer) + return Boolean is + begin + return fl_event_inside + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H)) /= 0; + end Is_Inside; + + + + + function Last_Key + return Keypress is + begin + return To_Ada (fl_event_key); + end Last_Key; + + + function Original_Last_Key + return Keypress is + begin + return To_Ada (fl_event_original_key); + end Original_Last_Key; + + + function Pressed_During + (Key : in Keypress) + return Boolean is + begin + return fl_event_key_during (To_C (Key)) /= 0; + end Pressed_During; + + + function Key_Now + (Key : in Keypress) + return Boolean is + begin + return fl_event_get_key (To_C (Key)) /= 0; + end Key_Now; + + + function Key_Ctrl + return Boolean is + begin + return fl_event_ctrl /= 0; + end Key_Ctrl; + + + function Key_Alt + return Boolean is + begin + return fl_event_alt /= 0; + end Key_Alt; + + + function Key_Command + return Boolean is + begin + return fl_event_command /= 0; + end Key_Command; + + + function Key_Shift + return Boolean is + begin + return fl_event_shift /= 0; + end Key_Shift; + + +begin + + + fl_event_add_handler (Event_Handler_Hook'Address); + fl_event_set_event_dispatch (Dispatch_Hook'Address); + + end FLTK.Event; diff --git a/src/fltk-event.ads b/src/fltk-event.ads index fc6fafb..62f106a 100644 --- a/src/fltk-event.ads +++ b/src/fltk-event.ads @@ -1,10 +1,103 @@ +with + + FLTK.Widgets.Groups.Windows; + +private with + + Ada.Containers.Vectors, + System.Address_To_Access_Conversions; + + package FLTK.Event is - function Last_Keypress - return Shortcut_Key; + type Event_Handler is access function + (Event : in Event_Kind) + return Event_Outcome; + + type Event_Dispatch is access function + (Event : in Event_Kind; + Win : in out FLTK.Widgets.Groups.Windows.Window'Class) + return Event_Outcome; + + + + + procedure Add_Handler + (Func : in Event_Handler); + + procedure Remove_Handler + (Func : in Event_Handler); + + function Get_Dispatch + return Event_Dispatch; + + procedure Set_Dispatch + (Func : in Event_Dispatch); + + function Default_Dispatch + (Event : in Event_Kind; + Win : in out FLTK.Widgets.Groups.Windows.Window'Class) + return Event_Outcome; + + + + + function Get_Grab + return access FLTK.Widgets.Groups.Windows.Window'Class; + + procedure Set_Grab + (To : in FLTK.Widgets.Groups.Windows.Window'Class); + + procedure Release_Grab; + + function Get_Pushed + return access FLTK.Widgets.Widget'Class; + + procedure Set_Pushed + (To : in FLTK.Widgets.Widget'Class); + + function Get_Below_Mouse + return access FLTK.Widgets.Widget'Class; + + procedure Set_Below_Mouse + (To : in FLTK.Widgets.Widget'Class); + + function Get_Focus + return access FLTK.Widgets.Widget'Class; + + procedure Set_Focus + (To : in FLTK.Widgets.Widget'Class); + + + + + function Compose + (Del : out Natural) + return Boolean; + + procedure Compose_Reset; + + function Text + return String; + + function Text_Length + return Natural; + + + + + function Last + return Event_Kind; + + function Last_Modifier + return Modifier; + + function Last_Modifier + (Had : in Modifier) + return Boolean; @@ -21,9 +114,93 @@ package FLTK.Event is function Mouse_Y_Root return Integer; + function Mouse_DX + return Integer; + + function Mouse_DY + return Integer; + + procedure Get_Mouse + (X, Y : out Integer); + function Is_Click return Boolean; + function Is_Multi_Click + return Boolean; + + procedure Set_Clicks + (To : in Natural); + + function Last_Button + return Mouse_Button; + + function Mouse_Left + return Boolean; + + function Mouse_Middle + return Boolean; + + function Mouse_Right + return Boolean; + + function Is_Inside + (X, Y, W, H : in Integer) + return Boolean; + + + + + function Last_Key + return Keypress; + + function Original_Last_Key + return Keypress; + + function Pressed_During + (Key : in Keypress) + return Boolean; + + function Key_Now + (Key : in Keypress) + return Boolean; + + function Key_Ctrl + return Boolean; + + function Key_Alt + return Boolean; + + function Key_Command + return Boolean; + + function Key_Shift + return Boolean; + + +private + + + package Widget_Convert is new System.Address_To_Access_Conversions + (FLTK.Widgets.Widget'Class); + package Window_Convert is new System.Address_To_Access_Conversions + (FLTK.Widgets.Groups.Windows.Window'Class); + + + package Handler_Vectors is new Ada.Containers.Vectors + (Index_Type => Positive, Element_Type => Event_Handler); + + + Handlers : Handler_Vectors.Vector := Handler_Vectors.Empty_Vector; + Current_Dispatch : Event_Dispatch := null; + + + 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"); + pragma Inline (fl_widget_get_user_data); + end FLTK.Event; diff --git a/src/fltk-screen.adb b/src/fltk-screen.adb index c85be21..284b0bd 100644 --- a/src/fltk-screen.adb +++ b/src/fltk-screen.adb @@ -12,28 +12,100 @@ use type package body FLTK.Screen is - function fl_screen_x return Interfaces.C.int; + function fl_screen_x + return Interfaces.C.int; pragma Import (C, fl_screen_x, "fl_screen_x"); + pragma Inline (fl_screen_x); - function fl_screen_y return Interfaces.C.int; + function fl_screen_y + return Interfaces.C.int; pragma Import (C, fl_screen_y, "fl_screen_y"); + pragma Inline (fl_screen_y); - function fl_screen_w return Interfaces.C.int; + function fl_screen_w + return Interfaces.C.int; pragma Import (C, fl_screen_w, "fl_screen_w"); + pragma Inline (fl_screen_w); - function fl_screen_h return Interfaces.C.int; + function fl_screen_h + return Interfaces.C.int; pragma Import (C, fl_screen_h, "fl_screen_h"); + pragma Inline (fl_screen_h); - function fl_screen_count return Interfaces.C.int; + function fl_screen_count + return Interfaces.C.int; pragma Import (C, fl_screen_count, "fl_screen_count"); + pragma Inline (fl_screen_count); procedure fl_screen_dpi (H, V : out Interfaces.C.C_float; N : in Interfaces.C.int); pragma Import (C, fl_screen_dpi, "fl_screen_dpi"); + pragma Inline (fl_screen_dpi); + + + + + function fl_screen_num + (X, Y : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_screen_num, "fl_screen_num"); + pragma Inline (fl_screen_num); + + function fl_screen_num2 + (X, Y, W, H : in Interfaces.C.int) + return Interfaces.C.int; + pragma Import (C, fl_screen_num2, "fl_screen_num2"); + pragma Inline (fl_screen_num2); + + + + + procedure fl_screen_work_area + (X, Y, W, H : out Interfaces.C.int; + PX, PY : in Interfaces.C.int); + pragma Import (C, fl_screen_work_area, "fl_screen_work_area"); + pragma Inline (fl_screen_work_area); + + procedure fl_screen_work_area2 + (X, Y, W, H : out Interfaces.C.int; + N : in Interfaces.C.int); + pragma Import (C, fl_screen_work_area2, "fl_screen_work_area2"); + pragma Inline (fl_screen_work_area2); + + procedure fl_screen_work_area3 + (X, Y, W, H : out Interfaces.C.int); + pragma Import (C, fl_screen_work_area3, "fl_screen_work_area3"); + pragma Inline (fl_screen_work_area3); + + + + + procedure fl_screen_xywh + (X, Y, W, H : out Interfaces.C.int; + PX, PY : in Interfaces.C.int); + pragma Import (C, fl_screen_xywh, "fl_screen_xywh"); + pragma Inline (fl_screen_xywh); + + procedure fl_screen_xywh2 + (X, Y, W, H : out Interfaces.C.int; + N : in Interfaces.C.int); + pragma Import (C, fl_screen_xywh2, "fl_screen_xywh2"); + pragma Inline (fl_screen_xywh2); + + procedure fl_screen_xywh3 + (X, Y, W, H : out Interfaces.C.int); + pragma Import (C, fl_screen_xywh3, "fl_screen_xywh3"); + pragma Inline (fl_screen_xywh3); + + procedure fl_screen_xywh4 + (X, Y, W, H : out Interfaces.C.int; + PX, PY, PW, PH : in Interfaces.C.int); + pragma Import (C, fl_screen_xywh4, "fl_screen_xywh4"); + pragma Inline (fl_screen_xywh4); @@ -64,14 +136,14 @@ package body FLTK.Screen is - function Get_Count return Integer is + function Count return Integer is begin return Integer (fl_screen_count); - end Get_Count; + end Count; -- Screen numbers in the range 1 .. Get_Count - procedure Get_DPI + procedure DPI (Horizontal, Vertical : out Float; Screen_Number : in Integer := 1) is @@ -80,7 +152,127 @@ package body FLTK.Screen is fl_screen_dpi (H, V, Interfaces.C.int (Screen_Number) - 1); Horizontal := Float (H); Vertical := Float (V); - end Get_DPI; + end DPI; + + + + + function Containing + (X, Y : in Integer) + return Integer is + begin + return Integer (fl_screen_num + (Interfaces.C.int (X), + Interfaces.C.int (Y))); + end Containing; + + + function Containing + (X, Y, W, H : in Integer) + return Integer is + begin + return Integer (fl_screen_num2 + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H))); + end Containing; + + + + + procedure Work_Area + (X, Y, W, H : out Integer; + Pos_X, Pos_Y : in Integer) is + begin + fl_screen_work_area + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (Pos_X), + Interfaces.C.int (Pos_Y)); + end Work_Area; + + + procedure Work_Area + (X, Y, W, H : out Integer; + Screen_Num : in Integer) is + begin + fl_screen_work_area2 + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (Screen_Num)); + end Work_Area; + + + procedure Work_Area + (X, Y, W, H : out Integer) is + begin + fl_screen_work_area3 + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H)); + end Work_Area; + + + + + procedure Bounding_Rect + (X, Y, W, H : out Integer; + Pos_X, Pos_Y : in Integer) is + begin + fl_screen_xywh + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (Pos_X), + Interfaces.C.int (Pos_Y)); + end Bounding_Rect; + + + procedure Bounding_Rect + (X, Y, W, H : out Integer; + Screen_Num : in Integer) is + begin + fl_screen_xywh2 + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (Screen_Num)); + end Bounding_Rect; + + + procedure Bounding_Rect + (X, Y, W, H : out Integer) is + begin + fl_screen_xywh3 + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H)); + end Bounding_Rect; + + + procedure Bounding_Rect + (X, Y, W, H : out Integer; + PX, PY, PW, PH : in Integer) is + begin + fl_screen_xywh4 + (Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (PX), + Interfaces.C.int (PY), + Interfaces.C.int (PW), + Interfaces.C.int (PH)); + end Bounding_Rect; end FLTK.Screen; diff --git a/src/fltk-screen.ads b/src/fltk-screen.ads index 10060d4..0656619 100644 --- a/src/fltk-screen.ads +++ b/src/fltk-screen.ads @@ -3,21 +3,72 @@ package FLTK.Screen is - function Get_X return Integer; - function Get_Y return Integer; - function Get_W return Integer; - function Get_H return Integer; + function Get_X + return Integer; + function Get_Y + return Integer; - function Get_Count return Integer; + function Get_W + return Integer; + function Get_H + return Integer; - -- Screen numbers in the range 1 .. Get_Count - procedure Get_DPI + + + + function Count return Integer; + + -- Screen numbers in the range 1 .. Count + procedure DPI (Horizontal, Vertical : out Float; Screen_Number : in Integer := 1); + + + function Containing + (X, Y : in Integer) + return Integer; + + function Containing + (X, Y, W, H : in Integer) + return Integer; + + + + + procedure Work_Area + (X, Y, W, H : out Integer; + Pos_X, Pos_Y : in Integer); + + procedure Work_Area + (X, Y, W, H : out Integer; + Screen_Num : in Integer); + + procedure Work_Area + (X, Y, W, H : out Integer); + + + + + procedure Bounding_Rect + (X, Y, W, H : out Integer; + Pos_X, Pos_Y : in Integer); + + procedure Bounding_Rect + (X, Y, W, H : out Integer; + Screen_Num : in Integer); + + procedure Bounding_Rect + (X, Y, W, H : out Integer); + + procedure Bounding_Rect + (X, Y, W, H : out Integer; + PX, PY, PW, PH : in Integer); + + private @@ -25,8 +76,11 @@ private pragma Inline (Get_Y); pragma Inline (Get_W); pragma Inline (Get_H); - pragma Inline (Get_Count); - pragma Inline (Get_DPI); + pragma Inline (Count); + pragma Inline (DPI); + pragma Inline (Containing); + pragma Inline (Work_Area); + pragma Inline (Bounding_Rect); end FLTK.Screen; diff --git a/src/fltk-widgets-buttons.adb b/src/fltk-widgets-buttons.adb index 050c571..2f5cbf4 100644 --- a/src/fltk-widgets-buttons.adb +++ b/src/fltk-widgets-buttons.adb @@ -188,17 +188,17 @@ package body FLTK.Widgets.Buttons is function Get_Shortcut (This : in Button) - return Shortcut_Key is + return Key_Combo is begin - return C_To_Key (Interfaces.C.unsigned_long (fl_button_get_shortcut (This.Void_Ptr))); + return To_Ada (Interfaces.C.unsigned_long (fl_button_get_shortcut (This.Void_Ptr))); end Get_Shortcut; procedure Set_Shortcut (This : in out Button; - Key : in Shortcut_Key) is + Key : in Key_Combo) is begin - fl_button_set_shortcut (This.Void_Ptr, Interfaces.C.int (Key_To_C (Key))); + fl_button_set_shortcut (This.Void_Ptr, Interfaces.C.int (To_C (Key))); end Set_Shortcut; diff --git a/src/fltk-widgets-buttons.ads b/src/fltk-widgets-buttons.ads index 7c70c2e..8e59e9c 100644 --- a/src/fltk-widgets-buttons.ads +++ b/src/fltk-widgets-buttons.ads @@ -49,11 +49,11 @@ package FLTK.Widgets.Buttons is function Get_Shortcut (This : in Button) - return Shortcut_Key; + return Key_Combo; procedure Set_Shortcut (This : in out Button; - Key : in Shortcut_Key); + Key : in Key_Combo); diff --git a/src/fltk-widgets-charts.adb b/src/fltk-widgets-charts.adb index f828576..078a64d 100644 --- a/src/fltk-widgets-charts.adb +++ b/src/fltk-widgets-charts.adb @@ -17,10 +17,12 @@ package body FLTK.Widgets.Charts is procedure chart_set_draw_hook (W, D : in System.Address); pragma Import (C, chart_set_draw_hook, "chart_set_draw_hook"); + pragma Inline (chart_set_draw_hook); procedure chart_set_handle_hook (W, H : in System.Address); pragma Import (C, chart_set_handle_hook, "chart_set_handle_hook"); + pragma Inline (chart_set_handle_hook); @@ -30,10 +32,12 @@ package body FLTK.Widgets.Charts is Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_chart, "new_fl_chart"); + pragma Inline (new_fl_chart); procedure free_fl_chart (B : in System.Address); pragma Import (C, free_fl_chart, "free_fl_chart"); + pragma Inline (free_fl_chart); @@ -44,6 +48,7 @@ package body FLTK.Widgets.Charts is L : in Interfaces.C.char_array; P : in Interfaces.C.unsigned); pragma Import (C, fl_chart_add, "fl_chart_add"); + pragma Inline (fl_chart_add); procedure fl_chart_insert (C : in System.Address; @@ -52,6 +57,7 @@ package body FLTK.Widgets.Charts is L : in Interfaces.C.char_array; P : in Interfaces.C.unsigned); pragma Import (C, fl_chart_insert, "fl_chart_insert"); + pragma Inline (fl_chart_insert); procedure fl_chart_replace (C : in System.Address; @@ -60,10 +66,12 @@ package body FLTK.Widgets.Charts is L : in Interfaces.C.char_array; P : in Interfaces.C.unsigned); pragma Import (C, fl_chart_replace, "fl_chart_replace"); + pragma Inline (fl_chart_replace); procedure fl_chart_clear (C : in System.Address); pragma Import (C, fl_chart_clear, "fl_chart_clear"); + pragma Inline (fl_chart_clear); @@ -72,36 +80,43 @@ package body FLTK.Widgets.Charts is (C : in System.Address) return Interfaces.C.int; pragma Import (C, fl_chart_get_autosize, "fl_chart_get_autosize"); + pragma Inline (fl_chart_get_autosize); procedure fl_chart_set_autosize (C : in System.Address; A : in Interfaces.C.int); pragma Import (C, fl_chart_set_autosize, "fl_chart_set_autosize"); + pragma Inline (fl_chart_set_autosize); procedure fl_chart_get_bounds (C : in System.Address; L, U : out Interfaces.C.double); pragma Import (C, fl_chart_get_bounds, "fl_chart_get_bounds"); + pragma Inline (fl_chart_get_bounds); procedure fl_chart_set_bounds (C : in System.Address; L, U : in Interfaces.C.double); pragma Import (C, fl_chart_set_bounds, "fl_chart_set_bounds"); + pragma Inline (fl_chart_set_bounds); function fl_chart_get_maxsize (C : in System.Address) return Interfaces.C.int; pragma Import (C, fl_chart_get_maxsize, "fl_chart_get_maxsize"); + pragma Inline (fl_chart_get_maxsize); procedure fl_chart_set_maxsize (C : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_chart_set_maxsize, "fl_chart_set_maxsize"); + pragma Inline (fl_chart_set_maxsize); function fl_chart_size (C : in System.Address) return Interfaces.C.int; pragma Import (C, fl_chart_size, "fl_chart_size"); + pragma Inline (fl_chart_size); @@ -110,31 +125,46 @@ package body FLTK.Widgets.Charts is (C : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_chart_get_textcolor, "fl_chart_get_textcolor"); + pragma Inline (fl_chart_get_textcolor); procedure fl_chart_set_textcolor (C : in System.Address; T : in Interfaces.C.unsigned); pragma Import (C, fl_chart_set_textcolor, "fl_chart_set_textcolor"); + pragma Inline (fl_chart_set_textcolor); function fl_chart_get_textfont (C : in System.Address) return Interfaces.C.int; pragma Import (C, fl_chart_get_textfont, "fl_chart_get_textfont"); + pragma Inline (fl_chart_get_textfont); procedure fl_chart_set_textfont (C : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_chart_set_textfont, "fl_chart_set_textfont"); + pragma Inline (fl_chart_set_textfont); function fl_chart_get_textsize (C : in System.Address) return Interfaces.C.int; pragma Import (C, fl_chart_get_textsize, "fl_chart_get_textsize"); + pragma Inline (fl_chart_get_textsize); procedure fl_chart_set_textsize (C : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_chart_set_textsize, "fl_chart_set_textsize"); + pragma Inline (fl_chart_set_textsize); + + + + + procedure fl_chart_size2 + (C : in System.Address; + W, H : in Interfaces.C.int); + pragma Import (C, fl_chart_size2, "fl_chart_size2"); + pragma Inline (fl_chart_size2); @@ -142,12 +172,14 @@ package body FLTK.Widgets.Charts is procedure fl_chart_draw (W : in System.Address); pragma Import (C, fl_chart_draw, "fl_chart_draw"); + pragma Inline (fl_chart_draw); function fl_chart_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_chart_handle, "fl_chart_handle"); + pragma Inline (fl_chart_handle); @@ -267,13 +299,12 @@ package body FLTK.Widgets.Charts is procedure Get_Bounds (This : in Chart; - Lower, Upper : out Long_Float) - is - L, U : Interfaces.C.double; + Lower, Upper : out Long_Float) is begin - fl_chart_get_bounds (This.Void_Ptr, L, U); - Lower := Long_Float (L); - Upper := Long_Float (U); + fl_chart_get_bounds + (This.Void_Ptr, + Interfaces.C.double (Lower), + Interfaces.C.double (Upper)); end Get_Bounds; @@ -364,6 +395,16 @@ package body FLTK.Widgets.Charts is + procedure Resize + (This : in out Chart; + W, H : in Integer) is + begin + fl_chart_size2 (This.Void_Ptr, Interfaces.C.int (W), Interfaces.C.int (H)); + end Resize; + + + + procedure Draw (This : in out Chart) is begin diff --git a/src/fltk-widgets-charts.ads b/src/fltk-widgets-charts.ads index 50373b0..b180bc9 100644 --- a/src/fltk-widgets-charts.ads +++ b/src/fltk-widgets-charts.ads @@ -5,6 +5,9 @@ package FLTK.Widgets.Charts is type Chart is new Widget with private; + type Chart_Reference (Data : not null access Chart'Class) is limited null record + with Implicit_Dereference => Data; + @@ -104,6 +107,13 @@ package FLTK.Widgets.Charts is + procedure Resize + (This : in out Chart; + W, H : in Integer); + + + + procedure Draw (This : in out Chart); @@ -122,5 +132,37 @@ private (This : in out Chart); + + + pragma Inline (Add); + pragma Inline (Insert); + pragma Inline (Replace); + pragma Inline (Clear); + + + pragma Inline (Will_Autosize); + pragma Inline (Set_Autosize); + pragma Inline (Get_Bounds); + pragma Inline (Set_Bounds); + pragma Inline (Get_Maximum_Size); + pragma Inline (Set_Maximum_Size); + pragma Inline (Get_Size); + + + pragma Inline (Get_Text_Color); + pragma Inline (Set_Text_Color); + pragma Inline (Get_Text_Font); + pragma Inline (Set_Text_Font); + pragma Inline (Get_Text_Size); + pragma Inline (Set_Text_Size); + + + pragma Inline (Resize); + + + pragma Inline (Draw); + pragma Inline (Handle); + + end FLTK.Widgets.Charts; diff --git a/src/fltk-widgets-groups-input_choices.adb b/src/fltk-widgets-groups-input_choices.adb index 603d480..afda09f 100644 --- a/src/fltk-widgets-groups-input_choices.adb +++ b/src/fltk-widgets-groups-input_choices.adb @@ -206,7 +206,7 @@ package body FLTK.Widgets.Groups.Input_Choices is function Menu_Button (This : in out Input_Choice) - return MB.Menu_Button_Cursor is + return MB.Menu_Button_Reference is begin return (Data => This.My_Menu_Button); end Menu_Button; diff --git a/src/fltk-widgets-groups-input_choices.ads b/src/fltk-widgets-groups-input_choices.ads index 0d4c8d4..52fa2d0 100644 --- a/src/fltk-widgets-groups-input_choices.ads +++ b/src/fltk-widgets-groups-input_choices.ads @@ -32,7 +32,7 @@ package FLTK.Widgets.Groups.Input_Choices is function Menu_Button (This : in out Input_Choice) - return FLTK.Widgets.Menus.Menu_Buttons.Menu_Button_Cursor; + return FLTK.Widgets.Menus.Menu_Buttons.Menu_Button_Reference; diff --git a/src/fltk-widgets-groups-packed.adb b/src/fltk-widgets-groups-packed.adb index 0507bb3..077d3c1 100644 --- a/src/fltk-widgets-groups-packed.adb +++ b/src/fltk-widgets-groups-packed.adb @@ -16,10 +16,12 @@ package body FLTK.Widgets.Groups.Packed is procedure pack_set_draw_hook (W, D : in System.Address); pragma Import (C, pack_set_draw_hook, "pack_set_draw_hook"); + pragma Inline (pack_set_draw_hook); procedure pack_set_handle_hook (W, H : in System.Address); pragma Import (C, pack_set_handle_hook, "pack_set_handle_hook"); + pragma Inline (pack_set_handle_hook); @@ -29,10 +31,12 @@ package body FLTK.Widgets.Groups.Packed is Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_pack, "new_fl_pack"); + pragma Inline (new_fl_pack); procedure free_fl_pack (B : in System.Address); pragma Import (C, free_fl_pack, "free_fl_pack"); + pragma Inline (free_fl_pack); @@ -41,11 +45,13 @@ package body FLTK.Widgets.Groups.Packed is (P : in System.Address) return Interfaces.C.int; pragma Import (C, fl_pack_get_spacing, "fl_pack_get_spacing"); + pragma Inline (fl_pack_get_spacing); procedure fl_pack_set_spacing (P : in System.Address; S : in Interfaces.C.int); pragma Import (C, fl_pack_set_spacing, "fl_pack_set_spacing"); + pragma Inline (fl_pack_set_spacing); @@ -53,12 +59,14 @@ package body FLTK.Widgets.Groups.Packed is procedure fl_pack_draw (W : in System.Address); pragma Import (C, fl_pack_draw, "fl_pack_draw"); + pragma Inline (fl_pack_draw); function fl_pack_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_pack_handle, "fl_pack_handle"); + pragma Inline (fl_pack_handle); diff --git a/src/fltk-widgets-groups-packed.ads b/src/fltk-widgets-groups-packed.ads index 92ed137..d711190 100644 --- a/src/fltk-widgets-groups-packed.ads +++ b/src/fltk-widgets-groups-packed.ads @@ -5,6 +5,9 @@ package FLTK.Widgets.Groups.Packed is type Packed_Group is new Group with private; + type Packed_Group_Reference (Data : not null access Packed_Group'Class) is + limited null record with Implicit_Dereference => Data; + @@ -49,5 +52,15 @@ private (This : in out Packed_Group); + + + pragma Inline (Get_Spacing); + pragma Inline (Set_Spacing); + + + pragma Inline (Draw); + pragma Inline (Handle); + + end FLTK.Widgets.Groups.Packed; diff --git a/src/fltk-widgets-groups-scrolls.adb b/src/fltk-widgets-groups-scrolls.adb index d90271d..6ceb0cb 100644 --- a/src/fltk-widgets-groups-scrolls.adb +++ b/src/fltk-widgets-groups-scrolls.adb @@ -16,10 +16,12 @@ package body FLTK.Widgets.Groups.Scrolls is procedure scroll_set_draw_hook (S, D : in System.Address); pragma Import (C, scroll_set_draw_hook, "scroll_set_draw_hook"); + pragma Inline (scroll_set_draw_hook); procedure scroll_set_handle_hook (S, H : in System.Address); pragma Import (C, scroll_set_handle_hook, "scroll_set_handle_hook"); + pragma Inline (scroll_set_handle_hook); @@ -29,10 +31,20 @@ package body FLTK.Widgets.Groups.Scrolls is Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_scroll, "new_fl_scroll"); + pragma Inline (new_fl_scroll); procedure free_fl_scroll (S : in System.Address); pragma Import (C, free_fl_scroll, "free_fl_scroll"); + pragma Inline (free_fl_scroll); + + + + + procedure fl_scroll_clear + (S : in System.Address); + pragma Import (C, fl_scroll_clear, "fl_scroll_clear"); + pragma Inline (fl_scroll_clear); @@ -41,11 +53,13 @@ package body FLTK.Widgets.Groups.Scrolls is (S : in System.Address; X, Y : in Interfaces.C.int); pragma Import (C, fl_scroll_to, "fl_scroll_to"); + pragma Inline (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"); + pragma Inline (fl_scroll_set_type); @@ -54,21 +68,25 @@ package body FLTK.Widgets.Groups.Scrolls is (S : in System.Address) return Interfaces.C.int; pragma Import (C, fl_scroll_get_size, "fl_scroll_get_size"); + pragma Inline (fl_scroll_get_size); procedure fl_scroll_set_size (S : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_scroll_set_size, "fl_scroll_set_size"); + pragma Inline (fl_scroll_set_size); function fl_scroll_xposition (S : in System.Address) return Interfaces.C.int; pragma Import (C, fl_scroll_xposition, "fl_scroll_xposition"); + pragma Inline (fl_scroll_xposition); function fl_scroll_yposition (S : in System.Address) return Interfaces.C.int; pragma Import (C, fl_scroll_yposition, "fl_scroll_yposition"); + pragma Inline (fl_scroll_yposition); @@ -76,12 +94,14 @@ package body FLTK.Widgets.Groups.Scrolls is procedure fl_scroll_draw (S : in System.Address); pragma Import (C, fl_scroll_draw, "fl_scroll_draw"); + pragma Inline (fl_scroll_draw); function fl_scroll_handle (S : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_scroll_handle, "fl_scroll_handle"); + pragma Inline (fl_scroll_handle); @@ -130,6 +150,15 @@ package body FLTK.Widgets.Groups.Scrolls is + procedure Clear + (This : in out Scroll) is + begin + fl_scroll_clear (This.Void_Ptr); + end Clear; + + + + procedure Scroll_To (This : in out Scroll; X, Y : in Integer) is diff --git a/src/fltk-widgets-groups-scrolls.ads b/src/fltk-widgets-groups-scrolls.ads index 111af90..25b2aa0 100644 --- a/src/fltk-widgets-groups-scrolls.ads +++ b/src/fltk-widgets-groups-scrolls.ads @@ -5,6 +5,9 @@ package FLTK.Widgets.Groups.Scrolls is type Scroll is new Group with private; + type Scroll_Reference (Data : not null access Scroll'Class) is limited null record + with Implicit_Dereference => Data; + type Scroll_Kind is (Horizontal, Vertical, @@ -29,6 +32,12 @@ package FLTK.Widgets.Groups.Scrolls is + procedure Clear + (This : in out Scroll); + + + + procedure Scroll_To (This : in out Scroll; X, Y : in Integer); @@ -79,5 +88,24 @@ private (This : in out Scroll); + + + pragma Inline (Clear); + + + pragma Inline (Scroll_To); + pragma Inline (Set_Type); + + + pragma Inline (Get_Scrollbar_Size); + pragma Inline (Set_Scrollbar_Size); + pragma Inline (Get_Scroll_X); + pragma Inline (Get_Scroll_Y); + + + pragma Inline (Draw); + pragma Inline (Handle); + + end FLTK.Widgets.Groups.Scrolls; diff --git a/src/fltk-widgets-groups-spinners.adb b/src/fltk-widgets-groups-spinners.adb index 03b1d52..476bb32 100644 --- a/src/fltk-widgets-groups-spinners.adb +++ b/src/fltk-widgets-groups-spinners.adb @@ -17,10 +17,12 @@ package body FLTK.Widgets.Groups.Spinners is procedure spinner_set_draw_hook (W, D : in System.Address); pragma Import (C, spinner_set_draw_hook, "spinner_set_draw_hook"); + pragma Inline (spinner_set_draw_hook); procedure spinner_set_handle_hook (W, H : in System.Address); pragma Import (C, spinner_set_handle_hook, "spinner_set_handle_hook"); + pragma Inline (spinner_set_handle_hook); @@ -30,10 +32,12 @@ package body FLTK.Widgets.Groups.Spinners is Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_spinner, "new_fl_spinner"); + pragma Inline (new_fl_spinner); procedure free_fl_spinner (W : in System.Address); pragma Import (C, free_fl_spinner, "free_fl_spinner"); + pragma Inline (free_fl_spinner); @@ -42,51 +46,61 @@ package body FLTK.Widgets.Groups.Spinners is (S : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_spinner_get_color, "fl_spinner_get_color"); + pragma Inline (fl_spinner_get_color); procedure fl_spinner_set_color (S : in System.Address; C : in Interfaces.C.unsigned); pragma Import (C, fl_spinner_set_color, "fl_spinner_set_color"); + pragma Inline (fl_spinner_set_color); function fl_spinner_get_selection_color (S : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_spinner_get_selection_color, "fl_spinner_get_selection_color"); + pragma Inline (fl_spinner_get_selection_color); procedure fl_spinner_set_selection_color (S : in System.Address; T : in Interfaces.C.unsigned); pragma Import (C, fl_spinner_set_selection_color, "fl_spinner_set_selection_color"); + pragma Inline (fl_spinner_set_selection_color); function fl_spinner_get_textcolor (S : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_spinner_get_textcolor, "fl_spinner_get_textcolor"); + pragma Inline (fl_spinner_get_textcolor); procedure fl_spinner_set_textcolor (S : in System.Address; T : in Interfaces.C.unsigned); pragma Import (C, fl_spinner_set_textcolor, "fl_spinner_set_textcolor"); + pragma Inline (fl_spinner_set_textcolor); function fl_spinner_get_textfont (S : in System.Address) return Interfaces.C.int; pragma Import (C, fl_spinner_get_textfont, "fl_spinner_get_textfont"); + pragma Inline (fl_spinner_get_textfont); procedure fl_spinner_set_textfont (S : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_spinner_set_textfont, "fl_spinner_set_textfont"); + pragma Inline (fl_spinner_set_textfont); function fl_spinner_get_textsize (S : in System.Address) return Interfaces.C.int; pragma Import (C, fl_spinner_get_textsize, "fl_spinner_get_textsize"); + pragma Inline (fl_spinner_get_textsize); procedure fl_spinner_set_textsize (S : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_spinner_set_textsize, "fl_spinner_set_textsize"); + pragma Inline (fl_spinner_set_textsize); @@ -95,56 +109,67 @@ package body FLTK.Widgets.Groups.Spinners is (S : in System.Address) return Interfaces.C.double; pragma Import (C, fl_spinner_get_minimum, "fl_spinner_get_minimum"); + pragma Inline (fl_spinner_get_minimum); procedure fl_spinner_set_minimum (S : in System.Address; T : in Interfaces.C.double); pragma Import (C, fl_spinner_set_minimum, "fl_spinner_set_minimum"); + pragma Inline (fl_spinner_set_minimum); function fl_spinner_get_maximum (S : in System.Address) return Interfaces.C.double; pragma Import (C, fl_spinner_get_maximum, "fl_spinner_get_maximum"); + pragma Inline (fl_spinner_get_maximum); procedure fl_spinner_set_maximum (S : in System.Address; T : in Interfaces.C.double); pragma Import (C, fl_spinner_set_maximum, "fl_spinner_set_maximum"); + pragma Inline (fl_spinner_set_maximum); procedure fl_spinner_range (S : in System.Address; A, B : in Interfaces.C.double); pragma Import (C, fl_spinner_range, "fl_spinner_range"); + pragma Inline (fl_spinner_range); function fl_spinner_get_step (S : in System.Address) return Interfaces.C.double; pragma Import (C, fl_spinner_get_step, "fl_spinner_get_step"); + pragma Inline (fl_spinner_get_step); procedure fl_spinner_set_step (S : in System.Address; T : in Interfaces.C.double); pragma Import (C, fl_spinner_set_step, "fl_spinner_set_step"); + pragma Inline (fl_spinner_set_step); function fl_spinner_get_type (S : in System.Address) return Interfaces.C.int; pragma Import (C, fl_spinner_get_type, "fl_spinner_get_type"); + pragma Inline (fl_spinner_get_type); procedure fl_spinner_set_type (S : in System.Address; T : in Interfaces.C.int); pragma Import (C, fl_spinner_set_type, "fl_spinner_set_type"); + pragma Inline (fl_spinner_set_type); function fl_spinner_get_value (S : in System.Address) return Interfaces.C.double; pragma Import (C, fl_spinner_get_value, "fl_spinner_get_value"); + pragma Inline (fl_spinner_get_value); procedure fl_spinner_set_value (S : in System.Address; T : in Interfaces.C.double); pragma Import (C, fl_spinner_set_value, "fl_spinner_set_value"); + pragma Inline (fl_spinner_set_value); @@ -152,12 +177,14 @@ package body FLTK.Widgets.Groups.Spinners is procedure fl_spinner_draw (W : in System.Address); pragma Import (C, fl_spinner_draw, "fl_spinner_draw"); + pragma Inline (fl_spinner_draw); function fl_spinner_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_spinner_handle, "fl_spinner_handle"); + pragma Inline (fl_spinner_handle); @@ -222,20 +249,20 @@ package body FLTK.Widgets.Groups.Spinners is end Set_Background_Color; - function Get_Select_Color + function Get_Selection_Color (This : in Spinner) return Color is begin return Color (fl_spinner_get_selection_color (This.Void_Ptr)); - end Get_Select_Color; + end Get_Selection_Color; - procedure Set_Select_Color + procedure Set_Selection_Color (This : in out Spinner; To : in Color) is begin fl_spinner_set_selection_color (This.Void_Ptr, Interfaces.C.unsigned (To)); - end Set_Select_Color; + end Set_Selection_Color; function Get_Text_Color @@ -320,6 +347,15 @@ package body FLTK.Widgets.Groups.Spinners is end Set_Maximum; + procedure Get_Range + (This : in Spinner; + Min, Max : out Long_Float) is + begin + Min := Long_Float (fl_spinner_get_minimum (This.Void_Ptr)); + Max := Long_Float (fl_spinner_get_maximum (This.Void_Ptr)); + end Get_Range; + + procedure Set_Range (This : in out Spinner; Min, Max : in Long_Float) is diff --git a/src/fltk-widgets-groups-spinners.ads b/src/fltk-widgets-groups-spinners.ads index c7e3f23..b85a3a4 100644 --- a/src/fltk-widgets-groups-spinners.ads +++ b/src/fltk-widgets-groups-spinners.ads @@ -5,6 +5,9 @@ package FLTK.Widgets.Groups.Spinners is type Spinner is new Group with private; + type Spinner_Reference (Data : not null access Spinner'Class) is limited null record + with Implicit_Dereference => Data; + type Spinner_Kind is (Float_Spin, Int_Spin); @@ -30,11 +33,11 @@ package FLTK.Widgets.Groups.Spinners is (This : in out Spinner; To : in Color); - function Get_Select_Color + function Get_Selection_Color (This : in Spinner) return Color; - procedure Set_Select_Color + procedure Set_Selection_Color (This : in out Spinner; To : in Color); @@ -81,6 +84,10 @@ package FLTK.Widgets.Groups.Spinners is (This : in out Spinner; To : in Long_Float); + procedure Get_Range + (This : in Spinner; + Min, Max : out Long_Float); + procedure Set_Range (This : in out Spinner; Min, Max : in Long_Float); @@ -130,5 +137,36 @@ private (This : in out Spinner); + + + pragma Inline (Get_Background_Color); + pragma Inline (Set_Background_Color); + pragma Inline (Get_Selection_Color); + pragma Inline (Set_Selection_Color); + pragma Inline (Get_Text_Color); + pragma Inline (Set_Text_Color); + pragma Inline (Get_Text_Font); + pragma Inline (Set_Text_Font); + pragma Inline (Get_Text_Size); + pragma Inline (Set_Text_Size); + + + pragma Inline (Get_Minimum); + pragma Inline (Set_Minimum); + pragma Inline (Get_Maximum); + pragma Inline (Set_Maximum); + pragma Inline (Set_Range); + pragma Inline (Get_Step); + pragma Inline (Set_Step); + pragma Inline (Get_Type); + pragma Inline (Set_Type); + pragma Inline (Get_Value); + pragma Inline (Set_Value); + + + pragma Inline (Draw); + pragma Inline (Handle); + + end FLTK.Widgets.Groups.Spinners; diff --git a/src/fltk-widgets-groups-tabbed.adb b/src/fltk-widgets-groups-tabbed.adb index e7689cd..1f62cee 100644 --- a/src/fltk-widgets-groups-tabbed.adb +++ b/src/fltk-widgets-groups-tabbed.adb @@ -16,10 +16,12 @@ package body FLTK.Widgets.Groups.Tabbed is procedure tabs_set_draw_hook (W, D : in System.Address); pragma Import (C, tabs_set_draw_hook, "tabs_set_draw_hook"); + pragma Inline (tabs_set_draw_hook); procedure tabs_set_handle_hook (W, H : in System.Address); pragma Import (C, tabs_set_handle_hook, "tabs_set_handle_hook"); + pragma Inline (tabs_set_handle_hook); @@ -29,10 +31,12 @@ package body FLTK.Widgets.Groups.Tabbed is Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_tabs, "new_fl_tabs"); + pragma Inline (new_fl_tabs); procedure free_fl_tabs (S : in System.Address); pragma Import (C, free_fl_tabs, "free_fl_tabs"); + pragma Inline (free_fl_tabs); @@ -42,6 +46,7 @@ package body FLTK.Widgets.Groups.Tabbed is X, Y, W, H : out Interfaces.C.int; I : in Interfaces.C.int); pragma Import (C, fl_tabs_client_area, "fl_tabs_client_area"); + pragma Inline (fl_tabs_client_area); @@ -50,25 +55,30 @@ package body FLTK.Widgets.Groups.Tabbed is (T : in System.Address) return System.Address; pragma Import (C, fl_tabs_get_push, "fl_tabs_get_push"); + pragma Inline (fl_tabs_get_push); procedure fl_tabs_set_push (T, I : in System.Address); pragma Import (C, fl_tabs_set_push, "fl_tabs_set_push"); + pragma Inline (fl_tabs_set_push); function fl_tabs_get_value (T : in System.Address) return System.Address; pragma Import (C, fl_tabs_get_value, "fl_tabs_get_value"); + pragma Inline (fl_tabs_get_value); procedure fl_tabs_set_value (T, V : in System.Address); pragma Import (C, fl_tabs_set_value, "fl_tabs_set_value"); + pragma Inline (fl_tabs_set_value); function fl_tabs_which (T : in System.Address; X, Y : in Interfaces.C.int) return System.Address; pragma Import (C, fl_tabs_which, "fl_tabs_which"); + pragma Inline (fl_tabs_which); @@ -76,21 +86,23 @@ package body FLTK.Widgets.Groups.Tabbed is procedure fl_tabs_draw (W : in System.Address); pragma Import (C, fl_tabs_draw, "fl_tabs_draw"); + pragma Inline (fl_tabs_draw); function fl_tabs_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_tabs_handle, "fl_tabs_handle"); + pragma Inline (fl_tabs_handle); procedure Finalize - (This : in out Tabs) is + (This : in out Tabbed_Group) is begin if This.Void_Ptr /= System.Null_Address and then - This in Tabs'Class + This in Tabbed_Group'Class then This.Clear; free_fl_tabs (This.Void_Ptr); @@ -107,9 +119,9 @@ package body FLTK.Widgets.Groups.Tabbed is function Create (X, Y, W, H : in Integer; Text : in String) - return Tabs is + return Tabbed_Group is begin - return This : Tabs do + return This : Tabbed_Group do This.Void_Ptr := new_fl_tabs (Interfaces.C.int (X), Interfaces.C.int (Y), @@ -131,24 +143,24 @@ package body FLTK.Widgets.Groups.Tabbed is procedure Get_Client_Area - (This : in Tabs; + (This : in Tabbed_Group; Tab_Height : in Natural; - X, Y, W, H : out Integer) - is - RX, RY, RW, RH : Interfaces.C.int; + X, Y, W, H : out Integer) is begin - fl_tabs_client_area (This.Void_Ptr, RX, RY, RW, RH, Interfaces.C.int (Tab_Height)); - X := Integer (RX); - Y := Integer (RY); - W := Integer (RW); - H := Integer (RH); + fl_tabs_client_area + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.int (Tab_Height)); end Get_Client_Area; function Get_Push - (This : in Tabs) + (This : in Tabbed_Group) return access Widget'Class is Widget_Ptr : System.Address := @@ -161,19 +173,15 @@ package body FLTK.Widgets.Groups.Tabbed is procedure Set_Push - (This : in out Tabs; - Item : access Widget'Class) is + (This : in out Tabbed_Group; + Item : in out Widget'Class) is begin - if Item = null then - fl_tabs_set_push (This.Void_Ptr, System.Null_Address); - else - fl_tabs_set_push (This.Void_Ptr, Item.Void_Ptr); - end if; + fl_tabs_set_push (This.Void_Ptr, Item.Void_Ptr); end Set_Push; function Get_Visible - (This : in Tabs) + (This : in Tabbed_Group) return access Widget'Class is Widget_Ptr : System.Address := @@ -186,19 +194,15 @@ package body FLTK.Widgets.Groups.Tabbed is procedure Set_Visible - (This : in out Tabs; - Item : access Widget'Class) is + (This : in out Tabbed_Group; + Item : in out Widget'Class) is begin - if Item = null then - fl_tabs_set_value (This.Void_Ptr, System.Null_Address); - else - fl_tabs_set_value (This.Void_Ptr, Item.Void_Ptr); - end if; + fl_tabs_set_value (This.Void_Ptr, Item.Void_Ptr); end Set_Visible; function Get_Which - (This : in Tabs; + (This : in Tabbed_Group; Event_X, Event_Y : in Integer) return access Widget'Class is @@ -214,14 +218,14 @@ package body FLTK.Widgets.Groups.Tabbed is procedure Draw - (This : in out Tabs) is + (This : in out Tabbed_Group) is begin fl_tabs_draw (This.Void_Ptr); end Draw; function Handle - (This : in out Tabs; + (This : in out Tabbed_Group; Event : in Event_Kind) return Event_Outcome is begin diff --git a/src/fltk-widgets-groups-tabbed.ads b/src/fltk-widgets-groups-tabbed.ads index 0973e9f..825b36d 100644 --- a/src/fltk-widgets-groups-tabbed.ads +++ b/src/fltk-widgets-groups-tabbed.ads @@ -3,7 +3,10 @@ package FLTK.Widgets.Groups.Tabbed is - type Tabs is new Group with private; + type Tabbed_Group is new Group with private; + + type Tabbed_Group_Reference (Data : not null access Tabbed_Group'Class) is + limited null record with Implicit_Dereference => Data; @@ -13,7 +16,7 @@ package FLTK.Widgets.Groups.Tabbed is function Create (X, Y, W, H : in Integer; Text : in String) - return Tabs; + return Tabbed_Group; end Forge; @@ -21,7 +24,7 @@ package FLTK.Widgets.Groups.Tabbed is procedure Get_Client_Area - (This : in Tabs; + (This : in Tabbed_Group; Tab_Height : in Natural; X, Y, W, H : out Integer); @@ -29,23 +32,23 @@ package FLTK.Widgets.Groups.Tabbed is function Get_Push - (This : in Tabs) + (This : in Tabbed_Group) return access Widget'Class; procedure Set_Push - (This : in out Tabs; - Item : access Widget'Class); + (This : in out Tabbed_Group; + Item : in out Widget'Class); function Get_Visible - (This : in Tabs) + (This : in Tabbed_Group) return access Widget'Class; procedure Set_Visible - (This : in out Tabs; - Item : access Widget'Class); + (This : in out Tabbed_Group; + Item : in out Widget'Class); function Get_Which - (This : in Tabs; + (This : in Tabbed_Group; Event_X, Event_Y : in Integer) return access Widget'Class; @@ -53,10 +56,10 @@ package FLTK.Widgets.Groups.Tabbed is procedure Draw - (This : in out Tabs); + (This : in out Tabbed_Group); function Handle - (This : in out Tabs; + (This : in out Tabbed_Group; Event : in Event_Kind) return Event_Outcome; @@ -64,10 +67,26 @@ package FLTK.Widgets.Groups.Tabbed is private - type Tabs is new Group with null record; + type Tabbed_Group is new Group with null record; overriding procedure Finalize - (This : in out Tabs); + (This : in out Tabbed_Group); + + + + + pragma Inline (Get_Client_Area); + + + pragma Inline (Get_Push); + pragma Inline (Set_Push); + pragma Inline (Get_Visible); + pragma Inline (Set_Visible); + pragma Inline (Get_Which); + + + pragma Inline (Draw); + pragma Inline (Handle); end FLTK.Widgets.Groups.Tabbed; diff --git a/src/fltk-widgets-groups-text_displays-text_editors.adb b/src/fltk-widgets-groups-text_displays-text_editors.adb index af3caea..f467862 100644 --- a/src/fltk-widgets-groups-text_displays-text_editors.adb +++ b/src/fltk-widgets-groups-text_displays-text_editors.adb @@ -302,8 +302,8 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is is Ada_Editor : access Text_Editor'Class := Editor_Convert.To_Pointer (fl_widget_get_user_data (E)); - Ada_Key : Shortcut_Key := - C_To_Key (Interfaces.C.unsigned_long (K)); + Ada_Key : Key_Combo := + To_Ada (Interfaces.C.unsigned_long (K)); Found_Binding : Boolean := False; begin @@ -340,32 +340,32 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is -- remove this type and array once FLTK keybindings fixed type To_Remove is record - Press : Interfaces.Unsigned_16; + Press : Keypress; Modif : Interfaces.C.int; end record; To_Remove_List : array (Positive range <>) of To_Remove := - ((Home_Key.Keypress, 0), - (End_Key.Keypress, 0), - (Page_Down_Key.Keypress, 0), - (Page_Up_Key.Keypress, 0), - (Down_Key.Keypress, 0), - (Left_Key.Keypress, 0), - (Right_Key.Keypress, 0), - (Up_Key.Keypress, 0), + ((Home_Key, 0), + (End_Key, 0), + (Page_Down_Key, 0), + (Page_Up_Key, 0), + (Down_Key, 0), + (Left_Key, 0), + (Right_Key, 0), + (Up_Key, 0), (Character'Pos ('/'), Interfaces.C.int (Mod_Ctrl)), - (Delete_Key.Keypress, Interfaces.C.int (Mod_Shift)), - (Insert_Key.Keypress, Interfaces.C.int (Mod_Ctrl)), - (Insert_Key.Keypress, Interfaces.C.int (Mod_Shift))); + (Delete_Key, Interfaces.C.int (Mod_Shift)), + (Insert_Key, Interfaces.C.int (Mod_Ctrl)), + (Insert_Key, Interfaces.C.int (Mod_Shift))); use type Interfaces.C.int; To_Remove_Weird : array (Positive range <>) of To_Remove := - ((Enter_Key.Keypress, -1), - (Keypad_Enter_Key.Keypress, -1), - (Backspace_Key.Keypress, -1), - (Insert_Key.Keypress, -1), - (Delete_Key.Keypress, -1), - (Escape_Key.Keypress, -1)); + ((Enter_Key, -1), + (Keypad_Enter_Key, -1), + (Backspace_Key, -1), + (Insert_Key, -1), + (Delete_Key, -1), + (Escape_Key, -1)); @@ -421,11 +421,11 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is -- this is irritatingly required due to how FLTK handles certain keys for B of Default_Key_Bindings loop -- remove this conditional once FLTK keybindings fixed - if B.Key.Modifier = Mod_None then + if B.Key.Modcode = Mod_None then fl_text_editor_add_key_binding (This.Void_Ptr, - Interfaces.C.int (B.Key.Keypress), - Interfaces.C.int (B.Key.Modifier) * 65536, + Interfaces.C.int (B.Key.Keycode), + Interfaces.C.int (B.Key.Modcode) * 65536, Key_Func_Hook'Address); end if; end loop; @@ -439,11 +439,11 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is procedure Default (This : in out Text_Editor'Class; - Key : in Shortcut_Key) is + Key : in Key_Combo) is begin fl_text_editor_default (This.Void_Ptr, - Interfaces.C.int (Key.Keypress)); + Interfaces.C.int (Key.Keycode)); end Default; @@ -757,7 +757,7 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is procedure Add_Key_Binding (This : in out Text_Editor; - Key : in Shortcut_Key; + Key : in Key_Combo; Func : in Key_Func) is begin This.Bindings.Append ((Key, Func)); @@ -774,7 +774,7 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is function Get_Bound_Key_Function (This : in Text_Editor; - Key : in Shortcut_Key) + Key : in Key_Combo) return Key_Func is begin for I in 1 .. Integer (This.Bindings.Length) loop @@ -788,7 +788,7 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is procedure Remove_Key_Binding (This : in out Text_Editor; - Key : in Shortcut_Key) + Key : in Key_Combo) is use type Interfaces.C.int; begin @@ -799,11 +799,11 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is end loop; -- remove this once FLTK keybindings fixed - if Key.Modifier /= Mod_None then + if Key.Modcode /= Mod_None then fl_text_editor_remove_key_binding (This.Void_Ptr, - Interfaces.C.int (Key.Keypress), - Interfaces.C.int (Key.Modifier) * 65536); + Interfaces.C.int (Key.Keycode), + Interfaces.C.int (Key.Modcode) * 65536); end if; end Remove_Key_Binding; @@ -821,11 +821,11 @@ package body FLTK.Widgets.Groups.Text_Displays.Text_Editors is end loop; -- remove this once FLTK keybindings fixed - if Bind.Key.Modifier /= Mod_None then + if Bind.Key.Modcode /= Mod_None then fl_text_editor_remove_key_binding (This.Void_Ptr, - Interfaces.C.int (Bind.Key.Keypress), - Interfaces.C.int (Bind.Key.Modifier) * 65536); + Interfaces.C.int (Bind.Key.Keycode), + Interfaces.C.int (Bind.Key.Modcode) * 65536); end if; end Remove_Key_Binding; diff --git a/src/fltk-widgets-groups-text_displays-text_editors.ads b/src/fltk-widgets-groups-text_displays-text_editors.ads index 06e8214..29413e6 100644 --- a/src/fltk-widgets-groups-text_displays-text_editors.ads +++ b/src/fltk-widgets-groups-text_displays-text_editors.ads @@ -19,10 +19,10 @@ package FLTK.Widgets.Groups.Text_Displays.Text_Editors is type Default_Key_Func is access procedure (This : in out Text_Editor'Class; - Key : in Shortcut_Key); + Key : in Key_Combo); type Key_Binding is record - Key : Shortcut_Key; + Key : Key_Combo; Func : Key_Func; end record; @@ -45,7 +45,7 @@ package FLTK.Widgets.Groups.Text_Displays.Text_Editors is procedure Default (This : in out Text_Editor'Class; - Key : in Shortcut_Key); + Key : in Key_Combo); @@ -195,26 +195,26 @@ package FLTK.Widgets.Groups.Text_Displays.Text_Editors is Default_Key_Bindings : constant Key_Binding_List := - ((Enter_Key, KF_Enter'Access), - (Keypad_Enter_Key, KF_Enter'Access), - (Backspace_Key, KF_Backspace'Access), - (Insert_Key, KF_Insert'Access), + ((Mod_None + Enter_Key, KF_Enter'Access), + (Mod_None + Keypad_Enter_Key, KF_Enter'Access), + (Mod_None + Backspace_Key, KF_Backspace'Access), + (Mod_None + Insert_Key, KF_Insert'Access), - (Delete_Key, Delete'Access), + (Mod_None + Delete_Key, Delete'Access), (Mod_Ctrl + 'c', Copy'Access), (Mod_Ctrl + 'v', Paste'Access), (Mod_Ctrl + 'x', Cut'Access), (Mod_Ctrl + 'z', Undo'Access), (Mod_Ctrl + 'a', Select_All'Access), - (Home_Key, KF_Home'Access), - (End_Key, KF_End'Access), - (Page_Down_Key, KF_Page_Down'Access), - (Page_Up_Key, KF_Page_Up'Access), - (Down_Key, KF_Down'Access), - (Left_Key, KF_Left'Access), - (Right_Key, KF_Right'Access), - (Up_Key, KF_Up'Access), + (Mod_None + Home_Key, KF_Home'Access), + (Mod_None + End_Key, KF_End'Access), + (Mod_None + Page_Down_Key, KF_Page_Down'Access), + (Mod_None + Page_Up_Key, KF_Page_Up'Access), + (Mod_None + Down_Key, KF_Down'Access), + (Mod_None + Left_Key, KF_Left'Access), + (Mod_None + Right_Key, KF_Right'Access), + (Mod_None + Up_Key, KF_Up'Access), (Mod_Shift + Home_Key, KF_Shift_Home'Access), (Mod_Shift + End_Key, KF_Shift_End'Access), @@ -261,7 +261,7 @@ package FLTK.Widgets.Groups.Text_Displays.Text_Editors is procedure Add_Key_Binding (This : in out Text_Editor; - Key : in Shortcut_Key; + Key : in Key_Combo; Func : in Key_Func); procedure Add_Key_Binding @@ -270,12 +270,12 @@ package FLTK.Widgets.Groups.Text_Displays.Text_Editors is function Get_Bound_Key_Function (This : in Text_Editor; - Key : in Shortcut_Key) + Key : in Key_Combo) return Key_Func; procedure Remove_Key_Binding (This : in out Text_Editor; - Key : in Shortcut_Key); + Key : in Key_Combo); procedure Remove_Key_Binding (This : in out Text_Editor; diff --git a/src/fltk-widgets-groups-tiled.adb b/src/fltk-widgets-groups-tiled.adb index ee19ea0..aa617ec 100644 --- a/src/fltk-widgets-groups-tiled.adb +++ b/src/fltk-widgets-groups-tiled.adb @@ -16,10 +16,12 @@ package body FLTK.Widgets.Groups.Tiled is procedure tile_set_draw_hook (W, D : in System.Address); pragma Import (C, tile_set_draw_hook, "tile_set_draw_hook"); + pragma Inline (tile_set_draw_hook); procedure tile_set_handle_hook (W, H : in System.Address); pragma Import (C, tile_set_handle_hook, "tile_set_handle_hook"); + pragma Inline (tile_set_handle_hook); @@ -29,10 +31,12 @@ package body FLTK.Widgets.Groups.Tiled is Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_tile, "new_fl_tile"); + pragma Inline (new_fl_tile); procedure free_fl_tile (B : in System.Address); pragma Import (C, free_fl_tile, "free_fl_tile"); + pragma Inline (free_fl_tile); @@ -41,6 +45,7 @@ package body FLTK.Widgets.Groups.Tiled is (T : in System.Address; OX, OY, NX, NY : in Interfaces.C.int); pragma Import (C, fl_tile_position, "fl_tile_position"); + pragma Inline (fl_tile_position); @@ -48,12 +53,14 @@ package body FLTK.Widgets.Groups.Tiled is procedure fl_tile_draw (W : in System.Address); pragma Import (C, fl_tile_draw, "fl_tile_draw"); + pragma Inline (fl_tile_draw); function fl_tile_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_tile_handle, "fl_tile_handle"); + pragma Inline (fl_tile_handle); diff --git a/src/fltk-widgets-groups-tiled.ads b/src/fltk-widgets-groups-tiled.ads index 89e2c82..ed24a15 100644 --- a/src/fltk-widgets-groups-tiled.ads +++ b/src/fltk-widgets-groups-tiled.ads @@ -5,6 +5,9 @@ package FLTK.Widgets.Groups.Tiled is type Tiled_Group is new Group with private; + type Tiled_Group_Reference (Data : not null access Tiled_Group'Class) is + limited null record with Implicit_Dereference => Data; + @@ -46,5 +49,14 @@ private (This : in out Tiled_Group); + + + pragma Inline (Position); + + + pragma Inline (Draw); + pragma Inline (Handle); + + end FLTK.Widgets.Groups.Tiled; diff --git a/src/fltk-widgets-groups-wizards.adb b/src/fltk-widgets-groups-wizards.adb index 84c70ae..b3e7f9c 100644 --- a/src/fltk-widgets-groups-wizards.adb +++ b/src/fltk-widgets-groups-wizards.adb @@ -16,10 +16,12 @@ package body FLTK.Widgets.Groups.Wizards is procedure wizard_set_draw_hook (W, D : in System.Address); pragma Import (C, wizard_set_draw_hook, "wizard_set_draw_hook"); + pragma Inline (wizard_set_draw_hook); procedure wizard_set_handle_hook (W, H : in System.Address); pragma Import (C, wizard_set_handle_hook, "wizard_set_handle_hook"); + pragma Inline (wizard_set_handle_hook); @@ -29,10 +31,12 @@ package body FLTK.Widgets.Groups.Wizards is Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_wizard, "new_fl_wizard"); + pragma Inline (new_fl_wizard); procedure free_fl_wizard (S : in System.Address); pragma Import (C, free_fl_wizard, "free_fl_wizard"); + pragma Inline (free_fl_wizard); @@ -40,10 +44,12 @@ package body FLTK.Widgets.Groups.Wizards is procedure fl_wizard_next (W : in System.Address); pragma Import (C, fl_wizard_next, "fl_wizard_next"); + pragma Inline (fl_wizard_next); procedure fl_wizard_prev (W : in System.Address); pragma Import (C, fl_wizard_prev, "fl_wizard_prev"); + pragma Inline (fl_wizard_prev); @@ -52,10 +58,12 @@ package body FLTK.Widgets.Groups.Wizards is (W : in System.Address) return System.Address; pragma Import (C, fl_wizard_get_visible, "fl_wizard_get_visible"); + pragma Inline (fl_wizard_get_visible); procedure fl_wizard_set_visible (W, I : in System.Address); pragma Import (C, fl_wizard_set_visible, "fl_wizard_set_visible"); + pragma Inline (fl_wizard_set_visible); @@ -63,12 +71,14 @@ package body FLTK.Widgets.Groups.Wizards is procedure fl_wizard_draw (W : in System.Address); pragma Import (C, fl_wizard_draw, "fl_wizard_draw"); + pragma Inline (fl_wizard_draw); function fl_wizard_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_wizard_handle, "fl_wizard_handle"); + pragma Inline (fl_wizard_handle); @@ -148,13 +158,9 @@ package body FLTK.Widgets.Groups.Wizards is procedure Set_Visible (This : in out Wizard; - Item : access Widget'Class) is + Item : in out Widget'Class) is begin - if Item = null then - fl_wizard_set_visible (This.Void_Ptr, System.Null_Address); - else - fl_wizard_set_visible (This.Void_Ptr, Item.Void_Ptr); - end if; + fl_wizard_set_visible (This.Void_Ptr, Item.Void_Ptr); end Set_Visible; diff --git a/src/fltk-widgets-groups-wizards.ads b/src/fltk-widgets-groups-wizards.ads index 50148d0..f7130e3 100644 --- a/src/fltk-widgets-groups-wizards.ads +++ b/src/fltk-widgets-groups-wizards.ads @@ -5,6 +5,9 @@ package FLTK.Widgets.Groups.Wizards is type Wizard is new Group with private; + type Wizard_Reference (Data : not null access Wizard'Class) is limited null record + with Implicit_Dereference => Data; + @@ -35,7 +38,7 @@ package FLTK.Widgets.Groups.Wizards is procedure Set_Visible (This : in out Wizard; - Item : access Widget'Class); + Item : in out Widget'Class); @@ -58,5 +61,19 @@ private (This : in out Wizard); + + + pragma Inline (Next); + pragma Inline (Prev); + + + pragma Inline (Get_Visible); + pragma Inline (Set_Visible); + + + pragma Inline (Draw); + pragma Inline (Handle); + + end FLTK.Widgets.Groups.Wizards; diff --git a/src/fltk-widgets-inputs.adb b/src/fltk-widgets-inputs.adb index 9064ee8..b0796b6 100644 --- a/src/fltk-widgets-inputs.adb +++ b/src/fltk-widgets-inputs.adb @@ -482,17 +482,17 @@ package body FLTK.Widgets.Inputs is function Get_Shortcut_Key (This : in Input) - return Shortcut_Key is + return Key_Combo is begin - return C_To_Key (fl_input_get_shortcut (This.Void_Ptr)); + return To_Ada (fl_input_get_shortcut (This.Void_Ptr)); end Get_Shortcut_Key; procedure Set_Shortcut_Key (This : in out Input; - To : in Shortcut_Key) is + To : in Key_Combo) is begin - fl_input_set_shortcut (This.Void_Ptr, Key_To_C (To)); + fl_input_set_shortcut (This.Void_Ptr, To_C (To)); end Set_Shortcut_Key; diff --git a/src/fltk-widgets-inputs.ads b/src/fltk-widgets-inputs.ads index c22efb3..692baa4 100644 --- a/src/fltk-widgets-inputs.ads +++ b/src/fltk-widgets-inputs.ads @@ -96,11 +96,11 @@ package FLTK.Widgets.Inputs is function Get_Shortcut_Key (This : in Input) - return Shortcut_Key; + return Key_Combo; procedure Set_Shortcut_Key (This : in out Input; - To : in Shortcut_Key); + To : in Key_Combo); function Get_Mark (This : in Input) diff --git a/src/fltk-widgets-menus-menu_bars.adb b/src/fltk-widgets-menus-menu_bars.adb index b8b58b6..fa8a96c 100644 --- a/src/fltk-widgets-menus-menu_bars.adb +++ b/src/fltk-widgets-menus-menu_bars.adb @@ -16,10 +16,12 @@ package body FLTK.Widgets.Menus.Menu_Bars is procedure menu_bar_set_draw_hook (W, D : in System.Address); pragma Import (C, menu_bar_set_draw_hook, "menu_bar_set_draw_hook"); + pragma Inline (menu_bar_set_draw_hook); procedure menu_bar_set_handle_hook (W, H : in System.Address); pragma Import (C, menu_bar_set_handle_hook, "menu_bar_set_handle_hook"); + pragma Inline (menu_bar_set_handle_hook); @@ -29,10 +31,12 @@ package body FLTK.Widgets.Menus.Menu_Bars is Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_menu_bar, "new_fl_menu_bar"); + pragma Inline (new_fl_menu_bar); procedure free_fl_menu_bar (M : in System.Address); pragma Import (C, free_fl_menu_bar, "free_fl_menu_bar"); + pragma Inline (free_fl_menu_bar); @@ -40,12 +44,14 @@ package body FLTK.Widgets.Menus.Menu_Bars is procedure fl_menu_bar_draw (W : in System.Address); pragma Import (C, fl_menu_bar_draw, "fl_menu_bar_draw"); + pragma Inline (fl_menu_bar_draw); function fl_menu_bar_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_menu_bar_handle, "fl_menu_bar_handle"); + pragma Inline (fl_menu_bar_handle); diff --git a/src/fltk-widgets-menus-menu_bars.ads b/src/fltk-widgets-menus-menu_bars.ads index 03b2900..e36c632 100644 --- a/src/fltk-widgets-menus-menu_bars.ads +++ b/src/fltk-widgets-menus-menu_bars.ads @@ -5,6 +5,9 @@ package FLTK.Widgets.Menus.Menu_Bars is type Menu_Bar is new Menu with private; + type Menu_Bar_Reference (Data : not null access Menu_Bar'Class) is limited null record + with Implicit_Dereference => Data; + @@ -38,5 +41,11 @@ private (This : in out Menu_Bar); + + + pragma Inline (Draw); + pragma Inline (Handle); + + end FLTK.Widgets.Menus.Menu_Bars; diff --git a/src/fltk-widgets-menus-menu_buttons.adb b/src/fltk-widgets-menus-menu_buttons.adb index 9b6d1cb..1207b68 100644 --- a/src/fltk-widgets-menus-menu_buttons.adb +++ b/src/fltk-widgets-menus-menu_buttons.adb @@ -16,10 +16,12 @@ package body FLTK.Widgets.Menus.Menu_Buttons is procedure menu_button_set_draw_hook (W, D : in System.Address); pragma Import (C, menu_button_set_draw_hook, "menu_button_set_draw_hook"); + pragma Inline (menu_button_set_draw_hook); procedure menu_button_set_handle_hook (W, H : in System.Address); pragma Import (C, menu_button_set_handle_hook, "menu_button_set_handle_hook"); + pragma Inline (menu_button_set_handle_hook); @@ -29,10 +31,12 @@ package body FLTK.Widgets.Menus.Menu_Buttons is Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_menu_button, "new_fl_menu_button"); + pragma Inline (new_fl_menu_button); procedure free_fl_menu_button (M : in System.Address); pragma Import (C, free_fl_menu_button, "free_fl_menu_button"); + pragma Inline (free_fl_menu_button); @@ -41,11 +45,13 @@ package body FLTK.Widgets.Menus.Menu_Buttons is (M : in System.Address; T : in Interfaces.C.unsigned); pragma Import (C, fl_menu_button_type, "fl_menu_button_type"); + pragma Inline (fl_menu_button_type); function fl_menu_button_popup (M : in System.Address) return System.Address; pragma Import (C, fl_menu_button_popup, "fl_menu_button_popup"); + pragma Inline (fl_menu_button_popup); @@ -53,12 +59,14 @@ package body FLTK.Widgets.Menus.Menu_Buttons is procedure fl_menu_button_draw (W : in System.Address); pragma Import (C, fl_menu_button_draw, "fl_menu_button_draw"); + pragma Inline (fl_menu_button_draw); function fl_menu_button_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_menu_button_handle, "fl_menu_button_handle"); + pragma Inline (fl_menu_button_handle); diff --git a/src/fltk-widgets-menus-menu_buttons.ads b/src/fltk-widgets-menus-menu_buttons.ads index f7bba64..dd8fa71 100644 --- a/src/fltk-widgets-menus-menu_buttons.ads +++ b/src/fltk-widgets-menus-menu_buttons.ads @@ -10,7 +10,7 @@ package FLTK.Widgets.Menus.Menu_Buttons is type Menu_Button is new Menu with private; - type Menu_Button_Cursor (Data : access Menu_Button'Class) is limited null record + type Menu_Button_Reference (Data : access Menu_Button'Class) is limited null record with Implicit_Dereference => Data; -- signifies which mouse buttons cause the menu to appear @@ -60,5 +60,15 @@ private (This : in out Menu_Button); + + + pragma Inline (Set_Popup_Kind); + pragma Inline (Popup); + + + pragma Inline (Draw); + pragma Inline (Handle); + + end FLTK.Widgets.Menus.Menu_Buttons; diff --git a/src/fltk-widgets-menus.adb b/src/fltk-widgets-menus.adb index 89bb584..0947003 100644 --- a/src/fltk-widgets-menus.adb +++ b/src/fltk-widgets-menus.adb @@ -132,7 +132,7 @@ package body FLTK.Widgets.Menus is (This : in out Menu; Text : in String; Action : in Widget_Callback := null; - Shortcut : in Shortcut_Key := No_Key; + Shortcut : in Key_Combo := No_Key; Flags : in Menu_Flag := Flag_Normal) is Place : Interfaces.C.int; @@ -149,7 +149,7 @@ package body FLTK.Widgets.Menus is Place := fl_menu_add (This.Void_Ptr, Interfaces.C.To_C (Text), - Key_To_C (Shortcut), + To_C (Shortcut), Callback, User_Data, Interfaces.C.unsigned_long (Flags)); diff --git a/src/fltk-widgets-menus.ads b/src/fltk-widgets-menus.ads index ad9ce36..2d36fc9 100644 --- a/src/fltk-widgets-menus.ads +++ b/src/fltk-widgets-menus.ads @@ -50,7 +50,7 @@ package FLTK.Widgets.Menus is (This : in out Menu; Text : in String; Action : in Widget_Callback := null; - Shortcut : in Shortcut_Key := No_Key; + Shortcut : in Key_Combo := No_Key; Flags : in Menu_Flag := Flag_Normal); function Find_Item diff --git a/src/fltk-widgets-progress_bars.adb b/src/fltk-widgets-progress_bars.adb index 70c07c6..f8b5291 100644 --- a/src/fltk-widgets-progress_bars.adb +++ b/src/fltk-widgets-progress_bars.adb @@ -16,10 +16,12 @@ package body FLTK.Widgets.Progress_Bars is procedure progress_set_draw_hook (W, D : in System.Address); pragma Import (C, progress_set_draw_hook, "progress_set_draw_hook"); + pragma Inline (progress_set_draw_hook); procedure progress_set_handle_hook (W, H : in System.Address); pragma Import (C, progress_set_handle_hook, "progress_set_handle_hook"); + pragma Inline (progress_set_handle_hook); @@ -29,10 +31,12 @@ package body FLTK.Widgets.Progress_Bars is Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_progress, "new_fl_progress"); + pragma Inline (new_fl_progress); procedure free_fl_progress (P : in System.Address); pragma Import (C, free_fl_progress, "free_fl_progress"); + pragma Inline (free_fl_progress); @@ -41,31 +45,37 @@ package body FLTK.Widgets.Progress_Bars is (P : in System.Address) return Interfaces.C.C_float; pragma Import (C, fl_progress_get_minimum, "fl_progress_get_minimum"); + pragma Inline (fl_progress_get_minimum); procedure fl_progress_set_minimum (P : in System.Address; T : in Interfaces.C.C_float); pragma Import (C, fl_progress_set_minimum, "fl_progress_set_minimum"); + pragma Inline (fl_progress_set_minimum); function fl_progress_get_maximum (P : in System.Address) return Interfaces.C.C_float; pragma Import (C, fl_progress_get_maximum, "fl_progress_get_maximum"); + pragma Inline (fl_progress_get_maximum); procedure fl_progress_set_maximum (P : in System.Address; T : in Interfaces.C.C_float); pragma Import (C, fl_progress_set_maximum, "fl_progress_set_maximum"); + pragma Inline (fl_progress_set_maximum); function fl_progress_get_value (P : in System.Address) return Interfaces.C.C_float; pragma Import (C, fl_progress_get_value, "fl_progress_get_value"); + pragma Inline (fl_progress_get_value); procedure fl_progress_set_value (P : in System.Address; T : in Interfaces.C.C_float); pragma Import (C, fl_progress_set_value, "fl_progress_set_value"); + pragma Inline (fl_progress_set_value); @@ -73,12 +83,14 @@ package body FLTK.Widgets.Progress_Bars is procedure fl_progress_draw (P : in System.Address); pragma Import (C, fl_progress_draw, "fl_progress_draw"); + pragma Inline (fl_progress_draw); function fl_progress_handle (P : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_progress_handle, "fl_progress_handle"); + pragma Inline (fl_progress_handle); diff --git a/src/fltk-widgets-progress_bars.ads b/src/fltk-widgets-progress_bars.ads index 007a28b..11dc2f8 100644 --- a/src/fltk-widgets-progress_bars.ads +++ b/src/fltk-widgets-progress_bars.ads @@ -5,6 +5,9 @@ package FLTK.Widgets.Progress_Bars is type Progress_Bar is new Widget with private; + type Progress_Bar_Reference (Data : not null access Progress_Bar'Class) is + limited null record with Implicit_Dereference => Data; + @@ -65,5 +68,19 @@ private (This : in out Progress_Bar); + + + pragma Inline (Get_Minimum); + pragma Inline (Set_Minimum); + pragma Inline (Get_Maximum); + pragma Inline (Set_Maximum); + pragma Inline (Get_Value); + pragma Inline (Set_Value); + + + pragma Inline (Draw); + pragma Inline (Handle); + + end FLTK.Widgets.Progress_Bars; diff --git a/src/fltk.adb b/src/fltk.adb index 8970efd..6bfd6d6 100644 --- a/src/fltk.adb +++ b/src/fltk.adb @@ -46,72 +46,190 @@ package body FLTK is + function Press + (Key : in Pressable_Key) + return Keypress is + begin + return Character'Pos (Key); + end Press; + - function Shortcut + function Press (Key : Pressable_Key) - return Shortcut_Key is + return Key_Combo is begin - return This : Shortcut_Key do - This.Modifier := Mod_None; - This.Keypress := Character'Pos (Key); + return This : Key_Combo do + This.Modcode := Mod_None; + This.Keycode := Character'Pos (Key); + This.Mousecode := No_Button; end return; - end Shortcut; + end Press; + + + function Press + (Key : in Keypress) + return Key_Combo is + begin + return This : Key_Combo do + This.Modcode := Mod_None; + This.Keycode := Key; + This.Mousecode := No_Button; + end return; + end Press; + + + function Press + (Key : in Mouse_Button) + return Key_Combo is + begin + return This : Key_Combo do + This.Modcode := Mod_None; + This.Keycode := 0; + This.Mousecode := Key; + end return; + end Press; function "+" - (Left, Right : in Modifier_Key) - return Modifier_Key is + (Left, Right : in Modifier) + return Modifier is begin return Left or Right; end "+"; function "+" - (Left : in Modifier_Key; + (Left : in Modifier; Right : in Pressable_Key) - return Shortcut_Key is + return Key_Combo is + begin + return This : Key_Combo do + This.Modcode := Left; + This.Keycode := Character'Pos (Right); + This.Mousecode := No_Button; + end return; + end "+"; + + + function "+" + (Left : in Modifier; + Right : in Keypress) + return Key_Combo is + begin + return This : Key_Combo do + This.Modcode := Left; + This.Keycode := Right; + This.Mousecode := No_Button; + end return; + end "+"; + + + function "+" + (Left : in Modifier; + Right : in Mouse_Button) + return Key_Combo is begin - return This : Shortcut_Key do - This.Modifier := Left; - This.Keypress := Character'Pos (Right); + return This : Key_Combo do + This.Modcode := Left; + This.Keycode := 0; + This.Mousecode := Right; end return; end "+"; function "+" - (Left : in Modifier_Key; - Right : in Shortcut_Key) - return Shortcut_Key is + (Left : in Modifier; + Right : in Key_Combo) + return Key_Combo is begin - return This : Shortcut_Key do - This.Modifier := Left or Right.Modifier; - This.Keypress := Right.Keypress; + return This : Key_Combo do + This.Modcode := Left or Right.Modcode; + This.Keycode := Right.Keycode; + This.Mousecode := Right.Mousecode; end return; end "+"; - function Key_To_C - (Key : in Shortcut_Key) + function To_C + (Key : in Key_Combo) return Interfaces.C.unsigned_long is begin - return Interfaces.C.unsigned_long (Key.Modifier) * - 65536 + Interfaces.C.unsigned_long (Key.Keypress); - end Key_To_C; + return To_C (Key.Modcode) + To_C (Key.Keycode) + To_C (Key.Mousecode); + end To_C; - function C_To_Key + function To_Ada (Key : in Interfaces.C.unsigned_long) - return Shortcut_Key is + return Key_Combo is begin - return Result : Shortcut_Key do - Result.Modifier := Modifier_Key (Key / 65536); - Result.Keypress := Interfaces.Unsigned_16 (Key mod 65536); + return Result : Key_Combo do + Result.Modcode := To_Ada (Key); + Result.Keycode := To_Ada (Key); + Result.Mousecode := To_Ada (Key); end return; - end C_To_Key; + end To_Ada; + + + function To_C + (Key : in Keypress) + return Interfaces.C.unsigned_long is + begin + return Interfaces.C.unsigned_long (Key); + end To_C; + + + function To_Ada + (Key : in Interfaces.C.unsigned_long) + return Keypress is + begin + return Keypress (Key mod 65536); + end To_Ada; + + + function To_C + (Modi : in Modifier) + return Interfaces.C.unsigned_long is + begin + return Interfaces.C.unsigned_long (Modi) * 65536; + end To_C; + + + function To_Ada + (Modi : in Interfaces.C.unsigned_long) + return Modifier is + begin + return Modifier ((Modi / 65536) mod 256); + end To_Ada; + + + function To_C + (Button : in Mouse_Button) + return Interfaces.C.unsigned_long is + begin + case Button is + when Left_Button => return 1 * (256 ** 3); + when Middle_Button => return 2 * (256 ** 3); + when Right_Button => return 4 * (256 ** 3); + when others => return 0; + end case; + end To_C; + + + function To_Ada + (Button : in Interfaces.C.unsigned_long) + return Mouse_Button is + begin + case (Button / (256 ** 3)) is + when 1 => return Left_Button; + when 2 => return Middle_Button; + when 4 => return Right_Button; + when others => return No_Button; + end case; + end To_Ada; end FLTK; diff --git a/src/fltk.ads b/src/fltk.ads index 025fe16..df4967f 100644 --- a/src/fltk.ads +++ b/src/fltk.ads @@ -24,6 +24,7 @@ package FLTK is type Color is new Natural; + type Color_Component is mod 256; No_Color : constant Color; @@ -35,34 +36,45 @@ package FLTK is Align_Right : constant Alignment; - type Shortcut_Key is private; + type Keypress is private; subtype Pressable_Key is Character range Character'Val (32) .. Character'Val (126); - function Shortcut (Key : Pressable_Key) return Shortcut_Key; - No_Key : constant Shortcut_Key; - Enter_Key : constant Shortcut_Key; - Keypad_Enter_Key : constant Shortcut_Key; - Backspace_Key : constant Shortcut_Key; - Insert_Key : constant Shortcut_Key; - Delete_Key : constant Shortcut_Key; - Home_Key : constant Shortcut_Key; - End_Key : constant Shortcut_Key; - Page_Down_Key : constant Shortcut_Key; - Page_Up_Key : constant Shortcut_Key; - Down_Key : constant Shortcut_Key; - Left_Key : constant Shortcut_Key; - Right_Key : constant Shortcut_Key; - Up_Key : constant Shortcut_Key; - Escape_Key : constant Shortcut_Key; - - - type Modifier_Key is private; - function "+" (Left, Right : in Modifier_Key) return Modifier_Key; - function "+" (Left : in Modifier_Key; Right : in Pressable_Key) return Shortcut_Key; - function "+" (Left : in Modifier_Key; Right : in Shortcut_Key) return Shortcut_Key; - Mod_None : constant Modifier_Key; - Mod_Shift : constant Modifier_Key; - Mod_Ctrl : constant Modifier_Key; - Mod_Alt : constant Modifier_Key; + function Press (Key : in Pressable_Key) return Keypress; + Enter_Key : constant Keypress; + Keypad_Enter_Key : constant Keypress; + Backspace_Key : constant Keypress; + Insert_Key : constant Keypress; + Delete_Key : constant Keypress; + Home_Key : constant Keypress; + End_Key : constant Keypress; + Page_Down_Key : constant Keypress; + Page_Up_Key : constant Keypress; + Down_Key : constant Keypress; + Left_Key : constant Keypress; + Right_Key : constant Keypress; + Up_Key : constant Keypress; + Escape_Key : constant Keypress; + + + type Mouse_Button is (No_Button, Left_Button, Middle_Button, Right_Button); + + + type Key_Combo is private; + function Press (Key : in Pressable_Key) return Key_Combo; + function Press (Key : in Keypress) return Key_Combo; + function Press (Key : in Mouse_Button) return Key_Combo; + No_Key : constant Key_Combo; + + + type Modifier is private; + function "+" (Left, Right : in Modifier) return Modifier; + function "+" (Left : in Modifier; Right : in Pressable_Key) return Key_Combo; + function "+" (Left : in Modifier; Right : in Keypress) return Key_Combo; + function "+" (Left : in Modifier; Right : in Mouse_Button) return Key_Combo; + function "+" (Left : in Modifier; Right : in Key_Combo) return Key_Combo; + Mod_None : constant Modifier; + Mod_Shift : constant Modifier; + Mod_Ctrl : constant Modifier; + Mod_Alt : constant Modifier; type Box_Kind is @@ -225,49 +237,74 @@ private Align_Right : constant Alignment := 8; - type Modifier_Key is new Interfaces.Unsigned_16; - - - type Shortcut_Key is + type Keypress is new Interfaces.Unsigned_16; + type Modifier is new Interfaces.Unsigned_16; + type Key_Combo is record - Modifier : Modifier_Key; - Keypress : Interfaces.Unsigned_16; + Modcode : Modifier; + Keycode : Keypress; + Mousecode : Mouse_Button; end record; - function Key_To_C - (Key : in Shortcut_Key) + + function To_C + (Key : in Key_Combo) + return Interfaces.C.unsigned_long; + + function To_Ada + (Key : in Interfaces.C.unsigned_long) + return Key_Combo; + + function To_C + (Key : in Keypress) return Interfaces.C.unsigned_long; - function C_To_Key + function To_Ada (Key : in Interfaces.C.unsigned_long) - return Shortcut_Key; + return Keypress; + + function To_C + (Modi : in Modifier) + return Interfaces.C.unsigned_long; + + function To_Ada + (Modi : in Interfaces.C.unsigned_long) + return Modifier; + + function To_C + (Button : in Mouse_Button) + return Interfaces.C.unsigned_long; + + function To_Ada + (Button : in Interfaces.C.unsigned_long) + return Mouse_Button; -- these values designed to align with FLTK enumeration types - Mod_None : constant Modifier_Key := 2#00000000#; - Mod_Shift : constant Modifier_Key := 2#00000001#; - Mod_Ctrl : constant Modifier_Key := 2#00000100#; - Mod_Alt : constant Modifier_Key := 2#00001000#; + Mod_None : constant Modifier := 2#00000000#; + Mod_Shift : constant Modifier := 2#00000001#; + Mod_Ctrl : constant Modifier := 2#00000100#; + Mod_Alt : constant Modifier := 2#00001000#; - No_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 0); + No_Key : constant Key_Combo := (Modcode => Mod_None, Keycode => 0, Mousecode => No_Button); -- these values correspond to constants defined in FLTK Enumerations.H - Enter_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 16#ff0d#); - Keypad_Enter_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 16#ff8d#); - Backspace_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 16#ff08#); - Insert_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 16#ff63#); - Delete_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 16#ffff#); - Home_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 16#ff50#); - End_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 16#ff57#); - Page_Down_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 16#ff56#); - Page_Up_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 16#ff55#); - Down_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 16#ff54#); - Left_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 16#ff51#); - Right_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 16#ff53#); - Up_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 16#ff52#); - Escape_Key : constant Shortcut_Key := (Modifier => Mod_None, Keypress => 16#ff1b#); + Enter_Key : constant Keypress := 16#ff0d#; + Keypad_Enter_Key : constant Keypress := 16#ff8d#; + Backspace_Key : constant Keypress := 16#ff08#; + Insert_Key : constant Keypress := 16#ff63#; + Delete_Key : constant Keypress := 16#ffff#; + Home_Key : constant Keypress := 16#ff50#; + End_Key : constant Keypress := 16#ff57#; + Page_Down_Key : constant Keypress := 16#ff56#; + Page_Up_Key : constant Keypress := 16#ff55#; + Down_Key : constant Keypress := 16#ff54#; + Left_Key : constant Keypress := 16#ff51#; + Right_Key : constant Keypress := 16#ff53#; + Up_Key : constant Keypress := 16#ff52#; + Escape_Key : constant Keypress := 16#ff1b#; end FLTK; -- cgit