blob: f2ee294678f4fabe15f9348ac16e6c844c478c0b (
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
75
76
77
78
79
80
81
82
83
84
|
// Copyright 2016 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 CHROME_BROWSER_UI_VIEWS_IME_IME_WINDOW_FRAME_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_IME_IME_WINDOW_FRAME_VIEW_H_
#include "chrome/browser/ui/ime/ime_window.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/window/non_client_view.h"
namespace views {
class ImageButton;
class ImageView;
class Label;
}
namespace ui {
class ImeWindowView;
// The non-client frame view implementation for the IME window UI.
class ImeWindowFrameView : public views::NonClientFrameView,
public views::ButtonListener {
public:
// According to the UX spec, the follow-cursor window needs to have the title
// bar on the side instead of on the top (because the follow-cursor window is
// majorly used as suggestion list which can be shown in horizontal).
// TODO(shuchen): locate the title bar on the right in the RTL case.
ImeWindowFrameView(ImeWindowView* ime_window_view,
ImeWindow::Mode mode);
~ImeWindowFrameView() override;
void Init();
void UpdateIcon();
private:
// views::NonClientFrameView:
gfx::Rect GetBoundsForClientView() const override;
gfx::Rect GetWindowBoundsForClientBounds(
const gfx::Rect& client_bounds) const override;
int NonClientHitTest(const gfx::Point& point) override;
void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override;
void ResetWindowControls() override;
void UpdateWindowIcon() override;
void UpdateWindowTitle() override;
void SizeConstraintsChanged() override;
// views::View:
gfx::Size GetPreferredSize() const override;
gfx::Size GetMinimumSize() const override;
gfx::Size GetMaximumSize() const override;
void Layout() override;
void OnPaint(gfx::Canvas* canvas) override;
bool OnMousePressed(const ui::MouseEvent& event) override;
bool OnMouseDragged(const ui::MouseEvent& event) override;
void OnMouseReleased(const ui::MouseEvent& event) override;
void OnMouseCaptureLost() override;
void OnGestureEvent(ui::GestureEvent* event) override;
// views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
// Update control styles to indicate if the titlebar is active or not.
void UpdateControlStyles();
// Custom draw the frame.
void PaintFrameBackground(gfx::Canvas* canvas);
bool in_follow_cursor_mode() const {
return mode_ == ImeWindow::FOLLOW_CURSOR;
}
ImeWindowView* ime_window_view_;
ImeWindow::Mode mode_;
views::ImageButton* close_button_;
views::ImageView* title_icon_;
DISALLOW_COPY_AND_ASSIGN(ImeWindowFrameView);
};
} // namespace ui
#endif // CHROME_BROWSER_UI_VIEWS_IME_IME_WINDOW_FRAME_VIEW_H_
|