Posted to tcl by kevin_walzer at Sun Jan 26 04:07:44 GMT 2025view raw
- /*
- *----------------------------------------------------------------------
- *
- * Tk_GetAccessibleDescription --
- *
- * This function reads a platform-neutral accessibility descrption for a
- * specific widget.
- *
- *
- * Results:
- * Assigns an accessibility description.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
- int
- Tk_GetAccessibleDescription(
- TCL_UNUSED(void *),
- Tcl_Interp *ip, /* Current interpreter. */
- int objc, /* Number of arguments. */
- Tcl_Obj *const objv[]) /* Argument objects. */
- {
- if (objc < 2) {
- Tcl_WrongNumArgs(ip, 1, objv, "window?");
- return TCL_ERROR;
- }
- Tk_Window win;
- Tcl_HashEntry *hPtr, *hPtr2;
- Tcl_HashTable *AccessibleAttributes;
- win = Tk_NameToWindow(ip, Tcl_GetString(objv[1]), Tk_MainWindow(ip));
- if (win == NULL) {
- return TCL_ERROR;
- }
- /* Get accessible description for window. */
- hPtr=Tcl_FindHashEntry(TkAccessibilityObject, win);
- if (!hPtr) {
- Tcl_AppendResult(ip, "No table found. You must set the accessibility role first.", (char *) NULL);
- return TCL_ERROR;
- }
- AccessibleAttributes = Tcl_GetHashValue(hPtr);
- hPtr2=Tcl_FindHashEntry(AccessibleAttributes, "description");
- if (!hPtr2) {
- Tcl_AppendResult(ip, "No description found", (char *) NULL);
- return TCL_ERROR;
- }
- Tcl_SetObjResult(ip, Tcl_GetHashValue(hPtr2));
- return TCL_OK;
- }
Add a comment