MCPcopy Create free account
hub / github.com/SimHacker/micropolis / PackAfter

Function PackAfter

micropolis-activity/src/tk/tkpack.c:731–915  ·  view source on GitHub ↗
(interp, prevPtr, parentPtr, argc, argv)

Source from the content-addressed store, hash-verified

729 * Side effects:
730 * The geometry of the specified windows may change, both now and
731 * again in the future.
732 *
733 *--------------------------------------------------------------
734 */
735
736static int
737PackAfter(interp, prevPtr, parentPtr, argc, argv)
738 Tcl_Interp *interp; /* Interpreter for error reporting. */
739 Packer *prevPtr; /* Pack windows in argv just after this
740 * window; NULL means pack as first
741 * child of parentPtr. */
742 Packer *parentPtr; /* Parent in which to pack windows. */
743 int argc; /* Number of elements in argv. */
744 char **argv; /* Array of lists, each containing 2
745 * elements: window name and side
746 * against which to pack. */
747{
748 register Packer *packPtr;
749 Tk_Window tkwin;
750 int length, optionCount;
751 char **options;
752 int index;
753 char c;
754
755 /*
756 * Iterate over all of the window specifiers, each consisting of
757 * two arguments. The first argument contains the window name and
758 * the additional arguments contain options such as "top" or
759 * "padx 20".
760 */
761
762 for ( ; argc > 0; argc -= 2, argv += 2, prevPtr = packPtr) {
763 if (argc < 2) {
764 Tcl_AppendResult(interp, "wrong # args: window \"",
765 argv[0], "\" should be followed by options",
766 (char *) NULL);
767 return TCL_ERROR;
768 }
769
770 /*
771 * Find the packer for the window to be packed, and make sure
772 * that the window in which it will be packed is its parent.
773 */
774
775 tkwin = Tk_NameToWindow(interp, argv[0], parentPtr->tkwin);
776 if (tkwin == NULL) {
777 return TCL_ERROR;
778 }
779 if (Tk_Parent(tkwin) != parentPtr->tkwin) {
780 Tcl_AppendResult(interp, "tried to pack \"",
781 argv[0], "\" in window that isn't its parent",
782 (char *) NULL);
783 return TCL_ERROR;
784 }
785 packPtr = GetPacker(tkwin);
786
787 /*
788 * Process options for this window.

Callers 1

Tk_PackCmdFunction · 0.85

Calls 8

Tcl_AppendResultFunction · 0.85
Tk_NameToWindowFunction · 0.85
Tcl_SplitListFunction · 0.85
Tcl_GetIntFunction · 0.85
Tk_GetAnchorFunction · 0.85
UnlinkFunction · 0.85
Tk_ManageGeometryFunction · 0.85
Tk_DoWhenIdleFunction · 0.70

Tested by

no test coverage detected