 Chromium Code Reviews
 Chromium Code Reviews Issue 10532171:
  Added support for icon views (view used instead of icon in a menu item).  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 10532171:
  Added support for icon views (view used instead of icon in a menu item).  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| 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 #include "ui/views/controls/menu/menu_scroll_view_container.h" | 5 #include "ui/views/controls/menu/menu_scroll_view_container.h" | 
| 6 | 6 | 
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) | 
| 8 #include <windows.h> | 8 #include <windows.h> | 
| 9 #include <uxtheme.h> | 9 #include <uxtheme.h> | 
| 10 #include <Vssym32.h> | 10 #include <Vssym32.h> | 
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 MenuScrollViewContainer::MenuScrollViewContainer(SubmenuView* content_view) | 158 MenuScrollViewContainer::MenuScrollViewContainer(SubmenuView* content_view) | 
| 159 : content_view_(content_view) { | 159 : content_view_(content_view) { | 
| 160 scroll_up_button_ = new MenuScrollButton(content_view, true); | 160 scroll_up_button_ = new MenuScrollButton(content_view, true); | 
| 161 scroll_down_button_ = new MenuScrollButton(content_view, false); | 161 scroll_down_button_ = new MenuScrollButton(content_view, false); | 
| 162 AddChildView(scroll_up_button_); | 162 AddChildView(scroll_up_button_); | 
| 163 AddChildView(scroll_down_button_); | 163 AddChildView(scroll_down_button_); | 
| 164 | 164 | 
| 165 scroll_view_ = new MenuScrollView(content_view); | 165 scroll_view_ = new MenuScrollView(content_view); | 
| 166 AddChildView(scroll_view_); | 166 AddChildView(scroll_view_); | 
| 167 | 167 | 
| 168 set_border(Border::CreateEmptyBorder( | 168 MenuItemView* root = content_view_->GetMenuItem(); | 
| 
sky
2012/06/20 21:52:40
This won't propagate to children and I don't like
 | |
| 169 MenuConfig::instance().submenu_vertical_margin_size, | 169 set_border(root->GetMenuBorder()); | 
| 170 MenuConfig::instance().submenu_horizontal_margin_size, | 170 set_background(root->GetMenuBackground()); | 
| 171 MenuConfig::instance().submenu_vertical_margin_size, | |
| 172 MenuConfig::instance().submenu_horizontal_margin_size)); | |
| 173 } | 171 } | 
| 174 | 172 | 
| 175 void MenuScrollViewContainer::OnPaintBackground(gfx::Canvas* canvas) { | 173 void MenuScrollViewContainer::OnPaintBackground(gfx::Canvas* canvas) { | 
| 176 if (background()) { | 174 if (background()) { | 
| 177 View::OnPaintBackground(canvas); | 175 View::OnPaintBackground(canvas); | 
| 178 return; | 176 return; | 
| 179 } | 177 } | 
| 180 | 178 | 
| 181 #if defined(OS_WIN) | 179 #if defined(OS_WIN) | 
| 182 HDC dc = canvas->BeginPlatformPaint(); | 180 HDC dc = canvas->BeginPlatformPaint(); | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 | 236 | 
| 239 void MenuScrollViewContainer::OnBoundsChanged( | 237 void MenuScrollViewContainer::OnBoundsChanged( | 
| 240 const gfx::Rect& previous_bounds) { | 238 const gfx::Rect& previous_bounds) { | 
| 241 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); | 239 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); | 
| 242 scroll_up_button_->SetVisible(content_pref.height() > height()); | 240 scroll_up_button_->SetVisible(content_pref.height() > height()); | 
| 243 scroll_down_button_->SetVisible(content_pref.height() > height()); | 241 scroll_down_button_->SetVisible(content_pref.height() > height()); | 
| 244 Layout(); | 242 Layout(); | 
| 245 } | 243 } | 
| 246 | 244 | 
| 247 } // namespace views | 245 } // namespace views | 
| OLD | NEW |