Browse Source

Move methods to pyGUIControl to pyGUIControlTextBox.

Anne Marije v/d Meer 11 years ago
parent
commit
664339a4bd
  1. 30
      Sources/Plasma/FeatureLib/pfPython/pyGUIControl.cpp
  2. 4
      Sources/Plasma/FeatureLib/pfPython/pyGUIControl.h
  3. 19
      Sources/Plasma/FeatureLib/pfPython/pyGUIControlGlue.cpp
  4. 29
      Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.cpp
  5. 3
      Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBox.h
  6. 17
      Sources/Plasma/FeatureLib/pfPython/pyGUIControlTextBoxGlue.cpp

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

@ -445,3 +445,33 @@ void pyGUIControl::SetFontSize(uint32_t fontsize)
} }
} }
} }
void pyGUIControl::SetFontFlags(uint8_t fontFlags)
{
if (fGCkey)
{
// get the pointer to the modifier
pfGUIControlMod* pdmod = pfGUIControlMod::ConvertNoRef(fGCkey->ObjectIsLoaded());
if (pdmod)
{
pfGUIColorScheme* colorscheme = pdmod->GetColorScheme();
colorscheme->fFontFlags = fontFlags;
}
}
}
uint8_t pyGUIControl::GetFontFlags()
{
if (fGCkey)
{
// get the pointer to the modifier
pfGUIControlMod* pdmod = pfGUIControlMod::ConvertNoRef(fGCkey->ObjectIsLoaded());
if (pdmod)
{
pfGUIColorScheme* colorscheme = pdmod->GetColorScheme();
return colorscheme->fFontFlags;
}
}
return 0;
}

4
Sources/Plasma/FeatureLib/pfPython/pyGUIControl.h

@ -118,13 +118,15 @@ public:
virtual PyObject* GetSelColor(); // returns pyColor virtual PyObject* GetSelColor(); // returns pyColor
virtual PyObject* GetBackColor(); // returns pyColor virtual PyObject* GetBackColor(); // returns pyColor
virtual PyObject* GetBackSelColor(); // returns pyColor virtual PyObject* GetBackSelColor(); // returns pyColor
virtual uint32_t GetFontSize(); virtual uint32_t GetFontSize();
virtual uint8_t GetFontFlags();
// set color scheme // set color scheme
virtual void SetForeColor( float r, float g, float b, float a ); virtual void SetForeColor( float r, float g, float b, float a );
virtual void SetSelColor( float r, float g, float b, float a ); virtual void SetSelColor( float r, float g, float b, float a );
virtual void SetBackColor( float r, float g, float b, float a ); virtual void SetBackColor( float r, float g, float b, float a );
virtual void SetBackSelColor( float r, float g, float b, float a ); virtual void SetBackSelColor( float r, float g, float b, float a );
virtual void SetFontSize(uint32_t fontsize); virtual void SetFontSize(uint32_t fontsize);
virtual void SetFontFlags(uint8_t fontflags);
}; };

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

@ -246,6 +246,23 @@ PYTHON_METHOD_DEFINITION_NOARGS(ptGUIControl, getFontSize)
return PyLong_FromUnsignedLong(self->fThis->GetFontSize()); return PyLong_FromUnsignedLong(self->fThis->GetFontSize());
} }
PYTHON_METHOD_DEFINITION_NOARGS(ptGUIControl, getFontFlags)
{
return PyInt_FromLong(self->fThis->GetFontFlags());
}
PYTHON_METHOD_DEFINITION(ptGUIControl, 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(ptGUIControl, setForeColor, args) PYTHON_METHOD_DEFINITION(ptGUIControl, setForeColor, args)
{ {
float r, g, b, a; float r, g, b, a;
@ -331,11 +348,13 @@ PYTHON_START_METHODS_TABLE(ptGUIControl)
PYTHON_METHOD_NOARGS(ptGUIControl, getBackColor, "Returns the background color"), PYTHON_METHOD_NOARGS(ptGUIControl, getBackColor, "Returns the background color"),
PYTHON_METHOD_NOARGS(ptGUIControl, getBackSelectColor, "Returns the background selection color"), PYTHON_METHOD_NOARGS(ptGUIControl, getBackSelectColor, "Returns the background selection color"),
PYTHON_METHOD_NOARGS(ptGUIControl, getFontSize, "Returns the font size"), PYTHON_METHOD_NOARGS(ptGUIControl, getFontSize, "Returns the font size"),
PYTHON_METHOD_NOARGS(ptGUIControl, getFontFlags, "Returns the current fontflags"),
PYTHON_METHOD(ptGUIControl, setForeColor, "Params: r,g,b,a\nSets the foreground color"), PYTHON_METHOD(ptGUIControl, setForeColor, "Params: r,g,b,a\nSets the foreground color"),
PYTHON_METHOD(ptGUIControl, setSelectColor, "Params: r,g,b,a\nSets the selection color"), PYTHON_METHOD(ptGUIControl, setSelectColor, "Params: r,g,b,a\nSets the selection color"),
PYTHON_METHOD(ptGUIControl, setBackColor, "Params: r,g,b,a\nSets the background color"), PYTHON_METHOD(ptGUIControl, setBackColor, "Params: r,g,b,a\nSets the background color"),
PYTHON_METHOD(ptGUIControl, setBackSelectColor, "Params: r,g,b,a\nSets the selection background color"), PYTHON_METHOD(ptGUIControl, setBackSelectColor, "Params: r,g,b,a\nSets the selection background color"),
PYTHON_METHOD(ptGUIControl, setFontSize, "Params: fontSize\nSets the font size"), PYTHON_METHOD(ptGUIControl, setFontSize, "Params: fontSize\nSets the font size"),
PYTHON_METHOD(ptGUIControl, setFontFlags, "Params: fontflags\nSets current fontflags"),
PYTHON_END_METHODS_TABLE; PYTHON_END_METHODS_TABLE;
// Type structure definition // Type structure definition

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

@ -213,32 +213,3 @@ 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;
}

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

@ -86,10 +86,9 @@ 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_

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

@ -188,22 +188,7 @@ 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)
{ {
@ -224,10 +209,8 @@ 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