Add ICU message format support
[chromium-blink-merge.git] / ui / views / controls / table / table_utils.h
blobec387102e69807ae91e937fe5b039f56b41dbb41
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
3 // found in the LICENSE file.
5 #ifndef UI_VIEWS_CONTROLS_TABLE_TABLE_UTILS_H_
6 #define UI_VIEWS_CONTROLS_TABLE_TABLE_UTILS_H_
8 #include <vector>
10 #include "ui/base/models/table_model.h"
11 #include "ui/views/views_export.h"
13 namespace gfx {
14 class FontList;
17 namespace views {
19 class TableView;
21 VIEWS_EXPORT extern const int kUnspecifiedColumnWidth;
23 // Returns the width needed to display the contents of the specified column.
24 // This is used internally by CalculateTableColumnSizes() and generally not
25 // useful by itself. |header_padding| is padding added to the header.
26 VIEWS_EXPORT int WidthForContent(const gfx::FontList& header_font_list,
27 const gfx::FontList& content_font_list,
28 int padding,
29 int header_padding,
30 const ui::TableColumn& column,
31 ui::TableModel* model);
33 // Determines the width for each of the specified columns. |width| is the width
34 // to fit the columns into. |header_font_list| the font list used to draw the
35 // header and |content_font_list| the header used to draw the content. |padding|
36 // is extra horizontal spaced added to each cell, and |header_padding| added to
37 // the width needed for the header.
38 VIEWS_EXPORT std::vector<int> CalculateTableColumnSizes(
39 int width,
40 int first_column_padding,
41 const gfx::FontList& header_font_list,
42 const gfx::FontList& content_font_list,
43 int padding,
44 int header_padding,
45 const std::vector<ui::TableColumn>& columns,
46 ui::TableModel* model);
48 // Converts a TableColumn::Alignment to the alignment for drawing the string.
49 int TableColumnAlignmentToCanvasAlignment(ui::TableColumn::Alignment alignment);
51 // Returns the index of the closest visible column index to |x|. Return value is
52 // in terms of table->visible_columns().
53 int GetClosestVisibleColumnIndex(const TableView* table, int x);
55 } // namespace views
57 #endif // UI_VIEWS_CONTROLS_TABLE_TABLE_UTILS_H_