home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Graphics / Graphics.zip / xfitsvew.zip / XFITSview / toolbox.c < prev    next >
C/C++ Source or Header  |  1998-04-05  |  6KB  |  170 lines

  1. /* Toolbox panel functions for XFITSview */
  2. /*-----------------------------------------------------------------------
  3. *  Copyright (C) 1998
  4. *  Associated Universities, Inc. Washington DC, USA.
  5. *  This program is free software; you can redistribute it and/or
  6. *  modify it under the terms of the GNU General Public License as
  7. *  published by the Free Software Foundation; either version 2 of
  8. *  the License, or (at your option) any later version.
  9. *
  10. *  This program is distributed in the hope that it will be useful,
  11. *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. *  GNU General Public License for more details.
  14. *-----------------------------------------------------------------------*/
  15. #include <Xm/Xm.h> 
  16. #include <Xm/DrawingA.h> 
  17. #include <Xm/MainW.h> 
  18. #include <stdlib.h>
  19. #include <stdio.h>
  20. #include <Xm/Scale.h>
  21. #include <Xm/Form.h>
  22. #include <Xm/PushB.h>
  23. #include <Xm/Label.h>
  24. #include <Xm/ToggleB.h>
  25. /*#include <X11/xpm.h> */
  26. #include "imagedisp.h"
  27. #include "menu.h"
  28. #include "infobox.h"
  29. #include "moviebox.h"
  30. #include "blinkbox.h"
  31. #include "optionbox.h"
  32. #include "markpos.h"
  33. #include "lookpos.h"
  34. #include "helpbox.h"
  35. #include "logger.h"
  36.  
  37. /* button pixmaps */
  38. /*#include "pixmap/open.xpm"*/
  39.  
  40. /* callback functions */
  41. void TBOpenCB (Widget w, XtPointer clientData, XtPointer callData)
  42. {
  43.   /*    ImageDisplay *IDdata = (ImageDisplay *)clientData;*/
  44.   /*    XmScaleCallbackStruct *call_data = (XmScaleCallbackStruct *) callData;*/
  45.  
  46. /* read value of scrollbar */
  47.   /*    IDdata->value[1] = call_data->value;*/
  48.  
  49. /* reset color table */
  50.   /*    SetColorTable(IDdata);*/
  51. } /* end OpenCB */
  52.  
  53.  
  54.  
  55. Widget MakeToolbox(Widget mainWindow, Widget topWidget, XtPointer data)
  56. /* Make toolbox panel */
  57. {
  58.   Widget       toolbox, tools[5];
  59.   Arg          args[10];
  60.   Dimension    width, height;
  61.   int          n, iTool = -1;
  62.   XmString     label = XmStringCreateSimple ("Open");
  63.   ImageDisplay *IDdata = (ImageDisplay *)data;
  64.   Pixmap       *buttonPM, *shapemask;
  65. /*  XpmAttributes *attributes;*/
  66.   Drawable     draw = (Drawable)XtWindow(mainWindow);
  67.   Display      *display = XtDisplay(mainWindow);
  68.  
  69. /* make Form widget for toolbox - same width as the Control */
  70.   toolbox = XtVaCreateManagedWidget ("toolbox", xmFormWidgetClass,
  71.                      mainWindow,
  72.                      XmNwidth,           CONTROLWIDTH,
  73.                      XmNheight,          200,
  74.                      XmNtopAttachment,  XmATTACH_WIDGET,
  75.                      XmNtopWidget,       topWidget,
  76.                      XmNleftAttachment,  XmATTACH_FORM,
  77.                      XmNbottomAttachment,  XmATTACH_FORM,
  78.                      NULL);
  79.  
  80.   /*------------------------- new row ------------------------------*/
  81. /* Open button */
  82.   /*  XpmCreatePixmapFromData (display, draw, OpenPM, buttonPM, shapemask, attributes);*/
  83.   tools[++iTool] = XtVaCreateManagedWidget ("Open", xmPushButtonWidgetClass, 
  84.                     toolbox, 
  85.                     XmNwidth,           50,
  86.                     XmNheight,          50,
  87.                     XmNtopAttachment, XmATTACH_FORM,
  88.                     XmNleftAttachment,  XmATTACH_FORM,
  89.                         /*                    XmNlabelPixmap,  buttonPM,*/
  90.                     NULL);
  91.   XtAddCallback (tools[iTool], XmNactivateCallback, OpenCB, (XtPointer)IDdata);
  92.  
  93. /* Preview button */
  94.   /*  XpmCreatePixmapFromData (display, draw, OpenPM, buttonPM, shapemask, attributes);*/
  95.   tools[++iTool] = XtVaCreateManagedWidget ("preview", xmPushButtonWidgetClass, 
  96.                     toolbox, 
  97.                     XmNwidth,           50,
  98.                     XmNheight,          50,
  99.                     XmNtopAttachment, XmATTACH_FORM,
  100.                     XmNleftAttachment,  XmATTACH_WIDGET,
  101.                     XmNleftWidget,    tools[iTool-1],
  102.                         /*                    XmNlabelPixmap,  buttonPM,*/
  103.                     NULL);
  104.   XtAddCallback (tools[iTool], XmNactivateCallback, PreviewCB, (XtPointer)IDdata);
  105.  
  106. /* Info button */
  107.   /*  XpmCreatePixmapFromData (display, draw, OpenPM, buttonPM, shapemask, attributes);*/
  108.   tools[++iTool] = XtVaCreateManagedWidget ("info", xmPushButtonWidgetClass, 
  109.                     toolbox, 
  110.                     XmNwidth,           50,
  111.                     XmNheight,          50,
  112.                     XmNtopAttachment, XmATTACH_FORM,
  113.                     XmNleftAttachment,  XmATTACH_WIDGET,
  114.                     XmNleftWidget,    tools[iTool-1],
  115.                         /*                    XmNlabelPixmap,  buttonPM,*/
  116.                     NULL);
  117.   XtAddCallback (tools[iTool], XmNactivateCallback, InfoBoxCB, (XtPointer)IDdata);
  118.  
  119.   /*------------------------- new row ------------------------------*/
  120. /* Movie button */
  121.   /*  XpmCreatePixmapFromData (display, draw, OpenPM, buttonPM, shapemask, attributes);*/
  122.   tools[++iTool] = XtVaCreateManagedWidget ("movie", xmPushButtonWidgetClass, 
  123.                     toolbox, 
  124.                     XmNwidth,           50,
  125.                     XmNheight,          50,
  126.                     XmNleftAttachment,  XmATTACH_FORM,
  127.                     XmNtopAttachment, XmATTACH_WIDGET,
  128.                     XmNtopWidget,    tools[iTool-3],
  129.                         /*                    XmNlabelPixmap,  buttonPM,*/
  130.                     NULL);
  131.   XtAddCallback (tools[iTool], XmNactivateCallback, MovieBoxCB, (XtPointer)IDdata);
  132.  
  133. /* Blink swap button */
  134.   /*  XpmCreatePixmapFromData (display, draw, OpenPM, buttonPM, shapemask, attributes);*/
  135.   tools[++iTool] = XtVaCreateManagedWidget ("swap", xmPushButtonWidgetClass, 
  136.                     toolbox, 
  137.                     XmNwidth,           50,
  138.                     XmNheight,          50,
  139.                     XmNleftAttachment,  XmATTACH_WIDGET,
  140.                     XmNleftWidget,    tools[iTool-1],
  141.                     XmNtopAttachment, XmATTACH_WIDGET,
  142.                     XmNtopWidget,    tools[iTool-3],
  143.                         /*                    XmNlabelPixmap,  buttonPM,*/
  144.                     NULL);
  145.   XtAddCallback (tools[iTool], XmNactivateCallback, BlinkSwapCB, (XtPointer)IDdata);
  146.  
  147. /* Blink blink button */
  148.   /*  XpmCreatePixmapFromData (display, draw, OpenPM, buttonPM, shapemask, attributes);*/
  149.   tools[++iTool] = XtVaCreateManagedWidget ("blink", xmPushButtonWidgetClass, 
  150.                     toolbox, 
  151.                     XmNwidth,           50,
  152.                     XmNheight,          50,
  153.                     XmNleftAttachment,  XmATTACH_WIDGET,
  154.                     XmNleftWidget,    tools[iTool-1],
  155.                     XmNtopAttachment, XmATTACH_WIDGET,
  156.                     XmNtopWidget,    tools[iTool-3],
  157.                         /*                    XmNlabelPixmap,  buttonPM,*/
  158.                     NULL);
  159.   XtAddCallback (tools[iTool], XmNactivateCallback, BlinkBlinkCB, (XtPointer)IDdata);
  160.  
  161.   /*------------------------- new row ------------------------------*/
  162.   XtManageChild (toolbox);
  163.  
  164.   /* delete temporary strings */
  165.   if (label) XmStringFree(label);
  166.  
  167.   return toolbox;
  168. } /* end MakeToolbox */
  169.  
  170.