ColorSelector.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef COLOR_SELECTOR_H
  2. #define COLOR_SELECTOR_H
  3. #include <Message.h>
  4. #include <Control.h>
  5. #include <String.h>
  6. /*------------------------------------------------------------*/
  7. class BPopUpMenu;
  8. class BMenuField;
  9. class BColorControl;
  10. #if !B_BEOS_VERSION_DANO
  11. class ColorSwatch;
  12. #endif
  13. class ColorSelector : public BControl {
  14. public:
  15. ColorSelector( BRect frame,
  16. const char* name,
  17. const char* label,
  18. const BMessage& colors,
  19. const BMessage& names,
  20. BMessage* model,
  21. uint32 resizeMask=B_FOLLOW_LEFT|B_FOLLOW_TOP,
  22. uint32 flags=B_WILL_DRAW|B_FRAME_EVENTS|B_NAVIGABLE_JUMP);
  23. ~ColorSelector();
  24. static void ExtractColors(BMessage* target, const BMessage& src);
  25. virtual void AttachedToWindow();
  26. virtual void AllAttached();
  27. virtual void MessageReceived(BMessage *msg);
  28. virtual void FrameResized(float width, float height);
  29. virtual void GetPreferredSize(float* width, float* height);
  30. void SetTo(const BMessage& colors);
  31. void Update(const BMessage& changes);
  32. void Revert();
  33. bool IsDirty() const;
  34. const BMessage& CurrentColors() const;
  35. const BMessage& InitialColors() const;
  36. private:
  37. void LayoutViews(bool really);
  38. BMessage fNames;
  39. BMessage fInitColors;
  40. BMessage fColors;
  41. BPopUpMenu* fColorMenu;
  42. BMenuField* fColorField;
  43. BColorControl* fColorPalette;
  44. BString fCurrentField;
  45. bool fSizeValid;
  46. float fPrefWidth, fPrefHeight;
  47. #if !B_BEOS_VERSION_DANO
  48. ColorSwatch *swatch;
  49. #endif
  50. };
  51. /*------------------------------------------------------------*/
  52. #endif