Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 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_CONFIRM_BUBBLE_VIEW_H_ | |
| 6 #define CHROME_BROWSER_UI_COCOA_CONFIRM_BUBBLE_VIEW_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #import <Cocoa/Cocoa.h> | |
| 10 | |
| 11 #import "base/mac/cocoa_protocols.h" | |
| 12 #include "base/memory/scoped_nsobject.h" | |
| 13 | |
| 14 @class ConfirmBubbleController; | |
| 15 class ConfirmBubbleModel; | |
| 16 | |
| 17 // A view class that implements a bubble consisting of the following items: | |
| 18 // * one icon ("icon") | |
| 19 // * one title text ("title") | |
| 20 // * one message text ("message") | |
| 21 // * one optional link ("link") | |
| 22 // * two optional buttons ("ok" and "cancel") | |
| 23 // | |
| 24 // This bubble is convenient when we wish to ask transient, non-blocking | |
| 25 // questions. Unlike a dialog, a bubble menu disappears when we click outside of | |
| 26 // its window to avoid blocking user operations. A bubble is laid out as | |
| 27 // follows: | |
| 28 // | |
| 29 // +------------------------+ | |
| 30 // | icon title | | |
| 31 // | message | | |
| 32 // | link | | |
| 33 // | [Cancel] [OK] | | |
| 34 // +------------------------+ | |
| 35 // | |
| 36 @interface ConfirmBubbleView : NSView<NSTextViewDelegate> { | |
| 37 @private | |
| 38 NSView* parent_; // weak | |
| 39 ConfirmBubbleController* controller_; // weak | |
| 40 | |
| 41 // Controls used in this bubble. | |
| 42 scoped_nsobject<NSImageView> icon_; | |
| 43 scoped_nsobject<NSTextView> titleLabel_; | |
| 44 scoped_nsobject<NSTextView> messageLabel_; | |
| 45 scoped_nsobject<NSButton> okButton_; | |
| 46 scoped_nsobject<NSButton> cancelButton_; | |
| 47 } | |
| 48 | |
| 49 // Initializes a bubble view. Since this initializer programmatically creates a | |
| 50 // custom NSView (i.e. without using a nib file), this function should be called | |
|
Robert Sesek
2011/12/12 15:42:43
Why do you not use a nib here? The layout of this
Hironori Bono
2011/12/15 13:06:14
Good point. In brief, I omit this feature in this
Robert Sesek
2011/12/15 18:47:09
If the intention is for the layout to be changed i
| |
| 51 // from loadView: of the controller object which owns this view. | |
| 52 - (id)initWithParent:(NSView*)parent | |
| 53 controller:(ConfirmBubbleController*)controller; | |
| 54 | |
| 55 @end | |
| 56 | |
| 57 // Exposed only for unit testing. | |
| 58 @interface ConfirmBubbleView(ExposedForUnitTesting) | |
|
Robert Sesek
2011/12/12 15:42:43
nit: space before (
| |
| 59 - (void)clickOk; | |
| 60 - (void)clickCancel; | |
| 61 - (void)clickLink; | |
| 62 @end | |
| 63 | |
| 64 #endif // CHROME_BROWSER_UI_COCOA_CONFIRM_BUBBLE_VIEW_H_ | |
| OLD | NEW |