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 MANIPULATOR_H 10 #define MANIPULATOR_H 11 12 #include <Rect.h> 13 14 #include "Observer.h" 15 16 class BMessage; 17 class BView; 18 class Command; 19 20 // TODO: merge ViewState and Manipulator 21 22 class Manipulator : public Observer { 23 public: 24 Manipulator(Observable* object); 25 virtual ~Manipulator(); 26 27 // Manipulator interface 28 virtual void Draw(BView* into, BRect updateRect); 29 30 virtual bool MouseDown(BPoint where); 31 virtual void MouseMoved(BPoint where); 32 virtual Command* MouseUp(); 33 virtual bool MouseOver(BPoint where); 34 virtual bool DoubleClicked(BPoint where); 35 36 virtual bool ShowContextMenu(BPoint where); 37 38 virtual bool MessageReceived(BMessage* message, 39 Command** _command); 40 41 virtual void ModifiersChanged(uint32 modifiers); 42 virtual bool HandleKeyDown(uint32 key, uint32 modifiers, 43 Command** _command); 44 virtual bool HandleKeyUp(uint32 key, uint32 modifiers, 45 Command** _command); 46 47 virtual void UpdateCursor(); 48 49 virtual BRect Bounds() = 0; 50 // the area that the manipulator is 51 // occupying in the "parent" view 52 virtual BRect TrackingBounds(BView* withinView); 53 // the area within "view" in which the 54 // Manipulator wants to receive MouseOver() 55 // events 56 57 virtual void AttachedToView(BView* view); 58 virtual void DetachedFromView(BView* view); 59 60 protected: 61 Observable* fManipulatedObject; 62 }; 63 64 #endif // MANIPULATOR_H 65