Playlist Generator  1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
MBProgressHUD.h
Go to the documentation of this file.
00001 //
00002 //  MBProgressHUD.h
00003 //  Version 0.4
00004 //  Created by Matej Bukovinski on 2.4.09.
00005 //
00006 
00007 // This code is distributed under the terms and conditions of the MIT license. 
00008 
00009 // Copyright (c) 2011 Matej Bukovinski
00010 //
00011 // Permission is hereby granted, free of charge, to any person obtaining a copy
00012 // of this software and associated documentation files (the "Software"), to deal
00013 // in the Software without restriction, including without limitation the rights
00014 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00015 // copies of the Software, and to permit persons to whom the Software is
00016 // furnished to do so, subject to the following conditions:
00017 //
00018 // The above copyright notice and this permission notice shall be included in
00019 // all copies or substantial portions of the Software.
00020 //
00021 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00022 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00023 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00024 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00025 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00026 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00027 // THE SOFTWARE.
00028 
00029 #import <UIKit/UIKit.h>
00030 
00031 @protocol MBProgressHUDDelegate;
00032 
00034 
00035 typedef enum {
00037     MBProgressHUDModeIndeterminate,
00039         MBProgressHUDModeDeterminate,
00041         MBProgressHUDModeCustomView
00042 } MBProgressHUDMode;
00043 
00044 typedef enum {
00046     MBProgressHUDAnimationFade,
00048     MBProgressHUDAnimationZoom
00049 } MBProgressHUDAnimation;
00050 
00052 
00071 @interface MBProgressHUD : UIView {
00072         
00073         MBProgressHUDMode mode;
00074     MBProgressHUDAnimation animationType;
00075         
00076         SEL methodForExecution;
00077         id targetForExecution;
00078         id objectForExecution;
00079         BOOL useAnimation;
00080         
00081     float yOffset;
00082     float xOffset;
00083         
00084         float width;
00085         float height;
00086         
00087         CGSize minSize;
00088         BOOL square;
00089         
00090         float margin;
00091         
00092         BOOL dimBackground;
00093         
00094         BOOL taskInProgress;
00095         float graceTime;
00096         float minShowTime;
00097         NSTimer *graceTimer;
00098         NSTimer *minShowTimer;
00099         NSDate *showStarted;
00100         
00101         UIView *indicator;
00102         UILabel *label;
00103         UILabel *detailsLabel;
00104         
00105         float progress;
00106         
00107         id<MBProgressHUDDelegate> delegate;
00108         NSString *labelText;
00109         NSString *detailsLabelText;
00110         float opacity;
00111         UIFont *labelFont;
00112         UIFont *detailsLabelFont;
00113         
00114     BOOL isFinished;
00115         BOOL removeFromSuperViewOnHide;
00116         
00117         UIView *customView;
00118         
00119         CGAffineTransform rotationTransform;
00120 }
00121 
00132 + (MBProgressHUD *)showHUDAddedTo:(UIView *)view animated:(BOOL)animated;
00133 
00144 + (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated;
00145 
00153 - (id)initWithWindow:(UIWindow *)window;
00154 
00162 - (id)initWithView:(UIView *)view;
00163 
00168 @property (retain) UIView *customView;
00169 
00176 @property (assign) MBProgressHUDMode mode;
00177 
00183 @property (assign) MBProgressHUDAnimation animationType;
00184 
00190 @property (assign) id<MBProgressHUDDelegate> delegate;
00191 
00197 @property (copy) NSString *labelText;
00198 
00203 @property (copy) NSString *detailsLabelText;
00204 
00208 @property (assign) float opacity;
00209 
00213 @property (assign) float xOffset;
00214 
00218 @property (assign) float yOffset;
00219 
00225 @property (assign) float margin;
00226 
00230 @property (assign) BOOL dimBackground;
00231 
00232 /*
00233  * Grace period is the time (in seconds) that the invoked method may be run without 
00234  * showing the HUD. If the task finishes befor the grace time runs out, the HUD will
00235  * not be shown at all. 
00236  * This may be used to prevent HUD display for very short tasks.
00237  * Defaults to 0 (no grace time).
00238  * Grace time functionality is only supported when the task status is known!
00239  * @see taskInProgress
00240  */
00241 @property (assign) float graceTime;
00242 
00243 
00249 @property (assign) float minShowTime;
00250 
00259 @property (assign) BOOL taskInProgress;
00260 
00265 @property (assign) BOOL removeFromSuperViewOnHide;
00266 
00270 @property (retain) UIFont* labelFont;
00271 
00275 @property (retain) UIFont* detailsLabelFont;
00276 
00280 @property (assign) float progress;
00281 
00285 @property (assign) CGSize minSize;
00286 
00290 @property (assign, getter = isSquare) BOOL square;
00291 
00305 - (void)show:(BOOL)animated;
00306 
00314 - (void)hide:(BOOL)animated;
00315 
00324 - (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay;
00325 
00338 - (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated;
00339 
00340 @end
00341 
00343 
00344 @protocol MBProgressHUDDelegate <NSObject>
00345 
00346 @optional
00347 
00351 - (void)hudWasHidden:(MBProgressHUD *)hud;
00352 
00357 - (void)hudWasHidden __attribute__ ((deprecated)); 
00358 
00359 @end
00360 
00362 
00366 @interface MBRoundProgressView : UIView {
00367 @private
00368     float _progress;
00369 }
00370 
00374 @property (nonatomic, assign) float progress;
00375 
00376 @end
00377 
00379