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
30 Screen(unsigned w, unsigned h) : _width(w), _height(h){}
\r
31 unsigned width() { return _width; }
\r
32 unsigned height() { return _height; }
\r
36 unsigned _pysical_width = 0;
\r
37 unsigned _pysical_height = 0;
\r
40 class LayerControlCallbacks {
\r
42 LayerControlCallbacks() {};
\r
43 ~LayerControlCallbacks() = default;
\r
44 LayerControlCallbacks(const LayerControlCallbacks &obj) = default;
\r
46 // callback functions
\r
47 void test(unsigned i) { HMI_DEBUG("test %d", i); }
\r
48 std::function<void(unsigned)> surfaceCreated;
\r
49 /* std::function<void(unsigned)> surfaceDestroyed;
\r
50 std::function<void(unsigned)> layerCreated;
\r
51 std::function<void(unsigned)> layerDestroyed; */
\r
62 explicit LayerControl(const std::string& root);
\r
63 ~LayerControl() = default;
\r
64 WMError init(const LayerControlCallbacks& cb);
\r
65 void createNewLayer(unsigned id);
\r
66 unsigned getNewLayerID(const std::string& role, std::string* layer_name);
\r
67 struct rect getAreaSize(const std::string& area);
\r
68 void setupArea(double scaling);
\r
69 Screen getScreenInfo();
\r
71 // void setRenderOrder(const std::vector<unsigned> layer_render_order);
\r
72 // std::vector<unsigned> getAllRenderOrder();
\r
73 // std::vector<std::shared_ptr<WMLayer>>& getAllLayers();
\r
74 // std::vector<unsigned> getRenderOrder(const std::string& layer_name);
\r
75 WMError updateLayer(LayerState& layer_state);
\r
76 WMError commitChange();
\r
78 WMError layoutChange(const WMAction& action);
\r
79 WMError visibilityChange(const WMAction &action);
\r
81 // Don't use this function.
\r
82 void dispatchCreateEvent(ilmObjectType object, unsigned id, bool created);
\r
83 void dispatchPropertyChangeEvent(unsigned id, struct ilmSurfaceProperties*, t_ilm_notification_mask);
\r
84 void dispatchPropertyChangeEvent(unsigned id, struct ilmLayerProperties*, t_ilm_notification_mask);
\r
86 WMError makeVisible(const std::shared_ptr<WMClient> client);
\r
87 WMError makeInvisible(const std::shared_ptr<WMClient> client);
\r
88 WMError loadLayerSetting(const std::string& path);
\r
89 WMError loadAreaDb(const std::string& path);
\r
91 std::vector<std::shared_ptr<WMLayer>> wm_layers;
\r
92 std::unordered_map<std::string, struct rect> area2size;
\r
94 struct ilmScreenProperties screen_prop;
\r
96 LayerControlCallbacks cb;
\r