From 76f20d2f2f7e9ffb99c3ef94021cd9181e31c0cf Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Tue, 30 May 2017 19:39:56 +1000 Subject: Added window border methods to Window widget --- src/c_fl_window.cpp | 10 ++++++++++ src/c_fl_window.h | 2 ++ src/fltk-widgets-groups-windows.adb | 29 +++++++++++++++++++++++++++++ src/fltk-widgets-groups-windows.ads | 13 +++++++++++++ 4 files changed, 54 insertions(+) (limited to 'src') diff --git a/src/c_fl_window.cpp b/src/c_fl_window.cpp index dba9ac1..fcaf6b0 100644 --- a/src/c_fl_window.cpp +++ b/src/c_fl_window.cpp @@ -96,6 +96,16 @@ void fl_window_hide(WINDOW n) { } +unsigned int fl_window_get_border(WINDOW n) { + return reinterpret_cast(n)->border(); +} + + +void fl_window_set_border(WINDOW n, int b) { + reinterpret_cast(n)->border(b); +} + + void fl_window_set_label(WINDOW n, char* text) { reinterpret_cast(n)->copy_label(text); } diff --git a/src/c_fl_window.h b/src/c_fl_window.h index 6ac2e1a..bd2cf53 100644 --- a/src/c_fl_window.h +++ b/src/c_fl_window.h @@ -20,6 +20,8 @@ extern "C" void free_fl_window(WINDOW n); extern "C" void fl_window_show(WINDOW n); extern "C" void fl_window_hide(WINDOW n); +extern "C" unsigned int fl_window_get_border(WINDOW n); +extern "C" void fl_window_set_border(WINDOW n, int b); extern "C" void fl_window_set_label(WINDOW n, char* text); extern "C" void fl_window_size_range(WINDOW n, int lw, int lh, int hw, int hh, int dw, int dh, int a); extern "C" void fl_window_set_icon(WINDOW n, void * img); diff --git a/src/fltk-widgets-groups-windows.adb b/src/fltk-widgets-groups-windows.adb index 130b87a..5e399e2 100644 --- a/src/fltk-widgets-groups-windows.adb +++ b/src/fltk-widgets-groups-windows.adb @@ -42,6 +42,16 @@ package body FLTK.Widgets.Groups.Windows is (W : in System.Address); pragma Import (C, fl_window_hide, "fl_window_hide"); + function fl_window_get_border + (W : in System.Address) + return Interfaces.C.unsigned; + pragma Import (C, fl_window_get_border, "fl_window_get_border"); + + procedure fl_window_set_border + (W : in System.Address; + S : in Interfaces.C.int); + pragma Import (C, fl_window_set_border, "fl_window_set_border"); + procedure fl_window_set_label (W : in System.Address; T : in Interfaces.C.char_array); @@ -154,6 +164,25 @@ package body FLTK.Widgets.Groups.Windows is + function Get_Border + (This : in Window) + return Border_State is + begin + return Border_State'Val (fl_window_get_border (This.Void_Ptr)); + end Get_Border; + + + + procedure Set_Border + (This : in out Window; + To : in Border_State) is + begin + fl_window_set_border (This.Void_Ptr, Border_State'Pos (To)); + end Set_Border; + + + + procedure Set_Label (This : in out Window; Text : in String) is diff --git a/src/fltk-widgets-groups-windows.ads b/src/fltk-widgets-groups-windows.ads index 2963c4e..eea2a6e 100644 --- a/src/fltk-widgets-groups-windows.ads +++ b/src/fltk-widgets-groups-windows.ads @@ -9,6 +9,9 @@ package FLTK.Widgets.Groups.Windows is type Window is new Group with private; + type Border_State is (None, Visible); + + function Create (X, Y, W, H : in Integer; Text : in String) @@ -28,6 +31,16 @@ package FLTK.Widgets.Groups.Windows is (This : in Window); + function Get_Border + (This : in Window) + return Border_State; + + + procedure Set_Border + (This : in out Window; + To : in Border_State); + + procedure Set_Label (This : in out Window; Text : in String); -- cgit