OpenCores
URL https://opencores.org/ocsvn/scarts/scarts/trunk

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gcc/] [gcc-4.1.1/] [libjava/] [classpath/] [javax/] [swing/] [plaf/] [metal/] [MetalTheme.java] - Blame information for rev 14

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 14 jlechner
/* MetalTheme.java --
2
   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
3
 
4
This file is part of GNU Classpath.
5
 
6
GNU Classpath is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2, or (at your option)
9
any later version.
10
 
11
GNU Classpath is distributed in the hope that it will be useful, but
12
WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
General Public License for more details.
15
 
16
You should have received a copy of the GNU General Public License
17
along with GNU Classpath; see the file COPYING.  If not, write to the
18
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
02110-1301 USA.
20
 
21
Linking this library statically or dynamically with other modules is
22
making a combined work based on this library.  Thus, the terms and
23
conditions of the GNU General Public License cover the whole
24
combination.
25
 
26
As a special exception, the copyright holders of this library give you
27
permission to link this library with independent modules to produce an
28
executable, regardless of the license terms of these independent
29
modules, and to copy and distribute the resulting executable under
30
terms of your choice, provided that you also meet, for each linked
31
independent module, the terms and conditions of the license of that
32
module.  An independent module is a module which is not derived from
33
or based on this library.  If you modify this library, you may extend
34
this exception to your version of the library, but you are not
35
obligated to do so.  If you do not wish to do so, delete this
36
exception statement from your version. */
37
 
38
 
39
 
40
package javax.swing.plaf.metal;
41
 
42
import java.awt.Color;
43
 
44
import javax.swing.UIDefaults;
45
import javax.swing.plaf.ColorUIResource;
46
import javax.swing.plaf.FontUIResource;
47
 
48
/**
49
 * The base class for themes used by the {@link MetalLookAndFeel}.  A default
50
 * theme ({@link DefaultMetalTheme}) is provided, or you can create and use
51
 * your own.
52
 *
53
 * @see MetalLookAndFeel#setCurrentTheme(MetalTheme)
54
 */
