diff options
author | Jed Barber <jjbarber@y7mail.com> | 2018-05-12 16:59:56 +1000 |
---|---|---|
committer | Jed Barber <jjbarber@y7mail.com> | 2018-05-12 16:59:56 +1000 |
commit | befef958429f7321cc40904d0128ed5c237d04c0 (patch) | |
tree | 3092a28c08bed1f10928b27c5ba8dab543c0db64 | |
parent | cdcf5839899276b041b56b70798055f0d438bbdb (diff) |
Completed and polished FLTK.Widgets
-rw-r--r-- | doc/fl_widget.html | 1059 | ||||
-rw-r--r-- | progress.txt | 2 | ||||
-rw-r--r-- | src/c_fl_widget.cpp | 164 | ||||
-rw-r--r-- | src/c_fl_widget.h | 115 | ||||
-rw-r--r-- | src/fltk-widgets.adb | 630 | ||||
-rw-r--r-- | src/fltk-widgets.ads | 266 |
6 files changed, 2158 insertions, 78 deletions
diff --git a/doc/fl_widget.html b/doc/fl_widget.html new file mode 100644 index 0000000..762591b --- /dev/null +++ b/doc/fl_widget.html @@ -0,0 +1,1059 @@ + +<!DOCTYPE html> + +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>Fl_Widget Binding Map</title> + <link href="map.css" rel="stylesheet"> + </head> + + <body> + + +<h2>Fl_Widget Binding Map</h2> + + +<table class="package"> + <tr><th colspan="2">Package name</th></tr> + + <tr> + <td>Fl_Widget</td> + <td>FLTK.Widgets</td> + </tr> + +</table> + + + +<table class="type"> + <tr><th colspan="2">Types</th></tr> + + <tr> + <td>Fl_Widget</td> + <td>Widget</td> + </tr> + + <tr> + <td> </td> + <td>Widget_Reference</td> + </tr> + + <tr> + <td>Fl_Callback_p</td> + <td>Widget_Callback</td> + </tr> + + <tr> + <td>Fl_When</td> + <td>Callback_Flag</td> + </tr> + +</table> + + + +<table class="function"> + <tr><th colspan="2">Functions and Procedures</th></tr> + + <tr> +<td><pre> +Fl_Widget(int x, int y, int w, int h, const char *label=0L); +</pre></td> +<td><pre> +function Create + (X, Y, W, H : in Integer; + Text : in String) + return Widget; +</pre></td> + </tr> + + <tr> +<td><pre> +void _clear_fullscreen(); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void _set_fullscreen(); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void activate(); +</pre></td> +<td><pre> +procedure Activate + (This : in out Widget); +</pre></td> + </tr> + + <tr> +<td><pre> +unsigned int active() const; +</pre></td> +<td><pre> +function Is_Active + (This : in Widget) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +int active_r() const; +</pre></td> +<td><pre> +function Is_Tree_Active + (This : in Widget) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Align align() const; +</pre></td> +<td><pre> +function Get_Alignment + (This : in Widget) + return Alignment; +</pre></td> + </tr> + + <tr> +<td><pre> +void align(Fl_Align alignment); +</pre></td> +<td><pre> +procedure Set_Alignment + (This : in out Widget; + New_Align : in Alignment); +</pre></td> + </tr> + + <tr> +<td><pre> +long argument() const; +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void argument(long v); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +virtual class Fl_Gl_Window * as_gl_window(); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +virtual Fl_Group * as_group(); +</pre></td> +<td>Use runtime tag checks and view conversions instead</td> + </tr> + + <tr> +<td><pre> +virtual Fl_Window * as_window(); +</pre></td> +<td>Use runtime tag checks and view conversions instead</td> + </tr> + + <tr> +<td><pre> +Fl_Boxtype box() const; +</pre></td> +<td><pre> +function Get_Box + (This : in Widget) + return Box_Kind; +</pre></td> + </tr> + + <tr> +<td><pre> +void box(Fl_Boxtype new_box); +</pre></td> +<td><pre> +procedure Set_Box + (This : in out Widget; + Box : in Box_Kind); +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Callback_p callback() const; +</pre></td> +<td><pre> +function Get_Callback + (This : in Widget) + return Widget_Callback; +</pre></td> + </tr> + + <tr> +<td><pre> +void callback(Fl_Callback *cb, void *p); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void callback(Fl_Callback *cb); +void callback(Fl_Callback0 *cb); +</pre></td> +<td><pre> +procedure Set_Callback + (This : in out Widget; + Func : in Widget_Callback); +</pre></td> + </tr> + + <tr> +<td><pre> +void callback(Fl_Callback1 *cb, long p=0); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +unsigned int changed() const; +</pre></td> +<td><pre> +function Has_Changed + (This : in Widget) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +void clear_active(); +</pre></td> +<td><pre> +procedure Set_Active + (This : in out Widget; + To : in Boolean); +</pre></td> + </tr> + + <tr> +<td><pre> +void clear_changed(); +</pre></td> +<td><pre> +procedure Set_Changed + (This : in out Widget; + To : in Boolean); +</pre></td> + </tr> + + <tr> +<td><pre> +void clear_damage(uchar c=0); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void clear_output(); +</pre></td> +<td><pre> +procedure Set_Output_Only + (This : in out Widget; + To : in Boolean); +</pre></td> + </tr> + + <tr> +<td><pre> +void clear_visible(); +</pre></td> +<td><pre> +procedure Set_Visible + (This : in out Widget; + To : in Boolean); +</pre></td> + </tr> + + <tr> +<td><pre> +void clear_visible_focus(); +</pre></td> +<td><pre> +procedure Set_Visible_Focus + (This : in out Widget; + To : in Boolean); +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Color color() const; +</pre></td> +<td><pre> +function Get_Background_Color + (This : in Widget) + return Color; +</pre></td> + </tr> + + <tr> +<td><pre> +void color(Fl_Color bg); +</pre></td> +<td><pre> +procedure Set_Background_Color + (This : in out Widget; + To : in Color); +</pre></td> + </tr> + + <tr> +<td><pre> +void color(Fl_Color bg, Fl_Color sel); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +Fl_Color color2() const; +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void color2(unsigned a); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +int contains(const Fl_Widget *w) const; +</pre></td> +<td><pre> +function Contains + (This : in Widget; + Item : in Widget'Class) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +void copy_label(const char *new_label); +</pre></td> +<td><pre> +procedure Set_Label + (This : in out Widget; + Text : in String); +</pre></td> + </tr> + + <tr> +<td><pre> +void copy_tooltip(const char *text); +</pre></td> +<td><pre> +procedure Set_Tooltip + (This : in out Widget; + Text : in String); +</pre></td> + </tr> + + <tr> +<td><pre> +uchar damage() const; +</pre></td> +<td><pre> +function Is_Damaged + (This : in Widget) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +void damage(uchar c); +</pre></td> +<td><pre> +procedure Set_Damaged + (This : in out Widget; + To : in Boolean); +</pre></td> + </tr> + + <tr> +<td><pre> +void damage(uchar c, int x, int y, int w, int h); +</pre></td> +<td><pre> +procedure Set_Damaged + (This : in out Widget; + To : in Boolean; + X, Y, W, H : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +int damage_resize(int, int, int, int); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void deactivate(); +</pre></td> +<td><pre> +procedure Deactivate + (This : in out Widget); +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Image * deimage(); +const Fl_Image * deimage() const; +</pre></td> +<td><pre> +function Get_Inactive_Image + (This : in Widget) + return access FLTK.Images.Image'Class; +</pre></td> + </tr> + + <tr> +<td><pre> +void deimage(Fl_Image *img); +void deimage(Fl_Image &img); +</pre></td> +<td><pre> +procedure Set_Inactive_Image + (This : in out Widget; + Pic : in out FLTK.Images.Image'Class); +</pre></td> + </tr> + + <tr> +<td><pre> +void do_callback(); +</pre></td> +<td><pre> +procedure Do_Callback + (This : in out Widget); +</pre></td> + </tr> + + <tr> +<td><pre> +void do_callback(Fl_Widget *o, long arg); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void do_callback(Fl_Widget *o, void *arg=0); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +virtual void draw()=0; +</pre></td> +<td><pre> +procedure Draw + (This : in out Widget) is null; +</pre></td> + </tr> + + <tr> +<td><pre> +void draw_label(int, int, int, int, Fl_Align) const; +</pre></td> +<td><pre> +procedure Draw_Label + (This : in Widget; + X, Y, W, H : in Integer; + Align : in Alignment); +</pre></td> + </tr> + + <tr> +<td><pre> +int h() const; +</pre></td> +<td><pre> +function Get_H + (This : in Widget) + return Integer; +</pre></td> + </tr> + + <tr> +<td><pre> +virtual int handle(int event); +</pre></td> +<td><pre> +function Handle + (This : in out Widget; + Event : in Event_Kind) + return Event_Outcome; +</pre></td> + </tr> + + <tr> +<td><pre> +virtual void hide(); +</pre></td> +<td>See void clear_visible();</td> + </tr> + + <tr> +<td><pre> +Fl_Image * image(); +const Fl_Image * image() const; +</pre></td> +<td><pre> +function Get_Image + (This : in Widget) + return access FLTK.Images.Image'Class; +</pre></td> + </tr> + + <tr> +<td><pre> +void image(Fl_Image *img); +void image(Fl_Image &img); +</pre></td> +<td><pre> +procedure Set_Image + (This : in out Widget; + Pic : in out FLTK.Images.Image'Class); +</pre></td> + </tr> + + <tr> +<td><pre> +int inside(const Fl_Widget *wgt) const; +</pre></td> +<td><pre> +function Inside + (This : in Widget; + Parent : in Widget'Class) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +int is_label_copied() const; +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +const char * label() const; +</pre></td> +<td><pre> +function Get_Label + (This : in Widget) + return String; +</pre></td> + </tr> + + <tr> +<td><pre> +void label(const char *text); +</pre></td> +<td>See void copy_label(const char *new_label);</td> + </tr> + + <tr> +<td><pre> +void label(Fl_Labeltype a, const char *b); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +Fl_Color labelcolor() const; +</pre></td> +<td><pre> +function Get_Label_Color + (This : in Widget) + return Color; +</pre></td> + </tr> + + <tr> +<td><pre> +void labelcolor(Fl_Color c); +</pre></td> +<td><pre> +procedure Set_Label_Color + (This : in out Widget; + Value : in Color); +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Font labelfont() const; +</pre></td> +<td><pre> +function Get_Label_Font + (This : in Widget) + return Font_Kind; +</pre></td> + </tr> + + <tr> +<td><pre> +void labelfont(Fl_Font f); +</pre></td> +<td><pre> +procedure Set_Label_Font + (This : in out Widget; + Font : in Font_Kind); +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Fontsize labelsize() const; +</pre></td> +<td><pre> +function Get_Label_Size + (This : in Widget) + return Font_Size; +</pre></td> + </tr> + + <tr> +<td><pre> +void labelsize(Fl_Fontsize pix); +</pre></td> +<td><pre> +procedure Set_Label_Size + (This : in out Widget; + Size : in Font_Size); +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Labeltype labeltype() const; +</pre></td> +<td><pre> +function Get_Label_Type + (This : in Widget) + return Label_Kind; +</pre></td> + </tr> + + <tr> +<td><pre> +void labeltype(Fl_Labeltype a); +</pre></td> +<td><pre> +procedure Set_Label_Type + (This : in out Widget; + Label : in Label_Kind); +</pre></td> + </tr> + + <tr> +<td><pre> +void measure_label(int &ww, int &hh) const; +</pre></td> +<td><pre> +procedure Measure_Label + (This : in Widget; + W, H : out Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +unsigned int output() const; +</pre></td> +<td><pre> +function Is_Output_Only + (This : in Widget) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Group * parent() const; +</pre></td> +<td><pre> +function Parent + (This : in Widget) + return access FLTK.Widgets.Groups.Group'Class; +</pre></td> + </tr> + + <tr> +<td><pre> +void parent(Fl_Group *p); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void position(int X, int Y); +</pre></td> +<td><pre> +procedure Reposition + (This : in out Widget; + X, Y : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +void redraw(); +</pre></td> +<td><pre> +procedure Redraw + (This : in out Widget); +</pre></td> + </tr> + + <tr> +<td><pre> +void redraw_label(); +</pre></td> +<td><pre> +procedure Redraw_Label + (This : in out Widget); +</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> +Fl_Color selection_color() const; +</pre></td> +<td><pre> +function Get_Selection_Color + (This : in Widget) + return Color; +</pre></td> + </tr> + + <tr> +<td><pre> +void selection_color(Fl_Color a); +</pre></td> +<td><pre> +procedure Set_Selection_Color + (This : in out Widget; + To : in Color); +</pre></td> + </tr> + + <tr> +<td><pre> +void set_active(); +</pre></td> +<td>See void clear_active();</td> + </tr> + + <tr> +<td><pre> +void set_changed(); +</pre></td> +<td>See void clear_changed();</td> + </tr> + + <tr> +<td><pre> +void set_output(); +</pre></td> +<td>See void clear_output();</td> + </tr> + + <tr> +<td><pre> +void set_visible(); +</pre></td> +<td>See void clear_visible();</td> + </tr> + + <tr> +<td><pre> +void set_visible_focus(); +</pre></td> +<td>See void clear_visible_focus();</td> + </tr> + + <tr> +<td><pre> +virtual void show(); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void size(int W, int H); +</pre></td> +<td><pre> +procedure Resize + (This : in out Widget; + W, H : in Integer); +</pre></td> + </tr> + + <tr> +<td><pre> +int take_focus(); +</pre></td> +<td><pre> +function Take_Focus + (This : in out Widget) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +unsigned int takesevents() const; +</pre></td> +<td><pre> +function Takes_Events + (This : in Widget) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +int test_shortcut(); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +const char * tooltip() const; +</pre></td> +<td><pre> +function Get_Tooltip + (This : in Widget) + return String; +</pre></td> + </tr> + + <tr> +<td><pre> +void tooltip(const char *text); +</pre></td> +<td>See void copy_tooltip(const char *text);</td> + </tr> + + <tr> +<td><pre> +Fl_Window * top_window() const; +</pre></td> +<td><pre> +function Top_Window + (This : in Widget) + return access FLTK.Widgets.Groups.Windows.Window'Class; +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Window * top_window_offset(int &xoff, int &yoff) const; +</pre></td> +<td><pre> +function Top_Window_Offset + (This : in Widget; + Offset_X, Offset_Y : out Integer) + return access FLTK.Widgets.Groups.Windows.Window'Class; +</pre></td> + </tr> + + <tr> +<td><pre> +uchar type() const; +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void type(uchar t); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +int use_accents_menu(); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void * user_data() const; +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +void user_data(void *v); +</pre></td> +<td> </td> + </tr> + + <tr> +<td><pre> +unsigned int visible() const; +</pre></td> +<td><pre> +function Is_Visible + (This : in Widget) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +void visible_focus(int v); +</pre></td> +<td>See void clear_visible_focus();</td> + </tr> + + <tr> +<td><pre> +unsigned int visible_focus(); +</pre></td> +<td><pre> +function Has_Visible_Focus + (This : in Widget) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +int visible_r() const; +</pre></td> +<td><pre> +function Is_Tree_Visible + (This : in Widget) + return Boolean; +</pre></td> + </tr> + + <tr> +<td><pre> +int w() const; +</pre></td> +<td><pre> +function Get_W + (This : in Widget) + return Integer; +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_When when() const; +</pre></td> +<td><pre> +function Get_When + (This : in Widget) + return Callback_Flag; +</pre></td> + </tr> + + <tr> +<td><pre> +void when(uchar i); +</pre></td> +<td><pre> +procedure Set_When + (This : in out Widget; + To : in Callback_Flag); +</pre></td> + </tr> + + <tr> +<td><pre> +Fl_Window * window() const; +</pre></td> +<td><pre> +function Nearest_Window + (This : in Widget) + return access FLTK.Widgets.Groups.Windows.Window'Class; +</pre></td> + </tr> + + <tr> +<td><pre> +int x() const; +</pre></td> +<td><pre> +function Get_X + (This : in Widget) + return Integer; +</pre></td> + </tr> + + <tr> +<td><pre> +int y() const; +</pre></td> +<td><pre> +function Get_Y + (This : in Widget) + return Integer; +</pre></td> + </tr> + +</table> + + + </body> +</html> + diff --git a/progress.txt b/progress.txt index 9dcba9f..54a3e5a 100644 --- a/progress.txt +++ b/progress.txt @@ -34,6 +34,7 @@ FLTK.Screen FLTK.Static FLTK.Text_Buffers FLTK.Tooltips +FLTK.Widgets FLTK.Widgets.Boxes FLTK.Widgets.Buttons FLTK.Widgets.Buttons.Enter @@ -105,7 +106,6 @@ Partially Done: FLTK.Devices.Graphics (incomplete API, otherwise polished) FLTK.Devices.Surfaces (incomplete API, otherwise polished) FLTK.Environment (incomplete API, otherwise polished) -FLTK.Widgets FLTK.Widgets.Groups FLTK.Widgets.Menus diff --git a/src/c_fl_widget.cpp b/src/c_fl_widget.cpp index 923b509..5f0c904 100644 --- a/src/c_fl_widget.cpp +++ b/src/c_fl_widget.cpp @@ -79,6 +79,10 @@ int fl_widget_active_r(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->active_r(); } +void fl_widget_set_active(WIDGET w) { + reinterpret_cast<Fl_Widget*>(w)->set_active(); +} + void fl_widget_clear_active(WIDGET w) { reinterpret_cast<Fl_Widget*>(w)->clear_active(); } @@ -90,10 +94,80 @@ unsigned int fl_widget_changed(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->changed(); } +void fl_widget_set_changed(WIDGET w) { + reinterpret_cast<Fl_Widget*>(w)->set_changed(); +} + void fl_widget_clear_changed(WIDGET w) { reinterpret_cast<Fl_Widget*>(w)->clear_changed(); } +int fl_widget_output(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->output(); +} + +void fl_widget_set_output(WIDGET w) { + reinterpret_cast<Fl_Widget*>(w)->set_output(); +} + +void fl_widget_clear_output(WIDGET w) { + reinterpret_cast<Fl_Widget*>(w)->clear_output(); +} + +int fl_widget_visible(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->visible(); +} + +int fl_widget_visible_r(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->visible_r(); +} + +void fl_widget_set_visible(WIDGET w) { + reinterpret_cast<Fl_Widget*>(w)->set_visible(); +} + +void fl_widget_clear_visible(WIDGET w) { + reinterpret_cast<Fl_Widget*>(w)->clear_visible(); +} + + + + +int fl_widget_get_visible_focus(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->visible_focus(); +} + +void fl_widget_set_visible_focus(WIDGET w, int f) { + reinterpret_cast<Fl_Widget*>(w)->visible_focus(f); +} + +int fl_widget_take_focus(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->take_focus(); +} + +int fl_widget_takesevents(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->takesevents(); +} + + + + +unsigned int fl_widget_get_color(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->color(); +} + +void fl_widget_set_color(WIDGET w, unsigned int b) { + reinterpret_cast<Fl_Widget*>(w)->color(b); +} + +unsigned int fl_widget_get_selection_color(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->selection_color(); +} + +void fl_widget_set_selection_color(WIDGET w, unsigned int c) { + reinterpret_cast<Fl_Widget*>(w)->selection_color(c); +} + @@ -105,6 +179,22 @@ int fl_widget_contains(WIDGET w, WIDGET i) { return reinterpret_cast<Fl_Widget*>(w)->contains(reinterpret_cast<Fl_Widget*>(i)); } +int fl_widget_inside(WIDGET w, WIDGET p) { + return reinterpret_cast<Fl_Widget*>(w)->inside(reinterpret_cast<Fl_Widget*>(p)); +} + +void * fl_widget_window(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->window(); +} + +void * fl_widget_top_window(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->top_window(); +} + +void * fl_widget_top_window_offset(WIDGET w, int &x, int &y) { + return reinterpret_cast<Fl_Widget*>(w)->top_window_offset(x,y); +} + @@ -124,6 +214,17 @@ void fl_widget_set_box(WIDGET w, int b) { reinterpret_cast<Fl_Widget*>(w)->box(static_cast<Fl_Boxtype>(b)); } +const char * fl_widget_tooltip(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->tooltip(); +} + +void fl_widget_copy_tooltip(WIDGET w, const char * t) { + reinterpret_cast<Fl_Widget*>(w)->copy_tooltip(t); +} + + + + const char* fl_widget_get_label(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->label(); } @@ -132,34 +233,57 @@ void fl_widget_set_label(WIDGET w, const char* t) { reinterpret_cast<Fl_Widget*>(w)->copy_label(t); } -int fl_widget_get_label_font(WIDGET w) { +unsigned int fl_widget_get_labelcolor(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->labelcolor(); +} + +void fl_widget_set_labelcolor(WIDGET w, unsigned int v) { + reinterpret_cast<Fl_Widget*>(w)->labelcolor(v); +} + +int fl_widget_get_labelfont(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->labelfont(); } -void fl_widget_set_label_font(WIDGET w, int f) { +void fl_widget_set_labelfont(WIDGET w, int f) { reinterpret_cast<Fl_Widget*>(w)->labelfont(static_cast<Fl_Font>(f)); } -int fl_widget_get_label_size(WIDGET w) { +int fl_widget_get_labelsize(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->labelsize(); } -void fl_widget_set_label_size(WIDGET w, int s) { +void fl_widget_set_labelsize(WIDGET w, int s) { reinterpret_cast<Fl_Widget*>(w)->labelsize(static_cast<Fl_Fontsize>(s)); } -int fl_widget_get_label_type(WIDGET w) { +int fl_widget_get_labeltype(WIDGET w) { return reinterpret_cast<Fl_Widget*>(w)->labeltype(); } -void fl_widget_set_label_type(WIDGET w, int l) { +void fl_widget_set_labeltype(WIDGET w, int l) { reinterpret_cast<Fl_Widget*>(w)->labeltype(static_cast<Fl_Labeltype>(l)); } +void fl_widget_measure_label(WIDGET w, int &d, int &h) { + reinterpret_cast<Fl_Widget*>(w)->measure_label(d,h); +} + + + + void fl_widget_set_callback(WIDGET w, void * cb) { reinterpret_cast<Fl_Widget*>(w)->callback(reinterpret_cast<Fl_Callback_p>(cb)); } +unsigned int fl_widget_get_when(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->when(); +} + +void fl_widget_set_when(WIDGET w, unsigned int c) { + reinterpret_cast<Fl_Widget*>(w)->when(c); +} + @@ -194,9 +318,37 @@ void fl_widget_set_image(WIDGET w, void * img) { reinterpret_cast<Fl_Widget*>(w)->image(reinterpret_cast<Fl_Image*>(img)); } +void fl_widget_set_deimage(WIDGET w, void * img) { + reinterpret_cast<Fl_Widget*>(w)->deimage(reinterpret_cast<Fl_Image*>(img)); +} + +int fl_widget_damage(WIDGET w) { + return reinterpret_cast<Fl_Widget*>(w)->damage(); +} + +void fl_widget_set_damage(WIDGET w, int t) { + if (t != 0) { + reinterpret_cast<Fl_Widget*>(w)->damage(0xff); + } else { + reinterpret_cast<Fl_Widget*>(w)->damage(0x00); + } +} + +void fl_widget_set_damage2(WIDGET w, int t, int x, int y, int d, int h) { + if (t != 0) { + reinterpret_cast<Fl_Widget*>(w)->damage(0xff,x,y,d,h); + } else { + reinterpret_cast<Fl_Widget*>(w)->damage(0x00,x,y,d,h); + } +} + +void fl_widget_draw_label(WIDGET w, int x, int y, int d, int h, unsigned int a) { + reinterpret_cast<Fl_Widget*>(w)->draw_label(x,y,d,h,a); +} + void fl_widget_redraw(WIDGET w) { reinterpret_cast<Fl_Widget*>(w)->redraw(); } diff --git a/src/c_fl_widget.h b/src/c_fl_widget.h index 7bf5d71..d4a3d24 100644 --- a/src/c_fl_widget.h +++ b/src/c_fl_widget.h @@ -11,65 +11,106 @@ typedef void* WIDGET; -extern "C" void widget_set_draw_hook(WIDGET w, void * d); -extern "C" void widget_set_handle_hook(WIDGET w, void * h); +extern "C" inline void widget_set_draw_hook(WIDGET w, void * d); +extern "C" inline void widget_set_handle_hook(WIDGET w, void * h); -extern "C" WIDGET new_fl_widget(int x, int y, int w, int h, char* label); -extern "C" void free_fl_widget(WIDGET w); +extern "C" inline WIDGET new_fl_widget(int x, int y, int w, int h, char* label); +extern "C" inline void free_fl_widget(WIDGET w); -extern "C" void * fl_widget_get_user_data(WIDGET w); -extern "C" void fl_widget_set_user_data(WIDGET w, void * d); +extern "C" inline void * fl_widget_get_user_data(WIDGET w); +extern "C" inline 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_clear_active(WIDGET w); +extern "C" inline void fl_widget_activate(WIDGET w); +extern "C" inline void fl_widget_deactivate(WIDGET w); +extern "C" inline int fl_widget_active(WIDGET w); +extern "C" inline int fl_widget_active_r(WIDGET w); +extern "C" inline void fl_widget_set_active(WIDGET w); +extern "C" inline void fl_widget_clear_active(WIDGET w); -extern "C" unsigned int fl_widget_changed(WIDGET w); -extern "C" void fl_widget_clear_changed(WIDGET w); +extern "C" inline unsigned int fl_widget_changed(WIDGET w); +extern "C" inline void fl_widget_set_changed(WIDGET w); +extern "C" inline void fl_widget_clear_changed(WIDGET w); +extern "C" inline int fl_widget_output(WIDGET w); +extern "C" inline void fl_widget_set_output(WIDGET w); +extern "C" inline void fl_widget_clear_output(WIDGET w); +extern "C" inline int fl_widget_visible(WIDGET w); +extern "C" inline int fl_widget_visible_r(WIDGET w); +extern "C" inline void fl_widget_set_visible(WIDGET w); +extern "C" inline void fl_widget_clear_visible(WIDGET w); -extern "C" void * fl_widget_get_parent(WIDGET w); -extern "C" int fl_widget_contains(WIDGET w, WIDGET i); +extern "C" inline int fl_widget_get_visible_focus(WIDGET w); +extern "C" inline void fl_widget_set_visible_focus(WIDGET w, int f); +extern "C" inline int fl_widget_take_focus(WIDGET w); +extern "C" inline int fl_widget_takesevents(WIDGET w); -extern "C" unsigned int fl_widget_get_align(WIDGET w); -extern "C" void fl_widget_set_align(WIDGET w, unsigned int a); -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); -extern "C" void fl_widget_set_label(WIDGET w, const char* t); -extern "C" int fl_widget_get_label_font(WIDGET w); -extern "C" void fl_widget_set_label_font(WIDGET w, int f); -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_set_callback(WIDGET w, void * cb); +extern "C" inline unsigned int fl_widget_get_color(WIDGET w); +extern "C" inline void fl_widget_set_color(WIDGET w, unsigned int b); +extern "C" inline unsigned int fl_widget_get_selection_color(WIDGET w); +extern "C" inline void fl_widget_set_selection_color(WIDGET w, unsigned int c); -extern "C" int fl_widget_get_x(WIDGET w); -extern "C" int fl_widget_get_y(WIDGET w); -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" inline void * fl_widget_get_parent(WIDGET w); +extern "C" inline int fl_widget_contains(WIDGET w, WIDGET i); +extern "C" inline int fl_widget_inside(WIDGET w, WIDGET p); +extern "C" inline void * fl_widget_window(WIDGET w); +extern "C" inline void * fl_widget_top_window(WIDGET w); +extern "C" inline void * fl_widget_top_window_offset(WIDGET w, int &x, int &y); -extern "C" void fl_widget_set_image(WIDGET w, void * img); +extern "C" inline unsigned int fl_widget_get_align(WIDGET w); +extern "C" inline void fl_widget_set_align(WIDGET w, unsigned int a); +extern "C" inline int fl_widget_get_box(WIDGET w); +extern "C" inline void fl_widget_set_box(WIDGET w, int b); +extern "C" inline const char * fl_widget_tooltip(WIDGET w); +extern "C" inline void fl_widget_copy_tooltip(WIDGET w, const char * t); -extern "C" void fl_widget_redraw(WIDGET w); -extern "C" void fl_widget_redraw_label(WIDGET w); +extern "C" inline const char* fl_widget_get_label(WIDGET w); +extern "C" inline void fl_widget_set_label(WIDGET w, const char* t); +extern "C" inline unsigned int fl_widget_get_labelcolor(WIDGET w); +extern "C" inline void fl_widget_set_labelcolor(WIDGET w, unsigned int v); +extern "C" inline int fl_widget_get_labelfont(WIDGET w); +extern "C" inline void fl_widget_set_labelfont(WIDGET w, int f); +extern "C" inline int fl_widget_get_labelsize(WIDGET w); +extern "C" inline void fl_widget_set_labelsize(WIDGET w, int s); +extern "C" inline int fl_widget_get_labeltype(WIDGET w); +extern "C" inline void fl_widget_set_labeltype(WIDGET w, int l); +extern "C" inline void fl_widget_measure_label(WIDGET w, int &d, int &h); + + +extern "C" inline void fl_widget_set_callback(WIDGET w, void * cb); +extern "C" inline unsigned int fl_widget_get_when(WIDGET w); +extern "C" inline void fl_widget_set_when(WIDGET w, unsigned int c); + + +extern "C" inline int fl_widget_get_x(WIDGET w); +extern "C" inline int fl_widget_get_y(WIDGET w); +extern "C" inline int fl_widget_get_w(WIDGET w); +extern "C" inline int fl_widget_get_h(WIDGET w); +extern "C" inline void fl_widget_size(WIDGET w, int d, int h); +extern "C" inline void fl_widget_position(WIDGET w, int x, int y); + + +extern "C" inline void fl_widget_set_image(WIDGET w, void * img); +extern "C" inline void fl_widget_set_deimage(WIDGET w, void * img); + + +extern "C" inline int fl_widget_damage(WIDGET w); +extern "C" inline void fl_widget_set_damage(WIDGET w, int t); +extern "C" inline void fl_widget_set_damage2(WIDGET w, int t, int x, int y, int d, int h); +extern "C" inline void fl_widget_draw_label(WIDGET w, int x, int y, int d, int h, unsigned int a); +extern "C" inline void fl_widget_redraw(WIDGET w); +extern "C" inline void fl_widget_redraw_label(WIDGET w); #endif diff --git a/src/fltk-widgets.adb b/src/fltk-widgets.adb index 28bbb24..40890c4 100644 --- a/src/fltk-widgets.adb +++ b/src/fltk-widgets.adb @@ -4,7 +4,7 @@ with Interfaces.C.Strings, System.Address_To_Access_Conversions, - FLTK.Widgets.Groups, + FLTK.Widgets.Groups.Windows, FLTK.Images; use type @@ -17,19 +17,34 @@ use type package body FLTK.Widgets is + function "+" + (Left, Right : in Callback_Flag) + return Callback_Flag is + begin + return Left or Right; + end "+"; + + + + package Group_Convert is new System.Address_To_Access_Conversions (FLTK.Widgets.Groups.Group'Class); + package Window_Convert is new + System.Address_To_Access_Conversions (FLTK.Widgets.Groups.Windows.Window'Class); + procedure widget_set_draw_hook (W, D : in System.Address); pragma Import (C, widget_set_draw_hook, "widget_set_draw_hook"); + pragma Inline (widget_set_draw_hook); procedure widget_set_handle_hook (W, H : in System.Address); pragma Import (C, widget_set_handle_hook, "widget_set_handle_hook"); + pragma Inline (widget_set_handle_hook); @@ -39,10 +54,12 @@ package body FLTK.Widgets is Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_widget, "new_fl_widget"); + pragma Inline (new_fl_widget); procedure free_fl_widget (F : in System.Address); pragma Import (C, free_fl_widget, "free_fl_widget"); + pragma Inline (free_fl_widget); @@ -50,24 +67,34 @@ package body FLTK.Widgets is procedure fl_widget_activate (W : in System.Address); pragma Import (C, fl_widget_activate, "fl_widget_activate"); + pragma Inline (fl_widget_activate); procedure fl_widget_deactivate (W : in System.Address); pragma Import (C, fl_widget_deactivate, "fl_widget_deactivate"); + pragma Inline (fl_widget_deactivate); function fl_widget_active (W : in System.Address) return Interfaces.C.int; pragma Import (C, fl_widget_active, "fl_widget_active"); + pragma Inline (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"); + pragma Inline (fl_widget_active_r); + + procedure fl_widget_set_active + (W : in System.Address); + pragma Import (C, fl_widget_set_active, "fl_widget_set_active"); + pragma Inline (fl_widget_set_active); procedure fl_widget_clear_active (W : in System.Address); pragma Import (C, fl_widget_clear_active, "fl_widget_clear_active"); + pragma Inline (fl_widget_clear_active); @@ -76,10 +103,109 @@ package body FLTK.Widgets is (W : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_widget_changed, "fl_widget_changed"); + pragma Inline (fl_widget_changed); + + procedure fl_widget_set_changed + (W : in System.Address); + pragma Import (C, fl_widget_set_changed, "fl_widget_set_changed"); + pragma Inline (fl_widget_set_changed); procedure fl_widget_clear_changed (W : in System.Address); pragma Import (C, fl_widget_clear_changed, "fl_widget_clear_changed"); + pragma Inline (fl_widget_clear_changed); + + function fl_widget_output + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_widget_output, "fl_widget_output"); + pragma Inline (fl_widget_output); + + procedure fl_widget_set_output + (W : in System.Address); + pragma Import (C, fl_widget_set_output, "fl_widget_set_output"); + pragma Inline (fl_widget_set_output); + + procedure fl_widget_clear_output + (W : in System.Address); + pragma Import (C, fl_widget_clear_output, "fl_widget_clear_output"); + pragma Inline (fl_widget_clear_output); + + function fl_widget_visible + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_widget_visible, "fl_widget_visible"); + pragma Inline (fl_widget_visible); + + function fl_widget_visible_r + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_widget_visible_r, "fl_widget_visible_r"); + pragma Inline (fl_widget_visible_r); + + procedure fl_widget_set_visible + (W : in System.Address); + pragma Import (C, fl_widget_set_visible, "fl_widget_set_visible"); + pragma Inline (fl_widget_set_visible); + + procedure fl_widget_clear_visible + (W : in System.Address); + pragma Import (C, fl_widget_clear_visible, "fl_widget_clear_visible"); + pragma Inline (fl_widget_clear_visible); + + + + + function fl_widget_get_visible_focus + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_widget_get_visible_focus, "fl_widget_get_visible_focus"); + pragma Inline (fl_widget_get_visible_focus); + + procedure fl_widget_set_visible_focus + (W : in System.Address; + T : in Interfaces.C.int); + pragma Import (C, fl_widget_set_visible_focus, "fl_widget_set_visible_focus"); + pragma Inline (fl_widget_set_visible_focus); + + function fl_widget_take_focus + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_widget_take_focus, "fl_widget_take_focus"); + pragma Inline (fl_widget_take_focus); + + function fl_widget_takesevents + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_widget_takesevents, "fl_widget_takesevents"); + pragma Inline (fl_widget_takesevents); + + + + + function fl_widget_get_color + (W : in System.Address) + return Interfaces.C.unsigned; + pragma Import (C, fl_widget_get_color, "fl_widget_get_color"); + pragma Inline (fl_widget_get_color); + + procedure fl_widget_set_color + (W : in System.Address; + T : in Interfaces.C.unsigned); + pragma Import (C, fl_widget_set_color, "fl_widget_set_color"); + pragma Inline (fl_widget_set_color); + + function fl_widget_get_selection_color + (W : in System.Address) + return Interfaces.C.unsigned; + pragma Import (C, fl_widget_get_selection_color, "fl_widget_get_selection_color"); + pragma Inline (fl_widget_get_selection_color); + + procedure fl_widget_set_selection_color + (W : in System.Address; + T : in Interfaces.C.unsigned); + pragma Import (C, fl_widget_set_selection_color, "fl_widget_set_selection_color"); + pragma Inline (fl_widget_set_selection_color); @@ -88,11 +214,38 @@ package body FLTK.Widgets is (W : in System.Address) return System.Address; pragma Import (C, fl_widget_get_parent, "fl_widget_get_parent"); + pragma Inline (fl_widget_get_parent); function fl_widget_contains (W, I : in System.Address) return Interfaces.C.int; pragma Import (C, fl_widget_contains, "fl_widget_contains"); + pragma Inline (fl_widget_contains); + + function fl_widget_inside + (W, P : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_widget_inside, "fl_widget_inside"); + pragma Inline (fl_widget_inside); + + function fl_widget_window + (W : in System.Address) + return System.Address; + pragma Import (C, fl_widget_window, "fl_widget_window"); + pragma Inline (fl_widget_window); + + function fl_widget_top_window + (W : in System.Address) + return System.Address; + pragma Import (C, fl_widget_top_window, "fl_widget_top_window"); + pragma Inline (fl_widget_top_window); + + function fl_widget_top_window_offset + (W : in System.Address; + X, Y : out Interfaces.C.int) + return System.Address; + pragma Import (C, fl_widget_top_window_offset, "fl_widget_top_window_offset"); + pragma Inline (fl_widget_top_window_offset); @@ -101,65 +254,126 @@ package body FLTK.Widgets is (W : in System.Address) return Interfaces.C.unsigned; pragma Import (C, fl_widget_get_align, "fl_widget_get_align"); + pragma Inline (fl_widget_get_align); procedure fl_widget_set_align (W : in System.Address; A : in Interfaces.C.unsigned); pragma Import (C, fl_widget_set_align, "fl_widget_set_align"); + pragma Inline (fl_widget_set_align); function fl_widget_get_box (W : in System.Address) return Interfaces.C.int; pragma Import (C, fl_widget_get_box, "fl_widget_get_box"); + pragma Inline (fl_widget_get_box); procedure fl_widget_set_box (W : in System.Address; B : in Interfaces.C.int); pragma Import (C, fl_widget_set_box, "fl_widget_set_box"); + pragma Inline (fl_widget_set_box); + + function fl_widget_tooltip + (W : in System.Address) + return Interfaces.C.Strings.chars_ptr; + pragma Import (C, fl_widget_tooltip, "fl_widget_tooltip"); + pragma Inline (fl_widget_tooltip); + + procedure fl_widget_copy_tooltip + (W : in System.Address; + T : in Interfaces.C.char_array); + pragma Import (C, fl_widget_copy_tooltip, "fl_widget_copy_tooltip"); + pragma Inline (fl_widget_copy_tooltip); + + + function fl_widget_get_label (W : in System.Address) return Interfaces.C.Strings.chars_ptr; pragma Import (C, fl_widget_get_label, "fl_widget_get_label"); + pragma Inline (fl_widget_get_label); procedure fl_widget_set_label (W : in System.Address; T : in Interfaces.C.char_array); pragma Import (C, fl_widget_set_label, "fl_widget_set_label"); + pragma Inline (fl_widget_set_label); + + function fl_widget_get_labelcolor + (W : in System.Address) + return Interfaces.C.unsigned; + pragma Import (C, fl_widget_get_labelcolor, "fl_widget_get_labelcolor"); + pragma Inline (fl_widget_get_labelcolor); + + procedure fl_widget_set_labelcolor + (W : in System.Address; + V : in Interfaces.C.unsigned); + pragma Import (C, fl_widget_set_labelcolor, "fl_widget_set_labelcolor"); + pragma Inline (fl_widget_set_labelcolor); - function fl_widget_get_label_font + function fl_widget_get_labelfont (W : in System.Address) return Interfaces.C.int; - pragma Import (C, fl_widget_get_label_font, "fl_widget_get_label_font"); + pragma Import (C, fl_widget_get_labelfont, "fl_widget_get_labelfont"); + pragma Inline (fl_widget_get_labelfont); - procedure fl_widget_set_label_font + procedure fl_widget_set_labelfont (W : in System.Address; F : in Interfaces.C.int); - pragma Import (C, fl_widget_set_label_font, "fl_widget_set_label_font"); + pragma Import (C, fl_widget_set_labelfont, "fl_widget_set_labelfont"); + pragma Inline (fl_widget_set_labelfont); - function fl_widget_get_label_size + function fl_widget_get_labelsize (W : in System.Address) return Interfaces.C.int; - pragma Import (C, fl_widget_get_label_size, "fl_widget_get_label_size"); + pragma Import (C, fl_widget_get_labelsize, "fl_widget_get_labelsize"); + pragma Inline (fl_widget_get_labelsize); - procedure fl_widget_set_label_size + procedure fl_widget_set_labelsize (W : in System.Address; S : in Interfaces.C.int); - pragma Import (C, fl_widget_set_label_size, "fl_widget_set_label_size"); + pragma Import (C, fl_widget_set_labelsize, "fl_widget_set_labelsize"); + pragma Inline (fl_widget_set_labelsize); - function fl_widget_get_label_type + function fl_widget_get_labeltype (W : in System.Address) return Interfaces.C.int; - pragma Import (C, fl_widget_get_label_type, "fl_widget_get_label_type"); + pragma Import (C, fl_widget_get_labeltype, "fl_widget_get_labeltype"); + pragma Inline (fl_widget_get_labeltype); - procedure fl_widget_set_label_type + procedure fl_widget_set_labeltype (W : in System.Address; L : in Interfaces.C.int); - pragma Import (C, fl_widget_set_label_type, "fl_widget_set_label_type"); + pragma Import (C, fl_widget_set_labeltype, "fl_widget_set_labeltype"); + pragma Inline (fl_widget_set_labeltype); + + procedure fl_widget_measure_label + (W : in System.Address; + D, H : out Interfaces.C.int); + pragma Import (C, fl_widget_measure_label, "fl_widget_measure_label"); + pragma Inline (fl_widget_measure_label); + + + procedure fl_widget_set_callback (W, C : in System.Address); pragma Import (C, fl_widget_set_callback, "fl_widget_set_callback"); + pragma Inline (fl_widget_set_callback); + + function fl_widget_get_when + (W : in System.Address) + return Interfaces.C.unsigned; + pragma Import (C, fl_widget_get_when, "fl_widget_get_when"); + pragma Inline (fl_widget_get_when); + + procedure fl_widget_set_when + (W : in System.Address; + T : in Interfaces.C.unsigned); + pragma Import (C, fl_widget_set_when, "fl_widget_set_when"); + pragma Inline (fl_widget_set_when); @@ -168,31 +382,37 @@ package body FLTK.Widgets is (W : in System.Address) return Interfaces.C.int; pragma Import (C, fl_widget_get_x, "fl_widget_get_x"); + pragma Inline (fl_widget_get_x); function fl_widget_get_y (W : in System.Address) return Interfaces.C.int; pragma Import (C, fl_widget_get_y, "fl_widget_get_y"); + pragma Inline (fl_widget_get_y); function fl_widget_get_w (W : in System.Address) return Interfaces.C.int; pragma Import (C, fl_widget_get_w, "fl_widget_get_w"); + pragma Inline (fl_widget_get_w); function fl_widget_get_h (W : in System.Address) return Interfaces.C.int; pragma Import (C, fl_widget_get_h, "fl_widget_get_h"); + pragma Inline (fl_widget_get_h); procedure fl_widget_size (W : in System.Address; D, H : in Interfaces.C.int); pragma Import (C, fl_widget_size, "fl_widget_size"); + pragma Inline (fl_widget_size); procedure fl_widget_position (W : in System.Address; X, Y : in Interfaces.C.int); pragma Import (C, fl_widget_position, "fl_widget_position"); + pragma Inline (fl_widget_position); @@ -200,17 +420,51 @@ package body FLTK.Widgets is procedure fl_widget_set_image (W, I : in System.Address); pragma Import (C, fl_widget_set_image, "fl_widget_set_image"); + pragma Inline (fl_widget_set_image); + + procedure fl_widget_set_deimage + (W, I : in System.Address); + pragma Import (C, fl_widget_set_deimage, "fl_widget_set_deimage"); + pragma Inline (fl_widget_set_deimage); + + function fl_widget_damage + (W : in System.Address) + return Interfaces.C.int; + pragma Import (C, fl_widget_damage, "fl_widget_damage"); + pragma Inline (fl_widget_damage); + + procedure fl_widget_set_damage + (W : in System.Address; + T : in Interfaces.C.int); + pragma Import (C, fl_widget_set_damage, "fl_widget_set_damage"); + pragma Inline (fl_widget_set_damage); + + procedure fl_widget_set_damage2 + (W : in System.Address; + T : in Interfaces.C.int; + X, Y, D, H : in Interfaces.C.int); + pragma Import (C, fl_widget_set_damage2, "fl_widget_set_damage2"); + pragma Inline (fl_widget_set_damage2); + + procedure fl_widget_draw_label + (W : in System.Address; + X, Y, D, H : in Interfaces.C.int; + A : in Interfaces.C.unsigned); + pragma Import (C, fl_widget_draw_label, "fl_widget_draw_label"); + pragma Inline (fl_widget_draw_label); procedure fl_widget_redraw (W : in System.Address); pragma Import (C, fl_widget_redraw, "fl_widget_redraw"); + pragma Inline (fl_widget_redraw); procedure fl_widget_redraw_label (W : in System.Address); pragma Import (C, fl_widget_redraw_label, "fl_widget_redraw_label"); + pragma Inline (fl_widget_redraw_label); @@ -320,11 +574,16 @@ package body FLTK.Widgets is end Is_Tree_Active; - procedure Clear_Active - (This : in out Widget) is + procedure Set_Active + (This : in out Widget; + To : in Boolean) is begin - fl_widget_clear_active (This.Void_Ptr); - end Clear_Active; + if To then + fl_widget_set_active (This.Void_Ptr); + else + fl_widget_clear_active (This.Void_Ptr); + end if; + end Set_Active; @@ -337,11 +596,132 @@ package body FLTK.Widgets is end Has_Changed; - procedure Clear_Changed - (This : in out Widget) is + procedure Set_Changed + (This : in out Widget; + To : in Boolean) is + begin + if To then + fl_widget_set_changed (This.Void_Ptr); + else + fl_widget_clear_changed (This.Void_Ptr); + end if; + end Set_Changed; + + + function Is_Output_Only + (This : in Widget) + return Boolean is + begin + return fl_widget_output (This.Void_Ptr) /= 0; + end Is_Output_Only; + + + procedure Set_Output_Only + (This : in out Widget; + To : in Boolean) is + begin + if To then + fl_widget_set_output (This.Void_Ptr); + else + fl_widget_clear_output (This.Void_Ptr); + end if; + end Set_Output_Only; + + + function Is_Visible + (This : in Widget) + return Boolean is + begin + return fl_widget_visible (This.Void_Ptr) /= 0; + end Is_Visible; + + + function Is_Tree_Visible + (This : in Widget) + return Boolean is + begin + return fl_widget_visible_r (This.Void_Ptr) /= 0; + end Is_Tree_Visible; + + + procedure Set_Visible + (This : in out Widget; + To : in Boolean) is + begin + if To then + fl_widget_set_visible (This.Void_Ptr); + else + fl_widget_clear_visible (This.Void_Ptr); + end if; + end Set_Visible; + + + + + function Has_Visible_Focus + (This : in Widget) + return Boolean is + begin + return fl_widget_get_visible_focus (This.Void_Ptr) /= 0; + end Has_Visible_Focus; + + + procedure Set_Visible_Focus + (This : in out Widget; + To : in Boolean) is + begin + fl_widget_set_visible_focus (This.Void_Ptr, Boolean'Pos (To)); + end Set_Visible_Focus; + + + function Take_Focus + (This : in out Widget) + return Boolean is + begin + return fl_widget_take_focus (This.Void_Ptr) /= 0; + end Take_Focus; + + + function Takes_Events + (This : in Widget) + return Boolean is + begin + return fl_widget_takesevents (This.Void_Ptr) /= 0; + end Takes_Events; + + + + + function Get_Background_Color + (This : in Widget) + return Color is + begin + return Color (fl_widget_get_color (This.Void_Ptr)); + end Get_Background_Color; + + + procedure Set_Background_Color + (This : in out Widget; + To : in Color) is + begin + fl_widget_set_color (This.Void_Ptr, Interfaces.C.unsigned (To)); + end Set_Background_Color; + + + function Get_Selection_Color + (This : in Widget) + return Color is + begin + return Color (fl_widget_get_selection_color (This.Void_Ptr)); + end Get_Selection_Color; + + + procedure Set_Selection_Color + (This : in out Widget; + To : in Color) is begin - fl_widget_clear_changed (This.Void_Ptr); - end Clear_Changed; + fl_widget_set_selection_color (This.Void_Ptr, Interfaces.C.unsigned (To)); + end Set_Selection_Color; @@ -370,6 +750,64 @@ package body FLTK.Widgets is end Contains; + function Inside + (This : in Widget; + Parent : in Widget'Class) + return Boolean is + begin + return fl_widget_inside (This.Void_Ptr, Parent.Void_Ptr) /= 0; + end Inside; + + + function Nearest_Window + (This : in Widget) + return access FLTK.Widgets.Groups.Windows.Window'Class + is + Window_Ptr : System.Address; + Actual_Window : access FLTK.Widgets.Groups.Windows.Window'Class; + begin + Window_Ptr := fl_widget_window (This.Void_Ptr); + if Window_Ptr /= System.Null_Address then + Actual_Window := Window_Convert.To_Pointer (fl_widget_get_user_data (Window_Ptr)); + end if; + return Actual_Window; + end Nearest_Window; + + + function Top_Window + (This : in Widget) + return access FLTK.Widgets.Groups.Windows.Window'Class + is + Window_Ptr : System.Address; + Actual_Window : access FLTK.Widgets.Groups.Windows.Window'Class; + begin + Window_Ptr := fl_widget_top_window (This.Void_Ptr); + if Window_Ptr /= System.Null_Address then + Actual_Window := Window_Convert.To_Pointer (fl_widget_get_user_data (Window_Ptr)); + end if; + return Actual_Window; + end Top_Window; + + + function Top_Window_Offset + (This : in Widget; + Offset_X, Offset_Y : out Integer) + return access FLTK.Widgets.Groups.Windows.Window'Class + is + Window_Ptr : System.Address; + Actual_Window : access FLTK.Widgets.Groups.Windows.Window'Class; + begin + Window_Ptr := fl_widget_top_window_offset + (This.Void_Ptr, + Interfaces.C.int (Offset_X), + Interfaces.C.int (Offset_Y)); + if Window_Ptr /= System.Null_Address then + Actual_Window := Window_Convert.To_Pointer (fl_widget_get_user_data (Window_Ptr)); + end if; + return Actual_Window; + end Top_Window_Offset; + + function Get_Alignment @@ -404,6 +842,25 @@ package body FLTK.Widgets is end Set_Box; + function Get_Tooltip + (This : in Widget) + return String is + begin + -- no need for dealloc + return Interfaces.C.Strings.Value (fl_widget_tooltip (This.Void_Ptr)); + end Get_Tooltip; + + + procedure Set_Tooltip + (This : in out Widget; + Text : in String) is + begin + fl_widget_copy_tooltip (This.Void_Ptr, Interfaces.C.To_C (Text)); + end Set_Tooltip; + + + + function Get_Label (This : in Widget) return String is @@ -420,11 +877,27 @@ package body FLTK.Widgets is end Set_Label; + function Get_Label_Color + (This : in Widget) + return Color is + begin + return Color (fl_widget_get_labelcolor (This.Void_Ptr)); + end Get_Label_Color; + + + procedure Set_Label_Color + (This : in out Widget; + Value : in Color) is + begin + fl_widget_set_labelcolor (This.Void_Ptr, Interfaces.C.unsigned (Value)); + end Set_Label_Color; + + function Get_Label_Font (This : in Widget) return Font_Kind is begin - return Font_Kind'Val (fl_widget_get_label_font (This.Void_Ptr)); + return Font_Kind'Val (fl_widget_get_labelfont (This.Void_Ptr)); end Get_Label_Font; @@ -432,7 +905,7 @@ package body FLTK.Widgets is (This : in out Widget; Font : in Font_Kind) is begin - fl_widget_set_label_font (This.Void_Ptr, Font_Kind'Pos (Font)); + fl_widget_set_labelfont (This.Void_Ptr, Font_Kind'Pos (Font)); end Set_Label_Font; @@ -440,7 +913,7 @@ package body FLTK.Widgets is (This : in Widget) return Font_Size is begin - return Font_Size (fl_widget_get_label_size (This.Void_Ptr)); + return Font_Size (fl_widget_get_labelsize (This.Void_Ptr)); end Get_Label_Size; @@ -448,7 +921,7 @@ package body FLTK.Widgets is (This : in out Widget; Size : in Font_Size) is begin - fl_widget_set_label_size (This.Void_Ptr, Interfaces.C.int (Size)); + fl_widget_set_labelsize (This.Void_Ptr, Interfaces.C.int (Size)); end Set_Label_Size; @@ -456,7 +929,7 @@ package body FLTK.Widgets is (This : in Widget) return Label_Kind is begin - return Label_Kind'Val (fl_widget_get_label_type (This.Void_Ptr)); + return Label_Kind'Val (fl_widget_get_labeltype (This.Void_Ptr)); end Get_Label_Type; @@ -464,10 +937,23 @@ package body FLTK.Widgets is (This : in out Widget; Label : in Label_Kind) is begin - fl_widget_set_label_type (This.Void_Ptr, Label_Kind'Pos (Label)); + fl_widget_set_labeltype (This.Void_Ptr, Label_Kind'Pos (Label)); end Set_Label_Type; + procedure Measure_Label + (This : in Widget; + W, H : out Integer) is + begin + fl_widget_measure_label + (This.Void_Ptr, + Interfaces.C.int (W), + Interfaces.C.int (H)); + end Measure_Label; + + + + function Get_Callback (This : in Widget) return Widget_Callback is @@ -487,6 +973,31 @@ package body FLTK.Widgets is end Set_Callback; + procedure Do_Callback + (This : in out Widget) is + begin + if This.Callback /= null then + This.Callback.all (This); + end if; + end Do_Callback; + + + function Get_When + (This : in Widget) + return Callback_Flag is + begin + return Callback_Flag (fl_widget_get_when (This.Void_Ptr)); + end Get_When; + + + procedure Set_When + (This : in out Widget; + To : in Callback_Flag) is + begin + fl_widget_set_when (This.Void_Ptr, Interfaces.C.unsigned (To)); + end Set_When; + + function Get_X @@ -564,6 +1075,71 @@ package body FLTK.Widgets is end Set_Image; + function Get_Inactive_Image + (This : in Widget) + return access FLTK.Images.Image'Class is + begin + return This.Inactive_Image; + end Get_Inactive_Image; + + + procedure Set_Inactive_Image + (This : in out Widget; + Pic : in out FLTK.Images.Image'Class) is + begin + This.Inactive_Image := Pic'Unchecked_Access; + fl_widget_set_deimage + (This.Void_Ptr, + Wrapper (Pic).Void_Ptr); + end Set_Inactive_Image; + + + + + function Is_Damaged + (This : in Widget) + return Boolean is + begin + return fl_widget_damage (This.Void_Ptr) /= 0; + end Is_Damaged; + + + procedure Set_Damaged + (This : in out Widget; + To : in Boolean) is + begin + fl_widget_set_damage (This.Void_Ptr, Boolean'Pos (To)); + end Set_Damaged; + + + procedure Set_Damaged + (This : in out Widget; + To : in Boolean; + X, Y, W, H : in Integer) is + begin + fl_widget_set_damage2 + (This.Void_Ptr, + Boolean'Pos (To), + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H)); + end Set_Damaged; + + + procedure Draw_Label + (This : in Widget; + X, Y, W, H : in Integer; + Align : in Alignment) is + begin + fl_widget_draw_label + (This.Void_Ptr, + Interfaces.C.int (X), + Interfaces.C.int (Y), + Interfaces.C.int (W), + Interfaces.C.int (H), + Interfaces.C.unsigned (Align)); + end Draw_Label; procedure Redraw diff --git a/src/fltk-widgets.ads b/src/fltk-widgets.ads index 671cfa0..4c649c0 100644 --- a/src/fltk-widgets.ads +++ b/src/fltk-widgets.ads @@ -6,7 +6,7 @@ with limited with - FLTK.Widgets.Groups; + FLTK.Widgets.Groups.Windows; private with @@ -20,9 +20,20 @@ package FLTK.Widgets is type Widget is new Wrapper with private; + type Widget_Reference (Data : not null access Widget'Class) is limited null record + with Implicit_Dereference => Data; + type Widget_Callback is access procedure (Item : in out Widget'Class); + type Callback_Flag is private; + function "+" (Left, Right : in Callback_Flag) return Callback_Flag; + Call_Never : constant Callback_Flag; + When_Changed : constant Callback_Flag; + When_Interact : constant Callback_Flag; + When_Release : constant Callback_Flag; + When_Enter_Key : constant Callback_Flag; + @@ -52,8 +63,9 @@ package FLTK.Widgets is (This : in Widget) return Boolean; - procedure Clear_Active - (This : in out Widget); + procedure Set_Active + (This : in out Widget; + To : in Boolean); @@ -62,8 +74,67 @@ package FLTK.Widgets is (This : in Widget) return Boolean; - procedure Clear_Changed - (This : in out Widget); + procedure Set_Changed + (This : in out Widget; + To : in Boolean); + + function Is_Output_Only + (This : in Widget) + return Boolean; + + procedure Set_Output_Only + (This : in out Widget; + To : in Boolean); + + function Is_Visible + (This : in Widget) + return Boolean; + + function Is_Tree_Visible + (This : in Widget) + return Boolean; + + procedure Set_Visible + (This : in out Widget; + To : in Boolean); + + + + + function Has_Visible_Focus + (This : in Widget) + return Boolean; + + procedure Set_Visible_Focus + (This : in out Widget; + To : in Boolean); + + function Take_Focus + (This : in out Widget) + return Boolean; + + function Takes_Events + (This : in Widget) + return Boolean; + + + + + function Get_Background_Color + (This : in Widget) + return Color; + + procedure Set_Background_Color + (This : in out Widget; + To : in Color); + + function Get_Selection_Color + (This : in Widget) + return Color; + + procedure Set_Selection_Color + (This : in out Widget; + To : in Color); @@ -77,6 +148,24 @@ package FLTK.Widgets is Item : in Widget'Class) return Boolean; + function Inside + (This : in Widget; + Parent : in Widget'Class) + return Boolean; + + function Nearest_Window + (This : in Widget) + return access FLTK.Widgets.Groups.Windows.Window'Class; + + function Top_Window + (This : in Widget) + return access FLTK.Widgets.Groups.Windows.Window'Class; + + function Top_Window_Offset + (This : in Widget; + Offset_X, Offset_Y : out Integer) + return access FLTK.Widgets.Groups.Windows.Window'Class; + @@ -96,6 +185,17 @@ package FLTK.Widgets is (This : in out Widget; Box : in Box_Kind); + function Get_Tooltip + (This : in Widget) + return String; + + procedure Set_Tooltip + (This : in out Widget; + Text : in String); + + + + function Get_Label (This : in Widget) return String; @@ -104,6 +204,14 @@ package FLTK.Widgets is (This : in out Widget; Text : in String); + function Get_Label_Color + (This : in Widget) + return Color; + + procedure Set_Label_Color + (This : in out Widget; + Value : in Color); + function Get_Label_Font (This : in Widget) return Font_Kind; @@ -128,6 +236,13 @@ package FLTK.Widgets is (This : in out Widget; Label : in Label_Kind); + procedure Measure_Label + (This : in Widget; + W, H : out Integer); + + + + function Get_Callback (This : in Widget) return Widget_Callback; @@ -136,6 +251,17 @@ package FLTK.Widgets is (This : in out Widget; Func : in Widget_Callback); + procedure Do_Callback + (This : in out Widget); + + function Get_When + (This : in Widget) + return Callback_Flag; + + procedure Set_When + (This : in out Widget; + To : in Callback_Flag); + @@ -174,12 +300,38 @@ package FLTK.Widgets is (This : in out Widget; Pic : in out FLTK.Images.Image'Class); + function Get_Inactive_Image + (This : in Widget) + return access FLTK.Images.Image'Class; + + procedure Set_Inactive_Image + (This : in out Widget; + Pic : in out FLTK.Images.Image'Class); + + function Is_Damaged + (This : in Widget) + return Boolean; + + procedure Set_Damaged + (This : in out Widget; + To : in Boolean); + + procedure Set_Damaged + (This : in out Widget; + To : in Boolean; + X, Y, W, H : in Integer); + procedure Draw (This : in out Widget) is null; + procedure Draw_Label + (This : in Widget; + X, Y, W, H : in Integer; + Align : in Alignment); + procedure Redraw (This : in out Widget); @@ -197,8 +349,9 @@ private type Widget is new Wrapper with record - Callback : Widget_Callback; - Current_Image : access FLTK.Images.Image'Class; + Callback : Widget_Callback; + Current_Image : access FLTK.Images.Image'Class; + Inactive_Image : access FLTK.Images.Image'Class; end record; overriding procedure Finalize @@ -207,6 +360,17 @@ private + type Callback_Flag is new Interfaces.C.unsigned; + + Call_Never : constant Callback_Flag := 0; + When_Changed : constant Callback_Flag := 1; + When_Interact : constant Callback_Flag := 2; + When_Release : constant Callback_Flag := 4; + When_Enter_Key : constant Callback_Flag := 8; + + + + -- the user data portion should always be a reference back to the Ada binding procedure Callback_Hook (W, U : in System.Address); @@ -244,5 +408,93 @@ private pragma Import (C, fl_widget_set_user_data, "fl_widget_set_user_data"); + + + pragma Inline (Activate); + pragma Inline (Deactivate); + pragma Inline (Is_Active); + pragma Inline (Is_Tree_Active); + pragma Inline (Set_Active); + + + pragma Inline (Has_Changed); + pragma Inline (Set_Changed); + pragma Inline (Is_Output_Only); + pragma Inline (Set_Output_Only); + pragma Inline (Is_Visible); + pragma Inline (Set_Visible); + + + pragma Inline (Has_Visible_Focus); + pragma Inline (Set_Visible_Focus); + pragma Inline (Take_Focus); + pragma Inline (Takes_Events); + + + pragma Inline (Get_Background_Color); + pragma Inline (Set_Background_Color); + pragma Inline (Get_Selection_Color); + pragma Inline (Set_Selection_Color); + + + pragma Inline (Parent); + pragma Inline (Contains); + pragma Inline (Inside); + pragma Inline (Nearest_Window); + pragma Inline (Top_Window); + pragma Inline (Top_Window_Offset); + + + pragma Inline (Get_Alignment); + pragma Inline (Set_Alignment); + pragma Inline (Get_Box); + pragma Inline (Set_Box); + pragma Inline (Get_Tooltip); + pragma Inline (Set_Tooltip); + + + pragma Inline (Get_Label); + pragma Inline (Set_Label); + pragma Inline (Get_Label_Color); + pragma Inline (Set_Label_Color); + pragma Inline (Get_Label_Font); + pragma Inline (Set_Label_Font); + pragma Inline (Get_Label_Size); + pragma Inline (Set_Label_Size); + pragma Inline (Get_Label_Type); + pragma Inline (Set_Label_Type); + pragma Inline (Measure_Label); + + + pragma Inline (Get_Callback); + pragma Inline (Set_Callback); + pragma Inline (Do_Callback); + pragma Inline (Get_When); + pragma Inline (Set_When); + + + pragma Inline (Get_X); + pragma Inline (Get_Y); + pragma Inline (Get_W); + pragma Inline (Get_H); + pragma Inline (Resize); + pragma Inline (Reposition); + + + pragma Inline (Get_Image); + pragma Inline (Set_Image); + pragma Inline (Get_Inactive_Image); + pragma Inline (Set_Inactive_Image); + + + pragma Inline (Is_Damaged); + pragma Inline (Set_Damaged); + pragma Inline (Draw); + pragma Inline (Draw_Label); + pragma Inline (Redraw); + pragma Inline (Redraw_Label); + pragma Inline (Handle); + + end FLTK.Widgets; |