mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Improve calculation for knob position when in On state
This commit is contained in:
parent
da0f7ded36
commit
d083bc061d
2 changed files with 38 additions and 1 deletions
|
@ -902,7 +902,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
rect = NSMakeRect(frame.origin.x + frame.size.width/2, frame.origin.y + 2,
|
||||
rect = NSMakeRect(frame.origin.x + ((frame.size.width - w) - 4), frame.origin.y + 2,
|
||||
w, frame.size.height - 4);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@
|
|||
|
||||
- (void) setAction: (SEL)action
|
||||
{
|
||||
NSString *s = NSStringFromSelector(action);
|
||||
NSLog(@"Action %@",s);
|
||||
_action = action;
|
||||
}
|
||||
|
||||
|
@ -60,6 +62,7 @@
|
|||
|
||||
- (void) setTarget: (id)target
|
||||
{
|
||||
NSLog(@"Target %@", target);
|
||||
_target = target;
|
||||
}
|
||||
|
||||
|
@ -89,6 +92,40 @@
|
|||
{
|
||||
[self setState: NSControlStateValueOn];
|
||||
}
|
||||
|
||||
if (_action)
|
||||
{
|
||||
[self sendAction: _action
|
||||
to: _target];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)aDecoder
|
||||
{
|
||||
if ((self = [super initWithCoder: aDecoder]) != nil)
|
||||
{
|
||||
if ([aDecoder allowsKeyedCoding])
|
||||
{
|
||||
if ([aDecoder containsValueForKey: @"NSAction"])
|
||||
{
|
||||
NSString *action = [aDecoder decodeObjectForKey: @"NSAction"];
|
||||
if (action != nil)
|
||||
{
|
||||
[self setAction: NSSelectorFromString(action)];
|
||||
}
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSTarget"])
|
||||
{
|
||||
id target = [aDecoder decodeObjectForKey: @"NSTarget"];
|
||||
[self setTarget: target];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue