Chromium Code Reviews| 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 { | 13 namespace gfx { |
| 14 class ImageSkia; | 14 class ImageSkia; |
|
msw
2014/07/09 15:56:59
nit: remove this.
meacer
2014/07/09 18:06:56
Done.
| |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 | 18 |
| 19 class Checkbox; | 19 class Checkbox; |
| 20 class ImageView; | 20 class ImageView; |
|
msw
2014/07/09 15:56:59
nit: remove this
meacer
2014/07/09 18:06:56
Done.
| |
| 21 class Label; | 21 class Label; |
| 22 class Link; | 22 class Link; |
| 23 class LinkListener; | 23 class LinkListener; |
| 24 class Textfield; | 24 class Textfield; |
| 25 | 25 |
| 26 // This class displays the contents of a message box. It is intended for use | 26 // 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 | 27 // within a constrained window, and has options for a message, prompt, OK |
| 28 // and Cancel buttons. | 28 // and Cancel buttons. |
| 29 class VIEWS_EXPORT MessageBoxView : public View { | 29 class VIEWS_EXPORT MessageBoxView : public View { |
| 30 public: | 30 public: |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 59 // Returns the text box. | 59 // Returns the text box. |
| 60 views::Textfield* text_box() { return prompt_field_; } | 60 views::Textfield* text_box() { return prompt_field_; } |
| 61 | 61 |
| 62 // Returns user entered data in the prompt field. | 62 // Returns user entered data in the prompt field. |
| 63 base::string16 GetInputText(); | 63 base::string16 GetInputText(); |
| 64 | 64 |
| 65 // Returns true if a checkbox is selected, false otherwise. (And false if | 65 // Returns true if a checkbox is selected, false otherwise. (And false if |
| 66 // the message box has no checkbox.) | 66 // the message box has no checkbox.) |
| 67 bool IsCheckBoxSelected(); | 67 bool IsCheckBoxSelected(); |
| 68 | 68 |
| 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 | 69 // 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 | 70 // 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. | 71 // start, the message box has no checkbox until this function is called. |
| 76 void SetCheckBoxLabel(const base::string16& label); | 72 void SetCheckBoxLabel(const base::string16& label); |
| 77 | 73 |
| 78 // Sets the state of the check-box. | 74 // Sets the state of the check-box. |
| 79 void SetCheckBoxSelected(bool selected); | 75 void SetCheckBoxSelected(bool selected); |
| 80 | 76 |
| 81 // Sets the text and the listener of the link. If |text| is empty, the link | 77 // Sets the text and the listener of the link. If |text| is empty, the link |
| 82 // is removed. | 78 // is removed. |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 100 // Sets up the layout manager based on currently initialized views. Should be | 96 // Sets up the layout manager based on currently initialized views. Should be |
| 101 // called when a view is initialized or changed. | 97 // called when a view is initialized or changed. |
| 102 void ResetLayoutManager(); | 98 void ResetLayoutManager(); |
| 103 | 99 |
| 104 // Message for the message box. | 100 // Message for the message box. |
| 105 std::vector<Label*> message_labels_; | 101 std::vector<Label*> message_labels_; |
| 106 | 102 |
| 107 // Input text field for the message box. | 103 // Input text field for the message box. |
| 108 Textfield* prompt_field_; | 104 Textfield* prompt_field_; |
| 109 | 105 |
| 110 // Icon displayed in the upper left corner of the message box. | |
| 111 ImageView* icon_; | |
| 112 | |
| 113 // Checkbox for the message box. | 106 // Checkbox for the message box. |
| 114 Checkbox* checkbox_; | 107 Checkbox* checkbox_; |
| 115 | 108 |
| 116 // Link displayed at the bottom of the view. | 109 // Link displayed at the bottom of the view. |
| 117 Link* link_; | 110 Link* link_; |
| 118 | 111 |
| 119 // Maximum width of the message label. | 112 // Maximum width of the message label. |
| 120 int message_width_; | 113 int message_width_; |
| 121 | 114 |
| 122 // Spacing between rows in the grid layout. | 115 // Spacing between rows in the grid layout. |
| 123 int inter_row_vertical_spacing_; | 116 int inter_row_vertical_spacing_; |
| 124 | 117 |
| 125 DISALLOW_COPY_AND_ASSIGN(MessageBoxView); | 118 DISALLOW_COPY_AND_ASSIGN(MessageBoxView); |
| 126 }; | 119 }; |
| 127 | 120 |
| 128 } // namespace views | 121 } // namespace views |
| 129 | 122 |
| 130 #endif // UI_VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ | 123 #endif // UI_VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ |
| OLD | NEW |