diff options
author | Jed Barber <jjbarber@y7mail.com> | 2018-04-19 21:30:43 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2018-04-19 21:30:43 +1000 |
commit | ae82edc42a3c93c400775b314b65a8662f181b67 (patch) | |
tree | 9782c067fefd55ec765e340fe61756a122ffc3cf | |
parent | 617353265e4dc4e0280b565f2cd9e7749ce52bfd (diff) |
Completed and polished Window widgets, and fixed some associated oddities
-rw-r--r-- | doc/fl_double_window.html | 3 | ||||
-rw-r--r-- | doc/fl_menu_window.html | 3 | ||||
-rw-r--r-- | doc/fl_single_window.html | 3 | ||||
-rw-r--r-- | doc/fl_window.html | 647 | ||||
-rw-r--r-- | progress.txt | 4 | ||||
-rw-r--r-- | src/c_fl_double_window.cpp | 4 | ||||
-rw-r--r-- | src/c_fl_double_window.h | 2 | ||||
-rw-r--r-- | src/c_fl_menu_window.cpp | 4 | ||||
-rw-r--r-- | src/c_fl_menu_window.h | 2 | ||||
-rw-r--r-- | src/c_fl_single_window.cpp | 4 | ||||
-rw-r--r-- | src/c_fl_single_window.h | 2 | ||||
-rw-r--r-- | src/c_fl_window.cpp | 127 | ||||
-rw-r--r-- | src/c_fl_window.h | 74 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows-double.adb | 9 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows-double.ads | 3 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows-single-menu.adb | 9 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows-single-menu.ads | 3 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows-single.adb | 9 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows-single.ads | 3 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows.adb | 478 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows.ads | 184 | ||||
-rw-r--r-- | src/fltk-widgets.adb | 2 | ||||
-rw-r--r-- | src/fltk-widgets.ads | 2 |
23 files changed, 1439 insertions, 142 deletions
diff --git a/doc/fl_double_window.html b/doc/fl_double_window.html index 88656a4..cc8a75b 100644 --- a/doc/fl_double_window.html +++ b/doc/fl_double_window.html @@ -52,7 +52,8 @@ Fl_Double_Window(int W, int H, const char *L=0); </pre></td> <td><pre> function Create - (W, H : in Integer) + (W, H : in Integer; + Text : in String) return Double_Window; </pre></td> </tr> diff --git a/doc/fl_menu_window.html b/doc/fl_menu_window.html index 74ca9b7..9237db5 100644 --- a/doc/fl_menu_window.html +++ b/doc/fl_menu_window.html @@ -52,7 +52,8 @@ Fl_Menu_Window(int W, int H, const char *L=0); </pre></td> <td><pre> function Create - (W, H : in Integer) + (W, H : in Integer; + Text : in String) return Menu_Window; </pre></td> </tr> diff --git a/doc/fl_single_window.html b/doc/fl_single_window.html index 4044d5c..f3ce48b 100644 --- a/doc/fl_single_window.html +++ b/doc/fl_single_window.html @@ -52,7 +52,8 @@ Fl_Single_Window(int W, int H, const char *L=0); </pre></td> <td><pre> function Create - (W, H : in Integer) + (W, H : in Integer; + Text : in String) return Single_Window; </pre></td> </tr> diff --git a/doc/fl_window.html b/doc/fl_window.html new file mode 100644 index 0000000..a1a5bb8 --- /dev/null +++ b/doc/fl_window.html @@ -0,0 +1,647 @@ + +<!DOCTYPE html> + +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Fl_Window Binding Map</title> + <link href="map.css" rel="stylesheet"> + </head> + + <body> + + +<h2>Fl_Window Binding Map</h2> + + +<table class="package"> + <tr><th colspan="2">Package name</th></tr> + + <tr> + <td>Fl_Window</td> + <td>FLTK.Widgets.Groups.Windows</td> + </tr> + +</table> + + + +<table class="type"> + <tr><th colspan="2">Types</th></tr> + + <tr> + <td>Fl_Window</td> + <td>Window</td> + </tr> + + <tr> + <td> </td> + <td>Window_Reference</td> + </tr> + + <tr> + <td> </td> + <td>Border_State</td> + </tr> + + <tr> + <td> </td> + <td>Modal_State</td> + </tr> + + <tr> + <td> </td> + <td>Cursor</td> + </tr> + +</table> + + + +<table class="function"> + <tr><th colspan="2">Functions and Procedures</th></tr> + + <tr> +<td><pre> +Fl_Window(int w, int h, const char *title=0); +</pre></td> +<td><pre> +function Create + (W, H : in Integer; + Text : in String) + return Window; +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Window(int x, int y, int w, int h, const char *title=0); +</pre></td> +<td><pre> +function Create + (X, Y, W, H : in Integer; + Text : in String) + return Window; +</pre></td> + </tr> + + <tr> +<td><pre> +virtual Fl_Window * as_window(); +</pre></td> +<td>Use view conversion and tag membership tests instead</td> + </tr> + + <tr> +<td><pre> +void border(int b); +</pre></td> +<td><pre> +procedure Set_Border_State + (This : in out Window; + To : in Border_State); +</pre></td> + </tr> + + <tr> +<td><pre> +unsigned int border() const; +</pre></td> +<td><pre> +function Get_Border_State + (This : in Window) + return Border_State; +</pre></td> + </tr> + + <tr> +<td><pre> +void clear_border(); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void clear_modal_states(); +</pre></td> +<td><pre> +procedure Set_Modal_State + (This : in out Window; + To : in Modal_State); +</pre></td> + </tr> + + <tr> +<td><pre> +void copy_label(const char *a); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +static Fl_Window * current(); +</pre></td> +<td><pre> +function Last_Made_Current + return access Window'Class; +</pre></td> + </tr> + + <tr> +<td><pre> +void cursor(Fl_Cursor); +</pre></td> +<td><pre> +procedure Set_Cursor + (This : in out Window; + To : in Cursor); +</pre></td> + </tr> + + <tr> +<td><pre> +void cursor(const Fl_RGB_Image *, int, int); +</pre></td> +<td><pre> +procedure Set_Cursor + (This : in out Window; + Pic : in out FLTK.Images.RGB.RGB_Image'Class; + Hot_X, Hot_Y : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +int decorated_h(); +</pre></td> +<td><pre> +function Get_Decorated_H + (This : in Window) + return Integer; +</pre></td> + </tr> + + <tr> +<td><pre> +int decorated_w(); +</pre></td> +<td><pre> +function Get_Decorated_W + (This : in Window) + return Integer; +</pre></td> + </tr> + + <tr> +<td><pre> +void default_cursor(Fl_Cursor); +</pre></td> +<td><pre> +procedure Set_Default_Cursor + (This : in out Window; + To : in Cursor); +</pre></td> + </tr> + + <tr> +<td><pre> +void default_cursor(Fl_Cursor c, Fl_Color, Fl_Color=FL_WHITE); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +static void default_icon(const Fl_RGB_Image *); +</pre></td> +<td><pre> +procedure Set_Default_Icon + (Pic : in out FLTK.Images.RGB.RGB_Image'Class); +</pre></td> + </tr> + + <tr> +<td><pre> +virtual void draw(); +</pre></td> +<td><pre> +procedure Draw + (This : in out Window); +</pre></td> + </tr> + + <tr> +<td><pre> +void free_position(); +</pre></td> +<td><pre> +procedure Free_Position + (This : in out Window); +</pre></td> + </tr> + + <tr> +<td><pre> +void fullscreen(); +</pre></td> +<td><pre> +procedure Fullscreen_On + (This : in out Window); +</pre></td> + </tr> + + <tr> +<td><pre> +unsigned int fullscreen_active() const; +</pre></td> +<td><pre> +function Is_Fullscreen + (This : in Window) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +void fullscreen_off(); +</pre></td> +<td><pre> +procedure Fullscreen_Off + (This : in out Window); +</pre></td> + </tr> + + <tr> +<td><pre> +void fullscreen_off(int X, int Y, int W, int H); +</pre></td> +<td><pre> +procedure Fullscreen_Off + (This : in out Window; + X, Y, W, H : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void fullscreen_screens(int top, int bottom, int left, int right); +</pre></td> +<td><pre> +procedure Fullscreen_Screens + (This : in out Window; + Top, Bottom, Left, Right : in Natural); +</pre></td> + </tr> + + <tr> +<td><pre> +virtual int handle(int); +</pre></td> +<td><pre> +function Handle + (This : in out Window; + Event : in Event_Kind) + return Event_Outcome; +</pre></td> + </tr> + + <tr> +<td><pre> +virtual void hide(); +</pre></td> +<td><pre> +procedure Hide + (This : in out Window); +</pre></td> + </tr> + + <tr> +<td><pre> +void hotspot(int x, int y, int offscreen=0); +</pre></td> +<td><pre> +procedure Hotspot + (This : in out Window; + X, Y : in Integer; + Offscreen : in Boolean := False); +</pre></td> + </tr> + + <tr> +<td><pre> +void hotspot(const Fl_Widget *, int offscreen=0); +void hotspot(const Fl_Widget &p, int offscreen=0); +</pre></td> +<td><pre> +procedure Hotspot + (This : in out Window; + Item : in Widget'Class; + Offscreen : in Boolean := False); +</pre></td> + </tr> + + <tr> +<td><pre> +void icon(const Fl_RGB_Image *); +</pre></td> +<td><pre> +procedure Set_Icon + (This : in out Window; + Pic : in out FLTK.Images.RGB.RGB_Image'Class); +</pre></td> + </tr> + + <tr> +<td><pre> +const void * icon() const; +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void icon(const void *ic); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void iconize(); +</pre></td> +<td><pre> +procedure Iconify + (This : in out Window); +</pre></td> + </tr> + + <tr> +<td><pre> +const char * iconlabel() const; +</pre></td> +<td><pre> +function Get_Icon_Label + (This : in Window) + return String; +</pre></td> + </tr> + + <tr> +<td><pre> +void iconlabel(const char *); +</pre></td> +<td><pre> +procedure Set_Icon_Label + (This : in out Window; + To : in String); +</pre></td> + </tr> + + <tr> +<td><pre> +void icons(const Fl_RGB_Image *[], int); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +const char * label() const; +</pre></td> +<td><pre> +function Get_Label + (This : in Window) + return String; +</pre></td> + </tr> + + <tr> +<td><pre> +void label(const char *); +</pre></td> +<td><pre> +procedure Set_Label + (This : in out Window; + Text : in String); +</pre></td> + </tr> + + <tr> +<td><pre> +void label(const char *label, const char *iconlabel); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void make_current(); +</pre></td> +<td><pre> +procedure Make_Current + (This : in out Window); +</pre></td> + </tr> + + <tr> +<td><pre> +unsigned int menu_window() const; +</pre></td> +<td>Use tag membership tests instead</td> + </tr> + + <tr> +<td><pre> +unsigned int modal() const; +</pre></td> +<td><pre> +function Get_Modal_State + (This : in Window) + return Modal_State; +</pre></td> + </tr> + + <tr> +<td><pre> +unsigned int non_modal() const; +</pre></td> +<td>See unsigned int modal() const;</td> + </tr> + + <tr> +<td><pre> +unsigned int override() const; +</pre></td> +<td><pre> +function Is_Override + (This : in Window) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +virtual void resize(int X, int Y, int W, int H); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void set_menu_window(); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void set_modal(); +</pre></td> +<td>See void clear_modal_states();</td> + </tr> + + <tr> +<td><pre> +void set_non_modal(); +</pre></td> +<td>See void clear_modal_states();</td> + </tr> + + <tr> +<td><pre> +void set_override(); +</pre></td> +<td><pre> +procedure Set_Override + (This : in out Window); +</pre></td> + </tr> + + <tr> +<td><pre> +void set_tooltip_window(); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void shape(const Fl_Image *img); +void shape(const Fl_Image &b); +</pre></td> +<td><pre> +procedure Shape + (This : in out Window; + Pic : in out FLTK.Images.Image'Class); +</pre></td> + </tr> + + <tr> +<td><pre> +virtual void show(); +</pre></td> +<td><pre> +procedure Show + (This : in out Window); +</pre></td> + </tr> + + <tr> +<td><pre> +void show(int argc, char **argv); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +int shown(); +</pre></td> +<td><pre> +function Is_Shown + (This : in Window) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +void size_range(int minw, int minh, int maxw=0, int maxh=0, int dw=0, int dh=0, int aspect=0); +</pre></td> +<td><pre> +procedure Set_Size_Range + (This : in out Window; + Min_W, Min_H : in Integer; + Max_W, Max_H, Incre_W, Incre_H : in Integer := 0; + Keep_Aspect : in Boolean := False); +</pre></td> + </tr> + + <tr> +<td><pre> +unsigned int tooltip_window() const; +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void wait_for_expose(); +</pre></td> +<td><pre> +procedure Wait_For_Expose + (This : in out Window); +</pre></td> + </tr> + + <tr> +<td><pre> +int x_root() const; +</pre></td> +<td><pre> +function Get_X_Root + (This : in Window) + return Integer; +</pre></td> + </tr> + + <tr> +<td><pre> +const char * xclass() const; +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void xclass(const char *c); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +int y_root() const; +</pre></td> +<td><pre> +function Get_Y_Root + (This : in Window) + return Integer; +</pre></td> + </tr> + +</table> + + + </body> +</html> + diff --git a/progress.txt b/progress.txt index 7724f4c..75c5bc4 100644 --- a/progress.txt +++ b/progress.txt @@ -28,6 +28,7 @@ FLTK.Widgets.Buttons.Toggle FLTK.Widgets.Clocks FLTK.Widgets.Clocks.Updated FLTK.Widgets.Clocks.Updated.Round +FLTK.Widgets.Groups.Windows FLTK.Widgets.Groups.Windows.Double FLTK.Widgets.Groups.Windows.Single FLTK.Widgets.Groups.Windows.Single.Menu @@ -105,7 +106,6 @@ FLTK.Text_Buffers FLTK.Widgets FLTK.Widgets.Groups FLTK.Widgets.Groups.Text_Displays (94%) -FLTK.Widgets.Groups.Windows FLTK.Widgets.Menus @@ -142,7 +142,7 @@ FL_Cairo_Window - make sure all C++ reinterpret_cast for methods is to the Fl object, not the My object, because inheriting - consistent unicode utf-8 support (is this even fully supported by FLTK? if not, nevermind...) - check FLTK library internals to see which char* return values need dealloc -- remove custom exception types in favour of Program_Error? +- remove custom exception types in favour of Program_Error? or at least a generic FLTK_Error? - qualify all C++ virtual method calls with the class name to prevent dynamic dispatch on C++ side - provide documentation for how C++ methods map to Ada functions and procedures diff --git a/src/c_fl_double_window.cpp b/src/c_fl_double_window.cpp index 4bed936..389ce6a 100644 --- a/src/c_fl_double_window.cpp +++ b/src/c_fl_double_window.cpp @@ -63,8 +63,8 @@ DOUBLEWINDOW new_fl_double_window(int x, int y, int w, int h, char* label) { return d; } -DOUBLEWINDOW new_fl_double_window2(int w, int h) { - My_Double_Window *d = new My_Double_Window(w, h); +DOUBLEWINDOW new_fl_double_window2(int w, int h, char* label) { + My_Double_Window *d = new My_Double_Window(w, h, label); return d; } diff --git a/src/c_fl_double_window.h b/src/c_fl_double_window.h index 8334058..4867fd2 100644 --- a/src/c_fl_double_window.h +++ b/src/c_fl_double_window.h @@ -20,7 +20,7 @@ extern "C" inline int fl_double_window_handle(DOUBLEWINDOW n, int e); extern "C" inline DOUBLEWINDOW new_fl_double_window(int x, int y, int w, int h, char* label); -extern "C" inline DOUBLEWINDOW new_fl_double_window2(int w, int h); +extern "C" inline DOUBLEWINDOW new_fl_double_window2(int w, int h, char* label); extern "C" inline void free_fl_double_window(DOUBLEWINDOW d); diff --git a/src/c_fl_menu_window.cpp b/src/c_fl_menu_window.cpp index 3505483..77b07ae 100644 --- a/src/c_fl_menu_window.cpp +++ b/src/c_fl_menu_window.cpp @@ -63,8 +63,8 @@ MENUWINDOW new_fl_menu_window(int x, int y, int w, int h, char* label) { return m; } -MENUWINDOW new_fl_menu_window2(int w, int h) { - My_Menu_Window *m = new My_Menu_Window(w, h); +MENUWINDOW new_fl_menu_window2(int w, int h, char* label) { + My_Menu_Window *m = new My_Menu_Window(w, h, label); return m; } diff --git a/src/c_fl_menu_window.h b/src/c_fl_menu_window.h index cd7a0f4..dacc873 100644 --- a/src/c_fl_menu_window.h +++ b/src/c_fl_menu_window.h @@ -20,7 +20,7 @@ extern "C" inline int fl_menu_window_handle(MENUWINDOW n, int e); extern "C" inline MENUWINDOW new_fl_menu_window(int x, int y, int w, int h, char* label); -extern "C" inline MENUWINDOW new_fl_menu_window2(int w, int h); +extern "C" inline MENUWINDOW new_fl_menu_window2(int w, int h, char* label); extern "C" inline void free_fl_menu_window(MENUWINDOW m); diff --git a/src/c_fl_single_window.cpp b/src/c_fl_single_window.cpp index f51fb92..35bdd29 100644 --- a/src/c_fl_single_window.cpp +++ b/src/c_fl_single_window.cpp @@ -63,8 +63,8 @@ SINGLEWINDOW new_fl_single_window(int x, int y, int w, int h, char* label) { return sw; } -SINGLEWINDOW new_fl_single_window2(int x, int y) { - My_Single_Window *sw = new My_Single_Window(x, y); +SINGLEWINDOW new_fl_single_window2(int x, int y, char* label) { + My_Single_Window *sw = new My_Single_Window(x, y, label); return sw; } diff --git a/src/c_fl_single_window.h b/src/c_fl_single_window.h index 31ca7d3..4040313 100644 --- a/src/c_fl_single_window.h +++ b/src/c_fl_single_window.h @@ -20,7 +20,7 @@ extern "C" inline int fl_single_window_handle(SINGLEWINDOW n, int e); extern "C" inline SINGLEWINDOW new_fl_single_window(int x, int y, int w, int h, char* label); -extern "C" inline SINGLEWINDOW new_fl_single_window2(int x, int y); +extern "C" inline SINGLEWINDOW new_fl_single_window2(int x, int y, char* label); extern "C" inline void free_fl_single_window(SINGLEWINDOW w); diff --git a/src/c_fl_window.cpp b/src/c_fl_window.cpp index 83f19f1..d6bb262 100644 --- a/src/c_fl_window.cpp +++ b/src/c_fl_window.cpp @@ -64,8 +64,8 @@ WINDOW new_fl_window(int x, int y, int w, int h, char* label) { return n; } -WINDOW new_fl_window2(int w, int h) { - My_Window *n = new My_Window(w, h); +WINDOW new_fl_window2(int w, int h, char* label) { + My_Window *n = new My_Window(w, h, label); return n; } @@ -77,17 +77,89 @@ void free_fl_window(WINDOW n) { void fl_window_show(WINDOW n) { - reinterpret_cast<Fl_Window*>(n)->show(); + // virtual, so disable dispatch + reinterpret_cast<Fl_Window*>(n)->Fl_Window::show(); } void fl_window_hide(WINDOW n) { - reinterpret_cast<Fl_Window*>(n)->hide(); + // virtual, so disable dispatch + reinterpret_cast<Fl_Window*>(n)->Fl_Window::hide(); +} + +int fl_window_shown(WINDOW n) { + return reinterpret_cast<Fl_Window*>(n)->shown(); +} + +void fl_window_wait_for_expose(WINDOW n) { + reinterpret_cast<Fl_Window*>(n)->wait_for_expose(); +} + +void fl_window_iconize(WINDOW n) { + reinterpret_cast<Fl_Window*>(n)->iconize(); } void fl_window_make_current(WINDOW n) { reinterpret_cast<Fl_Window*>(n)->make_current(); } +void fl_window_free_position(WINDOW n) { + reinterpret_cast<Fl_Window*>(n)->free_position(); +} + + + + +unsigned int fl_window_fullscreen_active(WINDOW n) { + return reinterpret_cast<Fl_Window*>(n)->fullscreen_active(); +} + +void fl_window_fullscreen(WINDOW n) { + reinterpret_cast<Fl_Window*>(n)->fullscreen(); +} + +void fl_window_fullscreen_off(WINDOW n) { + reinterpret_cast<Fl_Window*>(n)->fullscreen_off(); +} + +void fl_window_fullscreen_off2(WINDOW n, int x, int y, int w, int h) { + reinterpret_cast<Fl_Window*>(n)->fullscreen_off(x,y,w,h); +} + +void fl_window_fullscreen_screens(WINDOW n, int t, int b, int l, int r) { + reinterpret_cast<Fl_Window*>(n)->fullscreen_screens(t,b,l,r); +} + + + + +void fl_window_set_icon(WINDOW n, void * img) { + reinterpret_cast<Fl_Window*>(n)->icon(reinterpret_cast<Fl_RGB_Image*>(img)); +} + +void fl_window_default_icon(void * img) { + Fl_Window::default_icon(reinterpret_cast<Fl_RGB_Image*>(img)); +} + +const char * fl_window_get_iconlabel(WINDOW n) { + return reinterpret_cast<Fl_Window*>(n)->iconlabel(); +} + +void fl_window_set_iconlabel(WINDOW n, const char * s) { + reinterpret_cast<Fl_Window*>(n)->iconlabel(s); +} + +void fl_window_set_cursor(WINDOW n, int c) { + reinterpret_cast<Fl_Window*>(n)->cursor(static_cast<Fl_Cursor>(c)); +} + +void fl_window_set_cursor2(WINDOW n, void * img, int x, int y) { + reinterpret_cast<Fl_Window*>(n)->cursor(reinterpret_cast<Fl_RGB_Image*>(img),x,y); +} + +void fl_window_set_default_cursor(WINDOW n, int c) { + reinterpret_cast<Fl_Window*>(n)->default_cursor(static_cast<Fl_Cursor>(c)); +} + @@ -99,16 +171,24 @@ void fl_window_set_border(WINDOW n, int b) { reinterpret_cast<Fl_Window*>(n)->border(b); } -void fl_window_set_label(WINDOW n, char* text) { - reinterpret_cast<Fl_Window*>(n)->copy_label(text); +unsigned int fl_window_get_override(WINDOW n) { + return reinterpret_cast<Fl_Window*>(n)->override(); } -void fl_window_size_range(WINDOW n, int lw, int lh, int hw, int hh, int dw, int dh, int a) { - reinterpret_cast<Fl_Window*>(n)->size_range(lw, lh, hw, hh, dw, dh, a); +void fl_window_set_override(WINDOW n) { + reinterpret_cast<Fl_Window*>(n)->set_override(); } -void fl_window_set_icon(WINDOW n, void * img) { - reinterpret_cast<Fl_Window*>(n)->icon(reinterpret_cast<Fl_RGB_Image*>(img)); +unsigned int fl_window_modal(WINDOW n) { + return reinterpret_cast<Fl_Window*>(n)->modal(); +} + +unsigned int fl_window_non_modal(WINDOW n) { + return reinterpret_cast<Fl_Window*>(n)->non_modal(); +} + +void fl_window_clear_modal_states(WINDOW n) { + reinterpret_cast<Fl_Window*>(n)->clear_modal_states(); } void fl_window_set_modal(WINDOW n) { @@ -119,12 +199,31 @@ 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)); + + + +const char * fl_window_get_label(WINDOW n) { + return reinterpret_cast<Fl_Window*>(n)->label(); } -void fl_window_set_default_cursor(WINDOW n, int c) { - reinterpret_cast<Fl_Window*>(n)->default_cursor(static_cast<Fl_Cursor>(c)); +void fl_window_set_label(WINDOW n, char* text) { + reinterpret_cast<Fl_Window*>(n)->copy_label(text); +} + +void fl_window_hotspot(WINDOW n, int x, int y, int s) { + reinterpret_cast<Fl_Window*>(n)->hotspot(x,y,s); +} + +void fl_window_hotspot2(WINDOW n, void * i, int s) { + reinterpret_cast<Fl_Window*>(n)->hotspot(reinterpret_cast<Fl_Widget*>(i),s); +} + +void fl_window_size_range(WINDOW n, int lw, int lh, int hw, int hh, int dw, int dh, int a) { + reinterpret_cast<Fl_Window*>(n)->size_range(lw, lh, hw, hh, dw, dh, a); +} + +void fl_window_shape(WINDOW n, void * p) { + reinterpret_cast<Fl_Window*>(n)->shape(reinterpret_cast<Fl_Image*>(p)); } diff --git a/src/c_fl_window.h b/src/c_fl_window.h index bbf4448..f66876a 100644 --- a/src/c_fl_window.h +++ b/src/c_fl_window.h @@ -11,41 +11,69 @@ typedef void* WINDOW; -extern "C" void window_set_draw_hook(WINDOW n, void * d); -extern "C" void fl_window_draw(WINDOW n); -extern "C" void window_set_handle_hook(WINDOW n, void * h); -extern "C" int fl_window_handle(WINDOW n, int e); +extern "C" inline void window_set_draw_hook(WINDOW n, void * d); +extern "C" inline void fl_window_draw(WINDOW n); +extern "C" inline void window_set_handle_hook(WINDOW n, void * h); +extern "C" inline int fl_window_handle(WINDOW n, int e); -extern "C" WINDOW new_fl_window(int x, int y, int w, int h, char* label); -extern "C" WINDOW new_fl_window2(int w, int h); -extern "C" void free_fl_window(WINDOW n); +extern "C" inline WINDOW new_fl_window(int x, int y, int w, int h, char* label); +extern "C" inline WINDOW new_fl_window2(int w, int h, char* label); +extern "C" inline 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" inline void fl_window_show(WINDOW n); +extern "C" inline void fl_window_hide(WINDOW n); +extern "C" inline int fl_window_shown(WINDOW n); +extern "C" inline void fl_window_wait_for_expose(WINDOW n); +extern "C" inline void fl_window_iconize(WINDOW n); +extern "C" inline void fl_window_make_current(WINDOW n); +extern "C" inline void fl_window_free_position(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); -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" inline unsigned int fl_window_fullscreen_active(WINDOW n); +extern "C" inline void fl_window_fullscreen(WINDOW n); +extern "C" inline void fl_window_fullscreen_off(WINDOW n); +extern "C" inline void fl_window_fullscreen_off2(WINDOW n, int x, int y, int w, int h); +extern "C" inline void fl_window_fullscreen_screens(WINDOW n, int t, int b, int l, int r); -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); +extern "C" inline void fl_window_set_icon(WINDOW n, void * img); +extern "C" inline void fl_window_default_icon(void * img); +extern "C" inline const char * fl_window_get_iconlabel(WINDOW n); +extern "C" inline void fl_window_set_iconlabel(WINDOW n, const char * s); +extern "C" inline void fl_window_set_cursor(WINDOW n, int c); +extern "C" inline void fl_window_set_cursor2(WINDOW n, void * img, int x, int y); +extern "C" inline void fl_window_set_default_cursor(WINDOW n, int c); + + +extern "C" inline unsigned int fl_window_get_border(WINDOW n); +extern "C" inline void fl_window_set_border(WINDOW n, int b); +extern "C" inline unsigned int fl_window_get_override(WINDOW n); +extern "C" inline void fl_window_set_override(WINDOW n); +extern "C" inline unsigned int fl_window_modal(WINDOW n); +extern "C" inline unsigned int fl_window_non_modal(WINDOW n); +extern "C" inline void fl_window_clear_modal_states(WINDOW n); +extern "C" inline void fl_window_set_modal(WINDOW n); +extern "C" inline void fl_window_set_non_modal(WINDOW n); + + +extern "C" inline const char * fl_window_get_label(WINDOW n); +extern "C" inline void fl_window_set_label(WINDOW n, char* text); +extern "C" inline void fl_window_hotspot(WINDOW n, int x, int y, int s); +extern "C" inline void fl_window_hotspot2(WINDOW n, void * i, int s); +extern "C" inline void fl_window_size_range(WINDOW n, int lw, int lh, int hw, int hh, int dw, int dh, int a); +extern "C" inline void fl_window_shape(WINDOW n, void * p); + + +extern "C" inline int fl_window_get_x_root(WINDOW n); +extern "C" inline int fl_window_get_y_root(WINDOW n); +extern "C" inline int fl_window_get_decorated_w(WINDOW n); +extern "C" inline int fl_window_get_decorated_h(WINDOW n); #endif diff --git a/src/fltk-widgets-groups-windows-double.adb b/src/fltk-widgets-groups-windows-double.adb index 9e87d56..515e149 100644 --- a/src/fltk-widgets-groups-windows-double.adb +++ b/src/fltk-widgets-groups-windows-double.adb @@ -34,7 +34,8 @@ package body FLTK.Widgets.Groups.Windows.Double is pragma Inline (new_fl_double_window); function new_fl_double_window2 - (X, Y : in Interfaces.C.int) + (X, Y : in Interfaces.C.int; + Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_double_window2, "new_fl_double_window2"); pragma Inline (new_fl_double_window2); @@ -121,13 +122,15 @@ package body FLTK.Widgets.Groups.Windows.Double is function Create - (W, H : in Integer) + (W, H : in Integer; + Text : in String) return Double_Window is begin return This : Double_Window do This.Void_Ptr := new_fl_double_window2 (Interfaces.C.int (W), - Interfaces.C.int (H)); + Interfaces.C.int (H), + Interfaces.C.To_C (Text)); fl_group_end (This.Void_Ptr); fl_widget_set_user_data (This.Void_Ptr, diff --git a/src/fltk-widgets-groups-windows-double.ads b/src/fltk-widgets-groups-windows-double.ads index 216419d..697b72b 100644 --- a/src/fltk-widgets-groups-windows-double.ads +++ b/src/fltk-widgets-groups-windows-double.ads @@ -18,7 +18,8 @@ package FLTK.Widgets.Groups.Windows.Double is return Double_Window; function Create - (W, H : in Integer) + (W, H : in Integer; + Text : in String) return Double_Window; end Forge; diff --git a/src/fltk-widgets-groups-windows-single-menu.adb b/src/fltk-widgets-groups-windows-single-menu.adb index 85026f2..7a3d0c2 100644 --- a/src/fltk-widgets-groups-windows-single-menu.adb +++ b/src/fltk-widgets-groups-windows-single-menu.adb @@ -35,7 +35,8 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is pragma Inline (new_fl_menu_window); function new_fl_menu_window2 - (W, H : in Interfaces.C.int) + (W, H : in Interfaces.C.int; + Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_menu_window2, "new_fl_menu_window2"); pragma Inline (new_fl_menu_window2); @@ -141,13 +142,15 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is function Create - (W, H : in Integer) + (W, H : in Integer; + Text : in String) return Menu_Window is begin return This : Menu_Window do This.Void_Ptr := new_fl_menu_window2 (Interfaces.C.int (W), - Interfaces.C.int (H)); + Interfaces.C.int (H), + Interfaces.C.To_C (Text)); fl_group_end (This.Void_Ptr); fl_widget_set_user_data (This.Void_Ptr, diff --git a/src/fltk-widgets-groups-windows-single-menu.ads b/src/fltk-widgets-groups-windows-single-menu.ads index 0d82bf8..2b5d272 100644 --- a/src/fltk-widgets-groups-windows-single-menu.ads +++ b/src/fltk-widgets-groups-windows-single-menu.ads @@ -19,7 +19,8 @@ package FLTK.Widgets.Groups.Windows.Single.Menu is return Menu_Window; function Create - (W, H : in Integer) + (W, H : in Integer; + Text : in String) return Menu_Window; end Forge; diff --git a/src/fltk-widgets-groups-windows-single.adb b/src/fltk-widgets-groups-windows-single.adb index 0dec8f1..6ef2cc7 100644 --- a/src/fltk-widgets-groups-windows-single.adb +++ b/src/fltk-widgets-groups-windows-single.adb @@ -34,7 +34,8 @@ package body FLTK.Widgets.Groups.Windows.Single is pragma Inline (new_fl_single_window); function new_fl_single_window2 - (W, H : in Interfaces.C.int) + (W, H : in Interfaces.C.int; + Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_single_window2, "new_fl_single_window2"); pragma Inline (new_fl_single_window2); @@ -116,13 +117,15 @@ package body FLTK.Widgets.Groups.Windows.Single is function Create - (W, H : in Integer) + (W, H : in Integer; + Text : in String) return Single_Window is begin return This : Single_Window do This.Void_Ptr := new_fl_single_window2 (Interfaces.C.int (W), - Interfaces.C.int (H)); + Interfaces.C.int (H), + Interfaces.C.To_C (Text)); fl_group_end (This.Void_Ptr); fl_widget_set_user_data (This.Void_Ptr, diff --git a/src/fltk-widgets-groups-windows-single.ads b/src/fltk-widgets-groups-windows-single.ads index 67acf9b..7817325 100644 --- a/src/fltk-widgets-groups-windows-single.ads +++ b/src/fltk-widgets-groups-windows-single.ads @@ -19,7 +19,8 @@ package FLTK.Widgets.Groups.Windows.Single is return Single_Window; function Create - (W, H : in Integer) + (W, H : in Integer; + Text : in String) return Single_Window; end Forge; diff --git a/src/fltk-widgets-groups-windows.adb b/src/fltk-widgets-groups-windows.adb index 13a2aa1..a4da35b 100644 --- a/src/fltk-widgets-groups-windows.adb +++ b/src/fltk-widgets-groups-windows.adb @@ -2,12 +2,14 @@ with - Interfaces.C, + Interfaces.C.Strings, System, FLTK.Images.RGB; use type + Interfaces.C.int, + Interfaces.C.unsigned, System.Address; @@ -17,10 +19,12 @@ package body FLTK.Widgets.Groups.Windows is procedure window_set_draw_hook (W, D : in System.Address); pragma Import (C, window_set_draw_hook, "window_set_draw_hook"); + pragma Inline (window_set_draw_hook); procedure window_set_handle_hook (W, H : in System.Address); pragma Import (C, window_set_handle_hook, "window_set_handle_hook"); + pragma Inline (window_set_handle_hook); @@ -30,15 +34,19 @@ package body FLTK.Widgets.Groups.Windows is Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_window, "new_fl_window"); + pragma Inline (new_fl_window); function new_fl_window2 - (W, H : in Interfaces.C.int) + (W, H : in Interfaces.C.int; + Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_window2, "new_fl_window2"); + pragma Inline (new_fl_window2); procedure free_fl_window (W : in System.Address); pragma Import (C, free_fl_window, "free_fl_window"); + pragma Inline (free_fl_window); @@ -46,14 +54,112 @@ package body FLTK.Widgets.Groups.Windows is procedure fl_window_show (W : in System.Address); pragma Import (C, fl_window_show, "fl_window_show"); + pragma Inline (fl_window_show); procedure fl_window_hide (W : in System.Address); pragma Import (C, fl_window_hide, "fl_window_hide"); + pragma Inline (fl_window_hide); + + function fl_window_shown + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_window_shown, "fl_window_shown"); + pragma Inline (fl_window_shown); + + procedure fl_window_wait_for_expose + (W : in System.Address); + pragma Import (C, fl_window_wait_for_expose, "fl_window_wait_for_expose"); + pragma Inline (fl_window_wait_for_expose); + + procedure fl_window_iconize + (W : in System.Address); + pragma Import (C, fl_window_iconize, "fl_window_iconize"); + pragma Inline (fl_window_iconize); procedure fl_window_make_current (W : in System.Address); pragma Import (C, fl_window_make_current, "fl_window_make_current"); + pragma Inline (fl_window_make_current); + + procedure fl_window_free_position + (W : in System.Address); + pragma Import (C, fl_window_free_position, "fl_window_free_position"); + pragma Inline (fl_window_free_position); + + + + + function fl_window_fullscreen_active + (W : in System.Address) + return Interfaces.C.unsigned; + pragma Import (C, fl_window_fullscreen_active, "fl_window_fullscreen_active"); + pragma Inline (fl_window_fullscreen_active); + + procedure fl_window_fullscreen + (W : in System.Address); + pragma Import (C, fl_window_fullscreen, "fl_window_fullscreen"); + pragma Inline (fl_window_fullscreen); + + procedure fl_window_fullscreen_off + (W : in System.Address); + pragma Import (C, fl_window_fullscreen_off, "fl_window_fullscreen_off"); + pragma Inline (fl_window_fullscreen_off); + + procedure fl_window_fullscreen_off2 + (N : in System.Address; + X, Y, W, H : in Interfaces.C.int); + pragma Import (C, fl_window_fullscreen_off2, "fl_window_fullscreen_off2"); + pragma Inline (fl_window_fullscreen_off2); + + procedure fl_window_fullscreen_screens + (W : in System.Address; + T, B, L, R : in Interfaces.C.int); + pragma Import (C, fl_window_fullscreen_screens, "fl_window_fullscreen_screens"); + pragma Inline (fl_window_fullscreen_screens); + + + + + procedure fl_window_set_icon + (W, P : in System.Address); + pragma Import (C, fl_window_set_icon, "fl_window_set_icon"); + pragma Inline (fl_window_set_icon); + + procedure fl_window_default_icon + (P : in System.Address); + pragma Import (C, fl_window_default_icon, "fl_window_default_icon"); + pragma Inline (fl_window_default_icon); + + function fl_window_get_iconlabel + (W : in System.Address) + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, fl_window_get_iconlabel, "fl_window_get_iconlabel"); + pragma Inline (fl_window_get_iconlabel); + + procedure fl_window_set_iconlabel + (W : in System.Address; + S : in Interfaces.C.char_array); + pragma Import (C, fl_window_set_iconlabel, "fl_window_set_iconlabel"); + pragma Inline (fl_window_set_iconlabel); + + 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"); + pragma Inline (fl_window_set_cursor); + + procedure fl_window_set_cursor2 + (W, P : in System.Address; + X, Y : in Interfaces.C.int); + pragma Import (C, fl_window_set_cursor2, "fl_window_set_cursor2"); + pragma Inline (fl_window_set_cursor2); + + 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"); + pragma Inline (fl_window_set_default_cursor); @@ -62,43 +168,89 @@ package body FLTK.Widgets.Groups.Windows is (W : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_window_get_border, "fl_window_get_border"); + pragma Inline (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"); + pragma Inline (fl_window_set_border); - procedure fl_window_set_label - (W : in System.Address; - T : in Interfaces.C.char_array); - pragma Import (C, fl_window_set_label, "fl_window_set_label"); + function fl_window_get_override + (W : in System.Address) + return Interfaces.C.unsigned; + pragma Import (C, fl_window_get_override, "fl_window_get_override"); + pragma Inline (fl_window_get_override); - procedure fl_window_size_range - (W : in System.Address; - LW, LH, HW, HH, DW, DH, A : in Interfaces.C.int); - pragma Import (C, fl_window_size_range, "fl_window_size_range"); + procedure fl_window_set_override + (W : in System.Address); + pragma Import (C, fl_window_set_override, "fl_window_set_override"); + pragma Inline (fl_window_set_override); - procedure fl_window_set_icon - (W, P : in System.Address); - pragma Import (C, fl_window_set_icon, "fl_window_set_icon"); + function fl_window_modal + (W : in System.Address) + return Interfaces.C.unsigned; + pragma Import (C, fl_window_modal, "fl_window_modal"); + pragma Inline (fl_window_modal); + + function fl_window_non_modal + (W : in System.Address) + return Interfaces.C.unsigned; + pragma Import (C, fl_window_non_modal, "fl_window_non_modal"); + pragma Inline (fl_window_non_modal); + + procedure fl_window_clear_modal_states + (W : in System.Address); + pragma Import (C, fl_window_clear_modal_states, "fl_window_clear_modal_states"); + pragma Inline (fl_window_clear_modal_states); procedure fl_window_set_modal (W : in System.Address); pragma Import (C, fl_window_set_modal, "fl_window_set_modal"); + pragma Inline (fl_window_set_modal); procedure fl_window_set_non_modal (W : in System.Address); pragma Import (C, fl_window_set_non_modal, "fl_window_set_non_modal"); + pragma Inline (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 + + + function fl_window_get_label + (W : in System.Address) + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, fl_window_get_label, "fl_window_get_label"); + pragma Inline (fl_window_get_label); + + procedure fl_window_set_label (W : in System.Address; - C : in Interfaces.C.int); - pragma Import (C, fl_window_set_default_cursor, "fl_window_set_default_cursor"); + T : in Interfaces.C.char_array); + pragma Import (C, fl_window_set_label, "fl_window_set_label"); + pragma Inline (fl_window_set_label); + + procedure fl_window_hotspot + (W : in System.Address; + X, Y, S : in Interfaces.C.int); + pragma Import (C, fl_window_hotspot, "fl_window_hotspot"); + pragma Inline (fl_window_hotspot); + + procedure fl_window_hotspot2 + (W, I : in System.Address; + S : in Interfaces.C.int); + pragma Import (C, fl_window_hotspot2, "fl_window_hotspot2"); + pragma Inline (fl_window_hotspot2); + + procedure fl_window_size_range + (W : in System.Address; + LW, LH, HW, HH, DW, DH, A : in Interfaces.C.int); + pragma Import (C, fl_window_size_range, "fl_window_size_range"); + pragma Inline (fl_window_size_range); + + procedure fl_window_shape + (W, P : in System.Address); + pragma Import (C, fl_window_shape, "fl_window_shape"); + pragma Inline (fl_window_shape); @@ -107,21 +259,25 @@ package body FLTK.Widgets.Groups.Windows is (W : in System.Address) return Interfaces.C.int; pragma Import (C, fl_window_get_x_root, "fl_window_get_x_root"); + pragma Inline (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"); + pragma Inline (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"); + pragma Inline (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"); + pragma Inline (fl_window_get_decorated_h); @@ -129,12 +285,14 @@ package body FLTK.Widgets.Groups.Windows is procedure fl_window_draw (W : in System.Address); pragma Import (C, fl_window_draw, "fl_window_draw"); + pragma Inline (fl_window_draw); function fl_window_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_window_handle, "fl_window_handle"); + pragma Inline (fl_window_handle); @@ -180,13 +338,15 @@ package body FLTK.Widgets.Groups.Windows is function Create - (W, H : in Integer) + (W, H : in Integer; + Text : in String) return Window is begin return This : Window do This.Void_Ptr := new_fl_window2 (Interfaces.C.int (W), - Interfaces.C.int (H)); + Interfaces.C.int (H), + Interfaces.C.To_C (Text)); fl_group_end (This.Void_Ptr); fl_widget_set_user_data (This.Void_Ptr, @@ -215,55 +375,100 @@ package body FLTK.Widgets.Groups.Windows is end Hide; + function Is_Shown + (This : in Window) + return Boolean is + begin + return fl_window_shown (This.Void_Ptr) /= 0; + end Is_Shown; + + + procedure Wait_For_Expose + (This : in out Window) is + begin + fl_window_wait_for_expose (This.Void_Ptr); + end Wait_For_Expose; + + + procedure Iconify + (This : in out Window) is + begin + fl_window_iconize (This.Void_Ptr); + end Iconify; + + procedure Make_Current (This : in out Window) is begin fl_window_make_current (This.Void_Ptr); + Last_Current := This'Unchecked_Access; end Make_Current; + function Last_Made_Current + return access Window'Class is + begin + return Last_Current; + end Last_Made_Current; + + + procedure Free_Position + (This : in out Window) is + begin + fl_window_free_position (This.Void_Ptr); + end Free_Position; + - function Get_Border + + function Is_Fullscreen (This : in Window) - return Border_State is + return Boolean is begin - return Border_State'Val (fl_window_get_border (This.Void_Ptr)); - end Get_Border; + return fl_window_fullscreen_active (This.Void_Ptr) /= 0; + end Is_Fullscreen; - procedure Set_Border - (This : in out Window; - To : in Border_State) is + procedure Fullscreen_On + (This : in out Window) is begin - fl_window_set_border (This.Void_Ptr, Border_State'Pos (To)); - end Set_Border; + fl_window_fullscreen (This.Void_Ptr); + end Fullscreen_On; - procedure Set_Label - (This : in out Window; - Text : in String) is + procedure Fullscreen_Off + (This : in out Window) is begin - fl_window_set_label (This.Void_Ptr, Interfaces.C.To_C (Text)); - end Set_Label; + fl_window_fullscreen_off (This.Void_Ptr); + end Fullscreen_Off; - procedure Set_Size_Range - (This : in out Window; - Min_W, Min_H : in Integer; - Max_W, Max_H, Incre_W, Incre_H : in Integer := 0; - Keep_Aspect : in Boolean := False) is + procedure Fullscreen_Off + (This : in out Window; + X, Y, W, H : in Integer) is begin - fl_window_size_range - (This.Void_Ptr, - Interfaces.C.int (Min_W), - Interfaces.C.int (Min_H), - Interfaces.C.int (Max_W), - Interfaces.C.int (Max_H), - Interfaces.C.int (Incre_W), - Interfaces.C.int (Incre_H), - Boolean'Pos (Keep_Aspect)); - end Set_Size_Range; + fl_window_fullscreen_off2 + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H)); + end Fullscreen_Off; + + + procedure Fullscreen_Screens + (This : in out Window; + Top, Bottom, Left, Right : in Natural) is + begin + fl_window_fullscreen_screens + (This.Void_Ptr, + Interfaces.C.int (Top), + Interfaces.C.int (Bottom), + Interfaces.C.int (Left), + Interfaces.C.int (Right)); + end Fullscreen_Screens; + + procedure Set_Icon @@ -276,18 +481,28 @@ package body FLTK.Widgets.Groups.Windows is end Set_Icon; - procedure Set_Modal - (This : in out Window) is + procedure Set_Default_Icon + (Pic : in out FLTK.Images.RGB.RGB_Image'Class) is begin - fl_window_set_modal (This.Void_Ptr); - end Set_Modal; + fl_window_default_icon (Wrapper (Pic).Void_Ptr); + end Set_Default_Icon; - procedure Set_Non_Modal - (This : in out Window) is + function Get_Icon_Label + (This : in Window) + return String is + begin + -- pointer to internal buffer only, so no Free required + return Interfaces.C.Strings.Value (fl_window_get_iconlabel (This.Void_Ptr)); + end Get_Icon_Label; + + + procedure Set_Icon_Label + (This : in out Window; + To : in String) is begin - fl_window_set_non_modal (This.Void_Ptr); - end Set_Non_Modal; + fl_window_set_iconlabel (This.Void_Ptr, Interfaces.C.To_C (To)); + end Set_Icon_Label; procedure Set_Cursor @@ -298,6 +513,19 @@ package body FLTK.Widgets.Groups.Windows is end Set_Cursor; + procedure Set_Cursor + (This : in out Window; + Pic : in out FLTK.Images.RGB.RGB_Image'Class; + Hot_X, Hot_Y : in Integer) is + begin + fl_window_set_cursor2 + (This.Void_Ptr, + Wrapper (Pic).Void_Ptr, + Interfaces.C.int (Hot_X), + Interfaces.C.int (Hot_Y)); + end Set_Cursor; + + procedure Set_Default_Cursor (This : in out Window; To : in Cursor) is @@ -308,6 +536,138 @@ package body FLTK.Widgets.Groups.Windows is + function Get_Border_State + (This : in Window) + return Border_State is + begin + return Border_State'Val (fl_window_get_border (This.Void_Ptr)); + end Get_Border_State; + + + procedure Set_Border_State + (This : in out Window; + To : in Border_State) is + begin + fl_window_set_border (This.Void_Ptr, Border_State'Pos (To)); + end Set_Border_State; + + + function Is_Override + (This : in Window) + return Boolean is + begin + return fl_window_get_override (This.Void_Ptr) /= 0; + end Is_Override; + + + procedure Set_Override + (This : in out Window) is + begin + fl_window_set_override (This.Void_Ptr); + end Set_Override; + + + function Get_Modal_State + (This : in Window) + return Modal_State is + begin + if fl_window_modal (This.Void_Ptr) /= 0 then + return Modal; + elsif fl_window_non_modal (This.Void_Ptr) /= 0 then + return Non_Modal; + else + return Normal; + end if; + end Get_Modal_State; + + + procedure Set_Modal_State + (This : in out Window; + To : in Modal_State) is + begin + case To is + when Normal => + fl_window_clear_modal_states (This.Void_Ptr); + when Non_Modal => + fl_window_set_non_modal (This.Void_Ptr); + when Modal => + fl_window_set_modal (This.Void_Ptr); + end case; + end Set_Modal_State; + + + + + function Get_Label + (This : in Window) + return String is + begin + -- pointer to internal buffer only, so no Free required + return Interfaces.C.Strings.Value (fl_window_get_label (This.Void_Ptr)); + end Get_Label; + + + procedure Set_Label + (This : in out Window; + Text : in String) is + begin + fl_window_set_label (This.Void_Ptr, Interfaces.C.To_C (Text)); + end Set_Label; + + + procedure Hotspot + (This : in out Window; + X, Y : in Integer; + Offscreen : in Boolean := False) is + begin + fl_window_hotspot + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Boolean'Pos (Offscreen)); + end Hotspot; + + + procedure Hotspot + (This : in out Window; + Item : in Widget'Class; + Offscreen : in Boolean := False) is + begin + fl_window_hotspot2 + (This.Void_Ptr, + Item.Void_Ptr, + Boolean'Pos (Offscreen)); + end Hotspot; + + + procedure Set_Size_Range + (This : in out Window; + Min_W, Min_H : in Integer; + Max_W, Max_H, Incre_W, Incre_H : in Integer := 0; + Keep_Aspect : in Boolean := False) is + begin + fl_window_size_range + (This.Void_Ptr, + Interfaces.C.int (Min_W), + Interfaces.C.int (Min_H), + Interfaces.C.int (Max_W), + Interfaces.C.int (Max_H), + Interfaces.C.int (Incre_W), + Interfaces.C.int (Incre_H), + Boolean'Pos (Keep_Aspect)); + end Set_Size_Range; + + + procedure Shape + (This : in out Window; + Pic : in out FLTK.Images.Image'Class) is + begin + fl_window_shape (This.Void_Ptr, Wrapper (Pic).Void_Ptr); + end Shape; + + + + function Get_X_Root (This : in Window) return Integer is diff --git a/src/fltk-widgets-groups-windows.ads b/src/fltk-widgets-groups-windows.ads index 3ea38c1..1199ec7 100644 --- a/src/fltk-widgets-groups-windows.ads +++ b/src/fltk-widgets-groups-windows.ads @@ -14,8 +14,13 @@ package FLTK.Widgets.Groups.Windows is type Window is new Group with private; + type Window_Reference (Data : not null access Window'Class) is limited null record + with Implicit_Dereference => Data; + type Border_State is (None, Visible); + type Modal_State is (Normal, Non_Modal, Modal); + type Cursor is (Default, Arrow, Crosshair, Wait, Insert, Hand, Help, Move, @@ -34,7 +39,8 @@ package FLTK.Widgets.Groups.Windows is return Window; function Create - (W, H : in Integer) + (W, H : in Integer; + Text : in String) return Window; end Forge; @@ -48,44 +54,73 @@ package FLTK.Widgets.Groups.Windows is procedure Hide (This : in out Window); + function Is_Shown + (This : in Window) + return Boolean; + + procedure Wait_For_Expose + (This : in out Window); + + procedure Iconify + (This : in out Window); + procedure Make_Current (This : in out Window); + function Last_Made_Current + return access Window'Class; + + procedure Free_Position + (This : in out Window); + - function Get_Border + function Is_Fullscreen (This : in Window) - return Border_State; + return Boolean; + + procedure Fullscreen_On + (This : in out Window); + + procedure Fullscreen_Off + (This : in out Window); + + procedure Fullscreen_Off + (This : in out Window; + X, Y, W, H : in Integer); + + procedure Fullscreen_Screens + (This : in out Window; + Top, Bottom, Left, Right : in Natural); - procedure Set_Border - (This : in out Window; - To : in Border_State); - procedure Set_Label - (This : in out Window; - Text : in String); - procedure Set_Size_Range - (This : in out Window; - Min_W, Min_H : in Integer; - Max_W, Max_H, Incre_W, Incre_H : in Integer := 0; - Keep_Aspect : in Boolean := False); procedure Set_Icon (This : in out Window; Pic : in out FLTK.Images.RGB.RGB_Image'Class); - procedure Set_Modal - (This : in out Window); + procedure Set_Default_Icon + (Pic : in out FLTK.Images.RGB.RGB_Image'Class); - procedure Set_Non_Modal - (This : in out Window); + function Get_Icon_Label + (This : in Window) + return String; + + procedure Set_Icon_Label + (This : in out Window; + To : in String); procedure Set_Cursor (This : in out Window; To : in Cursor); + procedure Set_Cursor + (This : in out Window; + Pic : in out FLTK.Images.RGB.RGB_Image'Class; + Hot_X, Hot_Y : in Integer); + procedure Set_Default_Cursor (This : in out Window; To : in Cursor); @@ -93,6 +128,63 @@ package FLTK.Widgets.Groups.Windows is + function Get_Border_State + (This : in Window) + return Border_State; + + procedure Set_Border_State + (This : in out Window; + To : in Border_State); + + function Is_Override + (This : in Window) + return Boolean; + + procedure Set_Override + (This : in out Window); + + function Get_Modal_State + (This : in Window) + return Modal_State; + + procedure Set_Modal_State + (This : in out Window; + To : in Modal_State); + + + + + function Get_Label + (This : in Window) + return String; + + procedure Set_Label + (This : in out Window; + Text : in String); + + procedure Hotspot + (This : in out Window; + X, Y : in Integer; + Offscreen : in Boolean := False); + + procedure Hotspot + (This : in out Window; + Item : in Widget'Class; + Offscreen : in Boolean := False); + + procedure Set_Size_Range + (This : in out Window; + Min_W, Min_H : in Integer; + Max_W, Max_H, Incre_W, Incre_H : in Integer := 0; + Keep_Aspect : in Boolean := False); + + procedure Shape + (This : in out Window; + Pic : in out FLTK.Images.Image'Class); + + + + function Get_X_Root (This : in Window) return Integer; @@ -132,6 +224,57 @@ private + pragma Inline (Show); + pragma Inline (Hide); + pragma Inline (Is_Shown); + pragma Inline (Wait_For_Expose); + pragma Inline (Iconify); + pragma Inline (Make_Current); + pragma Inline (Last_Made_Current); + pragma Inline (Free_Position); + + + pragma Inline (Is_Fullscreen); + pragma Inline (Fullscreen_On); + pragma Inline (Fullscreen_Off); + pragma Inline (Fullscreen_Screens); + + + pragma Inline (Set_Icon); + pragma Inline (Set_Default_Icon); + pragma Inline (Get_Icon_Label); + pragma Inline (Set_Icon_Label); + pragma Inline (Set_Cursor); + pragma Inline (Set_Default_Cursor); + + + pragma Inline (Get_Border_State); + pragma Inline (Set_Border_State); + pragma Inline (Is_Override); + pragma Inline (Set_Override); + pragma Inline (Get_Modal_State); + pragma Inline (Set_Modal_State); + + + pragma Inline (Get_Label); + pragma Inline (Set_Label); + pragma Inline (Hotspot); + pragma Inline (Set_Size_Range); + pragma Inline (Shape); + + + pragma Inline (Get_X_Root); + pragma Inline (Get_Y_Root); + pragma Inline (Get_Decorated_W); + pragma Inline (Get_Decorated_H); + + + pragma Inline (Draw); + pragma Inline (Handle); + + + + -- What delightful magic numbers FLTK cursors are! -- (These correspond to the enum found in Enumerations.H) Cursor_Values : array (Cursor) of Interfaces.C.int := @@ -158,5 +301,10 @@ private None => 255); + + + Last_Current : access Window'Class := null; + + end FLTK.Widgets.Groups.Windows; diff --git a/src/fltk-widgets.adb b/src/fltk-widgets.adb index 5d1e5d8..28bbb24 100644 --- a/src/fltk-widgets.adb +++ b/src/fltk-widgets.adb @@ -405,7 +405,7 @@ package body FLTK.Widgets is function Get_Label - (This : in out Widget) + (This : in Widget) return String is begin return Interfaces.C.Strings.Value (fl_widget_get_label (This.Void_Ptr)); diff --git a/src/fltk-widgets.ads b/src/fltk-widgets.ads index e4069c1..671cfa0 100644 --- a/src/fltk-widgets.ads +++ b/src/fltk-widgets.ads @@ -97,7 +97,7 @@ package FLTK.Widgets is Box : in Box_Kind); function Get_Label - (This : in out Widget) + (This : in Widget) return String; procedure Set_Label |