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

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

Issue 8687031: views: Move the remaining files to ui/views/controls/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « views/controls/image_view.cc ('k') | 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_
6 #define VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/string16.h"
12 #include "views/view.h"
13
14 namespace views {
15
16 class Checkbox;
17 class ImageView;
18 class Label;
19 class Textfield;
20
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
23 // and Cancel buttons.
24 class VIEWS_EXPORT MessageBoxView : public View {
25 public:
26 MessageBoxView(int dialog_flags,
27 const string16& message,
28 const string16& default_prompt,
29 int message_width);
30
31 MessageBoxView(int dialog_flags,
32 const string16& message,
33 const string16& default_prompt);
34
35 virtual ~MessageBoxView();
36
37 // Returns the text box.
38 views::Textfield* text_box() { return prompt_field_; }
39
40 // Returns user entered data in the prompt field.
41 string16 GetInputText();
42
43 // Returns true if a checkbox is selected, false otherwise. (And false if
44 // the message box has no checkbox.)
45 bool IsCheckBoxSelected();
46
47 // Adds |icon| to the upper left of the message box or replaces the current
48 // icon. To start out, the message box has no icon.
49 void SetIcon(const SkBitmap& icon);
50
51 // Adds a checkbox with the specified label to the message box if this is the
52 // first call. Otherwise, it changes the label of the current checkbox. To
53 // start, the message box has no checkbox until this function is called.
54 void SetCheckBoxLabel(const string16& label);
55
56 // Sets the state of the check-box.
57 void SetCheckBoxSelected(bool selected);
58
59 // View:
60 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
61
62 protected:
63 // View:
64 virtual void ViewHierarchyChanged(bool is_add,
65 views::View* parent,
66 views::View* child) OVERRIDE;
67 // Handles Ctrl-C and writes the message in the system clipboard.
68 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
69
70 private:
71 // Sets up the layout manager and initializes the prompt field. This should
72 // only be called once, from the constructor.
73 void Init(int dialog_flags, const string16& default_prompt);
74
75 // Sets up the layout manager based on currently initialized views. Should be
76 // called when a view is initialized or changed.
77 void ResetLayoutManager();
78
79 // Message for the message box.
80 Label* message_label_;
81
82 // Input text field for the message box.
83 Textfield* prompt_field_;
84
85 // Icon displayed in the upper left corner of the message box.
86 ImageView* icon_;
87
88 // Checkbox for the message box.
89 Checkbox* checkbox_;
90
91 // Maximum width of the message label.
92 int message_width_;
93
94 DISALLOW_COPY_AND_ASSIGN(MessageBoxView);
95 };
96
97 } // namespace views
98
99 #endif // VIEWS_CONTROLS_MESSAGE_BOX_VIEW_H_
OLDNEW
« no previous file with comments | « views/controls/image_view.cc ('k') | views/controls/message_box_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698