1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
/*
* Copyright (C) 2005-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#include "Image.h"
#include "addons/binary-addons/AddonDll.h"
#include "addons/kodi-dev-kit/include/kodi/gui/controls/Image.h"
#include "guilib/GUIImage.h"
#include "utils/log.h"
using namespace KODI;
namespace ADDON
{
void Interface_GUIControlImage::Init(AddonGlobalInterface* addonInterface)
{
addonInterface->toKodi->kodi_gui->control_image =
new AddonToKodiFuncTable_kodi_gui_control_image();
addonInterface->toKodi->kodi_gui->control_image->set_visible = set_visible;
addonInterface->toKodi->kodi_gui->control_image->set_filename = set_filename;
addonInterface->toKodi->kodi_gui->control_image->set_color_diffuse = set_color_diffuse;
}
void Interface_GUIControlImage::DeInit(AddonGlobalInterface* addonInterface)
{
delete addonInterface->toKodi->kodi_gui->control_image;
}
void Interface_GUIControlImage::set_visible(KODI_HANDLE kodiBase,
KODI_GUI_CONTROL_HANDLE handle,
bool visible)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
CGUIImage* control = static_cast<CGUIImage*>(handle);
if (!addon || !control)
{
CLog::Log(LOGERROR,
"Interface_GUIControlImage::{} - invalid handler data (kodiBase='{}', handle='{}') "
"on addon '{}'",
__func__, kodiBase, handle, addon ? addon->ID() : "unknown");
return;
}
control->SetVisible(visible);
}
void Interface_GUIControlImage::set_filename(KODI_HANDLE kodiBase,
KODI_GUI_CONTROL_HANDLE handle,
const char* filename,
bool use_cache)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
CGUIImage* control = static_cast<CGUIImage*>(handle);
if (!addon || !control || !filename)
{
CLog::Log(LOGERROR,
"Interface_GUIControlImage::{} - invalid handler data (kodiBase='{}', handle='{}', "
"filename='{}') on addon '{}'",
__func__, kodiBase, handle, static_cast<const void*>(filename),
addon ? addon->ID() : "unknown");
return;
}
control->SetFileName(filename, false, use_cache);
}
void Interface_GUIControlImage::set_color_diffuse(KODI_HANDLE kodiBase,
KODI_GUI_CONTROL_HANDLE handle,
uint32_t colorDiffuse)
{
CAddonDll* addon = static_cast<CAddonDll*>(kodiBase);
CGUIImage* control = static_cast<CGUIImage*>(handle);
if (!addon || !control)
{
CLog::Log(LOGERROR,
"Interface_GUIControlImage::{} - invalid handler data (kodiBase='{}', handle='{}') "
"on addon '{}'",
__func__, kodiBase, handle, addon ? addon->ID() : "unknown");
return;
}
control->SetColorDiffuse(GUILIB::GUIINFO::CGUIInfoColor(colorDiffuse));
}
} /* namespace ADDON */
|