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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 uint16 options; | 43 uint16 options; |
44 base::string16 message; | 44 base::string16 message; |
45 base::string16 default_prompt; | 45 base::string16 default_prompt; |
46 int message_width; | 46 int message_width; |
47 int inter_row_vertical_spacing; | 47 int inter_row_vertical_spacing; |
48 }; | 48 }; |
49 | 49 |
50 explicit MessageBoxView(const InitParams& params); | 50 explicit MessageBoxView(const InitParams& params); |
51 | 51 |
52 virtual ~MessageBoxView(); | 52 ~MessageBoxView() override; |
53 | 53 |
54 // Returns the text box. | 54 // Returns the text box. |
55 views::Textfield* text_box() { return prompt_field_; } | 55 views::Textfield* text_box() { return prompt_field_; } |
56 | 56 |
57 // Returns user entered data in the prompt field. | 57 // Returns user entered data in the prompt field. |
58 base::string16 GetInputText(); | 58 base::string16 GetInputText(); |
59 | 59 |
60 // 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 |
61 // the message box has no checkbox.) | 61 // the message box has no checkbox.) |
62 bool IsCheckBoxSelected(); | 62 bool IsCheckBoxSelected(); |
63 | 63 |
64 // 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 |
65 // 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 |
66 // 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. |
67 void SetCheckBoxLabel(const base::string16& label); | 67 void SetCheckBoxLabel(const base::string16& label); |
68 | 68 |
69 // Sets the state of the check-box. | 69 // Sets the state of the check-box. |
70 void SetCheckBoxSelected(bool selected); | 70 void SetCheckBoxSelected(bool selected); |
71 | 71 |
72 // 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 |
73 // is removed. | 73 // is removed. |
74 void SetLink(const base::string16& text, LinkListener* listener); | 74 void SetLink(const base::string16& text, LinkListener* listener); |
75 | 75 |
76 // View: | 76 // View: |
77 virtual void GetAccessibleState(ui::AXViewState* state) override; | 77 void GetAccessibleState(ui::AXViewState* state) override; |
78 | 78 |
79 protected: | 79 protected: |
80 // View: | 80 // View: |
81 virtual void ViewHierarchyChanged( | 81 void ViewHierarchyChanged( |
82 const ViewHierarchyChangedDetails& details) override; | 82 const ViewHierarchyChangedDetails& details) override; |
83 // Handles Ctrl-C and writes the message in the system clipboard. | 83 // Handles Ctrl-C and writes the message in the system clipboard. |
84 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 84 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
85 | 85 |
86 private: | 86 private: |
87 // Sets up the layout manager and initializes the message labels and prompt | 87 // Sets up the layout manager and initializes the message labels and prompt |
88 // field. This should only be called once, from the constructor. | 88 // field. This should only be called once, from the constructor. |
89 void Init(const InitParams& params); | 89 void Init(const InitParams& params); |
90 | 90 |
91 // 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 |
92 // called when a view is initialized or changed. | 92 // called when a view is initialized or changed. |
93 void ResetLayoutManager(); | 93 void ResetLayoutManager(); |
94 | 94 |
(...skipping 14 matching lines...) Expand all Loading... |
109 | 109 |
110 // Spacing between rows in the grid layout. | 110 // Spacing between rows in the grid layout. |
111 int inter_row_vertical_spacing_; | 111 int inter_row_vertical_spacing_; |
112 | 112 |
113 DISALLOW_COPY_AND_ASSIGN(MessageBoxView); | 113 DISALLOW_COPY_AND_ASSIGN(MessageBoxView); |
114 }; | 114 }; |
115 | 115 |
116 } // namespace views | 116 } // namespace views |
117 | 117 |
118 #endif // UI_VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ | 118 #endif // UI_VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ |
OLD | NEW |