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

Side by Side Diff: views/controls/menu/chrome_menu.h

Issue 113443: ChromeCanvas->gfx::Canvas (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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
« no previous file with comments | « views/controls/link.cc ('k') | views/controls/menu/chrome_menu.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef VIEWS_CONTROLS_MENU_CHROME_MENU_H_ 5 #ifndef VIEWS_CONTROLS_MENU_CHROME_MENU_H_
6 #define VIEWS_CONTROLS_MENU_CHROME_MENU_H_ 6 #define VIEWS_CONTROLS_MENU_CHROME_MENU_H_
7 7
8 #include <list> 8 #include <list>
9 #include <vector> 9 #include <vector>
10 10
11 #include "app/drag_drop_types.h" 11 #include "app/drag_drop_types.h"
12 #include "app/gfx/chrome_font.h" 12 #include "app/gfx/font.h"
13 #include "base/gfx/point.h" 13 #include "base/gfx/point.h"
14 #include "base/gfx/rect.h" 14 #include "base/gfx/rect.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "base/task.h" 16 #include "base/task.h"
17 #include "third_party/skia/include/core/SkBitmap.h" 17 #include "third_party/skia/include/core/SkBitmap.h"
18 #include "views/controls/menu/controller.h" 18 #include "views/controls/menu/controller.h"
19 #include "views/event.h" 19 #include "views/event.h"
20 #include "views/view.h" 20 #include "views/view.h"
21 21
22 namespace views { 22 namespace views {
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // Returns the icon. 345 // Returns the icon.
346 const SkBitmap& GetIcon() const { return icon_; } 346 const SkBitmap& GetIcon() const { return icon_; }
347 347
348 // Sets the command id of this menu item. 348 // Sets the command id of this menu item.
349 void SetCommand(int command) { command_ = command; } 349 void SetCommand(int command) { command_ = command; }
350 350
351 // Returns the command id of this item. 351 // Returns the command id of this item.
352 int GetCommand() const { return command_; } 352 int GetCommand() const { return command_; }
353 353
354 // Paints the menu item. 354 // Paints the menu item.
355 virtual void Paint(ChromeCanvas* canvas); 355 virtual void Paint(gfx::Canvas* canvas);
356 356
357 // Returns the preferred size of this item. 357 // Returns the preferred size of this item.
358 virtual gfx::Size GetPreferredSize(); 358 virtual gfx::Size GetPreferredSize();
359 359
360 // Returns the object responsible for controlling showing the menu. 360 // Returns the object responsible for controlling showing the menu.
361 MenuController* GetMenuController(); 361 MenuController* GetMenuController();
362 362
363 // Returns the delegate. This returns the delegate of the root menu item. 363 // Returns the delegate. This returns the delegate of the root menu item.
364 MenuDelegate* GetDelegate(); 364 MenuDelegate* GetDelegate();
365 365
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 414
415 // Undoes the work of AddEmptyMenus. 415 // Undoes the work of AddEmptyMenus.
416 void RemoveEmptyMenus(); 416 void RemoveEmptyMenus();
417 417
418 // Given bounds within our View, this helper routine mirrors the bounds if 418 // Given bounds within our View, this helper routine mirrors the bounds if
419 // necessary. 419 // necessary.
420 void AdjustBoundsForRTLUI(RECT* rect) const; 420 void AdjustBoundsForRTLUI(RECT* rect) const;
421 421
422 // Actual paint implementation. If for_drag is true, portions of the menu 422 // Actual paint implementation. If for_drag is true, portions of the menu
423 // are not rendered. 423 // are not rendered.
424 void Paint(ChromeCanvas* canvas, bool for_drag); 424 void Paint(gfx::Canvas* canvas, bool for_drag);
425 425
426 // Destroys the window used to display this menu and recursively destroys 426 // Destroys the window used to display this menu and recursively destroys
427 // the windows used to display all descendants. 427 // the windows used to display all descendants.
428 void DestroyAllMenuHosts(); 428 void DestroyAllMenuHosts();
429 429
430 // Returns the various margins. 430 // Returns the various margins.
431 int GetTopMargin(); 431 int GetTopMargin();
432 int GetBottomMargin(); 432 int GetBottomMargin();
433 433
434 // The delegate. This is only valid for the root menu item. You shouldn't 434 // The delegate. This is only valid for the root menu item. You shouldn't
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 // giving each child the available width. 510 // giving each child the available width.
511 virtual void Layout(); 511 virtual void Layout();
512 virtual gfx::Size GetPreferredSize(); 512 virtual gfx::Size GetPreferredSize();
513 513
514 // View method. Overriden to schedule a paint. We do this so that when 514 // View method. Overriden to schedule a paint. We do this so that when
515 // scrolling occurs, everything is repainted correctly. 515 // scrolling occurs, everything is repainted correctly.
516 virtual void DidChangeBounds(const gfx::Rect& previous, 516 virtual void DidChangeBounds(const gfx::Rect& previous,
517 const gfx::Rect& current); 517 const gfx::Rect& current);
518 518
519 // Painting. 519 // Painting.
520 void PaintChildren(ChromeCanvas* canvas); 520 void PaintChildren(gfx::Canvas* canvas);
521 521
522 // Drag and drop methods. These are forwarded to the MenuController. 522 // Drag and drop methods. These are forwarded to the MenuController.
523 virtual bool CanDrop(const OSExchangeData& data); 523 virtual bool CanDrop(const OSExchangeData& data);
524 virtual void OnDragEntered(const DropTargetEvent& event); 524 virtual void OnDragEntered(const DropTargetEvent& event);
525 virtual int OnDragUpdated(const DropTargetEvent& event); 525 virtual int OnDragUpdated(const DropTargetEvent& event);
526 virtual void OnDragExited(); 526 virtual void OnDragExited();
527 virtual int OnPerformDrop(const DropTargetEvent& event); 527 virtual int OnPerformDrop(const DropTargetEvent& event);
528 528
529 // Scrolls on menu item boundaries. 529 // Scrolls on menu item boundaries.
530 virtual bool OnMouseWheel(const MouseWheelEvent& e); 530 virtual bool OnMouseWheel(const MouseWheelEvent& e);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 571
572 // Returns the container for the SubmenuView. 572 // Returns the container for the SubmenuView.
573 MenuScrollViewContainer* GetScrollViewContainer(); 573 MenuScrollViewContainer* GetScrollViewContainer();
574 574
575 // Returns the host of the menu. Returns NULL if not showing. 575 // Returns the host of the menu. Returns NULL if not showing.
576 MenuHost* host() const { return host_; } 576 MenuHost* host() const { return host_; }
577 577
578 private: 578 private:
579 // Paints the drop indicator. This is only invoked if item is non-NULL and 579 // Paints the drop indicator. This is only invoked if item is non-NULL and
580 // position is not DROP_NONE. 580 // position is not DROP_NONE.
581 void PaintDropIndicator(ChromeCanvas* canvas, 581 void PaintDropIndicator(gfx::Canvas* canvas,
582 MenuItemView* item, 582 MenuItemView* item,
583 MenuDelegate::DropPosition position); 583 MenuDelegate::DropPosition position);
584 584
585 void SchedulePaintForDropIndicator(MenuItemView* item, 585 void SchedulePaintForDropIndicator(MenuItemView* item,
586 MenuDelegate::DropPosition position); 586 MenuDelegate::DropPosition position);
587 587
588 // Calculates the location of th edrop indicator. 588 // Calculates the location of th edrop indicator.
589 gfx::Rect CalculateDropIndicatorBounds(MenuItemView* item, 589 gfx::Rect CalculateDropIndicatorBounds(MenuItemView* item,
590 MenuDelegate::DropPosition position); 590 MenuDelegate::DropPosition position);
591 591
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 // Task for scrolling the menu. If non-null indicates a scroll is currently 940 // Task for scrolling the menu. If non-null indicates a scroll is currently
941 // underway. 941 // underway.
942 scoped_ptr<MenuScrollTask> scroll_task_; 942 scoped_ptr<MenuScrollTask> scroll_task_;
943 943
944 DISALLOW_EVIL_CONSTRUCTORS(MenuController); 944 DISALLOW_EVIL_CONSTRUCTORS(MenuController);
945 }; 945 };
946 946
947 } // namespace views 947 } // namespace views
948 948
949 #endif // VIEWS_CONTROLS_MENU_CHROME_MENU_H_ 949 #endif // VIEWS_CONTROLS_MENU_CHROME_MENU_H_
OLDNEW
« no previous file with comments | « views/controls/link.cc ('k') | views/controls/menu/chrome_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698