home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-Developer.iso / NextLibrary / Frameworks / AppKit.framework / Versions / B / Headers / NSRulerMarker.h < prev    next >
Text File  |  1996-10-17  |  4KB  |  87 lines

  1. /*
  2.         NSRulerMarker.h
  3.         Application Kit
  4.         Copyright (c) 1994-1996, NeXT Software, Inc.
  5.         All rights reserved.
  6. */
  7.  
  8. #ifndef STRICT_OPENSTEP
  9.  
  10. #import <Foundation/Foundation.h>
  11.  
  12. @class NSImage;
  13. @class NSRulerView;
  14. @class NSView;
  15. @class NSEvent;
  16.  
  17. @interface NSRulerMarker : NSObject <NSCopying, NSCoding> {
  18.     NSRulerView *_ruler;
  19.     float _location;
  20.     NSImage *_image;
  21.     NSPoint _imageOrigin;
  22.  
  23.     struct __rFlags {
  24.         unsigned int movable:1;
  25.         unsigned int removable:1;
  26.         unsigned int dragging:1;
  27.         unsigned int pinned:1;
  28.         unsigned int _reserved:28;
  29.     } _rFlags;
  30.  
  31.     id _representedObject;
  32. }
  33.  
  34. /**************************** Initialization ****************************/
  35.  
  36. - (id)initWithRulerView:(NSRulerView *)ruler markerLocation:(float)location image:(NSImage *)image imageOrigin:(NSPoint)imageOrigin;
  37.     // Designated initializer.  Location is expressed in the client view's bounds coordinates.  Location is the x position if the ruler is horizontal or the y position if the ruler is vertical.  The image will not be scaled or rotated.  The image origin indicates the point in the image that will be placed on the ruler's baseline at the given location and is expressed in the image's coordinate system.  NSRulerMarkers are movable but not removable by default.  A removable object should have its dimmed image set.
  38.  
  39. /*********************** Query/Set basic attributes ***********************/
  40.  
  41. - (NSRulerView *)ruler;
  42.     // Returns the ruler.
  43.  
  44.  
  45. - (void)setMarkerLocation:(float)location;
  46. - (float)markerLocation;
  47.     // The location is set by the -init... method and the -setLocation: method.  Location is an x position for horizontal rulers or a y position for vertical rulers.  It is expressed in the client view's coordinate system.
  48.  
  49. - (void)setImage:(NSImage *)image;
  50. - (NSImage *)image;
  51.     // The image is what's drawn in the ruler.
  52.  
  53. - (void)setImageOrigin:(NSPoint)imageOrigin;
  54. - (NSPoint)imageOrigin;
  55.     // The image is drawn such that the image origin is on the baseline of the ruler at the object's location.
  56.  
  57. - (void)setMovable:(BOOL)flag;
  58. - (void)setRemovable:(BOOL)flag;
  59. - (BOOL)isMovable;
  60. - (BOOL)isRemovable;
  61.     // Objects are movable, but not removable by default.  Movable means the ruler object can be dragged by the user.  Removable means it can be deleted by the user.
  62.  
  63. - (BOOL)isDragging;
  64.     // Returns YES if the ruler object is currently being dragged.
  65.  
  66. - (void)setRepresentedObject:(id <NSCopying>)representedObject;
  67. - (id <NSCopying>)representedObject;
  68.     // The representedObject of an NSRulerMarker is purely for the client's use.  It must be able to copy itself.  A represented object should be some small object.  The text object uses NSStrings for most ruler objects or NSTextTab objects for tab stops.
  69.  
  70. /************************** Ruler facilities **************************/
  71.  
  72. - (NSRect)imageRectInRuler;
  73.     // Returns the rect that would be occupied by the object's image in the ruler's bounds coordinates.  This takes the flippedness of the ruler into account.
  74.  
  75. - (float)thicknessRequiredInRuler;
  76.     // Returns the height or width (depending on the ruler's orientation) required in the ruler to display the object.
  77.  
  78. - (void)drawRect:(NSRect)rect;
  79.     // Draws the object at it's current location.  Only rect needs to be drawn.
  80.  
  81. - (BOOL)trackMouse:(NSEvent *)mouseDownEvent adding:(BOOL)isAdding;
  82.     // Handles the given mmouseDown event.  Performs a modal tracking loop until mouseUp allowing the object to be moved, if movable or removed, if removable.
  83.  
  84. @end
  85.  
  86. #endif
  87.