Skip to content

Commit

Permalink
Add viewWithTextView: to ViTabController.
Browse files Browse the repository at this point in the history
This method returns the ViDocumentView instance in the
tab view corresponding to the given ViTextView, or nil if
there is no such instance.
  • Loading branch information
Shadowfiend committed Dec 6, 2013
1 parent c4c4590 commit 7b41f56
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/ViTabController.h
Expand Up @@ -24,9 +24,10 @@
*/

@class ViDocument;
@class ViDocumentView;
@class ViTabController;
@class ViTextView;
@class ViViewController;
@class ViDocumentView;

typedef enum ViViewPosition ViViewPosition;
typedef enum ViViewOrderingMode ViViewOrderingMode;
Expand Down Expand Up @@ -164,6 +165,7 @@ enum ViViewOrderingMode {

- (ViViewController *)viewOfClass:(Class)class withRepresentedObject:(id)repObj;
- (ViDocumentView *)viewWithDocument:(ViDocument *)document;
- (ViDocumentView *)viewWithTextView:(ViTextView *)aTextView;

- (ViViewController *)viewAtPosition:(ViViewOrderingMode)position
relativeTo:(NSView *)aView;
Expand Down
14 changes: 13 additions & 1 deletion app/ViTabController.m
Expand Up @@ -144,6 +144,18 @@ - (ViDocumentView *)viewWithDocument:(ViDocument *)document
withRepresentedObject:document];
}

- (ViDocumentView *)viewWithTextView:(ViTextView *)aTextView;
{
for (ViViewController *viewController in _views) {
if ([viewController isKindOfClass:[ViDocumentView class]] &&
[(ViDocumentView *)viewController textView] == aTextView) {
return (ViDocumentView *)viewController;
}
}

return nil;
}

- (NSView *)view
{
return _splitView;
Expand Down Expand Up @@ -434,7 +446,7 @@ - (NSView *)containedViewRelativeToView:(NSView *)view
}

- (ViViewController *)viewAtPosition:(ViViewOrderingMode)position
relativeTo:(NSView *)view
relativeTo:(NSView *)view
{
if (view == nil)
return nil;
Expand Down

0 comments on commit 7b41f56

Please sign in to comment.