/* Motif Tutorial - Hello world */ #include #include /** Button push callback * * Called when the user pushes * the button. * */ void button_pushed(Widget widget, XtPointer data, XmPushButtonCallbackStruct * cbs) { printf("Button pushed\n"); } /** Main * * Creates the application window * with a single button and starts * Motif event loop. * */ int main(int argc, char * argv[]) { Widget window; /* Widgets */ Widget button; XtAppContext app; /* Application */ /* Create application window */ window = XtVaAppInitialize(&app, "Application", NULL, 0, &argc, argv, NULL, NULL); /* Create button as child of the main window, set callback on push event */ button = XmCreatePushButton(window, "Button", NULL, 0); XtManageChild(button); XtAddCallback(button, XmNactivateCallback, (XtCallbackProc) button_pushed, NULL); /* Display the main window */ XtRealizeWidget(window); /* Motif event loop */ XtAppMainLoop(app); }