diff options
author | joye <joye> | 2014-02-06 18:02:34 (GMT) |
---|---|---|
committer | joye <joye> | 2014-02-06 18:02:34 (GMT) |
commit | 0781e4fad7bfbd5ae456b4cdeb256f4e75fa04a3 (patch) | |
tree | 58ab2032fcda3fae36341efd18878eaa7f253f94 /src/bltConfig.C | |
parent | 8528751fc74cdde52ae670bcc3faec6fc0d37687 (diff) | |
download | blt-0781e4fad7bfbd5ae456b4cdeb256f4e75fa04a3.zip blt-0781e4fad7bfbd5ae456b4cdeb256f4e75fa04a3.tar.gz blt-0781e4fad7bfbd5ae456b4cdeb256f4e75fa04a3.tar.bz2 |
*** empty log message ***
Diffstat (limited to 'src/bltConfig.C')
-rw-r--r-- | src/bltConfig.C | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/bltConfig.C b/src/bltConfig.C index f031086..d855330 100644 --- a/src/bltConfig.C +++ b/src/bltConfig.C @@ -84,6 +84,48 @@ #include "bltInt.h" #include "bltBgStyle.h" +// Background + +static Tk_CustomOptionSetProc BackgroundSetProc; +static Tk_CustomOptionGetProc BackgroundGetProc; +Tk_ObjCustomOption backgroundObjOption = + { + "background", BackgroundSetProc, BackgroundGetProc, NULL, NULL, NULL + }; + + +static int BackgroundSetProc(ClientData clientData, Tcl_Interp *interp, + Tk_Window tkwin, Tcl_Obj** objPtr, char* widgRec, + int offset, char* save, int flags) +{ + Blt_Background* backgroundPtr = (Blt_Background*)(widgRec + offset); + + if (*backgroundPtr) + Blt_FreeBackground(*backgroundPtr); + *backgroundPtr = NULL; + + int length; + const char* string = Tcl_GetStringFromObj(*objPtr, &length); + if (string) + *backgroundPtr = Blt_GetBackground(interp, tkwin, string); + else + return TCL_ERROR; + + return TCL_OK; +} + +static Tcl_Obj* BackgroundGetProc(ClientData clientData, Tk_Window tkwin, + char *widgRec, int offset) +{ + Blt_Background* backgroundPtr = (Blt_Background*)(widgRec + offset); + if (*backgroundPtr) { + const char* string = Blt_NameOfBackground(*backgroundPtr); + return Tcl_NewStringObj(string, -1); + } + else + return Tcl_NewStringObj("", -1); +} + /* STATE */ static Blt_OptionParseProc ObjToStateProc; |