From b870f2a1e8fcb956ce316e6a600d7d0625604830 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Sun, 29 Dec 2024 23:51:07 +1300 Subject: Revised FLTK.Devices.Surface subhierarchy --- src/c_fl_paged_device.cpp | 48 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) (limited to 'src/c_fl_paged_device.cpp') diff --git a/src/c_fl_paged_device.cpp b/src/c_fl_paged_device.cpp index fcb4bae..2d3e788 100644 --- a/src/c_fl_paged_device.cpp +++ b/src/c_fl_paged_device.cpp @@ -12,15 +12,44 @@ +// Enums and macro constants + +const int fl_page_format_media = Fl_Paged_Device::MEDIA; + +const int fl_page_layout_portrait = Fl_Paged_Device::PORTRAIT; +const int fl_page_layout_landscape = Fl_Paged_Device::LANDSCAPE; +const int fl_page_layout_reversed = Fl_Paged_Device::REVERSED; +const int fl_page_layout_orientation = Fl_Paged_Device::ORIENTATION; + +const int fl_no_page_formats = NO_PAGE_FORMATS; + + + + +// Helper functions + +void fl_paged_device_get_page_format(int i, const char ** n, int * w, int * h) { + *n = Fl_Paged_Device::page_formats[i].name; + *w = Fl_Paged_Device::page_formats[i].height; + *h = Fl_Paged_Device::page_formats[i].width; +} + + + + +// Adding relevant friends + class My_Paged_Device : public Fl_Paged_Device { - public: - using Fl_Paged_Device::Fl_Paged_Device; - friend PAGED_DEVICE new_fl_paged_device(void); +public: + using Fl_Paged_Device::Fl_Paged_Device; + friend PAGED_DEVICE new_fl_paged_device(void); }; +// Flattened C API + PAGED_DEVICE new_fl_paged_device(void) { My_Paged_Device *p = new My_Paged_Device(); return p; @@ -35,12 +64,12 @@ void free_fl_paged_device(PAGED_DEVICE p) { int fl_paged_device_start_job(PAGED_DEVICE p, int c) { // virtual so disable dispatch - return reinterpret_cast(p)->Fl_Paged_Device::start_job(c,0,0); + return reinterpret_cast(p)->Fl_Paged_Device::start_job(c, 0, 0); } -int fl_paged_device_start_job2(PAGED_DEVICE p, int c, int f, int t) { +int fl_paged_device_start_job2(PAGED_DEVICE p, int c, int * f, int * t) { // virtual so disable dispatch - return reinterpret_cast(p)->Fl_Paged_Device::start_job(c,&f,&t); + return reinterpret_cast(p)->Fl_Paged_Device::start_job(c, f, t); } void fl_paged_device_end_job(PAGED_DEVICE p) { @@ -113,9 +142,12 @@ void fl_paged_device_print_window(PAGED_DEVICE p, void * i, int dx, int dy) { reinterpret_cast(p)->print_window(reinterpret_cast(i),dx,dy); } -void fl_paged_device_print_window_part(PAGED_DEVICE p, void * i, int x, int y, int w, int h, int dx, int dy) { +void fl_paged_device_print_window_part(PAGED_DEVICE p, void * i, int x, int y, + int w, int h, int dx, int dy) +{ // virtual so disable dispatch - reinterpret_cast(p)->Fl_Paged_Device::print_window_part(reinterpret_cast(i),x,y,w,h,dx,dy); + reinterpret_cast(p)->Fl_Paged_Device::print_window_part + (reinterpret_cast(i),x,y,w,h,dx,dy); } -- cgit