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