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