Permalink
Browse files

actual use the highlighted state

  • Loading branch information...
1 parent 8f9317f commit 1f86887a9d842e4b8e5a8622d6844da6c9d7c27b @joshaber joshaber committed May 18, 2012
Showing with 14 additions and 0 deletions.
  1. +2 −0 lib/UIKit/TUIControl.h
  2. +12 −0 lib/UIKit/TUIControl.m
@@ -50,6 +50,7 @@ typedef NSUInteger TUIControlState;
unsigned int selected:1;
unsigned int acceptsFirstMouse:1;
unsigned int tracking:1;
+ unsigned int highlighted:1;
} _controlFlags;
}
@@ -58,6 +59,7 @@ typedef NSUInteger TUIControlState;
@property(nonatomic,readonly) TUIControlState state;
@property(nonatomic,readonly,getter=isTracking) BOOL tracking;
@property(nonatomic,assign) BOOL selected;
+@property (nonatomic, assign) BOOL highlighted;
@property (nonatomic, assign) BOOL acceptsFirstMouse;
@@ -59,6 +59,7 @@ - (TUIControlState)state
if(_controlFlags.disabled) actual |= TUIControlStateDisabled;
if(_controlFlags.selected) actual |= TUIControlStateSelected;
if(_controlFlags.tracking) actual |= TUIControlStateHighlighted;
+ if(_controlFlags.highlighted) actual |= TUIControlStateHighlighted;
if(![self.nsView isWindowKey]) actual |= TUIControlStateNotKey;
return actual;
@@ -96,6 +97,17 @@ -(void)setSelected:(BOOL)selected {
[self setNeedsDisplay];
}
+- (BOOL)highlighted {
+ return _controlFlags.highlighted;
+}
+
+- (void)setHighlighted:(BOOL)highlighted {
+ [self _stateWillChange];
+ _controlFlags.highlighted = highlighted;
+ [self _stateDidChange];
+ [self setNeedsDisplay];
+}
+
- (BOOL)acceptsFirstMouse
{
return _controlFlags.acceptsFirstMouse;

0 comments on commit 1f86887

Please sign in to comment.