diff options
author | Jedidiah Barber <contact@jedbarber.id.au> | 2025-01-12 15:11:40 +1300 |
---|---|---|
committer | Jedidiah Barber <contact@jedbarber.id.au> | 2025-01-12 15:11:40 +1300 |
commit | e324057cbd9b02704172bb5db4163f4a0c276288 (patch) | |
tree | 35afdc681d278049acc62ae61366b6da46122128 /src | |
parent | f8b638b57cc1318ef3536efae662b54b3d14a3bb (diff) |
Closed a few gaps in the APIs of Window derivatives
Diffstat (limited to 'src')
-rw-r--r-- | src/c_fl_cairo_window.cpp | 12 | ||||
-rw-r--r-- | src/c_fl_cairo_window.h | 4 | ||||
-rw-r--r-- | src/c_fl_double_window.cpp | 16 | ||||
-rw-r--r-- | src/c_fl_double_window.h | 1 | ||||
-rw-r--r-- | src/c_fl_gl_window.cpp | 4 | ||||
-rw-r--r-- | src/c_fl_gl_window.h | 1 | ||||
-rw-r--r-- | src/c_fl_menu_window.cpp | 4 | ||||
-rw-r--r-- | src/c_fl_menu_window.h | 1 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows-double-cairo.adb | 33 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows-double.adb | 13 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows-double.ads | 4 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows-opengl.adb | 12 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows-opengl.ads | 4 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows-single-menu.adb | 21 | ||||
-rw-r--r-- | src/fltk-widgets-groups-windows-single-menu.ads | 10 |
15 files changed, 100 insertions, 40 deletions
diff --git a/src/c_fl_cairo_window.cpp b/src/c_fl_cairo_window.cpp index 39f3031..c1a815e 100644 --- a/src/c_fl_cairo_window.cpp +++ b/src/c_fl_cairo_window.cpp @@ -55,17 +55,7 @@ int My_Cairo_Window::handle(int e) { // Flattened C API begins here -CAIROWINDOW new_fl_cairo_window(int x, int y, int w, int h, char * label) { - My_Cairo_Window *c = new My_Cairo_Window(x, y, w, h, label); - return c; -} - -CAIROWINDOW new_fl_cairo_window2(int w, int h, char * label) { - My_Cairo_Window *c = new My_Cairo_Window(w, h, label); - return c; -} - -CAIROWINDOW new_fl_cairo_window3(int w, int h) { +CAIROWINDOW new_fl_cairo_window(int w, int h) { My_Cairo_Window *c = new My_Cairo_Window(w, h); return c; } diff --git a/src/c_fl_cairo_window.h b/src/c_fl_cairo_window.h index e9a1437..d004d16 100644 --- a/src/c_fl_cairo_window.h +++ b/src/c_fl_cairo_window.h @@ -11,9 +11,7 @@ typedef void* CAIROWINDOW; -extern "C" CAIROWINDOW new_fl_cairo_window(int x, int y, int w, int h, char * label); -extern "C" CAIROWINDOW new_fl_cairo_window2(int w, int h, char * label); -extern "C" CAIROWINDOW new_fl_cairo_window3(int w, int h); +extern "C" CAIROWINDOW new_fl_cairo_window(int w, int h); extern "C" void free_fl_cairo_window(CAIROWINDOW w); diff --git a/src/c_fl_double_window.cpp b/src/c_fl_double_window.cpp index 4bbe48b..93c3f49 100644 --- a/src/c_fl_double_window.cpp +++ b/src/c_fl_double_window.cpp @@ -18,6 +18,17 @@ extern "C" int widget_handle_hook(void * ud, int e); +// Non-friend protected access + +class Friend_Double_Window : Fl_Double_Window { +public: + // Only needed for the (int) version + using Fl_Double_Window::flush; +}; + + + + // Attaching all relevant hooks and friends class My_Double_Window : public Fl_Double_Window { @@ -77,6 +88,11 @@ void fl_double_window_flush(DOUBLEWINDOW d) { reinterpret_cast<Fl_Double_Window*>(d)->flush(); } +void fl_double_window_flush2(DOUBLEWINDOW d, int e) { + void (Fl_Double_Window::*myflush)(int) = &Friend_Double_Window::flush; + (reinterpret_cast<Fl_Double_Window*>(d)->*myflush)(e); +} + diff --git a/src/c_fl_double_window.h b/src/c_fl_double_window.h index b1bb7d4..c6f4cc8 100644 --- a/src/c_fl_double_window.h +++ b/src/c_fl_double_window.h @@ -20,6 +20,7 @@ extern "C" void fl_double_window_show(DOUBLEWINDOW d); extern "C" void fl_double_window_show2(DOUBLEWINDOW d, int c, void * v); extern "C" void fl_double_window_hide(DOUBLEWINDOW d); extern "C" void fl_double_window_flush(DOUBLEWINDOW d); +extern "C" void fl_double_window_flush2(DOUBLEWINDOW d, int e); extern "C" void fl_double_window_resize(DOUBLEWINDOW d, int x, int y, int w, int h); diff --git a/src/c_fl_gl_window.cpp b/src/c_fl_gl_window.cpp index 70ba7e3..ac2d7a5 100644 --- a/src/c_fl_gl_window.cpp +++ b/src/c_fl_gl_window.cpp @@ -150,6 +150,10 @@ void fl_gl_window_set_valid(GLWINDOW w, char v) { reinterpret_cast<Fl_Gl_Window*>(w)->valid(v); } +void fl_gl_window_invalidate(GLWINDOW w) { + reinterpret_cast<Fl_Gl_Window*>(w)->invalidate(); +} + void fl_gl_window_make_current(GLWINDOW w) { reinterpret_cast<Fl_Gl_Window*>(w)->make_current(); } diff --git a/src/c_fl_gl_window.h b/src/c_fl_gl_window.h index 4c48b59..6177db6 100644 --- a/src/c_fl_gl_window.h +++ b/src/c_fl_gl_window.h @@ -42,6 +42,7 @@ extern "C" char fl_gl_window_context_valid(GLWINDOW w); extern "C" void fl_gl_window_set_context_valid(GLWINDOW w, char v); extern "C" char fl_gl_window_valid(GLWINDOW w); extern "C" void fl_gl_window_set_valid(GLWINDOW w, char v); +extern "C" void fl_gl_window_invalidate(GLWINDOW w); extern "C" void fl_gl_window_make_current(GLWINDOW w); extern "C" void fl_gl_window_make_overlay_current(GLWINDOW w); diff --git a/src/c_fl_menu_window.cpp b/src/c_fl_menu_window.cpp index db03028..a01b0f7 100644 --- a/src/c_fl_menu_window.cpp +++ b/src/c_fl_menu_window.cpp @@ -73,6 +73,10 @@ void fl_menu_window_flush(MENUWINDOW m) { reinterpret_cast<Fl_Menu_Window*>(m)->flush(); } +void fl_menu_window_erase(MENUWINDOW m) { + reinterpret_cast<Fl_Menu_Window*>(m)->erase(); +} + diff --git a/src/c_fl_menu_window.h b/src/c_fl_menu_window.h index db8f26f..020a377 100644 --- a/src/c_fl_menu_window.h +++ b/src/c_fl_menu_window.h @@ -19,6 +19,7 @@ extern "C" void free_fl_menu_window(MENUWINDOW m); extern "C" void fl_menu_window_show(MENUWINDOW m); extern "C" void fl_menu_window_hide(MENUWINDOW m); extern "C" void fl_menu_window_flush(MENUWINDOW m); +extern "C" void fl_menu_window_erase(MENUWINDOW m); extern "C" void fl_menu_window_set_overlay(MENUWINDOW m); diff --git a/src/fltk-widgets-groups-windows-double-cairo.adb b/src/fltk-widgets-groups-windows-double-cairo.adb index eeeab90..75cf50a 100644 --- a/src/fltk-widgets-groups-windows-double-cairo.adb +++ b/src/fltk-widgets-groups-windows-double-cairo.adb @@ -18,25 +18,11 @@ package body FLTK.Widgets.Groups.Windows.Double.Cairo is ------------------------ function new_fl_cairo_window - (X, Y, W, H : in Interfaces.C.int; - Text : in Interfaces.C.char_array) + (W, H : in Interfaces.C.int) return Storage.Integer_Address; pragma Import (C, new_fl_cairo_window, "new_fl_cairo_window"); pragma Inline (new_fl_cairo_window); - function new_fl_cairo_window2 - (W, H : in Interfaces.C.int; - Text : in Interfaces.C.char_array) - return Storage.Integer_Address; - pragma Import (C, new_fl_cairo_window2, "new_fl_cairo_window2"); - pragma Inline (new_fl_cairo_window2); - - function new_fl_cairo_window3 - (W, H : in Interfaces.C.int) - return Storage.Integer_Address; - pragma Import (C, new_fl_cairo_window3, "new_fl_cairo_window3"); - pragma Inline (new_fl_cairo_window3); - procedure free_fl_cairo_window (W : in Storage.Integer_Address); pragma Import (C, free_fl_cairo_window, "free_fl_cairo_window"); @@ -151,11 +137,10 @@ package body FLTK.Widgets.Groups.Windows.Double.Cairo is begin return This : Cairo_Window do This.Void_Ptr := new_fl_cairo_window - (Interfaces.C.int (X), - Interfaces.C.int (Y), - Interfaces.C.int (W), - Interfaces.C.int (H), - Interfaces.C.To_C (Text)); + (Interfaces.C.int (W), + Interfaces.C.int (H)); + This.Reposition (X, Y); + This.Set_Label (Text); Extra_Init (This, X, Y, W, H, Text); end return; end Create; @@ -167,10 +152,10 @@ package body FLTK.Widgets.Groups.Windows.Double.Cairo is return Cairo_Window is begin return This : Cairo_Window do - This.Void_Ptr := new_fl_cairo_window2 + This.Void_Ptr := new_fl_cairo_window (Interfaces.C.int (W), - Interfaces.C.int (H), - Interfaces.C.To_C (Text)); + Interfaces.C.int (H)); + This.Set_Label (Text); Extra_Init (This, This.Get_X, This.Get_Y, W, H, Text); end return; end Create; @@ -181,7 +166,7 @@ package body FLTK.Widgets.Groups.Windows.Double.Cairo is return Cairo_Window is begin return This : Cairo_Window do - This.Void_Ptr := new_fl_cairo_window3 + This.Void_Ptr := new_fl_cairo_window (Interfaces.C.int (W), Interfaces.C.int (H)); Extra_Init (This, This.Get_X, This.Get_Y, W, H, This.Get_Label); diff --git a/src/fltk-widgets-groups-windows-double.adb b/src/fltk-widgets-groups-windows-double.adb index 3864a1a..044bf38 100644 --- a/src/fltk-widgets-groups-windows-double.adb +++ b/src/fltk-widgets-groups-windows-double.adb @@ -60,6 +60,12 @@ package body FLTK.Widgets.Groups.Windows.Double is pragma Import (C, fl_double_window_flush, "fl_double_window_flush"); pragma Inline (fl_double_window_flush); + procedure fl_double_window_flush2 + (W : in Storage.Integer_Address; + E : in Interfaces.C.int); + pragma Import (C, fl_double_window_flush2, "fl_double_window_flush2"); + pragma Inline (fl_double_window_flush2); + @@ -202,6 +208,13 @@ package body FLTK.Widgets.Groups.Windows.Double is end Flush; + procedure Flush_All + (This : in out Double_Window) is + begin + fl_double_window_flush2 (This.Void_Ptr, 1); + end Flush_All; + + procedure Resize diff --git a/src/fltk-widgets-groups-windows-double.ads b/src/fltk-widgets-groups-windows-double.ads index 919e687..bd54d47 100644 --- a/src/fltk-widgets-groups-windows-double.ads +++ b/src/fltk-widgets-groups-windows-double.ads @@ -44,6 +44,9 @@ package FLTK.Widgets.Groups.Windows.Double is procedure Flush (This : in out Double_Window); + procedure Flush_All + (This : in out Double_Window); + @@ -78,6 +81,7 @@ private pragma Inline (Show_With_Args); pragma Inline (Hide); pragma Inline (Flush); + pragma Inline (Flush_All); pragma Inline (Resize); diff --git a/src/fltk-widgets-groups-windows-opengl.adb b/src/fltk-widgets-groups-windows-opengl.adb index 190b5c1..1b8bea7 100644 --- a/src/fltk-widgets-groups-windows-opengl.adb +++ b/src/fltk-widgets-groups-windows-opengl.adb @@ -171,6 +171,11 @@ package body FLTK.Widgets.Groups.Windows.OpenGL is pragma Import (C, fl_gl_window_set_valid, "fl_gl_window_set_valid"); pragma Inline (fl_gl_window_set_valid); + procedure fl_gl_window_invalidate + (S : in Storage.Integer_Address); + pragma Import (C, fl_gl_window_invalidate, "fl_gl_window_invalidate"); + pragma Inline (fl_gl_window_invalidate); + procedure fl_gl_window_make_current (S : in Storage.Integer_Address); pragma Import (C, fl_gl_window_make_current, "fl_gl_window_make_current"); @@ -481,6 +486,13 @@ package body FLTK.Widgets.Groups.Windows.OpenGL is end Set_Valid; + procedure Invalidate + (This : in out GL_Window) is + begin + fl_gl_window_invalidate (This.Void_Ptr); + end Invalidate; + + procedure Make_Current (This : in out GL_Window) is begin diff --git a/src/fltk-widgets-groups-windows-opengl.ads b/src/fltk-widgets-groups-windows-opengl.ads index 44a7647..2582bb1 100644 --- a/src/fltk-widgets-groups-windows-opengl.ads +++ b/src/fltk-widgets-groups-windows-opengl.ads @@ -158,6 +158,9 @@ package FLTK.Widgets.Groups.Windows.OpenGL is (This : in out GL_Window; Value : in Boolean); + procedure Invalidate + (This : in out GL_Window); + procedure Make_Current (This : in out GL_Window); @@ -251,6 +254,7 @@ private pragma Inline (Set_Context_Valid); pragma Inline (Get_Valid); pragma Inline (Set_Valid); + pragma Inline (Invalidate); pragma Inline (Make_Current); pragma Inline (Make_Overlay_Current); diff --git a/src/fltk-widgets-groups-windows-single-menu.adb b/src/fltk-widgets-groups-windows-single-menu.adb index 7448c3b..480f89e 100644 --- a/src/fltk-widgets-groups-windows-single-menu.adb +++ b/src/fltk-widgets-groups-windows-single-menu.adb @@ -57,6 +57,11 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is pragma Import (C, fl_menu_window_flush, "fl_menu_window_flush"); pragma Inline (fl_menu_window_flush); + procedure fl_menu_window_erase + (M : in Storage.Integer_Address); + pragma Import (C, fl_menu_window_erase, "fl_menu_window_erase"); + pragma Inline (fl_menu_window_erase); + @@ -202,6 +207,13 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is end Flush; + procedure Erase + (This : in out Menu_Window) is + begin + fl_menu_window_erase (This.Void_Ptr); + end Erase; + + function Is_Overlay @@ -214,7 +226,7 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is procedure Set_Overlay (This : in out Menu_Window; - Value : in Boolean) is + Value : in Boolean := True) is begin if Value then fl_menu_window_set_overlay (This.Void_Ptr); @@ -224,6 +236,13 @@ package body FLTK.Widgets.Groups.Windows.Single.Menu is end Set_Overlay; + procedure Clear_Overlay + (This : in out Menu_Window) is + begin + fl_menu_window_clear_overlay (This.Void_Ptr); + end Clear_Overlay; + + end FLTK.Widgets.Groups.Windows.Single.Menu; diff --git a/src/fltk-widgets-groups-windows-single-menu.ads b/src/fltk-widgets-groups-windows-single-menu.ads index 1908d72..7f6fd59 100644 --- a/src/fltk-widgets-groups-windows-single-menu.ads +++ b/src/fltk-widgets-groups-windows-single-menu.ads @@ -41,6 +41,9 @@ package FLTK.Widgets.Groups.Windows.Single.Menu is procedure Flush (This : in out Menu_Window); + procedure Erase + (This : in out Menu_Window); + @@ -50,7 +53,10 @@ package FLTK.Widgets.Groups.Windows.Single.Menu is procedure Set_Overlay (This : in out Menu_Window; - Value : in Boolean); + Value : in Boolean := True); + + procedure Clear_Overlay + (This : in out Menu_Window); private @@ -78,9 +84,11 @@ private pragma Inline (Show); pragma Inline (Hide); pragma Inline (Flush); + pragma Inline (Erase); pragma Inline (Is_Overlay); pragma Inline (Set_Overlay); + pragma Inline (Clear_Overlay); end FLTK.Widgets.Groups.Windows.Single.Menu; |