OLD | NEW |
| (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_VIEWS_DELEGATE_H_ | |
6 #define VIEWS_VIEWS_DELEGATE_H_ | |
7 #pragma once | |
8 | |
9 #include <string> | |
10 | |
11 #if defined(OS_WIN) | |
12 #include <windows.h> | |
13 #endif | |
14 | |
15 #include "base/string16.h" | |
16 #include "ui/base/accessibility/accessibility_types.h" | |
17 #include "ui/base/ui_base_types.h" | |
18 #include "views/views_export.h" | |
19 | |
20 namespace gfx { | |
21 class Rect; | |
22 } | |
23 | |
24 namespace ui { | |
25 class Clipboard; | |
26 } | |
27 | |
28 namespace views { | |
29 | |
30 class View; | |
31 class Widget; | |
32 | |
33 // ViewsDelegate is an interface implemented by an object using the views | |
34 // framework. It is used to obtain various high level application utilities | |
35 // and perform some actions such as window placement saving. | |
36 // | |
37 // The embedding app must set views_delegate to assign its ViewsDelegate | |
38 // implementation. | |
39 class VIEWS_EXPORT ViewsDelegate { | |
40 public: | |
41 // The active ViewsDelegate used by the views system. | |
42 static ViewsDelegate* views_delegate; | |
43 | |
44 virtual ~ViewsDelegate() {} | |
45 | |
46 // Gets the clipboard. | |
47 virtual ui::Clipboard* GetClipboard() const = 0; | |
48 | |
49 // Saves the position, size and "show" state for the window with the | |
50 // specified name. | |
51 virtual void SaveWindowPlacement(const Widget* widget, | |
52 const std::string& window_name, | |
53 const gfx::Rect& bounds, | |
54 ui::WindowShowState show_state) = 0; | |
55 | |
56 // Retrieves the saved position and size and "show" state for the window with | |
57 // the specified name. | |
58 virtual bool GetSavedWindowPlacement( | |
59 const std::string& window_name, | |
60 gfx::Rect* bounds, | |
61 ui::WindowShowState* show_state) const = 0; | |
62 | |
63 virtual void NotifyAccessibilityEvent( | |
64 View* view, | |
65 ui::AccessibilityTypes::Event event_type) = 0; | |
66 | |
67 // For accessibility, notify the delegate that a menu item was focused | |
68 // so that alternate feedback (speech / magnified text) can be provided. | |
69 virtual void NotifyMenuItemFocused(const string16& menu_name, | |
70 const string16& menu_item_name, | |
71 int item_index, | |
72 int item_count, | |
73 bool has_submenu) = 0; | |
74 | |
75 #if defined(OS_WIN) | |
76 // Retrieves the default window icon to use for windows if none is specified. | |
77 virtual HICON GetDefaultWindowIcon() const = 0; | |
78 #endif | |
79 | |
80 // AddRef/ReleaseRef are invoked while a menu is visible. They are used to | |
81 // ensure we don't attempt to exit while a menu is showing. | |
82 virtual void AddRef() = 0; | |
83 virtual void ReleaseRef() = 0; | |
84 | |
85 // Converts views::Event::flags to a WindowOpenDisposition. | |
86 virtual int GetDispositionForEvent(int event_flags) = 0; | |
87 }; | |
88 | |
89 } // namespace views | |
90 | |
91 #endif // VIEWS_VIEWS_DELEGATE_H_ | |
OLD | NEW |