diff options
| author | Manolo Gouy <Manolo> | 2018-05-12 16:59:03 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2018-05-12 16:59:03 +0000 |
| commit | 4c45bec12705345621f074922a4eb25c47f39b48 (patch) | |
| tree | 5abb24b27784ab0939ea8bc4b40e0a884cc8c915 /src/drivers | |
| parent | 6fd216d75984e25cdd3fada7396300965861ce90 (diff) | |
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
Diffstat (limited to 'src/drivers')
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.cxx | 44 |
1 files changed, 44 insertions, 0 deletions
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$". // |
