OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 APP_GFX_CANVAS_H_ | 5 #ifndef APP_GFX_CANVAS_H_ |
6 #define APP_GFX_CANVAS_H_ | 6 #define APP_GFX_CANVAS_H_ |
7 | 7 |
8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif | 10 #endif |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 void DrawGdkPixbuf(GdkPixbuf* pixbuf, int x, int y); | 204 void DrawGdkPixbuf(GdkPixbuf* pixbuf, int x, int y); |
205 #endif | 205 #endif |
206 | 206 |
207 // Compute the size required to draw some text with the provided font. | 207 // Compute the size required to draw some text with the provided font. |
208 // Attempts to fit the text with the provided width and height. Increases | 208 // Attempts to fit the text with the provided width and height. Increases |
209 // height and then width as needed to make the text fit. This method | 209 // height and then width as needed to make the text fit. This method |
210 // supports multiple lines. | 210 // supports multiple lines. |
211 static void SizeStringInt(const std::wstring& test, const gfx::Font& font, | 211 static void SizeStringInt(const std::wstring& test, const gfx::Font& font, |
212 int *width, int* height, int flags); | 212 int *width, int* height, int flags); |
213 | 213 |
| 214 // Returns the default text alignment to be used when drawing text on a |
| 215 // gfx::Canvas based on the directionality of the system locale language. This |
| 216 // function is used by gfx::Canvas::DrawStringInt when the text alignment is |
| 217 // not specified. |
| 218 // |
| 219 // This function returns either gfx::Canvas::TEXT_ALIGN_LEFT or |
| 220 // gfx::Canvas::TEXT_ALIGN_RIGHT. |
| 221 static int DefaultCanvasTextAlignment(); |
| 222 |
214 private: | 223 private: |
215 #if defined(OS_WIN) | 224 #if defined(OS_WIN) |
216 // Draws text with the specified color, font and location. The text is | 225 // Draws text with the specified color, font and location. The text is |
217 // aligned to the left, vertically centered, clipped to the region. If the | 226 // aligned to the left, vertically centered, clipped to the region. If the |
218 // text is too big, it is truncated and '...' is added to the end. | 227 // text is too big, it is truncated and '...' is added to the end. |
219 void DrawStringInt(const std::wstring& text, HFONT font, | 228 void DrawStringInt(const std::wstring& text, HFONT font, |
220 const SkColor& color, int x, int y, int w, int h, | 229 const SkColor& color, int x, int y, int w, int h, |
221 int flags); | 230 int flags); |
222 #endif | 231 #endif |
223 | 232 |
224 DISALLOW_COPY_AND_ASSIGN(Canvas); | 233 DISALLOW_COPY_AND_ASSIGN(Canvas); |
225 }; | 234 }; |
226 | 235 |
227 } // namespace gfx; | 236 } // namespace gfx; |
228 | 237 |
229 #endif // APP_GFX_CANVAS_H_ | 238 #endif // APP_GFX_CANVAS_H_ |
OLD | NEW |