forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ios clean] Add overflow buttons for ToolsMenu.
-ToolsMenu adds a StackView subclass (MenuOverflowControlsStack) as a first element when in compact widths. -ToolsMenu is dismissed everytime the ToolbarLayout changes (Rotation, iPad multitasking,etc.) this mimics current behavior. -MenuOverflowControlsStack currently uses ToolbarButtons as a placeholder, but this is not necessarily how it needs to be. -MenuOverflowControlsStack UI is not yet ready, this CL is more about the logic of adding/removing the Stack, and not the contents. Screenshot: https://drive.google.com/open?id=0Byo6-Nuda2jgQmFzYXZsNkd2ZlU BUG=682880 Review-Url: https://codereview.chromium.org/2693043002 Cr-Commit-Position: refs/heads/master@{#451065}
- Loading branch information
sczs
authored and
Commit bot
committed
Feb 16, 2017
1 parent
4b0ea82
commit 7f21fa5
Showing
6 changed files
with
129 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
ios/clean/chrome/browser/ui/tools/menu_overflow_controls_stackview.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef IOS_CLEAN_CHROME_BROWSER_UI_TOOLS_MENU_OVERFLOW_CONTROLS_STACKVIEW_H_ | ||
#define IOS_CLEAN_CHROME_BROWSER_UI_TOOLS_MENU_OVERFLOW_CONTROLS_STACKVIEW_H_ | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@class ToolbarButton; | ||
|
||
// StackView subclass that contains the Overflow Toolbar Buttons that will be | ||
// inserted in the first row of ToolMenu in compact widths. | ||
@interface MenuOverflowControlsStackView : UIStackView | ||
// ToolsMenu ToolbarButton. | ||
@property(nonatomic, strong) ToolbarButton* toolsMenuButton; | ||
// Share ToolbarButton. | ||
@property(nonatomic, strong) ToolbarButton* shareButton; | ||
// Reload ToolbarButton. | ||
@property(nonatomic, strong) ToolbarButton* reloadButton; | ||
// Stop ToolbarButton. | ||
@property(nonatomic, strong) ToolbarButton* stopButton; | ||
@end | ||
|
||
#endif // IOS_CLEAN_CHROME_BROWSER_UI_TOOLS_MENU_OVERFLOW_CONTROLS_STACKVIEW_H_ |
46 changes: 46 additions & 0 deletions
46
ios/clean/chrome/browser/ui/tools/menu_overflow_controls_stackview.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2017 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#import "ios/clean/chrome/browser/ui/tools/menu_overflow_controls_stackview.h" | ||
|
||
#import "ios/clean/chrome/browser/ui/toolbar/toolbar_button+factory.h" | ||
|
||
@implementation MenuOverflowControlsStackView | ||
@synthesize toolsMenuButton = _toolsMenuButton; | ||
@synthesize shareButton = _shareButton; | ||
@synthesize reloadButton = _reloadButton; | ||
@synthesize stopButton = _stopButton; | ||
|
||
- (instancetype)init { | ||
if ((self = [super init])) { | ||
// PLACEHOLDER: Buttons and UI config is not final and will be improved. | ||
[self setUpToolbarButtons]; | ||
[self addArrangedSubview:self.shareButton]; | ||
[self addArrangedSubview:self.stopButton]; | ||
[self addArrangedSubview:self.reloadButton]; | ||
[self addArrangedSubview:self.toolsMenuButton]; | ||
|
||
self.axis = UILayoutConstraintAxisHorizontal; | ||
self.distribution = UIStackViewDistributionFillEqually; | ||
} | ||
return self; | ||
} | ||
|
||
#pragma mark - Components Setup | ||
|
||
- (void)setUpToolbarButtons { | ||
// Tools menu button. | ||
self.toolsMenuButton = [ToolbarButton toolsMenuToolbarButton]; | ||
|
||
// Share button. | ||
self.shareButton = [ToolbarButton shareToolbarButton]; | ||
|
||
// Reload button. | ||
self.reloadButton = [ToolbarButton reloadToolbarButton]; | ||
|
||
// Stop button. | ||
self.stopButton = [ToolbarButton stopToolbarButton]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters