From 01ab57dabbc15f52143089e53317bb51b71dc7f2 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 8 Nov 2011 10:46:30 +0100 Subject: New lua and xml attr methods for setting widget foreground and background colours. --- client/widgets/widget.h | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'client/widgets/widget.h') diff --git a/client/widgets/widget.h b/client/widgets/widget.h index d0f1799..4f23790 100644 --- a/client/widgets/widget.h +++ b/client/widgets/widget.h @@ -61,6 +61,12 @@ * @att local This attribute is a boolean telling wether the field can be stored * in the database on commits. It can be either 'true' or 'false'. The default * is 'false'. + * @att colour The foreground (text) colour of the widget. The value must be a + * 6 byte hexadecimal string with each 2 byte pair describing the colour + * channels in order: Red, green blue. Example: '0f1a3b'. + * @att bgcolour The background colour of the widget. The value must be a + * 6 byte hexadecimal string with each 2 byte pair describing the colour + * channels in order: Red, green blue. Example: '0f1a3b'. */ class QLayout; @@ -106,6 +112,13 @@ public: virtual bool setKeyboardFocus(); + virtual void setForegroundColour(unsigned char red, + unsigned char green, + unsigned char blue); + virtual void setBackgroundColour(unsigned char red, + unsigned char green, + unsigned char blue); + virtual QWidget *qwidget() { return widget; } // Set deep to true to search through inner widgets. @@ -278,6 +291,30 @@ int wdg_valid(lua_State *L); */ int wdg_set_valid(lua_State *L); +/*** + * @method nil setBackgroundColour(integer red, integer green, integer blue) + * This method is used to change to background colour of the widget. + * @param red An integer value in the range 0-255. This is the red component of + * the RGB colour value. + * @param green An integer value in the range 0-255. This is the green component + * of the RGB colour value. + * @param blue An integer value in the range 0-255. This is the blue component + * of the RGB colour value. + */ +int wdg_set_bgcol(lua_State *L); + +/*** + * @method nil setForegroundColour(integer red, integer green, integer blue) + * This method is used to change to foreground (text) colour of the widget. + * @param red An integer value in the range 0-255. This is the red component of + * the RGB colour value. + * @param green An integer value in the range 0-255. This is the green component + * of the RGB colour value. + * @param blue An integer value in the range 0-255. This is the blue component + * of the RGB colour value. + */ +int wdg_set_fgcol(lua_State *L); + #define WDG_METHS \ {"name", wdg_name},\ {"type", wdg_type},\ @@ -290,7 +327,9 @@ int wdg_set_valid(lua_State *L); {"hidden", wdg_hidden},\ {"setHidden", wdg_set_hidden},\ {"valid", wdg_valid},\ - {"setValid", wdg_set_valid} + {"setValid", wdg_set_valid},\ + {"setForegroundColour", wdg_set_fgcol},\ + {"setBackgroundColour", wdg_set_bgcol} const struct luaL_Reg wdg_meths[] = { WDG_METHS, {NULL, NULL} }; -- cgit v1.2.3