SIMBLでCocoaアプリをパワーアップ

847 views

Published on

2008-4-12 Cocoa勉強会#28

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
847
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
4
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

SIMBLでCocoaアプリをパワーアップ

  1. 1. SIMBL Cocoa 2008-4-12 Cocoa #28 
 1
  2. 2. Objective-C(42) SIMBL http://journal.mycom.co.jp/column/objc/042/index.html 2
  3. 3. 3
  4. 4. http://hetima.com/safari/stand.html 4
  5. 5. http://ciaranwal.sh/2007/11/01/customising- colours-in-leopard-terminal 5
  6. 6. http://limechat.net/inputswitcher/index_ja.html 6
  7. 7. http://kirika.la.coocan.jp/proj/sandtrip/ index.html 7
  8. 8. 8
  9. 9. 9
  10. 10. Objective-C(42) SIMBL http://journal.mycom.co.jp/column/objc/042/index.html 10
  11. 11. 11
  12. 12. 12
  13. 13. 13
  14. 14. 14
  15. 15. 15
  16. 16. 16
  17. 17. 17
  18. 18. http://numata.designed.jp/ja/programming/ cocoabrowser.html 18
  19. 19. 19
  20. 20. 20
  21. 21. 21
  22. 22. 22
  23. 23. 23
  24. 24. 24
  25. 25. // CBPlugin.m -(void) installNewMenuItem { NSMenuItem * newMenuItem; NSString * title; NSMenu * fileMenu; // title = [self localizedText:@"Show in Browser"]; newMenuItem = [[NSMenuItem alloc] initWithTitle:title action:@selector(showInBrowser:) keyEquivalent:@"O"]; [newMenuItem setTarget:nil]; // first responder // fileMenu = [[[NSApp mainMenu] itemAtIndex:1] submenu]; [fileMenu insertItem:newMenuItem atIndex:3]; 25
  26. 26. // CBPlugin.m +(void) install { CBPlugin * plugin; plugin = [[CBPlugin alloc] init]; [plugin installNewMenuItem]; 26
  27. 27. // MyDocument+plugInAction.h @interface MyDocument : NSDocument { } @end @interface MyDocument (CBPluginAction) -(IBAction) showInBrowser:(id)sender; @end 27
  28. 28. 28
  29. 29. MyDocument MyDocument -validateMenuItem: -cbp_orig_validateMenuItem: (category) (category) -cbp_validateMenuItem: -validateMenuItem: 29
  30. 30. // CBPlugin.m static BOOL alias_instance_method( Class cls, SEL src_sel, SEL dest_sel) { Method src_meth; IMP imp; const char * types; BOOL ret; src_meth = class_getInstanceMethod(cls, src_sel); imp = method_getImplementation(src_meth); types = method_getTypeEncoding(src_meth); ret = class_addMethod(cls, dest_sel, imp, types); // force override if (!ret) { Method dest_meth; dest_meth = class_getInstanceMethod(cls, dest_sel); method_setImplementation(dest_meth, imp); ret = YES; } 30
  31. 31. // CBPlugin.m +(void) install { CBPlugin * plugin; plugin = [[CBPlugin alloc] init]; [plugin installNewMenuItem]; [plugin aliasMethods]; // 31
  32. 32. 32
  33. 33. 33
  34. 34. 34
  35. 35. SIMBL Cocoa 35
  36. 36. 36
  37. 37. http://d.hatena.ne.jp/hetima/20071027/1193452016 37
  38. 38. http://infinite-labs.net/PlugSuit/ 38
  39. 39. http://www.cocoamug.com/pimpkit/ 39

×