1 /* 2 * Copyright (c) 2020 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_VIEWGROUP_PAGE_H 17 #define OHOS_VIEWGROUP_PAGE_H 18 19 #include <components/ui_label.h> 20 #include <components/ui_label_button.h> 21 #include <components/ui_view_group.h> 22 #include "gfx_utils/list.h" 23 24 #include "ui_config.h" 25 #include "app_info.h" 26 #include "native_base.h" 27 28 namespace OHOS { 29 class ViewGroupPage { 30 public: 31 ViewGroupPage() = delete; 32 explicit ViewGroupPage(UIViewGroup* viewGroup); 33 virtual ~ViewGroupPage(); 34 void SetMatrix(int16_t rows, int16_t cols); 35 bool AddApp(AppInfo* pAppInfo); 36 bool RemoveApp(const char* pAppName); 37 bool FindApp(AppInfo* pApp); 38 void SetScale(double scale); 39 40 protected: 41 void SetPosion(int16_t width, int16_t height, int16_t x = 0, int16_t y = 0); 42 void SetStyle(Style sty); 43 bool IsFull(int16_t& row, int16_t& col); 44 void SetUpApp(AppInfo* pAppInfo); 45 void CalculateAppPosition(AppInfo* pAppInfo, int16_t row, int16_t col); 46 47 private: 48 List<AppInfo*> appInfo_; 49 UIViewGroup* viewGroup_ { nullptr }; 50 bool** row_col_ { nullptr }; 51 int16_t row_ { 0 }; 52 int16_t col_ { 0 }; 53 double scale_ { 0.0 }; 54 }; 55 } // namespace OHOS 56 #endif