//
//  ButtonPullDownRealize.h
//  22222222222222
//
//  Created by liangchenying on 12-4-9.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "ButtonPullDownPrepare.h"

#define AlertViewShow(Message)    UIAlertView *alert = [[[UIAlertView alloc]initWithTitle:nil message:Message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]autorelease];[alert show];

#define JudgeParamDigitOrNot(Controller, Message)	for(i = 0;i < [self.Controller.text length];i++){if([self.Controller.text UTF8String][i] < '0' || [self.Controller.text UTF8String][i] > '9'){ UIAlertView *alert = [[[UIAlertView alloc]initWithTitle:nil message:Message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]autorelease];[alert show]; goto ExitLine;}}

#define JudgeParamNil(Controller, Message)  if([self.Controller.text isEqualToString:@""]){UIAlertView *alert = [[[UIAlertView alloc]initWithTitle:nil message:Message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]autorelease];[alert show]; goto ExitLine;} 

#define JudgePrinterWidthRange(width, Message,x) if((width < 64 && width != 0) || width > x){UIAlertView *alert = [[[UIAlertView alloc]initWithTitle:nil message:Message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]autorelease];[alert show]; goto ExitLine;}

#define JudgeParamRange(parameter, X1,X2,Message) if(parameter < X1 || parameter > X2){UIAlertView *alert = [[[UIAlertView alloc]initWithTitle:nil message:Message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]autorelease];[alert show]; goto ExitLine;}

@class ButtonPullDownRealize;

typedef void(^PickerActionDoneButton)  (ButtonPullDownRealize *picker, NSInteger selectedIndex, id selectedValue);
typedef void(^PickerActionCancelButton)(ButtonPullDownRealize *picker);

@interface ButtonPullDownRealize : ButtonPullDownPrepare <UIPickerViewDelegate, UIPickerViewDataSource>

+ (id)sheetPickerTitle:(NSString *)title Sheet:(NSArray *)strings Selected:(NSInteger)index DoneButton:(PickerActionDoneButton)DoneButton CancelButton:(PickerActionCancelButton)CancelButton Action:(id)Action;

- (id)initWithTitle:(NSString *)title Sheet:(NSArray *)strings Selected:(NSInteger)index DoneButton:(PickerActionDoneButton)DoneButton CancelButton:(PickerActionCancelButton)CancelButton Action:(id)Action;

@property (nonatomic, retain) NSArray                   *strings;
@property (nonatomic, assign) NSInteger                 index;
@property (nonatomic, copy)   PickerActionDoneButton    DoneButton;
@property (nonatomic, copy)   PickerActionCancelButton  CancelButton;

@end
