NSTabView with background color

As discussed elsewhere, NSTabView does not have the setBackgroundColor method and NSTabView subclassification, and using drawRect to manage it no longer works - since it does not display the 10% best, a bit just below the segmented control button.

Now I am a little surprised by the amount of work that I had to solve; cm.

and I wonder if I went the wrong way. And how to make it better and easier:

  • NSSegmentStyleTexturedSquare seems to give me a translucent segmented control. This means that I need to do extra work to hide any lines without a border (line 240, 253).

    • Is there a better way to do this? That is, to deny its transparency?

    • or is there a way I can use the actual / original segmented selection button?

  • I find that the colors I need, like [NSColor windowBackgroundColour], are not set to anything useful (that is, it is transparent), so right now I will recode them (lines 87, 94).

    • Is there a better way to do this?
  • I believe that I need a boat of fluffy methods to synchronize the situation (line 128, 134, etc.).

    • can this be avoided?
  • I find that the imitation of the ability to rescale means that I need to constantly monitor the divided control unit and delete / resize it. And even then - it's not as good as the original

    • , 157 - ? , ?
  • SegementControl , - .

    • ? ?
  • - NSTabViewItem ? - Segemented COntrol - .

    • - 20-30 , "" Windows, "", , , , 8 .

- / - . / github:):):) .

Dw.

+2
3

PSMTabBarControl, , . , cocoa . PSMTabBarControl Xcode 4. https://github.com/ciaran/psmtabbarcontrol

+1

CALayer? ( , , wishLayer = YES.)

0

, NSTabView . :

- (void)drawRect:(NSRect)dirtyRect {
    static const NSRect offsetRect = (NSRect) { -2, -16, 4, 18 };

    NSRect rect = self.contentRect;

    rect.origin.x += offsetRect.origin.x;
    rect.origin.y += offsetRect.origin.y;
    rect.size.width += offsetRect.size.width;
    rect.size.height += offsetRect.size.height;

    [[NSColor yellowColor] set];
    NSRectFill(rect);

    [super drawRect:dirtyRect];
}

NSTabView, , , !

0

All Articles