diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-04-08 21:23:43 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-04-08 21:23:43 +0200 |
| commit | 00b82b287ca91a270f1c462c9b0d948dfb8838e1 (patch) | |
| tree | c6457e96b36f95d6938288c707075cde38790e90 /test/cursor.cxx | |
| parent | eaf50f4779f6e52750f9ac42950969cd9d9e1656 (diff) | |
Add usage example of Fl_Window::cursor(const Fl_RGB_Image *, int, int)
Diffstat (limited to 'test/cursor.cxx')
| -rw-r--r-- | test/cursor.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/cursor.cxx b/test/cursor.cxx index 9ae677521..7ff7ecdec 100644 --- a/test/cursor.cxx +++ b/test/cursor.cxx @@ -20,6 +20,9 @@ #include <FL/Fl_Choice.H> #include <FL/fl_draw.H> #include <FL/Fl_Box.H> +#include <FL/Fl_Pixmap.H> +#include <FL/Fl_RGB_Image.H> +#include "../fluid/pixmaps/compressed.xpm" Fl_Cursor cursor = FL_CURSOR_DEFAULT; @@ -31,6 +34,13 @@ void choice_cb(Fl_Widget *, void *v) { fl_cursor(cursor); } +void custom_cb(Fl_Widget *widget, void *) { + Fl_Pixmap pxm(compressed_xpm); + Fl_RGB_Image rgb(&pxm); + rgb.scale(16,16); + widget->top_window()->cursor(&rgb, rgb.w()/2, rgb.h()/2); +} + Fl_Menu_Item choices[] = { {"FL_CURSOR_DEFAULT",0,choice_cb,(void*)FL_CURSOR_DEFAULT}, {"FL_CURSOR_ARROW",0,choice_cb,(void*)FL_CURSOR_ARROW}, @@ -53,6 +63,7 @@ Fl_Menu_Item choices[] = { {"FL_CURSOR_W",0,choice_cb,(void*)FL_CURSOR_W}, {"FL_CURSOR_NW",0,choice_cb,(void*)FL_CURSOR_NW}, {"FL_CURSOR_NONE",0,choice_cb,(void*)FL_CURSOR_NONE}, + {"custom cursor",0,custom_cb,NULL}, {0} }; |
