home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / video / security / startStop.C < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.3 KB  |  80 lines

  1. /*
  2.  * Copyright (C) 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. #include "startStop.h"
  18. #include <Xm/RowColumn.h>
  19. #include <Xm/PushB.h>
  20.  
  21. String StartStopPanel::_defaultResources[] = {
  22.   "*start.labelString: Start",
  23.   "*stop.labelString: Stop",
  24.   "*orientation: HORIZONTAL",
  25.   NULL
  26. };
  27. const char *const StartStopPanel::actionCallback = "actionCallback";
  28.  
  29. StartStopPanel::StartStopPanel(const char *name, Widget parent) : VkComponent(name)
  30. {
  31.   setDefaultResources(parent, _defaultResources);
  32.   _baseWidget = XmCreateRowColumn(parent, _name, NULL,0);
  33.   installDestroyHandler();
  34.  
  35.   _startButton = XmCreatePushButton(_baseWidget, "start",NULL,0);
  36.   _stopButton = XmCreatePushButton(_baseWidget, "stop", NULL, 0);
  37.  
  38.   XtManageChild(_startButton);
  39.   XtManageChild(_stopButton);
  40.   
  41.   XtAddCallback(_startButton, XmNactivateCallback,
  42.         &StartStopPanel::startCallback, (XtPointer)this);
  43.   
  44.   XtAddCallback(_stopButton, XmNactivateCallback,
  45.         &StartStopPanel::stopCallback, (XtPointer)this);
  46.   
  47. }
  48.  
  49. StartStopPanel::~StartStopPanel()
  50. {}
  51.  
  52. const char *StartStopPanel::className()
  53. {
  54.   return "StartStopPanel";
  55. }
  56.  
  57. void StartStopPanel::startCallback(Widget w, XtPointer clientData,
  58.                    XtPointer callData)
  59. {
  60.   StartStopPanel *obj = (StartStopPanel *)clientData;
  61.   obj->start(w,callData);
  62. }
  63.  
  64. void StartStopPanel::stopCallback(Widget w, XtPointer clientData,
  65.                    XtPointer callData)
  66. {
  67.   StartStopPanel *obj = (StartStopPanel *)clientData;
  68.   obj->stop(w,callData);
  69. }
  70.  
  71. void StartStopPanel::start(Widget, XtPointer)
  72. {
  73.   callCallbacks(actionCallback, (void *)START);
  74. }
  75.  
  76. void StartStopPanel::stop(Widget, XtPointer)
  77. {
  78.   callCallbacks(actionCallback, (void *)STOP);
  79. }
  80.