55
public abstract class MetalTheme
56
{
57
  private ColorUIResource BLACK = new ColorUIResource(Color.BLACK);
58
  private ColorUIResource WHITE = new ColorUIResource(Color.WHITE);
59
 
60
  /**
61
   * Default constructor.
62
   */
63
  public MetalTheme()
64
  {
65
    // Do nothing here.
66
  }
67
 
68
  /**
69
   * Returns the name of the theme.
70
   *
71
   * @return The name of the theme.
72
   */
73
  public abstract String getName();
74
 
75
  /**
76
   * Adds custom entries to the UI defaults table.  This method is empty.
77
   *
78
   * @param table  the table.
79
   */
80
  public void addCustomEntriesToTable(UIDefaults table)
81
  {
82
    // Do nothing here.
83
    // This method needs to be overridden to actually do something.
84
    // It is called from MetalLookAndFeel.getDefaults().
85
  }
86
 
87
  /**
88
   * Returns the accelerator foreground color.  The default implementation
89
   * returns the color from {@link #getPrimary1()}.
90
   *
91
   * @return The accelerator foreground color.
92
   */
93
  public ColorUIResource getAcceleratorForeground()
94
  {
95
    return getPrimary1();
96
  }
97
 
98
  /**
99
   * Returns the accelerator selected foreground color.  The default
100
   * implementation returns the color from {@link #getBlack()}.
101
   *
102
   * @return The accelerator selected foreground color.
103
   */
104
  public ColorUIResource getAcceleratorSelectedForeground()
105
  {
106
    return getBlack();
107
  }
108
 
109
  /**
110
   * Returns the control color.  The default implementation returns the color
111
   * from {@link #getSecondary3()}.
112
   *
113
   * @return The control color.
114
   */
115
  public ColorUIResource getControl()
116
  {
117
    return getSecondary3();
118
  }
119
 
120
  /**
121
   * Returns the color used for dark shadows on controls.  The default
122
   * implementation returns the color from  {@link #getSecondary1()}.
123
   *
124
   * @return The color used for dark shadows on controls.
125
   */
126
  public ColorUIResource getControlDarkShadow()
127
  {
128
    return getSecondary1();
129
  }
130
 
131
  /**
132
   * Returns the color used for disabled controls.  The default implementation
133
   * returns the color from {@link #getSecondary1()}.
134
   *
135
   * @return The color used for disabled controls.
136
   */
137
  public ColorUIResource getControlDisabled()
138
  {
139
    return getSecondary2();
140
  }
141
 
142
  /**
143
   * Returns the color used to draw highlights for controls.  The default
144
   * implementation returns the color from {@link #getWhite()}.
145
   *
146
   * @return The color used to draw highlights for controls.
147
   */
148
  public ColorUIResource getControlHighlight()
149
  {
150
    return getWhite();
151
  }
152
 
153
  /**
154
   * Returns the color used to display control info.  The default
155
   * implementation returns the color from {@link #getBlack()}.
156
   *
157
   * @return The color used to display control info.
158
   */
159
  public ColorUIResource getControlInfo()
160
  {
161
    return getBlack();
162
  }
163
 
164
  /**
165
   * Returns the color used to draw shadows for controls.  The default
166
   * implementation returns the color from {@link #getSecondary2()}.
167
   *
168
   * @return The color used to draw shadows for controls.
169
   */
170
  public ColorUIResource getControlShadow()
171
  {
172
    return getSecondary2();
173
  }
174
 
175
  /**
176
   * Returns the color used for text on controls.  The default implementation
177
   * returns the color from {@link #getControlInfo()}.
178
   *
179
   * @return The color used for text on controls.
180
   */
181
  public ColorUIResource getControlTextColor()
182
  {
183
    return getControlInfo();
184
  }
185
 
186
  /**
187
   * Returns the color used for the desktop background.  The default
188
   * implementation returns the color from {@link #getPrimary2()}.
189
   *
190
   * @return The color used for the desktop background.
191
   */
192
  public ColorUIResource getDesktopColor()
193
  {
194
    return getPrimary2();
195
  }
196
 
197
  /**
198
   * Returns the color used to draw focus highlights.  The default
199
   * implementation returns the color from {@link #getPrimary2()}.
200
   *
201
   * @return The color used to draw focus highlights.
202
   */
203
  public ColorUIResource getFocusColor()
204
  {
205
    return getPrimary2();
206
  }
207
 
208
  /**
209
   * Returns the color used to draw highlighted text.  The default
210
   * implementation returns the color from {@link #getHighlightedTextColor()}.
211
   *
212
   * @return The color used to draw highlighted text.
213
   */
214
  public ColorUIResource getHighlightedTextColor()
215
  {
216
    return getControlTextColor();
217
  }
218
 
219
  /**
220
   * Returns the color used to draw text on inactive controls.  The default
221
   * implementation returns the color from {@link #getControlDisabled()}.
222
   *
223
   * @return The color used to draw text on inactive controls.
224
   */
225
  public ColorUIResource getInactiveControlTextColor()
226
  {
227
    return getControlDisabled();
228
  }
229
 
230
  /**
231
   * Returns the color used to draw inactive system text.  The default
232
   * implementation returns the color from {@link #getSecondary2()}.
233
   *
234
   * @return The color used to draw inactive system text.
235
   */
236
  public ColorUIResource getInactiveSystemTextColor()
237
  {
238
    return getSecondary2();
239
  }
240
 
241
  /**
242
   * Returns the background color for menu items.  The default implementation
243
   * returns the color from {@link #getSecondary3()}.
244
   *
245
   * @return The background color for menu items.
246
   *
247
   * @see #getMenuSelectedBackground()
248
   */
249
  public ColorUIResource getMenuBackground()
250
  {
251
    return getSecondary3();
252
  }
253
 
254
  /**
255
   * Returns the foreground color for disabled menu items.  The default
256
   * implementation returns the color from {@link #getSecondary2()}.
257
   *
258
   * @return The foreground color for disabled menu items.
259
   *
260
   * @see #getMenuForeground()
261
   */
262
  public ColorUIResource getMenuDisabledForeground()
263
  {
264
    return getSecondary2();
265
  }
266
 
267
  /**
268
   * Returns the foreground color for menu items.  The default implementation
269
   * returns the color from {@link #getBlack()}.
270
   *
271
   * @return The foreground color for menu items.
272
   *
273
   * @see #getMenuDisabledForeground()
274
   * @see #getMenuSelectedForeground()
275
   */
276
  public ColorUIResource getMenuForeground()
277
  {
278
    return getBlack();
279
  }
280
 
281
  /**
282
   * Returns the background color for selected menu items.  The default
283
   * implementation returns the color from {@link #getPrimary2()}.
284
   *
285
   * @return The background color for selected menu items.
286
   *
287
   * @see #getMenuBackground()
288
   */
289
  public ColorUIResource getMenuSelectedBackground()
290
  {
291
    return getPrimary2();
292
  }
293
 
294
  /**
295
   * Returns the foreground color for selected menu items.  The default
296
   * implementation returns the value from {@link #getBlack()}.
297
   *
298
   * @return The foreground color for selected menu items.
299
   *
300
   * @see #getMenuForeground()
301
   */
302
  public ColorUIResource getMenuSelectedForeground()
303
  {
304
    return getBlack();
305
  }
306
 
307
  /**
308
   * Returns the primary color for controls.  The default implementation
309
   * returns the color from {@link #getPrimary3()}.
310
   *
311
   * @return The primary color for controls.
312
   */
313
  public ColorUIResource getPrimaryControl()
314
  {
315
    return getPrimary3();
316
  }
317
 
318
  /**
319
   * Returns the primary color for the dark shadow on controls.  The default
320
   * implementation returns the color from {@link #getPrimary1()}.
321
   *
322
   * @return The primary color for the dark shadow on controls.
323
   */
324
  public ColorUIResource getPrimaryControlDarkShadow()
325
  {
326
    return getPrimary1();
327
  }
328
 
329
  /**
330
   * Returns the primary color for the highlight on controls.  The default
331
   * implementation returns the color from {@link #getWhite()}.
332
   *
333
   * @return The primary color for the highlight on controls.
334
   */
335
  public ColorUIResource getPrimaryControlHighlight()
336
  {
337
    return getWhite();
338
  }
339
 
340
  /**
341
   * Returns the primary color for the information on controls.  The default
342
   * implementation returns the color from {@link #getBlack()}.
343
   *
344
   * @return The primary color for the information on controls.
345
   */
346
  public ColorUIResource getPrimaryControlInfo()
347
  {
348
    return getBlack();
349
  }
350
 
351
  /**
352
   * Returns the primary color for the shadow on controls.  The default
353
   * implementation returns the color from {@link #getPrimary2()}.
354
   *
355
   * @return The primary color for the shadow on controls.
356
   */
357
  public ColorUIResource getPrimaryControlShadow()
358
  {
359
    return getPrimary2();
360
  }
361
 
362
  /**
363
   * Returns the background color for separators.  The default implementation
364
   * returns the color from {@link #getWhite()}.
365
   *
366
   * @return The background color for separators.
367
   */
368
  public ColorUIResource getSeparatorBackground()
369
  {
370
    return getWhite();
371
  }
372
 
373
  /**
374
   * Returns the foreground color for separators.  The default implementation
375
   * returns the value from {@link #getPrimary1()}.
376
   *
377
   * @return The foreground color for separators.
378
   */
379
  public ColorUIResource getSeparatorForeground()
380
  {
381
    return getPrimary1();
382
  }
383
 
384
  /**
385
   * Returns the color used for system text.  The default implementation
386
   * returns the color from {@link #getBlack()}.
387
   *
388
   * @return The color used for system text.
389
   */
390
  public ColorUIResource getSystemTextColor()
391
  {
392
    return getBlack();
393
  }
394
 
395
  /**
396
   * Returns the color used to highlight text.  The default implementation
397
   * returns the color from {@link #getPrimary3()}.
398
   *
399
   * @return The color used to highlight text.
400
   */
401
  public ColorUIResource getTextHighlightColor()
402
  {
403
    return getPrimary3();
404
  }
405
 
406
  /**
407
   * Returns the color used to display user text.  The default implementation
408
   * returns the color from {@link #getBlack()}.
409
   *
410
   * @return The color used to display user text.
411
   */
412
  public ColorUIResource getUserTextColor()
413
  {
414
    return getBlack();
415
  }
416
 
417
  /**
418
   * Returns the window background color.  The default implementation returns
419
   * the color from {@link #getWhite()}.
420
   *
421
   * @return The window background color.
422
   */
423
  public ColorUIResource getWindowBackground()
424
  {
425
    return getWhite();
426
  }
427
 
428
  /**
429
   * Returns the window title background color.  The default implementation
430
   * returns the color from {@link #getPrimary3()}.
431
   *
432
   * @return The window title background color.
433
   */
434
  public ColorUIResource getWindowTitleBackground()
435
  {
436
    return getPrimary3();
437
  }
438
 
439
  /**
440
   * Returns the window title foreground color.  The default implementation
441
   * returns the color from {@link #getBlack()}.
442
   *
443
   * @return The window title foreground color.
444
   */
445
  public ColorUIResource getWindowTitleForeground()
446
  {
447
    return getBlack();
448
  }
449
 
450
  /**
451
   * Returns the background color for an inactive window title.  The default
452
   * implementation returns the color from {@link #getSecondary3()}.
453
   *
454
   * @return The background color for an inactive window title.
455
   */
456
  public ColorUIResource getWindowTitleInactiveBackground()
457
  {
458
    return getSecondary3();
459
  }
460
 
461
  /**
462
   * Returns the foreground color for an inactive window title.  The default
463
   * implementation returns the color from {@link #getBlack()}.
464
   *
465
   * @return The foreground color for an inactive window title.
466
   */
467
  public ColorUIResource getWindowTitleInactiveForeground()
468
  {
469
    return getBlack();
470
  }
471
 
472
  /**
473
   * Returns the color used for black.
474
   *
475
   * @return The color used for black.
476
   */
477
  protected ColorUIResource getBlack()
478
  {
479
    return BLACK;
480
  }
481
 
482
  /**
483
   * Returns the color used for white.
484
   *
485
   * @return The color used for white.
486
   */
487
  protected ColorUIResource getWhite()
488
  {
489
    return WHITE;
490
  }
491
 
492
  /**
493
   * Returns the first primary color for this theme.
494
   *
495
   * @return The first primary color.
496
   */
497
  protected abstract ColorUIResource getPrimary1();
498
 
499
  /**
500
   * Returns the second primary color for this theme.
501
   *
502
   * @return The second primary color.
503
   */
504
  protected abstract ColorUIResource getPrimary2();
505
 
506
  /**
507
   * Returns the third primary color for this theme.
508
   *
509
   * @return The third primary color.
510
   */
511
  protected abstract ColorUIResource getPrimary3();
512
 
513
  /**
514
   * Returns the first secondary color for this theme.
515
   *
516
   * @return The first secondary color.
517
   */
518
  protected abstract ColorUIResource getSecondary1();
519
 
520
  /**
521
   * Returns the second secondary color for this theme.
522
   *
523
   * @return The second secondary color.
524
   */
525
  protected abstract ColorUIResource getSecondary2();
526
 
527
  /**
528
   * Returns the third secondary color for this theme.
529
   *
530
   * @return The third secondary color.
531
   */
532
  protected abstract ColorUIResource getSecondary3();
533
 
534
  /**
535
   * Returns the font used for text on controls.
536
   *
537
   * @return The font used for text on controls.
538
   */
539
  public abstract FontUIResource getControlTextFont();
540
 
541
  /**
542
   * Returns the font used for text in menus.
543
   *
544
   * @return The font used for text in menus.
545
   */
546
  public abstract FontUIResource getMenuTextFont();
547
 
548
  /**
549
   * Returns the font used for sub text.
550
   *
551
   * @return The font used for sub text.
552
   */
553
  public abstract FontUIResource getSubTextFont();
554
 
555
  /**
556
   * Returns the font used for system text.
557
   *
558
   * @return The font used for system text.
559
   */
560
  public abstract FontUIResource getSystemTextFont();
561
 
562
  /**
563
   * Returns the font used for user text.
564
   *
565
   * @return The font used for user text.
566
   */
567
  public abstract FontUIResource getUserTextFont();
568
 
569
  /**
570
   * Returns the font used for window titles.
571
   *
572
   * @return The font used for window titles.
573
   */
574
  public abstract FontUIResource getWindowTitleFont();
575
 
576
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.