Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Avoid selecting non-existent table row (mac)
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrekV committed Feb 19, 2018
1 parent b57fac8 commit d68ef43
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/ui/osx/TogglDesktop/AutoComplete/AutoCompleteInput.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// AutoCompleteInput.h
// TogglDesktop
//
// Created by Indrek Vändrik on 19/02/2018.
// Copyright © 2018 Alari. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface AutoCompleteInput : NSTextField

@end
19 changes: 19 additions & 0 deletions src/ui/osx/TogglDesktop/AutoComplete/AutoCompleteInput.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// AutoCompleteInput.m
// TogglDesktop
//
// Created by Indrek Vändrik on 19/02/2018.
// Copyright © 2018 Alari. All rights reserved.
//

#import "AutoCompleteInput.h"

@implementation AutoCompleteInput

- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];

// Drawing code here.
}

@end
13 changes: 13 additions & 0 deletions src/ui/osx/TogglDesktop/AutoComplete/AutoCompleteTableCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// AutoCompleteTableCell.h
// TogglDesktop
//
// Created by Indrek Vändrik on 19/02/2018.
// Copyright © 2018 Alari. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface AutoCompleteTableCell : NSTableCellView

@end
19 changes: 19 additions & 0 deletions src/ui/osx/TogglDesktop/AutoComplete/AutoCompleteTableCell.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// AutoCompleteTableCell.m
// TogglDesktop
//
// Created by Indrek Vändrik on 19/02/2018.
// Copyright © 2018 Alari. All rights reserved.
//

#import "AutoCompleteTableCell.h"

@implementation AutoCompleteTableCell

- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];

// Drawing code here.
}

@end
15 changes: 15 additions & 0 deletions src/ui/osx/TogglDesktop/AutoComplete/AutoCompleteTableCell.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner"/>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="c22-O7-iKe">
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</customView>
</objects>
</document>
5 changes: 5 additions & 0 deletions src/ui/osx/TogglDesktop/TimeEntryListViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,11 @@ - (IBAction)performClick:(id)sender

- (TimeEntryCell *)getSelectedEntryCell:(NSInteger)row
{
if (row < 0)
{
return nil;
}

NSView *latestView = [self.timeEntriesTableView rowViewAtRow:row
makeIfNecessary :YES];

Expand Down

0 comments on commit d68ef43

Please sign in to comment.