OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
RetinaHelperImpl Class Reference

Instance Methods

(id) - initWithView:handler: [implementation]
(void) - dealloc [implementation]
(void) - setViewWantsBestResolutionOpenGLSurface: [implementation]
(BOOL) - getViewWantsBestResolutionOpenGLSurface [implementation]
(float) - getBackingScaleFactor [implementation]
(void) - windowDidChangeBackingProperties: [implementation]

Detailed Description

Method Documentation

◆ dealloc

- (void) dealloc
implementation
66{
67 // unregister from all notifications
68 NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
69 if (nc) {
70 [nc removeObserver:self];
71 }
72 [super dealloc];
73}

References dealloc.

Referenced by dealloc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBackingScaleFactor

- (float) getBackingScaleFactor
implementation
86{
87 return [[view window] backingScaleFactor];
88}

References getBackingScaleFactor.

Referenced by getBackingScaleFactor.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getViewWantsBestResolutionOpenGLSurface

- (BOOL) getViewWantsBestResolutionOpenGLSurface
implementation
81{
82 return [view wantsBestResolutionOpenGLSurface];
83}

References getViewWantsBestResolutionOpenGLSurface.

Referenced by getViewWantsBestResolutionOpenGLSurface.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initWithView:handler:

- (id) initWithView: (NSView *) aView
handler: (wxEvtHandler *) aHandler 
implementation
44 :(NSView *)aView handler:(wxEvtHandler *)aHandler
45{
46 self = [super init];
47 if (self) {
48 handler = aHandler;
49 view = aView;
50 // register for backing change notifications
51 NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
52 if (nc) {
53 [nc addObserver:self selector:@selector(windowDidChangeBackingProperties:)
54 name:NSWindowDidChangeBackingPropertiesNotification object:nil];
55 }
56
57 NSWindow* window = [aView window];
58 if (window) {
59 [window setColorSpace:[NSColorSpace sRGBColorSpace]];
60 }
61 }
62 return self;
63}

◆ setViewWantsBestResolutionOpenGLSurface:

- (void) setViewWantsBestResolutionOpenGLSurface: (BOOL) value
implementation
75 :(BOOL)value
76{
77 [view setWantsBestResolutionOpenGLSurface:value];
78}

◆ windowDidChangeBackingProperties:

- (void) windowDidChangeBackingProperties: (NSNotification *) notification
implementation
90 :(NSNotification *)notification
91{
92 NSWindow *theWindow = (NSWindow *)[notification object];
93
94 if (theWindow == [view window]) {
95 CGFloat newBackingScaleFactor = [theWindow backingScaleFactor];
96 CGFloat oldBackingScaleFactor = [[[notification userInfo]
97 objectForKey:@"NSBackingPropertyOldScaleFactorKey"]
98 doubleValue];
99
100 if (newBackingScaleFactor != oldBackingScaleFactor) {
101 // generate a wx resize event and pass it to the handler's queue
102 wxSizeEvent *event = new wxSizeEvent();
103 // use the following line if this resize event should have the physical pixel resolution
104 // but that is not recommended, because ordinary resize events won't do so either
105 // which would necessitate a case-by-case switch in the resize handler method.
106 // NSRect nsrect = [view convertRectToBacking:[view bounds]];
107 NSRect nsrect = [view bounds];
108 wxRect rect = wxRect(nsrect.origin.x, nsrect.origin.y, nsrect.size.width, nsrect.size.height);
109 event->SetRect(rect);
110 event->SetSize(rect.GetSize());
111 handler->QueueEvent(event);
112 }
113 }
114}

The documentation for this class was generated from the following file: