1 // 2 // StickIt 3 // File: JoystickWindow.h 4 // Joystick window definitions. 5 // Sampel code used in "Getting a Grip on BJoystick" by Eric Shepherd 6 // 7 8 #include <Window.h> 9 #include <View.h> 10 11 class BJoystick; 12 13 class JoystickView : public BView { 14 public: 15 JoystickView(BRect bounds, BJoystick *stick); 16 virtual void Draw(BRect updateRect); 17 virtual void Pulse(void); 18 19 private: 20 BRect _BuildButtons(BJoystick *stick); 21 BRect _BuildHats(BJoystick *stick, BRect rect); 22 void _BuildAxes(BJoystick *stick, BRect rect); 23 BRect _BuildString(BString name, const char* strName, 24 int number, BRect rect); 25 26 BJoystick *fStick; 27 BRect fLastHatRect; 28 }; 29 30 class JoystickWindow : public BWindow { 31 public: 32 JoystickWindow(BJoystick *stick, BRect rect); 33 virtual bool QuitRequested(void); 34 35 private: 36 JoystickView *fView; 37 }; 38