1 |
|
---|
2 | #import "GSResultItem.h"
|
---|
3 | #import "GreenstoneApplication.h"
|
---|
4 |
|
---|
5 | #import "PrefCascadeView.h"
|
---|
6 |
|
---|
7 | @implementation PrefCascadeView
|
---|
8 |
|
---|
9 | -(id) initWithFrame:(CGRect)rect withParent:(UIView*)parent
|
---|
10 | withCollection:(NSString*)collection withTitle:(NSString*)title withGID:(NSString*)gid
|
---|
11 | {
|
---|
12 | self = [super initWithFrame:rect withParent:parent withCollection:collection
|
---|
13 | withTitle:title withGID:gid];
|
---|
14 |
|
---|
15 | _prefViews = [[NSMutableArray alloc] initWithCapacity:MCInitCapacity];
|
---|
16 |
|
---|
17 | return self;
|
---|
18 | }
|
---|
19 |
|
---|
20 | -(void) appendMenuItem:(NSObject*)app withItem:(NSString*)item_label withGID:(NSString*)childGID
|
---|
21 | {
|
---|
22 | [super appendMenuItem:app withItem:item_label withGID:childGID];
|
---|
23 |
|
---|
24 | CGRect workarea_rect = [GreenstoneApplication workAreaRect];
|
---|
25 | PrefView* prefView = [[PrefView alloc] initWithFrame:workarea_rect
|
---|
26 | withParent:self withCollection:childGID withTitle:item_label];
|
---|
27 |
|
---|
28 | [_prefViews addObject:prefView];
|
---|
29 |
|
---|
30 | }
|
---|
31 |
|
---|
32 | -(UIView*) directEntry:(int)rowId
|
---|
33 | {
|
---|
34 | return [_prefViews objectAtIndex:rowId];
|
---|
35 | }
|
---|
36 |
|
---|
37 |
|
---|
38 |
|
---|
39 | //***********
|
---|
40 | //* Delegates
|
---|
41 | //***********
|
---|
42 | -(void) tableRowSelected:(NSNotification*)notification
|
---|
43 | {
|
---|
44 | UITable* table = [notification object];
|
---|
45 | int rowId = [table selectedRow];
|
---|
46 |
|
---|
47 | GreenstoneAPI* greenstoneAPI = [GreenstoneApplication greenstoneAPI];
|
---|
48 |
|
---|
49 | NSString* childTitle = [[_oidItem objectAtIndex:rowId] title];
|
---|
50 | NSString* childGID = [[_oidItem objectAtIndex:rowId] oid];
|
---|
51 |
|
---|
52 | NSString* chosenCollection = [[NSString alloc] initWithString:childGID];
|
---|
53 |
|
---|
54 | PrefView* prefView = [_prefViews objectAtIndex:rowId];
|
---|
55 |
|
---|
56 | [GreenstoneApplication setInCollection:chosenCollection];
|
---|
57 | [GreenstoneApplication transitionView:UITransitionBothShiftLeft
|
---|
58 | fromView:self toView:prefView];
|
---|
59 |
|
---|
60 | }
|
---|
61 |
|
---|
62 | -(void) dealloc
|
---|
63 | {
|
---|
64 | [_prefViews release];
|
---|
65 |
|
---|
66 | [super dealloc];
|
---|
67 | }
|
---|
68 |
|
---|
69 | @end
|
---|