void main(int argc, char **argv) { Widget Container5, *IconGad; int i, num_obj; Cardinal n; Arg args[MAX_ARGS]; char test_char; int test_num; char ContainerName[NAME_LEN + 1]; ContainerName[0] = '\0'; test_char = '\0'; test_num = 0; CommonTestInit(argc, argv); num_obj = 10; if (UserData != NULL) { if (strcmp(UserData, "a") == 0) { num_obj = 4; test_num = 1; } if (strcmp(UserData, "b") == 0) { num_obj = 5; test_num = 2; } if (strcmp(UserData, "c") == 0) { num_obj = 9; test_num = 3; } if (strcmp(UserData, "d") == 0) { num_obj = 20; test_num = 4; } if (strcmp(UserData, "e") == 0) { num_obj = 4; test_num = 5; } test_char = *UserData; free(UserData); } sprintf(ContainerName, "Container5%c", test_char); n = 0; Container5 = XmCreateContainer(Shell1, ContainerName, args, n); XtManageChild(Container5); XtRealizeWidget(Shell1); CommonPause(); /* Add a bunch of Icon Gadgets */ IconGad = (Widget*) XtMalloc(NUM_OBJ*sizeof(Widget)); for (i = 0; i < num_obj; i++) { char IconName[20] ; XmString icon_name; n = 0 ; sprintf(IconName, "IconGad%d", i); icon_name = XmStringGenerate(IconName, NULL, XmCHARSET_TEXT, NULL); XtSetArg(args[n], XmNlabelString, icon_name); n++; IconGad[i] = XmCreateIconGadget(Container5, IconName, args, n); XtManageChild(IconGad[i]); XmStringFree(icon_name); } CommonPause(); if (test_num == 0 || test_num == 1) { /* Set the Spatial Style to None */ n = 0; XtSetArg(args[n], XmNspatialStyle, XmNONE); n++; XtSetValues(Container5, args, n); CommonPause(); /* Unmanage all the children - Change the ResizeModel - and Remanage */ XtUnmanageChildren(IconGad, num_obj); n = 0; XtSetArg(args[n], XmNspatialStyle, XmGRID); n++; XtSetArg(args[n], XmNspatialResizeModel, XmGROW_BALANCED); n++; XtSetValues(Container5, args, n); XtManageChildren(IconGad, num_obj); CommonPause(); } if (test_num == 2) { int new_obj; /* Test the different ResizeModel - Start by adding children with grow_balanced, then add with grow_major and then grow_minor. */ new_obj = 4; for (i = num_obj; i < (num_obj+new_obj); i++) { char IconName[20] ; XmString icon_name; n = 0 ; sprintf(IconName, "IconGad%d", i); icon_name = XmStringGenerate(IconName, NULL, XmCHARSET_TEXT, NULL); XtSetArg(args[n], XmNlabelString, icon_name); n++; IconGad[i] = XmCreateIconGadget(Container5, IconName, args, n); XmStringFree(icon_name); } XtManageChildren(&IconGad[num_obj], new_obj); num_obj = num_obj + new_obj; CommonPause(); new_obj = 5; n = 0; XtSetArg(args[n], XmNspatialResizeModel, XmGROW_MAJOR); n++; XtSetValues(Container5, args, n); for (i = num_obj; i < (num_obj+new_obj); i++) { char IconName[20] ; XmString icon_name; n = 0 ; sprintf(IconName, "IconGad%d", i); icon_name = XmStringGenerate(IconName, NULL, XmCHARSET_TEXT, NULL); XtSetArg(args[n], XmNlabelString, icon_name); n++; IconGad[i] = XmCreateIconGadget(Container5, IconName, args, n); XmStringFree(icon_name); } XtManageChildren(&IconGad[num_obj], new_obj); num_obj = num_obj + new_obj; CommonPause(); n = 0; XtSetArg(args[n], XmNspatialResizeModel, XmGROW_MINOR); n++; XtSetValues(Container5, args, n); for (i = num_obj; i < (num_obj+new_obj); i++) { char IconName[20] ; XmString icon_name; n = 0 ; sprintf(IconName, "IconGad%d", i); icon_name = XmStringGenerate(IconName, NULL, XmCHARSET_TEXT, NULL); XtSetArg(args[n], XmNlabelString, icon_name); n++; IconGad[i] = XmCreateIconGadget(Container5, IconName, args, n); XmStringFree(icon_name); } XtManageChildren(&IconGad[num_obj], new_obj); num_obj = num_obj + new_obj; } if (test_num == 3) { char IconName[20]; XmString icon_name; /* Change the spatialStyle to GRID */ n = 0; XtSetArg(args[n], XmNspatialStyle, XmGRID); n++; XtSetValues(Container5, args, n); CommonPause(); /* Test the spatialIncludeModel Add some children and check where they go */ i = num_obj; n = 0 ; sprintf(IconName, "IconGad%d", i); icon_name = XmStringGenerate(IconName, NULL, XmCHARSET_TEXT, NULL); XtSetArg(args[n], XmNlabelString, icon_name); n++; IconGad[i] = XmCreateIconGadget(Container5, IconName, args, n); XmStringFree(icon_name); XtManageChild(IconGad[i]); CommonPause(); /* set the spatialIncludeModel to FIRST_FIT */ n = 0; XtSetArg(args[n], XmNspatialIncludeModel, XmFIRST_FIT); n++; XtSetValues(Container5, args, n); i = num_obj + 1; n = 0 ; sprintf(IconName, "IconGad%d", i); icon_name = XmStringGenerate(IconName, NULL, XmCHARSET_TEXT, NULL); XtSetArg(args[n], XmNlabelString, icon_name); n++; IconGad[i] = XmCreateIconGadget(Container5, IconName, args, n); XmStringFree(icon_name); XtManageChild(IconGad[i]); } CommonPause(); XtAppMainLoop(app_context); }
void main(int argc, char **argv) { XmStringTable ColumnDetails; int i,j; Cardinal n; Arg args[MAX_ARGS]; int test_num; char test_char; char ContainerName[NAME_LEN + 1]; Pixmap CollapsedStatePixmap, ExpandedStatePixmap; ContainerName[0] = '\0'; test_num = 0; test_char = '\0'; CommonTestInit(argc, argv); if (UserData != NULL) { if (strcmp(UserData, "a") == 0) test_num = 1; else if (strcmp(UserData, "b") == 0) test_num = 2; else if (strcmp(UserData, "c") == 0) test_num = 3; else if (strcmp(UserData, "d") == 0) test_num = 4; test_char = *UserData; free(UserData); } sprintf(ContainerName, "Container3%c", test_char); CollapsedStatePixmap = XCreatePixmapFromBitmapData(display, rootWindow, collapsedState_bits, collapsedState_width, collapsedState_height, CommonGetColor("black"), CommonGetColor("white"), XDefaultDepth(display, XDefaultScreen(display))); ExpandedStatePixmap = XCreatePixmapFromBitmapData(display, rootWindow, expandedState_bits, expandedState_width, expandedState_height, CommonGetColor("white"), CommonGetColor("black"), XDefaultDepth(display, XDefaultScreen(display))); ColumnHeadings = (XmStringTable) XtMalloc(NUM_COL * sizeof(XmString)); for (i = 0; i < NUM_COL; i++) ColumnHeadings[i] = XmStringGenerate(ColumnHeadingText[i], NULL, XmCHARSET_TEXT, NULL); n = 0; XtSetArg(args[n], XmNentryViewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNlayoutType, XmOUTLINE); n++; XtSetArg(args[n], XmNautomaticSelection, XmNO_AUTO_SELECT); n++; XtSetArg(args[n], XmNdetailColumnHeading, ColumnHeadings); n++; XtSetArg(args[n], XmNdetailColumnHeadingCount, NUM_COL); n++; XtSetArg(args[n], XmNdetailOrderCount, NUM_COL-1); n++; XtSetArg(args[n], XmNcollapsedStatePixmap, CollapsedStatePixmap); n++; XtSetArg(args[n], XmNexpandedStatePixmap, ExpandedStatePixmap); n++; Container3 = XmCreateContainer(Shell1, ContainerName, args, n); XtManageChild(Container3); EntryDetails = (XmStringTable *) XtMalloc(NUM_OBJ * sizeof(XmStringTable)); for (i = 0; i < NUM_OBJ; i++) { ColumnDetails = (XmStringTable)XtMalloc((NUM_COL-1) * sizeof(XmString)); ColumnDetails[0] = XmStringGenerate(FullTitleText[i], NULL, XmCHARSET_TEXT, NULL); ColumnDetails[1] = XmStringGenerate(FlavorText[i], NULL, XmCHARSET_TEXT, NULL); ColumnDetails[2] = XmStringGenerate(AgeText[i], NULL, XmCHARSET_TEXT, NULL); EntryDetails[i] = ColumnDetails; } n = 0; XtSetArg(args[n], XmNx, 100); n++; XtSetArg(args[n], XmNy, 100); n++; XtSetArg(args[n], XmNentryViewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[0]); n++; IconGad1 = XmCreateIconGadget(Container3, "IconGad1", args, n); XtManageChild(IconGad1); n = 0; XtSetArg(args[n], XmNx, 200); n++; XtSetArg(args[n], XmNy, 200); n++; XtSetArg(args[n], XmNentryViewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[1]); n++; IconGad2 = XmCreateIconGadget(Container3, "IconGad2", args, n); XtManageChild(IconGad2); n = 0; XtSetArg(args[n], XmNx, 300); n++; XtSetArg(args[n], XmNy, 100); n++; XtSetArg(args[n], XmNentryViewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[2]); n++; IconGad3 = XmCreateIconGadget(Container3, "IconGad3", args, n); XtManageChild(IconGad3); n = 0; XtSetArg(args[n], XmNx, 50); n++; XtSetArg(args[n], XmNy, 400); n++; XtSetArg(args[n], XmNentryViewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[3]); n++; IconGad4 = XmCreateIconGadget(Container3, "IconGad4", args, n); XtManageChild(IconGad4); n = 0; XtSetArg(args[n], XmNentryParent, IconGad3); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNentryViewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetail, EntryDetails[4]); n++; IconGad31 = XmCreateIconGadget(Container3, "IconGad31", args, n); XtManageChild(IconGad31); n = 0; XtSetArg(args[n], XmNentryParent, IconGad3); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNentryViewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetail, EntryDetails[5]); n++; IconGad32 = XmCreateIconGadget(Container3, "IconGad32", args, n); XtManageChild(IconGad32); n = 0; XtSetArg(args[n], XmNentryParent, IconGad32); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNentryViewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNdetail, EntryDetails[6]); n++; IconGad321 = XmCreateIconGadget(Container3, "IconGad321", args, n); XtManageChild(IconGad321); n = 0; XtSetArg(args[n], XmNentryParent, IconGad321); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNentryViewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNdetail, EntryDetails[7]); n++; IconGad3211 = XmCreateIconGadget(Container3, "IconGad3211", args, n); XtManageChild(IconGad3211); n = 0; XtSetArg(args[n], XmNentryParent, IconGad3); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNentryViewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetail, EntryDetails[8]); n++; IconGad33 = XmCreateIconGadget(Container3, "IconGad33", args, n); XtManageChild(IconGad33); for (i = 0; i < NUM_OBJ; i++) { ColumnDetails = EntryDetails[i]; for (j = 0; j < NUM_COL-1; j++) XmStringFree(ColumnDetails[j]); XtFree((XtPointer)ColumnDetails); } XtFree((XtPointer)EntryDetails); XtRealizeWidget(Shell1); CommonPause(); if ((test_num == 1) || (test_num == 2)) { CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); for (i = 0; i < NUM_COL; i++) XmStringFree(ColumnHeadings[i]); XtFree((XtPointer)ColumnHeadings); } if (test_num == 3) { CommonPause(); for (i = 0; i < NUM_COL; i++) XmStringFree(ColumnHeadings[i]); XtFree((XtPointer)ColumnHeadings); } XtAppMainLoop(app_context); }
Widget XmCreateContainer_TNK(Widget parent, String name, ArgList arglist,Cardinal argcount) { return XmCreateContainer(parent, name, arglist, argcount);}
int main(int argc, char **argv) { Widget ScrollWin, Container, *IconGad; int i; Cardinal n; Arg args[MAX_ARGS]; Dimension x_size, y_size; CommonTestInit(argc, argv); n = 0; XtSetArg( args[n], XmNx, 20 ); n++; ScrollWin = XmCreateScrolledWindow(Shell1, "ScrollWin7", args, n); XtManageChild(ScrollWin); XtSetArg(args[n], XmNselectionPolicy, XmMULTIPLE_SELECT); n++; XtSetArg(args[n], XmNspatialStyle, XmNONE ); n++; Container = XmCreateContainer(ScrollWin, "Container7", args, n); XtManageChild(Container); /* Add a bunch of Icon Gadgets */ IconGad = (Widget*) XtMalloc(NUM_ELEMS * sizeof(Widget)); /* Put some pixmaps in the Container */ for (i = 0; i < NUM_PIXMAP; i++) { char IconName[20] ; XmString icon_name; Pixmap pixmap; n = 0 ; sprintf(IconName, "IconGad%d", i); icon_name = XmStringGenerate(IconName, NULL, XmCHARSET_TEXT, NULL); /* make icons from pixmap files */ pixmap = XmGetPixmap(screen, BitmapPaths[i], BlackPixelOfScreen(screen), WhitePixelOfScreen(screen)); if (!pixmap) { printf("Can't make pixmap for file %s!\n", BitmapPaths[i]); exit(1); } XtSetArg(args[n], XmNx, PIXEL_X(i) ); n++; XtSetArg(args[n], XmNy, PIXEL_Y(i) ); n++; XtSetArg(args[n], XmNlabelString, icon_name); n++; XtSetArg(args[n], XmNlargeIconPixmap, pixmap); n++; IconGad[i] = XmCreateIconGadget(Container, IconName, args, n); XtManageChild(IconGad[i]); XmStringFree(icon_name); } /* Put some labels in the Container */ for (i = NUM_PIXMAP; i < NUM_ELEMS; i++) { char LabelName[20] ; XmString label_name; n = 0 ; sprintf(LabelName, "LabelName%d", i); label_name = XmStringGenerate(LabelName, NULL, XmCHARSET_TEXT, NULL); XtSetArg(args[n], XmNx, PIXEL_X(i) ); n++; XtSetArg(args[n], XmNy, PIXEL_Y(i) ); n++; XtSetArg(args[n], XmNlabelString, label_name); n++; XtSetArg(args[n], XmNlabelType, XmSTRING); n++; IconGad[i] = XmCreateIconGadget(Container, LabelName, args, n); XtManageChild(IconGad[i]); XmStringFree(label_name); } XtRealizeWidget(Shell1); /* Find out the default size for X and Y */ n = 0; XtSetArg( args[n], XmNwidth, &x_size ); n++; XtSetArg( args[n], XmNheight, &y_size ); n++; XtGetValues( ScrollWin, args, n ); /************************* * Assertions begin */ /* Assertions 1 and 2 */ n = 0; XtSetArg( args[n], XmNwidth, 175 ); n++; XtSetValues( ScrollWin, args, n ); CommonPause(); RestoreXY( ScrollWin, x_size, y_size ); UnselectAll( Container ); /* Assertions 3 and 4 */ n = 0; XtSetArg( args[n], XmNwidth, 400 ); n++; XtSetValues( ScrollWin, args, n ); CommonPause(); RestoreXY( ScrollWin, x_size, y_size ); UnselectAll( Container ); /* Assertions 5 and 6 */ n = 0; XtSetArg( args[n], XmNheight, 400 ); n++; XtSetValues( ScrollWin, args, n ); CommonPause(); RestoreXY( ScrollWin, x_size, y_size ); UnselectAll( Container ); /* Assertions 7 and 8 */ CommonPause(); XtAppMainLoop(app_context); for ( i=0; i < NUM_ELEMS; i++ ) XtDestroyWidget( IconGad[i] ); XtDestroyWidget( Container ); XtDestroyWidget( ScrollWin ); XtFree( (char *)IconGad ); }
static void CreateAnotherContainer() { Widget PopupShell; Widget MainW2, menubar2, pulldown2, menu_btn2; Widget CutPB2, CopyPB2, CopyLinkPB2, PastePB2, PasteLinkPB2; Widget OtherContainer4; Widget IconGad6, IconGad7, IconGad8, IconGad9, IconGad10; Cardinal n; XmString Label; Arg args[MAX_ARGS]; /* * Create a Dialog Shell */ n = 0; XtSetArg(args[n], XtNgeometry, "=375x375+400+300"); n++; XtSetArg(args[n], XtNallowShellResize, True); n++; PopupShell = XtCreatePopupShell("OtherContainer", topLevelShellWidgetClass, Shell1, args, n); /* * Create a main window */ n = 0; XtSetArg(args[n], XmNborderWidth, 2); n++; MainW2 = XmCreateMainWindow(PopupShell, "MainW2", args, n); XtManageChild(MainW2); /* * Create a menu bar with a pulldown menu for interacting with the * clipboard */ n = 0; menubar2 = XmCreateMenuBar(MainW2, "menubar2", args, n); XtManageChild(menubar2); n = 0; pulldown2 = XmCreatePulldownMenu(menubar2, "pulldown2", args, n); Label = XmStringCreate("Edit", XmSTRING_DEFAULT_CHARSET); n = 0; XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNsubMenuId, pulldown2); n++; menu_btn2 = XmCreateCascadeButton(menubar2, "menu_btn2", args, n); XtManageChild(menu_btn2); XmStringFree(Label); n = 0; Label = XmStringCreate("Cut", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; CutPB2 = XmCreatePushButtonGadget(pulldown2, "CutPB2", args, n); XtManageChild(CutPB2); XmStringFree(Label); n = 0; Label = XmStringCreate("Copy", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; CopyPB2 = XmCreatePushButtonGadget(pulldown2, "CopyPB2", args, n); XtManageChild(CopyPB2); XmStringFree(Label); n = 0; Label = XmStringCreate("Copy Link", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; CopyLinkPB2 = XmCreatePushButtonGadget(pulldown2, "CopyLinkPB2", args, n); XtManageChild(CopyLinkPB2); XmStringFree(Label); n = 0; Label = XmStringCreate("Paste", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; PastePB2 = XmCreatePushButtonGadget(pulldown2, "PastePB2", args, n); XtManageChild(PastePB2); XmStringFree(Label); n = 0; Label = XmStringCreate("Paste Link", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; PasteLinkPB2= XmCreatePushButtonGadget(pulldown2, "PasteLinkPB2", args, n); XtManageChild(PasteLinkPB2); XmStringFree(Label); /* * Create the container */ n = 0; XtSetArg(args[n], XmNwidth, 450); n++; XtSetArg(args[n], XmNheight, 450); n++; XtSetArg(args[n], XmNentryViewType, XmANY_ICON); n++; XtSetArg(args[n], XmNlayoutType, XmSPATIAL); n++; XtSetArg(args[n], XmNspatialStyle, XmNONE); n++; XtSetArg(args[n], XmNautomaticSelection, XmNO_AUTO_SELECT); n++; OtherContainer4 = XmCreateContainer(MainW2, "OtherContainer", args, n); XtManageChild(OtherContainer4); XtAddCallback(OtherContainer4, XmNconvertCallback, ConvertCB, NULL); XtAddCallback(OtherContainer4, XmNdestinationCallback, DestinationCB, NULL); XtAddCallback(CutPB2, XmNactivateCallback, CutCB, (XtPointer) OtherContainer4); XtAddCallback(CopyPB2, XmNactivateCallback, CopyCB, (XtPointer) OtherContainer4); XtAddCallback(CopyLinkPB2, XmNactivateCallback, CopyLinkCB, (XtPointer) OtherContainer4); XtAddCallback(PastePB2, XmNactivateCallback, PasteCB, (XtPointer) OtherContainer4); XtAddCallback(PasteLinkPB2, XmNactivateCallback, PasteLinkCB, (XtPointer) OtherContainer4); n = 0; XtSetArg(args[n], XmNx, 50); n++; XtSetArg(args[n], XmNy, 50); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; IconGad6 = XmCreateIconGadget(OtherContainer4, "IconGad6", args, n); XtManageChild(IconGad6); n = 0; XtSetArg(args[n], XmNx, 150); n++; XtSetArg(args[n], XmNy, 150); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; IconGad7 = XmCreateIconGadget(OtherContainer4, "IconGad7", args, n); XtManageChild(IconGad7); n = 0; XtSetArg(args[n], XmNx, 50); n++; XtSetArg(args[n], XmNy, 300); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; IconGad8 = XmCreateIconGadget(OtherContainer4, "IconGad8", args, n); XtManageChild(IconGad8); n = 0; XtSetArg(args[n], XmNx, 300); n++; XtSetArg(args[n], XmNy, 300); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; IconGad9 = XmCreateIconGadget(OtherContainer4, "IconGad9", args, n); XtManageChild(IconGad9); n = 0; XtSetArg(args[n], XmNx, 200); n++; XtSetArg(args[n], XmNy, 50); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; IconGad10 = XmCreateIconGadget(OtherContainer4, "IconGad10", args, n); XtManageChild(IconGad10); XmMainWindowSetAreas(MainW2, menubar2, NULL, NULL, NULL, OtherContainer4); XtPopup(PopupShell, XtGrabNone); }
void main(int argc, char **argv) { int i,j; Cardinal n; XmString Label; Arg args[MAX_ARGS]; int test_num; char test_char; char ContainerName[NAME_LEN + 1]; ContainerName[0] = '\0'; test_num = 0; test_char = '\0'; CommonTestInit(argc, argv); if (UserData != NULL) { if (strcmp(UserData, "a") == 0) test_num = 1; else if (strcmp(UserData, "b") == 0) test_num = 2; else if (strcmp(UserData, "c") == 0) test_num = 3; else if (strcmp(UserData, "d") == 0) test_num = 4; test_char = *UserData; free(UserData); } sprintf(ContainerName, "Container4%c", test_char); /* * Create a main window */ n = 0; XtSetArg(args[n], XmNborderWidth, 2); n++; MainW1 = XmCreateMainWindow(Shell1, "MainW1", args, n); XtManageChild(MainW1); /* * Create a menu bar with a pulldown menu for interacting with the * clipboard */ n = 0; menubar1 = XmCreateMenuBar(MainW1, "menubar1", args, n); XtManageChild(menubar1); n = 0; pulldown1 = XmCreatePulldownMenu(menubar1, "pulldown1", args, n); Label = XmStringCreate("Edit", XmSTRING_DEFAULT_CHARSET); n = 0; XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNsubMenuId, pulldown1); n++; menu_btn1 = XmCreateCascadeButton(menubar1, "menu_btn1", args, n); XtManageChild(menu_btn1); XmStringFree(Label); n = 0; Label = XmStringCreate("Cut", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; CutPB1 = XmCreatePushButtonGadget(pulldown1, "CutPB1", args, n); XtManageChild(CutPB1); XmStringFree(Label); n = 0; Label = XmStringCreate("Copy", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; CopyPB1 = XmCreatePushButtonGadget(pulldown1, "CopyPB1", args, n); XtManageChild(CopyPB1); XmStringFree(Label); n = 0; Label = XmStringCreate("Copy Link", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; CopyLinkPB1 = XmCreatePushButtonGadget(pulldown1, "CopyLinkPB1", args, n); XtManageChild(CopyLinkPB1); XmStringFree(Label); n = 0; Label = XmStringCreate("Paste", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; PastePB1 = XmCreatePushButtonGadget(pulldown1, "PastePB1", args, n); XtManageChild(PastePB1); XmStringFree(Label); n = 0; Label = XmStringCreate("Paste Link", XmSTRING_DEFAULT_CHARSET); XtSetArg(args[n], XmNlabelString, Label); n++; XtSetArg(args[n], XmNalignment, XmALIGNMENT_BEGINNING); n++; PasteLinkPB1= XmCreatePushButtonGadget(pulldown1, "PasteLinkPB1", args, n); XtManageChild(PasteLinkPB1); XmStringFree(Label); /* * Create the container */ ColumnHeadings = (XmStringTable) XtMalloc(NUM_COL * sizeof(XmString)); for (i = 0; i < NUM_COL; i++) ColumnHeadings[i] = XmStringGenerate(ColumnHeadingText[i], NULL, XmCHARSET_TEXT, NULL); n = 0; XtSetArg(args[n], XmNdetailColumnHeading, ColumnHeadings); n++; XtSetArg(args[n], XmNdetailColumnHeadingCount, NUM_COL); n++; XtSetArg(args[n], XmNdetailOrderCount, NUM_COL-1); n++; Container4 = XmCreateContainer(MainW1, ContainerName, args, n); XtManageChild(Container4); XtAddCallback(Container4, XmNdefaultActionCallback, PrintChildrenCB, NULL); XtAddCallback(Container4, XmNconvertCallback, ConvertCB, NULL); XtAddCallback(Container4, XmNdestinationCallback, DestinationCB, NULL); XtAddCallback(CutPB1, XmNactivateCallback, CutCB, (XtPointer) Container4); XtAddCallback(CopyPB1, XmNactivateCallback, CopyCB, (XtPointer)Container4); XtAddCallback(CopyLinkPB1, XmNactivateCallback, CopyLinkCB, (XtPointer) Container4); XtAddCallback(PastePB1, XmNactivateCallback, PasteCB, (XtPointer) Container4); XtAddCallback(PasteLinkPB1, XmNactivateCallback, PasteLinkCB, (XtPointer) Container4); for (i=0; i<NUM_COL; i++) XmStringFree(ColumnHeadings[i]); XtFree((XtPointer) ColumnHeadings); EntryDetails = (XmStringTable *) XtMalloc(NUM_OBJ * sizeof(XmStringTable)); for (i = 0; i < NUM_OBJ; i++) { ColumnHeadings = (XmStringTable)XtMalloc((NUM_COL-1) * sizeof(XmString)); ColumnHeadings[0] = XmStringGenerate(FullTitleText[i], NULL, XmCHARSET_TEXT, NULL); ColumnHeadings[1] = XmStringGenerate(FlavorText[i], NULL, XmCHARSET_TEXT, NULL); ColumnHeadings[2] = XmStringGenerate(AgeText[i], NULL, XmCHARSET_TEXT, NULL); EntryDetails[i] = ColumnHeadings; } n = 0; XtSetArg(args[n], XmNx, 100); n++; XtSetArg(args[n], XmNy, 100); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[0]); n++; IconGad1 = XmCreateIconGadget(Container4, "IconGad1", args, n); XtManageChild(IconGad1); n = 0; XtSetArg(args[n], XmNx, 200); n++; XtSetArg(args[n], XmNy, 200); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[1]); n++; IconGad2 = XmCreateIconGadget(Container4, "IconGad2", args, n); XtManageChild(IconGad2); n = 0; XtSetArg(args[n], XmNx, 300); n++; XtSetArg(args[n], XmNy, 100); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[2]); n++; IconGad3 = XmCreateIconGadget(Container4, "IconGad3", args, n); XtManageChild(IconGad3); n = 0; XtSetArg(args[n], XmNx, 50); n++; XtSetArg(args[n], XmNy, 400); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[3]); n++; IconGad4 = XmCreateIconGadget(Container4, "IconGad4", args, n); XtManageChild(IconGad4); n = 0; XtSetArg(args[n], XmNentryParent, IconGad3); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetail, EntryDetails[4]); n++; IconGad31 = XmCreateIconGadget(Container4, "IconGad31", args, n); XtManageChild(IconGad31); n = 0; XtSetArg(args[n], XmNentryParent, IconGad3); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[5]); n++; IconGad32 = XmCreateIconGadget(Container4, "IconGad32", args, n); XtManageChild(IconGad32); n = 0; XtSetArg(args[n], XmNentryParent, IconGad32); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[6]); n++; IconGad321 = XmCreateIconGadget(Container4, "IconGad321", args, n); XtManageChild(IconGad321); n = 0; XtSetArg(args[n], XmNentryParent, IconGad321); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[7]); n++; IconGad3211 = XmCreateIconGadget(Container4, "IconGad3211", args, n); XtManageChild(IconGad3211); n = 0; XtSetArg(args[n], XmNentryParent, IconGad3); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[8]); n++; IconGad33 = XmCreateIconGadget(Container4, "IconGad33", args, n); XtManageChild(IconGad33); n = 0; XtSetArg(args[n], XmNx, 70); n++; XtSetArg(args[n], XmNy, 420); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[9]); n++; IconGad5 = XmCreateIconGadget(Container4, "IconGad5", args, n); XtManageChild(IconGad5); XmMainWindowSetAreas(MainW1, menubar1, NULL, NULL, NULL, Container4); for (i = 0; i < NUM_OBJ; i++) { ColumnHeadings = EntryDetails[i]; for (j = 0; j < NUM_COL-1; j++) XmStringFree(ColumnHeadings[j]); XtFree((XtPointer)ColumnHeadings); } XtFree((XtPointer)EntryDetails); XtRealizeWidget(Shell1); CommonPause(); CommonPause(); XmContainerRelayout(Container4); CommonPause(); if ((test_num == 1) || (test_num == 2)) { TestContainerReorder(); CommonPause(); } /* * Create another Container for UTM testing */ CreateAnotherContainer(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); XtAppMainLoop(app_context); }
void main(int argc, char **argv) { XmStringTable ColumnHeadings; int i,j; Cardinal n; Arg args[MAX_ARGS]; int test_num; char test_char; char ContainerName[NAME_LEN + 1]; Pixmap CollapsedStatePixmap, ExpandedStatePixmap; WidgetList SelectedObjects; unsigned int SelectedObjectCount; ContainerName[0] = '\0'; test_num = 0; test_char = '\0'; CommonTestInit(argc, argv); if (UserData != NULL) { if (strcmp(UserData, "a") == 0) test_num = 1; else if (strcmp(UserData, "b") == 0) test_num = 2; else if (strcmp(UserData, "c") == 0) test_num = 3; else if (strcmp(UserData, "d") == 0) test_num = 4; else if (strcmp(UserData, "e") == 0) test_num = 5; else if (strcmp(UserData, "f") == 0) test_num = 6; else if (strcmp(UserData, "g") == 0) test_num = 7; else if (strcmp(UserData, "h") == 0) test_num = 8; else if (strcmp(UserData, "j") == 0) test_num = 9; else if (strcmp(UserData, "k") == 0) test_num = 10; else if (strcmp(UserData, "l") == 0) test_num = 11; else if (strcmp(UserData, "m") == 0) test_num = 12; else if (strcmp(UserData, "n") == 0) test_num = 13; else if (strcmp(UserData, "z") == 0) test_num = 26; test_char = *UserData; free(UserData); } sprintf(ContainerName, "Container1%c", test_char); CollapsedStatePixmap = XCreatePixmapFromBitmapData(display, rootWindow, collapsedState_bits, collapsedState_width, collapsedState_height, CommonGetColor("black"), CommonGetColor("white"), XDefaultDepth(display, XDefaultScreen(display))); ExpandedStatePixmap = XCreatePixmapFromBitmapData(display, rootWindow, expandedState_bits, expandedState_width, expandedState_height, CommonGetColor("white"), CommonGetColor("black"), XDefaultDepth(display, XDefaultScreen(display))); ColumnHeadings = (XmStringTable) XtMalloc(NUM_COL * sizeof(XmString)); for (i = 0; i < NUM_COL; i++) ColumnHeadings[i] = XmStringGenerate(ColumnHeadingText[i], NULL, XmCHARSET_TEXT, NULL); n = 0; /* Don't want to set the following resources for Container1l test */ if (test_num != 11) { XtSetArg(args[n], XmNdetailColumnHeading, ColumnHeadings); n++; XtSetArg(args[n], XmNdetailColumnHeadingCount, NUM_COL); n++; } XtSetArg(args[n], XmNcollapsedStatePixmap, CollapsedStatePixmap); n++; XtSetArg(args[n], XmNexpandedStatePixmap, ExpandedStatePixmap); n++; Container1 = XmCreateContainer(Shell1, ContainerName, args, n); XtManageChild(Container1); XtAddCallback(Container1, XmNdefaultActionCallback, DefaultActionCB, NULL); XtAddCallback(Container1, XmNselectionCallback, SelectCB, NULL); XtAddCallback(Container1, XmNoutlineChangedCallback, OutlineCB, NULL); for (i = 0; i < NUM_COL; i++) XmStringFree(ColumnHeadings[i]); XtFree((XtPointer)ColumnHeadings); EntryDetails = (XmStringTable *) XtMalloc(NUM_OBJ * sizeof(XmStringTable)); for (i = 0; i < NUM_OBJ; i++) { ColumnHeadings = (XmStringTable)XtMalloc((NUM_COL-1) * sizeof(XmString)); ColumnHeadings[0] = XmStringGenerate(FullTitleText[i], NULL, XmCHARSET_TEXT, NULL); ColumnHeadings[1] = XmStringGenerate(FlavorText[i], NULL, XmCHARSET_TEXT, NULL); ColumnHeadings[2] = XmStringGenerate(AgeText[i], NULL, XmCHARSET_TEXT, NULL); EntryDetails[i] = ColumnHeadings; } n = 0; /* Don't want to set the following resource for Container1m test*/ if (test_num != 12) XtSetArg(args[n], XmNvisualEmphasis, XmSELECTED); n++; XtSetArg(args[n], XmNx, 100); n++; XtSetArg(args[n], XmNy, 100); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[0]); n++; IconGad1 = XmCreateIconGadget(Container1, "IconGad1", args, n); XtManageChild(IconGad1); n = 0; XtSetArg(args[n], XmNx, 200); n++; XtSetArg(args[n], XmNy, 200); n++; XtSetArg(args[n], XmNwidth, 50); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[1]); n++; IconGad2 = XmCreateIconGadget(Container1, "IconGad2", args, n); XtManageChild(IconGad2); n = 0; XtSetArg(args[n], XmNx, 300); n++; XtSetArg(args[n], XmNy, 100); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[2]); n++; IconGad3 = XmCreateIconGadget(Container1, "IconGad3", args, n); XtManageChild(IconGad3); n = 0; XtSetArg(args[n], XmNx, 50); n++; XtSetArg(args[n], XmNy, 400); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[3]); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; IconGad4 = XmCreateIconGadget(Container1, "IconGad4", args, n); XtManageChild(IconGad4); n = 0; XtSetArg(args[n], XmNentryParent, IconGad3); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[4]); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; IconGad31 = XmCreateIconGadget(Container1, "IconGad31", args, n); XtManageChild(IconGad31); n = 0; XtSetArg(args[n], XmNentryParent, IconGad3); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[5]); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; IconGad32 = XmCreateIconGadget(Container1, "IconGad32", args, n); XtManageChild(IconGad32); n = 0; XtSetArg(args[n], XmNentryParent, IconGad32); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[6]); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; IconGad321 = XmCreateIconGadget(Container1, "IconGad321", args, n); XtManageChild(IconGad321); n = 0; XtSetArg(args[n], XmNentryParent, IconGad321); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[7]); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; IconGad3211 = XmCreateIconGadget(Container1, "IconGad3211", args, n); XtManageChild(IconGad3211); n = 0; XtSetArg(args[n], XmNentryParent, IconGad3); n++; XtSetArg(args[n], XmNviewType, XmSMALL_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[8]); n++; IconGad33 = XmCreateIconGadget(Container1, "IconGad33", args, n); XtManageChild(IconGad33); /**** Create only widgets when needed, because automation is realizing and managing all created widgets. When we use R6, try that again. n = 0; XtSetArg(args[n], XmNx, 70); n++; XtSetArg(args[n], XmNy, 420); n++; XtSetArg(args[n], XmNviewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNdetailCount, NUM_COL-1); n++; XtSetArg(args[n], XmNdetail, EntryDetails[9]); n++; IconGad5 = XmCreateIconGadget(Container1, "IconGad5", args, n); for (i = 0; i < NUM_OBJ; i++) { ****/ IconGad5 = (Widget) 0; for (i = 0; i < NUM_OBJ-1; i++) { ColumnHeadings = EntryDetails[i]; for (j = 0; j < NUM_COL-1; j++) XmStringFree(ColumnHeadings[j]); XtFree((XtPointer)ColumnHeadings); } /**** XtFree((XtPointer)EntryDetails); ****/ XtRealizeWidget(Shell1); CommonPause(); CommonPause(); if (test_num == 1) { CommonPause(); } if (test_num == 2) { CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); CommonPause(); n = 0; XtSetArg(args[n], XmNselectedObjectCount, &SelectedObjectCount); n++; XtSetArg(args[n], XmNselectedObjects, &SelectedObjects); n++; XtGetValues(Container1, args, n); printf("SelectedObjectCount from GetValues: %d\n", SelectedObjectCount); printf("SelectedObjects from GetValues: "); for (i = 0; i < SelectedObjectCount; i++) printf("%s ", XtName(SelectedObjects[i])); printf("\n"); CommonPause(); } if (test_num == 3) { CommonPause(); CommonPause(); CommonPause(); CommonPause(); } if (test_num == 4) { CommonPause(); } if (test_num == 5) { CommonPause(); CommonPause(); CommonPause(); CommonPause(); } if (test_num == 6) { CommonPause(); CommonPause(); CommonPause(); CommonPause(); } if (test_num == 7) { CommonPause(); CommonPause(); CommonPause(); } if (test_num == 8) { CommonPause(); CommonPause(); } if (test_num == 9) { CommonPause(); CommonPause(); } if (test_num == 10) { CommonPause(); CommonPause(); } if (test_num == 11) { CommonPause(); CommonPause(); CommonPause(); } if (test_num == 12) { CommonPause(); CommonPause(); CommonPause(); } if (test_num == 26) { n = 0; XtSetArg(args[n], XmNentryViewType, XmLARGE_ICON); n++; XtSetArg(args[n], XmNlayoutType, XmOUTLINE); n++; XtSetValues(Container1, args, n); CommonPause(); CommonPause(); CommonPause(); } CommonPause(); XtAppMainLoop(app_context); }