summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/grow_box_view.m
blob: d7ace4129277456e912543a9d39616ee0be9835b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "chrome/browser/cocoa/grow_box_view.h"

@implementation GrowBoxView

- (void)awakeFromNib {
  image_ = [[NSImage imageNamed:@"grow_box"] retain];
}

- (void)dealloc {
  [image_ release];
  [super dealloc];
}

// Draws the "grow_box" image in our bounds.
- (void)drawRect:(NSRect)dirtyRect {
  [image_ drawInRect:[self bounds] fromRect:NSZeroRect
      operation:NSCompositeSourceOver fraction:1.0];
}

// Called when the user clicks and drags within the bounds. Resize the window's
// frame based on the delta of the drag.
- (void)mouseDragged:(NSEvent*)event {
  NSRect frame = [[self window] frame];
  frame.size.width += [event deltaX];
  frame.origin.y -= [event deltaY];
  frame.size.height += [event deltaY];
  [[self window] setFrame:frame display:YES];
}

@end