1 /* $TOG: AskFirstCmd.C /main/5 1997/03/31 15:59:09 mgreess $ */
5 * RESTRICTED CONFIDENTIAL INFORMATION:
7 * The information in this document is subject to special
8 * restrictions in a confidential disclosure agreement bertween
9 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
10 * document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
11 * Sun's specific written approval. This documment and all copies
12 * and derivative works thereof must be returned or destroyed at
15 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
19 ///////////////////////////////////////////////////////////////////////////////
20 //////////////////////////////////////////////////////////////////////////////
21 // This example code is from the book:
23 // Object-Oriented Programming with C++ and OSF/Motif
26 // Prentice Hall, 1992
29 // Copyright 1991 by Prentice Hall
30 // All Rights Reserved
32 // Permission to use, copy, modify, and distribute this software for
33 // any purpose except publication and without fee is hereby granted, provided
34 // that the above copyright notice appear in all copies of the software.
35 ///////////////////////////////////////////////////////////////////////////////
36 //////////////////////////////////////////////////////////////////////////////
39 //////////////////////////////////////////////////////////
41 //////////////////////////////////////////////////////////
42 #include "AskFirstCmd.h"
43 #include "QuestionDialogManager.h"
51 AskFirstCmd::AskFirstCmd ( char *name,
53 int active ) : Cmd ( name, label, active )
57 _dialogParentWidget = NULL;
58 setQuestion ( GETMSG(catd, 1, 1,
59 "Do you really want to execute this command?"));
62 void AskFirstCmd::setQuestion ( char *str )
66 _question = strdup ( str );
69 void AskFirstCmd::execute()
74 name_str = (char *) name();
75 label_str = (char *) getLabel();
78 if (!_dialogParentWidget) return;
81 _dialog = new QuestionDialogManager(name_str);
89 &AskFirstCmd::yesCallback,
90 &AskFirstCmd::cancelCallback);
93 void AskFirstCmd::yesCallback ( void *clientData )
95 AskFirstCmd *obj = (AskFirstCmd *) clientData;
102 AskFirstCmd::cancelCallback ( void *)
108 AskFirstCmd::doYesCallback()
111 // unmanage the dialog right away
115 // Call the base class execute()
116 // member function to do all the
117 // usual processing of the command
119 this->Cmd::execute();