mcu_hi3321_watch/tjd/ui/common/TjdUiImageView.cpp
2025-05-26 20:15:20 +08:00

48 lines
1.4 KiB
C++

#include "TjdUiImageView.h"
#include "TjdUiMultiLanguageExt.h"
#define ENABLE_PRINT_INFO 1
#if ENABLE_PRINT_INFO
#define static_print_info(...) sys_ui_log_i(__VA_ARGS__) // 一般信息打印宏控制
#define static_print_warn(...) sys_ui_log_w(__VA_ARGS__) // 警告信息打印一般常开
#define static_print_error(...) sys_ui_log_e(__VA_ARGS__) // 错误信息打印一般常开
#else
#define static_print_info(...)
#define static_print_warn(...)
#define static_print_error(...)
#endif
using namespace OHOS;
namespace TJD {
TjdUiImageView::TjdUiImageView()
{
}
TjdUiImageView::~TjdUiImageView()
{
}
void TjdUiImageView::SetPosition(int16_t x, int16_t y, int16_t width, int16_t height, bool isMirror)
{
UIView* view = GetParent();
if (view == nullptr || TjdUiMultiLanguageExt::IsSpecialLanguage() == false) {
UIImageView::SetPosition(x, y, width, height);
//printf("TjdUiImageView::SetPosition x=%d, y=%d, width=%d, height=%d\n", x, y, width, height);
return;
}
int16_t parentWidth = view->GetWidth();
int16_t parentHeight = view->GetHeight();
int16_t parentX = view->GetX();
int16_t parentY = view->GetY();
int16_t newX = parentWidth - x - width;
int16_t newY = parentHeight - y - height;
UIImageView::SetPosition(newX, newY, width, height);
//printf("-------------------TjdUiImageView::SetPosition x=%d, y=%d, width=%d, height=%d\n", x, y, width, height);
}
}