Skip to content

Commit

Permalink
Merge pull request #25 from barijaona/syncMiMo42
Browse files Browse the repository at this point in the history
Sync with recent improvements in MiMo42's version : 
- Better fix to issue MiMo42#63
- Fix submitted by @greenius : more detail at MiMo42#80
- Improvements to demo app
  • Loading branch information
barijaona authored Oct 4, 2020
2 parents 1ca99b4 + 7ac3c08 commit df8fe5c
Show file tree
Hide file tree
Showing 8 changed files with 709 additions and 3,597 deletions.
4,239 changes: 675 additions & 3,564 deletions MMTabBarView Demo/MMTabBarView Demo/en.lproj/MainMenu.xib

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions MMTabBarView/MMTabBarView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 06DB239A1609F5820071BDA0;
Expand Down
7 changes: 1 addition & 6 deletions MMTabBarView/MMTabBarView/MMAttachedTabBarButtonCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@ NS_ASSUME_NONNULL_BEGIN

/**
* The control view
*
* TODO: fix, rename "attachedTabBarButton"
*/
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wincompatible-property-type"
@property (assign) MMAttachedTabBarButton *controlView;
#pragma clang diagnostic pop
@property (nullable, weak) MMAttachedTabBarButton *attachedTabBarButton;

@end

Expand Down
11 changes: 7 additions & 4 deletions MMTabBarView/MMTabBarView/MMAttachedTabBarButtonCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ - (instancetype)init {
#pragma mark -
#pragma mark Properties

- (MMAttachedTabBarButton *)controlView {
return (MMAttachedTabBarButton *)[super controlView];
- (nullable MMAttachedTabBarButton *)controlView {
// return (MMAttachedTabBarButton *)[super controlView];
return _attachedTabBarButton;
}

- (void)setControlView:(MMAttachedTabBarButton *)aView {
[super setControlView:aView];
- (void) setControlView:(nullable NSView *)aView
{
[super setControlView:aView];
_attachedTabBarButton = (MMAttachedTabBarButton*)aView;
}

#pragma mark -
Expand Down
13 changes: 4 additions & 9 deletions MMTabBarView/MMTabBarView/MMTabBarButtonCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,13 @@ NS_ASSUME_NONNULL_BEGIN

/**
* The control view
*
* TODO: fix, rename "tabBarButton"
*/
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wincompatible-property-type"
@property (assign) MMTabBarButton *controlView;
#pragma clang diagnostic pop
@property (nullable, weak) MMTabBarButton *tabBarButton;

/**
* Tab bar view the tab bar button belongs to
*/
@property (readonly) MMTabBarView *tabBarView;
@property (nullable, readonly) MMTabBarView *tabBarView;

#pragma mark Update images

Expand Down Expand Up @@ -118,14 +113,14 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Get progress indicator
*/
@property (readonly) MMProgressIndicator *indicator;
@property (nullable, readonly) MMProgressIndicator *indicator;

#pragma mark Close Button Support

/**
* The close button
*/
@property (readonly) MMRolloverButton *closeButton;
@property (nullable, readonly) MMRolloverButton *closeButton;

/**
* Check if receiver should display close button
Expand Down
26 changes: 14 additions & 12 deletions MMTabBarView/MMTabBarView/MMTabBarButtonCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,18 @@ - (instancetype)init {
return self;
}

- (MMTabBarButton *)controlView {
return (MMTabBarButton *)[super controlView];
- (nullable MMTabBarButton *)controlView {
// return (MMTabBarButton *)[super controlView];
return _tabBarButton;
}

- (void)setControlView:(MMTabBarButton *)aView {
[super setControlView:aView];
- (void)setControlView:(nullable NSView *)aView {
_tabBarButton = (MMTabBarButton*) aView;
[super setControlView:aView];
}

- (MMTabBarView *)tabBarView {
return self.controlView.tabBarView;
- (nullable MMTabBarView *)tabBarView {
return _tabBarButton.tabBarView;
}

- (void)calcDrawInfo:(NSRect)aRect {
Expand Down Expand Up @@ -183,15 +185,15 @@ - (void)setState:(NSInteger)value {
#pragma mark -
#pragma mark Progress Indicator Support

- (MMProgressIndicator *)indicator {
return self.controlView.indicator;
- (nullable MMProgressIndicator *)indicator {
return self.tabBarButton.indicator;
}

#pragma mark -
#pragma mark Close Button Support

- (MMRolloverButton *)closeButton {
return self.controlView.closeButton;
- (nullable MMRolloverButton *)closeButton {
return self.tabBarButton.closeButton;
}

- (NSImage *)closeButtonImageOfType:(MMCloseButtonImageType)type {
Expand Down Expand Up @@ -612,7 +614,7 @@ - (NSImage *)_closeButtonImageOfType:(MMCloseButtonImageType)type {
- (void)_updateCloseButton {

MMTabBarView *tabBarView = self.tabBarView;
MMTabBarButton *button = self.controlView;
MMTabBarButton *button = self.tabBarButton;
MMRolloverButton *closeButton = button.closeButton;

[self _updateCloseButtonImages];
Expand Down Expand Up @@ -643,7 +645,7 @@ - (void)_updateCloseButton {
- (void)_updateIndicator {

MMTabBarView *tabBarView = self.tabBarView;
MMTabBarButton *button = self.controlView;
MMTabBarButton *button = self.tabBarButton;
MMProgressIndicator *indicator = button.indicator;

// adjust visibility and position of process indicator
Expand Down
7 changes: 6 additions & 1 deletion MMTabBarView/MMTabBarView/MMTabBarView.m
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,20 @@ - (void)viewDidMoveToWindow {
}

- (void)viewWillStartLiveResize {
[super viewWillStartLiveResize];
for (MMAttachedTabBarButton *aButton in self.attachedButtons) {
[aButton.indicator stopAnimation:self];
}
[self setNeedsDisplay:YES];
}

-(void)viewDidEndLiveResize {
for (MMAttachedTabBarButton *aButton in self.attachedButtons) {
[aButton.indicator performSelector:@selector(startAnimation:) withObject:nil afterDelay:0.0];
}

[self _checkWindowFrame];
[self update:NO];
[super viewDidEndLiveResize];
}

- (void)resetCursorRects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ - (NSAttributedString *)attributedStringValueForTabCell:(MMTabBarButtonCell *)ce

// Figure out correct text color

if ( cell.controlView.state == NSOnState )
if ( cell.tabBarButton.state == NSOnState )
{
textColor = [self colorForPart:MMMtabSelectedFont ofTabBarView:cell.tabBarView];
}
Expand Down

0 comments on commit df8fe5c

Please sign in to comment.