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

Side by Side Diff: views/window/dialog_delegate.h

Issue 8552005: views: Move views/window/ to ui/views/window directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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/window/dialog_client_view.cc ('k') | views/window/dialog_delegate.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) 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_WINDOW_DIALOG_DELEGATE_H_ 5 #ifndef VIEWS_WINDOW_DIALOG_DELEGATE_H_
6 #define VIEWS_WINDOW_DIALOG_DELEGATE_H_ 6 #define VIEWS_WINDOW_DIALOG_DELEGATE_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/string16.h" 9 #include "ui/views/window/dialog_delegate.h"
10 #include "ui/base/accessibility/accessibility_types.h" 10 // TODO(tfarina): remove this file once all includes have been updated.
11 #include "ui/base/ui_base_types.h"
12 #include "views/widget/widget_delegate.h"
13 #include "views/window/dialog_client_view.h"
14
15 namespace views {
16
17 class View;
18
19 ///////////////////////////////////////////////////////////////////////////////
20 //
21 // DialogDelegate
22 //
23 // DialogDelegate is an interface implemented by objects that wish to show a
24 // dialog box Window. The window that is displayed uses this interface to
25 // determine how it should be displayed and notify the delegate object of
26 // certain events.
27 //
28 ///////////////////////////////////////////////////////////////////////////////
29 class VIEWS_EXPORT DialogDelegate : public WidgetDelegate {
30 public:
31 virtual DialogDelegate* AsDialogDelegate();
32
33 // Returns a mask specifying which of the available DialogButtons are visible
34 // for the dialog. Note: If an OK button is provided, you should provide a
35 // CANCEL button. A dialog box with just an OK button is frowned upon and
36 // considered a very special case, so if you're planning on including one,
37 // you should reconsider, or beng says there will be stabbings.
38 //
39 // To use the extra button you need to override GetDialogButtons()
40 virtual int GetDialogButtons() const;
41
42 // Returns the default dialog button. This should not be a mask as only
43 // one button should ever be the default button. Return
44 // ui::DIALOG_BUTTON_NONE if there is no default. Default
45 // behavior is to return ui::DIALOG_BUTTON_OK or
46 // ui::DIALOG_BUTTON_CANCEL (in that order) if they are
47 // present, ui::DIALOG_BUTTON_NONE otherwise.
48 virtual int GetDefaultDialogButton() const;
49
50 // Returns the label of the specified dialog button.
51 virtual string16 GetDialogButtonLabel(ui::DialogButton button) const;
52
53 // Returns whether the specified dialog button is enabled.
54 virtual bool IsDialogButtonEnabled(ui::DialogButton button) const;
55
56 // Returns whether the specified dialog button is visible.
57 virtual bool IsDialogButtonVisible(ui::DialogButton button) const;
58
59 // Returns whether accelerators are enabled on the button. This is invoked
60 // when an accelerator is pressed, not at construction time. This
61 // returns true.
62 virtual bool AreAcceleratorsEnabled(ui::DialogButton button);
63
64 // Override this function if with a view which will be shown in the same
65 // row as the OK and CANCEL buttons but flush to the left and extending
66 // up to the buttons.
67 virtual View* GetExtraView();
68
69 // Returns whether the height of the extra view should be at least as tall as
70 // the buttons. The default (false) is to give the extra view it's preferred
71 // height. By returning true the height becomes
72 // max(extra_view preferred height, buttons preferred height).
73 virtual bool GetSizeExtraViewHeightToButtons();
74
75 // For Dialog boxes, if there is a "Cancel" button, this is called when the
76 // user presses the "Cancel" button or the Close button on the window or
77 // in the system menu, or presses the Esc key. This function should return
78 // true if the window can be closed after it returns, or false if it must
79 // remain open.
80 virtual bool Cancel();
81
82 // For Dialog boxes, this is called when the user presses the "OK" button,
83 // or the Enter key. Can also be called on Esc key or close button
84 // presses if there is no "Cancel" button. This function should return
85 // true if the window can be closed after it returns, or false if it must
86 // remain open. If |window_closing| is true, it means that this handler is
87 // being called because the window is being closed (e.g. by Window::Close)
88 // and there is no Cancel handler, so Accept is being called instead.
89 virtual bool Accept(bool window_closing);
90 virtual bool Accept();
91
92 // Overridden from WindowDelegate:
93 virtual View* GetInitiallyFocusedView() OVERRIDE;
94 virtual ClientView* CreateClientView(Widget* widget) OVERRIDE;
95
96 // Called when the window has been closed.
97 virtual void OnClose() {}
98
99 // A helper for accessing the DialogClientView object contained by this
100 // delegate's Window.
101 const DialogClientView* GetDialogClientView() const;
102 DialogClientView* GetDialogClientView();
103
104 protected:
105 // Overridden from WindowDelegate:
106 virtual ui::AccessibilityTypes::Role GetAccessibleWindowRole() const OVERRIDE;
107 };
108
109 // A DialogDelegate implementation that is-a View. Used to override GetWidget()
110 // to call View's GetWidget() for the common case where a DialogDelegate
111 // implementation is-a View.
112 class VIEWS_EXPORT DialogDelegateView : public DialogDelegate,
113 public View {
114 public:
115 DialogDelegateView();
116 virtual ~DialogDelegateView();
117
118 // Overridden from DialogDelegate:
119 virtual Widget* GetWidget() OVERRIDE;
120 virtual const Widget* GetWidget() const OVERRIDE;
121
122 private:
123 DISALLOW_COPY_AND_ASSIGN(DialogDelegateView);
124 };
125
126 } // namespace views
127 11
128 #endif // VIEWS_WINDOW_DIALOG_DELEGATE_H_ 12 #endif // VIEWS_WINDOW_DIALOG_DELEGATE_H_
OLDNEW
« no previous file with comments | « views/window/dialog_client_view.cc ('k') | views/window/dialog_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698