Silence warning in GormTabViewEditor.m

This commit is contained in:
Gregory John Casamento 2023-07-18 18:10:04 -04:00
parent c39c54d62d
commit c84168951c

View file

@ -29,10 +29,15 @@
#include "GormTabViewEditor.h" #include "GormTabViewEditor.h"
#define _EO ((NSTabView *)_editedObject) // #define _EO ((NSTabView *)_editedObject)
@implementation GormTabViewEditor @implementation GormTabViewEditor
- (NSTabView *) _eo
{
return (NSTabView *)_editedObject;
}
- (void) setOpened: (BOOL) flag - (void) setOpened: (BOOL) flag
{ {
[super setOpened: flag]; [super setOpened: flag];
@ -44,30 +49,38 @@
- (NSArray *) selection - (NSArray *) selection
{ {
return [NSArray arrayWithObject: _EO]; return [NSArray arrayWithObject: [self _eo]];
} }
//
// ignore this warning since this works... the editor that may be returned in some cases
// passes on unrecognized selectors to its editedObject, so this will not cause an
// issue.
//
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wobjc-method-access"
- (BOOL) activate - (BOOL) activate
{ {
if ([super activate]) if ([super activate])
{ {
currentView = nil; currentView = nil;
[_EO setDelegate: self]; [[self _eo] setDelegate: self];
[self [self
tabView: _EO tabView: [self _eo]
didSelectTabViewItem: [_EO selectedTabViewItem]]; didSelectTabViewItem: [[self _eo] selectedTabViewItem]];
return YES; return YES;
} }
return NO; return NO;
} }
#pragma GCC diagnostic pop
- (void) deactivate - (void) deactivate
{ {
if (activated == YES) if (activated == YES)
{ {
[self deactivateSubeditors]; [self deactivateSubeditors];
[_EO setDelegate: nil]; [[self _eo] setDelegate: nil];
[super deactivate]; [super deactivate];
} }
} }
@ -80,7 +93,7 @@
{ {
if ([parent respondsToSelector: @selector(selection)] && if ([parent respondsToSelector: @selector(selection)] &&
[[parent selection] containsObject: _EO]) [[parent selection] containsObject: [self _eo]])
{ {
IBKnobPosition knob = IBNoneKnobPosition; IBKnobPosition knob = IBNoneKnobPosition;
NSPoint mouseDownPoint = NSPoint mouseDownPoint =
@ -106,7 +119,7 @@
return; return;
} }
if ([[_EO hitTest: [theEvent locationInWindow]] if ([[[self _eo] hitTest: [theEvent locationInWindow]]
isDescendantOf: currentView]) isDescendantOf: currentView])
{ {
NSDebugLog(@"md %@ descendant of", self); NSDebugLog(@"md %@ descendant of", self);
@ -119,7 +132,7 @@
NSDebugLog(@"md %@ not descendant of", self); NSDebugLog(@"md %@ not descendant of", self);
if ([currentView isOpened] == YES) if ([currentView isOpened] == YES)
[currentView setOpened: NO]; [currentView setOpened: NO];
[_EO mouseDown: theEvent]; [[self _eo] mouseDown: theEvent];
} }
} }