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" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // directionality of the paragraph's first strong character's. Please refer | 35 // directionality of the paragraph's first strong character's. Please refer |
36 // to HTML5 spec for details. | 36 // to HTML5 spec for details. |
37 // http://dev.w3.org/html5/spec/Overview.html#text-rendered-in-native-user-i
nterfaces: | 37 // http://dev.w3.org/html5/spec/Overview.html#text-rendered-in-native-user-i
nterfaces: |
38 // The spec does not say anything about alignment. And we choose to | 38 // The spec does not say anything about alignment. And we choose to |
39 // align all paragraphs according to the direction of the first paragraph. | 39 // align all paragraphs according to the direction of the first paragraph. |
40 DETECT_DIRECTIONALITY = 1 << 0, | 40 DETECT_DIRECTIONALITY = 1 << 0, |
41 HAS_PROMPT_FIELD = 1 << 1, | 41 HAS_PROMPT_FIELD = 1 << 1, |
42 }; | 42 }; |
43 | 43 |
44 struct VIEWS_EXPORT InitParams { | 44 struct VIEWS_EXPORT InitParams { |
45 explicit InitParams(const string16& message); | 45 explicit InitParams(const base::string16& message); |
46 ~InitParams(); | 46 ~InitParams(); |
47 | 47 |
48 uint16 options; | 48 uint16 options; |
49 string16 message; | 49 base::string16 message; |
50 string16 default_prompt; | 50 base::string16 default_prompt; |
51 int message_width; | 51 int message_width; |
52 int inter_row_vertical_spacing; | 52 int inter_row_vertical_spacing; |
53 }; | 53 }; |
54 | 54 |
55 explicit MessageBoxView(const InitParams& params); | 55 explicit MessageBoxView(const InitParams& params); |
56 | 56 |
57 virtual ~MessageBoxView(); | 57 virtual ~MessageBoxView(); |
58 | 58 |
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 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 | 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. | 70 // icon. To start out, the message box has no icon. |
71 void SetIcon(const gfx::ImageSkia& icon); | 71 void SetIcon(const gfx::ImageSkia& icon); |
72 | 72 |
73 // Adds a checkbox with the specified label to the message box if this is the | 73 // 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 | 74 // 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. | 75 // start, the message box has no checkbox until this function is called. |
76 void SetCheckBoxLabel(const string16& label); | 76 void SetCheckBoxLabel(const base::string16& label); |
77 | 77 |
78 // Sets the state of the check-box. | 78 // Sets the state of the check-box. |
79 void SetCheckBoxSelected(bool selected); | 79 void SetCheckBoxSelected(bool selected); |
80 | 80 |
81 // Sets the text and the listener of the link. If |text| is empty, the link | 81 // Sets the text and the listener of the link. If |text| is empty, the link |
82 // is removed. | 82 // is removed. |
83 void SetLink(const string16& text, LinkListener* listener); | 83 void SetLink(const base::string16& text, LinkListener* listener); |
84 | 84 |
85 // View: | 85 // View: |
86 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 86 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
87 | 87 |
88 protected: | 88 protected: |
89 // View: | 89 // View: |
90 virtual void ViewHierarchyChanged( | 90 virtual void ViewHierarchyChanged( |
91 const ViewHierarchyChangedDetails& details) OVERRIDE; | 91 const ViewHierarchyChangedDetails& details) OVERRIDE; |
92 // Handles Ctrl-C and writes the message in the system clipboard. | 92 // Handles Ctrl-C and writes the message in the system clipboard. |
93 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 93 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
(...skipping 27 matching lines...) Expand all Loading... |
121 | 121 |
122 // Spacing between rows in the grid layout. | 122 // Spacing between rows in the grid layout. |
123 int inter_row_vertical_spacing_; | 123 int inter_row_vertical_spacing_; |
124 | 124 |
125 DISALLOW_COPY_AND_ASSIGN(MessageBoxView); | 125 DISALLOW_COPY_AND_ASSIGN(MessageBoxView); |
126 }; | 126 }; |
127 | 127 |
128 } // namespace views | 128 } // namespace views |
129 | 129 |
130 #endif // UI_VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ | 130 #endif // UI_VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ |
OLD | NEW |