Browse Source

add python api to set flags

Clean up unwanted changes caused by IDE extension -.-

Reworked implementation
Anne Marije v/d Meer 11 years ago
parent
commit
4e613d1899
  1. 30
      Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.cpp
  2. 2
      Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h
  3. 19
      Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBoxGlue.cpp

30
Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.cpp

@ -212,3 +212,33 @@ uint8_t pyGUIControlTextBox::GetJustify()
} }
return pfGUIListText::kLeftJustify; return pfGUIListText::kLeftJustify;
} }
void pyGUIControlTextBox::SetFontFlags(uint8_t 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_t 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;
}

2
Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h

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

19
Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBoxGlue.cpp

@ -188,6 +188,23 @@ PYTHON_METHOD_DEFINITION(ptGUIControlTextBox, setStringJustify, args)
PYTHON_RETURN_NONE; 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) PYTHON_METHOD_DEFINITION_NOARGS(ptGUIControlTextBox, getStringJustify)
{ {
return PyInt_FromLong(self->fThis->GetJustify()); return PyInt_FromLong(self->fThis->GetJustify());
@ -207,8 +224,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, 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, 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, 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, getStringJustify, "Returns current justify"),
PYTHON_METHOD_NOARGS(ptGUIControlTextBox, getForeColor, "Returns the current forecolor"), PYTHON_METHOD_NOARGS(ptGUIControlTextBox, getForeColor, "Returns the current forecolor"),
PYTHON_METHOD_NOARGS(ptGUIControlTextBox, getFontFlags, "Returns the current fontflags"),
PYTHON_END_METHODS_TABLE; PYTHON_END_METHODS_TABLE;
// Type structure definition // Type structure definition

Loading…
Cancel
Save