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 CHROME_VIEWS_MESSAGE_BOX_VIEW_VIEW_H__ | 5 #ifndef CHROME_VIEWS_MESSAGE_BOX_VIEW_VIEW_H__ |
6 #define CHROME_VIEWS_MESSAGE_BOX_VIEW_VIEW_H__ | 6 #define CHROME_VIEWS_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" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 MessageBoxView(int dialog_flags, | 37 MessageBoxView(int dialog_flags, |
38 const std::wstring& message, | 38 const std::wstring& message, |
39 const std::wstring& default_prompt, | 39 const std::wstring& default_prompt, |
40 int message_width); | 40 int message_width); |
41 | 41 |
42 MessageBoxView(int dialog_flags, | 42 MessageBoxView(int dialog_flags, |
43 const std::wstring& message, | 43 const std::wstring& message, |
44 const std::wstring& default_prompt); | 44 const std::wstring& default_prompt); |
45 | 45 |
| 46 // Returns the text box. |
| 47 views::TextField* text_box() { return prompt_field_; } |
| 48 |
46 // Returns user entered data in the prompt field. | 49 // Returns user entered data in the prompt field. |
47 std::wstring GetInputText(); | 50 std::wstring GetInputText(); |
48 | 51 |
49 // Returns true if a checkbox is selected, false otherwise. (And false if | 52 // Returns true if a checkbox is selected, false otherwise. (And false if |
50 // the message box has no checkbox.) | 53 // the message box has no checkbox.) |
51 bool IsCheckBoxSelected(); | 54 bool IsCheckBoxSelected(); |
52 | 55 |
53 // Adds |icon| to the upper left of the message box or replaces the current | 56 // Adds |icon| to the upper left of the message box or replaces the current |
54 // icon. To start out, the message box has no icon. | 57 // icon. To start out, the message box has no icon. |
55 void SetIcon(const SkBitmap& icon); | 58 void SetIcon(const SkBitmap& icon); |
56 | 59 |
57 // Adds a checkbox with the specified label to the message box if this is the | 60 // Adds a checkbox with the specified label to the message box if this is the |
58 // first call. Otherwise, it changes the label of the current checkbox. To | 61 // first call. Otherwise, it changes the label of the current checkbox. To |
59 // start, the message box has no checkbox until this function is called. | 62 // start, the message box has no checkbox until this function is called. |
60 void SetCheckBoxLabel(const std::wstring& label); | 63 void SetCheckBoxLabel(const std::wstring& label); |
61 | 64 |
| 65 // Sets the state of the check-box. |
| 66 void SetCheckBoxSelected(bool selected); |
| 67 |
62 protected: | 68 protected: |
63 // Layout and Painting functions. | 69 // Layout and Painting functions. |
64 virtual void ViewHierarchyChanged(bool is_add, | 70 virtual void ViewHierarchyChanged(bool is_add, |
65 views::View* parent, | 71 views::View* parent, |
66 views::View* child); | 72 views::View* child); |
67 | 73 |
68 private: | 74 private: |
69 // Sets up the layout manager and initializes the prompt field. This should | 75 // Sets up the layout manager and initializes the prompt field. This should |
70 // only be called once, from the constructor. | 76 // only be called once, from the constructor. |
71 void Init(int dialog_flags, const std::wstring& default_prompt); | 77 void Init(int dialog_flags, const std::wstring& default_prompt); |
(...skipping 17 matching lines...) Expand all Loading... |
89 // Maximum width of the message label. | 95 // Maximum width of the message label. |
90 int message_width_; | 96 int message_width_; |
91 | 97 |
92 ScopedRunnableMethodFactory<MessageBoxView> focus_grabber_factory_; | 98 ScopedRunnableMethodFactory<MessageBoxView> focus_grabber_factory_; |
93 | 99 |
94 DISALLOW_EVIL_CONSTRUCTORS(MessageBoxView); | 100 DISALLOW_EVIL_CONSTRUCTORS(MessageBoxView); |
95 }; | 101 }; |
96 | 102 |
97 #endif // CHROME_VIEWS_MESSAGE_BOX_VIEW_VIEW_H__ | 103 #endif // CHROME_VIEWS_MESSAGE_BOX_VIEW_VIEW_H__ |
98 | 104 |
OLD | NEW |