summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--body/c_fl_scroll.cpp87
-rw-r--r--body/c_fl_scroll.h14
-rw-r--r--body/fltk-widgets-groups-scrolls.adb124
-rw-r--r--doc/fl_scroll.html38
-rw-r--r--progress.txt10
-rw-r--r--spec/fltk-widgets-groups-scrolls.ads37
6 files changed, 299 insertions, 11 deletions
diff --git a/body/c_fl_scroll.cpp b/body/c_fl_scroll.cpp
index 3707b52..a240139 100644
--- a/body/c_fl_scroll.cpp
+++ b/body/c_fl_scroll.cpp
@@ -33,6 +33,16 @@ extern "C" int widget_handle_hook(void * ud, int e);
+// Non-friend protected access
+
+class Friend_Scroll : Fl_Scroll {
+public:
+ using Fl_Scroll::bbox;
+};
+
+
+
+
// Attaching all relevant hooks and friends
class My_Scroll : public Fl_Scroll {
@@ -108,6 +118,83 @@ void fl_scroll_set_size(SCROLL s, int t) {
+void fl_scroll_resize(SCROLL s, int x, int y, int w, int h) {
+ static_cast<Fl_Scroll*>(s)->resize(x, y, w, h);
+}
+
+void fl_scroll_recalc_scrollbars(SCROLL s,
+ int &cb_x, int &cb_y, int &cb_w, int &cb_h,
+ int &ib_x, int &ib_y, int &ib_w, int &ib_h,
+ int &ic_x, int &ic_y, int &ic_w, int &ic_h,
+ int &chneed, int &cvneed,
+ int &hs_x, int &hs_y, int &hs_w, int &hs_h,
+ int &hs_size, int &hs_total, int &hs_first, int &hs_pos,
+ int &vs_x, int &vs_y, int &vs_w, int &vs_h,
+ int &vs_size, int &vs_total, int &vs_first, int &vs_pos,
+ int &ssize)
+{
+#if FLTK_ABI_VERSION >= 10303
+ Fl_Scroll::ScrollInfo my_info;
+ static_cast<Fl_Scroll*>(s)->recalc_scrollbars(my_info);
+
+ cb_x = my_info.child.l;
+ cb_y = my_info.child.t;
+ cb_w = my_info.child.r - my_info.child.l;
+ cb_h = my_info.child.b - my_info.child.t;
+
+ ib_x = my_info.innerbox.x;
+ ib_y = my_info.innerbox.y;
+ ib_w = my_info.innerbox.w;
+ ib_h = my_info.innerbox.h;
+
+ ic_x = my_info.innerchild.x;
+ ic_y = my_info.innerchild.y;
+ ic_w = my_info.innerchild.w;
+ ic_h = my_info.innerchild.h;
+
+ chneed = my_info.hneeded;
+ cvneed = my_info.vneeded;
+
+ hs_x = my_info.hscroll.x;
+ hs_y = my_info.hscroll.y;
+ hs_w = my_info.hscroll.w;
+ hs_h = my_info.hscroll.h;
+ hs_size = my_info.hscroll.size;
+ hs_total = my_info.hscroll.total;
+ hs_first = my_info.hscroll.first;
+ hs_pos = my_info.hscroll.pos;
+
+ vs_x = my_info.vscroll.x;
+ vs_y = my_info.vscroll.y;
+ vs_w = my_info.vscroll.w;
+ vs_h = my_info.vscroll.h;
+ vs_size = my_info.vscroll.size;
+ vs_total = my_info.vscroll.total;
+ vs_first = my_info.vscroll.first;
+ vs_pos = my_info.vscroll.pos;
+
+ ssize = my_info.scrollsize;
+#else
+ (void)(s);
+ (void)(cb_x); (void)(cb_y); (void)(cb_w); (void)(cb_h);
+ (void)(ib_x); (void)(ib_y); (void)(ib_w); (void)(ib_h);
+ (void)(ic_x); (void)(ic_y); (void)(ic_w); (void)(ic_h);
+ (void)(chneed); (void)(cvneed);
+ (void)(hs_x); (void)(hs_y); (void)(hs_w); (void)(hs_h);
+ (void)(hs_size); (void)(hs_total); (void)(hs_first); (void)(hs_pos);
+ (void)(vs_x); (void)(vs_y); (void)(vs_w); (void)(vs_h);
+ (void)(vs_size); (void)(vs_total); (void)(vs_first); (void)(vs_pos);
+ (void)(ssize);
+#endif
+}
+
+
+
+
+void fl_scroll_bbox(SCROLL s, int &x, int &y, int &w, int &h) {
+ (static_cast<Fl_Scroll*>(s)->*(&Friend_Scroll::bbox))(x, y, w, h);
+}
+
void fl_scroll_draw(SCROLL s) {
static_cast<My_Scroll*>(s)->Fl_Scroll::draw();
}
diff --git a/body/c_fl_scroll.h b/body/c_fl_scroll.h
index 60cf9a0..17dec0f 100644
--- a/body/c_fl_scroll.h
+++ b/body/c_fl_scroll.h
@@ -32,6 +32,20 @@ extern "C" int fl_scroll_get_size(SCROLL s);
extern "C" void fl_scroll_set_size(SCROLL s, int t);
+extern "C" void fl_scroll_resize(SCROLL s, int x, int y, int w, int h);
+extern "C" void fl_scroll_recalc_scrollbars(SCROLL s,
+ int &cb_x, int &cb_y, int &cb_w, int &cb_h,
+ int &ib_x, int &ib_y, int &ib_w, int &ib_h,
+ int &ic_x, int &ic_y, int &ic_w, int &ic_h,
+ int &chneed, int &cvneed,
+ int &hs_x, int &hs_y, int &hs_w, int &hs_h,
+ int &hs_size, int &hs_total, int &hs_first, int &hs_pos,
+ int &vs_x, int &vs_y, int &vs_w, int &vs_h,
+ int &vs_size, int &vs_total, int &vs_first, int &vs_pos,
+ int &ssize);
+
+
+extern "C" void fl_scroll_bbox(SCROLL s, int &x, int &y, int &w, int &h);
extern "C" void fl_scroll_draw(SCROLL s);
extern "C" int fl_scroll_handle(SCROLL s, int e);
diff --git a/body/fltk-widgets-groups-scrolls.adb b/body/fltk-widgets-groups-scrolls.adb
index fa1b03e..b0b81d5 100644
--- a/body/fltk-widgets-groups-scrolls.adb
+++ b/body/fltk-widgets-groups-scrolls.adb
@@ -6,16 +6,23 @@
with
+ Ada.Characters.Latin_1,
Interfaces.C.Strings;
use type
+ Interfaces.C.int,
Interfaces.C.unsigned_char;
package body FLTK.Widgets.Groups.Scrolls is
+ package Latin renames Ada.Characters.Latin_1;
+
+
+
+
------------------------
-- Functions From C --
------------------------
@@ -86,6 +93,35 @@ package body FLTK.Widgets.Groups.Scrolls is
+ procedure fl_scroll_resize
+ (S : in Storage.Integer_Address;
+ X, Y, W, H : in Interfaces.C.int);
+ pragma Import (C, fl_scroll_resize, "fl_scroll_resize");
+ pragma Inline (fl_scroll_resize);
+
+ procedure fl_scroll_recalc_scrollbars
+ (Addr : in Storage.Integer_Address;
+ CB_X, CB_Y, CB_W, CB_H : out Interfaces.C.int;
+ IB_X, IB_Y, IB_W, IB_H : out Interfaces.C.int;
+ IC_X, IC_Y, IC_W, IC_H : out Interfaces.C.int;
+ CH_Need, CV_Need : out Interfaces.C.int;
+ HS_X, HS_Y, HS_W, HS_H : out Interfaces.C.int;
+ HS_Size, HS_Total, HS_First, HS_Pos : out Interfaces.C.int;
+ VS_X, VS_Y, VS_W, VS_H : out Interfaces.C.int;
+ VS_Size, VS_Total, VS_First, VS_Pos : out Interfaces.C.int;
+ SSize : out Interfaces.C.int);
+ pragma Import (C, fl_scroll_recalc_scrollbars, "fl_scroll_recalc_scrollbars");
+ pragma Inline (fl_scroll_recalc_scrollbars);
+
+
+
+
+ procedure fl_scroll_bbox
+ (S : in Storage.Integer_Address;
+ X, Y, W, H : out Interfaces.C.int);
+ pragma Import (C, fl_scroll_bbox, "fl_scroll_bbox");
+ pragma Inline (fl_scroll_bbox);
+
procedure fl_scroll_draw
(S : in Storage.Integer_Address);
pragma Import (C, fl_scroll_draw, "fl_scroll_draw");
@@ -365,6 +401,94 @@ package body FLTK.Widgets.Groups.Scrolls is
+ procedure Resize
+ (This : in out Scroll;
+ X, Y, W, H : in Integer) is
+ begin
+ fl_scroll_resize
+ (This.Void_Ptr,
+ Interfaces.C.int (X),
+ Interfaces.C.int (Y),
+ Interfaces.C.int (W),
+ Interfaces.C.int (H));
+ end Resize;
+
+
+ procedure Recalculate_Scrollbars
+ (This : in Scroll;
+ Data : out Scroll_Info)
+ is
+ C_Scroll_Size,
+ C_H_Need, C_V_Need,
+ C_H_Data_Size, C_V_Data_Size,
+ C_H_Data_Total, C_V_Data_Total : Interfaces.C.int;
+ begin
+ fl_scroll_recalc_scrollbars
+ (This.Void_Ptr,
+
+ -- child LRTB region that will be reworked into XYWH in C++
+ Interfaces.C.int (Data.Child_Box.X), Interfaces.C.int (Data.Child_Box.Y),
+ Interfaces.C.int (Data.Child_Box.W), Interfaces.C.int (Data.Child_Box.H),
+
+ -- innerbox XYWH region
+ Interfaces.C.int (Data.Inner_Ex.X), Interfaces.C.int (Data.Inner_Ex.Y),
+ Interfaces.C.int (Data.Inner_Ex.W), Interfaces.C.int (Data.Inner_Ex.H),
+
+ -- innerchild XYWH region
+ Interfaces.C.int (Data.Inner_Inc.X), Interfaces.C.int (Data.Inner_Inc.Y),
+ Interfaces.C.int (Data.Inner_Inc.W), Interfaces.C.int (Data.Inner_Inc.H),
+
+ -- raw hneeded/vneeded values to be converted into Booleans
+ C_H_Need, C_V_Need,
+
+ -- hscroll data
+ Interfaces.C.int (Data.H_Data.X), Interfaces.C.int (Data.H_Data.Y),
+ Interfaces.C.int (Data.H_Data.W), Interfaces.C.int (Data.H_Data.H),
+ C_H_Data_Size, C_H_Data_Total,
+ Interfaces.C.int (Data.H_Data.First), Interfaces.C.int (Data.H_Data.Position),
+
+ -- vscroll data
+ Interfaces.C.int (Data.V_Data.X), Interfaces.C.int (Data.V_Data.Y),
+ Interfaces.C.int (Data.V_Data.W), Interfaces.C.int (Data.V_Data.H),
+ C_V_Data_Size, C_V_Data_Total,
+ Interfaces.C.int (Data.V_Data.First), Interfaces.C.int (Data.V_Data.Position),
+
+ -- scrollsize
+ C_Scroll_Size);
+
+ Data.H_Needed := C_H_Need /= 0;
+ Data.V_Needed := C_V_Need /= 0;
+ Data.H_Data.Size := Natural (C_H_Data_Size);
+ Data.H_Data.Total := Natural (C_H_Data_Total);
+ Data.V_Data.Size := Natural (C_V_Data_Size);
+ Data.V_Data.Total := Natural (C_V_Data_Total);
+ Data.Scroll_Size := Natural (C_Scroll_Size);
+ exception
+ when Constraint_Error => raise Internal_FLTK_Error with
+ "Fl_Scroll::recalc_scrollbars returned unexpected int values of " & Latin.LF &
+ Latin.HT & "hscroll.size = " & Interfaces.C.int'Image (C_H_Data_Size) & Latin.LF &
+ Latin.HT & "hscroll.total = " & Interfaces.C.int'Image (C_H_Data_Total) & Latin.LF &
+ Latin.HT & "vscroll.size = " & Interfaces.C.int'Image (C_V_Data_Size) & Latin.LF &
+ Latin.HT & "vscroll.total = " & Interfaces.C.int'Image (C_V_Data_Total) & Latin.LF &
+ Latin.HT & "scrollsize = " & Interfaces.C.int'Image (C_Scroll_Size);
+ end Recalculate_Scrollbars;
+
+
+
+
+ procedure Bounding_Box
+ (This : in Scroll;
+ X, Y, W, H : out Integer) is
+ begin
+ fl_scroll_bbox
+ (This.Void_Ptr,
+ Interfaces.C.int (X),
+ Interfaces.C.int (Y),
+ Interfaces.C.int (W),
+ Interfaces.C.int (H));
+ end Bounding_Box;
+
+
procedure Draw
(This : in out Scroll) is
begin
diff --git a/doc/fl_scroll.html b/doc/fl_scroll.html
index 35856ba..c55dba5 100644
--- a/doc/fl_scroll.html
+++ b/doc/fl_scroll.html
@@ -46,6 +46,26 @@
<td>Scroll_Kind</td>
</tr>
+ <tr>
+ <td>Fl_Region_LRTB</td>
+ <td>Region</td>
+ </tr>
+
+ <tr>
+ <td>Fl_Region_XYWH</td>
+ <td>Region</td>
+ </tr>
+
+ <tr>
+ <td>Fl_Scrollbar_Data</td>
+ <td>Scrollbar_Data</td>
+ </tr>
+
+ <tr>
+ <td>ScrollInfo</td>
+ <td>Scroll_Info</td>
+ </tr>
+
</table>
@@ -139,7 +159,11 @@ function Handle
<td><pre>
void resize(int X, int Y, int W, int H);
</pre></td>
-<td>&nbsp;</td>
+<td><pre>
+procedure Resize
+ (This : in out Scroll;
+ X, Y, W, H : in Integer);
+</pre></td>
</tr>
<tr>
@@ -226,7 +250,11 @@ procedure Set_Kind
<td><pre>
void bbox(int &, int &, int &, int &);
</pre></td>
-<td>&nbsp;</td>
+<td><pre>
+procedure Bounding_Box
+ (This : in Scroll;
+ X, Y, W, H : out Integer);
+</pre></td>
</tr>
<tr>
@@ -243,7 +271,11 @@ procedure Draw
<td><pre>
void recalc_scrollbars(Scrollinfo &si);
</pre></td>
-<td>&nbsp;</td>
+<td><pre>
+procedure Recalculate_Scrollbars
+ (This : in Scroll;
+ Data : out Scroll_Info);
+</pre></td>
</tr>
</table>
diff --git a/progress.txt b/progress.txt
index 3e0fcce..9130e3c 100644
--- a/progress.txt
+++ b/progress.txt
@@ -210,19 +210,13 @@ possibly this hasn't been noticed because it's only visible to doxygen
-Non-widgets with incomplete APIs:
+Incomplete APIs:
FLTK
FLTK.Devices.Graphics
FLTK.Images.Pixmaps (unmarshall data access?)
FLTK.Images.Shared (images(), compare)
FLTK.Text_Buffers (a few functions, protected stuff, ensure buffer is 1-indexed)
-
-
-
-Widgets with incomplete APIs:
-
-Widgets.Groups.Scrolls (attributes, resize, type, protected)
-Widgets.Groups.Text_Displays (ensure text buffer is 1-indexed)
+FLTK.Widgets.Groups.Text_Displays (ensure text buffer is 1-indexed)
diff --git a/spec/fltk-widgets-groups-scrolls.ads b/spec/fltk-widgets-groups-scrolls.ads
index f4cbad0..3acf165 100644
--- a/spec/fltk-widgets-groups-scrolls.ads
+++ b/spec/fltk-widgets-groups-scrolls.ads
@@ -27,6 +27,25 @@ package FLTK.Widgets.Groups.Scrolls is
Both_Always);
+ type Region is record
+ X, Y, W, H : Integer;
+ end record;
+
+ type Scrollbar_Data is record
+ X, Y, W, H : Integer;
+ Size, Total : Natural;
+ First, Position : Integer;
+ end record;
+
+ type Scroll_Info is record
+ Child_Box : Region;
+ Inner_Inc, Inner_Ex : Region;
+ H_Needed, V_Needed : Boolean;
+ H_Data, V_Data : Scrollbar_Data;
+ Scroll_Size : Natural;
+ end record;
+
+
package Forge is
@@ -100,6 +119,21 @@ package FLTK.Widgets.Groups.Scrolls is
+ procedure Resize
+ (This : in out Scroll;
+ X, Y, W, H : in Integer);
+
+ procedure Recalculate_Scrollbars
+ (This : in Scroll;
+ Data : out Scroll_Info);
+
+
+
+
+ procedure Bounding_Box
+ (This : in Scroll;
+ X, Y, W, H : out Integer);
+
procedure Draw
(This : in out Scroll);
@@ -142,6 +176,9 @@ private
pragma Inline (Get_Kind);
pragma Inline (Set_Kind);
+ pragma Inline (Resize);
+
+ pragma Inline (Bounding_Box);
pragma Inline (Draw);
pragma Inline (Handle);