Committed C# port from Mohamad
[zxing.git] / iphone / Classes / DecoderViewController.h
1 //
2 //  DecoderViewController.h
3 //  ZXing
4 //
5 //  Created by Christian Brunschen on 22/05/2008.
6 /*
7  * Copyright 2008 ZXing authors
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */
21
22 #import <UIKit/UIKit.h>
23 #import "Decoder.h"
24 #import "DecoderDelegate.h"
25 #import "ScannedImageView.h"
26
27 @class ParsedResult;
28 @class Scan;
29 @class TwoDDecoderResult;
30 @class ResultAction;
31
32
33 @interface DecoderViewController : UIViewController <DecoderDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate, UIActionSheetDelegate> {
34   IBOutlet UIBarItem *cameraBarItem;
35   IBOutlet UIBarItem *savedPhotosBarItem;
36   IBOutlet UIBarItem *libraryBarItem;
37   IBOutlet UIBarItem *archiveBarItem;
38   IBOutlet UIBarItem *actionBarItem;
39   
40   IBOutlet UIView *messageView;
41   IBOutlet UITextView *messageTextView;
42   IBOutlet UIButton *messageHelpButton;
43   IBOutlet ScannedImageView *imageView;
44   IBOutlet UIToolbar *toolbar;
45   
46   Decoder *decoder;
47   ParsedResult *result;
48   NSArray *actions;
49   
50   NSMutableArray *resultPointViews;
51 }
52
53 @property (nonatomic, retain) UIBarItem *cameraBarItem;
54 @property (nonatomic, retain) UIBarItem *savedPhotosBarItem;
55 @property (nonatomic, retain) UIBarItem *libraryBarItem;
56 @property (nonatomic, retain) UIBarItem *archiveBarItem;
57 @property (nonatomic, retain) UIBarItem *actionBarItem;
58
59 @property (nonatomic, retain) UIView *messageView;
60 @property (nonatomic, retain) UITextView *messageTextView;
61 @property (nonatomic, retain) UIButton *messageHelpButton;
62 @property (nonatomic, retain) ScannedImageView *imageView;
63 @property (nonatomic, retain) UIToolbar *toolbar;
64
65 @property (nonatomic, retain) Decoder *decoder;
66 @property (nonatomic, retain) ParsedResult *result;
67 @property (nonatomic, retain) NSArray *actions;
68
69 @property (nonatomic, retain) NSMutableArray *resultPointViews;
70
71 - (void)clearImageView;
72 - (void)updateToolbar;
73 - (void)pickAndDecodeFromSource:(UIImagePickerControllerSourceType) sourceType;
74 - (IBAction)pickAndDecode:(id)sender;
75 - (void)showMessage:(NSString *)message helpButton:(BOOL)showHelpButton;
76 - (IBAction)performResultAction:(id)sender;
77 - (IBAction)showArchive:(id)sender;
78 - (void)showScan:(Scan *)scan;
79
80 /* DecoderDelegate methods */
81
82 - (void)decoder:(Decoder *)decoder willDecodeImage:(UIImage *)image usingSubset:(UIImage *)subset;
83 - (void)decoder:(Decoder *)decoder decodingImage:(UIImage *)image usingSubset:(UIImage *)subset progress:(NSString *) message;
84 - (void)decoder:(Decoder *)decoder didDecodeImage:(UIImage *)image usingSubset:(UIImage *)subset withResult:(TwoDDecoderResult *)result;
85
86 /* UIImagePickerControllerDelegate methods */
87
88 - (void)imagePickerController:(UIImagePickerController *)picker
89         didFinishPickingImage:(UIImage *)image
90                   editingInfo:(NSDictionary *)editingInfo;
91 - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker;
92
93 /* UINavigationControllerDelegate methods */
94 - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated;
95 - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated;
96
97 @end