[zephyrchat-cvs] zchat/zChat ZChatFriendViewController.h,1.9,1.10 ZChatFriendViewController.mm,1.17,
Status: Alpha
                
                Brought to you by:
                
                    akosut
                    
                
            | 
      
      
      From: <ak...@us...> - 2003-03-28 18:59:59
      
     | 
| Update of /cvsroot/zephyrchat/zchat/zChat
In directory sc8-pr-cvs1:/tmp/cvs-serv13042
Modified Files:
	ZChatFriendViewController.h ZChatFriendViewController.mm 
Log Message:
Initial (minimal) implementation of location display.
Index: ZChatFriendViewController.h
===================================================================
RCS file: /cvsroot/zephyrchat/zchat/zChat/ZChatFriendViewController.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ZChatFriendViewController.h	26 Mar 2003 22:09:25 -0000	1.9
+++ ZChatFriendViewController.h	28 Mar 2003 18:59:54 -0000	1.10
@@ -21,7 +21,8 @@
 
     IBOutlet NSView *_expandedView;
     IBOutlet NSTextField *_expandedTitle;
-
+    IBOutlet NSTableView *_locationTable;
+    
     NSString *_user;
 
     // The current locations -- empty if the person is offline (or unknown)
Index: ZChatFriendViewController.mm
===================================================================
RCS file: /cvsroot/zephyrchat/zchat/zChat/ZChatFriendViewController.mm,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- ZChatFriendViewController.mm	26 Mar 2003 22:09:25 -0000	1.17
+++ ZChatFriendViewController.mm	28 Mar 2003 18:59:54 -0000	1.18
@@ -128,6 +128,16 @@
 - (void)locateSuccess:(const vector<zephyrlib::ZephyrLocation> &)locations {
     *_locations = locations;
 
+
+    [_locationTable reloadData];
+    [_expandedView setFrameSize:NSMakeSize([_expandedView frame].size.width,
+                                           [_expandedView frame].size.height - [_locationTable frame].size.height
+                                           + ([_locationTable numberOfRows]
+                                              * ([_locationTable rowHeight]
+                                                 + [_locationTable intercellSpacing].height))
+                                           )];
+    [_expandedView setNeedsDisplay:YES];
+        
     // TODO
 
     _busy = false;
@@ -228,6 +238,35 @@
     }
     
     return email;
+}
+
+- (int)numberOfRowsInTableView:(NSTableView *)tableView {
+    return _locations->size();
+}
+
+- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row {
+    if (tableView == _locationTable) {
+        ZephyrLocation &location = (*_locations)[row];
+        switch ([[tableView tableColumns] indexOfObject:tableColumn]) {
+            case 0:
+                return [NSString stringWithSTLString:location.machine_name];
+            case 1:
+                return [NSString stringWithSTLString:location.terminal];
+            case 2:
+                return [NSString stringWithSTLString:location.login_time];
+        }
+    }
+        
+    return nil;
+}
+
+- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(int)row {
+    if (tableView == _locationTable) {
+        /* Do not allow expanded view table to be selected */
+        return NO;
+    }
+
+    return YES;
 }
 
 @end
 |