2
3
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-14 02:27:40 -04:00

add python api to set flags

Clean up unwanted changes caused by IDE extension -.-

Reworked implementation
This commit is contained in:
Anne Marije v/d Meer
2014-04-01 16:38:12 +02:00
parent a0bbef1819
commit 39ff487ca8
3 changed files with 51 additions and 0 deletions

View File

@ -214,3 +214,33 @@ UInt8 pyGUIControlTextBox::GetJustify()
}
return pfGUIListText::kLeftJustify;
}
void pyGUIControlTextBox::SetFontFlags(UInt8 fontFlags)
{
if (fGCkey)
{
// get the pointer to the modifier
pfGUITextBoxMod* ptbmod = pfGUITextBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded());
if (ptbmod)
{
pfGUIColorScheme* colorscheme = ptbmod->GetColorScheme();
colorscheme->fFontFlags = fontFlags;
ptbmod->UpdateColorScheme();
}
}
}
UInt8 pyGUIControlTextBox::GetFontFlags()
{
if (fGCkey)
{
// get the pointer to the modifier
pfGUITextBoxMod* ptbmod = pfGUITextBoxMod::ConvertNoRef(fGCkey->ObjectIsLoaded());
if (ptbmod)
{
pfGUIColorScheme* colorscheme = ptbmod->GetColorScheme();
return colorscheme->fFontFlags;
}
}
return 0;
}

View File

@ -88,8 +88,10 @@ public:
virtual void SetForeColor( pyColor& color );
virtual void SetBackColor( pyColor& color );
virtual void SetJustify( UInt8 justify );
virtual void SetFontFlags(UInt8 fontflags);
virtual UInt8 GetJustify();
virtual PyObject* GetForeColor(); // returns pyColor
virtual UInt8 GetFontFlags();
};
#endif // _pyGUIControlTextBox_h_

View File

@ -185,6 +185,23 @@ PYTHON_METHOD_DEFINITION(ptGUIControlTextBox, setStringJustify, args)
PYTHON_RETURN_NONE;
}
PYTHON_METHOD_DEFINITION(ptGUIControlTextBox, setFontFlags, args)
{
unsigned char fontflags;
if (!PyArg_ParseTuple(args, "b", &fontflags))
{
PyErr_SetString(PyExc_TypeError, "setFontFlags expects an unsigned 8-bit int");
PYTHON_RETURN_ERROR;
}
self->fThis->SetFontFlags(fontflags);
PYTHON_RETURN_NONE;
}
PYTHON_METHOD_DEFINITION_NOARGS(ptGUIControlTextBox, getFontFlags)
{
return PyInt_FromLong(self->fThis->GetFontFlags());
}
PYTHON_METHOD_DEFINITION_NOARGS(ptGUIControlTextBox, getStringJustify)
{
return PyInt_FromLong(self->fThis->GetJustify());
@ -204,8 +221,10 @@ PYTHON_START_METHODS_TABLE(ptGUIControlTextBox)
PYTHON_METHOD(ptGUIControlTextBox, setForeColor, "Params: color\nSets the text forecolor to 'color', which is a ptColor object."),
PYTHON_METHOD(ptGUIControlTextBox, setBackColor, "Params: color\nSets the text backcolor to 'color', which is a ptColor object."),
PYTHON_METHOD(ptGUIControlTextBox, setStringJustify, "Params: justify\nSets current justify"),
PYTHON_METHOD(ptGUIControlTextBox, setFontFlags, "Params: fontflags\nSets current fontflags"),
PYTHON_METHOD_NOARGS(ptGUIControlTextBox, getStringJustify, "Returns current justify"),
PYTHON_METHOD_NOARGS(ptGUIControlTextBox, getForeColor, "Returns the current forecolor"),
PYTHON_METHOD_NOARGS(ptGUIControlTextBox, getFontFlags, "Returns the current fontflags"),
PYTHON_END_METHODS_TABLE;
// Type structure definition