| OLD | NEW |
| 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_BORDER_H_ | 5 #ifndef UI_VIEWS_BUBBLE_BUBBLE_BORDER_H_ |
| 6 #define UI_VIEWS_BUBBLE_BUBBLE_BORDER_H_ | 6 #define UI_VIEWS_BUBBLE_BUBBLE_BORDER_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 "ui/views/background.h" | 10 #include "ui/views/background.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 void set_alignment(BubbleAlignment alignment) { alignment_ = alignment; } | 128 void set_alignment(BubbleAlignment alignment) { alignment_ = alignment; } |
| 129 BubbleAlignment alignment() const { return alignment_; } | 129 BubbleAlignment alignment() const { return alignment_; } |
| 130 | 130 |
| 131 // Get the shadow type. | 131 // Get the shadow type. |
| 132 Shadow shadow() const { return shadow_; } | 132 Shadow shadow() const { return shadow_; } |
| 133 | 133 |
| 134 // Get or set the background color for the bubble and arrow body. | 134 // Get or set the background color for the bubble and arrow body. |
| 135 void set_background_color(SkColor color) { background_color_ = color; } | 135 void set_background_color(SkColor color) { background_color_ = color; } |
| 136 SkColor background_color() const { return background_color_; } | 136 SkColor background_color() const { return background_color_; } |
| 137 | 137 |
| 138 // Get or set the client_bounds, a Windows-only temporary hack. | |
| 139 void set_client_bounds(const gfx::Rect& bounds) { client_bounds_ = bounds; } | |
| 140 const gfx::Rect& client_bounds() const { return client_bounds_; } | |
| 141 | |
| 142 // Sets a desired pixel distance between the arrow tip and the outside edge of | 138 // Sets a desired pixel distance between the arrow tip and the outside edge of |
| 143 // the neighboring border image. For example: |----offset----| | 139 // the neighboring border image. For example: |----offset----| |
| 144 // '(' represents shadow around the '{' edge: ((({ ^ }))) | 140 // '(' represents shadow around the '{' edge: ((({ ^ }))) |
| 145 // The arrow will still anchor to the same location but the bubble will shift | 141 // The arrow will still anchor to the same location but the bubble will shift |
| 146 // location to place the arrow |offset| pixels from the perpendicular edge. | 142 // location to place the arrow |offset| pixels from the perpendicular edge. |
| 147 void set_arrow_offset(int offset) { arrow_offset_ = offset; } | 143 void set_arrow_offset(int offset) { arrow_offset_ = offset; } |
| 148 | 144 |
| 149 // Sets the way the arrow is actually painted. Default is PAINT_NORMAL. | 145 // Sets the way the arrow is actually painted. Default is PAINT_NORMAL. |
| 150 void set_paint_arrow(ArrowPaintType value) { arrow_paint_type_ = value; } | 146 void set_paint_arrow(ArrowPaintType value) { arrow_paint_type_ = value; } |
| 151 | 147 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 173 void DrawArrow(gfx::Canvas* canvas, const gfx::Rect& arrow_bounds) const; | 169 void DrawArrow(gfx::Canvas* canvas, const gfx::Rect& arrow_bounds) const; |
| 174 | 170 |
| 175 Arrow arrow_; | 171 Arrow arrow_; |
| 176 int arrow_offset_; | 172 int arrow_offset_; |
| 177 ArrowPaintType arrow_paint_type_; | 173 ArrowPaintType arrow_paint_type_; |
| 178 BubbleAlignment alignment_; | 174 BubbleAlignment alignment_; |
| 179 Shadow shadow_; | 175 Shadow shadow_; |
| 180 internal::BorderImages* images_; | 176 internal::BorderImages* images_; |
| 181 SkColor background_color_; | 177 SkColor background_color_; |
| 182 | 178 |
| 183 // The client/content bounds; must be clipped from the background on Windows. | |
| 184 // TODO(msw): Clean this up when Windows native controls are no longer needed. | |
| 185 gfx::Rect client_bounds_; | |
| 186 | |
| 187 DISALLOW_COPY_AND_ASSIGN(BubbleBorder); | 179 DISALLOW_COPY_AND_ASSIGN(BubbleBorder); |
| 188 }; | 180 }; |
| 189 | 181 |
| 190 // A Background that clips itself to the specified BubbleBorder and uses | 182 // A Background that clips itself to the specified BubbleBorder and uses |
| 191 // the background color of the BubbleBorder. | 183 // the background color of the BubbleBorder. |
| 192 class VIEWS_EXPORT BubbleBackground : public Background { | 184 class VIEWS_EXPORT BubbleBackground : public Background { |
| 193 public: | 185 public: |
| 194 explicit BubbleBackground(BubbleBorder* border) : border_(border) {} | 186 explicit BubbleBackground(BubbleBorder* border) : border_(border) {} |
| 195 | 187 |
| 196 // Overridden from Background: | 188 // Overridden from Background: |
| 197 virtual void Paint(gfx::Canvas* canvas, View* view) const OVERRIDE; | 189 virtual void Paint(gfx::Canvas* canvas, View* view) const OVERRIDE; |
| 198 | 190 |
| 199 private: | 191 private: |
| 200 BubbleBorder* border_; | 192 BubbleBorder* border_; |
| 201 | 193 |
| 202 DISALLOW_COPY_AND_ASSIGN(BubbleBackground); | 194 DISALLOW_COPY_AND_ASSIGN(BubbleBackground); |
| 203 }; | 195 }; |
| 204 | 196 |
| 205 } // namespace views | 197 } // namespace views |
| 206 | 198 |
| 207 #endif // UI_VIEWS_BUBBLE_BUBBLE_BORDER_H_ | 199 #endif // UI_VIEWS_BUBBLE_BUBBLE_BORDER_H_ |
| OLD | NEW |