| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ |
| 6 #define UI_VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ | 6 #define UI_VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
| 12 | 12 |
| 13 namespace gfx { | |
| 14 class ImageSkia; | |
| 15 } | |
| 16 | |
| 17 namespace views { | 13 namespace views { |
| 18 | 14 |
| 19 class Checkbox; | 15 class Checkbox; |
| 20 class ImageView; | |
| 21 class Label; | 16 class Label; |
| 22 class Link; | 17 class Link; |
| 23 class LinkListener; | 18 class LinkListener; |
| 24 class Textfield; | 19 class Textfield; |
| 25 | 20 |
| 26 // This class displays the contents of a message box. It is intended for use | 21 // This class displays the contents of a message box. It is intended for use |
| 27 // within a constrained window, and has options for a message, prompt, OK | 22 // within a constrained window, and has options for a message, prompt, OK |
| 28 // and Cancel buttons. | 23 // and Cancel buttons. |
| 29 class VIEWS_EXPORT MessageBoxView : public View { | 24 class VIEWS_EXPORT MessageBoxView : public View { |
| 30 public: | 25 public: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 59 // Returns the text box. | 54 // Returns the text box. |
| 60 views::Textfield* text_box() { return prompt_field_; } | 55 views::Textfield* text_box() { return prompt_field_; } |
| 61 | 56 |
| 62 // Returns user entered data in the prompt field. | 57 // Returns user entered data in the prompt field. |
| 63 base::string16 GetInputText(); | 58 base::string16 GetInputText(); |
| 64 | 59 |
| 65 // Returns true if a checkbox is selected, false otherwise. (And false if | 60 // Returns true if a checkbox is selected, false otherwise. (And false if |
| 66 // the message box has no checkbox.) | 61 // the message box has no checkbox.) |
| 67 bool IsCheckBoxSelected(); | 62 bool IsCheckBoxSelected(); |
| 68 | 63 |
| 69 // Adds |icon| to the upper left of the message box or replaces the current | |
| 70 // icon. To start out, the message box has no icon. | |
| 71 void SetIcon(const gfx::ImageSkia& icon); | |
| 72 | |
| 73 // Adds a checkbox with the specified label to the message box if this is the | 64 // Adds a checkbox with the specified label to the message box if this is the |
| 74 // first call. Otherwise, it changes the label of the current checkbox. To | 65 // first call. Otherwise, it changes the label of the current checkbox. To |
| 75 // start, the message box has no checkbox until this function is called. | 66 // start, the message box has no checkbox until this function is called. |
| 76 void SetCheckBoxLabel(const base::string16& label); | 67 void SetCheckBoxLabel(const base::string16& label); |
| 77 | 68 |
| 78 // Sets the state of the check-box. | 69 // Sets the state of the check-box. |
| 79 void SetCheckBoxSelected(bool selected); | 70 void SetCheckBoxSelected(bool selected); |
| 80 | 71 |
| 81 // Sets the text and the listener of the link. If |text| is empty, the link | 72 // Sets the text and the listener of the link. If |text| is empty, the link |
| 82 // is removed. | 73 // is removed. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 100 // Sets up the layout manager based on currently initialized views. Should be | 91 // Sets up the layout manager based on currently initialized views. Should be |
| 101 // called when a view is initialized or changed. | 92 // called when a view is initialized or changed. |
| 102 void ResetLayoutManager(); | 93 void ResetLayoutManager(); |
| 103 | 94 |
| 104 // Message for the message box. | 95 // Message for the message box. |
| 105 std::vector<Label*> message_labels_; | 96 std::vector<Label*> message_labels_; |
| 106 | 97 |
| 107 // Input text field for the message box. | 98 // Input text field for the message box. |
| 108 Textfield* prompt_field_; | 99 Textfield* prompt_field_; |
| 109 | 100 |
| 110 // Icon displayed in the upper left corner of the message box. | |
| 111 ImageView* icon_; | |
| 112 | |
| 113 // Checkbox for the message box. | 101 // Checkbox for the message box. |
| 114 Checkbox* checkbox_; | 102 Checkbox* checkbox_; |
| 115 | 103 |
| 116 // Link displayed at the bottom of the view. | 104 // Link displayed at the bottom of the view. |
| 117 Link* link_; | 105 Link* link_; |
| 118 | 106 |
| 119 // Maximum width of the message label. | 107 // Maximum width of the message label. |
| 120 int message_width_; | 108 int message_width_; |
| 121 | 109 |
| 122 // Spacing between rows in the grid layout. | 110 // Spacing between rows in the grid layout. |
| 123 int inter_row_vertical_spacing_; | 111 int inter_row_vertical_spacing_; |
| 124 | 112 |
| 125 DISALLOW_COPY_AND_ASSIGN(MessageBoxView); | 113 DISALLOW_COPY_AND_ASSIGN(MessageBoxView); |
| 126 }; | 114 }; |
| 127 | 115 |
| 128 } // namespace views | 116 } // namespace views |
| 129 | 117 |
| 130 #endif // UI_VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ | 118 #endif // UI_VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ |
| OLD | NEW |