mirror of
https://github.com/TermiT/Flycut.git
synced 2024-09-20 15:26:05 +08:00
cd26c65b4b
The bezel doesn't provide any UI indication when it loses focus and this no longer responds to input. This ranges anywhere from being klunky to being a bug. Users have reported that they believed Flycut to have hung when encountering this. This defines a protocol for the BezelWindow's delegate, which had previously just been a blind id delegate and makes the new delegate inherit from NSWindowDelegate so that AppController can receive windowDidResignKey: to indicate when focus is lost and immediately close the bezel.
71 lines
2 KiB
Objective-C
Executable file
71 lines
2 KiB
Objective-C
Executable file
//
|
|
// BezelWindow.h
|
|
// Flycut
|
|
//
|
|
// Flycut by Gennadiy Potapov and contributors. Based on Jumpcut by Steve Cook.
|
|
// Copyright 2011 General Arcade. All rights reserved.
|
|
//
|
|
// This code is open-source software subject to the MIT License; see the homepage
|
|
// at <https://github.com/TermiT/Flycut> for details.
|
|
//
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
#import "RoundRecBezierPath.h"
|
|
#import "RoundRecTextField.h"
|
|
|
|
@protocol BezelWindowDelegate <NSWindowDelegate>
|
|
|
|
-(void)processBezelKeyDown:(NSEvent *)theEvent;
|
|
-(void)processBezelMouseEvents:(NSEvent *)theEvent;
|
|
-(void)metaKeysReleased;
|
|
|
|
@end
|
|
|
|
@interface BezelWindow : NSPanel {
|
|
// "n of n" text in bezel
|
|
NSString *charString; // Slightly misleading, as this can be longer than one character
|
|
NSString *title;
|
|
// Clipping text shown in bezel
|
|
NSString *bezelText;
|
|
NSString *sourceText;
|
|
NSString *dateText;
|
|
NSImage *sourceIconImage;
|
|
NSImage *icon;
|
|
Boolean showSourceField;
|
|
NSImageView *sourceIcon;
|
|
RoundRecTextField *sourceFieldBackground;
|
|
RoundRecTextField *sourceFieldApp;
|
|
RoundRecTextField *sourceFieldDate;
|
|
RoundRecTextField *textField;
|
|
RoundRecTextField *charField;
|
|
NSImageView *iconView;
|
|
id<BezelWindowDelegate> delegate;
|
|
Boolean color;
|
|
}
|
|
|
|
- (id)initWithContentRect:(NSRect)contentRect
|
|
styleMask:(NSUInteger)aStyle
|
|
backing:(NSBackingStoreType)bufferingType
|
|
defer:(BOOL)flag
|
|
showSource:(BOOL)showSource;
|
|
|
|
- (NSColor *)roundedBackgroundWithRect:(NSRect)bgRect withRadius:(float)radius withAlpha:(float)alpha;
|
|
- (NSColor *)sizedBezelBackgroundWithRadius:(float)radius withAlpha:(float)alpha;
|
|
|
|
- (NSString *)title;
|
|
- (void)setTitle:(NSString *)newTitle;
|
|
- (NSString *)text;
|
|
- (void)setText:(NSString *)newText;
|
|
- (void)setColor:(BOOL)value;
|
|
- (void)setCharString:(NSString *)newChar;
|
|
- (void)setAlpha:(float)newValue;
|
|
- (void)setSource:(NSString *)newSource;
|
|
- (void)setDate:(NSString *)newDate;
|
|
- (void)setSourceIcon:(NSImage *)newSourceIcon;
|
|
|
|
- (id<BezelWindowDelegate>)delegate;
|
|
- (void)setDelegate:(id<BezelWindowDelegate>)newDelegate;
|
|
|
|
@end
|