From f338d498adfff69ef86156a39f92d28669206447 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 2 Mar 2023 08:42:31 +0000 Subject: [PATCH] Add internal method to set window position The SetWindowPosition() method of AppCoreUiBase::Impl is added. Change-Id: Idd7a4fbba2d09e64e34c87af1fbe102512861f19 Signed-off-by: Hwankyu Jhun --- tizen-cpp/app-core-ui-cpp/app_core_ui_base.cc | 38 ++++++++++++++++----------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/tizen-cpp/app-core-ui-cpp/app_core_ui_base.cc b/tizen-cpp/app-core-ui-cpp/app_core_ui_base.cc index 014e83a..cfc6e6c 100644 --- a/tizen-cpp/app-core-ui-cpp/app_core_ui_base.cc +++ b/tizen-cpp/app-core-ui-cpp/app_core_ui_base.cc @@ -142,6 +142,7 @@ class AppCoreUiBase::Impl { int FiniWl(); void PluginInit(int argc, char** argv); void PluginFini(); + void SetWindowPosition(const tizen_base::Bundle& b); void Run(int argc, char** argv); void Exit(); @@ -415,6 +416,27 @@ void AppCoreUiBase::Impl::PluginFini() { plugin_->Fini(parent_); } +void AppCoreUiBase::Impl::SetWindowPosition(const tizen_base::Bundle& b) { + std::string x_str = b.GetString(AUL_K_HINT_SCREEN_POS_X); + if (x_str.empty()) + return; + + std::string y_str = b.GetString(AUL_K_HINT_SCREEN_POS_Y); + if (y_str.empty()) + return; + + std::string w_str = b.GetString(AUL_K_HINT_SCREEN_WIDTH); + if (w_str.empty()) + return; + + std::string h_str = b.GetString(AUL_K_HINT_SCREEN_HEIGHT); + if (h_str.empty()) + return; + + position_ = std::make_unique( + std::stoi(x_str), std::stoi(y_str), std::stoi(w_str), std::stoi(h_str)); +} + void AppCoreUiBase::DoRun(int argc, char** argv) { SetCoreDelegator(nullptr); SetLoopDelegator(nullptr); @@ -443,21 +465,7 @@ void AppCoreUiBase::DoRun(int argc, char** argv) { impl_->ApplyBgState(true); } - std::string x_str = b.GetString(AUL_K_HINT_SCREEN_POS_X); - if (!x_str.empty()) { - std::string y_str = b.GetString(AUL_K_HINT_SCREEN_POS_Y); - std::string w_str = b.GetString(AUL_K_HINT_SCREEN_WIDTH); - std::string h_str = b.GetString(AUL_K_HINT_SCREEN_HEIGHT); - if (!y_str.empty() && !w_str.empty() && !h_str.empty()) { - int x = atoi(x_str.c_str()); - int y = atoi(y_str.c_str()); - int w = atoi(w_str.c_str()); - int h = atoi(h_str.c_str()); - - impl_->position_ = - std::make_unique(x, y, w, h); - } - } + impl_->SetWindowPosition(b); } if (impl_->hint_ & HINT_WINDOW_ID_CONTROL) -- 2.7.4