2 * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
20 #include <unordered_map>
\r
21 #include <functional>
\r
22 #include <ilm/ilm_control.h>
\r
23 #include "wm_error.hpp"
\r
28 class Screen : public rectangle {
\r
32 class LayerControlCallbacks {
\r
34 LayerControlCallbacks() {};
\r
35 virtual ~LayerControlCallbacks() = default;
\r
36 LayerControlCallbacks(const LayerControlCallbacks &obj) = default;
\r
38 // callback functions
\r
39 virtual void test(unsigned i) { HMI_DEBUG("test %d", i); }
\r
40 std::function<void(unsigned)> surfaceCreated;
\r
41 /* std::function<void(unsigned)> surfaceDestroyed;
\r
42 std::function<void(unsigned)> layerCreated;
\r
43 std::function<void(unsigned)> layerDestroyed; */
\r
51 explicit LayerControl(const std::string& root);
\r
52 ~LayerControl() = default;
\r
53 WMError init(const LayerControlCallbacks& cb);
\r
54 unsigned getNewLayerID(const std::string& role);
\r
55 // void setRenderOrder(const std::vector<unsigned> layer_render_order);
\r
56 // std::vector<unsigned> getAllRenderOrder();
\r
57 // std::vector<std::shared_ptr<WMLayer>>& getAllLayers();
\r
58 // std::vector<unsigned> getRenderOrder(const std::string& layer_name);
\r
59 WMError updateLayer(LayerState& layer_state);
\r
60 WMError commitChange();
\r
63 // Don't use this function.
\r
64 void dispatchCreateEvent(ilmObjectType object, unsigned id, bool created);
\r
65 void dispatchPropertyChangeEvent(unsigned id, struct ilmSurfaceProperties*, t_ilm_notification_mask);
\r
66 void dispatchPropertyChangeEvent(unsigned id, struct ilmLayerProperties*, t_ilm_notification_mask);
\r
68 WMError loadLayerSetting(const std::string& path);
\r
69 WMError loadAreaDb(const std::string& path);
\r
71 std::vector<std::shared_ptr<WMLayer>> wm_layers;
\r
72 std::unordered_map<std::string, struct rect> area2size;
\r
74 struct ilmScreenProperties screen_prop;
\r
75 LayerControlCallbacks cb;
\r