File: PieceView.h

package info (click to toggle)
gnustep-examples 1%3A1.0.0-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,952 kB
  • ctags: 280
  • sloc: objc: 15,345; makefile: 64
file content (94 lines) | stat: -rw-r--r-- 1,740 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

#import "Document.h"
#import "BTree.h"

#define PIECE_WIDTH  48 // must be even
#define PIECE_HEIGHT 40 // must be even

#define BOUNDARY     16
#define OFFS          8
#define RADSQ        ((float)(BOUNDARY*BOUNDARY/4))

#define PIECE_BD_WIDTH  (2*BOUNDARY+PIECE_WIDTH)
#define PIECE_BD_HEIGHT (2*BOUNDARY+PIECE_HEIGHT)

#define DIM_MAX      32
#define DIM_MIN       3

typedef enum {
    INNER = -1,
    BORDER,
    OUTER
} BTYPE;

typedef enum {
    EXTERIOR,
    LEFTIN, LEFTOUT,
    RIGHTIN, RIGHTOUT,
    LOWERIN, LOWEROUT,
    UPPERIN, UPPEROUT,
    CENTER
} PTYPE;

@interface PieceView : NSView
{
    Document *doc;
    NSImage *image;
    BTree *cluster;
    int x, y, px, py;
    BTYPE left, right, upper, lower;
    int padleft, padright, padupper, padlower;
    NSBezierPath *clip;
    int tag;
}

+ (id *)checkCluster:(BTree *)theCluster;

- (id)initWithImage:(NSImage *)theImage
                loc:(NSPoint)theLoc
               posX:(int)posx outOf:(int)px
               posY:(int)posy outOf:(int)py
               left:(BTYPE)bleft
              right:(BTYPE)bright
              upper:(BTYPE)bupper
              lower:(BTYPE)blower;

- setCluster:(BTree *)theCluster;
- (BTree *)cluster;

- setDocument:(Document *)theDocument;
- (Document *)document;

- (void)drawRect:(NSRect)aRect;
- (void)outline:(float *)delta;

- (void)showInvalid;

- (void)bbox:(NSRect *)bbox;

- (void)shiftView:(float *)delta;

- (BTYPE)left;
- (BTYPE)right;
- (BTYPE)upper;
- (BTYPE)lower;

- (int)tag;

- (int)x;
- (int)y;

- (PTYPE)classifyPoint:(NSPoint)pt;

- (void)mouseDown:(NSEvent *)theEvent;
- (void)rightMouseDown:(NSEvent *)theEvent;

- (NSString *)toString;


@end