blob: c924e243ff58362000e0dc847ba65c3ae4cdf9f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_VIEWS_TOUCHUI_TOUCH_EDITING_MENU_H_
#define UI_VIEWS_TOUCHUI_TOUCH_EDITING_MENU_H_
#include "ui/gfx/point.h"
#include "ui/views/bubble/bubble_delegate.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/views_export.h"
namespace gfx {
class Canvas;
}
namespace views {
class TouchEditingMenuView;
class Widget;
class VIEWS_EXPORT TouchEditingMenuController {
public:
// Checks if the specified menu command is supported.
virtual bool IsCommandIdEnabled(int command_id) const = 0;
// Send a context menu command to the controller.
virtual void ExecuteCommand(int command_id, int event_flags) = 0;
// Tell the controller that user has selected the context menu button.
virtual void OpenContextMenu() = 0;
// Called when the menu is closed.
virtual void OnMenuClosed(TouchEditingMenuView* menu) = 0;
protected:
virtual ~TouchEditingMenuController() {}
};
// A View that displays the touch context menu.
class VIEWS_EXPORT TouchEditingMenuView : public BubbleDelegateView,
public ButtonListener {
public:
TouchEditingMenuView(TouchEditingMenuController* controller,
gfx::Rect anchor_rect,
gfx::NativeView context);
virtual ~TouchEditingMenuView();
void Close();
private:
// views::WidgetDelegate overrides:
virtual void WindowClosing() OVERRIDE;
// Overridden from ButtonListener.
virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE;
// Overridden from BubbleDelegateView.
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
// Queries the |controller_| for what elements to show in the menu and sizes
// the menu appropriately.
void CreateButtons();
// Helper method to create a single button.
Button* CreateButton(const string16& title, int tag);
TouchEditingMenuController* controller_;
DISALLOW_COPY_AND_ASSIGN(TouchEditingMenuView);
};
} // namespace views
#endif // UI_VIEWS_TOUCHUI_TOUCH_SELECTION_CONTROLLER_IMPL_H_
|