diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-03-13 08:56:23 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-03-13 08:56:35 +0100 |
| commit | b549cfaaea11ce5e881e2151a838c91a031ad9ba (patch) | |
| tree | a8a34a8cd7270a4d4ca68bca08c1b6e6388220d4 /src/drivers/WinAPI/fl_WinAPI_platform_init.cxx | |
| parent | e8461a6191e0afa5fd96290856d1a056437469d0 (diff) | |
Separate platform init functions from platform-specific driver files
Diffstat (limited to 'src/drivers/WinAPI/fl_WinAPI_platform_init.cxx')
| -rw-r--r-- | src/drivers/WinAPI/fl_WinAPI_platform_init.cxx | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/src/drivers/WinAPI/fl_WinAPI_platform_init.cxx b/src/drivers/WinAPI/fl_WinAPI_platform_init.cxx new file mode 100644 index 000000000..bf5e34d36 --- /dev/null +++ b/src/drivers/WinAPI/fl_WinAPI_platform_init.cxx @@ -0,0 +1,69 @@ +// +// Windows-specific code to initialize Windows support. +// +// Copyright 2022 by Bill Spitzak and others. +// +// This library is free software. Distribution and use rights are outlined in +// the file "COPYING" which should have been included with this file. If this +// file is missing or damaged, see the license at: +// +// https://www.fltk.org/COPYING.php +// +// Please see the following page on how to report bugs and issues: +// +// https://www.fltk.org/bugs.php +// + + +#include "../GDI/Fl_GDI_Copy_Surface_Driver.H" +#include "../GDI/Fl_GDI_Graphics_Driver.H" +#include "Fl_WinAPI_Screen_Driver.H" +#include "Fl_WinAPI_System_Driver.H" +#include "Fl_WinAPI_Window_Driver.H" +#include "../GDI/Fl_GDI_Image_Surface_Driver.H" + + +Fl_Copy_Surface_Driver *Fl_Copy_Surface_Driver::newCopySurfaceDriver(int w, int h) +{ + return new Fl_GDI_Copy_Surface_Driver(w, h); +} + + +Fl_Graphics_Driver *Fl_Graphics_Driver::newMainGraphicsDriver() +{ +#if USE_GDIPLUS + // Initialize GDI+. + static Gdiplus::GdiplusStartupInput gdiplusStartupInput; + if (Fl_GDIplus_Graphics_Driver::gdiplusToken == 0) { + GdiplusStartup(&Fl_GDIplus_Graphics_Driver::gdiplusToken, &gdiplusStartupInput, NULL); + } + Fl_Graphics_Driver *driver = new Fl_GDIplus_Graphics_Driver(); + return driver; +#else + return new Fl_GDI_Graphics_Driver(); +#endif +} + + +Fl_Screen_Driver *Fl_Screen_Driver::newScreenDriver() +{ + return new Fl_WinAPI_Screen_Driver(); +} + + +Fl_System_Driver *Fl_System_Driver::newSystemDriver() +{ + return new Fl_WinAPI_System_Driver(); +} + + +Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w) +{ + return new Fl_WinAPI_Window_Driver(w); +} + + +Fl_Image_Surface_Driver *Fl_Image_Surface_Driver::newImageSurfaceDriver(int w, int h, int high_res, Fl_Offscreen off) +{ + return new Fl_GDI_Image_Surface_Driver(w, h, high_res, off); +} |
