| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 VIEWS_CONTROLS_MESSAGE_BOX_VIEW_VIEW_H_ | 5 #ifndef VIEWS_CONTROLS_MESSAGE_BOX_VIEW_VIEW_H_ |
| 6 #define VIEWS_CONTROLS_MESSAGE_BOX_VIEW_VIEW_H_ | 6 #define VIEWS_CONTROLS_MESSAGE_BOX_VIEW_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/task.h" | 10 #include "base/task.h" |
| 11 #include "views/controls/image_view.h" | 11 #include "views/controls/image_view.h" |
| 12 #include "views/controls/label.h" | 12 #include "views/controls/label.h" |
| 13 #include "views/controls/text_field.h" | 13 #include "views/controls/textfield/textfield.h" |
| 14 #include "views/view.h" | 14 #include "views/view.h" |
| 15 | 15 |
| 16 namespace views { | 16 namespace views { |
| 17 class Checkbox; | 17 class Checkbox; |
| 18 } | 18 } |
| 19 | 19 |
| 20 // This class displays the contents of a message box. It is intended for use | 20 // This class displays the contents of a message box. It is intended for use |
| 21 // within a constrained window, and has options for a message, prompt, OK | 21 // within a constrained window, and has options for a message, prompt, OK |
| 22 // and Cancel buttons. | 22 // and Cancel buttons. |
| 23 class MessageBoxView : public views::View { | 23 class MessageBoxView : public views::View { |
| 24 public: | 24 public: |
| 25 MessageBoxView(int dialog_flags, | 25 MessageBoxView(int dialog_flags, |
| 26 const std::wstring& message, | 26 const std::wstring& message, |
| 27 const std::wstring& default_prompt, | 27 const std::wstring& default_prompt, |
| 28 int message_width); | 28 int message_width); |
| 29 | 29 |
| 30 MessageBoxView(int dialog_flags, | 30 MessageBoxView(int dialog_flags, |
| 31 const std::wstring& message, | 31 const std::wstring& message, |
| 32 const std::wstring& default_prompt); | 32 const std::wstring& default_prompt); |
| 33 | 33 |
| 34 // Returns the text box. | 34 // Returns the text box. |
| 35 views::TextField* text_box() { return prompt_field_; } | 35 views::Textfield* text_box() { return prompt_field_; } |
| 36 | 36 |
| 37 // Returns user entered data in the prompt field. | 37 // Returns user entered data in the prompt field. |
| 38 std::wstring GetInputText(); | 38 std::wstring GetInputText(); |
| 39 | 39 |
| 40 // Returns true if a checkbox is selected, false otherwise. (And false if | 40 // Returns true if a checkbox is selected, false otherwise. (And false if |
| 41 // the message box has no checkbox.) | 41 // the message box has no checkbox.) |
| 42 bool IsCheckBoxSelected(); | 42 bool IsCheckBoxSelected(); |
| 43 | 43 |
| 44 // Adds |icon| to the upper left of the message box or replaces the current | 44 // Adds |icon| to the upper left of the message box or replaces the current |
| 45 // icon. To start out, the message box has no icon. | 45 // icon. To start out, the message box has no icon. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 68 void Init(int dialog_flags, const std::wstring& default_prompt); | 68 void Init(int dialog_flags, const std::wstring& default_prompt); |
| 69 | 69 |
| 70 // Sets up the layout manager based on currently initialized views. Should be | 70 // Sets up the layout manager based on currently initialized views. Should be |
| 71 // called when a view is initialized or changed. | 71 // called when a view is initialized or changed. |
| 72 void ResetLayoutManager(); | 72 void ResetLayoutManager(); |
| 73 | 73 |
| 74 // Message for the message box. | 74 // Message for the message box. |
| 75 views::Label* message_label_; | 75 views::Label* message_label_; |
| 76 | 76 |
| 77 // Input text field for the message box. | 77 // Input text field for the message box. |
| 78 views::TextField* prompt_field_; | 78 views::Textfield* prompt_field_; |
| 79 | 79 |
| 80 // Icon displayed in the upper left corner of the message box. | 80 // Icon displayed in the upper left corner of the message box. |
| 81 views::ImageView* icon_; | 81 views::ImageView* icon_; |
| 82 | 82 |
| 83 // Checkbox for the message box. | 83 // Checkbox for the message box. |
| 84 views::Checkbox* checkbox_; | 84 views::Checkbox* checkbox_; |
| 85 | 85 |
| 86 // Maximum width of the message label. | 86 // Maximum width of the message label. |
| 87 int message_width_; | 87 int message_width_; |
| 88 | 88 |
| 89 ScopedRunnableMethodFactory<MessageBoxView> focus_grabber_factory_; | 89 ScopedRunnableMethodFactory<MessageBoxView> focus_grabber_factory_; |
| 90 | 90 |
| 91 DISALLOW_EVIL_CONSTRUCTORS(MessageBoxView); | 91 DISALLOW_EVIL_CONSTRUCTORS(MessageBoxView); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 #endif // VIEWS_CONTROLS_MESSAGE_BOX_VIEW_VIEW_H_ | 94 #endif // VIEWS_CONTROLS_MESSAGE_BOX_VIEW_VIEW_H_ |
| OLD | NEW |