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 "chrome/browser/ui/panels/panel_window_controller_cocoa.h" | 5 #include "chrome/browser/ui/panels/panel_window_controller_cocoa.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
392 scoped_nsobject<MenuController> settingsMenuController( | 392 scoped_nsobject<MenuController> settingsMenuController( |
393 [[MenuController alloc] initWithModel:settingsMenuModel.get() | 393 [[MenuController alloc] initWithModel:settingsMenuModel.get() |
394 useWithPopUpButtonCell:NO]); | 394 useWithPopUpButtonCell:NO]); |
395 | 395 |
396 [NSMenu popUpContextMenu:[settingsMenuController menu] | 396 [NSMenu popUpContextMenu:[settingsMenuController menu] |
397 withEvent:[NSApp currentEvent] | 397 withEvent:[NSApp currentEvent] |
398 forView:button]; | 398 forView:button]; |
399 } | 399 } |
400 | 400 |
401 - (BOOL)isDraggable { | 401 - (BOOL)isDraggable { |
402 return windowShim_->panel()->draggable(); | 402 return windowShim_->panel()->manager()->CanDrag(windowShim_->panel()); |
jennb
2012/02/17 21:28:45
Wow, this looks ugly. We should leave draggable()
jianli
2012/02/17 23:52:56
Done.
| |
403 } | 403 } |
404 | 404 |
405 - (void)startDrag { | 405 - (void)startDrag { |
406 animateOnBoundsChange_ = NO; | 406 animateOnBoundsChange_ = NO; |
407 windowShim_->panel()->manager()->StartDragging(windowShim_->panel()); | 407 windowShim_->panel()->manager()->StartDragging(windowShim_->panel()); |
408 } | 408 } |
409 | 409 |
410 - (void)endDrag:(BOOL)cancelled { | 410 - (void)endDrag:(BOOL)cancelled { |
411 animateOnBoundsChange_ = YES; | 411 animateOnBoundsChange_ = YES; |
412 windowShim_->panel()->manager()->EndDragging(cancelled); | 412 windowShim_->panel()->manager()->EndDragging(cancelled); |
413 } | 413 } |
414 | 414 |
415 - (void)dragWithDeltaX:(int)deltaX { | 415 - (void)dragWithDeltaX:(int)deltaX |
416 windowShim_->panel()->manager()->Drag(deltaX); | 416 deltaY:(int)deltaY { |
417 windowShim_->panel()->manager()->Drag(deltaX, deltaY); | |
417 } | 418 } |
418 | 419 |
419 - (void)setPanelFrame:(NSRect)frame | 420 - (void)setPanelFrame:(NSRect)frame |
420 animate:(BOOL)animate { | 421 animate:(BOOL)animate { |
421 // Setup the whole window as the tracking area so that we can get notified | 422 // Setup the whole window as the tracking area so that we can get notified |
422 // when the mouse enters or leaves the window. This will make us be able to | 423 // when the mouse enters or leaves the window. This will make us be able to |
423 // show or hide settings button accordingly. | 424 // show or hide settings button accordingly. |
424 NSRect localBounds = frame; | 425 NSRect localBounds = frame; |
425 localBounds.origin = NSZeroPoint; | 426 localBounds.origin = NSZeroPoint; |
426 windowTrackingArea_.reset( | 427 windowTrackingArea_.reset( |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
618 | 619 |
619 - (BOOL)canBecomeKeyWindow { | 620 - (BOOL)canBecomeKeyWindow { |
620 // Panel can only gain focus if it is expanded. Minimized panels do not | 621 // Panel can only gain focus if it is expanded. Minimized panels do not |
621 // participate in Cmd-~ rotation. | 622 // participate in Cmd-~ rotation. |
622 // TODO(dimich): If it will be ever desired to expand/focus the Panel on | 623 // TODO(dimich): If it will be ever desired to expand/focus the Panel on |
623 // keyboard navigation or via main menu, the care should be taken to avoid | 624 // keyboard navigation or via main menu, the care should be taken to avoid |
624 // cases when minimized Panel is getting keyboard input, invisibly. | 625 // cases when minimized Panel is getting keyboard input, invisibly. |
625 return windowShim_->panel()->expansion_state() == Panel::EXPANDED; | 626 return windowShim_->panel()->expansion_state() == Panel::EXPANDED; |
626 } | 627 } |
627 @end | 628 @end |
OLD | NEW |