diff options
Diffstat (limited to 'views/controls/table')
-rw-r--r-- | views/controls/table/group_table_view.cc | 15 | ||||
-rw-r--r-- | views/controls/table/group_table_view.h | 2 | ||||
-rw-r--r-- | views/controls/table/table_view.cc | 27 | ||||
-rw-r--r-- | views/controls/table/table_view.h | 3 |
4 files changed, 27 insertions, 20 deletions
diff --git a/views/controls/table/group_table_view.cc b/views/controls/table/group_table_view.cc index 5e6a155..b5d5698 100644 --- a/views/controls/table/group_table_view.cc +++ b/views/controls/table/group_table_view.cc @@ -5,6 +5,7 @@ #include "views/controls/table/group_table_view.h" #include "app/gfx/chrome_canvas.h" +#include "base/compiler_specific.h" #include "base/message_loop.h" #include "base/task.h" @@ -24,7 +25,7 @@ GroupTableView::GroupTableView(GroupTableModel* model, : TableView(model, columns, table_type, false, resizable_columns, autosize_columns), model_(model), - sync_selection_factory_(this) { + ALLOW_THIS_IN_INITIALIZER_LIST(sync_selection_factory_(this)) { } GroupTableView::~GroupTableView() { @@ -165,22 +166,22 @@ void GroupTableView::OnSelectedStateChanged() { // Draws the line separator betweens the groups. void GroupTableView::PostPaint(int model_row, int column, bool selected, - const CRect& bounds, HDC hdc) { + const gfx::Rect& bounds, HDC hdc) { GroupRange group_range; model_->GetGroupRangeForItem(model_row, &group_range); // We always paint a vertical line at the end of the last cell. HPEN hPen = CreatePen(PS_SOLID, kSeparatorLineThickness, kSeparatorLineColor); HPEN hPenOld = (HPEN) SelectObject(hdc, hPen); - int x = static_cast<int>(bounds.right - kSeparatorLineThickness); - MoveToEx(hdc, x, bounds.top, NULL); - LineTo(hdc, x, bounds.bottom); + int x = static_cast<int>(bounds.right() - kSeparatorLineThickness); + MoveToEx(hdc, x, bounds.y(), NULL); + LineTo(hdc, x, bounds.bottom()); // We paint a separator line after the last item of a group. if (model_row == (group_range.start + group_range.length - 1)) { - int y = static_cast<int>(bounds.bottom - kSeparatorLineThickness); + int y = static_cast<int>(bounds.bottom() - kSeparatorLineThickness); MoveToEx(hdc, 0, y, NULL); - LineTo(hdc, bounds.Width(), y); + LineTo(hdc, bounds.width(), y); } SelectObject(hdc, hPenOld); DeleteObject(hPen); diff --git a/views/controls/table/group_table_view.h b/views/controls/table/group_table_view.h index d128759..e581d5d 100644 --- a/views/controls/table/group_table_view.h +++ b/views/controls/table/group_table_view.h @@ -48,7 +48,7 @@ class GroupTableView : public TableView { // Extra-painting required to draw the separator line between groups. virtual bool ImplementPostPaint() { return true; } virtual void PostPaint(int model_row, int column, bool selected, - const CRect& bounds, HDC device_context); + const gfx::Rect& bounds, HDC device_context); // In order to make keyboard navigation possible (using the Up and Down // keys), we must take action when an arrow key is pressed. The reason we diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc index 10c0456..a476da3 100644 --- a/views/controls/table/table_view.cc +++ b/views/controls/table/table_view.cc @@ -4,8 +4,12 @@ #include "views/controls/table/table_view.h" -#include <algorithm> #include <windowsx.h> +#include <atlbase.h> +#include <atlapp.h> +#include <atlmisc.h> + +#include <algorithm> #include "app/gfx/chrome_canvas.h" #include "app/gfx/favicon_size.h" @@ -95,7 +99,7 @@ TableView::TableView(TableModel* model, list_view_(NULL), header_original_handler_(NULL), original_handler_(NULL), - table_view_wrapper_(this), + ALLOW_THIS_IN_INITIALIZER_LIST(table_view_wrapper_(this)), custom_cell_font_(NULL), content_offset_(0) { for (std::vector<TableColumn>::const_iterator i = columns.begin(); @@ -574,10 +578,10 @@ LRESULT CALLBACK TableView::TableWndProc(HWND window, // the position supplied in the l_param. if (table_view->UILayoutIsRightToLeft() && (GET_X_LPARAM(l_param) != -1 || GET_Y_LPARAM(l_param) != -1)) { - CPoint screen_point; + WTL::CPoint screen_point; GetCursorPos(&screen_point); - CPoint table_point = screen_point; - CRect client_rect; + WTL::CPoint table_point = screen_point; + WTL::CRect client_rect; if (ScreenToClient(window, &table_point) && GetClientRect(window, &client_rect) && client_rect.PtInRect(table_point)) { @@ -1231,11 +1235,11 @@ LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { SkBitmap image = model_->GetIcon(model_index); if (!image.isNull()) { // Get the rect that holds the icon. - CRect icon_rect, client_rect; + WTL::CRect icon_rect, client_rect; if (ListView_GetItemRect(list_view_, view_index, &icon_rect, LVIR_ICON) && GetClientRect(list_view_, &client_rect)) { - CRect intersection; + WTL::CRect intersection; // Client rect includes the header but we need to make sure we don't // paint into it. client_rect.top += content_offset_; @@ -1287,10 +1291,11 @@ LRESULT TableView::OnCustomDraw(NMLVCUSTOMDRAW* draw_info) { } } if (ImplementPostPaint()) { - CRect cell_rect; + WTL::CRect cell_rect; if (ListView_GetItemRect(list_view_, view_index, &cell_rect, LVIR_BOUNDS)) { - PostPaint(model_index, 0, false, cell_rect, draw_info->nmcd.hdc); + PostPaint(model_index, 0, false, gfx::Rect(cell_rect), + draw_info->nmcd.hdc); r = CDRF_SKIPDEFAULT; } } @@ -1313,7 +1318,7 @@ void TableView::ResetColumnSizes() { // See comment in TableColumn for what this does. int width = this->width(); - CRect native_bounds; + WTL::CRect native_bounds; if (GetClientRect(GetNativeControlHWND(), &native_bounds) && native_bounds.Width() > 0) { // Prefer the bounds of the window over our bounds, which may be different. @@ -1524,7 +1529,7 @@ void TableView::UpdateContentOffset() { POINT origin = {0, 0}; MapWindowPoints(header, list_view_, &origin, 1); - CRect header_bounds; + WTL::CRect header_bounds; GetWindowRect(header, &header_bounds); content_offset_ = origin.y + header_bounds.Height(); diff --git a/views/controls/table/table_view.h b/views/controls/table/table_view.h index 2db5234..da228fc 100644 --- a/views/controls/table/table_view.h +++ b/views/controls/table/table_view.h @@ -9,6 +9,7 @@ #if defined(OS_WIN) #include <windows.h> +typedef struct tagNMLVCUSTOMDRAW NMLVCUSTOMDRAW; #endif // defined(OS_WIN) #include <map> @@ -470,7 +471,7 @@ class TableView : public NativeControl, virtual bool ImplementPostPaint() { return false; } // Subclasses can implement in this method extra-painting for cells. virtual void PostPaint(int model_row, int column, bool selected, - const CRect& bounds, HDC device_context) { } + const gfx::Rect& bounds, HDC device_context) { } virtual void PostPaint() {} virtual HWND CreateNativeControl(HWND parent_container); |