From 00b82b287ca91a270f1c462c9b0d948dfb8838e1 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sat, 8 Apr 2023 21:23:43 +0200 Subject: [PATCH] Add usage example of Fl_Window::cursor(const Fl_RGB_Image *, int, int) --- test/cursor.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 #include #include +#include +#include +#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} };