北京  ■ 深圳 ■ 上海  ■ 成都  ■ 重庆  ■ 浙江
经过数据恢复工程师的努力研究,已搞清楚了XFS文件系统的结构层。如果有基于XFS的NAS或LINUX数据出现问题,已有很大把握了。基于XFS数据恢复的软件已经完工。
站 内 搜 索
    
热 点 文 章
PC3000使用说明
关于硬盘坏道(绝对有收获) 
pc3000译文
U盘故障的详细维修方法! 
硬盘零磁道与分区表的修复
pc3000处理常见故障的一些方
推 荐 文 章
Hrt修复磁盘缺陷
pc3000处理常见故障的一些方
硬盘容量限制问题的形成以及
关于硬盘坏道(绝对有收获) 
20个美钻维修心德(1.22版)
Disk Genius V2.0 Beta 0219
FUJITSU盘故障表现
FUJ维修资料
最 新 文 章
北京理工大学
某数据恢复公司
捌捌国际
北京梁先生
吉林延边
山西刘先生
北京张先生
HP公司
联 系 我 们
北京北亚数据恢复中心
地址:北京市海淀区学院南路68号吉安大厦C座(汇智楼)528室
电话:(010)51280825
手机:13522617215 (张先生)
电子邮件:zymail@vip.sina.com
QQ:34000588(请叙述理由)
您现在的位置:

首页>>数据恢复文章>>正文

MAC OS X Cocoa NSToolbar 的使用

作者: 来源: 日期:2007-11-07 12:07:15  点击次数:

//向NSToolbar控件添加自定义的NSToolbarItem项
- (NSToolbarItem *) toolbar: (NSToolbar *)toolbar itemForItemIdentifIEr:
(NSString *) itemIdent willBeInsertedIntoToolbar:(BOOL) willBeInserted {
// Required delegate method Given an item identifier, self method
returns an item
// The toolbar will use self method to obtain toolbar items that can
be displayed in the customization sheet, or in the toolbar itself
NSToolbarItem *toolbarItem = [[[NSToolbarItem alloc]
initWithItemIdentifier: itemIdent] autorelease];

if ([itemIdent isEqual: SquareDotViewItemIdentifier]) {
SquareDotView *dv = [[SquareDotView alloc] initWithFrame:
NSMakeRect(0,0,100,32)];

[toolbarItem setView: dv];

// set a reasonable minimum size
[toolbarItem setMinSize: NSMakeSize(100,32)];
// set a maximum size that allows us to stretch.
[toolbarItem setMaxSize: NSMakeSize(300,32)];

[toolbarItem setLabel: @"Dot View"];
[toolbarItem setPaletteLabel: @"A Dot View"];
[toolbarItem setToolTip: @"This is a dot view"];
}
.....
}

//返回单击后能被选中且为高亮显示的NSToolbarItem的集合。
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
{// return an array of all the items that can be highlight display after selected
return [NSArray arrayWithObjects:
NSColorToolbarItemIdentifier,
NSFontToolbarItemIdentifier,nil];
}

//返回程序加载后的默认的NSToolbarItem的集合。
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar
{ // return an array of the items found in the default toolbar
return [NSArray arrayWithObjects:
NSToolbarSeparatorItemIdentifier,
NSFontToolbarItemIdentifier,
NSToolbarCustomizeToolbarItemIdentifier,
nil];
}


//以下是作为NSToolbarItem出现的自定义类
The "SquareDotView" class:


@interface SquareDotView : NSView {
@private
float sdSide;
NSPoint sdLocation;
}
@end

@implementation SquareDotView

#define START_SIDE 10
#define START_LOCATION NSMakePoint(10,10)

- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
sdSide = START_SIDE;
sdLocation = START_LOCATION;
}
return self;
}

- (void)mouseDown:(NSEvent *)theEvent {
sdLocation = [self convertPoint: [theEvent locationInWindow]
fromView: nil];
[self setNeedsDisplay: YES];
}

- (void)drawRect:(NSRect)rect {
[[NSColor redColor] set];
[[NSBezierPath bezierPathWithRect: NSMakeRect(sdLocation.x,
sdLocation.y, sdSide, sdSide)] fill];

[[NSColor blackColor] set];
[[NSBezierPath bezierPathWithRect: [self bounds]] stroke];
}

- (id)initWithCoder:(NSCoder *)coder {
self = [super initWithCoder: coder];
if (self) {
[coder decodeValuesOfObjCTypes: "fff", &sdSide, &sdLocation.x,
&sdLocation.y];
}
return self;
}

- (void)encodeWithCoder:(NSCoder *)coder {
[super encodeWithCoder: coder];
if (self) {
[coder encodeValuesOfObjCTypes: "fff", &sdSide, &sdLocation.x,
&sdLocation.y];
}
}

@end


上一篇:Solaris 做Raid1小结
下一篇:Outlook邮件和规则的备份与恢复
相关文章
Copyright 2005 - 2006 版权所有 北亚数据恢复中心
全国统一客服电话:4006-505-808 或 800-810-5880
地址:北京市海淀区学院南路68号吉安大厦C座(汇智楼)528
申明:本网站所有关于硬盘数据恢复硬盘维修的资料及工具全部来自网络,如有侵权,请通知我们,我们马上做出处理-北亚数据恢复中心。