source: gs2-extensions/iOS-1.x/trunk/GreenstoneButtonBar.mm@ 32238

Last change on this file since 32238 was 22548, checked in by davidb, 14 years ago

Original version of Greenstone2 app for iPhone/iPod-touch

File size: 2.5 KB
Line 
1#import "GreenstoneButtonBar.h"
2#import "GreenstoneApplication.h"
3
4@implementation GreenstoneButtonBar
5
6- (UIButtonBar*)initInView:(UIView*)view withFrame:(CGRect)frame
7{
8 self = [super initInView: view withFrame: frame
9 withItemList: [self buttonBarItemList]];
10
11 GreenstoneApplication* app = [GreenstoneApplication toplevelApp];
12
13 [self setDelegate: app ];
14 [self setBarStyle: 1 ];
15 [self setButtonBarTrackingMode: 2 ];
16
17 int buttons[NUM_GSBAR_BUTTONS] = { GSBBBrowse, GSBBQuery, GSBBPref };
18
19 [self registerButtonGroup: 0 withButtons: buttons withCount: NUM_GSBAR_BUTTONS ];
20 [self showButtonGroup: 0 withDuration: 0.0 ];
21
22 // *** This and the fact that BookmarkSelected.png seems to be back to front is a bit weird!
23 [self showSelectionForButton: 1 ];
24
25 return self;
26}
27
28- (NSArray *)buttonBarItemList
29{
30 GreenstoneApplication* app = [GreenstoneApplication toplevelApp];
31
32 NSArray* buts
33 = [ NSArray arrayWithObjects:
34 [ NSDictionary dictionaryWithObjectsAndKeys:
35 @"buttonBarClicked:", kUIButtonBarButtonAction,
36 @"icons/BookmarkSelected.png", kUIButtonBarButtonInfo,
37 @"icons/Bookmark.png", kUIButtonBarButtonSelectedInfo,
38 [ NSNumber numberWithInt: 1], kUIButtonBarButtonTag,
39 app, kUIButtonBarButtonTarget,
40 @"Browse", kUIButtonBarButtonTitle,
41 @"0", kUIButtonBarButtonType,
42 nil
43 ],
44
45 [ NSDictionary dictionaryWithObjectsAndKeys:
46 @"buttonBarClicked:", kUIButtonBarButtonAction,
47 @"icons/Search.png", kUIButtonBarButtonInfo,
48 @"icons/SearchSelected.png", kUIButtonBarButtonSelectedInfo,
49 [ NSNumber numberWithInt: 2], kUIButtonBarButtonTag,
50 app, kUIButtonBarButtonTarget,
51 @"Search", kUIButtonBarButtonTitle,
52 @"0", kUIButtonBarButtonType,
53 nil
54 ],
55
56 [ NSDictionary dictionaryWithObjectsAndKeys:
57 @"buttonBarClicked:", kUIButtonBarButtonAction,
58 @"icons/Preferences.png", kUIButtonBarButtonInfo,
59 @"icons/PreferencesSelected.png", kUIButtonBarButtonSelectedInfo,
60 [ NSNumber numberWithInt: 3], kUIButtonBarButtonTag,
61 app, kUIButtonBarButtonTarget,
62 @"Settings", kUIButtonBarButtonTitle,
63 @"0", kUIButtonBarButtonType,
64 nil
65 ],
66
67 nil
68 ];
69
70 return buts;
71}
72
73@end
Note: See TracBrowser for help on using the repository browser.