summaryrefslogtreecommitdiff
path: root/tikzit/src/common/NodeStyle.h
blob: 034f95dd2dbd76a1f4e0ceeb3ea6343305145ae6 (plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
//
//  NodeStyle.h
//  TikZiT
//  
//  Copyright 2010 Aleks Kissinger. All rights reserved.
//  
//  
//  This file is part of TikZiT.
//  
//  TikZiT is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//  
//  TikZiT is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//  
//  You should have received a copy of the GNU General Public License
//  along with TikZiT.  If not, see <http://www.gnu.org/licenses/>.
//  

#import "util.h"
#import "ColorRGB.h"
#import "PropertyHolder.h"

/*!
 @class      NodeStyle
 @brief      Store node style information.
 @details    Store node style information. These properties affect how a node
             is displayed in TikZiT. Colors are stored in the ColorRGB struct
             to avoid any Cocoa dependency. These styles should be persistant,
             which should be implemented in a platform-specific category. For
             OS X, this is NodeStyle+Coder.
 */
@interface NodeStyle : PropertyHolder <NSCopying> {
	int strokeThickness;
	float scale;
	ColorRGB *strokeColorRGB;
	ColorRGB *fillColorRGB;
	NSString *name;
	NSString *shapeName;
	NSString *category;
}

/*!
 @property   strokeThickness
 @brief      Thickness of the stroke.
 */
@property (assign) int strokeThickness;

/*!
 @property   scale
 @brief      Overall scale of the shape. Defaults to 1.0.
 */
@property (assign) float scale;


/*!
 @property   strokeColorRGB
 @brief      The stroke color used to render the node
 */
@property (copy) ColorRGB *strokeColorRGB;

/*!
 @property   fillColorRGB
 @brief      The fill color used to render the node
 */
@property (copy) ColorRGB *fillColorRGB;

/*!
 @property   name
 @brief      Style name.
 @details    Style name. This is the only thing that affects how the node
             will look when the latex code is rendered.
 */
@property (copy) NSString *name;

/*!
 @property   shapeName
 @brief      The name of the shape that will be drawn in TikZiT.
 */
@property (copy) NSString *shapeName;

/*!
 @property   category
 @brief      ???
 */
@property (copy) NSString *category;

@property (readonly) NSString *tikz;
@property (readonly) BOOL strokeColorIsKnown;
@property (readonly) BOOL fillColorIsKnown;

+ (int) defaultStrokeThickness;

/*!
 @brief      Designated initializer. Construct a blank style with name 'new'.
 @result     A default style.
 */
- (id)init;

/*!
 @brief      Create a named style.
 @param      nm the style name.
 @result     A <tt>NodeStyle</tt> with the given name.
 */
- (id)initWithName:(NSString *)nm;

/*!
 @brief      Factory method for initWithName:
 @param      nm the style name.
 @result     A <tt>NodeStyle</tt> with the given name.
 */
+ (NodeStyle*)defaultNodeStyleWithName:(NSString *)nm;

/*!
 * Make this style the same as the given one
 */
- (void) updateFromStyle:(NodeStyle*)style;

@end

// vi:ft=objc:noet:ts=4:sts=4:sw=4