luddep (owner)

Revisions

gist: 230252 Download_button fork
public
Public Clone URL: git://gist.github.com/230252.git
Embed All Files: show embed
LPAnchorButton #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@implementation LPAnchorButton : CPButton
{
}
 
- (id)init
{
    if (self = [super init])
    {
        [self setBordered:NO];
        
        [self setValue:[CPFont fontWithName:@"Lucida Grande" size:11.0] forThemeAttribute:@"font"];
        [self setValue:[CPColor colorWithHexString:@"6d28ac"] forThemeAttribute:@"text-color"];
        [self setValue:CPLineBreakByTruncatingTail forThemeAttribute:@"line-break-mode"];
        
        [self setValue:[CPColor colorWithHexString:@"999"] forThemeAttribute:@"text-color" inState:CPThemeStateHighlighted];
    }
    return self;
}
 
- (void)mouseEntered:(CPEvent)anEvent
{
    [self setThemeState:CPThemeStateHighlighted];
}
 
- (void)mouseExited:(CPEvent)anEvent
{
    [self unsetThemeState:CPThemeStateHighlighted];
}
 
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self._DOMElement.style.setProperty(@"color", [[self currentValueForThemeAttribute:@"text-color"] cssString], null);
    self._DOMElement.style.setProperty(@"text-decoration", @"underline", null);
}
 
@end