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

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

Issue 8553001: views: Add an Options enum to MessageBoxView control. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 9 years 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_H_ 5 #ifndef VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_
6 #define VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ 6 #define VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "views/view.h" 12 #include "views/view.h"
13 13
14 namespace views { 14 namespace views {
15 15
16 class Checkbox; 16 class Checkbox;
17 class ImageView; 17 class ImageView;
18 class Label; 18 class Label;
19 class Textfield; 19 class Textfield;
20 20
21 // This class displays the contents of a message box. It is intended for use 21 // This class displays the contents of a message box. It is intended for use
22 // within a constrained window, and has options for a message, prompt, OK 22 // within a constrained window, and has options for a message, prompt, OK
23 // and Cancel buttons. 23 // and Cancel buttons.
24 class VIEWS_EXPORT MessageBoxView : public View { 24 class VIEWS_EXPORT MessageBoxView : public View {
25 public: 25 public:
26 MessageBoxView(int dialog_flags, 26 enum Options {
27 NONE = 0,
sky 2011/11/30 22:43:12 How about NO_OPTIONS or something to make it more
tfarina 2011/12/01 12:43:26 Done.
28 DETECT_ALIGNMENT = 1 << 0,
29 HAS_PROMPT_FIELD = 1 << 1,
30 };
31
32 MessageBoxView(int options,
27 const string16& message, 33 const string16& message,
28 const string16& default_prompt, 34 const string16& default_prompt,
29 int message_width); 35 int message_width);
30 36
31 MessageBoxView(int dialog_flags, 37 MessageBoxView(int options,
32 const string16& message, 38 const string16& message,
33 const string16& default_prompt); 39 const string16& default_prompt);
34 40
35 virtual ~MessageBoxView(); 41 virtual ~MessageBoxView();
36 42
37 // Returns the text box. 43 // Returns the text box.
38 views::Textfield* text_box() { return prompt_field_; } 44 views::Textfield* text_box() { return prompt_field_; }
39 45
40 // Returns user entered data in the prompt field. 46 // Returns user entered data in the prompt field.
41 string16 GetInputText(); 47 string16 GetInputText();
(...skipping 21 matching lines...) Expand all
63 // View: 69 // View:
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) OVERRIDE; 72 views::View* child) OVERRIDE;
67 // Handles Ctrl-C and writes the message in the system clipboard. 73 // Handles Ctrl-C and writes the message in the system clipboard.
68 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; 74 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
69 75
70 private: 76 private:
71 // Sets up the layout manager and initializes the prompt field. This should 77 // Sets up the layout manager and initializes the prompt field. This should
72 // only be called once, from the constructor. 78 // only be called once, from the constructor.
73 void Init(int dialog_flags, const string16& default_prompt); 79 void Init(int options, const string16& default_prompt);
74 80
75 // Sets up the layout manager based on currently initialized views. Should be 81 // Sets up the layout manager based on currently initialized views. Should be
76 // called when a view is initialized or changed. 82 // called when a view is initialized or changed.
77 void ResetLayoutManager(); 83 void ResetLayoutManager();
78 84
79 // Message for the message box. 85 // Message for the message box.
80 Label* message_label_; 86 Label* message_label_;
81 87
82 // Input text field for the message box. 88 // Input text field for the message box.
83 Textfield* prompt_field_; 89 Textfield* prompt_field_;
84 90
85 // Icon displayed in the upper left corner of the message box. 91 // Icon displayed in the upper left corner of the message box.
86 ImageView* icon_; 92 ImageView* icon_;
87 93
88 // Checkbox for the message box. 94 // Checkbox for the message box.
89 Checkbox* checkbox_; 95 Checkbox* checkbox_;
90 96
91 // Maximum width of the message label. 97 // Maximum width of the message label.
92 int message_width_; 98 int message_width_;
93 99
94 DISALLOW_COPY_AND_ASSIGN(MessageBoxView); 100 DISALLOW_COPY_AND_ASSIGN(MessageBoxView);
95 }; 101 };
96 102
97 } // namespace views 103 } // namespace views
98 104
99 #endif // VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_ 105 #endif // VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698