1/*
2    PPTextAttributesDicts.m
3
4    Copyright 2013-2018 Josh Freeman
5    http://www.twilightedge.com
6
7    This file is part of PikoPixel for Mac OS X and GNUstep.
8    PikoPixel is a graphical application for drawing & editing pixel-art images.
9
10    PikoPixel is free software: you can redistribute it and/or modify it under
11    the terms of the GNU Affero General Public License as published by the
12    Free Software Foundation, either version 3 of the License, or (at your
13    option) any later version approved for PikoPixel by its copyright holder (or
14    an authorized proxy).
15
16    PikoPixel is distributed in the hope that it will be useful, but WITHOUT ANY
17    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18    FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19    details.
20
21    You should have received a copy of the GNU Affero General Public License
22    along with this program. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#import "PPTextAttributesDicts.h"
26
27#import "PPUIFontDefines.h"
28
29
30NSDictionary *PPTextAttributesDict_ToolModifierTips_Header(void)
31{
32    static NSDictionary *headerAttributesDict = nil;
33
34    if (!headerAttributesDict)
35    {
36        NSFont *font = kUIFont_ToolModifierTips_Header;
37        NSNumber *underlineNumber = [NSNumber numberWithInt: 1];
38        NSColor *color = kUIFontColor_ToolModifierTips_Header;
39
40        if (!font || !underlineNumber)
41        {
42            goto ERROR;
43        }
44
45        headerAttributesDict = [[NSDictionary dictionaryWithObjectsAndKeys:
46                                                font, NSFontAttributeName,
47                                                underlineNumber, NSUnderlineStyleAttributeName,
48                                                color, NSForegroundColorAttributeName,
49                                                nil]
50                                        retain];
51    }
52
53    return headerAttributesDict;
54
55ERROR:
56    return nil;
57}
58
59NSDictionary *PPTextAttributesDict_ToolModifierTips_Subheader(void)
60{
61    static NSDictionary *subheaderAttributesDict = nil;
62
63    if (!subheaderAttributesDict)
64    {
65        NSFont *font = kUIFont_ToolModifierTips_Subheader;
66        NSColor *color = kUIFontColor_ToolModifierTips_Subheader;
67
68        if (!font)
69            goto ERROR;
70
71        subheaderAttributesDict = [[NSDictionary dictionaryWithObjectsAndKeys:
72                                                    font, NSFontAttributeName,
73                                                    color, NSForegroundColorAttributeName,
74                                                    nil]
75                                        retain];
76    }
77
78    return subheaderAttributesDict;
79
80ERROR:
81    return nil;
82}
83
84NSDictionary *PPTextAttributesDict_ToolModifierTips_Tips(void)
85{
86    static NSDictionary *tipsAttributesDict = nil;
87
88    if (!tipsAttributesDict)
89    {
90        NSFont *font = kUIFont_ToolModifierTips_Tips;
91        NSColor *color = kUIFontColor_ToolModifierTips_Tips;
92
93        if (!font)
94            goto ERROR;
95
96        tipsAttributesDict = [[NSDictionary dictionaryWithObjectsAndKeys:
97                                                    font, NSFontAttributeName,
98                                                    color, NSForegroundColorAttributeName,
99                                                    nil]
100                                    retain];
101    }
102
103    return tipsAttributesDict;
104
105ERROR:
106    return nil;
107}
108
109NSDictionary *PPTextAttributesDict_DisabledTitle_Table(void)
110{
111    static NSDictionary *tableAttributesDict = nil;
112
113    if (!tableAttributesDict)
114    {
115        NSFont *font = kUIFont_DisabledTitle_Table;
116        NSColor *color = kUIFontColor_DisabledTitle_Table;
117
118        if (!font || !color)
119        {
120            goto ERROR;
121        }
122
123        tableAttributesDict = [[NSDictionary dictionaryWithObjectsAndKeys:
124                                                    font, NSFontAttributeName,
125                                                    color, NSForegroundColorAttributeName,
126                                                    nil]
127                                            retain];
128    }
129
130    return tableAttributesDict;
131
132ERROR:
133    return nil;
134}
135
136NSDictionary *PPTextAttributesDict_DisabledTitle_PopupButton(void)
137{
138    static NSDictionary *buttonAttributesDict = nil;
139
140    if (!buttonAttributesDict)
141    {
142        NSFont *font = kUIFont_DisabledTitle_PopupButton;
143        NSColor *color = kUIFontColor_DisabledTitle_PopupButton;
144
145        if (!font || !color)
146        {
147            goto ERROR;
148        }
149
150        buttonAttributesDict = [[NSDictionary dictionaryWithObjectsAndKeys:
151                                                    font, NSFontAttributeName,
152                                                    color, NSForegroundColorAttributeName,
153                                                    nil]
154                                            retain];
155    }
156
157    return buttonAttributesDict;
158
159ERROR:
160    return nil;
161}
162
163NSDictionary *PPTextAttributesDict_DisabledTitle_PopupMenuItem(void)
164{
165    static NSDictionary *menuItemAttributesDict = nil;
166
167    if (!menuItemAttributesDict)
168    {
169        NSFont *font = kUIFont_DisabledTitle_PopupMenuItem;
170        NSColor *color = kUIFontColor_DisabledTitle_PopupMenuItem;
171
172        if (!font || !color)
173        {
174            goto ERROR;
175        }
176
177        menuItemAttributesDict = [[NSDictionary dictionaryWithObjectsAndKeys:
178                                                    font, NSFontAttributeName,
179                                                    color, NSForegroundColorAttributeName,
180                                                    nil]
181                                            retain];
182    }
183
184    return menuItemAttributesDict;
185
186ERROR:
187    return nil;
188}
189