home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / fontutils-0.6-base.tgz / fontutils-0.6-base.tar / fsf / fontutils / include / Bitmap.h < prev    next >
C/C++ Source or Header  |  1992-03-27  |  5KB  |  122 lines

  1. /* Bitmap.h: public header file for a bitmap widget, implemented as a
  2.    subclass of Athena's Label widget.
  3.  
  4. Copyright (C) 1992 Free Software Foundation, Inc.
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. #ifndef BITMAP_WIDGET_H
  21. #define BITMAP_WIDGET_H
  22.  
  23. #include "xt-common.h"
  24. #include <X11/Xaw/Label.h>
  25.  
  26. #include "bitmap.h"
  27.  
  28.  
  29. /* Resources (in addition to those in Core, Simple, and Label):
  30.  
  31. Name        Class        RepType        Default Value
  32. ----        -----        -------        -------------
  33. bits        Bitmap        Pointer        NULL
  34.   A pointer to a `bitmap_type' structure (see `include/bitmap.h') that
  35.   is what is actually displayed.  I didn't want to name this resource
  36.   `bitmap', since there is already a `bitmap' resource in the Label
  37.   widget, and the two are different.  (In fact, `bits' becomes the
  38.   Label's `bitmap'.)
  39.  
  40. expansion    Expansion    Dimension    16
  41.   How many times each pixel in the bitmap is replicated.
  42.  
  43. modified    Modified    Boolean        False
  44.   This readonly resource says whether or not the bitmap has been modified.
  45.  
  46. shadow        Bitmap        BitmapWidget    NULL
  47.   A replica of the widget, possibly with a different expansion
  48.   (typically, in fact, the shadow bitmap has expansion one).  When a
  49.   pixel in the widget is changed and repainted via the InvertPixel
  50.   action (see the `translations' resource below), the corresponding
  51.   pixel in the shadow widget is also changed and repainted.
  52.  
  53. translations    Translations    TranslationTable NULL
  54.   The event bindings associated with this widget.  The Bitmap widget
  55.   provides an action `InvertPixel', which inverts the value of the pixel
  56.   the pointer is on.  `InvertPixel' takes one parameter, which must be
  57.   one of the symbols `Discrete' or `Continuous' (case is significant).
  58.   In the latter case, the pixel is only changed if the pointer was 1) not
  59.   at that same pixel on the last invocation, and 2) on a pixel that is
  60.   of the opposite color as the pixel at the time of the last `Discrete'
  61.   invocation.  Why?  Because it is most useful to be able to move the
  62.   pointer and change pixels to either black or white, not invert them.
  63.  
  64.   The Bitmap widget also provides two related sets of actions for copying
  65.   parts of characters.  For the purposes of these actions, imagine that
  66.   the ``hot spots'' of each pixel in the large bitmap are at the upper
  67.   left of the visible square.  StartSelection() begins a selection
  68.   operation at the nearest pixel above and to the left of the current
  69.   point.  AdjustSelection() changes the selected rectangle according to
  70.   the nearest pixel below and to the right of the current pixel; the
  71.   new point can be in any relationship to the initial point.
  72.   AcceptSelection() takes the current selection as the final one.
  73.   
  74.   Once a rectangle has been selected, you can paste it in the same or
  75.   another character: StartPaste() shows the selected rectangle and
  76.   MovePaste() moves it around.  AcceptPaste(Opaque) changes the bitmap
  77.   destructively, i.e., each pixel in the selected rectangle overwrites
  78.   the pixel in the bitmap.  AcceptPaste(Transparent) changes the bitmap
  79.   nondestructively, i.e., a black pixel in the bitmap will remain black.
  80.   
  81.   Aside from pasting the selection, you can also fill it:
  82.   FillSelection() fills the current selection with the color of the
  83.   pixel the pointer is currently on.
  84.  
  85.   To abort any selection or paste operation, simply move the pointer
  86.   outside the bitmap before finishing the operation.
  87.   
  88.   By default, no events are bound to the actions.  Default bindings
  89.   should be put in the app-defaults file.
  90. */
  91.  
  92. #ifndef XtCBitmap
  93. #define XtCBitmap    "Bitmap"
  94. #endif
  95. #define XtCExpansion    "Expansion"
  96. #define XtCModified    "Modified"
  97.  
  98. #define XtNbits        "bits"
  99.  
  100. #define XtNexpansion    "expansion"
  101. #define BITMAP_DEFAULT_EXPANSION 16
  102.  
  103. #define XtNmodified    "modified"
  104.  
  105. #define XtNshadow    "shadow"
  106.  
  107. /* Convenience procedures to get the interesting resources.  */
  108. extern unsigned BitmapExpansion (Widget);
  109. extern bitmap_type *BitmapBits (Widget);
  110. extern Boolean BitmapModified (Widget);
  111.  
  112.  
  113.  
  114. /* The class variable, for arguments to XtCreateWidget et al.  */
  115. extern WidgetClass bitmapWidgetClass;
  116.  
  117. /* The class record and instance record types.  */
  118. typedef struct _BitmapClassRec *BitmapWidgetClass;
  119. typedef struct _BitmapRec *BitmapWidget;
  120.  
  121. #endif /* not BITMAP_WIDGET_H */
  122.