2 * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
10 //==========================================================================
12 * @file CicoCommonComponent.cpp
14 * @brief This file is definition of CicoCommonComponent class
16 //==========================================================================
22 #include "CicoCommonComponent.h"
24 //--------------------------------------------------------------------------
26 * @brief default constructor
31 //--------------------------------------------------------------------------
32 CicoCommonComponent::CicoCommonComponent()
33 : posx_(0), posy_(0), width_(0), height_(0)
35 ICO_TRA("CicoCommonComponent::CicoCommonComponent Enter");
36 ICO_TRA("CicoCommonComponent::CicoCommonComponent Leave");
39 //--------------------------------------------------------------------------
46 //--------------------------------------------------------------------------
47 CicoCommonComponent::~CicoCommonComponent()
49 ICO_TRA("CicoCommonComponent::~CicoCommonComponent Enter");
50 ICO_TRA("CicoCommonComponent::~CicoCommonComponent Leave");
53 //--------------------------------------------------------------------------
55 * @brief terminate component
59 * @retval true: success
61 //--------------------------------------------------------------------------
63 CicoCommonComponent::Terminate(void)
65 ICO_TRA("CicoCommonComponent::Terminate Enter");
66 std::list<std::shared_ptr<CicoCommonModule>>::iterator itr;
67 std::list<std::shared_ptr<CicoCommonModule>>::iterator itr_end;
68 for (itr = modulelist_.begin(); itr != itr_end; itr++) {
73 ICO_TRA("CicoCommonComponent::Terminate Leave");
77 //--------------------------------------------------------------------------
79 * @brief show component
84 //--------------------------------------------------------------------------
86 CicoCommonComponent::Show(void)
88 ICO_TRA("CicoCommonComponent::Show Enter");
90 std::list<std::shared_ptr<CicoCommonModule>>::iterator itr;
91 std::list<std::shared_ptr<CicoCommonModule>>::iterator itr_end;
92 itr_end = modulelist_.end();
93 for (itr = modulelist_.begin(); itr != itr_end; itr++) {
97 ICO_TRA("CicoCommonComponent::Show Leave");
100 //--------------------------------------------------------------------------
102 * @brief hide component
106 //--------------------------------------------------------------------------
108 CicoCommonComponent::Hide(void)
110 ICO_TRA("CicoCommonComponent::Hide Enter");
111 std::list<std::shared_ptr<CicoCommonModule>>::iterator itr;
112 std::list<std::shared_ptr<CicoCommonModule>>::iterator itr_end;
113 itr_end = modulelist_.end();
114 for (itr = modulelist_.begin(); itr != itr_end; itr++) {
117 ICO_TRA("CicoCommonComponent::Hide Leave");
120 //--------------------------------------------------------------------------
122 * @brief set position of component
124 * @param [in] x position of x
125 * @param [in] y position of y
128 //--------------------------------------------------------------------------
130 CicoCommonComponent::SetPos(int x, int y)
132 ICO_TRA("CicoCommonComponent::SetPos Enter(x/y=%d/%d)", x, y);
133 int diffx = x - posx_;
134 int diffy = y - posy_;
137 std::list<std::shared_ptr<CicoCommonModule>>::iterator itr;
138 std::list<std::shared_ptr<CicoCommonModule>>::iterator itr_end;
139 itr_end = modulelist_.end();
140 for (itr = modulelist_.begin(); itr != itr_end; itr++) {
141 (*itr)->Move(diffx, diffy);
143 ICO_TRA("CicoCommonComponent::SetPos Leave");
146 //--------------------------------------------------------------------------
148 * @brief set size of component
150 * @param [in] w width of component
151 * @param [in] h height of component
154 //--------------------------------------------------------------------------
156 CicoCommonComponent::SetSize(int w, int h)
158 ICO_TRA("CicoCommonComponent::SetSize Enter(w/h=%d/%d)", w, h);
159 double rate_w = width_ / w;
160 double rate_h = height_ / h;
163 std::list<std::shared_ptr<CicoCommonModule>>::iterator itr;
164 std::list<std::shared_ptr<CicoCommonModule>>::iterator itr_end;
165 itr_end = modulelist_.end();
166 for (itr = modulelist_.begin(); itr != itr_end; itr++) {
167 (*itr)->Reallocate(posx_, posy_, rate_w, rate_h);
169 ICO_TRA("CicoCommonComponent::SetSize Leave");
172 //--------------------------------------------------------------------------
176 * @param [in] module add module object
179 //--------------------------------------------------------------------------
181 CicoCommonComponent::PackModule(std::shared_ptr<CicoCommonModule> module)
183 modulelist_.push_back(module);
186 //--------------------------------------------------------------------------
188 * @brief unpack module
190 * @param [in] module remove module object
193 //--------------------------------------------------------------------------
195 CicoCommonComponent::UnpackModule(std::shared_ptr<CicoCommonModule> module)
197 modulelist_.remove(module);
199 // vim: set expandtab ts=4 sw=4: