| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 bool use_theme_background_color() { return use_theme_background_color_; } | 175 bool use_theme_background_color() { return use_theme_background_color_; } |
| 176 | 176 |
| 177 // Sets a desired pixel distance between the arrow tip and the outside edge of | 177 // Sets a desired pixel distance between the arrow tip and the outside edge of |
| 178 // the neighboring border image. For example: |----offset----| | 178 // the neighboring border image. For example: |----offset----| |
| 179 // '(' represents shadow around the '{' edge: ((({ ^ }))) | 179 // '(' represents shadow around the '{' edge: ((({ ^ }))) |
| 180 // The arrow will still anchor to the same location but the bubble will shift | 180 // The arrow will still anchor to the same location but the bubble will shift |
| 181 // location to place the arrow |offset| pixels from the perpendicular edge. | 181 // location to place the arrow |offset| pixels from the perpendicular edge. |
| 182 void set_arrow_offset(int offset) { arrow_offset_ = offset; } | 182 void set_arrow_offset(int offset) { arrow_offset_ = offset; } |
| 183 | 183 |
| 184 // Sets the way the arrow is actually painted. Default is PAINT_NORMAL. | 184 // Sets the way the arrow is actually painted. Default is PAINT_NORMAL. |
| 185 void set_paint_arrow(ArrowPaintType value) { arrow_paint_type_ = value; } | 185 void set_paint_arrow(ArrowPaintType value); |
| 186 | 186 |
| 187 // Get the desired widget bounds (in screen coordinates) given the anchor rect | 187 // Get the desired widget bounds (in screen coordinates) given the anchor rect |
| 188 // and bubble content size; calculated from shadow and arrow image dimensions. | 188 // and bubble content size; calculated from shadow and arrow image dimensions. |
| 189 virtual gfx::Rect GetBounds(const gfx::Rect& anchor_rect, | 189 virtual gfx::Rect GetBounds(const gfx::Rect& anchor_rect, |
| 190 const gfx::Size& contents_size) const; | 190 const gfx::Size& contents_size) const; |
| 191 | 191 |
| 192 // Get the border exterior thickness, including stroke and shadow, in pixels. | 192 // Get the border exterior thickness, including stroke and shadow, in pixels. |
| 193 int GetBorderThickness() const; | 193 int GetBorderThickness() const; |
| 194 | 194 |
| 195 // Returns the corner radius of the current image set. | 195 // Returns the corner radius of the current image set. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 222 // The border and arrow stroke size used in image assets, in pixels. | 222 // The border and arrow stroke size used in image assets, in pixels. |
| 223 static const int kStroke; | 223 static const int kStroke; |
| 224 | 224 |
| 225 gfx::Size GetSizeForContentsSize(const gfx::Size& contents_size) const; | 225 gfx::Size GetSizeForContentsSize(const gfx::Size& contents_size) const; |
| 226 gfx::ImageSkia* GetArrowImage() const; | 226 gfx::ImageSkia* GetArrowImage() const; |
| 227 gfx::Rect GetArrowRect(const gfx::Rect& bounds) const; | 227 gfx::Rect GetArrowRect(const gfx::Rect& bounds) const; |
| 228 void GetArrowPathFromArrowBounds(const gfx::Rect& arrow_bounds, | 228 void GetArrowPathFromArrowBounds(const gfx::Rect& arrow_bounds, |
| 229 SkPath* path) const; | 229 SkPath* path) const; |
| 230 void DrawArrow(gfx::Canvas* canvas, const gfx::Rect& arrow_bounds) const; | 230 void DrawArrow(gfx::Canvas* canvas, const gfx::Rect& arrow_bounds) const; |
| 231 | 231 |
| 232 void PaintMd(const View& view, gfx::Canvas* canvas); |
| 233 |
| 232 internal::BorderImages* GetImagesForTest() const; | 234 internal::BorderImages* GetImagesForTest() const; |
| 233 | 235 |
| 234 Arrow arrow_; | 236 Arrow arrow_; |
| 235 int arrow_offset_; | 237 int arrow_offset_; |
| 236 ArrowPaintType arrow_paint_type_; | 238 ArrowPaintType arrow_paint_type_; |
| 237 BubbleAlignment alignment_; | 239 BubbleAlignment alignment_; |
| 238 Shadow shadow_; | 240 Shadow shadow_; |
| 239 internal::BorderImages* images_; | 241 internal::BorderImages* images_; |
| 240 SkColor background_color_; | 242 SkColor background_color_; |
| 241 bool use_theme_background_color_; | 243 bool use_theme_background_color_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 254 | 256 |
| 255 private: | 257 private: |
| 256 BubbleBorder* border_; | 258 BubbleBorder* border_; |
| 257 | 259 |
| 258 DISALLOW_COPY_AND_ASSIGN(BubbleBackground); | 260 DISALLOW_COPY_AND_ASSIGN(BubbleBackground); |
| 259 }; | 261 }; |
| 260 | 262 |
| 261 } // namespace views | 263 } // namespace views |
| 262 | 264 |
| 263 #endif // UI_VIEWS_BUBBLE_BUBBLE_BORDER_H_ | 265 #endif // UI_VIEWS_BUBBLE_BUBBLE_BORDER_H_ |
| OLD | NEW |