diff options
author | Jed Barber <jjbarber@y7mail.com> | 2016-09-21 17:20:32 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2016-09-21 17:20:32 +1000 |
commit | f8fc211b41dbfa43f9cace75ffdc1d43c0ab8114 (patch) | |
tree | 9a294a4d27ae7e673cf06f3d41a8715b6e133370 /src/fltk_binding | |
parent | 8cb506a7f6ba79983b1327e29233f4fb25a4a694 (diff) |
Started constructing Find/Replace/About windows
Diffstat (limited to 'src/fltk_binding')
-rw-r--r-- | src/fltk_binding/c_fl_widget.cpp | 32 | ||||
-rw-r--r-- | src/fltk_binding/c_fl_widget.h | 8 | ||||
-rw-r--r-- | src/fltk_binding/fltk-widgets.adb | 96 | ||||
-rw-r--r-- | src/fltk_binding/fltk-widgets.ads | 9 |
4 files changed, 145 insertions, 0 deletions
diff --git a/src/fltk_binding/c_fl_widget.cpp b/src/fltk_binding/c_fl_widget.cpp index f700c54..9dea7ee 100644 --- a/src/fltk_binding/c_fl_widget.cpp +++ b/src/fltk_binding/c_fl_widget.cpp @@ -79,3 +79,35 @@ void fl_widget_set_callback(WIDGET w, void * cb) { reinterpret_cast<Fl_Widget*>(w)->callback(reinterpret_cast<Fl_Callback_p>(cb)); } + + + +int fl_widget_get_x(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->x(); +} + + +int fl_widget_get_y(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->y(); +} + + +int fl_widget_get_w(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->w(); +} + + +int fl_widget_get_h(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->h(); +} + + +void fl_widget_size(WIDGET w, int d, int h) { + reinterpret_cast<Fl_Widget*>(w)->size(d, h); +} + + +void fl_widget_position(WIDGET w, int x, int y) { + reinterpret_cast<Fl_Widget*>(w)->position(x, y); +} + diff --git a/src/fltk_binding/c_fl_widget.h b/src/fltk_binding/c_fl_widget.h index 3b2561e..a9379f6 100644 --- a/src/fltk_binding/c_fl_widget.h +++ b/src/fltk_binding/c_fl_widget.h @@ -27,5 +27,13 @@ extern "C" void * fl_widget_get_parent(WIDGET w); extern "C" void fl_widget_set_callback(WIDGET w, void * cb); +extern "C" int fl_widget_get_x(WIDGET w); +extern "C" int fl_widget_get_y(WIDGET w); +extern "C" int fl_widget_get_w(WIDGET w); +extern "C" int fl_widget_get_h(WIDGET w); +extern "C" void fl_widget_size(WIDGET w, int d, int h); +extern "C" void fl_widget_position(WIDGET w, int x, int y); + + #endif diff --git a/src/fltk_binding/fltk-widgets.adb b/src/fltk_binding/fltk-widgets.adb index 3e27cb7..5ec090d 100644 --- a/src/fltk_binding/fltk-widgets.adb +++ b/src/fltk_binding/fltk-widgets.adb @@ -75,6 +75,36 @@ package body FLTK.Widgets is (W, C : in System.Address); pragma Import (C, fl_widget_set_callback, "fl_widget_set_callback"); + function fl_widget_get_x + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_widget_get_x, "fl_widget_get_x"); + + function fl_widget_get_y + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_widget_get_y, "fl_widget_get_y"); + + function fl_widget_get_w + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_widget_get_w, "fl_widget_get_w"); + + function fl_widget_get_h + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_widget_get_h, "fl_widget_get_h"); + + procedure fl_widget_size + (W : in System.Address; + D, H : in Interfaces.C.int); + pragma Import (C, fl_widget_size, "fl_widget_size"); + + procedure fl_widget_position + (W : in System.Address; + X, Y : in Interfaces.C.int); + pragma Import (C, fl_widget_position, "fl_widget_position"); + @@ -223,5 +253,71 @@ package body FLTK.Widgets is end Set_Callback; + + + function Get_X + (This : in Widget) + return Integer is + begin + return Integer (fl_widget_get_x (This.Void_Ptr)); + end Get_X; + + + + + function Get_Y + (This : in Widget) + return Integer is + begin + return Integer (fl_widget_get_y (This.Void_Ptr)); + end Get_Y; + + + + + function Get_W + (This : in Widget) + return Integer is + begin + return Integer (fl_widget_get_w (This.Void_Ptr)); + end Get_W; + + + + + function Get_H + (This : in Widget) + return Integer is + begin + return Integer (fl_widget_get_h (This.Void_Ptr)); + end Get_H; + + + + + procedure Resize + (This : in out Widget; + W, H : in Integer) is + begin + fl_widget_size + (This.Void_Ptr, + Interfaces.C.int (W), + Interfaces.C.int (H)); + end Resize; + + + + + procedure Reposition + (This : in out Widget; + X, Y : in Integer) is + begin + fl_widget_position + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y)); + end Reposition; + + end FLTK.Widgets; diff --git a/src/fltk_binding/fltk-widgets.ads b/src/fltk_binding/fltk-widgets.ads index 0a123bf..c0f89c1 100644 --- a/src/fltk_binding/fltk-widgets.ads +++ b/src/fltk_binding/fltk-widgets.ads @@ -96,6 +96,15 @@ package FLTK.Widgets is Func : not null access Widget_Callback'Class); + function Get_X (This : in Widget) return Integer; + function Get_Y (This : in Widget) return Integer; + function Get_W (This : in Widget) return Integer; + function Get_H (This : in Widget) return Integer; + + + procedure Resize (This : in out Widget; W, H : in Integer); + procedure Reposition (This : in out Widget; X, Y : in Integer); + private |