home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / viewkit / xcontact / lib / VkGroupBox.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.8 KB  |  97 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. #ifndef VKGROUPBOX_H
  18. #define VKGROUPBOX_H
  19. ///////////////////////////////////////////////////////////////////////////////
  20. //  THIS SUCKER IS OBSOLETE.  IN MOTIF 1.2 JUST USE PLAIN OLD FRAME WIDGET!!!!
  21. //  DON'T USE THIS CLASS ANYMORE.
  22. //  I MODIFY IT TO USE FRAME WIDGET, AND PUT EVERYTHING IN THIS .h FILE.
  23. //    (Ivan 1/5/94)
  24. ///////////////////////////////////////////////////////////////////////////////
  25.  
  26.  
  27. //////////////////////////////////////////////////////////////////////////
  28. // VkGroupBox.h - Logically group children inside a labeled frame.
  29. //               
  30. //  author -- hajadi@csd
  31. //  notes: This is probably better implemented as variation of
  32. //         frame widget.
  33. //////////////////////////////////////////////////////////////////////////
  34.  
  35.  
  36. enum Attachment { LEFT, CENTER, RIGHT };
  37.  
  38. #include "OkArgs.h"
  39.  
  40. #include <Vk/VkComponent.h>
  41.  
  42. #include <Xm/LabelG.h>
  43. #include <Xm/Frame.h>
  44.  
  45. class VkGroupBox : public VkComponent {
  46.  
  47.  private:
  48.   Boolean   _built;
  49.   Widget _title;
  50.  
  51.  
  52.  protected:
  53.   virtual Widget setUpInterface( Widget parent ) = 0;
  54.  
  55.  public:
  56.   VkGroupBox( Widget parent, const char* name, Attachment attach = CENTER ) :
  57.     VkComponent( name )
  58.   {
  59.     _baseWidget = XmCreateFrame( parent, _name, NULL, 0 );
  60.     installDestroyHandler();
  61.  
  62.     unsigned char alignment = XmALIGNMENT_CENTER;
  63.     if ( attach==LEFT )
  64.       alignment = XmALIGNMENT_BEGINNING;
  65.     else if ( attach==RIGHT )
  66.       alignment = XmALIGNMENT_END;
  67.  
  68.     OkArgs args( 2 );
  69.     args.set( XmNchildType, XmFRAME_TITLE_CHILD );
  70.     args.set( XmNchildHorizontalAlignment, alignment );
  71.     _title = XmCreateLabelGadget( _baseWidget, "title",
  72.                 args.list(), args.count() );
  73.     XtManageChild( _title );
  74.     _built = False;
  75.   }
  76.  
  77.   ~VkGroupBox() {};
  78.   virtual const char *className() { return "VkGroupBox"; }
  79.  
  80.   void show()
  81.   {
  82.     if ( !_built ) 
  83.       XtManageChild( setUpInterface( _baseWidget ) );
  84.     VkComponent::show();
  85.   }
  86.  
  87.   Widget view() const             { return frame(); }
  88.   Widget title() const            { return _title; }
  89.   Widget frame() const            { return _baseWidget; }
  90.  
  91.  
  92. };
  93.  
  94.  
  95.  
  96. #endif // VKGROUPBOX_H
  97.