queryDialog.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: queryDialog.c /main/4 1995/11/02 14:06:32 rswiston $ */
  24. /*********************************************************************
  25. * (c) Copyright 1993, 1994 Hewlett-Packard Company
  26. * (c) Copyright 1993, 1994 International Business Machines Corp.
  27. * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
  28. * (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
  29. * Novell, Inc.
  30. **********************************************************************/
  31. /*******************************************************************************
  32. queryDialog.c
  33. *******************************************************************************/
  34. #include <stdio.h>
  35. #include <Xm/Xm.h>
  36. #include <Xm/DialogS.h>
  37. #include <Xm/MenuShell.h>
  38. #include <Xm/MwmUtil.h>
  39. #include <Xm/MessageB.h>
  40. #include "main.h"
  41. #include "externals.h"
  42. #include "process.h"
  43. #define RES_CONVERT( res_name, res_value) \
  44. XtVaTypedArg, (res_name), XmRString, (res_value), strlen(res_value) + 1
  45. /*******************************************************************************
  46. Includes, Defines, and Global variables from the Declarations Editor:
  47. *******************************************************************************/
  48. Widget queryDialog;
  49. /*******************************************************************************
  50. Forward declarations of functions that are defined later in this file.
  51. *******************************************************************************/
  52. Widget create_queryDialog();
  53. /*******************************************************************************
  54. The following are callback functions.
  55. *******************************************************************************/
  56. static void
  57. okCallback_queryDialog(
  58. Widget w,
  59. XtPointer clientData,
  60. XtPointer callbackArg )
  61. {
  62. Process_Query_OK();
  63. }
  64. static void
  65. cancelCB_queryDialog(
  66. Widget w,
  67. XtPointer clientData,
  68. XtPointer callbackArg )
  69. {
  70. Process_Query_Cancel();
  71. }
  72. /*******************************************************************************
  73. The 'build_' function creates all the widgets
  74. using the resource values specified in the Property Editor.
  75. *******************************************************************************/
  76. static Widget
  77. build_queryDialog( void )
  78. {
  79. Widget queryDialog_shell;
  80. XmString tmpXmStr, tmpXmStr2, tmpXmStr3, tmpXmStr4, tmpXmStr5;
  81. Arg args[10];
  82. int n;
  83. queryDialog_shell = XtVaCreatePopupShell( "queryDialog_shell",
  84. xmDialogShellWidgetClass, mainWindow,
  85. XmNtitle, GETSTR(6,2, "Icon Editor - Warning"),
  86. NULL );
  87. tmpXmStr = GETXMSTR(6,2, "Icon Editor - Warning");
  88. tmpXmStr2= GETXMSTR(6,6, "OK");
  89. tmpXmStr3= GETXMSTR(6,8, "Do ya really wanna?");
  90. tmpXmStr4= GETXMSTR(6,10, "Cancel");
  91. tmpXmStr5= GETXMSTR(4,10, "Help");
  92. queryDialog = XtVaCreateWidget( "queryDialog",
  93. xmMessageBoxWidgetClass, queryDialog_shell,
  94. XmNdefaultButtonType, XmDIALOG_CANCEL_BUTTON,
  95. XmNdialogTitle, tmpXmStr,
  96. XmNokLabelString, tmpXmStr2,
  97. XmNmessageString, tmpXmStr3,
  98. XmNcancelLabelString, tmpXmStr4,
  99. XmNhelpLabelString, tmpXmStr5,
  100. XmNdialogType, XmDIALOG_WARNING,
  101. NULL );
  102. XmStringFree(tmpXmStr);
  103. XmStringFree(tmpXmStr2);
  104. XmStringFree(tmpXmStr3);
  105. XmStringFree(tmpXmStr4);
  106. XmStringFree(tmpXmStr5);
  107. XtAddCallback( queryDialog, XmNokCallback, okCallback_queryDialog, NULL);
  108. XtAddCallback( queryDialog, XmNcancelCallback, cancelCB_queryDialog, NULL);
  109. n = 0;
  110. XtSetArg (args[n], XmNuseAsyncGeometry, True); n++;
  111. XtSetArg (args[n], XmNmwmInputMode,MWM_INPUT_PRIMARY_APPLICATION_MODAL);n++;
  112. XtSetValues (queryDialog_shell, args, n);
  113. return ( queryDialog );
  114. }
  115. /*******************************************************************************
  116. The following is the 'Interface function' which is the
  117. external entry point for creating this interface.
  118. This function should be called from your application or from
  119. a callback function.
  120. *******************************************************************************/
  121. Widget
  122. create_queryDialog( void )
  123. {
  124. Widget rtrn;
  125. rtrn = build_queryDialog();
  126. return(rtrn);
  127. }
  128. /*******************************************************************************
  129. END OF FILE
  130. *******************************************************************************/