#43 ✓resolved
Kelvin Sherlock

CPButton sizeToFit with border

Reported by Kelvin Sherlock | September 16th, 2008 @ 07:18 AM

the CPButton sizeToFit method doesn't work well when there is a border -- the height is wrong and the width doesn't adjust for the left/right images.

  • (void)sizeToFit { [_imageAndTitleView sizeToFit];

    var frame = [_imageAndTitleView frame],

    height = CGRectGetHeight(frame),
    width = CGRectGetWidth(frame),
    bezelSizes;
    
    
    if (_isBordered) {
    bezelSizes = _CPButtonBezelStyleSizes[_CPButtonClassName + _CPButtonBezelStyleIdentifiers[_bezelStyle]];
    height = bezelSizes [[1]](/projects/16499/changesets/1 "Changeset #1").height;
    width += bezelSizes [[0]](/projects/16499/changesets/0 "Changeset #0").width + bezelSizes [[2]](/projects/16499/changesets/2 "Changeset #2").width;
    
    

    }

    [self setFrameSize:CGSizeMake(width, height)]; }

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Cappuccino Web Framework, including AppKit, Foundation, and Objective-J.

Shared Ticket Bins

People watching this ticket

Referenced by

Pages