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