OLD | NEW |
| (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 CHROME_BROWSER_UI_COCOA_CHOOSER_CONTENT_VIEW_COCOA_H_ | |
6 #define CHROME_BROWSER_UI_COCOA_CHOOSER_CONTENT_VIEW_COCOA_H_ | |
7 | |
8 #import <Cocoa/Cocoa.h> | |
9 | |
10 #include <memory> | |
11 | |
12 #include "base/mac/scoped_nsobject.h" | |
13 | |
14 class ChooserContentViewController; | |
15 class ChooserController; | |
16 @class SpinnerView; | |
17 | |
18 // A chooser content view class that user can select an option. | |
19 @interface ChooserContentViewCocoa : NSView { | |
20 @private | |
21 base::scoped_nsobject<NSTextField> titleView_; | |
22 base::scoped_nsobject<NSButton> adapterOffHelpButton_; | |
23 base::scoped_nsobject<NSTextField> adapterOffMessage_; | |
24 base::scoped_nsobject<NSScrollView> scrollView_; | |
25 base::scoped_nsobject<NSTableColumn> tableColumn_; | |
26 base::scoped_nsobject<NSTableView> tableView_; | |
27 base::scoped_nsobject<SpinnerView> spinner_; | |
28 base::scoped_nsobject<NSButton> connectButton_; | |
29 base::scoped_nsobject<NSButton> cancelButton_; | |
30 base::scoped_nsobject<NSBox> separator_; | |
31 base::scoped_nsobject<NSButton> helpButton_; | |
32 base::scoped_nsobject<NSTextField> scanningMessage_; | |
33 base::scoped_nsobject<NSTextField> wordConnector_; | |
34 base::scoped_nsobject<NSButton> rescanButton_; | |
35 std::unique_ptr<ChooserController> chooserController_; | |
36 std::unique_ptr<ChooserContentViewController> chooserContentViewController_; | |
37 CGFloat separatorOriginY_; | |
38 } | |
39 | |
40 // Designated initializer. | |
41 - (instancetype)initWithChooserTitle:(NSString*)chooserTitle | |
42 chooserController: | |
43 (std::unique_ptr<ChooserController>)chooserController; | |
44 | |
45 // Creates the title for the chooser. | |
46 - (base::scoped_nsobject<NSTextField>)createChooserTitle:(NSString*)title; | |
47 | |
48 // Creates a table row view for the chooser. | |
49 - (base::scoped_nsobject<NSView>)createTableRowView:(NSInteger)row; | |
50 | |
51 // The height of a table row view. | |
52 - (CGFloat)tableRowViewHeight:(NSInteger)row; | |
53 | |
54 // Creates a button with |title|. | |
55 - (base::scoped_nsobject<NSButton>)createButtonWithTitle:(NSString*)title; | |
56 | |
57 // Creates the "Connect" button. | |
58 - (base::scoped_nsobject<NSButton>)createConnectButton; | |
59 | |
60 // Creates the "Cancel" button. | |
61 - (base::scoped_nsobject<NSButton>)createCancelButton; | |
62 | |
63 // Creates the separator. | |
64 - (base::scoped_nsobject<NSBox>)createSeparator; | |
65 | |
66 // Creates a hyperlink button with |text|. | |
67 - (base::scoped_nsobject<NSButton>)createHyperlinkButtonWithText: | |
68 (NSString*)text; | |
69 | |
70 // Gets the adapter off help button. | |
71 - (NSButton*)adapterOffHelpButton; | |
72 | |
73 // Gets the table view for the chooser. | |
74 - (NSTableView*)tableView; | |
75 | |
76 // Gets the spinner. | |
77 - (SpinnerView*)spinner; | |
78 | |
79 // Gets the "Connect" button. | |
80 - (NSButton*)connectButton; | |
81 | |
82 // Gets the "Cancel" button. | |
83 - (NSButton*)cancelButton; | |
84 | |
85 // Gets the "Get help" button. | |
86 - (NSButton*)helpButton; | |
87 | |
88 // Gets the scanning message. | |
89 - (NSTextField*)scanningMessage; | |
90 | |
91 // Gets the word connector. | |
92 - (NSTextField*)wordConnector; | |
93 | |
94 // Gets the "Re-scan" button. | |
95 - (NSButton*)rescanButton; | |
96 | |
97 // The number of options in the |tableView_|. | |
98 - (NSInteger)numberOfOptions; | |
99 | |
100 // The |index|th option string which is listed in the chooser. | |
101 - (NSString*)optionAtIndex:(NSInteger)index; | |
102 | |
103 // Update |tableView_| when chooser options changed. | |
104 - (void)updateTableView; | |
105 | |
106 // Called when the "Connect" button is pressed. | |
107 - (void)accept; | |
108 | |
109 // Called when the "Cancel" button is pressed. | |
110 - (void)cancel; | |
111 | |
112 // Called when the chooser is closed. | |
113 - (void)close; | |
114 | |
115 // Called when the adapter off help button is pressed. | |
116 - (void)onAdapterOffHelp:(id)sender; | |
117 | |
118 // Called when "Re-scan" button is pressed. | |
119 - (void)onRescan:(id)sender; | |
120 | |
121 // Called when the "Get help" button is pressed. | |
122 - (void)onHelpPressed:(id)sender; | |
123 | |
124 // Update the color of the image and text in the table row view. | |
125 - (void)updateContentRowColor; | |
126 | |
127 // Gets the image from table row view. For testing and internal use only. | |
128 - (NSImageView*)tableRowViewImage:(NSInteger)row; | |
129 | |
130 // Gets the text from table row view. For testing and internal use only. | |
131 - (NSTextField*)tableRowViewText:(NSInteger)row; | |
132 | |
133 // Gets the paired status from table row view. For testing and internal use | |
134 // only. | |
135 - (NSTextField*)tableRowViewPairedStatus:(NSInteger)row; | |
136 | |
137 @end | |
138 | |
139 #endif // CHROME_BROWSER_UI_COCOA_CHOOSER_CONTENT_VIEW_COCOA_H_ | |
OLD | NEW |