summaryrefslogtreecommitdiff
path: root/src/fltk_binding
diff options
context:
space:
mode:
Diffstat (limited to 'src/fltk_binding')
-rw-r--r--src/fltk_binding/c_fl_menu.cpp15
-rw-r--r--src/fltk_binding/c_fl_menu.h3
-rw-r--r--src/fltk_binding/c_fl_text_buffer.cpp5
-rw-r--r--src/fltk_binding/c_fl_text_buffer.h1
-rw-r--r--src/fltk_binding/fltk-text_buffers.adb15
-rw-r--r--src/fltk_binding/fltk-text_buffers.ads5
-rw-r--r--src/fltk_binding/fltk-widgets-menus.adb47
-rw-r--r--src/fltk_binding/fltk-widgets-menus.ads14
8 files changed, 105 insertions, 0 deletions
diff --git a/src/fltk_binding/c_fl_menu.cpp b/src/fltk_binding/c_fl_menu.cpp
index 0455e51..f8c7b9e 100644
--- a/src/fltk_binding/c_fl_menu.cpp
+++ b/src/fltk_binding/c_fl_menu.cpp
@@ -10,6 +10,11 @@ int fl_menu_add(MENU m, const char * t, unsigned long s, void * c, void * u, uns
}
+const void * fl_menu_find_item(MENU m, const char * t) {
+ return reinterpret_cast<Fl_Menu_*>(m)->find_item(t);
+}
+
+
const void * fl_menu_mvalue(MENU m) {
return reinterpret_cast<Fl_Menu_*>(m)->mvalue();
}
@@ -21,3 +26,13 @@ int fl_menuitem_value(void * mi) {
return reinterpret_cast<Fl_Menu_Item*>(mi)->value();
}
+
+void fl_menuitem_activate(void * mi) {
+ reinterpret_cast<Fl_Menu_Item*>(mi)->activate();
+}
+
+
+void fl_menuitem_deactivate(void * mi) {
+ reinterpret_cast<Fl_Menu_Item*>(mi)->deactivate();
+}
+
diff --git a/src/fltk_binding/c_fl_menu.h b/src/fltk_binding/c_fl_menu.h
index 1599334..2b9aa68 100644
--- a/src/fltk_binding/c_fl_menu.h
+++ b/src/fltk_binding/c_fl_menu.h
@@ -9,10 +9,13 @@ typedef void* MENU;
extern "C" int fl_menu_add(MENU m, const char * t, unsigned long s, void * c, void * u, unsigned long f);
+extern "C" const void * fl_menu_find_item(MENU m, const char * t);
extern "C" const void * fl_menu_mvalue(MENU m);
extern "C" int fl_menuitem_value(void * mi);
+extern "C" void fl_menuitem_activate(void * mi);
+extern "C" void fl_menuitem_deactivate(void * mi);
#endif
diff --git a/src/fltk_binding/c_fl_text_buffer.cpp b/src/fltk_binding/c_fl_text_buffer.cpp
index 623aea7..966f142 100644
--- a/src/fltk_binding/c_fl_text_buffer.cpp
+++ b/src/fltk_binding/c_fl_text_buffer.cpp
@@ -80,6 +80,11 @@ int fl_text_buffer_selection_position(TEXTBUFFER tb, int * s, int * e) {
}
+int fl_text_buffer_selected(TEXTBUFFER tb) {
+ return reinterpret_cast<Fl_Text_Buffer*>(tb)->selected();
+}
+
+
int fl_text_buffer_skip_lines(TEXTBUFFER tb, int s, int l) {
return reinterpret_cast<Fl_Text_Buffer*>(tb)->skip_lines(s, l);
}
diff --git a/src/fltk_binding/c_fl_text_buffer.h b/src/fltk_binding/c_fl_text_buffer.h
index 4c5edb3..a7b954b 100644
--- a/src/fltk_binding/c_fl_text_buffer.h
+++ b/src/fltk_binding/c_fl_text_buffer.h
@@ -24,6 +24,7 @@ extern "C" int fl_text_buffer_search_forward(TEXTBUFFER tb, int start, const cha
extern "C" int fl_text_buffer_search_backward(TEXTBUFFER tb, int start, const char * item, int * found, int mcase);
extern "C" void fl_text_buffer_select(TEXTBUFFER tb, int s, int e);
extern "C" int fl_text_buffer_selection_position(TEXTBUFFER tb, int * s, int * e);
+extern "C" int fl_text_buffer_selected(TEXTBUFFER tb);
extern "C" int fl_text_buffer_skip_lines(TEXTBUFFER tb, int s, int l);
extern "C" int fl_text_buffer_rewind_lines(TEXTBUFFER tb, int s, int l);
extern "C" unsigned int fl_text_buffer_char_at(TEXTBUFFER tb, int p);
diff --git a/src/fltk_binding/fltk-text_buffers.adb b/src/fltk_binding/fltk-text_buffers.adb
index 6ff5b55..38e6632 100644
--- a/src/fltk_binding/fltk-text_buffers.adb
+++ b/src/fltk_binding/fltk-text_buffers.adb
@@ -99,6 +99,11 @@ package body FLTK.Text_Buffers is
return Interfaces.C.int;
pragma Import (C, fl_text_buffer_selection_position, "fl_text_buffer_selection_position");
+ function fl_text_buffer_selected
+ (TB : in System.Address)
+ return Interfaces.C.int;
+ pragma Import (C, fl_text_buffer_selected, "fl_text_buffer_selected");
+
function fl_text_buffer_skip_lines
(TB : in System.Address;
S, L : in Interfaces.C.int)
@@ -418,6 +423,16 @@ package body FLTK.Text_Buffers is
+ function Has_Selection
+ (This : in Text_Buffer)
+ return Boolean is
+ begin
+ return fl_text_buffer_selected (This.Void_Ptr) /= 0;
+ end Has_Selection;
+
+
+
+
function Skip_Lines
(This : in out Text_Buffer;
Start, Lines : in Natural)
diff --git a/src/fltk_binding/fltk-text_buffers.ads b/src/fltk_binding/fltk-text_buffers.ads
index 582de1d..c17b020 100644
--- a/src/fltk_binding/fltk-text_buffers.ads
+++ b/src/fltk_binding/fltk-text_buffers.ads
@@ -106,6 +106,11 @@ package FLTK.Text_Buffers is
return Boolean;
+ function Has_Selection
+ (This : in Text_Buffer)
+ return Boolean;
+
+
-- only takes into account newline characters, not word wrap
function Skip_Lines
(This : in out Text_Buffer;
diff --git a/src/fltk_binding/fltk-widgets-menus.adb b/src/fltk_binding/fltk-widgets-menus.adb
index 169e71d..b1ffd9a 100644
--- a/src/fltk_binding/fltk-widgets-menus.adb
+++ b/src/fltk_binding/fltk-widgets-menus.adb
@@ -91,6 +91,12 @@ package body FLTK.Widgets.Menus is
return Interfaces.C.int;
pragma Import (C, fl_menu_add, "fl_menu_add");
+ function fl_menu_find_item
+ (M : in System.Address;
+ T : in Interfaces.C.char_array)
+ return System.Address;
+ pragma Import (C, fl_menu_find_item, "fl_menu_find_item");
+
function fl_menu_mvalue
(M : in System.Address)
return System.Address;
@@ -101,6 +107,14 @@ package body FLTK.Widgets.Menus is
return Interfaces.C.int;
pragma Import (C, fl_menuitem_value, "fl_menuitem_value");
+ procedure fl_menuitem_activate
+ (MI : in System.Address);
+ pragma Import (C, fl_menuitem_activate, "fl_menuitem_activate");
+
+ procedure fl_menuitem_deactivate
+ (MI : in System.Address);
+ pragma Import (C, fl_menuitem_deactivate, "fl_menuitem_deactivate");
+
@@ -150,6 +164,21 @@ package body FLTK.Widgets.Menus is
+ function Find_Item
+ (This : in Menu'Class;
+ Name : in String)
+ return Menu_Item is
+ begin
+ return Item : Menu_Item do
+ Item.Void_Ptr := fl_menu_find_item
+ (This.Void_Ptr,
+ Interfaces.C.To_C (Name));
+ end return;
+ end Find_Item;
+
+
+
+
function Chosen
(This : in Menu'Class)
return Menu_Item is
@@ -170,5 +199,23 @@ package body FLTK.Widgets.Menus is
end Value;
+
+
+ procedure Activate
+ (Item : in Menu_Item) is
+ begin
+ fl_menuitem_activate (Item.Void_Ptr);
+ end Activate;
+
+
+
+
+ procedure Deactivate
+ (Item : in Menu_Item) is
+ begin
+ fl_menuitem_deactivate (Item.Void_Ptr);
+ end Deactivate;
+
+
end FLTK.Widgets.Menus;
diff --git a/src/fltk_binding/fltk-widgets-menus.ads b/src/fltk_binding/fltk-widgets-menus.ads
index cf6fcf7..0346d2d 100644
--- a/src/fltk_binding/fltk-widgets-menus.ads
+++ b/src/fltk_binding/fltk-widgets-menus.ads
@@ -60,6 +60,12 @@ package FLTK.Widgets.Menus is
Flags : in Menu_Flag := Flag_Normal);
+ function Find_Item
+ (This : in Menu'Class;
+ Name : in String)
+ return Menu_Item;
+
+
function Chosen
(This : in Menu'Class)
return Menu_Item;
@@ -70,6 +76,14 @@ package FLTK.Widgets.Menus is
return Boolean;
+ procedure Activate
+ (Item : in Menu_Item);
+
+
+ procedure Deactivate
+ (Item : in Menu_Item);
+
+
private