vfs: check userland buffers before reading them.
[haiku.git] / src / preferences / joysticks / JoyWin.h
blob0b914644331be8c64e1e8a8e7c482f1baa0e0302
1 /*
2 * Copyright 2007-2008 Haiku.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Oliver Ruiz Dorantes oliver.ruiz.dorantes_at_gmail.com
7 * Ryan Leavengood leavengood@gmail.com
8 * Fredrik Modéen fredrik@modeen.se
9 */
11 #ifndef _JOY_WIN_H
12 #define _JOY_WIN_H
14 #include <Window.h>
16 class BJoystick;
17 class BCheckBox;
18 class BStringView;
19 class BListView;
20 class PortItem;
21 class BButton;
22 class BEntry;
23 class BFile;
25 class JoyWin : public BWindow {
26 public:
27 JoyWin(BRect frame,const char *title);
28 virtual ~JoyWin();
29 virtual void MessageReceived(BMessage *message);
30 virtual bool QuitRequested();
32 private:
33 status_t _AddToList(BListView *list, uint32 command,
34 const char* rootPath, BEntry *rootEntry = NULL);
36 status_t _Calibrate();
37 status_t _PerformProbe(const char* path);
38 status_t _ApplyChanges();
39 status_t _GetSettings();
40 status_t _CheckJoystickExist(const char* path);
42 /*Show Alert Boxes*/
43 status_t _ShowProbeMesage(const char* str);
44 status_t _ShowCantFindFileMessage(const char* port);
45 void _ShowNoDeviceConnectedMessage(const char* joy,
46 const char* port);
47 void _ShowNoCompatibleJoystickMessage();
49 /*Util*/
50 BString _FixPathToName(const char* port);
51 BString _BuildDisabledJoysticksFile();
52 PortItem* _GetSelectedItem(BListView* list);
53 void _SelectDeselectJoystick(BListView* list, bool enable);
54 int32 _FindStringItemInList(BListView *view,
55 PortItem *item);
56 BString _FindFilePathForSymLink(const char* symLinkPath,
57 PortItem *item);
58 status_t _FindStick(const char* name);
59 const char* _FindSettingString(const char* name, const char* strPath);
60 bool _GetLine(BString& string);
62 //this one are used when we select joystick when portare selected
63 bool fSystemUsedSelect;
65 BJoystick* fJoystick;
66 BCheckBox* fCheckbox;
67 BStringView* fGamePortS;
68 BStringView* fConControllerS;
69 BListView* fGamePortL;
70 BListView* fConControllerL;
71 BButton* fCalibrateButton;
72 BButton* fProbeButton;
74 BFile* fFileTempProbeJoystick;
75 // int32 fSourceEncoding;
76 char fBuffer[4096];
77 off_t fPositionInBuffer;
78 ssize_t fAmtRead;
81 #endif /* _JOY_WIN_H */