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)
56 bool operator==( const LayoutLength& rhs )
58 return mValue == rhs.mValue;
61 bool operator==( LayoutLength::IntType rhs )
66 bool operator!=( const LayoutLength& rhs )
68 return !operator==(rhs);
71 bool operator<( const LayoutLength& rhs )
73 return mValue < rhs.mValue;
76 bool operator<( const LayoutLength rhs ) const
78 return mValue < rhs.mValue;
81 bool operator<=( const LayoutLength& rhs )
83 return mValue <= rhs.mValue;
85 bool operator<=( LayoutLength rhs )
87 return mValue <= rhs.mValue;
89 bool operator>( const LayoutLength& rhs )
91 return mValue > rhs.mValue;
93 bool operator>( LayoutLength rhs )
95 return mValue > rhs.mValue;
97 bool operator>=( const LayoutLength& rhs )
99 return mValue >= rhs.mValue;
101 bool operator>=( LayoutLength rhs )
103 return mValue >= rhs.mValue;
106 LayoutLength operator+( const LayoutLength& rhs )
108 return mValue + rhs.mValue;
111 LayoutLength operator+( LayoutLength::IntType rhs )
116 LayoutLength operator-( const LayoutLength& rhs )
118 return mValue - rhs.mValue;
120 LayoutLength operator-( LayoutLength::IntType rhs )
125 LayoutLength& operator+=( const LayoutLength& rhs )
127 mValue += rhs.mValue;
130 LayoutLength& operator+=( LayoutLength::IntType rhs )
136 LayoutLength& operator-=( const LayoutLength& rhs )
138 mValue -= rhs.mValue;
142 LayoutLength& operator-=( LayoutLength::IntType rhs )
148 LayoutLength operator/( const LayoutLength& rhs )
150 return mValue / rhs.mValue;
152 LayoutLength operator/( LayoutLength::IntType rhs )
157 LayoutLength operator*( const LayoutLength& rhs )
159 return mValue * rhs.mValue;
161 LayoutLength operator*( LayoutLength::IntType rhs )
165 LayoutLength operator*( float rhs )
167 return LayoutLength(LayoutLength::IntType(float(mValue) * rhs));
172 return float( mValue );
179 * @brief Prints a LayoutLength
181 * @param[in] o The output stream operator
182 * @param[in] layoutLength the layout length to print
183 * @return The output stream operator
185 inline std::ostream& operator<<( std::ostream& o, const LayoutLength& layoutLength )
187 return o<<layoutLength.mValue;
190 } // namespace Toolkit
194 #endif //DALI_TOOLKIT_DEVEL_LAYOUT_LENGTH_H