Commit 4e280d62 authored by Alexandre Lision's avatar Alexandre Lision

ui: override default theme

This commit overide style for tree items rendering, to fit with wireframes.
It adds a new Highlight shadow, new item separator, new Selected style.
Items can also have an array of "contextual views" that will be rendered only
on mouse hovers events.
It also introduce support for Ring official colors.

Issue: #79400, #79398
Change-Id: I8d227955f9afe25240b1ece991c57a3cbf996474
parent 4dfcafc0
......@@ -125,7 +125,13 @@ SET(ringclient_VIEWS
src/views/RingOutlineView.mm
src/views/RingOutlineView.h
src/views/RingIDField.mm
src/views/RingIDField.h)
src/views/RingIDField.h
src/views/HoverTableRowView.mm
src/views/HoverTableRowView.h
src/views/NSColor+RingTheme.mm
src/views/NSColor+RingTheme.h
src/views/ContextualTableCellView.mm
src/views/ContextualTableCellView.h)
SET(ringclient_OTHERS
src/main.mm
......
......@@ -28,6 +28,7 @@
#import "QNSTreeController.h"
#import "PersonLinkerVC.h"
#import "views/HoverTableRowView.h"
@interface HistoryVC() <NSPopoverDelegate, KeyboardShortcutDelegate, ContactLinkedDelegate> {
......@@ -142,10 +143,10 @@ NSInteger const DETAILS_TAG = 300;
{
QModelIndex qIdx = [treeController toQIdx:((NSTreeNode*)item)];
NSTableCellView *result;
NSTableCellView* result;
if(!qIdx.parent().isValid()) {
result = [outlineView makeViewWithIdentifier:@"CategoryCell" owner:outlineView];
[result.layer setBackgroundColor:[NSColor selectedControlColor].CGColor];
} else {
result = [outlineView makeViewWithIdentifier:@"HistoryCell" owner:outlineView];
NSImageView* photoView = [result viewWithTag:IMAGE_TAG];
......@@ -186,9 +187,19 @@ NSInteger const DETAILS_TAG = 300;
}
}
- (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item
/* View Based OutlineView: See the delegate method -tableView:rowViewForRow: in NSTableView.
*/
- (NSTableRowView *)outlineView:(NSOutlineView *)outlineView rowViewForItem:(id)item
{
return [treeController toQIdx:((NSTreeNode*)item)].parent().isValid();
QModelIndex qIdx = [treeController toQIdx:((NSTreeNode*)item)];
HoverTableRowView* result = [outlineView makeViewWithIdentifier:@"HoverRowView" owner:nil];
if(!qIdx.parent().isValid()) {
[result setHighlightable:NO];
} else
[result setHighlightable:YES];
return result;
}
#pragma mark - ContextMenuDelegate
......
......@@ -36,6 +36,7 @@
#import "backends/AddressBookBackend.h"
#import "QNSTreeController.h"
#import "delegates/ImageManipulationDelegate.h"
#import "views/HoverTableRowView.h"
class ReachablePersonModel : public QSortFilterProxyModel
{
......@@ -142,22 +143,6 @@ NSInteger const CALL_BUTTON_TAG = 400;
}
}
// -------------------------------------------------------------------------------
// textShouldEndEditing:fieldEditor
// -------------------------------------------------------------------------------
- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor
{
if ([[fieldEditor string] length] == 0)
{
// don't allow empty node names
return NO;
}
else
{
return YES;
}
}
// -------------------------------------------------------------------------------
// shouldEditTableColumn:tableColumn:item
//
......@@ -201,6 +186,21 @@ NSInteger const CALL_BUTTON_TAG = 400;
return result;
}
/* View Based OutlineView: See the delegate method -tableView:rowViewForRow: in NSTableView.
*/
- (NSTableRowView *)outlineView:(NSOutlineView *)outlineView rowViewForItem:(id)item
{
QModelIndex qIdx = [treeController toQIdx:((NSTreeNode*)item)];
HoverTableRowView* result = [outlineView makeViewWithIdentifier:@"HoverRowView" owner:nil];
if(!qIdx.parent().isValid()) {
[result setHighlightable:NO];
} else
[result setHighlightable:YES];
return result;
}
- (IBAction)callClickedAtRow:(id)sender {
NSInteger row = [personsView rowForView:sender];
[personsView selectRowIndexes:[NSIndexSet indexSetWithIndex:row] byExtendingSelection:NO];
......
......@@ -35,6 +35,8 @@
#import "QNSTreeController.h"
#import "delegates/ImageManipulationDelegate.h"
#import "views/HoverTableRowView.h"
#import "views/ContextualTableCellView.h"
@interface SmartViewVC () <NSOutlineViewDelegate> {
BOOL isShowingContacts;
......@@ -197,6 +199,8 @@ NSInteger const TXT_BUTTON_TAG = 500;
result = [outlineView makeViewWithIdentifier:@"MainCell" owner:outlineView];
NSTextField* details = [result viewWithTag:DETAILS_TAG];
[((ContextualTableCellView*) result) setContextualsControls:[NSMutableArray arrayWithObject:[result viewWithTag:CALL_BUTTON_TAG]]];
[details setStringValue:qIdx.data((int)Person::Role::FormattedLastUsed).toString().toNSString()];
} else {
result = [outlineView makeViewWithIdentifier:@"CallCell" owner:outlineView];
......@@ -204,10 +208,6 @@ NSInteger const TXT_BUTTON_TAG = 500;
[details setStringValue:qIdx.data((int)Call::Role::HumanStateName).toString().toNSString()];
}
BOOL ongoing = RecentModel::instance()->hasActiveCall(qIdx);
[[result viewWithTag:CALL_BUTTON_TAG] setHidden:ongoing];
NSTextField* displayName = [result viewWithTag:DISPLAYNAME_TAG];
[displayName setStringValue:qIdx.data(Qt::DisplayRole).toString().toNSString()];
......@@ -231,12 +231,12 @@ NSInteger const TXT_BUTTON_TAG = 500;
}
/* View Based OutlineView: See the delegate method -tableView:rowViewForRow: in NSTableView.
*/
- (NSTableRowView *)outlineView:(NSOutlineView *)outlineView rowViewForItem:(id)item
{
return [outlineView makeViewWithIdentifier:@"HoverRowView" owner:nil];
}
*/
/* View Based OutlineView: This delegate method can be used to know when a new 'rowView' has been added to the table. At this point, you can choose to add in extra views, or modify any properties on 'rowView'.
*/
......
/*
* Copyright (C) 2015 Savoir-faire Linux Inc.
* Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#import <Cocoa/Cocoa.h>
@interface ContextualTableCellView : NSTableCellView
/**
* List of subviews to hide/show when mouse is tracked
*/
@property (nonatomic) NSMutableArray* contextualsControls;
@end
/*
* Copyright (C) 2015 Savoir-faire Linux Inc.
* Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#import "ContextualTableCellView.h"
@interface ContextualTableCellView()
@property NSTrackingArea *trackingArea;
@end
@implementation ContextualTableCellView
- (void)updateTrackingAreas {
[super updateTrackingAreas];
[self ensureTrackingArea];
if (![[self trackingAreas] containsObject:_trackingArea]) {
[self addTrackingArea:_trackingArea];
}
}
- (void)ensureTrackingArea {
if (_trackingArea == nil) {
_trackingArea = [[NSTrackingArea alloc] initWithRect:NSZeroRect
options:NSTrackingInVisibleRect
| NSTrackingActiveAlways
| NSTrackingMouseEnteredAndExited owner:self userInfo:nil];
}
}
- (void)prepareForReuse
{
for (NSView* item in self.contextualsControls) {
[item setHidden:YES];
}
}
- (void)mouseEntered:(NSEvent *)theEvent
{
for (NSView* item in self.contextualsControls) {
[item setHidden:NO];
}
}
- (void)mouseExited:(NSEvent *)theEvent
{
for (NSView* item in self.contextualsControls) {
[item setHidden:YES];
}
}
@end
/*
File: HoverTableRowView.h
Abstract: Custom NSTableRowView class for custom drawing and mouse tracking feedback via NSTrackingArea
Version: 1.1
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may
be used to endorse or promote products derived from the Apple Software
without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2012 Apple Inc. All Rights Reserved.
*/
#import <Cocoa/Cocoa.h>
@interface HoverTableRowView : NSTableRowView {
@private
BOOL mouseInside;
NSTrackingArea *trackingArea;
}
@property BOOL highlightable;
@end
// Used by the HoverTableRowView and the RingOutlineView
void DrawSeparatorInRect(NSRect rect);
/*
File: HoverTableRowView.m
Abstract: Custom NSTableRowView class for custom drawing and mouse tracking feedback via NSTrackingArea
Version: 1.1
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may
be used to endorse or promote products derived from the Apple Software
without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2012 Apple Inc. All Rights Reserved.
*/
#import "HoverTableRowView.h"
#import "NSColor+RingTheme.h"
@interface HoverTableRowView ()
@property BOOL mouseInside;
@end
@implementation HoverTableRowView
@dynamic mouseInside;
- (instancetype)init
{
self.highlightable = YES;
}
- (id)initWithFrame:(CGRect)aRect
{
self = [super initWithFrame:aRect];
if (self) {
self.highlightable = YES;
}
return self;
}
- (id)initWithCoder:(NSCoder*)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self) {
self.highlightable = YES;
}
return self;
}
- (void)dealloc {
}
- (void)setMouseInside:(BOOL)value {
if (mouseInside != value) {
mouseInside = value;
[self setNeedsDisplay:YES];
}
}
- (BOOL)mouseInside {
return mouseInside;
}
- (void)ensureTrackingArea {
if (trackingArea == nil) {
trackingArea = [[NSTrackingArea alloc] initWithRect:NSZeroRect
options:NSTrackingInVisibleRect
| NSTrackingActiveAlways
| NSTrackingMouseEnteredAndExited owner:self userInfo:nil];
}
}
- (void)updateTrackingAreas {
[super updateTrackingAreas];
[self ensureTrackingArea];
if (![[self trackingAreas] containsObject:trackingArea]) {
[self addTrackingArea:trackingArea];
}
}
- (void)mouseEntered:(NSEvent *)theEvent {
self.mouseInside = YES;
}
- (void)mouseExited:(NSEvent *)theEvent {
self.mouseInside = NO;
}
static NSGradient *gradientWithTargetColor(NSColor *targetColor) {
NSArray *colors = [NSArray arrayWithObjects:[targetColor colorWithAlphaComponent:0],
targetColor,
targetColor,
[targetColor colorWithAlphaComponent:0], nil];
const CGFloat locations[4] = { 0.0, 0.35, 0.65, 1.0 };
return [[NSGradient alloc] initWithColors:colors atLocations:locations colorSpace:[NSColorSpace sRGBColorSpace]];
}
- (void)drawBackgroundInRect:(NSRect)dirtyRect {
// Custom background drawing. We don't call super at all.
[self.backgroundColor set];
// Fill with the background color first
NSRectFill(self.bounds);
// Draw a gradient
if (self.mouseInside && self.highlightable) {
NSRect selectionRect = NSRect(self.bounds);
[[NSColor ringGreyHighlight] setFill];
NSBezierPath *selectionPath = [NSBezierPath bezierPathWithRoundedRect:selectionRect xRadius:2 yRadius:2];
[selectionPath fill];
}
}
- (NSRect)separatorRect {
NSRect separatorRect = self.bounds;
separatorRect.origin.y = NSMaxY(separatorRect) - 1;
separatorRect.size.height = 1;
return separatorRect;
}
// Only called if the table is set with a horizontal grid
- (void)drawSeparatorInRect:(NSRect)dirtyRect {
// Use a common shared method of drawing the separator
DrawSeparatorInRect([self separatorRect]);
}
// Only called if the 'selected' property is yes.
- (void)drawSelectionInRect:(NSRect)dirtyRect {
// Check the selectionHighlightStyle, in case it was set to None
if (self.selectionHighlightStyle != NSTableViewSelectionHighlightStyleNone) {
// We want a hard-crisp stroke, and stroking 1 pixel will border half on one side and half on another, so we offset by the 0.5 to handle this
NSRect selectionRect = NSRect(self.bounds);
[[NSColor ringGreyHighlight] setFill];
NSBezierPath *selectionPath = [NSBezierPath bezierPathWithRoundedRect:selectionRect xRadius:2 yRadius:2];
[selectionPath fill];
}
}
// interiorBackgroundStyle is normaly "dark" when the selection is drawn (self.selected == YES) and we are in a key window (self.emphasized == YES). However, we always draw a light selection, so we override this method to always return a light color.
- (NSBackgroundStyle)interiorBackgroundStyle {
return NSBackgroundStyleLight;
}
- (void)setFrame:(NSRect)frameRect {
[super setFrame:frameRect];
// We need to invalidate more things when live-resizing since we fill with a gradient and stroke
if ([self inLiveResize]) {
// Redraw everything if we are using a gradient
if (self.selected || self.mouseInside) {
[self setNeedsDisplay:YES];
} else {
// Redraw our horizontal grid line, which is a gradient
[self setNeedsDisplayInRect:[self separatorRect]];
}
}
}
@end
void DrawSeparatorInRect(NSRect rect) {
// Cache the gradient for performance
static NSGradient *gradient = nil;
if (gradient == nil) {
gradient = gradientWithTargetColor([NSColor colorWithSRGBRed:.80 green:.80 blue:.80 alpha:1]);
}
[gradient drawInRect:rect angle:0];
}
/*
* Copyright (C) 2015 Savoir-faire Linux Inc.
* Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#import <Cocoa/Cocoa.h>
@interface NSColor (RingTheme)
+ (NSColor*) ringBlue;
+ (NSColor*) ringBlueWithAlpha:(CGFloat) a;
+ (NSColor*) ringDarkBlue;
+ (NSColor*) ringGreyHighlight;
@end
/*
* Copyright (C) 2015 Savoir-faire Linux Inc.
* Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#import "NSColor+RingTheme.h"
@implementation NSColor (RingTheme)
+ (NSColor*) ringBlue
{
return [NSColor colorWithCalibratedRed:43/255.0 green:180/255.0 blue:201/255.0 alpha:1.0];
}
+ (NSColor*) ringBlueWithAlpha:(CGFloat) a
{
return [NSColor colorWithCalibratedRed:43/255.0 green:180/255.0 blue:201/255.0 alpha:a];
}
+ (NSColor*) ringDarkBlue
{
return [NSColor colorWithCalibratedRed:0/255.0 green:59/255.0 blue:78/255.0 alpha:1.0];
}
+ (NSColor*) ringGreyHighlight
{
return [NSColor colorWithCalibratedRed:239/255.0 green:239/255.0 blue:239/255.0 alpha:1.0];
}
@end
......@@ -15,17 +15,6 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#import <Cocoa/Cocoa.h>
......
......@@ -15,21 +15,12 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#import "RingOutlineView.h"
#import "HoverTableRowView.h" // For the grid drawing shared code
@implementation RingOutlineView
- (NSMenu*)menuForEvent:(NSEvent*)evt
......@@ -65,4 +56,46 @@
[super keyDown:theEvent];
}
- (CGFloat)yPositionPastLastRow {
// Only draw the grid past the last visible row
NSInteger numberOfRows = self.numberOfRows;
CGFloat yStart = 0;
if (numberOfRows > 0) {
yStart = NSMaxY([self rectOfRow:numberOfRows - 1]);
}
return yStart;
}
- (void)drawGridInClipRect:(NSRect)clipRect {
// Only draw the grid past the last visible row
CGFloat yStart = [self yPositionPastLastRow];
// Draw the first separator one row past the last row
yStart += self.rowHeight;
// One thing to do is smarter clip testing to see if we actually need to draw!
NSRect boundsToDraw = self.bounds;
NSRect separatorRect = boundsToDraw;
separatorRect.size.height = 1;
while (yStart < NSMaxY(boundsToDraw)) {
separatorRect.origin.y = yStart;
DrawSeparatorInRect(separatorRect);
yStart += self.rowHeight;
}
}
- (void)setFrameSize:(NSSize)size {
[super setFrameSize:size];
// We need to invalidate more things when live-resizing since we fill with a gradient and stroke
if ([self inLiveResize]) {
CGFloat yStart = [self yPositionPastLastRow];
if (NSHeight(self.bounds) > yStart) {
// Redraw our horizontal grid lines
NSRect boundsPastY = self.bounds;
boundsPastY.size.height -= yStart;
boundsPastY.origin.y = yStart;
[self setNeedsDisplayInRect:boundsPastY];
}
}
}
@end
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment