2 * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * @author Yunchan Cho (yunchan.cho@samsung.com)
20 #include "IBoxContext.h"
21 #include "IBoxState.h"
25 void BoxState::switchState()
27 // TODO this creation may be wrong..
28 m_context->setState(IBoxStatePtr(this));
31 void BoxState::setContext(IBoxContextPtr context)
36 IBoxContextPtr BoxState::getContext()
42 IBoxStatePtr BoxInitState::permitShow()
44 return IBoxStatePtr(BoxShowState::create(getContext()));
48 IBoxStatePtr BoxShowState::permitShow()
50 // In this case, existing state needn't to be changed
51 return IBoxStatePtr(this);
54 IBoxStatePtr BoxShowState::permitHide()
56 return IBoxStatePtr(BoxHideState::create(getContext()));
59 IBoxStatePtr BoxShowState::permitOpenPd()
61 return IBoxStatePtr(BoxOpenPdState::create(getContext()));
64 IBoxStatePtr BoxShowState::permitPause()
66 return IBoxStatePtr(BoxPauseState::create(getContext()));
70 IBoxStatePtr BoxHideState::permitShutdown()
72 // In this case, existing state needn't to be changed
73 // because there is no state to be changed from Hide State
74 return IBoxStatePtr(this);
78 IBoxStatePtr BoxOpenPdState::permitClosePd()
80 return IBoxStatePtr(BoxClosePdState::create(getContext()));
84 IBoxStatePtr BoxClosePdState::permitShow()
86 return IBoxStatePtr(BoxShowState::create(getContext()));
90 IBoxStatePtr BoxPauseState::permitResume()
92 return IBoxStatePtr(BoxResumeState::create(getContext()));
95 IBoxStatePtr BoxPauseState::permitHide()
97 return IBoxStatePtr(BoxHideState::create(getContext()));
101 IBoxStatePtr BoxResumeState::permitShow()
103 return IBoxStatePtr(BoxShowState::create(getContext()));
106 IBoxStatePtr BoxResumeState::permitHide()
108 return IBoxStatePtr(BoxHideState::create(getContext()));