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

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, 6 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 MenuItemView* root = content_view_->GetMenuItem();
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
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
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