ColorSwatch.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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): Wade Majors <wade@ezri.org>
  20. * Rene Gollent
  21. */
  22. #ifndef COLORSWATCH_H
  23. #define COLORSWATCH_H
  24. #include <View.h>
  25. class ColorSwatch : public BView
  26. {
  27. public:
  28. ColorSwatch (
  29. BRect,
  30. const char *,
  31. rgb_color,
  32. uint32 = B_FOLLOW_LEFT | B_FOLLOW_TOP,
  33. uint32 = B_WILL_DRAW | B_NAVIGABLE);
  34. virtual ~ColorSwatch (void);
  35. virtual void AttachedToWindow (void);
  36. virtual void Draw (BRect);
  37. rgb_color ValueAsColor (void) const;
  38. virtual void SetColor (rgb_color);
  39. BRect ColorRect (void) const;
  40. private:
  41. rgb_color ShiftColor (rgb_color, float) const;
  42. rgb_color Inverted (void) const;
  43. protected:
  44. rgb_color fColor;
  45. rgb_color fAlpha;
  46. };
  47. #endif