diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2025-12-11 18:40:14 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2025-12-11 18:40:14 +0100 |
| commit | 78908dfe7df5792c334583f93a9f90335c1a6541 (patch) | |
| tree | 9f784494c088701886e7fc0d14137e4ed58d5f78 /test | |
| parent | 8427f1d330be2c5d475419702359d750596efea1 (diff) | |
Add "Copy" button to test/pixmap_browser
Diffstat (limited to 'test')
| -rw-r--r-- | test/pixmap_browser.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/pixmap_browser.cxx b/test/pixmap_browser.cxx index 7e97b0b26..01e314036 100644 --- a/test/pixmap_browser.cxx +++ b/test/pixmap_browser.cxx @@ -28,6 +28,7 @@ #include <locale.h> // setlocale().. #include <FL/Fl_File_Chooser.H> #include <FL/fl_message.H> +#include <FL/Fl_Copy_Surface.H> #include <FL/Fl_SVG_File_Surface.H> #include <FL/Fl_Native_File_Chooser.H> @@ -135,6 +136,17 @@ int arg(int, char **argv, int &i) { return 0; } +void copy_cb(Fl_Widget *, void *) { + if (!img) return; + Fl_Copy_Surface *surface = new Fl_Copy_Surface(img->w(), img->h()); + Fl_Box *tmp = new Fl_Box(FL_NO_BOX, 0, 0, img->w(), img->h(), ""); + tmp->align(FL_ALIGN_IMAGE_BACKDROP); + tmp->image(img); + surface->draw(tmp); + delete tmp; + delete surface; +} + int main(int argc, char **argv) { int i = 1; @@ -160,6 +172,8 @@ int main(int argc, char **argv) { print.callback(print_cb); Fl_Button svg(190,425,100,25,"save as SVG"); svg.callback(svg_cb); + Fl_Button copy(100,425,80,25,"Copy"); + copy.callback(copy_cb); window.show(argc,argv); if (animate) |
