Work in progress, now the Joystick pref should show the right text and error (that I can reproduce without joystick)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25865 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -17,6 +17,11 @@
|
|||||||
#define PORT_INVOKE 'PInV'
|
#define PORT_INVOKE 'PInV'
|
||||||
#define JOY_INVOKE 'jInV'
|
#define JOY_INVOKE 'jInV'
|
||||||
|
|
||||||
|
#define DISABLEPORT 'pdis'
|
||||||
|
#define PROBE 'prob'
|
||||||
|
#define CALIBRATE 'cali'
|
||||||
|
|
||||||
|
#define SELECTED 'sele'
|
||||||
|
|
||||||
#endif /* _GLOBAL_H */
|
#endif /* _GLOBAL_H */
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
SubDir HAIKU_TOP src preferences joysticks ;
|
SubDir HAIKU_TOP src preferences joysticks ;
|
||||||
|
|
||||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||||
|
AddSubDirSupportedPlatforms libbe_test ;
|
||||||
|
|
||||||
Preference Joysticks :
|
Preference Joysticks :
|
||||||
CalibWin.cpp
|
CalibWin.cpp
|
||||||
JoyWin.cpp
|
JoyWin.cpp
|
||||||
Joysticks.cpp
|
Joysticks.cpp
|
||||||
MessageWin.cpp
|
MessageWin.cpp
|
||||||
|
PortItem.cpp
|
||||||
: be device
|
: be device
|
||||||
: Joysticks.rdef
|
: Joysticks.rdef
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -1,117 +1,264 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007 Haiku.
|
* Copyright 2007-2008 Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
* Oliver Ruiz Dorantes oliver.ruiz.dorantes_at_gmail.com
|
||||||
* Ryan Leavengood, [email protected]
|
* Ryan Leavengood [email protected]
|
||||||
|
* Fredrik Modéen [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "JoyWin.h"
|
#include "JoyWin.h"
|
||||||
#include "MessagedItem.h"
|
|
||||||
#include "MessageWin.h"
|
#include "MessageWin.h"
|
||||||
#include "CalibWin.h"
|
#include "CalibWin.h"
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
|
#include "PortItem.h"
|
||||||
|
//#include "FileReadWrite.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
#include <ListView.h>
|
#include <ListView.h>
|
||||||
|
#include <ListItem.h>
|
||||||
#include <ScrollView.h>
|
#include <ScrollView.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
#include <Path.h>
|
||||||
|
#include <Entry.h>
|
||||||
|
#include <Directory.h>
|
||||||
|
#include <Alert.h>
|
||||||
|
#include <File.h>
|
||||||
|
#include <SymLink.h>
|
||||||
|
#include <Messenger.h>
|
||||||
|
#include <Directory.h>
|
||||||
|
#include <Joystick.h>
|
||||||
|
#include <FindDirectory.h>
|
||||||
|
#include <Joystick.h>
|
||||||
|
|
||||||
|
#define JOYSTICKPATH "/dev/joystick/"
|
||||||
|
#define JOYSTICKFILEPATH "/boot/beos/etc/joysticks/"
|
||||||
|
#define JOYSTICKFILESETTINGS "/boot/home/config/settings/joysticks/"
|
||||||
|
#define SELECTGAMEPORTFIRST "Select a game port first"
|
||||||
|
|
||||||
JoyWin::JoyWin(BRect frame, const char *title, window_look look,
|
static int
|
||||||
window_feel feel, uint32 flags, uint32 workspace = B_CURRENT_WORKSPACE)
|
ShowMessage(char* string)
|
||||||
: BWindow(frame, title, look, feel, flags, workspace)
|
|
||||||
{
|
{
|
||||||
fProbeButton = new BButton(BRect(15.00, 260.00, 115.00, 285.00), "ProbeButton", "Probe", NULL);
|
BAlert *alert = new BAlert("Message", string, "OK");
|
||||||
fCalibrateButton = new BButton(BRect(270.00, 260.00, 370.00, 285.00), "CalibrateButton", "Calibrate", NULL);
|
alert->SetShortcut(1, B_ESCAPE);
|
||||||
|
return alert->Go();
|
||||||
|
}
|
||||||
|
|
||||||
fGamePortL = new BListView(BRect(15.00, 30.00, 145.00, 250.00), "gamePort");
|
JoyWin::JoyWin(BRect frame, const char *title)
|
||||||
|
: BWindow(frame, title, B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
||||||
|
B_NOT_ZOOMABLE), fSystemUsedSelect(false),
|
||||||
|
fJoystick(new BJoystick)
|
||||||
|
{
|
||||||
|
fProbeButton = new BButton(BRect(15.00, 260.00, 115.00, 285.00),
|
||||||
|
"ProbeButton", "Probe", new BMessage(PROBE));
|
||||||
|
|
||||||
|
fCalibrateButton = new BButton(BRect(270.00, 260.00, 370.00, 285.00),
|
||||||
|
"CalibrateButton", "Calibrate", new BMessage(CALIBRATE));
|
||||||
|
|
||||||
|
fGamePortL = new BListView(BRect(15.00, 30.00, 145.00, 250.00),
|
||||||
|
"gamePort");
|
||||||
fGamePortL->SetSelectionMessage(new BMessage(PORT_SELECTED));
|
fGamePortL->SetSelectionMessage(new BMessage(PORT_SELECTED));
|
||||||
fGamePortL->SetInvocationMessage(new BMessage(PORT_INVOKE));
|
fGamePortL->SetInvocationMessage(new BMessage(PORT_INVOKE));
|
||||||
|
|
||||||
fConControllerL = new BListView(BRect(175.00,30.00,370.00,250.00),"conController");
|
fConControllerL = new BListView(BRect(175.00,30.00,370.00,250.00),
|
||||||
|
"conController");
|
||||||
fConControllerL->SetSelectionMessage(new BMessage(JOY_SELECTED));
|
fConControllerL->SetSelectionMessage(new BMessage(JOY_SELECTED));
|
||||||
fConControllerL->SetInvocationMessage(new BMessage(JOY_INVOKE));
|
fConControllerL->SetInvocationMessage(new BMessage(JOY_INVOKE));
|
||||||
|
|
||||||
fGamePortS = new BStringView(BRect(15, 5, 160, 25), "gpString", "Game Port");
|
fGamePortS = new BStringView(BRect(15, 5, 160, 25), "gpString",
|
||||||
|
"Game Port");
|
||||||
fGamePortS->SetFont(be_bold_font);
|
fGamePortS->SetFont(be_bold_font);
|
||||||
fConControllerS = new BStringView(BRect(170, 5, 330, 25), "ccString", "Connected Controller");
|
fConControllerS = new BStringView(BRect(170, 5, 330, 25), "ccString",
|
||||||
|
"Connected Controller");
|
||||||
|
|
||||||
fConControllerS->SetFont(be_bold_font);
|
fConControllerS->SetFont(be_bold_font);
|
||||||
|
|
||||||
fCheckbox = new BCheckBox(BRect(131.00, 260.00, 227.00, 280.00), "Disabled", "Disabled", NULL);
|
fCheckbox = new BCheckBox(BRect(131.00, 260.00, 227.00, 280.00),
|
||||||
fBox = new BBox( Bounds(),"box", B_FOLLOW_ALL,
|
"Disabled", "Disabled", new BMessage(DISABLEPORT));
|
||||||
|
BBox *box = new BBox( Bounds(),"box", B_FOLLOW_ALL,
|
||||||
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE,
|
B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE,
|
||||||
B_PLAIN_BORDER);
|
B_PLAIN_BORDER);
|
||||||
fBox->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
|
||||||
|
|
||||||
// Adding object
|
box->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
fBox->AddChild(fCheckbox);
|
|
||||||
|
|
||||||
fBox->AddChild(fGamePortS);
|
|
||||||
fBox->AddChild(fConControllerS);
|
|
||||||
|
|
||||||
// Add listViews with their scrolls
|
// Add listViews with their scrolls
|
||||||
fBox->AddChild(new BScrollView("PortScroll", fGamePortL,
|
box->AddChild(new BScrollView("PortScroll", fGamePortL,
|
||||||
B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW, false, true));
|
B_FOLLOW_LEFT | B_FOLLOW_TOP_BOTTOM, B_WILL_DRAW, false, true));
|
||||||
fBox->AddChild(new BScrollView("ConScroll", fConControllerL,
|
|
||||||
B_FOLLOW_ALL, B_WILL_DRAW, false, true));
|
|
||||||
|
|
||||||
fBox->AddChild(fProbeButton);
|
box->AddChild(new BScrollView("ConScroll", fConControllerL, B_FOLLOW_ALL,
|
||||||
fBox->AddChild(fCalibrateButton);
|
B_WILL_DRAW, false, true));
|
||||||
|
|
||||||
AddChild(fBox);
|
// Adding object
|
||||||
|
box->AddChild(fCheckbox);
|
||||||
|
box->AddChild(fGamePortS);
|
||||||
|
box->AddChild(fConControllerS);
|
||||||
|
box->AddChild(fProbeButton);
|
||||||
|
box->AddChild(fCalibrateButton);
|
||||||
|
AddChild(box);
|
||||||
|
|
||||||
// This resizable feature is not in R5 but.
|
|
||||||
// making horizontal resizing allows
|
|
||||||
// long joysticks names to be seen completelly
|
|
||||||
SetSizeLimits(400, 600, Bounds().Height(), Bounds().Height());
|
SetSizeLimits(400, 600, Bounds().Height(), Bounds().Height());
|
||||||
|
|
||||||
/* Add all the devices */
|
/* Add all the devices */
|
||||||
AddDevices();
|
int32 nr = fJoystick->CountDevices();
|
||||||
|
for (int32 i = 0; i < nr;i++) {
|
||||||
|
//BString str(path.Path());
|
||||||
|
char buf[B_OS_NAME_LENGTH];
|
||||||
|
fJoystick->GetDeviceName(i, buf, B_OS_NAME_LENGTH);
|
||||||
|
fGamePortL->AddItem(new PortItem(buf));
|
||||||
|
}
|
||||||
|
fGamePortL->Select(0);
|
||||||
|
|
||||||
/* Add the joysticks specifications */
|
/* Add the joysticks specifications */
|
||||||
AddJoysticks();
|
_AddToList(fConControllerL, JOY_SELECTED, JOYSTICKFILEPATH);
|
||||||
|
|
||||||
|
_GetSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void JoyWin::MessageReceived(BMessage *message)
|
JoyWin::~JoyWin()
|
||||||
{
|
{
|
||||||
|
//delete fFileTempProbeJoystick;
|
||||||
|
be_app_messenger.SendMessage(B_QUIT_REQUESTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
JoyWin::MessageReceived(BMessage *message)
|
||||||
|
{
|
||||||
|
// message->PrintToStream();
|
||||||
switch(message->what)
|
switch(message->what)
|
||||||
{
|
{
|
||||||
|
case DISABLEPORT:
|
||||||
|
break;
|
||||||
|
{
|
||||||
|
PortItem *item = _GetSelectedItem(fGamePortL);
|
||||||
|
if (item != NULL) {
|
||||||
|
//ToDo: item->SetEnabled(true);
|
||||||
|
//don't work as you can't select a item that are disabled
|
||||||
|
if(fCheckbox->Value()) {
|
||||||
|
item->SetEnabled(false);
|
||||||
|
_SelectDeselectJoystick(fConControllerL, false);
|
||||||
|
} else {
|
||||||
|
item->SetEnabled(true);
|
||||||
|
_SelectDeselectJoystick(fConControllerL, true);
|
||||||
|
_PerformProbe(item->Text());
|
||||||
|
}
|
||||||
|
} //else
|
||||||
|
//printf("We have a null value\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case PORT_SELECTED:
|
case PORT_SELECTED:
|
||||||
break;
|
{
|
||||||
|
PortItem *item = _GetSelectedItem(fGamePortL);
|
||||||
|
if (item != NULL) {
|
||||||
|
fSystemUsedSelect = true;
|
||||||
|
if (item->IsEnabled()) {
|
||||||
|
//printf("SetEnabled = false\n");
|
||||||
|
fCheckbox->SetValue(false);
|
||||||
|
_SelectDeselectJoystick(fConControllerL, true);
|
||||||
|
} else {
|
||||||
|
//printf("SetEnabled = true\n");
|
||||||
|
fCheckbox->SetValue(true);
|
||||||
|
_SelectDeselectJoystick(fConControllerL, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_CheckJoystickExist(item->Text()) == B_ERROR) {
|
||||||
|
if (_ShowCantFindFileMessage(item->Text()) == B_OK) {
|
||||||
|
_PerformProbe(item->Text());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
BString str(_FindFilePathForSymLink(JOYSTICKFILESETTINGS,
|
||||||
|
item));
|
||||||
|
if (str != NULL) {
|
||||||
|
BString str(_FixPathToName(str.String()));
|
||||||
|
int32 id = _FindStringItemInList(fConControllerL,
|
||||||
|
new PortItem(str.String()));
|
||||||
|
if (id > -1) {
|
||||||
|
fConControllerL->Select(id);
|
||||||
|
item->SetJoystickName(BString(str.String()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fConControllerL->DeselectAll();
|
||||||
|
ShowMessage(SELECTGAMEPORTFIRST);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case PROBE:
|
||||||
case PORT_INVOKE:
|
case PORT_INVOKE:
|
||||||
// Do we have any port?
|
{
|
||||||
|
PortItem *item = _GetSelectedItem(fGamePortL);
|
||||||
// And some joysticks ?
|
if (item != NULL) {
|
||||||
|
//printf("invoke.. inte null\n");
|
||||||
// Probe!
|
_PerformProbe(item->Text());
|
||||||
PerformProbe();
|
} else
|
||||||
|
ShowMessage(SELECTGAMEPORTFIRST);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case JOY_SELECTED:
|
case JOY_SELECTED:
|
||||||
break;
|
{
|
||||||
|
if (!fSystemUsedSelect) {
|
||||||
|
PortItem *controllerName = _GetSelectedItem(fConControllerL);
|
||||||
|
PortItem *portname = _GetSelectedItem(fGamePortL);
|
||||||
|
if (portname != NULL && controllerName != NULL) {
|
||||||
|
portname->SetJoystickName(BString(controllerName->Text()));
|
||||||
|
|
||||||
|
BString str = portname->GetOldJoystickName();
|
||||||
|
if (str != NULL) {
|
||||||
|
BString strOldFile(JOYSTICKFILESETTINGS);
|
||||||
|
strOldFile.Append(portname->Text());
|
||||||
|
BEntry entry(strOldFile.String());
|
||||||
|
entry.Remove();
|
||||||
|
}
|
||||||
|
BString strLinkPlace(JOYSTICKFILESETTINGS);
|
||||||
|
strLinkPlace.Append(portname->Text());
|
||||||
|
|
||||||
|
BString strLinkTo(JOYSTICKFILEPATH);
|
||||||
|
strLinkTo.Append(controllerName->Text());
|
||||||
|
|
||||||
|
BDirectory *dir = new BDirectory();
|
||||||
|
dir->CreateSymLink(strLinkPlace.String(),
|
||||||
|
strLinkTo.String(), NULL);
|
||||||
|
} else
|
||||||
|
ShowMessage(SELECTGAMEPORTFIRST);
|
||||||
|
}
|
||||||
|
|
||||||
|
fSystemUsedSelect = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case CALIBRATE:
|
||||||
case JOY_INVOKE:
|
case JOY_INVOKE:
|
||||||
|
{
|
||||||
// Do we have a selected definition?
|
PortItem *controllerName = _GetSelectedItem(fConControllerL);
|
||||||
|
PortItem *portname = _GetSelectedItem(fGamePortL);
|
||||||
// And a suitale selected port?
|
if (portname != NULL) {
|
||||||
|
if (controllerName == NULL)
|
||||||
// Calibrate it!
|
_ShowNoDeviceConnectedMessage("known", portname->Text());
|
||||||
Calibrate();
|
else {
|
||||||
|
_ShowNoDeviceConnectedMessage(controllerName->Text(), portname->Text());
|
||||||
|
/*
|
||||||
|
ToDo:
|
||||||
|
Check for a device, and show calibrate window if so
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
ShowMessage(SELECTGAMEPORTFIRST);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(message);
|
BWindow::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
@@ -119,104 +266,360 @@ void JoyWin::MessageReceived(BMessage *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool JoyWin::QuitRequested()
|
bool
|
||||||
|
JoyWin::QuitRequested()
|
||||||
{
|
{
|
||||||
// Apply changes and save configurations etc etc
|
_ApplyChanges();
|
||||||
|
|
||||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
|
||||||
|
|
||||||
return BWindow::QuitRequested();
|
return BWindow::QuitRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Initialization */
|
//---------------------- Private ---------------------------------//
|
||||||
status_t
|
status_t
|
||||||
JoyWin::AddDevices()
|
JoyWin::_AddToList(BListView *list, uint32 command,
|
||||||
|
const char* rootPath, BEntry *rootEntry = NULL)
|
||||||
{
|
{
|
||||||
char name[B_FILE_NAME_LENGTH];
|
BDirectory root;
|
||||||
int devId = 0;
|
|
||||||
MessagedItem* device;
|
|
||||||
BMessage* message;
|
|
||||||
BString str;
|
|
||||||
|
|
||||||
while (!fJoystick.GetDeviceName(devId, name, sizeof(name))) {
|
|
||||||
message = new BMessage(PORT_SELECTED);
|
|
||||||
message->AddString("devname", name);
|
|
||||||
// NOTE: Adding the index in the list might be useful.
|
|
||||||
|
|
||||||
// TODO: Change it with leaf path
|
|
||||||
str.SetTo(name);
|
|
||||||
//str = str.Remove(0, str.FindLast('/') );
|
|
||||||
|
|
||||||
device = new MessagedItem(str.String(), message);
|
|
||||||
fGamePortL->AddItem(device);
|
|
||||||
|
|
||||||
devId++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO: Add the Disabled devices */
|
|
||||||
|
|
||||||
/* We do not have any Joystick dev */
|
|
||||||
if (devId == 0) {
|
|
||||||
// keep track of it
|
|
||||||
// Alert it
|
|
||||||
|
|
||||||
|
if ( rootEntry != NULL )
|
||||||
|
root.SetTo( rootEntry );
|
||||||
|
else if ( rootPath != NULL )
|
||||||
|
root.SetTo( rootPath );
|
||||||
|
else
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
|
BEntry entry;
|
||||||
|
while ((root.GetNextEntry(&entry)) > B_ERROR ) {
|
||||||
|
if (entry.IsDirectory()) {
|
||||||
|
_AddToList(list, command, rootPath, &entry);
|
||||||
|
} else {
|
||||||
|
BPath path;
|
||||||
|
entry.GetPath(&path);
|
||||||
|
BString str(path.Path());
|
||||||
|
str.RemoveFirst(rootPath);
|
||||||
|
list->AddItem(new PortItem(str.String()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t JoyWin::AddJoysticks()
|
status_t
|
||||||
{
|
JoyWin::_Calibrate()
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Management */
|
|
||||||
status_t JoyWin::Calibrate()
|
|
||||||
{
|
{
|
||||||
CalibWin* calibw;
|
CalibWin* calibw;
|
||||||
|
BRect rect(100, 100, 500, 400);
|
||||||
calibw = new CalibWin(BRect(100, 100, 500, 400), "Calibrate",
|
calibw = new CalibWin(rect, "Calibrate", B_DOCUMENT_WINDOW_LOOK,
|
||||||
B_DOCUMENT_WINDOW_LOOK,
|
B_NORMAL_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_ZOOMABLE);
|
||||||
B_NORMAL_WINDOW_FEEL,
|
|
||||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE);
|
|
||||||
|
|
||||||
calibw->Show();
|
calibw->Show();
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t JoyWin::PerformProbe()
|
status_t
|
||||||
|
JoyWin::_PerformProbe(const char* path)
|
||||||
{
|
{
|
||||||
MessageWin* mesgw;
|
status_t err = B_ERROR;
|
||||||
|
err = _ShowProbeMesage(path);
|
||||||
|
if (err != B_OK) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
// [...]
|
MessageWin* mesgw = new MessageWin(Frame(),"Probing", B_MODAL_WINDOW_LOOK,
|
||||||
|
B_MODAL_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_ZOOMABLE);
|
||||||
mesgw = new MessageWin(Frame(),"Probing",
|
|
||||||
B_MODAL_WINDOW_LOOK,
|
|
||||||
B_MODAL_APP_WINDOW_FEEL,
|
|
||||||
B_NOT_RESIZABLE | B_NOT_ZOOMABLE );
|
|
||||||
|
|
||||||
mesgw->Show();
|
mesgw->Show();
|
||||||
mesgw->SetText("Looking for: X in port Y ...");
|
int32 number = fConControllerL->CountItems();
|
||||||
|
PortItem *item;
|
||||||
|
for (int i = 0; i < number; i++) {
|
||||||
|
// Do a search in JOYSTICKFILEPATH with item->Text() find the string
|
||||||
|
// that starts with "gadget" (tex gadget = "GamePad Pro") remove
|
||||||
|
// spacing and the "=" ty to open this one, if failed move to next and
|
||||||
|
// try to open.. list those that suxesfully work
|
||||||
|
fConControllerL->Select(i);
|
||||||
|
int32 selected = fConControllerL->CurrentSelection();
|
||||||
|
item = dynamic_cast<PortItem*>(fConControllerL->ItemAt(selected));
|
||||||
|
BString str("Looking for: ");
|
||||||
|
str << item->Text() << " in port " << path;
|
||||||
|
mesgw->SetText(str.String());
|
||||||
|
_FindSettingString(item->Text(), JOYSTICKFILEPATH);
|
||||||
|
//Need a check to find joysticks (don't know how right now so show a
|
||||||
|
// don't find message)
|
||||||
|
}
|
||||||
|
mesgw->Hide();
|
||||||
|
|
||||||
|
//Need a if !found then show this message. else list joysticks.
|
||||||
|
_ShowNoCompatibleJoystickMessage();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Configuration */
|
status_t
|
||||||
status_t JoyWin::ApplyChanges()
|
JoyWin::_ApplyChanges()
|
||||||
{
|
{
|
||||||
|
BString str = _BuildDisabledJoysticksFile();
|
||||||
|
//ToDo; Save the string as the file "disabled_joysticks" under settings
|
||||||
|
// (/boot/home/config/settings/disabled_joysticks)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Configuration */
|
status_t
|
||||||
status_t JoyWin::GetSettings()
|
JoyWin::_GetSettings()
|
||||||
{
|
{
|
||||||
|
// ToDo; Read the file "disabled_joysticks" and make the port with the
|
||||||
|
// same name disabled (/boot/home/config/settings/disabled_joysticks)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
JoyWin::_CheckJoystickExist(const char* path)
|
||||||
|
{
|
||||||
|
BString str(JOYSTICKFILESETTINGS);
|
||||||
|
str << path;
|
||||||
|
|
||||||
|
BFile file;
|
||||||
|
status_t status = file.SetTo(str.String(), B_READ_ONLY | B_FAIL_IF_EXISTS);
|
||||||
|
|
||||||
|
if (status == B_FILE_EXISTS || status == B_OK)
|
||||||
|
return B_OK;
|
||||||
|
else
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
JoyWin::_ShowProbeMesage(const char* device)
|
||||||
|
{
|
||||||
|
BString str("An attempt will be made to probe the port '");
|
||||||
|
str << device << "' to try to figure out what kind of joystick (if any) ";
|
||||||
|
str << "are attached.There is a small chance this process might cause ";
|
||||||
|
str << "your machine to lock up and require a reboot. Make sure you have ";
|
||||||
|
str << "savedchanges in all open applications before you Probe";
|
||||||
|
|
||||||
|
BAlert *alert = new BAlert("test1", str.String(), "Probe", "Cancel");
|
||||||
|
alert->SetShortcut(1, B_ESCAPE);
|
||||||
|
int32 bindex = alert->Go();
|
||||||
|
|
||||||
|
if (bindex == 0)
|
||||||
|
return B_OK;
|
||||||
|
else
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//Used when a files/joysticks are no were to be found
|
||||||
|
status_t
|
||||||
|
JoyWin::_ShowCantFindFileMessage(const char* port)
|
||||||
|
{
|
||||||
|
BString str("The file '");
|
||||||
|
str << _FixPathToName(port).String() << "' used by '" << port;
|
||||||
|
str << "' cannot be found.\n Do you want to ";
|
||||||
|
str << "try to auto-detect a joystick for this port?";
|
||||||
|
|
||||||
|
BAlert *alert = new BAlert("test1", str.String(), "Stop", "Probe");
|
||||||
|
alert->SetShortcut(1, B_ENTER);
|
||||||
|
int32 bindex = alert->Go();
|
||||||
|
|
||||||
|
if (bindex == 1)
|
||||||
|
return B_OK;
|
||||||
|
else
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
JoyWin::_ShowNoCompatibleJoystickMessage()
|
||||||
|
{
|
||||||
|
BString str("There where no compatible joysticks detected on this game");
|
||||||
|
str << " port. Try another port, or ask the manufacture of your jostick";
|
||||||
|
str << " for a driver designed for Haiku or BeOS.";
|
||||||
|
|
||||||
|
BAlert *alert = new BAlert("test1", str.String(), "Ok");
|
||||||
|
alert->SetShortcut(0, B_ENTER);
|
||||||
|
alert->Go();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
JoyWin::_ShowNoDeviceConnectedMessage(const char* joy, const char* port)
|
||||||
|
{
|
||||||
|
BString str("There does not appear to be a ");
|
||||||
|
str << joy << " device connected to the port '" << port << "'.";
|
||||||
|
|
||||||
|
BAlert *alert = new BAlert("test1", str.String(), "Stop");
|
||||||
|
alert->SetShortcut(0, B_ENTER);
|
||||||
|
alert->Go();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Use this function to get a string of disabled ports
|
||||||
|
BString
|
||||||
|
JoyWin::_BuildDisabledJoysticksFile()
|
||||||
|
{
|
||||||
|
BString temp("# This is a list of disabled joystick devices.");
|
||||||
|
temp << "# Do not include the /dev/joystick/ part of the device name.";
|
||||||
|
|
||||||
|
int32 number = fGamePortL->CountItems();
|
||||||
|
PortItem *item;
|
||||||
|
for (int i = 0; i < number; i++) {
|
||||||
|
item = dynamic_cast<PortItem*>(fGamePortL->ItemAt(i));
|
||||||
|
if (!item->IsEnabled())
|
||||||
|
temp << "disable = \"" << item->Text() << "\"";
|
||||||
|
}
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PortItem*
|
||||||
|
JoyWin::_GetSelectedItem(BListView* list)
|
||||||
|
{
|
||||||
|
int32 id = list->CurrentSelection();
|
||||||
|
if (id > -1) {
|
||||||
|
//PortItem *item = dynamic_cast<PortItem*>(list->ItemAt(id));
|
||||||
|
return dynamic_cast<PortItem*>(list->ItemAt(id));
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BString
|
||||||
|
JoyWin::_FixPathToName(const char* port)
|
||||||
|
{
|
||||||
|
BString temp(port);
|
||||||
|
temp = temp.Remove(0, temp.FindLast('/') + 1) ;
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
JoyWin::_SelectDeselectJoystick(BListView* list, bool enable)
|
||||||
|
{
|
||||||
|
list->DeselectAll();
|
||||||
|
int32 number = fGamePortL->CountItems();
|
||||||
|
PortItem *item;
|
||||||
|
for (int i = 0; i < number; i++) {
|
||||||
|
item = dynamic_cast<PortItem*>(list->ItemAt(i));
|
||||||
|
item->SetEnabled(enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
JoyWin::_FindStringItemInList(BListView *view, PortItem *item)
|
||||||
|
{
|
||||||
|
PortItem *strItem;
|
||||||
|
int32 number = view->CountItems();
|
||||||
|
for (int32 i = 0; i < number; i++) {
|
||||||
|
strItem = dynamic_cast<PortItem*>(view->ItemAt(i));
|
||||||
|
if (!strcmp(strItem->Text(), item->Text())) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete strItem;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BString
|
||||||
|
JoyWin::_FindFilePathForSymLink(const char* symLinkPath, PortItem *item)
|
||||||
|
{
|
||||||
|
BPath path(symLinkPath);
|
||||||
|
path.Append(item->Text());
|
||||||
|
BEntry entry(path.Path());
|
||||||
|
if (entry.IsSymLink()) {
|
||||||
|
BSymLink symLink(&entry);
|
||||||
|
BDirectory parent;
|
||||||
|
entry.GetParent(&parent);
|
||||||
|
symLink.MakeLinkedPath(&parent, &path);
|
||||||
|
BString str(path.Path());
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
JoyWin::_FindStick(const char* name)
|
||||||
|
{
|
||||||
|
BJoystick *stick = new BJoystick();
|
||||||
|
return stick->Open(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char*
|
||||||
|
JoyWin::_FindSettingString(const char* name, const char* strPath)
|
||||||
|
{
|
||||||
|
//Make a BJoystick try open it
|
||||||
|
BString str;
|
||||||
|
|
||||||
|
BPath path(strPath);
|
||||||
|
path.Append(name);
|
||||||
|
fFileTempProbeJoystick = new BFile(path.Path(), B_READ_ONLY);
|
||||||
|
|
||||||
|
//status_t err = find_directory(B_COMMON_ETC_DIRECTORY, &path);
|
||||||
|
// if (err == B_OK) {
|
||||||
|
//BString str(path.Path());
|
||||||
|
//str << "/joysticks/" << name;
|
||||||
|
//printf("path'%s'\n", str.String());
|
||||||
|
//err = file->SetTo(strPath, B_READ_ONLY);
|
||||||
|
status_t err = fFileTempProbeJoystick->InitCheck();
|
||||||
|
if (err == B_OK) {
|
||||||
|
//FileReadWrite frw(fFileTempProbeJoystick);
|
||||||
|
//printf("Get going\n");
|
||||||
|
//printf("Opening file = %s\n", path.Path());
|
||||||
|
//while (frw.Next(str)) {
|
||||||
|
//printf("In While loop\n");
|
||||||
|
// printf("getline %s \n", str.String());
|
||||||
|
//Test to open joystick with x number
|
||||||
|
//}
|
||||||
|
/*while (_GetLine(str)) {
|
||||||
|
//printf("In While loop\n");
|
||||||
|
printf("getline %s \n", str.String());
|
||||||
|
//Test to open joystick with x number
|
||||||
|
}*/
|
||||||
|
return "";
|
||||||
|
} else
|
||||||
|
printf("BFile.SetTo error: %s, Path = %s\n", strerror(err), str.String());
|
||||||
|
// } else
|
||||||
|
// printf("find_directory error: %s\n", strerror(err));
|
||||||
|
|
||||||
|
// delete file;
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
//Function to get a line from a file
|
||||||
|
bool
|
||||||
|
JoyWin::_GetLine(BString& string)
|
||||||
|
{
|
||||||
|
// Fill up the buffer with the first chunk of code
|
||||||
|
if (fPositionInBuffer == 0)
|
||||||
|
fAmtRead = fFileTempProbeJoystick->Read(&fBuffer, sizeof(fBuffer));
|
||||||
|
while (fAmtRead > 0) {
|
||||||
|
while (fPositionInBuffer < fAmtRead) {
|
||||||
|
// Return true if we hit a newline or the end of the file
|
||||||
|
if (fBuffer[fPositionInBuffer] == '\n') {
|
||||||
|
fPositionInBuffer++;
|
||||||
|
//Convert begin
|
||||||
|
int32 state = 0;
|
||||||
|
int32 bufferLen = string.Length();
|
||||||
|
int32 destBufferLen = bufferLen;
|
||||||
|
char destination[destBufferLen];
|
||||||
|
// if (fSourceEncoding)
|
||||||
|
// convert_to_utf8(fSourceEncoding, string.String(), &bufferLen, destination, &destBufferLen, &state);
|
||||||
|
string = destination;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
string += fBuffer[fPositionInBuffer];
|
||||||
|
fPositionInBuffer++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Once the buffer runs out, grab some more and start again
|
||||||
|
fAmtRead = fFileTempProbeJoystick->Read(&fBuffer, sizeof(fBuffer));
|
||||||
|
fPositionInBuffer = 0;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|||||||
@@ -1,61 +1,81 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007 Haiku.
|
* Copyright 2007-2008 Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
* Oliver Ruiz Dorantes oliver.ruiz.dorantes_at_gmail.com
|
||||||
* Ryan Leavengood, [email protected]
|
* Ryan Leavengood [email protected]
|
||||||
|
* Fredrik Modéen [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _JOY_WIN_H
|
#ifndef _JOY_WIN_H
|
||||||
#define _JOY_WIN_H
|
#define _JOY_WIN_H
|
||||||
|
|
||||||
|
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
#include <Joystick.h>
|
|
||||||
|
|
||||||
class BView;
|
class BJoystick;
|
||||||
class BCheckBox;
|
class BCheckBox;
|
||||||
class BStringView;
|
class BStringView;
|
||||||
class BListView;
|
class BListView;
|
||||||
|
class PortItem;
|
||||||
class BButton;
|
class BButton;
|
||||||
class BBox;
|
class BEntry;
|
||||||
|
class BFile;
|
||||||
|
|
||||||
|
class JoyWin : public BWindow {
|
||||||
class JoyWin : public BWindow
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
JoyWin(BRect frame,const char *title,
|
JoyWin(BRect frame,const char *title);
|
||||||
window_look look,
|
virtual ~JoyWin();
|
||||||
window_feel feel,
|
|
||||||
uint32 flags,
|
|
||||||
uint32 workspace = B_CURRENT_WORKSPACE);
|
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
BJoystick fJoystick;
|
status_t _AddToList(BListView *list, uint32 command,
|
||||||
|
const char* rootPath, BEntry *rootEntry = NULL);
|
||||||
|
|
||||||
BBox* fBox;
|
status_t _Calibrate();
|
||||||
|
status_t _PerformProbe(const char* path);
|
||||||
|
status_t _ApplyChanges();
|
||||||
|
status_t _GetSettings();
|
||||||
|
status_t _CheckJoystickExist(const char* path);
|
||||||
|
|
||||||
|
/*Show Alert Boxes*/
|
||||||
|
status_t _ShowProbeMesage(const char* str);
|
||||||
|
status_t _ShowCantFindFileMessage(const char* port);
|
||||||
|
void _ShowNoDeviceConnectedMessage(const char* joy,
|
||||||
|
const char* port);
|
||||||
|
void _ShowNoCompatibleJoystickMessage();
|
||||||
|
|
||||||
|
/*Util*/
|
||||||
|
BString _FixPathToName(const char* port);
|
||||||
|
BString _BuildDisabledJoysticksFile();
|
||||||
|
PortItem* _GetSelectedItem(BListView* list);
|
||||||
|
void _SelectDeselectJoystick(BListView* list, bool enable);
|
||||||
|
int32 _FindStringItemInList(BListView *view,
|
||||||
|
PortItem *item);
|
||||||
|
BString _FindFilePathForSymLink(const char* symLinkPath,
|
||||||
|
PortItem *item);
|
||||||
|
status_t _FindStick(const char* name);
|
||||||
|
const char* _FindSettingString(const char* name, const char* strPath);
|
||||||
|
bool _GetLine(BString& string);
|
||||||
|
|
||||||
|
//this one are used when we select joystick when portare selected
|
||||||
|
bool fSystemUsedSelect;
|
||||||
|
|
||||||
|
BJoystick* fJoystick;
|
||||||
BCheckBox* fCheckbox;
|
BCheckBox* fCheckbox;
|
||||||
|
|
||||||
BStringView* fGamePortS;
|
BStringView* fGamePortS;
|
||||||
BStringView* fConControllerS;
|
BStringView* fConControllerS;
|
||||||
|
|
||||||
BListView* fGamePortL;
|
BListView* fGamePortL;
|
||||||
BListView* fConControllerL;
|
BListView* fConControllerL;
|
||||||
|
|
||||||
BButton* fCalibrateButton;
|
BButton* fCalibrateButton;
|
||||||
BButton* fProbeButton;
|
BButton* fProbeButton;
|
||||||
|
|
||||||
status_t AddDevices();
|
BFile* fFileTempProbeJoystick;
|
||||||
status_t AddJoysticks();
|
// int32 fSourceEncoding;
|
||||||
status_t Calibrate();
|
char fBuffer[4096];
|
||||||
status_t PerformProbe();
|
off_t fPositionInBuffer;
|
||||||
status_t ApplyChanges();
|
ssize_t fAmtRead;
|
||||||
status_t GetSettings();
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _JOY_WIN_H */
|
#endif /* _JOY_WIN_H */
|
||||||
|
|
||||||
|
|||||||
@@ -11,43 +11,46 @@
|
|||||||
#include "Joysticks.h"
|
#include "Joysticks.h"
|
||||||
#include "JoyWin.h"
|
#include "JoyWin.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <StringView.h>
|
#include <StringView.h>
|
||||||
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
Joysticks application("application/x-vnd.Haiku-Joysticks");
|
Joysticks application("application/x-vnd.Haiku-Joysticks");
|
||||||
|
|
||||||
// Start Application
|
|
||||||
application.Run();
|
application.Run();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Joysticks::Joysticks(const char *signature) : BApplication(signature)
|
Joysticks::Joysticks(const char *signature)
|
||||||
|
: BApplication(signature)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Joysticks::~Joysticks()
|
Joysticks::~Joysticks()
|
||||||
{
|
{
|
||||||
|
be_app_messenger.SendMessage(B_QUIT_REQUESTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Joysticks::ReadyToRun()
|
bool
|
||||||
|
Joysticks::QuitRequested()
|
||||||
{
|
{
|
||||||
fJoywin = new JoyWin(BRect(100, 100, 500, 400), "Joysticks",
|
return BApplication::QuitRequested();
|
||||||
B_DOCUMENT_WINDOW_LOOK,
|
}
|
||||||
B_NORMAL_WINDOW_FEEL,
|
|
||||||
B_NOT_ZOOMABLE);
|
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Joysticks::ReadyToRun()
|
||||||
|
{
|
||||||
|
fJoywin = new JoyWin(BRect(100, 100, 500, 400), "Joysticks");
|
||||||
if (fJoywin != NULL)
|
if (fJoywin != NULL)
|
||||||
fJoywin->Show();
|
fJoywin->Show();
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class Joysticks : public BApplication
|
|||||||
~Joysticks();
|
~Joysticks();
|
||||||
|
|
||||||
virtual void ReadyToRun();
|
virtual void ReadyToRun();
|
||||||
|
virtual bool QuitRequested();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
JoyWin* fJoywin;
|
JoyWin* fJoywin;
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008 Haiku.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Fredrik Modéen [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "PortItem.h"
|
||||||
|
|
||||||
|
PortItem::PortItem(const char* label)
|
||||||
|
:BStringItem(label)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
PortItem::~PortItem()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void
|
||||||
|
PortItem::DrawItem(BView *owner, BRect frame, bool complete = false)
|
||||||
|
{
|
||||||
|
BStringItem::DrawItem(owner, frame, complete);
|
||||||
|
}
|
||||||
|
|
||||||
|
BString
|
||||||
|
PortItem::GetOldJoystickName()
|
||||||
|
{
|
||||||
|
return fOldSelectedJoystick;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BString
|
||||||
|
PortItem::GetJoystickName()
|
||||||
|
{
|
||||||
|
return fSelectedJoystick;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PortItem::SetJoystickName(BString str)
|
||||||
|
{
|
||||||
|
fOldSelectedJoystick = fSelectedJoystick;
|
||||||
|
fSelectedJoystick = str;
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2008 Haiku.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Fredrik Modéen [email protected]
|
||||||
|
*/
|
||||||
|
#ifndef PORT_ITEM_H
|
||||||
|
#define PORT_ITEM_H
|
||||||
|
|
||||||
|
#include <ListItem.h>
|
||||||
|
#include <String.h>
|
||||||
|
|
||||||
|
class PortItem : public BStringItem {
|
||||||
|
public:
|
||||||
|
PortItem(const char* label);
|
||||||
|
~PortItem();
|
||||||
|
virtual void DrawItem(BView *owner, BRect frame, bool complete = false);
|
||||||
|
BString GetOldJoystickName();
|
||||||
|
BString GetJoystickName();
|
||||||
|
void SetJoystickName(BString str);
|
||||||
|
protected:
|
||||||
|
BString fOldSelectedJoystick;
|
||||||
|
BString fSelectedJoystick;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* MESSAGED_ITEM_H */
|
||||||
|
|
||||||
Reference in New Issue
Block a user