2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
17 * @author Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
20 #ifndef WRTDEVICEAPIS_DISPLAY_SCREEN_H_
21 #define WRTDEVICEAPIS_DISPLAY_SCREEN_H_
25 #include <appcore-common.h>
26 #include <platform/commons/Emitters.h>
27 #include <API/Display/IScreen.h>
28 #include <VConf/Key.h>
30 namespace WrtPlugins {
35 class Screen : public Api::Display::IScreen
41 * @see WrtPlugins::Api::Display::IScreen::getColorDepth()
43 unsigned short getColorDepth() const;
46 * @see WrtPlugins::Api::Display::IScreen::getSize()
48 Dimension getSize() const;
51 * @see WrtPlugins::Api::Display::IScreen::getActualSize()
53 Dimension getActualSize() const;
56 * @see WrtPlugins::Api::Display::IScreen::getOrientation()
58 Api::Display::Orientation getOrientation() const;
61 * @see WrtPlugins::Api::Display::IScreen::getState()
63 Api::Display::State getState() const;
66 * @see WrtPlugins::Api::Display::IScreen::addOnChangeOrientation()
68 void addOnChangeOrientation(
69 const Api::Display::EventChangeOrientationEmitterPtr& emitter);
72 * @see WrtPlugins::Api::Display::IScreen::removeOnChangeOrientation()
74 void removeOnChangeOrientation(
75 Api::Display::EventChangeOrientationEmitter::IdType id);
78 * @see WrtPlugins::Api::Display::IScreen::addOnChangeState()
80 void addOnChangeState(
81 const Api::Display::EventChangeStateEmitterPtr& emitter);
84 * @see WrtPlugins::Api::Display::IScreen::removeOnChangeState()
86 void removeOnChangeState(Api::Display::EventChangeStateEmitter::IdType id);
89 typedef Emitters<Api::Display::EventChangeOrientationEmitter>
90 ChangeOrientationEmitters;
91 typedef Emitters<Api::Display::EventChangeStateEmitter> ChangeStateEmitters;
95 * Gets data matching specified pattern from output of xdpyinfo program.
96 * @param pattern Pattern to search for.
97 * @return Zero or positive value on success, -1 on failure.
99 static bool getXDpyProperty(const char* pattern,
100 const pcrecpp::Arg& arg1 = pcrecpp::RE::no_arg,
101 const pcrecpp::Arg& arg2 = pcrecpp::RE::no_arg);
104 * Callback run when device's power state changes.
105 * @param node Node object (unused).
106 * @param data User data.
108 static void onChangeState(const VConf::Node* node,
112 * Callback run when device's orientation changes.
113 * @param rot Rotation mode.
114 * @param data User data.
115 * @return Error code (?) - not specified in documentation.
117 static int onChangeOrientation(appcore_rm rot,
121 explicit Screen(std::size_t index);
124 std::size_t m_index; ///< Index of the screen.
125 ChangeOrientationEmitters m_onChangeOrientation; ///< Change orientation emitters.
126 ChangeStateEmitters m_onChangeState; ///< Change state emitters.
127 VConf::Key m_powerState; ///< Key for power manager state.
133 #endif // WRTDEVICEAPIS_DISPLAY_SCREEN_H_