Confirmed.c 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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: Confirmed.c /main/5 1996/10/15 14:44:45 rswiston $ */
  24. /*******************************************************************************
  25. Confirmed.c
  26. Associated Header file: Confirmed.h
  27. *******************************************************************************/
  28. #include <stdio.h>
  29. #include <stdlib.h>
  30. #include <Xm/Xm.h>
  31. #include <Xm/MessageB.h>
  32. #include <sys/signal.h>
  33. #include "dtcreate.h"
  34. #include "ca_aux.h"
  35. #include "UxXt.h"
  36. #include "CreateActionAppShell.h"
  37. #define CONTEXT_MACRO_ACCESS 1
  38. #include "Confirmed.h"
  39. #undef CONTEXT_MACRO_ACCESS
  40. /*******************************************************************************
  41. The following are callback functions for Confirmed dialog.
  42. *******************************************************************************/
  43. /******************************************************************************/
  44. /* activateCB_Confirmed_OkButton */
  45. /******************************************************************************/
  46. void activateCB_Confirmed_OkButton( Widget UxWidget,
  47. XtPointer UxClientData,
  48. XtPointer UxCallbackArg)
  49. {
  50. XtDestroyWidget(XtParent(UxWidget));
  51. }
  52. /******************************************************************************/
  53. /* display_confirmed_message */
  54. /* */
  55. /* INPUT: Widget parent - parent to position dialog on. */
  56. /* char *message - message to display in dialog box */
  57. /* OUTPIT: none */
  58. /* */
  59. /******************************************************************************/
  60. void display_confirmed_message (Widget parent, char *message)
  61. {
  62. Confirmed = XmCreateInformationDialog(parent, "confirmedDialog", NULL, 0);
  63. XtUnmanageChild (XmMessageBoxGetChild (Confirmed, XmDIALOG_CANCEL_BUTTON));
  64. XtUnmanageChild (XmMessageBoxGetChild (Confirmed, XmDIALOG_HELP_BUTTON));
  65. XtAddCallback( Confirmed, XmNokCallback,
  66. (XtCallbackProc) activateCB_Confirmed_OkButton,
  67. (XtPointer) NULL );
  68. XtVaSetValues (Confirmed,
  69. RES_CONVERT(XmNdialogTitle, GETMESSAGE(6, 41, "Create Action - Confirmation")),
  70. RES_CONVERT(XmNmessageString, message),
  71. NULL);
  72. XtRealizeWidget(Confirmed);
  73. XtManageChild (Confirmed);
  74. return;
  75. }
  76. /*******************************************************************************
  77. The following are callback functions for Question dialog
  78. *******************************************************************************/
  79. /******************************************************************************/
  80. /* */
  81. /* cancelCB_QuestionDialog */
  82. /* */
  83. /******************************************************************************/
  84. void cancelCB_QuestionDialog(Widget UxWidget,
  85. XtPointer UxClientData,
  86. XtPointer UxCallbackArg)
  87. {
  88. XtDestroyWidget(XtParent(UxWidget));
  89. }
  90. /******************************************************************************/
  91. /* */
  92. /* nosaveCB_QuestionDialog */
  93. /* */
  94. /******************************************************************************/
  95. void nosaveCB_QuestionDialog(Widget UxWidget,
  96. XtPointer UxClientData,
  97. XtPointer UxCallbackArg)
  98. {
  99. XtDestroyWidget(XtParent(UxWidget));
  100. FreeResources();
  101. exit(0);
  102. }
  103. /******************************************************************************/
  104. /* */
  105. /* saveCallbackB_QuestionDialog */
  106. /* */
  107. /******************************************************************************/
  108. void saveCB_QuestionDialog(Widget UxWidget,
  109. XtPointer UxClientData,
  110. XtPointer UxCallbackArg)
  111. {
  112. XtDestroyWidget(XtParent(UxWidget));
  113. /********************************************************************/
  114. /* Activate the save routine. */
  115. /********************************************************************/
  116. activateCB_CA_MB_FileSave((Widget)NULL, (XtPointer)NULL, (XtPointer)NULL);
  117. }
  118. /******************************************************************************/
  119. /* display_question_message */
  120. /* */
  121. /* INPUT: Widget parent - parent to position dialog on. */
  122. /* char *message - message to display in dialog box */
  123. /* OUTPIT: none */
  124. /* */
  125. /******************************************************************************/
  126. void display_question_message (Widget parent, char *message,
  127. char *button1, XtCallbackProc cb_button1,
  128. char *button2, XtCallbackProc cb_button2,
  129. char *button3, XtCallbackProc cb_button3)
  130. {
  131. Widget tmpw;
  132. QuestionDialog = XmCreateQuestionDialog(parent, "questionDialog", NULL, 0);
  133. tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_OK_BUTTON);
  134. if (button1) {
  135. XtVaSetValues(tmpw,
  136. RES_CONVERT( XmNlabelString, button1),
  137. NULL);
  138. XtAddCallback( QuestionDialog, XmNokCallback,
  139. (XtCallbackProc) cb_button1,
  140. (XtPointer) NULL );
  141. } else {
  142. XtUnmanageChild (tmpw);
  143. }
  144. tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_CANCEL_BUTTON);
  145. if (button2) {
  146. XtVaSetValues(tmpw,
  147. RES_CONVERT( XmNlabelString, button2),
  148. NULL);
  149. XtAddCallback( QuestionDialog, XmNcancelCallback,
  150. (XtCallbackProc) cb_button2,
  151. (XtPointer) NULL );
  152. } else {
  153. XtUnmanageChild (tmpw);
  154. }
  155. tmpw = XmMessageBoxGetChild(QuestionDialog, XmDIALOG_HELP_BUTTON);
  156. if (button3) {
  157. XtVaSetValues(tmpw,
  158. RES_CONVERT( XmNlabelString, button3),
  159. NULL);
  160. XtAddCallback( QuestionDialog, XmNhelpCallback,
  161. (XtCallbackProc) cb_button3,
  162. (XtPointer) NULL );
  163. } else {
  164. XtUnmanageChild (tmpw);
  165. }
  166. XtVaSetValues (QuestionDialog,
  167. RES_CONVERT(XmNdialogTitle, GETMESSAGE(6, 51, "Create Action - Question")),
  168. RES_CONVERT(XmNmessageString, message),
  169. NULL);
  170. XtManageChild (QuestionDialog);
  171. return;
  172. }
  173. /*******************************************************************************
  174. END OF FILE
  175. *******************************************************************************/