From 4c45bec12705345621f074922a4eb25c47f39b48 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sat, 12 May 2018 16:59:03 +0000 Subject: MacOS: move some code from file Fl_cocoa.mm to file Fl_Cocoa_Window_Driver.cxx git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12917 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'src/drivers') diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx index f6a05607c..d565ae20c 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx @@ -276,6 +276,50 @@ int Fl_Cocoa_Window_Driver::scroll(int src_x, int src_y, int src_w, int src_h, i return 0; } +static const unsigned windowDidResize_mask = 1; + +bool Fl_Cocoa_Window_Driver::in_windowDidResize() { + return window_flags_ & windowDidResize_mask; +} + +void Fl_Cocoa_Window_Driver::in_windowDidResize(bool b) { + if (b) window_flags_ |= windowDidResize_mask; + else window_flags_ &= ~windowDidResize_mask; +} + +static const unsigned mapped_mask = 2; +static const unsigned changed_mask = 4; + +bool Fl_Cocoa_Window_Driver::mapped_to_retina() { + return window_flags_ & mapped_mask; +} + +void Fl_Cocoa_Window_Driver::mapped_to_retina(bool b) { + if (b) window_flags_ |= mapped_mask; + else window_flags_ &= ~mapped_mask; +} + +bool Fl_Cocoa_Window_Driver::changed_resolution() { + return window_flags_ & changed_mask; +} + +void Fl_Cocoa_Window_Driver::changed_resolution(bool b) { + if (b) window_flags_ |= changed_mask; + else window_flags_ &= ~changed_mask; +} + +// clip the graphics context to rounded corners +void Fl_Cocoa_Window_Driver::clip_to_rounded_corners(CGContextRef gc, int w, int h) { + const CGFloat radius = 7.5; + CGContextMoveToPoint(gc, 0, 0); + CGContextAddLineToPoint(gc, 0, h - radius); + CGContextAddArcToPoint(gc, 0, h, radius, h, radius); + CGContextAddLineToPoint(gc, w - radius, h); + CGContextAddArcToPoint(gc, w, h, w, h - radius, radius); + CGContextAddLineToPoint(gc, w, 0); + CGContextClip(gc); +} + // // End of "$Id$". // -- cgit v1.2.3