home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- // OkLabeledComponent.c++ --
-
-
- #include "OkLabeledComponent.h"
- #include "OkArgs.h"
- #include "OkStr.h"
-
- #include <Xm/Label.h>
- #include <Xm/Form.h>
-
- #include <assert.h>
-
-
- template <class T>
- OkLabeledComponent<T>::OkLabeledComponent( const char* name, Widget parent,
- Orientation ornt ) :
- VkComponent( name )
- {
- _baseWidget = XmCreateForm( parent, _name, NULL, 0 );
- installDestroyHandler();
-
- OkArgs args( 3 );
- args.set( XmNtopAttachment, XmATTACH_FORM );
- if ( ornt == HORIZONTAL )
- args.set( XmNbottomAttachment, XmATTACH_FORM );
- args.set( XmNleftAttachment, XmATTACH_FORM );
- _label = XmCreateLabel( _baseWidget, OkStr( _name )|"Label",
- args.list(), args.count() );
- XtManageChild( _label );
-
- _component = new T( OkStr( _name )|"Base", _baseWidget );
- assert( _component );
- if ( ornt == HORIZONTAL )
- // This trick needed, cause Motif Scrolled<whatever> is brain dead.
- XtVaSetValues( XtParent( _component->baseWidget() ) == _baseWidget ?
- _component->baseWidget() : XtParent( _component->baseWidget() ),
- XmNtopAttachment, XmATTACH_FORM,
- XmNbottomAttachment, XmATTACH_FORM,
- XmNrightAttachment, XmATTACH_FORM,
- XmNleftAttachment, XmATTACH_WIDGET,
- XmNleftWidget, _label,
- NULL );
- else
- // This trick needed, cause Motif Scrolled<whatever> is brain dead.
- XtVaSetValues( XtParent( _component->baseWidget() ) == _baseWidget ?
- _component->baseWidget() : XtParent( _component->baseWidget() ),
- XmNtopAttachment, XmATTACH_WIDGET,
- XmNtopWidget, _label,
- XmNbottomAttachment, XmATTACH_FORM,
- XmNrightAttachment, XmATTACH_FORM,
- XmNleftAttachment, XmATTACH_FORM,
- NULL );
- _component->show();
-
-
- }
-
- template <class T>
- OkLabeledComponent<T>::~OkLabeledComponent()
- {
- delete _component;
- }
-
-