// Programmed by Jedidiah Barber // Released into the public domain #include #include "c_fl_color_chooser.h" // Exports from Ada extern "C" void widget_draw_hook(void * ud); extern "C" int widget_handle_hook(void * ud, int e); // Attaching all relevant hooks and friends class My_Color_Chooser : public Fl_Color_Chooser { public: using Fl_Color_Chooser::Fl_Color_Chooser; friend void fl_color_chooser_draw(COLORCHOOSER n); friend int fl_color_chooser_handle(COLORCHOOSER n, int e); void draw(); int handle(int e); }; void My_Color_Chooser::draw() { widget_draw_hook(this->user_data()); } int My_Color_Chooser::handle(int e) { return widget_handle_hook(this->user_data(), e); } // Flattened C API COLORCHOOSER new_fl_color_chooser(int x, int y, int w, int h, char* label) { My_Color_Chooser *n = new My_Color_Chooser(x, y, w, h, label); return n; } void free_fl_color_chooser(COLORCHOOSER n) { delete static_cast(n); } double fl_color_chooser_r(COLORCHOOSER n) { return static_cast(n)->r(); } double fl_color_chooser_g(COLORCHOOSER n) { return static_cast(n)->g(); } double fl_color_chooser_b(COLORCHOOSER n) { return static_cast(n)->b(); } int fl_color_chooser_rgb(COLORCHOOSER n, int r, int g, int b) { return static_cast(n)->rgb(r,g,b); } double fl_color_chooser_hue(COLORCHOOSER n) { return static_cast(n)->hue(); } double fl_color_chooser_saturation(COLORCHOOSER n) { return static_cast(n)->saturation(); } double fl_color_chooser_value(COLORCHOOSER n) { return static_cast(n)->value(); } int fl_color_chooser_hsv(COLORCHOOSER n, int h, int s, int v) { return static_cast(n)->hsv(h,s,v); } void fl_color_chooser_hsv2rgb(double h, double s, double v, double &r, double &g, double &b) { Fl_Color_Chooser::hsv2rgb(h,s,v,r,g,b); } void fl_color_chooser_rgb2hsv(double r, double g, double b, double &h, double &s, double &v) { Fl_Color_Chooser::rgb2hsv(r,g,b,h,s,v); } int fl_color_chooser_get_mode(COLORCHOOSER n) { return static_cast(n)->mode(); } void fl_color_chooser_set_mode(COLORCHOOSER n, int m) { static_cast(n)->mode(m); } void fl_color_chooser_draw(COLORCHOOSER n) { static_cast(n)->Fl_Color_Chooser::draw(); } int fl_color_chooser_handle(COLORCHOOSER n, int e) { return static_cast(n)->Fl_Color_Chooser::handle(e); }