1 /* 2 * Copyright 2019, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Author: 6 * Preetpal Kaur <preetpalok123@gmail.com> 7 */ 8 9 10 #ifndef MOUSE_VIEW_H 11 #define MOUSE_VIEW_H 12 13 14 #include <Bitmap.h> 15 #include <Picture.h> 16 #include <PopUpMenu.h> 17 #include <View.h> 18 19 20 class MouseSettings; 21 22 class MouseView : public BView { 23 public: 24 MouseView(const MouseSettings& settings); 25 virtual ~MouseView(); 26 27 void SetMouseType(int32 type); 28 void MouseMapUpdated(); 29 void UpdateFromSettings(); 30 31 virtual void GetPreferredSize(float* _width, float* _height); 32 virtual void AttachedToWindow(); 33 virtual void MouseUp(BPoint where); 34 virtual void MouseDown(BPoint where); 35 virtual void Draw(BRect frame); 36 bool IsMouseConnected() 37 { return fConnected; } 38 39 private: 40 BRect _ButtonsRect() const; 41 BRect _ButtonRect(const int32* offsets, 42 int index) const; 43 int32 _ConvertFromVisualOrder(int32 button); 44 void _CreateButtonsPicture(); 45 46 private: 47 typedef BView inherited; 48 49 const MouseSettings& fSettings; 50 51 BPicture fButtonsPicture; 52 int32 fDigitBaseline; 53 int32 fDigitHeight; 54 float fScaling; 55 56 int32 fType; 57 uint32 fButtons; 58 uint32 fOldButtons; 59 bool fConnected; 60 }; 61 62 63 #endif /* MOUSE_VIEW_H */