1 /* 2 * Copyright 2006, Haiku. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 9 #ifndef STYLE_VIEW_H 10 #define STYLE_VIEW_H 11 12 #include <View.h> 13 14 #include "Observer.h" 15 16 class BMenu; 17 class BMenuField; 18 class CommandStack; 19 class CurrentColor; 20 class Gradient; 21 class GradientControl; 22 class Style; 23 24 // TODO: write lock the document when changing something... 25 26 enum { 27 MSG_GRADIENT_SELECTED = 'grsl', 28 }; 29 30 class StyleView : public BView, 31 public Observer { 32 public: 33 StyleView(BRect frame); 34 virtual ~StyleView(); 35 36 // BView interface 37 virtual void AttachedToWindow(); 38 virtual void MessageReceived(BMessage* message); 39 40 #if __HAIKU__ 41 virtual BSize MinSize(); 42 #endif 43 44 // Observer interface 45 virtual void ObjectChanged(const Observable* object); 46 47 // StyleView 48 void SetStyle(Style* style); 49 void SetCommandStack(CommandStack* stack); 50 void SetCurrentColor(CurrentColor* color); 51 52 private: 53 void _SetGradient(Gradient* gradient); 54 void _MarkType(BMenu* menu, 55 int32 type) const; 56 void _SetStyleType(int32 type); 57 void _SetGradientType(int32 type); 58 void _AdoptCurrentColor(rgb_color color); 59 void _TransferGradientStopColor(); 60 61 62 CommandStack* fCommandStack; 63 CurrentColor* fCurrentColor; 64 65 Style* fStyle; 66 Gradient* fGradient; 67 bool fIgnoreCurrentColorNotifications; 68 69 GradientControl* fGradientControl; 70 BMenuField* fStyleType; 71 BMenuField* fGradientType; 72 }; 73 74 #endif // STYLE_VIEW_H 75