Skip to content

Commit

Permalink
add contrast and menu funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
MoAlyousef committed Feb 16, 2024
1 parent af453ac commit 566f1e1
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fltk
10 changes: 10 additions & 0 deletions include/cfl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 15 additions & 1 deletion include/cfl_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down
20 changes: 20 additions & 0 deletions src/cfl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
22 changes: 22 additions & 0 deletions src/cfl_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 566f1e1

Please sign in to comment.