1 #ifndef DALI_TOOLKIT_LAYOUTING_MEASURED_SIZE_H
2 #define DALI_TOOLKIT_LAYOUTING_MEASURED_SIZE_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.
20 #include <dali/public-api/common/dali-common.h>
21 #include <dali-toolkit/devel-api/layouting/layout-length.h>
29 * Class that encodes a measurement and a measure state, which is set if the measured size is too small.
31 class DALI_IMPORT_API MeasuredSize
37 MEASURED_SIZE_OK, ///< The measured size is good
38 MEASURED_SIZE_TOO_SMALL ///< The measured size is too small
42 : mMeasuredSize( 0u ),
43 mState ( MeasuredSize::State::MEASURED_SIZE_OK )
47 MeasuredSize( LayoutLength measuredSize )
48 : mMeasuredSize( measuredSize ),
49 mState ( MeasuredSize::State::MEASURED_SIZE_OK )
53 MeasuredSize( LayoutLength measuredSize, MeasuredSize::State state )
54 : mMeasuredSize( measuredSize ),
59 ~MeasuredSize() = default;
61 MeasuredSize& operator=( const MeasuredSize& rhs )
63 this->mMeasuredSize = rhs.mMeasuredSize;
64 this->mState = rhs.mState;
68 MeasuredSize& operator=( LayoutLength::IntType rhs )
70 this->mMeasuredSize = rhs;
71 this->mState = State::MEASURED_SIZE_OK;
75 inline bool operator==( MeasuredSize value )
77 return mMeasuredSize == value.mMeasuredSize;
80 inline bool operator!=( MeasuredSize value )
82 return mMeasuredSize != value.mMeasuredSize;
85 inline operator LayoutLength::IntType()
87 return mMeasuredSize.mValue;
90 inline void SetState( MeasuredSize::State state )
95 inline MeasuredSize::State GetState()
100 inline void SetSize( LayoutLength size )
102 mMeasuredSize = size;
104 inline LayoutLength GetSize()
106 return mMeasuredSize;
110 LayoutLength mMeasuredSize; ///< The measured size
111 State mState; ///< The measured state
114 } //namespace Toolkit
118 #endif // DALI_TOOLKIT_LAYOUTING_MEASURED_SIZE_H