Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: ui/views/controls/message_box_view.h

Issue 10378086: views: Add a new ctor to MessageBoxView that takes only a InitParams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix review Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/user_data_dir_dialog.cc ('k') | ui/views/controls/message_box_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <string>
10 #include <vector> 9 #include <vector>
11 10
12 #include "base/string16.h" 11 #include "base/string16.h"
13 #include "ui/views/view.h" 12 #include "ui/views/view.h"
14 13
15 namespace views { 14 namespace views {
16 15
17 class Checkbox; 16 class Checkbox;
18 class ImageView; 17 class ImageView;
19 class Label; 18 class Label;
(...skipping 10 matching lines...) Expand all
30 // dialog text, each paragraph's directionality is auto-detected using the 29 // dialog text, each paragraph's directionality is auto-detected using the
31 // directionality of the paragraph's first strong character's. Please refer 30 // directionality of the paragraph's first strong character's. Please refer
32 // to HTML5 spec for details. 31 // to HTML5 spec for details.
33 // http://dev.w3.org/html5/spec/Overview.html#text-rendered-in-native-user-i nterfaces: 32 // http://dev.w3.org/html5/spec/Overview.html#text-rendered-in-native-user-i nterfaces:
34 // The spec does not say anything about alignment. And we choose to 33 // The spec does not say anything about alignment. And we choose to
35 // align all paragraphs according to the direction of the first paragraph. 34 // align all paragraphs according to the direction of the first paragraph.
36 DETECT_DIRECTIONALITY = 1 << 0, 35 DETECT_DIRECTIONALITY = 1 << 0,
37 HAS_PROMPT_FIELD = 1 << 1, 36 HAS_PROMPT_FIELD = 1 << 1,
38 }; 37 };
39 38
40 MessageBoxView(int options, 39 struct InitParams {
41 const string16& message, 40 explicit InitParams(const string16& message);
42 const string16& default_prompt, 41 ~InitParams();
43 int message_width);
44 42
45 MessageBoxView(int options, 43 uint16 options;
46 const string16& message, 44 string16 message;
47 const string16& default_prompt); 45 string16 default_prompt;
46 int message_width;
47 };
48
49 explicit MessageBoxView(const InitParams& params);
48 50
49 virtual ~MessageBoxView(); 51 virtual ~MessageBoxView();
50 52
51 // Returns the text box. 53 // Returns the text box.
52 views::Textfield* text_box() { return prompt_field_; } 54 views::Textfield* text_box() { return prompt_field_; }
53 55
54 // Returns user entered data in the prompt field. 56 // Returns user entered data in the prompt field.
55 string16 GetInputText(); 57 string16 GetInputText();
56 58
57 // Returns true if a checkbox is selected, false otherwise. (And false if 59 // Returns true if a checkbox is selected, false otherwise. (And false if
(...skipping 19 matching lines...) Expand all
77 // View: 79 // View:
78 virtual void ViewHierarchyChanged(bool is_add, 80 virtual void ViewHierarchyChanged(bool is_add,
79 views::View* parent, 81 views::View* parent,
80 views::View* child) OVERRIDE; 82 views::View* child) OVERRIDE;
81 // Handles Ctrl-C and writes the message in the system clipboard. 83 // Handles Ctrl-C and writes the message in the system clipboard.
82 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; 84 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
83 85
84 private: 86 private:
85 // 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
86 // field. This should only be called once, from the constructor. 88 // field. This should only be called once, from the constructor.
87 void Init(int options, const string16& message, const string16& prompt); 89 void Init(const InitParams& params);
88 90
89 // 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
90 // called when a view is initialized or changed. 92 // called when a view is initialized or changed.
91 void ResetLayoutManager(); 93 void ResetLayoutManager();
92 94
93 // Message for the message box. 95 // Message for the message box.
94 std::vector<Label*> message_labels_; 96 std::vector<Label*> message_labels_;
95 97
96 // Input text field for the message box. 98 // Input text field for the message box.
97 Textfield* prompt_field_; 99 Textfield* prompt_field_;
98 100
99 // Icon displayed in the upper left corner of the message box. 101 // Icon displayed in the upper left corner of the message box.
100 ImageView* icon_; 102 ImageView* icon_;
101 103
102 // Checkbox for the message box. 104 // Checkbox for the message box.
103 Checkbox* checkbox_; 105 Checkbox* checkbox_;
104 106
105 // Maximum width of the message label. 107 // Maximum width of the message label.
106 int message_width_; 108 int message_width_;
107 109
108 DISALLOW_COPY_AND_ASSIGN(MessageBoxView); 110 DISALLOW_COPY_AND_ASSIGN(MessageBoxView);
109 }; 111 };
110 112
111 } // namespace views 113 } // namespace views
112 114
113 #endif // UI_VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ 115 #endif // UI_VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/user_data_dir_dialog.cc ('k') | ui/views/controls/message_box_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698