mirror of
https://github.com/objective-see/TaskExplorer.git
synced 2026-03-22 07:02:39 +00:00
fixes/improvements to flagged items & search views
variable length 'loaded in' field mouse over for buttons (+refactor) files now searched
This commit is contained in:
+5
-102
@@ -274,120 +274,23 @@ bail:
|
||||
|
||||
|
||||
//automatically invoked when mouse entered
|
||||
// ->highlight button
|
||||
-(void)mouseEntered:(NSEvent*)theEvent
|
||||
{
|
||||
//mouse entered
|
||||
// ->highlight (visual) state
|
||||
[self buttonAppearance:theEvent shouldReset:NO];
|
||||
buttonAppearance(self.itemView, theEvent, NO);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//automaticall invoked when mouse exits
|
||||
//automatically invoked when mouse exits
|
||||
// ->unhighlight/reset button
|
||||
-(void)mouseExited:(NSEvent*)theEvent
|
||||
{
|
||||
//mouse exited
|
||||
// ->so reset button to original (visual) state
|
||||
[self buttonAppearance:theEvent shouldReset:YES];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//set or unset button's highlight
|
||||
-(void)buttonAppearance:(NSEvent*)theEvent shouldReset:(BOOL)shouldReset
|
||||
{
|
||||
//mouse point
|
||||
NSPoint mousePoint = {0};
|
||||
|
||||
//row index
|
||||
NSUInteger rowIndex = -1;
|
||||
|
||||
//current row
|
||||
NSTableCellView* currentRow = nil;
|
||||
|
||||
//tag
|
||||
NSUInteger tag = 0;
|
||||
|
||||
//button
|
||||
NSButton* button = nil;
|
||||
|
||||
//button's label
|
||||
NSTextField* label = nil;
|
||||
|
||||
//image name
|
||||
NSString* imageName = nil;
|
||||
|
||||
//extract tag
|
||||
tag = [((NSDictionary*)theEvent.userData)[@"tag"] unsignedIntegerValue];
|
||||
|
||||
//restore button back to default (visual) state
|
||||
if(YES == shouldReset)
|
||||
{
|
||||
//set image name
|
||||
// ->'info'
|
||||
if(TABLE_ROW_INFO_BUTTON == tag)
|
||||
{
|
||||
//set
|
||||
imageName = @"info";
|
||||
}
|
||||
//set image name
|
||||
// ->'info'
|
||||
else if(TABLE_ROW_SHOW_BUTTON == tag)
|
||||
{
|
||||
//set
|
||||
imageName = @"show";
|
||||
}
|
||||
}
|
||||
//highlight button
|
||||
else
|
||||
{
|
||||
//set image name
|
||||
// ->'info'
|
||||
if(TABLE_ROW_INFO_BUTTON == tag)
|
||||
{
|
||||
//set
|
||||
imageName = @"infoOver";
|
||||
}
|
||||
//set image name
|
||||
// ->'info'
|
||||
else if(TABLE_ROW_SHOW_BUTTON == tag)
|
||||
{
|
||||
//set
|
||||
imageName = @"showOver";
|
||||
}
|
||||
}
|
||||
|
||||
//grab mouse point
|
||||
mousePoint = [self.itemView convertPoint:[theEvent locationInWindow] fromView:nil];
|
||||
|
||||
//compute row indow
|
||||
rowIndex = [self.itemView rowAtPoint:mousePoint];
|
||||
|
||||
//sanity check
|
||||
if(-1 == rowIndex)
|
||||
{
|
||||
//bail
|
||||
goto bail;
|
||||
}
|
||||
|
||||
//get row that's about to be selected
|
||||
currentRow = [self.itemView viewAtColumn:0 row:rowIndex makeIfNecessary:YES];
|
||||
|
||||
//get button
|
||||
// ->tag id of button, passed in userData var
|
||||
button = [currentRow viewWithTag:[((NSDictionary*)theEvent.userData)[@"tag"] unsignedIntegerValue]];
|
||||
label = [currentRow viewWithTag: 1 + [((NSDictionary*)theEvent.userData)[@"tag"] unsignedIntegerValue]];
|
||||
|
||||
//restore default button image
|
||||
// ->for 'info' and 'show' buttons
|
||||
if(nil != imageName)
|
||||
{
|
||||
//set image
|
||||
[button setImage:[NSImage imageNamed:imageName]];
|
||||
}
|
||||
|
||||
//bail
|
||||
bail:
|
||||
buttonAppearance(self.itemView, theEvent, YES);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user