summaryrefslogtreecommitdiffstats
path: root/src/bltConfig.C
diff options
context:
space:
mode:
Diffstat (limited to 'src/bltConfig.C')
-rw-r--r--src/bltConfig.C38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/bltConfig.C b/src/bltConfig.C
index d855330..e095eaf 100644
--- a/src/bltConfig.C
+++ b/src/bltConfig.C
@@ -126,6 +126,44 @@ static Tcl_Obj* BackgroundGetProc(ClientData clientData, Tk_Window tkwin,
return Tcl_NewStringObj("", -1);
}
+// Point
+static Tk_CustomOptionSetProc PointSetProc;
+static Tk_CustomOptionGetProc PointGetProc;
+Tk_ObjCustomOption pointObjOption =
+ {
+ "point", PointSetProc, PointGetProc, NULL, NULL, NULL
+ };
+
+static int PointSetProc(ClientData clientData, Tcl_Interp *interp,
+ Tk_Window tkwin, Tcl_Obj** objPtr, char* widgRec,
+ int offset, char* save, int flags)
+{
+ XPoint *pointPtr = (XPoint *)(widgRec + offset);
+ int x, y;
+
+ if (Blt_GetXY(interp, tkwin, Tcl_GetString(*objPtr), &x, &y) != TCL_OK)
+ return TCL_ERROR;
+
+ pointPtr->x = x;
+ pointPtr->y = y;
+
+ return TCL_OK;
+};
+
+static Tcl_Obj* PointGetProc(ClientData clientData, Tk_Window tkwin,
+ char *widgRec, int offset)
+{
+ XPoint *pointPtr = (XPoint *)(widgRec + offset);
+
+ if ((pointPtr->x != -SHRT_MAX) && (pointPtr->y != -SHRT_MAX)) {
+ char string[200];
+ sprintf_s(string, 200, "@%d,%d", pointPtr->x, pointPtr->y);
+ return Tcl_NewStringObj(string, -1);
+ }
+ else
+ return Tcl_NewStringObj("", -1);
+};
+
/* STATE */
static Blt_OptionParseProc ObjToStateProc;