1 /*
2    NSImageCell.h
3 
4    The cell class for NSImage
5 
6    Copyright (C) 1999 Free Software Foundation, Inc.
7 
8    Author:  Jonathan Gapen <jagapen@chem.wisc.edu>
9    Date: 1999
10 
11    This file is part of the GNUstep GUI Library.
12 
13    This library is free software; you can redistribute it and/or
14    modify it under the terms of the GNU Lesser General Public
15    License as published by the Free Software Foundation; either
16    version 2 of the License, or (at your option) any later version.
17 
18    This library is distributed in the hope that it will be useful,
19    but WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
21    Lesser General Public License for more details.
22 
23    You should have received a copy of the GNU Lesser General Public
24    License along with this library; see the file COPYING.LIB.
25    If not, see <http://www.gnu.org/licenses/> or write to the
26    Free Software Foundation, 51 Franklin Street, Fifth Floor,
27    Boston, MA 02110-1301, USA.
28 */
29 
30 #ifndef _GNUstep_H_NSImageCell
31 #define _GNUstep_H_NSImageCell
32 #import <GNUstepBase/GSVersionMacros.h>
33 
34 #import <AppKit/NSCell.h>
35 
36 /**
37  *  <p>Enumeration of the ways that you can align an image inside an
38  *  NSImageCell when the image is not taking up all the space inside
39  *  the cell (for example, because you are using NSScaleNone or
40  *  NSScaleProportionally and the cell size is bigger than the natural
41  *  image size).  The available ones are: <code>NSImageAlignCenter,
42  *  NSImageAlignTop, NSImageAlignTopLeft, NSImageAlignTopRight,
43  *  NSImageAlignLeft, NSImageAlignBottom, NSImageAlignBottomLeft,
44  *  NSImageAlignBottomRight, NSImageAlignRight</code>.</p>
45  */
46 typedef enum {
47     NSImageAlignCenter = 0,
48     NSImageAlignTop,
49     NSImageAlignTopLeft,
50     NSImageAlignTopRight,
51     NSImageAlignLeft,
52     NSImageAlignBottom,
53     NSImageAlignBottomLeft,
54     NSImageAlignBottomRight,
55     NSImageAlignRight
56 } NSImageAlignment;
57 
58 /**
59  *  <p>Enumeration of the types of frame that can be used in an
60  *  NSImageCell.  The available ones are: <code>NSImageFrameNone,
61  *  NSImageFramePhoto, NSImageFrameGrayBezel, NSImageFrameGroove,
62  *  NSImageFrameButton</code>.</p>
63  */
64 typedef enum {
65     NSImageFrameNone = 0,
66     NSImageFramePhoto,
67     NSImageFrameGrayBezel,
68     NSImageFrameGroove,
69     NSImageFrameButton
70 } NSImageFrameStyle;
71 
72 /**
73  *  <p>An NSImageCell is a cell that can display a single image.  It
74  *  is normally associated with an NSImageView control; but you can
75  *  use it as a building block in your own controls.</p>
76  *
77  *  <p>The image to display is set using the -setImage: method
78  *  which is inherited from the superclass.</p>
79  *
80  *  <p>The -setImageAlignment: and -setImageScaling: methods can be
81  *  used to control how the image is drawn inside a rectangle which is
82  *  larger or smaller than the image size; the image might need to be
83  *  scaled, cropped or aligned.</p>
84  *
85  *  <p>The -setImageFrameStyle: method can be used to control if the
86  *  cell should display a frame border, and which one.</p>
87  */
88 @interface NSImageCell : NSCell
89 {
90   NSImageAlignment _imageAlignment;
91   NSImageFrameStyle _frameStyle;
92   NSImageScaling _imageScaling;
93   NSSize _original_image_size;
94 }
95 
96 /**
97  * Returns the alignment used when displaying the image inside
98  * a cell that is bigger than the image, and NSScaleToFit has
99  * not been selected.
100  */
101 - (NSImageAlignment) imageAlignment;
102 /**
103  * Sets the alignment used when displaying the image inside a cell
104  * that is bigger than the image, and NSScaleToFit has not been
105  * selected.
106  */
107 - (void) setImageAlignment: (NSImageAlignment)anAlignment;
108 
109 /**
110  * Returns the type of image scaling used on the image when the
111  * image natural size and the cell size are different.
112  */
113 - (NSImageScaling) imageScaling;
114 /**
115  * Sets the type of image scaling used on the image when the image
116  * natural size and the cell size are different.
117  */
118 - (void) setImageScaling: (NSImageScaling)scaling;
119 
120 /**
121  * Returns the style used to draw the frame around the image.
122  */
123 - (NSImageFrameStyle) imageFrameStyle;
124 /**
125  * Sets the style used to draw the frame around the image.
126  */
127 - (void) setImageFrameStyle: (NSImageFrameStyle)aFrameStyle;
128 
129 @end
130 
131 #endif // _GNUstep_H_NSImageCell
132