LoadImageFromFile for CImageBox
This commit is contained in:
@@ -1247,6 +1247,15 @@ namespace UI
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CImageBox::LoadImageFromFile(const char* c_szFileName)
|
||||
{
|
||||
CPackManager::instance().SetFileLoadMode();
|
||||
BOOL r = LoadImage(c_szFileName);
|
||||
CPackManager::instance().SetPackLoadMode();
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void CImageBox::SetDiffuseColor(float fr, float fg, float fb, float fa)
|
||||
{
|
||||
if (!m_pImageInstance)
|
||||
|
||||
@@ -335,6 +335,7 @@ namespace UI
|
||||
virtual ~CImageBox();
|
||||
|
||||
BOOL LoadImage(const char * c_szFileName);
|
||||
BOOL LoadImageFromFile(const char * c_szFileName);
|
||||
void SetDiffuseColor(float fr, float fg, float fb, float fa);
|
||||
|
||||
int GetWidth();
|
||||
|
||||
@@ -1957,6 +1957,21 @@ PyObject * wndImageLoadImage(PyObject * poSelf, PyObject * poArgs)
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject* wndImageLoadImageFromFile(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
UI::CWindow* pWindow;
|
||||
if (!PyTuple_GetWindow(poArgs, 0, &pWindow))
|
||||
return Py_BuildException();
|
||||
char* szFileName;
|
||||
if (!PyTuple_GetString(poArgs, 1, &szFileName))
|
||||
return Py_BuildException();
|
||||
|
||||
if (!((UI::CImageBox*)pWindow)->LoadImageFromFile(szFileName))
|
||||
return Py_BuildException("Failed to load image from file (filename: %s)", szFileName);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * wndImageSetDiffuseColor(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
UI::CWindow * pWindow;
|
||||
@@ -2451,6 +2466,7 @@ void initwndMgr()
|
||||
|
||||
// ImageBox
|
||||
{ "LoadImage", wndImageLoadImage, METH_VARARGS },
|
||||
{ "LoadImageFromFile", wndImageLoadImageFromFile, METH_VARARGS },
|
||||
{ "SetDiffuseColor", wndImageSetDiffuseColor, METH_VARARGS },
|
||||
{ "GetWidth", wndImageGetWidth, METH_VARARGS },
|
||||
{ "GetHeight", wndImageGetHeight, METH_VARARGS },
|
||||
|
||||
Reference in New Issue
Block a user