xref: /haiku/src/apps/icon-o-matic/gui/StyleView.h (revision 1acbe440b8dd798953bec31d18ee589aa3f71b73)
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_GRADIENT_SELECTED	= 'grsl',
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				MessageReceived(BMessage* message);
46 
47 #if __HAIKU__
48 	virtual	BSize				MinSize();
49 #endif
50 
51 	// Observer interface
52 	virtual	void				ObjectChanged(const Observable* object);
53 
54 	// StyleView
55 			void				SetStyle(Style* style);
56 			void				SetCommandStack(CommandStack* stack);
57 			void				SetCurrentColor(CurrentColor* color);
58 
59  private:
60 			void				_SetGradient(Gradient* gradient,
61 											 bool forceControlUpdate = false);
62 			void				_MarkType(BMenu* menu,
63 										  int32 type) const;
64 			void				_SetStyleType(int32 type);
65 			void				_SetGradientType(int32 type);
66 			void				_AdoptCurrentColor(rgb_color color);
67 			void				_TransferGradientStopColor();
68 
69 
70 			CommandStack*		fCommandStack;
71 			CurrentColor*		fCurrentColor;
72 
73 			Style*				fStyle;
74 			Gradient*			fGradient;
75 			bool				fIgnoreCurrentColorNotifications;
76 
77 			GradientControl*	fGradientControl;
78 			BMenuField*			fStyleType;
79 			BMenuField*			fGradientType;
80 };
81 
82 #endif // STYLE_VIEW_H
83