diff options
author | Jed Barber <jjbarber@y7mail.com> | 2017-05-22 13:19:42 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2017-05-22 13:19:42 +1000 |
commit | a466cb205885576087f40df28dd0680d66aebbc9 (patch) | |
tree | 50ba70b8318d8fb0025f4d73e535b93cced9a5e3 | |
parent | a504cffaf55d090fea44b4d16e538f77974f842a (diff) |
Functions and procedures to Activate/Deactivate Widgets added
-rw-r--r-- | src/c_fl_widget.cpp | 36 | ||||
-rw-r--r-- | src/c_fl_widget.h | 12 | ||||
-rw-r--r-- | src/fltk-widgets.adb | 67 | ||||
-rw-r--r-- | src/fltk-widgets.ads | 18 |
4 files changed, 122 insertions, 11 deletions
diff --git a/src/c_fl_widget.cpp b/src/c_fl_widget.cpp index 1e3e3a4..7b0d6b2 100644 --- a/src/c_fl_widget.cpp +++ b/src/c_fl_widget.cpp @@ -69,6 +69,35 @@ void fl_widget_set_user_data(WIDGET w, void * d) { +void fl_widget_activate(WIDGET w) { + reinterpret_cast<Fl_Widget*>(w)->activate(); +} + + +void fl_widget_deactivate(WIDGET w) { + reinterpret_cast<Fl_Widget*>(w)->deactivate(); +} + + +int fl_widget_active(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->active(); +} + + +int fl_widget_active_r(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->active_r(); +} + + + + +void * fl_widget_get_parent(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->parent(); +} + + + + int fl_widget_get_box(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->box(); } @@ -119,11 +148,6 @@ void fl_widget_set_label_type(WIDGET w, int l) { } -void * fl_widget_get_parent(WIDGET w) { - return reinterpret_cast<Fl_Widget*>(w)->parent(); -} - - void fl_widget_set_callback(WIDGET w, void * cb) { @@ -163,6 +187,8 @@ void fl_widget_position(WIDGET w, int x, int y) { } + + void fl_widget_set_image(WIDGET w, void * img) { reinterpret_cast<Fl_Widget*>(w)->image(reinterpret_cast<Fl_Image*>(img)); } diff --git a/src/c_fl_widget.h b/src/c_fl_widget.h index edb7ed3..255be16 100644 --- a/src/c_fl_widget.h +++ b/src/c_fl_widget.h @@ -19,6 +19,15 @@ extern "C" void * fl_widget_get_user_data(WIDGET w); extern "C" void fl_widget_set_user_data(WIDGET w, void * d); +extern "C" void fl_widget_activate(WIDGET w); +extern "C" void fl_widget_deactivate(WIDGET w); +extern "C" int fl_widget_active(WIDGET w); +extern "C" int fl_widget_active_r(WIDGET w); + + +extern "C" void * fl_widget_get_parent(WIDGET w); + + extern "C" int fl_widget_get_box(WIDGET w); extern "C" void fl_widget_set_box(WIDGET w, int b); extern "C" const char* fl_widget_get_label(WIDGET w); @@ -29,7 +38,6 @@ extern "C" int fl_widget_get_label_size(WIDGET w); extern "C" void fl_widget_set_label_size(WIDGET w, int s); extern "C" int fl_widget_get_label_type(WIDGET w); extern "C" void fl_widget_set_label_type(WIDGET w, int l); -extern "C" void * fl_widget_get_parent(WIDGET w); extern "C" void fl_widget_set_callback(WIDGET w, void * cb); @@ -41,6 +49,8 @@ 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); + + extern "C" void fl_widget_set_image(WIDGET w, void * img); diff --git a/src/fltk-widgets.adb b/src/fltk-widgets.adb index 91495e9..629f90e 100644 --- a/src/fltk-widgets.adb +++ b/src/fltk-widgets.adb @@ -6,6 +6,7 @@ with System; with System.Address_To_Access_Conversions; with FLTK.Widgets.Groups; with FLTK.Images; +use type Interfaces.C.int; use type System.Address; @@ -38,6 +39,29 @@ package body FLTK.Widgets is pragma Import (C, free_fl_widget, "free_fl_widget"); + procedure fl_widget_activate + (W : in System.Address); + pragma Import (C, fl_widget_activate, "fl_widget_activate"); + + procedure fl_widget_deactivate + (W : in System.Address); + pragma Import (C, fl_widget_deactivate, "fl_widget_deactivate"); + + function fl_widget_active + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_widget_active, "fl_widget_active"); + + function fl_widget_active_r + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_widget_active_r, "fl_widget_active_r"); + + function fl_widget_get_parent + (W : in System.Address) + return System.Address; + pragma Import (C, fl_widget_get_parent, "fl_widget_get_parent"); + function fl_widget_get_box (W : in System.Address) return Interfaces.C.int; @@ -88,11 +112,6 @@ package body FLTK.Widgets is L : in Interfaces.C.int); pragma Import (C, fl_widget_set_label_type, "fl_widget_set_label_type"); - function fl_widget_get_parent - (W : in System.Address) - return System.Address; - pragma Import (C, fl_widget_get_parent, "fl_widget_get_parent"); - procedure fl_widget_set_callback (W, C : in System.Address); pragma Import (C, fl_widget_set_callback, "fl_widget_set_callback"); @@ -209,6 +228,44 @@ package body FLTK.Widgets is + procedure Activate + (This : in out Widget) is + begin + fl_widget_activate (This.Void_Ptr); + end Activate; + + + + + procedure Deactivate + (This : in out Widget) is + begin + fl_widget_deactivate (This.Void_Ptr); + end Deactivate; + + + + + function Is_Active + (This : in Widget) + return Boolean is + begin + return fl_widget_active (This.Void_Ptr) /= 0; + end Is_Active; + + + + + function Is_Tree_Active + (This : in Widget) + return Boolean is + begin + return fl_widget_active_r (This.Void_Ptr) /= 0; + end Is_Tree_Active; + + + + function Parent (This : in Widget) return access FLTK.Widgets.Groups.Group'Class diff --git a/src/fltk-widgets.ads b/src/fltk-widgets.ads index dce79b5..36598bf 100644 --- a/src/fltk-widgets.ads +++ b/src/fltk-widgets.ads @@ -32,6 +32,24 @@ package FLTK.Widgets is return Widget; + procedure Activate + (This : in out Widget); + + + procedure Deactivate + (This : in out Widget); + + + function Is_Active + (This : in Widget) + return Boolean; + + + function Is_Tree_Active + (This : in Widget) + return Boolean; + + function Parent (This : in Widget) return access FLTK.Widgets.Groups.Group'Class; |