Guest User

Untitled

a guest
Aug 21st, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. /*
  2. * AppController.j
  3. * TableCibTest
  4. *
  5. * Created by Francisco Tolmasky on July 5, 2009.
  6. * Copyright 2009, 280 North, Inc. All rights reserved.
  7. */
  8.  
  9. @import <Foundation/CPObject.j>
  10.  
  11. CPLogRegister(CPLogConsole);
  12.  
  13. @implementation AppController : CPObject
  14. {
  15. CPWindow theWindow; //this "outlet" is connected automatically by the Cib
  16. CPScrollView theScrollView;
  17. CPTableView theTableView;
  18. CPPopupButton theBorderTypePopup;
  19. }
  20.  
  21. - (void)applicationDidFinishLaunching:(CPNotification)aNotification
  22. {
  23. // This is called when the application is done loading.
  24. }
  25.  
  26. - (void)awakeFromCib
  27. {
  28. // This is called when the cib is done loading.
  29. // You can implement this method on any object instantiated from a Cib.
  30. // It's a useful hook for setting up current UI values, and other things.
  31.  
  32. // In this case, we want the window from Cib to become our full browser window
  33. [theWindow setFullPlatformWindow:YES];
  34.  
  35. [theWindow setBackgroundColor:[CPColor colorWithHexString:@"f3f4f5"]];
  36.  
  37. [theBorderTypePopup selectItemWithTag:[theScrollView borderType]];
  38.  
  39. [theTableView setDelegate:self];
  40.  
  41. }
  42.  
  43. - (int)numberOfRowsInTableView:(CPTableView)tableView
  44. {
  45. return 10;
  46. }
  47.  
  48. - (id)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(int)row
  49. {
  50. return String((row + 1) * [[tableColumn identifier] intValue]);
  51. }
  52.  
  53. // Actions
  54.  
  55. - (void)setBorder:(id)sender
  56. {
  57. var type = [[sender selectedItem] tag];
  58. console.log('type=%d', type);
  59.  
  60. [theScrollView setBorderType:type];
  61. }
  62.  
  63. /*
  64. Table Delegates
  65. */
  66. -(void)tableViewSelectionDidChange:(CPNotification)aNotification
  67. {
  68. //this fires with mouse clicks
  69. //this fires with mouse clicks with arrow-key changes
  70. console.log("Selection did Change");
  71. }
  72.  
  73. -(void)tableViewSelectionIsChanging:(CPNotification)aNotification
  74. {
  75. //this fires with mouse clicks
  76. //does not fire with arrow-key changes
  77. console.log("Selection will Change");
  78. }
  79.  
  80. @end
Add Comment
Please, Sign In to add comment