Theme.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * The contents of this file are subject to the Mozilla Public
  3. * License Version 1.1 (the "License"); you may not use this file
  4. * except in compliance with the License. You may obtain a copy of
  5. * the License at http://www.mozilla.org/MPL/
  6. *
  7. * Software distributed under the License is distributed on an "AS
  8. * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  9. * implied. See the License for the specific language governing
  10. * rights and limitations under the License.
  11. *
  12. * The Original Code is Vision.
  13. *
  14. * The Initial Developer of the Original Code is The Vision Team.
  15. * Portions created by The Vision Team are
  16. * Copyright (C) 1999, 2000, 2001 The Vision Team. All Rights
  17. * Reserved.
  18. *
  19. * Contributor(s): Rene Gollent
  20. * Todd Lair
  21. */
  22. #ifndef THEME_H_
  23. #define THEME_H_
  24. #include <OS.h>
  25. #include <GraphicsDefs.h>
  26. #include <List.h>
  27. class BView;
  28. class Theme
  29. {
  30. char *name;
  31. rgb_color *fores;
  32. rgb_color *backs;
  33. BFont *fonts;
  34. int16 fore_count;
  35. int16 back_count;
  36. int16 font_count;
  37. BList list;
  38. sem_id sid;
  39. public:
  40. static int16 TimestampFore;
  41. static int16 TimestampBack;
  42. static int16 TimestampFont;
  43. static int16 TimespaceFore;
  44. static int16 TimespaceBack;
  45. static int16 TimespaceFont;
  46. static int16 NormalFore;
  47. static int16 NormalBack;
  48. static int16 NormalFont;
  49. static int16 SelectionBack;
  50. Theme (
  51. const char *,
  52. int16,
  53. int16,
  54. int16);
  55. virtual ~Theme (void);
  56. const char *Name (void) const
  57. { return name; }
  58. void ReadLock (void);
  59. void ReadUnlock (void);
  60. void WriteLock (void);
  61. void WriteUnlock (void);
  62. int16 CountForegrounds (void) const;
  63. int16 CountBackgrounds (void) const;
  64. int16 CountFonts (void) const;
  65. const rgb_color ForegroundAt (int16) const;
  66. const rgb_color BackgroundAt (int16) const;
  67. const BFont &FontAt (int16) const;
  68. bool SetForeground (int16, const rgb_color);
  69. bool SetForeground (int16 w, uchar r, uchar g, uchar b, uchar a = 255)
  70. { rgb_color color = {r, g, b, a}; return SetForeground (w, color); }
  71. bool SetBackground (int16, const rgb_color);
  72. bool SetBackground (int16 w, uchar r, uchar g, uchar b, uchar a = 255)
  73. { rgb_color color = {r, g, b, a}; return SetBackground (w, color); }
  74. bool SetFont (int16, const BFont &);
  75. void AddView (BView *);
  76. void RemoveView (BView *);
  77. };
  78. #endif