1 #ifndef DALI_TOOLKIT_DEVEL_LAYOUT_LENGTH_H
2 #define DALI_TOOLKIT_DEVEL_LAYOUT_LENGTH_H
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
28 * @brief A type that represents a layout length.
30 * Currently, this implies pixels, but could be extended to handle device dependant sizes, etc.
37 LayoutLength( IntType value )
42 LayoutLength( const LayoutLength& layoutLength )
43 : mValue( layoutLength.mValue )
47 LayoutLength& operator=(const LayoutLength& rhs)
53 bool operator==( const LayoutLength& rhs )
55 return mValue == rhs.mValue;
58 bool operator==( LayoutLength::IntType rhs )
63 bool operator!=( const LayoutLength& rhs )
65 return !operator==(rhs);
68 bool operator<( const LayoutLength& rhs )
70 return mValue < rhs.mValue;
73 bool operator<( const LayoutLength rhs ) const
75 return mValue < rhs.mValue;
78 bool operator<=( const LayoutLength& rhs )
80 return mValue <= rhs.mValue;
82 bool operator<=( LayoutLength rhs )
84 return mValue <= rhs.mValue;
86 bool operator>( const LayoutLength& rhs )
88 return mValue > rhs.mValue;
90 bool operator>( LayoutLength rhs )
92 return mValue > rhs.mValue;
94 bool operator>=( const LayoutLength& rhs )
96 return mValue >= rhs.mValue;
98 bool operator>=( LayoutLength rhs )
100 return mValue >= rhs.mValue;
103 LayoutLength operator+( const LayoutLength& rhs )
105 return mValue + rhs.mValue;
108 LayoutLength operator+( LayoutLength::IntType rhs )
113 LayoutLength operator-( const LayoutLength& rhs )
115 return mValue - rhs.mValue;
117 LayoutLength operator-( LayoutLength::IntType rhs )
122 LayoutLength& operator+=( const LayoutLength& rhs )
124 mValue += rhs.mValue;
127 LayoutLength& operator+=( LayoutLength::IntType rhs )
133 LayoutLength& operator-=( const LayoutLength& rhs )
135 mValue -= rhs.mValue;
139 LayoutLength& operator-=( LayoutLength::IntType rhs )
145 LayoutLength operator/( const LayoutLength& rhs )
147 return mValue / rhs.mValue;
149 LayoutLength operator/( LayoutLength::IntType rhs )
154 LayoutLength operator*( const LayoutLength& rhs )
156 return mValue * rhs.mValue;
158 LayoutLength operator*( LayoutLength::IntType rhs )
162 LayoutLength operator*( float rhs )
164 return LayoutLength(LayoutLength::IntType(float(mValue) * rhs));
169 return float( mValue );
176 * @brief Prints a LayoutLength
178 * @param[in] o The output stream operator
179 * @param[in] layoutLength the layout length to print
180 * @return The output stream operator
182 inline std::ostream& operator<<( std::ostream& o, const LayoutLength& layoutLength )
184 return o<<layoutLength.mValue;
187 } // namespace Toolkit
191 #endif //DALI_TOOLKIT_DEVEL_LAYOUT_LENGTH_H