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.
42 LayoutLength( IntType value )
47 LayoutLength( const LayoutLength& layoutLength )
48 : mValue( layoutLength.mValue )
52 LayoutLength& operator=(const LayoutLength& rhs)
61 bool operator==( const LayoutLength& rhs )
63 return mValue == rhs.mValue;
66 bool operator==( LayoutLength::IntType rhs )
71 bool operator!=( const LayoutLength& rhs )
73 return !operator==(rhs);
76 bool operator<( const LayoutLength& rhs )
78 return mValue < rhs.mValue;
81 bool operator<( const LayoutLength rhs ) const
83 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;
102 bool operator>=( const LayoutLength& rhs )
104 return mValue >= rhs.mValue;
106 bool operator>=( LayoutLength rhs )
108 return mValue >= rhs.mValue;
111 LayoutLength operator+( const LayoutLength& rhs )
113 return mValue + rhs.mValue;
116 LayoutLength operator+( LayoutLength::IntType rhs )
121 LayoutLength operator-( const LayoutLength& rhs )
123 return mValue - rhs.mValue;
125 LayoutLength operator-( LayoutLength::IntType rhs )
130 LayoutLength& operator+=( const LayoutLength& rhs )
132 mValue += rhs.mValue;
135 LayoutLength& operator+=( LayoutLength::IntType rhs )
141 LayoutLength& operator-=( const LayoutLength& rhs )
143 mValue -= rhs.mValue;
147 LayoutLength& operator-=( LayoutLength::IntType rhs )
153 LayoutLength operator/( const LayoutLength& rhs )
155 return mValue / rhs.mValue;
157 LayoutLength operator/( LayoutLength::IntType rhs )
162 LayoutLength operator*( const LayoutLength& rhs )
164 return mValue * rhs.mValue;
166 LayoutLength operator*( LayoutLength::IntType rhs )
170 LayoutLength operator*( float rhs )
172 return LayoutLength(LayoutLength::IntType(AsFloat() * rhs));
176 * @brief explicit method to return the value as float
177 * @return the LayoutLength as float
179 float AsFloat() const
181 return static_cast<float>( mValue );
188 * @brief Prints a LayoutLength
190 * @param[in] o The output stream operator
191 * @param[in] layoutLength the layout length to print
192 * @return The output stream operator
194 inline std::ostream& operator<<( std::ostream& o, const LayoutLength& layoutLength )
196 return o<<layoutLength.mValue;
199 } // namespace Toolkit
203 #endif //DALI_TOOLKIT_DEVEL_LAYOUT_LENGTH_H