home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / new_manage.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  4.9 KB  |  161 lines

  1. /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. /* 
  19.    new_manage.c --- defines a subclass of XmManager
  20.    Created: Eric Bina <ebina@netscape.com>, 17-Aug-94.
  21.  
  22.    Excerts from the X Toolkit Intrinsics Programming Manual - O'Reilly:
  23.  
  24.     "Writing a general-purpose composite widget is not a trivial task
  25.     and should only be done when other options fail."
  26.     "A truly general-purpose composite widget is a large, complex piece 
  27.     of software.  You should leave this programming to the widget writers
  28.     who write commercial widget sets, and concentrate on things that are
  29.     more important in your application."
  30.  */
  31.  
  32.  
  33. #include <stdio.h>
  34. #include <stdlib.h>
  35. #include "mozilla.h"
  36. #include "new_manage.h"
  37. #include "new_manageP.h"
  38.  
  39. static XtGeometryResult
  40. GeometryManager(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply);
  41.  
  42. static void
  43. ChangeManaged(Widget w);
  44.  
  45.  
  46. NewManageClassRec newManageClassRec =
  47. {
  48.   {
  49. /* core_class fields      */
  50.     /* superclass         */    (WidgetClass) &xmManagerClassRec,
  51.     /* class_name         */    "NewManage",
  52.     /* widget_size        */    sizeof(NewManageRec),
  53.     /* class_initialize   */    NULL,
  54.     /* class_partinit     */    NULL /* ClassPartInitialize */,
  55.     /* class_inited       */    FALSE,
  56.     /* initialize         */    NULL /* Initialize */,
  57.     /* Init hook      */    NULL,
  58.     /* realize            */    XtInheritRealize /* Realize */,
  59.     /* actions          */    NULL,
  60.     /* num_actions      */    0,
  61.     /* resources          */    NULL /* resources */,
  62.     /* num_resources      */    0 /* XtNumber(resources) */,
  63.     /* xrm_class          */    NULLQUARK,
  64.     /* compress_motion      */    TRUE,
  65.     /* compress_exposure  */    TRUE,
  66.     /* compress_enterleave*/    TRUE,
  67.     /* visible_interest   */    FALSE,
  68.     /* destroy            */    NULL,
  69.     /* resize             */    NULL,
  70.     /* expose             */    XtInheritExpose /* (XtExposeProc) Redisplay */,
  71.     /* set_values         */    NULL /* (XtSetValuesFunc )SetValues */,
  72.     /* set values hook    */    NULL,
  73.     /* set values almost  */    XtInheritSetValuesAlmost,
  74.     /* get values hook    */    NULL,
  75.     /* accept_focus       */    NULL,
  76.     /* Version            */    XtVersion,
  77.     /* PRIVATE cb list    */    NULL,
  78.     /* tm_table          */    XtInheritTranslations,
  79.     /* query_geometry     */    NULL /* QueryProc */,
  80.     /* display_accelerator*/    NULL,
  81.     /* extension          */    NULL,
  82.   },
  83.   {
  84. /* composite_class fields */
  85.     /* geometry_manager   */    GeometryManager /*(XtGeometryHandler )GeometryManager*/,
  86.     /* change_managed     */    ChangeManaged /*(XtWidgetProc) ChangeManaged*/,
  87.     /* insert_child      */    XtInheritInsertChild /*(XtArgsProc) InsertChild*/,    
  88.     /* delete_child      */    XtInheritDeleteChild,
  89.     /* Extension          */    NULL,
  90.   },{
  91. /* Constraint class Init */
  92.     NULL,
  93.     0,
  94.     0,
  95.     NULL,
  96.     NULL,
  97.     NULL,
  98.     NULL
  99.       
  100.   },
  101. /* Manager Class */
  102.    {        
  103.       XmInheritTranslations/*ScrolledWindowXlations*/,     /* translations        */    
  104.       NULL /*get_resources*/,            /* get resources            */
  105.       0 /*XtNumber(get_resources)*/,        /* num get_resources       */
  106.       NULL,                    /* get_cont_resources     */
  107.       0,                    /* num_get_cont_resources */
  108.       XmInheritParentProcess,                   /* parent_process         */
  109.       NULL,                    /* extension           */    
  110.    },
  111.  
  112.  {
  113. /* NewManage class - none */     
  114.      /* mumble */               0
  115.  }
  116. };
  117.  
  118.  
  119. WidgetClass newManageClass = (WidgetClass)&newManageClassRec;
  120.  
  121.  
  122. static XtGeometryResult
  123. GeometryManager(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply)
  124. {
  125.     if (request->request_mode & XtCWQueryOnly)
  126.     {
  127.         return(XtGeometryYes);
  128.     }
  129.  
  130.     if (request->request_mode & CWX)
  131.     {
  132.         XtX(w) = request->x;
  133.     }
  134.     if (request->request_mode & CWY)
  135.     {
  136.         XtY(w) = request->y;
  137.     }
  138.     if (request->request_mode & CWWidth)
  139.     {
  140.         XtWidth(w) = request->width;
  141.     }
  142.     if (request->request_mode & CWHeight)
  143.     {
  144.         XtHeight(w) = request->height;
  145.     }
  146.     if (request->request_mode & CWBorderWidth)
  147.     {
  148.         XtBorderWidth(w) = request->border_width;
  149.     }
  150.  
  151.     return(XtGeometryYes);
  152. }
  153.  
  154.  
  155. static void
  156. ChangeManaged(Widget w)
  157. {
  158.     return;
  159. }
  160.  
  161.