2023-04-19 07:06:53 +00:00
|
|
|
/* Copyright (C) 2023 Free Software Foundation, Inc.
|
2023-05-06 06:24:08 +00:00
|
|
|
|
2023-04-19 07:06:53 +00:00
|
|
|
By: Benjamin Johnson
|
|
|
|
Date: 19-3-2023
|
|
|
|
This file is part of the GNUstep Library.
|
2023-05-06 06:24:08 +00:00
|
|
|
|
2023-04-19 07:06:53 +00:00
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
2023-05-06 06:24:08 +00:00
|
|
|
|
2023-04-19 07:06:53 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
2023-05-06 06:24:08 +00:00
|
|
|
|
2023-04-19 07:06:53 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02110 USA.
|
|
|
|
*/
|
|
|
|
|
2023-05-06 06:24:08 +00:00
|
|
|
#import "GSCSConstraintOperator.h"
|
|
|
|
#import "GSCSLinearExpression.h"
|
|
|
|
#import "GSCSStrength.h"
|
|
|
|
#import "GSCSVariable.h"
|
2023-04-19 07:06:53 +00:00
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
#ifndef _GS_CS_CONSTRAINT_H
|
|
|
|
#define _GS_CS_CONSTRAINT_H
|
|
|
|
|
2023-05-06 06:24:08 +00:00
|
|
|
enum GSCSConstraintType
|
|
|
|
{
|
|
|
|
GSCSConstraintTypeEdit,
|
|
|
|
GSCSConstraintTypeStay,
|
|
|
|
GSCSConstraintTypeLinear,
|
|
|
|
GSCSConstraintTypeLinearInequity
|
|
|
|
};
|
|
|
|
typedef enum GSCSConstraintType GSCSConstraintType;
|
|
|
|
|
2023-04-19 07:06:53 +00:00
|
|
|
@interface GSCSConstraint : NSObject
|
2023-05-06 06:24:08 +00:00
|
|
|
{
|
|
|
|
GSCSConstraintType _type;
|
|
|
|
GSCSStrength *_strength;
|
|
|
|
GSCSLinearExpression *_expression;
|
|
|
|
GSCSVariable *_variable;
|
|
|
|
}
|
|
|
|
|
2023-05-27 00:58:27 +00:00
|
|
|
#if GS_HAS_DECLARED_PROPERTIES
|
|
|
|
@property (nonatomic, assign) GSCSStrength *strength;
|
|
|
|
#else
|
|
|
|
- (GSCSStrength *) strength;
|
|
|
|
- (void) setStrength: (GSCSStrength *)strength;
|
|
|
|
#endif
|
|
|
|
|
2023-05-06 06:24:08 +00:00
|
|
|
- (instancetype) initWithType: (GSCSConstraintType)type
|
|
|
|
strength: (GSCSStrength *)strength
|
|
|
|
expression: (GSCSLinearExpression *)expression
|
|
|
|
variable: (GSCSVariable *)variable;
|
|
|
|
|
|
|
|
- (instancetype) initLinearConstraintWithExpression:
|
|
|
|
(GSCSLinearExpression *)expression;
|
|
|
|
|
|
|
|
- (instancetype) initLinearInequityConstraintWithExpression:
|
|
|
|
(GSCSLinearExpression *)expression;
|
|
|
|
|
|
|
|
- (instancetype) initLinearConstraintWithExpression:
|
|
|
|
(GSCSLinearExpression *)expression
|
|
|
|
strength: (GSCSStrength *)strength
|
|
|
|
variable: (GSCSVariable *)variable;
|
|
|
|
|
|
|
|
- (instancetype) initEditConstraintWithVariable: (GSCSVariable *)variable
|
2023-05-27 00:58:27 +00:00
|
|
|
strength: (GSCSStrength *)strength;
|
2023-05-06 06:24:08 +00:00
|
|
|
|
|
|
|
- (instancetype) initStayConstraintWithVariable: (GSCSVariable *)variable
|
|
|
|
strength: (GSCSStrength *)strength;
|
|
|
|
|
|
|
|
- (instancetype) initWithLhsVariable: (GSCSVariable *)lhs
|
|
|
|
equalsConstant: (CGFloat)rhs;
|
|
|
|
|
|
|
|
- (instancetype) initWithLhsVariable: (GSCSVariable *)lhs
|
|
|
|
equalsRhsVariable: (GSCSVariable *)rhs;
|
|
|
|
|
|
|
|
+ (GSCSConstraint *) constraintWithLeftVariable: (GSCSVariable *)lhs
|
|
|
|
operator: (GSCSConstraintOperator) operator
|
|
|
|
rightVariable: (GSCSVariable *)rhsVariable;
|
|
|
|
|
|
|
|
+ (GSCSConstraint *) constraintWithLeftVariable: (GSCSVariable *)lhs
|
|
|
|
operator: (GSCSConstraintOperator) operator
|
|
|
|
rightConstant: (CGFloat)rhs;
|
|
|
|
|
|
|
|
+ (GSCSConstraint *) constraintWithLeftVariable: (GSCSVariable *)lhs
|
|
|
|
operator: (GSCSConstraintOperator) operator
|
|
|
|
rightExpression: (GSCSLinearExpression *)rhs;
|
|
|
|
|
|
|
|
+ (GSCSConstraint *) constraintWithLeftConstant: (CGFloat)lhs
|
|
|
|
operator: (GSCSConstraintOperator) operator
|
|
|
|
rightVariable: (GSCSVariable *)rhs;
|
|
|
|
|
|
|
|
+ (GSCSConstraint *) constraintWithLeftExpression: (GSCSLinearExpression *)lhs
|
|
|
|
operator: (GSCSConstraintOperator) operator
|
|
|
|
rightVariable: (GSCSVariable *)rhs;
|
|
|
|
|
|
|
|
+ (GSCSConstraint *) constraintWithLeftExpression: (GSCSLinearExpression *)lhs
|
|
|
|
operator: (GSCSConstraintOperator) operator
|
|
|
|
rightExpression: (GSCSLinearExpression *)rhs;
|
|
|
|
|
|
|
|
+ (GSCSConstraint *) constraintWithLeftExpression: (GSCSLinearExpression *)lhs
|
|
|
|
operator: (GSCSConstraintOperator) operator
|
|
|
|
rightConstant: (CGFloat)rhs;
|
|
|
|
|
|
|
|
+ (instancetype) editConstraintWithVariable: (GSCSVariable *)variable;
|
|
|
|
|
|
|
|
- (BOOL) isRequired;
|
|
|
|
|
|
|
|
- (BOOL) isEditConstraint;
|
|
|
|
|
|
|
|
- (BOOL) isStayConstraint;
|
|
|
|
|
|
|
|
- (BOOL) isInequality;
|
|
|
|
|
|
|
|
- (GSCSLinearExpression *) expression;
|
|
|
|
|
|
|
|
- (GSCSConstraintType) type;
|
|
|
|
|
|
|
|
- (GSCSVariable *) variable;
|
2023-04-19 07:06:53 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#endif
|