summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--c_fl_widget.cpp32
-rw-r--r--c_fl_widget.h8
-rw-r--r--fltk-widgets.adb96
-rw-r--r--fltk-widgets.ads9
4 files changed, 145 insertions, 0 deletions
diff --git a/c_fl_widget.cpp b/c_fl_widget.cpp
index f700c54..9dea7ee 100644
--- a/c_fl_widget.cpp
+++ b/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/c_fl_widget.h b/c_fl_widget.h
index 3b2561e..a9379f6 100644
--- a/c_fl_widget.h
+++ b/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/fltk-widgets.adb b/fltk-widgets.adb
index 3e27cb7..5ec090d 100644
--- a/fltk-widgets.adb
+++ b/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/fltk-widgets.ads b/fltk-widgets.ads
index 0a123bf..c0f89c1 100644
--- a/fltk-widgets.ads
+++ b/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