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

Side by Side Diff: ui/views/bubble/bubble_frame_view.h

Issue 12184004: Replace DialogFrameView with an enhanced BubbleFrameView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comment. Created 7 years, 10 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ 5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_
6 #define UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ 6 #define UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "ui/gfx/insets.h" 11 #include "ui/gfx/insets.h"
12 #include "ui/views/controls/button/button.h"
12 #include "ui/views/window/non_client_view.h" 13 #include "ui/views/window/non_client_view.h"
13 14
14 namespace views { 15 namespace views {
15 16
17 class Label;
18 class LabelButton;
16 class BubbleBorder; 19 class BubbleBorder;
17 20
18 // The non-client frame view of bubble-styled widgets. 21 // The non-client frame view of bubble-styled widgets.
19 class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView { 22 class VIEWS_EXPORT BubbleFrameView : public NonClientFrameView,
23 public ButtonListener {
20 public: 24 public:
21
22 explicit BubbleFrameView(const gfx::Insets& content_margins); 25 explicit BubbleFrameView(const gfx::Insets& content_margins);
23 virtual ~BubbleFrameView(); 26 virtual ~BubbleFrameView();
24 27
25 // NonClientFrameView overrides: 28 // NonClientFrameView overrides:
26 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; 29 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
27 virtual gfx::Rect GetWindowBoundsForClientBounds( 30 virtual gfx::Rect GetWindowBoundsForClientBounds(
28 const gfx::Rect& client_bounds) const OVERRIDE; 31 const gfx::Rect& client_bounds) const OVERRIDE;
29 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; 32 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
30 virtual void GetWindowMask(const gfx::Size& size, 33 virtual void GetWindowMask(const gfx::Size& size,
31 gfx::Path* window_mask) OVERRIDE {} 34 gfx::Path* window_mask) OVERRIDE;
32 virtual void ResetWindowControls() OVERRIDE {} 35 virtual void ResetWindowControls() OVERRIDE;
33 virtual void UpdateWindowIcon() OVERRIDE {} 36 virtual void UpdateWindowIcon() OVERRIDE;
34 virtual void UpdateWindowTitle() OVERRIDE {} 37 virtual void UpdateWindowTitle() OVERRIDE;
35 38
36 // View overrides: 39 // View overrides:
40 virtual gfx::Insets GetInsets() const OVERRIDE;
37 virtual gfx::Size GetPreferredSize() OVERRIDE; 41 virtual gfx::Size GetPreferredSize() OVERRIDE;
42 virtual void Layout() OVERRIDE;
43 virtual std::string GetClassName() const OVERRIDE;
44
45 // Overridden from ButtonListener:
46 virtual void ButtonPressed(Button* sender, const ui::Event& event) OVERRIDE;
38 47
39 // Use bubble_border() and SetBubbleBorder(), not border() and set_border(). 48 // Use bubble_border() and SetBubbleBorder(), not border() and set_border().
40 BubbleBorder* bubble_border() const { return bubble_border_; } 49 BubbleBorder* bubble_border() const { return bubble_border_; }
41 void SetBubbleBorder(BubbleBorder* border); 50 void SetBubbleBorder(BubbleBorder* border);
42 51
43 gfx::Insets content_margins() const { return content_margins_; } 52 gfx::Insets content_margins() const { return content_margins_; }
44 53
54 void SetTitle(const string16& title);
55 void SetShowCloseButton(bool show);
56
57 void set_can_drag(bool can_drag) { can_drag_ = can_drag; }
58
45 // Given the size of the contents and the rect to point at, returns the bounds 59 // Given the size of the contents and the rect to point at, returns the bounds
46 // of the bubble window. The bubble's arrow location may change if the bubble 60 // of the bubble window. The bubble's arrow location may change if the bubble
47 // does not fit on the monitor and |adjust_if_offscreen| is true. 61 // does not fit on the monitor and |adjust_if_offscreen| is true.
48 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect, 62 gfx::Rect GetUpdatedWindowBounds(const gfx::Rect& anchor_rect,
49 gfx::Size client_size, 63 gfx::Size client_size,
50 bool adjust_if_offscreen); 64 bool adjust_if_offscreen);
51 65
52 protected: 66 protected:
53 // Returns the bounds for the monitor showing the specified |rect|. 67 // Returns the bounds for the monitor showing the specified |rect|.
54 // This function is virtual to support testing environments. 68 // This function is virtual to support testing environments.
(...skipping 12 matching lines...) Expand all
67 // in the monitor bounds. 81 // in the monitor bounds.
68 void OffsetArrowIfOffScreen(const gfx::Rect& anchor_rect, 82 void OffsetArrowIfOffScreen(const gfx::Rect& anchor_rect,
69 const gfx::Size& client_size); 83 const gfx::Size& client_size);
70 84
71 // The bubble border. 85 // The bubble border.
72 BubbleBorder* bubble_border_; 86 BubbleBorder* bubble_border_;
73 87
74 // Margins between the content and the inside of the border, in pixels. 88 // Margins between the content and the inside of the border, in pixels.
75 gfx::Insets content_margins_; 89 gfx::Insets content_margins_;
76 90
91 // The optional title and (x) close button.
92 Label* title_;
93 LabelButton* close_;
94
95 // A flag controlling the ability to drag this frame.
96 bool can_drag_;
97
77 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView); 98 DISALLOW_COPY_AND_ASSIGN(BubbleFrameView);
78 }; 99 };
79 100
80 } // namespace views 101 } // namespace views
81 102
82 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_ 103 #endif // UI_VIEWS_BUBBLE_BUBBLE_FRAME_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/constrained_window_views.cc ('k') | ui/views/bubble/bubble_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698