Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item.h

Issue 2588713002: Upstream Chrome on iOS source code [4/11]. (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef IOS_CHROME_BROWSER_UI_COLLECTION_VIEW_CELLS_COLLECTION_VIEW_DETAIL_ITEM_ H_
6 #define IOS_CHROME_BROWSER_UI_COLLECTION_VIEW_CELLS_COLLECTION_VIEW_DETAIL_ITEM_ H_
7
8 #import <UIKit/UIKit.h>
9
10 #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h"
11 #import "ios/third_party/material_components_ios/src/components/CollectionCells/ src/MaterialCollectionCells.h"
12
13 // CollectionViewDetailItem is the model class corresponding to
14 // CollectionViewDetailCell.
15 @interface CollectionViewDetailItem : CollectionViewItem
16
17 // The accessory type to display on the trailing edge of the cell.
18 @property(nonatomic) MDCCollectionViewCellAccessoryType accessoryType;
19
20 // The main text string.
21 @property(nonatomic, copy) NSString* text;
22
23 // The detail text string.
24 @property(nonatomic, copy) NSString* detailText;
25
26 @end
27
28 // CollectionViewDetailCell implements an MDCCollectionViewCell subclass
29 // containing two text labels: a "main" label and a "detail" label. The two
30 // labels are laid out side-by-side and fill the full width of the cell. Labels
31 // are truncated as needed to fit in the cell.
32 @interface CollectionViewDetailCell : MDCCollectionViewCell
33
34 // UILabels corresponding to |text| and |detailText| from the item.
35 @property(nonatomic, readonly, strong) UILabel* textLabel;
36 @property(nonatomic, readonly, strong) UILabel* detailTextLabel;
37
38 // The amount of horizontal space to provide to each of the labels. These values
39 // are determined with the following logic:
40 //
41 // - If there is sufficient room (after accounting for margins) for the full
42 // width of each label, use the current width of each label.
43 // - If not, use the current width of the main label and a clipped width for the
44 // detail label.
45 // - Unless the main label wants more than 75% of the available width and the
46 // detail label wants 25% or less of the available width, in which case use a
47 // clipped width for the main label and the current width of the detail label.
48 // - If both labels want more width than their guaranteed minimums (75% and
49 // 25%), use the guaranteed minimum amount for each.
50 //
51 // Exposed for testing.
52 @property(nonatomic, readonly) CGFloat textLabelTargetWidth;
53 @property(nonatomic, readonly) CGFloat detailTextLabelTargetWidth;
54
55 @end
56
57 #endif // IOS_CHROME_BROWSER_UI_COLLECTION_VIEW_CELLS_COLLECTION_VIEW_DETAIL_IT EM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698