00001
00002 @import <AppKit/CPView.j>
00003
00004 #include "CoreGraphics/CGGeometry.h"
00005
00006
00007 @implementation CPButtonBar : CPControl
00008 {
00009 }
00010
00011 - (id)initWithFrame:(CGRect)aFrame
00012 {
00013 self = [super initWithFrame:aFrame];
00014
00015 if (self)
00016 [self setNeedsLayout];
00017
00018 return self;
00019 }
00020
00021 + (CPString)themeClass
00022 {
00023 return @"button-bar";
00024 }
00025
00026 + (id)themeAttributes
00027 {
00028 return [CPDictionary dictionaryWithObjects:[[CPNull null]]
00029 forKeys:[@"bezel-color"]];
00030 }
00031
00032 - (CGRect)rectForEphemeralSubviewNamed:(CPString)aName
00033 {
00034 if (aName === "bezel-view")
00035 return [self bounds];
00036
00037 return [super rectForEphemeralSubviewNamed:aName];
00038 }
00039
00040 - (CPView)createEphemeralSubviewNamed:(CPString)aName
00041 {
00042 if (aName === "bezel-view")
00043 {
00044 var view = [[CPView alloc] initWithFrame:_CGRectMakeZero()];
00045
00046 [view setHitTests:NO];
00047
00048 return view;
00049 }
00050
00051 return [super createEphemeralSubviewNamed:aName];
00052 }
00053
00054 - (void)layoutSubviews
00055 {
00056 var bezelView = [self layoutEphemeralSubviewNamed:@"bezel-view"
00057 positioned:CPWindowBelow
00058 relativeToEphemeralSubviewNamed:@""];
00059
00060 if (bezelView)
00061 [bezelView setBackgroundColor:[self currentValueForThemeAttribute:@"bezel-color"]];
00062 }
00063
00064 - (void)addSubview:(CPView)aSubview
00065 {
00066 [super addSubview:aSubview];
00067
00068 [aSubview setAutoresizingMask:CPViewMinXMargin];
00069 }
00070
00071 @end