diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-17 22:25:33 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-17 22:25:33 +0000 |
commit | 6f3bb6ca5a2e423fc9dda71c164c7e8ae2a8eae7 (patch) | |
tree | 4ce1316dbfd179681bdff905a7d71f1b4cbb902c /chrome/views/chrome_menu.cc | |
parent | 4c45708be10906e3cdbe9d40d206cfd3fcbaf1c2 (diff) | |
download | chromium_src-6f3bb6ca5a2e423fc9dda71c164c7e8ae2a8eae7.zip chromium_src-6f3bb6ca5a2e423fc9dda71c164c7e8ae2a8eae7.tar.gz chromium_src-6f3bb6ca5a2e423fc9dda71c164c7e8ae2a8eae7.tar.bz2 |
Rename legacy methods that were in CamelCase to unix_hacker.
Required going through and modifying some of the code to
solve name clashes.
Review URL: http://codereview.chromium.org/2945
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2337 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/chrome_menu.cc')
-rw-r--r-- | chrome/views/chrome_menu.cc | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/chrome/views/chrome_menu.cc b/chrome/views/chrome_menu.cc index 33452cd..360f8c4 100644 --- a/chrome/views/chrome_menu.cc +++ b/chrome/views/chrome_menu.cc @@ -175,7 +175,7 @@ namespace { // Convenience for scrolling the view such that the origin is visible. static void ScrollToVisible(View* view) { - view->ScrollRectToVisible(0, 0, view->GetWidth(), view->GetHeight()); + view->ScrollRectToVisible(0, 0, view->width(), view->height()); } // MenuScrollTask -------------------------------------------------------------- @@ -234,7 +234,7 @@ public: if (is_scrolling_up_) target_y = std::max(0, target_y - delta_y); else - target_y = std::min(submenu_->GetHeight() - vis_rect.height(), + target_y = std::min(submenu_->height() - vis_rect.height(), target_y + delta_y); submenu_->ScrollRectToVisible(vis_rect.x(), target_y, vis_rect.width(), vis_rect.height()); @@ -309,14 +309,14 @@ class MenuScrollButton : public View { HDC dc = canvas->beginPlatformPaint(); // The background. - RECT item_bounds = { 0, 0, GetWidth(), GetHeight() }; + RECT item_bounds = { 0, 0, width(), height() }; NativeTheme::instance()->PaintMenuItemBackground( NativeTheme::MENU, dc, MENU_POPUPITEM, MPI_NORMAL, false, &item_bounds); // Then the arrow. - int x = GetWidth() / 2; - int y = (GetHeight() - kScrollArrowHeight) / 2; + int x = width() / 2; + int y = (height() - kScrollArrowHeight) / 2; int delta_y = 1; if (!is_up_) { delta_y = -1; @@ -363,11 +363,11 @@ class MenuScrollView : public View { View* child = GetContents(); // Convert y to view's coordinates. - y -= child->GetY(); + y -= child->y(); CSize pref; child->GetPreferredSize(&pref); // Constrain y to make sure we don't show past the bottom of the view. - y = std::max(0, std::min(static_cast<int>(pref.cy) - GetHeight(), y)); + y = std::max(0, std::min(static_cast<int>(pref.cy) - this->height(), y)); child->SetY(-y); } @@ -403,7 +403,7 @@ class MenuScrollViewContainer : public View { virtual void Paint(ChromeCanvas* canvas) { HDC dc = canvas->beginPlatformPaint(); - CRect bounds(0, 0, GetWidth(), GetHeight()); + CRect bounds(0, 0, width(), height()); NativeTheme::instance()->PaintMenuBackground( NativeTheme::MENU, dc, MENU_POPUPBACKGROUND, 0, &bounds); canvas->endPlatformPaint(); @@ -417,8 +417,8 @@ class MenuScrollViewContainer : public View { gfx::Insets insets = GetInsets(); int x = insets.left(); int y = insets.top(); - int width = GetWidth() - insets.width(); - int content_height = GetHeight() - insets.height(); + int width = View::width() - insets.width(); + int content_height = height() - insets.height(); if (!scroll_up_button_->IsVisible()) { scroll_view_->SetBounds(x, y, width, content_height); scroll_view_->Layout(); @@ -433,7 +433,7 @@ class MenuScrollViewContainer : public View { const int scroll_view_y = y + pref.cy; scroll_down_button_->GetPreferredSize(&pref); - scroll_down_button_->SetBounds(x, GetHeight() - pref.cy - insets.top(), + scroll_down_button_->SetBounds(x, height() - pref.cy - insets.top(), width, pref.cy); content_height -= pref.cy; @@ -444,8 +444,8 @@ class MenuScrollViewContainer : public View { virtual void DidChangeBounds(const CRect& previous, const CRect& current) { CSize content_pref; scroll_view_->GetContents()->GetPreferredSize(&content_pref); - scroll_up_button_->SetVisible(content_pref.cy > GetHeight()); - scroll_down_button_->SetVisible(content_pref.cy > GetHeight()); + scroll_up_button_->SetVisible(content_pref.cy > height()); + scroll_down_button_->SetVisible(content_pref.cy > height()); } virtual void GetPreferredSize(CSize* out) { @@ -478,20 +478,20 @@ class MenuSeparator : public View { void Paint(ChromeCanvas* canvas) { // The gutter is rendered before the background. int start_x = 0; - int start_y = GetHeight() / 3; + int start_y = height() / 3; HDC dc = canvas->beginPlatformPaint(); if (render_gutter) { // If render_gutter is true, we're on Vista and need to render the // gutter, then indent the separator from the gutter. RECT gutter_bounds = { label_start - kGutterToLabel - gutter_width, 0, 0, - GetHeight() }; + height() }; gutter_bounds.right = gutter_bounds.left + gutter_width; NativeTheme::instance()->PaintMenuGutter(dc, MENU_POPUPGUTTER, MPI_NORMAL, &gutter_bounds); start_x = gutter_bounds.left + gutter_width; start_y = 0; } - RECT separator_bounds = { start_x, start_y, GetWidth(), GetHeight() }; + RECT separator_bounds = { start_x, start_y, width(), height() }; NativeTheme::instance()->PaintMenuSeparator(dc, MENU_POPUPSEPARATOR, MPI_NORMAL, &separator_bounds); canvas->endPlatformPaint(); @@ -533,8 +533,8 @@ class MenuHostRootView : public RootView { return true; forward_drag_to_menu_controller_ = - ((event.GetX() < 0 || event.GetY() < 0 || event.GetX() >= GetWidth() || - event.GetY() >= GetHeight()) || + ((event.x() < 0 || event.y() < 0 || event.x() >= width() || + event.y() >= height()) || !RootView::OnMousePressed(event)); if (forward_drag_to_menu_controller_) GetMenuController()->OnMousePressed(submenu_, event); @@ -801,12 +801,12 @@ void SubmenuView::Layout() { return; CSize pref; GetPreferredSize(&pref); - SetBounds(GetX(), GetY(), parent->GetWidth(), pref.cy); + SetBounds(x(), y(), parent->width(), pref.cy); gfx::Insets insets = GetInsets(); int x = insets.left(); int y = insets.top(); - int menu_item_width = GetWidth() - insets.width(); + int menu_item_width = width() - insets.width(); for (int i = 0; i < GetChildViewCount(); ++i) { View* child = GetChildViewAt(i); CSize child_pref_size; @@ -874,7 +874,7 @@ int SubmenuView::OnPerformDrop(const DropTargetEvent& event) { bool SubmenuView::OnMouseWheel(const MouseWheelEvent& e) { gfx::Rect vis_bounds = GetVisibleBounds(); int menu_item_count = GetMenuItemCount(); - if (vis_bounds.height() == GetHeight() || !menu_item_count) { + if (vis_bounds.height() == height() || !menu_item_count) { // All menu items are visible, nothing to scroll. return true; } @@ -884,10 +884,10 @@ bool SubmenuView::OnMouseWheel(const MouseWheelEvent& e) { int first_vis_index = -1; for (int i = 0; i < menu_item_count; ++i) { MenuItemView* menu_item = GetMenuItemAt(i); - if (menu_item->GetY() == vis_bounds.y()) { + if (menu_item->y() == vis_bounds.y()) { first_vis_index = i; break; - } else if (menu_item->GetY() > vis_bounds.y()) { + } else if (menu_item->y() > vis_bounds.y()) { first_vis_index = std::max(0, i - 1); break; } @@ -902,23 +902,23 @@ bool SubmenuView::OnMouseWheel(const MouseWheelEvent& e) { while (delta-- > 0) { int scroll_amount = 0; if (scroll_up) { - if (GetMenuItemAt(first_vis_index)->GetY() == vis_bounds.y()) { + if (GetMenuItemAt(first_vis_index)->y() == vis_bounds.y()) { if (first_vis_index != 0) { - scroll_amount = GetMenuItemAt(first_vis_index - 1)->GetY() - + scroll_amount = GetMenuItemAt(first_vis_index - 1)->y() - vis_bounds.y(); first_vis_index--; } else { break; } } else { - scroll_amount = GetMenuItemAt(first_vis_index)->GetY() - vis_bounds.y(); + scroll_amount = GetMenuItemAt(first_vis_index)->y() - vis_bounds.y(); } } else { if (first_vis_index + 1 == GetMenuItemCount()) break; - scroll_amount = GetMenuItemAt(first_vis_index + 1)->GetY() - + scroll_amount = GetMenuItemAt(first_vis_index + 1)->y() - vis_bounds.y(); - if (GetMenuItemAt(first_vis_index)->GetY() == vis_bounds.y()) + if (GetMenuItemAt(first_vis_index)->y() == vis_bounds.y()) first_vis_index++; } ScrollRectToVisible(0, vis_bounds.y() + scroll_amount, vis_bounds.width(), @@ -1362,7 +1362,7 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) { // The gutter is rendered before the background. if (render_gutter && !for_drag) { RECT gutter_bounds = { label_start - kGutterToLabel - gutter_width, 0, 0, - GetHeight() }; + height() }; gutter_bounds.right = gutter_bounds.left + gutter_width; AdjustBoundsForRTLUI(&gutter_bounds); NativeTheme::instance()->PaintMenuGutter(dc, MENU_POPUPGUTTER, MPI_NORMAL, &gutter_bounds); @@ -1370,7 +1370,7 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) { // Render the background. if (!for_drag) { - RECT item_bounds = { 0, 0, GetWidth(), GetHeight() }; + RECT item_bounds = { 0, 0, width(), height() }; AdjustBoundsForRTLUI(&item_bounds); NativeTheme::instance()->PaintMenuItemBackground( NativeTheme::MENU, dc, MENU_POPUPITEM, state, render_selection, @@ -1378,14 +1378,14 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) { } int icon_x = kItemLeftMargin; - int icon_y = kItemTopMargin + (GetHeight() - kItemTopMargin - + int icon_y = kItemTopMargin + (height() - kItemTopMargin - kItemBottomMargin - check_height) / 2; int icon_height = check_height; int icon_width = check_width; if (type_ == CHECKBOX && GetDelegate()->IsItemChecked(GetCommand())) { // Draw the check background. - RECT check_bg_bounds = { 0, 0, icon_x + icon_width, GetHeight() }; + RECT check_bg_bounds = { 0, 0, icon_x + icon_width, height() }; const int bg_state = IsEnabled() ? MCB_NORMAL : MCB_DISABLED; AdjustBoundsForRTLUI(&check_bg_bounds); NativeTheme::instance()->PaintMenuCheckBackground( @@ -1410,7 +1410,7 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) { (IsEnabled() ? COLOR_MENUTEXT : COLOR_GRAYTEXT); SkColor fg_color = NativeTheme::instance()->GetThemeColorWithDefault( NativeTheme::MENU, MENU_POPUPITEM, state, TMT_TEXTCOLOR, default_sys_color); - int width = GetWidth() - item_right_margin - label_start; + int width = this->width() - item_right_margin - label_start; gfx::Rect text_bounds(label_start, kItemTopMargin, width, font_.height()); text_bounds.set_x(MirroredLeftPointForRect(text_bounds)); canvas->DrawStringInt(GetTitle(), font_, fg_color, text_bounds.x(), @@ -1420,7 +1420,7 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) { if (icon_.width() > 0) { gfx::Rect icon_bounds(kItemLeftMargin, - kItemTopMargin + (GetHeight() - kItemTopMargin - + kItemTopMargin + (height() - kItemTopMargin - kItemBottomMargin - icon_.height()) / 2, icon_.width(), icon_.height()); @@ -1430,8 +1430,8 @@ void MenuItemView::Paint(ChromeCanvas* canvas, bool for_drag) { if (HasSubmenu()) { int state_id = IsEnabled() ? MSM_NORMAL : MSM_DISABLED; - RECT arrow_bounds = { GetWidth() - item_right_margin + kLabelToArrowPadding, - 0, 0, GetHeight() }; + RECT arrow_bounds = { this->width() - item_right_margin + kLabelToArrowPadding, + 0, 0, height() }; arrow_bounds.right = arrow_bounds.left + arrow_width; AdjustBoundsForRTLUI(&arrow_bounds); @@ -1662,7 +1662,7 @@ void MenuController::OnMousePressed(SubmenuView* source, return; MenuPart part = - GetMenuPartByScreenCoordinate(source, event.GetX(), event.GetY()); + GetMenuPartByScreenCoordinate(source, event.x(), event.y()); if (part.is_scroll()) return; // Ignore presses on scroll buttons. @@ -1690,8 +1690,8 @@ void MenuController::OnMousePressed(SubmenuView* source, } else { if (part.menu->GetDelegate()->CanDrag(part.menu)) { possible_drag_ = true; - press_x_ = event.GetX(); - press_y_ = event.GetY(); + press_x_ = event.x(); + press_y_ = event.y(); } if (part.menu->HasSubmenu()) open_submenu = true; @@ -1707,15 +1707,15 @@ void MenuController::OnMouseDragged(SubmenuView* source, DLOG(INFO) << "OnMouseDragged source=" << source; #endif MenuPart part = - GetMenuPartByScreenCoordinate(source, event.GetX(), event.GetY()); + GetMenuPartByScreenCoordinate(source, event.x(), event.y()); UpdateScrolling(part); if (!blocking_run_) return; if (possible_drag_) { - if (ChromeViews::View::ExceededDragThreshold(event.GetX() - press_x_, - event.GetY() - press_y_)) { + if (ChromeViews::View::ExceededDragThreshold(event.x() - press_x_, + event.y() - press_y_)) { MenuItemView* item = state_.item; DCHECK(item); // Points are in the coordinates of the submenu, need to map to that of @@ -1724,17 +1724,17 @@ void MenuController::OnMouseDragged(SubmenuView* source, CPoint press_loc(press_x_, press_y_); View::ConvertPointToScreen(source->GetScrollViewContainer(), &press_loc); View::ConvertPointToView(NULL, item, &press_loc); - CPoint drag_loc(event.GetX(), event.GetY()); + CPoint drag_loc(event.x(), event.y()); View::ConvertPointToScreen(source->GetScrollViewContainer(), &drag_loc); View::ConvertPointToView(NULL, item, &drag_loc); in_drag_ = true; - ChromeCanvas canvas(item->GetWidth(), item->GetHeight(), false); + ChromeCanvas canvas(item->width(), item->height(), false); item->Paint(&canvas, true); scoped_refptr<OSExchangeData> data(new OSExchangeData); item->GetDelegate()->WriteDragData(item, data.get()); - drag_utils::SetDragImageOnDataObject(canvas, item->GetWidth(), - item->GetHeight(), press_loc.x, + drag_utils::SetDragImageOnDataObject(canvas, item->width(), + item->height(), press_loc.x, press_loc.y, data); scoped_refptr<BaseDragSource> drag_source(new BaseDragSource); @@ -1774,7 +1774,7 @@ void MenuController::OnMouseReleased(SubmenuView* source, possible_drag_ = false; DCHECK(blocking_run_); MenuPart part = - GetMenuPartByScreenCoordinate(source, event.GetX(), event.GetY()); + GetMenuPartByScreenCoordinate(source, event.x(), event.y()); any_menu_contains_mouse_ = (part.type == MenuPart::MENU_ITEM); if (event.IsRightMouseButton() && (part.type == MenuPart::MENU_ITEM && part.menu)) { @@ -1783,7 +1783,7 @@ void MenuController::OnMouseReleased(SubmenuView* source, bool open_submenu = (state_.item == pending_state_.item && state_.submenu_open); SetSelection(pending_state_.item, open_submenu, true); - CPoint loc(event.GetX(), event.GetY()); + CPoint loc(event.x(), event.y()); View::ConvertPointToScreen(source->GetScrollViewContainer(), &loc); // If we open a context menu just return now @@ -1812,7 +1812,7 @@ void MenuController::OnMouseMoved(SubmenuView* source, return; MenuPart part = - GetMenuPartByScreenCoordinate(source, event.GetX(), event.GetY()); + GetMenuPartByScreenCoordinate(source, event.x(), event.y()); UpdateScrolling(part); @@ -1853,7 +1853,7 @@ int MenuController::OnDragUpdated(SubmenuView* source, const DropTargetEvent& event) { StopCancelAllTimer(); - CPoint screen_loc(event.GetX(), event.GetY()); + CPoint screen_loc(event.x(), event.y()); View::ConvertPointToScreen(source, &screen_loc); if (valid_drop_coordinates_ && screen_loc.x == drop_x_ && screen_loc.y == drop_y_) { @@ -1863,22 +1863,22 @@ int MenuController::OnDragUpdated(SubmenuView* source, drop_y_ = screen_loc.y; valid_drop_coordinates_ = true; - MenuItemView* menu_item = GetMenuItemAt(source, event.GetX(), event.GetY()); + MenuItemView* menu_item = GetMenuItemAt(source, event.x(), event.y()); bool over_empty_menu = false; if (!menu_item) { // See if we're over an empty menu. - menu_item = GetEmptyMenuItemAt(source, event.GetX(), event.GetY()); + menu_item = GetEmptyMenuItemAt(source, event.x(), event.y()); if (menu_item) over_empty_menu = true; } MenuDelegate::DropPosition drop_position = MenuDelegate::DROP_NONE; int drop_operation = DragDropTypes::DRAG_NONE; if (menu_item) { - CPoint menu_item_loc(event.GetX(), event.GetY()); + CPoint menu_item_loc(event.x(), event.y()); View::ConvertPointToView(source, menu_item, &menu_item_loc); MenuItemView* query_menu_item; if (!over_empty_menu) { - int menu_item_height = menu_item->GetHeight(); + int menu_item_height = menu_item->height(); if (menu_item->HasSubmenu() && (menu_item_loc.y > MenuItemView::kDropBetweenPixels && menu_item_loc.y < (menu_item_height - @@ -2201,9 +2201,9 @@ bool MenuController::GetMenuPartByScreenCoordinateImpl( View* scroll_view_container = menu->GetScrollViewContainer(); View::ConvertPointToView(NULL, scroll_view_container, &scroll_view_loc); if (scroll_view_loc.x < 0 || - scroll_view_loc.x >= scroll_view_container->GetWidth() || + scroll_view_loc.x >= scroll_view_container->width() || scroll_view_loc.y < 0 || - scroll_view_loc.y >= scroll_view_container->GetHeight()) { + scroll_view_loc.y >= scroll_view_container->height()) { // Point isn't contained in menu. return false; } @@ -2452,7 +2452,7 @@ gfx::Rect MenuController::CalculateMenuBounds(MenuItemView* item, (!prefer_leading && layout_is_rtl); if (create_on_the_right) { - x = item_loc.x + item->GetWidth() - kSubmenuHorizontalInset; + x = item_loc.x + item->width() - kSubmenuHorizontalInset; if (state_.monitor_bounds.width() != 0 && x + pref.cx > state_.monitor_bounds.right()) { if (layout_is_rtl) @@ -2468,7 +2468,7 @@ gfx::Rect MenuController::CalculateMenuBounds(MenuItemView* item, *is_leading = false; else *is_leading = true; - x = item_loc.x + item->GetWidth() - kSubmenuHorizontalInset; + x = item_loc.x + item->width() - kSubmenuHorizontalInset; } } y = item_loc.y - kSubmenuBorderSize; @@ -2622,7 +2622,7 @@ bool MenuController::SelectByChar(wchar_t character) { void MenuController::RepostEvent(SubmenuView* source, const MouseEvent& event) { - CPoint screen_loc(event.GetX(), event.GetY()); + CPoint screen_loc(event.x(), event.y()); View::ConvertPointToScreen(source->GetScrollViewContainer(), &screen_loc); HWND window = WindowFromPoint(screen_loc); if (window) { |