1 /* 2 * Copyright 2003-2010, Haiku, Inc. All Rights Reserved. 3 * Copyright 2004-2005 yellowTAB GmbH. All Rights Reserverd. 4 * Copyright 2006 Bernd Korz. All Rights Reserved 5 * Distributed under the terms of the MIT License. 6 * 7 * Authors: 8 * Fernando Francisco de Oliveira 9 * Michael Wilber 10 * Michael Pfeiffer 11 * yellowTAB GmbH 12 * Bernd Korz 13 * Stephan Aßmus <superstippi@gmx.de> 14 */ 15 #ifndef SELECTION_BOX_H 16 #define SELECTION_BOX_H 17 18 19 #include <View.h> 20 21 class ShowImageView; 22 23 24 class SelectionBox { 25 public: 26 SelectionBox(); 27 ~SelectionBox(); 28 29 void SetBounds(ShowImageView* view, BRect bounds); 30 BRect Bounds() const; 31 32 void MouseDown(ShowImageView* view, BPoint where); 33 void MouseMoved(ShowImageView* view, BPoint where); 34 void MouseUp(ShowImageView* view, BPoint where); 35 36 void Animate(); 37 void Draw(ShowImageView* view, 38 const BRect& updateRect) const; 39 40 private: 41 void _InitPatterns(); 42 43 BRect _RectInView(ShowImageView* view) const; 44 45 private: 46 BRect fBounds; 47 48 // Use patterns to simulate marching ants for selection. 49 pattern fPatternUp; 50 pattern fPatternDown; 51 pattern fPatternLeft; 52 pattern fPatternRight; 53 }; 54 55 #endif // SELECTION_BOX_H 56