summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-05-31 17:22:20 +1000
committerJed Barber <jjbarber@y7mail.com>2017-05-31 17:22:20 +1000
commit329d2b5b2df376904c2468738630b9d052d283e5 (patch)
treea80fc85df26ad91806df5b459b4b8560c64622f5
parent76f20d2f2f7e9ffb99c3ef94021cd9181e31c0cf (diff)
More methods added to Window widget
-rw-r--r--src/c_fl_window.cpp37
-rw-r--r--src/c_fl_window.h9
-rw-r--r--src/fltk-widgets-groups-windows.adb103
-rw-r--r--src/fltk-widgets-groups-windows.ads69
4 files changed, 218 insertions, 0 deletions
diff --git a/src/c_fl_window.cpp b/src/c_fl_window.cpp
index fcaf6b0..00f4fff 100644
--- a/src/c_fl_window.cpp
+++ b/src/c_fl_window.cpp
@@ -96,6 +96,11 @@ void fl_window_hide(WINDOW n) {
}
+void fl_window_make_current(WINDOW n) {
+ reinterpret_cast<Fl_Window*>(n)->make_current();
+}
+
+
unsigned int fl_window_get_border(WINDOW n) {
return reinterpret_cast<Fl_Window*>(n)->border();
}
@@ -130,3 +135,35 @@ void fl_window_set_non_modal(WINDOW n) {
reinterpret_cast<Fl_Window*>(n)->set_non_modal();
}
+
+void fl_window_set_cursor(WINDOW n, int c) {
+ reinterpret_cast<Fl_Window*>(n)->cursor(static_cast<Fl_Cursor>(c));
+}
+
+
+void fl_window_set_default_cursor(WINDOW n, int c) {
+ reinterpret_cast<Fl_Window*>(n)->default_cursor(static_cast<Fl_Cursor>(c));
+}
+
+
+
+
+int fl_window_get_x_root(WINDOW n) {
+ return reinterpret_cast<Fl_Window*>(n)->x_root();
+}
+
+
+int fl_window_get_y_root(WINDOW n) {
+ return reinterpret_cast<Fl_Window*>(n)->y_root();
+}
+
+
+int fl_window_get_decorated_w(WINDOW n) {
+ return reinterpret_cast<Fl_Window*>(n)->decorated_w();
+}
+
+
+int fl_window_get_decorated_h(WINDOW n) {
+ return reinterpret_cast<Fl_Window*>(n)->decorated_h();
+}
+
diff --git a/src/c_fl_window.h b/src/c_fl_window.h
index bd2cf53..97f3712 100644
--- a/src/c_fl_window.h
+++ b/src/c_fl_window.h
@@ -20,6 +20,7 @@ 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" void fl_window_make_current(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);
@@ -27,6 +28,14 @@ extern "C" void fl_window_size_range(WINDOW n, int lw, int lh, int hw, int hh, i
extern "C" void fl_window_set_icon(WINDOW n, void * img);
extern "C" void fl_window_set_modal(WINDOW n);
extern "C" void fl_window_set_non_modal(WINDOW n);
+extern "C" void fl_window_set_cursor(WINDOW n, int c);
+extern "C" void fl_window_set_default_cursor(WINDOW n, int c);
+
+
+extern "C" int fl_window_get_x_root(WINDOW n);
+extern "C" int fl_window_get_y_root(WINDOW n);
+extern "C" int fl_window_get_decorated_w(WINDOW n);
+extern "C" int fl_window_get_decorated_h(WINDOW n);
#endif
diff --git a/src/fltk-widgets-groups-windows.adb b/src/fltk-widgets-groups-windows.adb
index 5e399e2..429d27d 100644
--- a/src/fltk-widgets-groups-windows.adb
+++ b/src/fltk-widgets-groups-windows.adb
@@ -42,6 +42,10 @@ package body FLTK.Widgets.Groups.Windows is
(W : in System.Address);
pragma Import (C, fl_window_hide, "fl_window_hide");
+ procedure fl_window_make_current
+ (W : in System.Address);
+ pragma Import (C, fl_window_make_current, "fl_window_make_current");
+
function fl_window_get_border
(W : in System.Address)
return Interfaces.C.unsigned;
@@ -74,6 +78,36 @@ package body FLTK.Widgets.Groups.Windows is
(W : in System.Address);
pragma Import (C, fl_window_set_non_modal, "fl_window_set_non_modal");
+ procedure fl_window_set_cursor
+ (W : in System.Address;
+ C : in Interfaces.C.int);
+ pragma Import (C, fl_window_set_cursor, "fl_window_set_cursor");
+
+ procedure fl_window_set_default_cursor
+ (W : in System.Address;
+ C : in Interfaces.C.int);
+ pragma Import (C, fl_window_set_default_cursor, "fl_window_set_default_cursor");
+
+ function fl_window_get_x_root
+ (W : in System.Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_window_get_x_root, "fl_window_get_x_root");
+
+ function fl_window_get_y_root
+ (W : in System.Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_window_get_y_root, "fl_window_get_y_root");
+
+ function fl_window_get_decorated_w
+ (W : in System.Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_window_get_decorated_w, "fl_window_get_decorated_w");
+
+ function fl_window_get_decorated_h
+ (W : in System.Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_window_get_decorated_h, "fl_window_get_decorated_h");
+
procedure fl_window_draw
(W : in System.Address);
pragma Import (C, fl_window_draw, "fl_window_draw");
@@ -164,6 +198,15 @@ package body FLTK.Widgets.Groups.Windows is
+ procedure Make_Current
+ (This : in out Window) is
+ begin
+ fl_window_make_current (This.Void_Ptr);
+ end Make_Current;
+
+
+
+
function Get_Border
(This : in Window)
return Border_State is
@@ -243,6 +286,66 @@ package body FLTK.Widgets.Groups.Windows is
+ procedure Set_Cursor
+ (This : in out Window;
+ To : in Cursor) is
+ begin
+ fl_window_set_cursor (This.Void_Ptr, Cursor_Values (To));
+ end Set_Cursor;
+
+
+
+
+ procedure Set_Default_Cursor
+ (This : in out Window;
+ To : in Cursor) is
+ begin
+ fl_window_set_default_cursor (This.Void_Ptr, Cursor_Values (To));
+ end Set_Default_Cursor;
+
+
+
+
+ function Get_X_Root
+ (This : in Window)
+ return Integer is
+ begin
+ return Integer (fl_window_get_x_root (This.Void_Ptr));
+ end Get_X_Root;
+
+
+
+
+ function Get_Y_Root
+ (This : in Window)
+ return Integer is
+ begin
+ return Integer (fl_window_get_y_root (This.Void_Ptr));
+ end Get_Y_Root;
+
+
+
+
+ function Get_Decorated_W
+ (This : in Window)
+ return Integer is
+ begin
+ return Integer (fl_window_get_decorated_w (This.Void_Ptr));
+ end Get_Decorated_W;
+
+
+
+
+ function Get_Decorated_H
+ (This : in Window)
+ return Integer is
+ begin
+ return Integer (fl_window_get_decorated_h (This.Void_Ptr));
+ end Get_Decorated_H;
+
+
+
+
procedure Draw
(This : in out Window) is
begin
diff --git a/src/fltk-widgets-groups-windows.ads b/src/fltk-widgets-groups-windows.ads
index eea2a6e..ac943c5 100644
--- a/src/fltk-widgets-groups-windows.ads
+++ b/src/fltk-widgets-groups-windows.ads
@@ -1,6 +1,7 @@
with FLTK.Images.RGB;
+private with Interfaces.C;
package FLTK.Widgets.Groups.Windows is
@@ -12,6 +13,14 @@ package FLTK.Widgets.Groups.Windows is
type Border_State is (None, Visible);
+ type Cursor is
+ (Default, Arrow, Crosshair, Wait,
+ Insert, Hand, Help, Move,
+ NS, WE, NWSE, NESW,
+ N, NE, E, SE, S, SW, W, NW,
+ None);
+
+
function Create
(X, Y, W, H : in Integer;
Text : in String)
@@ -31,6 +40,10 @@ package FLTK.Widgets.Groups.Windows is
(This : in Window);
+ procedure Make_Current
+ (This : in out Window);
+
+
function Get_Border
(This : in Window)
return Border_State;
@@ -66,6 +79,36 @@ package FLTK.Widgets.Groups.Windows is
(This : in out Window);
+ procedure Set_Cursor
+ (This : in out Window;
+ To : in Cursor);
+
+
+ procedure Set_Default_Cursor
+ (This : in out Window;
+ To : in Cursor);
+
+
+ function Get_X_Root
+ (This : in Window)
+ return Integer;
+
+
+ function Get_Y_Root
+ (This : in Window)
+ return Integer;
+
+
+ function Get_Decorated_W
+ (This : in Window)
+ return Integer;
+
+
+ function Get_Decorated_H
+ (This : in Window)
+ return Integer;
+
+
procedure Draw
(This : in out Window);
@@ -86,5 +129,31 @@ private
(This : in out Window);
+ -- What delightful magic numbers FLTK cursors are!
+ -- (These correspond to the enum found in Enumerations.H)
+ Cursor_Values : array (Cursor) of Interfaces.C.int :=
+ (Default => 0,
+ Arrow => 35,
+ Crosshair => 66,
+ Wait => 76,
+ Insert => 77,
+ Hand => 31,
+ Help => 47,
+ Move => 27,
+ NS => 78,
+ WE => 79,
+ NWSE => 80,
+ NESW => 81,
+ N => 70,
+ NE => 69,
+ E => 49,
+ SE => 8,
+ S => 9,
+ SW => 7,
+ W => 36,
+ NW => 68,
+ None => 255);
+
+
end FLTK.Widgets.Groups.Windows;