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 CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_WIDGET_WIN_H_ | |
6 #define CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_WIDGET_WIN_H_ | |
7 #pragma once | |
8 | |
9 #include "ui/views/bubble/bubble_border.h" | |
10 #include "ui/views/widget/native_widget_win.h" | |
11 | |
12 class BorderContents; | |
13 | |
14 // This is a window that surrounds the info bubble and paints the margin and | |
15 // border. It is a separate window so that it can be a layered window, so that | |
16 // we can use >1-bit alpha shadow images on the borders, which look nicer than | |
17 // the Windows CS_DROPSHADOW shadows. The info bubble window itself cannot be a | |
18 // layered window because that prevents it from hosting native child controls. | |
19 class BorderWidgetWin : public views::NativeWidgetWin { | |
20 public: | |
21 BorderWidgetWin(); | |
22 virtual ~BorderWidgetWin() { } | |
23 | |
24 // Initializes the BrowserWidget making |owner| its owning window. | |
25 void InitBorderWidgetWin(BorderContents* border_contents, HWND owner); | |
26 | |
27 // Given the size of the contained contents (without margins), and the rect | |
28 // (in screen coordinates) to point to, sets the border window positions and | |
29 // sizes the border window and returns the bounds (in screen coordinates) the | |
30 // contents should use. |arrow_location| is prefered arrow location, | |
31 // the function tries to preserve the location and direction, in case of RTL | |
32 // arrow location is mirrored. | |
33 virtual gfx::Rect SizeAndGetBounds( | |
34 const gfx::Rect& position_relative_to, | |
35 views::BubbleBorder::ArrowLocation arrow_location, | |
36 const gfx::Size& contents_size); | |
37 | |
38 // Simple accessors. | |
39 BorderContents* border_contents() { return border_contents_; } | |
40 | |
41 protected: | |
42 BorderContents* border_contents_; | |
43 | |
44 private: | |
45 // Overridden from NativeWidgetWin: | |
46 virtual LRESULT OnMouseActivate(UINT message, | |
47 WPARAM w_param, | |
48 LPARAM l_param) OVERRIDE; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(BorderWidgetWin); | |
51 }; | |
52 | |
53 #endif // CHROME_BROWSER_UI_VIEWS_BUBBLE_BORDER_WIDGET_WIN_H_ | |
OLD | NEW |