topical media & game development

talk show tell print

#mobile-application-10-DerbyApp-build-iphone-Classes-LayoutConstraint.h / h



  
Appcelerator Titanium Mobile Copyright (c) 2009-2011 by Appcelerator, Inc. All Rights Reserved. Licensed under the terms of the Apache Public License Please see the LICENSE included with this distribution for details. WARNING: This is generated code. Modify at your own risk and without support.

  
  
  #import <UIKit/UIKit.h>
  #import <TiDimension.h>
  #import <TiUtils.h>
  
  @protocol LayoutAutosizing
  
  @optional
  
  -(CGFloat)minimumParentWidthForWidth:(CGFloat)suggestedWidth;
  -(CGFloat)minimumParentHeightForWidth:(CGFloat)suggestedWidth;
  
  -(CGFloat)autoWidthForWidth:(CGFloat)suggestedWidth;
  -(CGFloat)autoHeightForWidth:(CGFloat)width;
  
  -(CGFloat)verifyWidth:(CGFloat)suggestedWidth;
  -(CGFloat)verifyHeight:(CGFloat)suggestedHeight;
  
  -(UIViewAutoresizing)verifyAutoresizing:(UIViewAutoresizing)suggestedResizing;
  
  @end
  
  typedef enum {
          TiLayoutRuleAbsolute,
          TiLayoutRuleVertical,
          TiLayoutRuleHorizontal,
  } TiLayoutRule;
  
  TI_INLINE CGFloat TiFixedValueRuleFromObject(id object)
  {
          return [TiUtils floatValue:object def:0];
  }
  
  TI_INLINE TiLayoutRule TiLayoutRuleFromObject(id object)
  {
          if ([object isKindOfClass:[NSString class]])
          {
                  if ([object caseInsensitiveCompare:@"vertical"]==NSOrderedSame)
                  {
                          return TiLayoutRuleVertical;
                  }
                  if ([object caseInsensitiveCompare:@"horizontal"]==NSOrderedSame)
                  {
                          return TiLayoutRuleHorizontal;
                  }
          }
          return TiLayoutRuleAbsolute;
  }
  
  TI_INLINE BOOL TiLayoutRuleIsAbsolute(TiLayoutRule rule)
  {
          return rule==TiLayoutRuleAbsolute;
  }
  
  TI_INLINE BOOL TiLayoutRuleIsVertical(TiLayoutRule rule)
  {
          return rule==TiLayoutRuleVertical;
  }
  
  TI_INLINE BOOL TiLayoutRuleIsHorizontal(TiLayoutRule rule)
  {
          return rule==TiLayoutRuleHorizontal;
  }
  
  typedef struct LayoutConstraint {
  
          TiDimension centerX;
          TiDimension left;
          TiDimension right;
          TiDimension width;
          
          TiDimension centerY;
          TiDimension top;
          TiDimension bottom;
          TiDimension height;
          
          TiLayoutRule layout;
          
          CGFloat minimumHeight;
          CGFloat minimumWidth;
          
  } LayoutConstraint;
  
  
  void ApplyConstraintToViewWithBounds(LayoutConstraint * constraint, TiUIView * subView, CGRect viewBounds);
  CGFloat WidthFromConstraintGivenWidth(LayoutConstraint * constraint,CGFloat viewWidth);
  CGSize SizeConstraintViewWithSizeAddingResizing(LayoutConstraint * constraint, NSObject<LayoutAutosizing> * autoSizer, CGSize boundSize, UIViewAutoresizing * resultResizing);
  CGPoint PositionConstraintGivenSizeBoundsAddingResizing(LayoutConstraint * constraint, CGSize viewSize, CGPoint anchorPoint, CGSize superViewSize, UIViewAutoresizing * resultResizing);
  BOOL IsLayoutUndefined(LayoutConstraint *constraint);
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.