From 566f1e1c5dd41b380817251a3d2c086a53d38a28 Mon Sep 17 00:00:00 2001 From: Mohammed Alyousef Date: Fri, 16 Feb 2024 22:29:26 +0300 Subject: [PATCH] add contrast and menu funcs --- fltk | 2 +- include/cfl.h | 10 ++++++++++ include/cfl_menu.h | 16 +++++++++++++++- src/cfl.cpp | 20 ++++++++++++++++++++ src/cfl_menu.cpp | 22 ++++++++++++++++++++++ 5 files changed, 68 insertions(+), 2 deletions(-) diff --git a/fltk b/fltk index cc56276..1069ebc 160000 --- a/fltk +++ b/fltk @@ -1 +1 @@ -Subproject commit cc562761c2d3a589766a20cfbaefc30310bfc423 +Subproject commit 1069ebc1b65bdd2b69dddab300414f47002d3e4b diff --git a/include/cfl.h b/include/cfl.h index c5562ae..11662f4 100644 --- a/include/cfl.h +++ b/include/cfl.h @@ -388,6 +388,16 @@ void Fl_set_option(int opt, int val); void Fl_load_system_icons(void); +void Fl_set_contrast_level(int level); + +int Fl_contrast_level(); + +void Fl_set_contrast_mode(int mode); + +int Fl_contrast_mode(); + +void Fl_set_contrast_function(unsigned int (*f)(unsigned int, unsigned int, int, int)); + #ifdef __cplusplus } #endif diff --git a/include/cfl_menu.h b/include/cfl_menu.h index 4e3106e..d3fe0cc 100644 --- a/include/cfl_menu.h +++ b/include/cfl_menu.h @@ -51,7 +51,9 @@ extern "C" { char *pathname, \ int pathnamelen, \ const Fl_Menu_Item *item \ - ); + ); \ + void widget##_set_menu_box(widget *self, int b); \ + int widget##_menu_box(const widget *self); typedef struct Fl_Menu_Item Fl_Menu_Item; @@ -95,6 +97,18 @@ void Fl_Menu_Item_delete(Fl_Menu_Item *self); const Fl_Menu_Item *Fl_Menu_Item_popup(Fl_Menu_Item *self, int x, int y); +const Fl_Menu_Item *Fl_Menu_Item_pulldown( + Fl_Menu_Item *self, + int X, + int Y, + int W, + int H, + const Fl_Menu_Item *picked, + const void *, + const Fl_Menu_Item *title, + int menubar +); + const char *Fl_Menu_Item_label(Fl_Menu_Item *); void Fl_Menu_Item_set_label(Fl_Menu_Item *, const char *a); diff --git a/src/cfl.cpp b/src/cfl.cpp index 0d3a7b7..d5f503d 100644 --- a/src/cfl.cpp +++ b/src/cfl.cpp @@ -851,4 +851,24 @@ void Fl_set_option(int opt, int val) { void Fl_load_system_icons(void) { Fl_File_Icon::load_system_icons(); +} + +void Fl_set_contrast_level(int level) { + fl_contrast_level(level); +} + +int Fl_contrast_level() { + return fl_contrast_level(); +} + +void Fl_set_contrast_mode(int mode) { + fl_contrast_mode(mode); +} + +int Fl_contrast_mode() { + return fl_contrast_mode(); +} + +void Fl_set_contrast_function(unsigned int (*f)(unsigned int, unsigned int, int, int)) { + fl_contrast_function(f); } \ No newline at end of file diff --git a/src/cfl_menu.cpp b/src/cfl_menu.cpp index 0a4d622..c0db7c4 100644 --- a/src/cfl_menu.cpp +++ b/src/cfl_menu.cpp @@ -142,6 +142,13 @@ LOCK(auto ret = self->item_pathname(temp, 256, item); \ if (ret == 0) strncpy(pathname, temp, strlen(temp) + 1);); \ return ret; \ + } \ + void widget##_set_menu_box(widget *self, int b) { \ + LOCK(self->menu_box((Fl_Boxtype)b)); \ + } \ + int widget##_menu_box(const widget *self) { \ + LOCK(auto ret = self->menu_box()); \ + return ret; \ } WIDGET_CLASS(Fl_Menu_Bar) @@ -234,6 +241,21 @@ const Fl_Menu_Item *Fl_Menu_Item_popup(Fl_Menu_Item *self, int x, int y) { return ret; } +const Fl_Menu_Item *Fl_Menu_Item_pulldown( + Fl_Menu_Item *self, + int X, + int Y, + int W, + int H, + const Fl_Menu_Item *picked, + const void *menu, + const Fl_Menu_Item *title, + int menubar +) { + LOCK(auto ret = self->pulldown(X, Y, W, H, picked, (const Fl_Menu_ *)menu, title, menubar)); + return ret; +} + const char *Fl_Menu_Item_label(Fl_Menu_Item *self) { LOCK(auto ret = self->label()); return ret;