Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(547)

Side by Side Diff: ui/views/controls/menu/menu_scroll_view_container.cc

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
Patch Set: Added support for icon views (view used instead of icon in a menu item). Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 MenuDelegate* delegate = content_view_->GetMenuItem()->GetDelegate();
169 MenuConfig::instance().submenu_vertical_margin_size, 169 if (delegate) {
170 MenuConfig::instance().submenu_horizontal_margin_size, 170 set_border(delegate->CreateMenuBorder());
171 MenuConfig::instance().submenu_vertical_margin_size, 171 set_background(delegate->CreateMenuBackground());
172 MenuConfig::instance().submenu_horizontal_margin_size)); 172 }
173 } 173 }
174 174
175 void MenuScrollViewContainer::OnPaintBackground(gfx::Canvas* canvas) { 175 void MenuScrollViewContainer::OnPaintBackground(gfx::Canvas* canvas) {
176 if (background()) { 176 if (background()) {
177 View::OnPaintBackground(canvas); 177 View::OnPaintBackground(canvas);
178 return; 178 return;
179 } 179 }
180 180
181 #if defined(OS_WIN) 181 #if defined(OS_WIN)
182 HDC dc = canvas->BeginPlatformPaint(); 182 HDC dc = canvas->BeginPlatformPaint();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 void MenuScrollViewContainer::OnBoundsChanged( 239 void MenuScrollViewContainer::OnBoundsChanged(
240 const gfx::Rect& previous_bounds) { 240 const gfx::Rect& previous_bounds) {
241 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize(); 241 gfx::Size content_pref = scroll_view_->GetContents()->GetPreferredSize();
242 scroll_up_button_->SetVisible(content_pref.height() > height()); 242 scroll_up_button_->SetVisible(content_pref.height() > height());
243 scroll_down_button_->SetVisible(content_pref.height() > height()); 243 scroll_down_button_->SetVisible(content_pref.height() > height());
244 Layout(); 244 Layout();
245 } 245 }
246 246
247 } // namespace views 247 } // namespace views
OLDNEW
« ui/views/controls/menu/menu_item_view_win.cc ('K') | « ui/views/controls/menu/menu_item_view_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698