diff --git a/src/preferences/Jamfile b/src/preferences/Jamfile index c160518b7e..3d127a6486 100644 --- a/src/preferences/Jamfile +++ b/src/preferences/Jamfile @@ -8,6 +8,7 @@ SubInclude HAIKU_TOP src preferences drivesetup ; SubInclude HAIKU_TOP src preferences dun ; SubInclude HAIKU_TOP src preferences filetypes ; SubInclude HAIKU_TOP src preferences fonts ; +SubInclude HAIKU_TOP src preferences joysticks ; SubInclude HAIKU_TOP src preferences keyboard ; SubInclude HAIKU_TOP src preferences keymap ; SubInclude HAIKU_TOP src preferences mail ; diff --git a/src/preferences/joysticks/CalibWin.cpp b/src/preferences/joysticks/CalibWin.cpp new file mode 100644 index 0000000000..e144d3c321 --- /dev/null +++ b/src/preferences/joysticks/CalibWin.cpp @@ -0,0 +1,101 @@ +/* + * Copyright 2007 Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * Ryan Leavengood, leavengood@gmail.com + */ + + +#include "CalibWin.h" + +#include +#include +#include +#include +#include +#include + +/* + All this code is here is just to not have an empty view at + Clicking the Calibrate function. + + All controls in this view needs to be created and placed dynamically according + with the Joystick descriptors +*/ + +CalibWin::CalibWin(BRect frame,const char *title, window_look look, + window_feel feel, uint32 flags, uint32 workspace) + : BWindow(frame,title,look,feel,flags,workspace) +{ + // Allocate object + fButton12 = new BButton(BRect(213.00,86.00,268.00,105.00),"Button12","Button",NULL); + fButton11 = new BButton(BRect(148.00,88.00,206.00,110.00),"Button11","Button",NULL); + fButton10 = new BButton(BRect(205.00,168.00,260.00,190.00),"Button10","Button",NULL); + fButton9 = new BButton(BRect(213.00,137.00,263.00,163.00),"Button9","Button", NULL); + fButton8 = new BButton(BRect(144.00,173.00,189.00,194.00),"Button8","Button",NULL); + fButton7 = new BButton(BRect(145.00,145.00,193.00,168.00),"Button7","Button",NULL); + fButton6 = new BButton(BRect(217.00,109.00,261.00,131.00),"Button6","Button",NULL); + fButton5 = new BButton(BRect(147.00,116.00,194.00,139.00),"Button5","Button",NULL); + fButton4 = new BButton(BRect(189.00,263.00,271.00,288.00),"Button4","Button",NULL); + fButton3 = new BButton(BRect(17.00,254.00,100.00,284.00),"Button3","Button",NULL); + + fStringView9 = new BStringView(BRect(8.00,175.00,116.00,190.00),"StringView9","Text"); + fStringView8 = new BStringView(BRect(10.00,154.00,112.00,172.00),"StringView8","Text"); + fStringView7 = new BStringView(BRect(9.00,132.00,116.00,148.00),"StringView7","Text"); + fStringView6 = new BStringView(BRect(11.00,114.00,120.00,128.00),"StringView6","Text"); + fStringView5 = new BStringView(BRect(11.00,93.00,121.00,108.00),"StringView5","Text"); + fStringView4 = new BStringView(BRect(12.00,73.00,121.00,88.00),"StringView4","Text"); + fStringView3 = new BStringView(BRect(26.00,17.00,258.00,45.00),"StringView3","Text3"); + + fBox = new BBox(BRect(12.00,7.00,280.00,67.00),"Box1", + B_FOLLOW_LEFT | B_FOLLOW_TOP,B_WILL_DRAW | B_NAVIGABLE, B_FANCY_BORDER); + + fView = new BView(Bounds(),"View3", B_FOLLOW_NONE,B_WILL_DRAW); + + fView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + // Adding object + fBox->AddChild(fStringView3); + + fView->AddChild(fButton3); + fView->AddChild(fButton4); + fView->AddChild(fBox); + + fView->AddChild(fStringView4); + fView->AddChild(fStringView5); + fView->AddChild(fStringView6); + fView->AddChild(fStringView7); + fView->AddChild(fStringView8); + fView->AddChild(fStringView9); + + fView->AddChild(fButton5); + fView->AddChild(fButton6); + fView->AddChild(fButton7); + fView->AddChild(fButton8); + fView->AddChild(fButton9); + fView->AddChild(fButton10); + fView->AddChild(fButton11); + fView->AddChild(fButton12); + + AddChild(fView); +} + + +void CalibWin::MessageReceived(BMessage *message) +{ + switch(message->what) + { + default: + BWindow::MessageReceived(message); + break; + } +} + + +bool CalibWin::QuitRequested() +{ + return BWindow::QuitRequested(); +} + diff --git a/src/preferences/joysticks/CalibWin.h b/src/preferences/joysticks/CalibWin.h new file mode 100644 index 0000000000..a31c785702 --- /dev/null +++ b/src/preferences/joysticks/CalibWin.h @@ -0,0 +1,70 @@ +/* + * Copyright 2007 Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * Ryan Leavengood, leavengood@gmail.com + */ +#ifndef _CALIB_WIN_H +#define _CALIB_WIN_H + + +#include + +class BView; +class BCheckBox; +class BStringView; +class BButton; +class BBox; + + +/* + All this code is here is just to not have an empty view at + Clicking the Calibrate function. + + All controls in this view needs to be created and placed dynamically according + with the Joystick descriptors +*/ + + +class CalibWin : public BWindow +{ + public: + CalibWin(BRect frame, const char *title, + window_look look, + window_feel feel, + uint32 flags, + uint32 workspace = B_CURRENT_WORKSPACE); + + virtual void MessageReceived(BMessage *message); + virtual bool QuitRequested(); + + protected: + BStringView* fStringView3; + BStringView* fStringView4; + BStringView* fStringView5; + BStringView* fStringView6; + BStringView* fStringView7; + BStringView* fStringView8; + BStringView* fStringView9; + + BButton* fButton3; + BButton* fButton4; + + BButton* fButton5; + BButton* fButton6; + BButton* fButton7; + BButton* fButton8; + BButton* fButton9; + BButton* fButton10; + BButton* fButton11; + BButton* fButton12; + + BBox* fBox; + BView* fView; +}; + + +#endif /* _CALIB_WIN_H */ + diff --git a/src/preferences/joysticks/Global.h b/src/preferences/joysticks/Global.h new file mode 100644 index 0000000000..41ef22254b --- /dev/null +++ b/src/preferences/joysticks/Global.h @@ -0,0 +1,22 @@ +/* + * Copyright 2007 Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * Ryan Leavengood, leavengood@gmail.com + */ +#ifndef _GLOBAL_H +#define _GLOBAL_H + + +/* Application Messages */ +#define PORT_SELECTED 'pSeL' +#define JOY_SELECTED 'jYSl' + +#define PORT_INVOKE 'PInV' +#define JOY_INVOKE 'jInV' + + +#endif /* _GLOBAL_H */ + diff --git a/src/preferences/joysticks/Jamfile b/src/preferences/joysticks/Jamfile new file mode 100644 index 0000000000..d219508b7b --- /dev/null +++ b/src/preferences/joysticks/Jamfile @@ -0,0 +1,18 @@ +SubDir HAIKU_TOP src preferences joysticks ; + +SetSubDirSupportedPlatformsBeOSCompatible ; +AddSubDirSupportedPlatforms libbe_test ; + +Preference Joysticks : + CalibWin.cpp + JoyWin.cpp + Joysticks.cpp + MessageWin.cpp + : be device + : Joysticks.rdef + ; + +if $(TARGET_PLATFORM) = libbe_test { + HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : Joysticks + : tests!apps ; +} diff --git a/src/preferences/joysticks/JoyWin.cpp b/src/preferences/joysticks/JoyWin.cpp new file mode 100644 index 0000000000..2b5ad8803d --- /dev/null +++ b/src/preferences/joysticks/JoyWin.cpp @@ -0,0 +1,221 @@ +/* + * Copyright 2007 Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * Ryan Leavengood, leavengood@gmail.com + */ + + +#include "JoyWin.h" +#include "MessagedItem.h" +#include "MessageWin.h" +#include "CalibWin.h" +#include "Global.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +JoyWin::JoyWin(BRect frame, const char *title, window_look look, + window_feel feel, uint32 flags, uint32 workspace = B_CURRENT_WORKSPACE) + : BWindow(frame, title, look, feel, flags, workspace) +{ + fProbeButton = new BButton(BRect(15.00, 260.00, 115.00, 285.00), "ProbeButton", "Probe", NULL); + fCalibrateButton = new BButton(BRect(270.00, 260.00, 370.00, 285.00), "CalibrateButton", "Calibrate", NULL); + + fGamePortL = new BListView(BRect(15.00, 30.00, 145.00, 250.00), "gamePort"); + fGamePortL->SetSelectionMessage(new BMessage(PORT_SELECTED)); + fGamePortL->SetInvocationMessage(new BMessage(PORT_INVOKE)); + + fConControllerL = new BListView(BRect(175.00,30.00,370.00,250.00),"conController"); + fConControllerL->SetSelectionMessage(new BMessage(JOY_SELECTED)); + fConControllerL->SetInvocationMessage(new BMessage(JOY_INVOKE)); + + fGamePortS = new BStringView(BRect(15, 5, 160, 25), "gpString", "Game Port"); + fGamePortS->SetFont(be_bold_font); + fConControllerS = new BStringView(BRect(170, 5, 330, 25), "ccString", "Connected Controller"); + fConControllerS->SetFont(be_bold_font); + + fCheckbox = new BCheckBox(BRect(131.00, 260.00, 227.00, 280.00), "Disabled", "Disabled", NULL); + fBox = new BBox( Bounds(),"box", B_FOLLOW_ALL, + B_WILL_DRAW | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE, + B_PLAIN_BORDER); + fBox->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + + // Adding object + fBox->AddChild(fCheckbox); + + fBox->AddChild(fGamePortS); + fBox->AddChild(fConControllerS); + + // Add listViews with their scrolls + fBox->AddChild(new BScrollView("PortScroll", fGamePortL, + 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); + fBox->AddChild(fCalibrateButton); + + AddChild(fBox); + + // 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()); + + /* Add all the devices */ + AddDevices(); + + /* Add the joysticks specifications */ + AddJoysticks(); +} + + +void JoyWin::MessageReceived(BMessage *message) +{ + switch(message->what) + { + case PORT_SELECTED: + break; + + case PORT_INVOKE: + // Do we have any port? + + // And some joysticks ? + + // Probe! + PerformProbe(); + + break; + + case JOY_SELECTED: + break; + + case JOY_INVOKE: + + // Do we have a selected definition? + + // And a suitale selected port? + + // Calibrate it! + Calibrate(); + + break; + + default: + BWindow::MessageReceived(message); + break; + } +} + + +bool JoyWin::QuitRequested() +{ + // Apply changes and save configurations etc etc + + be_app->PostMessage(B_QUIT_REQUESTED); + + return BWindow::QuitRequested(); +} + + +/* Initialization */ +status_t JoyWin::AddDevices() +{ + char buf[256]; + int devId = 0; + MessagedItem* device; + BMessage* message; + BString str; + + while (!fJoystick.GetDeviceName(devId, buf, 256)) { + message = new BMessage(PORT_SELECTED); + message->AddString("devname", buf); + // NOTE: Adding the index in the list might be useful. + + // TODO: Change it with leaf path + str.SetTo(buf); + //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 + + return B_ERROR; + } + + return B_OK; +} + + +status_t JoyWin::AddJoysticks() +{ + return B_OK; +} + + +/* Management */ +status_t JoyWin::Calibrate() +{ + CalibWin* calibw; + + calibw = new CalibWin(BRect(100, 100, 500, 400), "Calibrate", + B_DOCUMENT_WINDOW_LOOK, + B_NORMAL_WINDOW_FEEL, + B_NOT_RESIZABLE | B_NOT_ZOOMABLE); + + calibw->Show(); + + return B_OK; +} + + +status_t JoyWin::PerformProbe() +{ + MessageWin* mesgw; + + // [...] + + mesgw = new MessageWin(Frame(),"Probing", + B_MODAL_WINDOW_LOOK, + B_MODAL_APP_WINDOW_FEEL, + B_NOT_RESIZABLE | B_NOT_ZOOMABLE ); + + mesgw->Show(); + mesgw->SetText("Looking for: X in port Y ..."); + return B_OK; +} + + +/* Configuration */ +status_t JoyWin::ApplyChanges() +{ + return B_OK; +} + + +/* Configuration */ +status_t JoyWin::GetSettings() +{ + return B_OK; +} + diff --git a/src/preferences/joysticks/JoyWin.h b/src/preferences/joysticks/JoyWin.h new file mode 100644 index 0000000000..313a7f81eb --- /dev/null +++ b/src/preferences/joysticks/JoyWin.h @@ -0,0 +1,61 @@ +/* + * Copyright 2007 Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * Ryan Leavengood, leavengood@gmail.com + */ +#ifndef _JOY_WIN_H +#define _JOY_WIN_H + + +#include +#include + +class BView; +class BCheckBox; +class BStringView; +class BListView; +class BButton; +class BBox; + + +class JoyWin : public BWindow +{ + public: + JoyWin(BRect frame,const char *title, + window_look look, + window_feel feel, + uint32 flags, + uint32 workspace = B_CURRENT_WORKSPACE); + + virtual void MessageReceived(BMessage *message); + virtual bool QuitRequested(); + + protected: + BJoystick fJoystick; + + BBox* fBox; + BCheckBox* fCheckbox; + + BStringView* fGamePortS; + BStringView* fConControllerS; + + BListView* fGamePortL; + BListView* fConControllerL; + + BButton* fCalibrateButton; + BButton* fProbeButton; + + status_t AddDevices(); + status_t AddJoysticks(); + status_t Calibrate(); + status_t PerformProbe(); + status_t ApplyChanges(); + status_t GetSettings(); + +}; + +#endif /* _JOY_WIN_H */ + diff --git a/src/preferences/joysticks/Joysticks.cpp b/src/preferences/joysticks/Joysticks.cpp new file mode 100644 index 0000000000..f280901f27 --- /dev/null +++ b/src/preferences/joysticks/Joysticks.cpp @@ -0,0 +1,56 @@ +/* + * Copyright 2007 Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * Ryan Leavengood, leavengood@gmail.com + */ + + +#include "Joysticks.h" +#include "JoyWin.h" + +#include +#include +#include +#include +#include + + +int main(void) +{ + Joysticks application("application/x-vnd.Haiku-Joysticks"); + + // Start Application + application.Run(); + + return 0; +} + + +Joysticks::Joysticks(const char *signature) : BApplication(signature) +{ + +} + + +Joysticks::~Joysticks() +{ + +} + + +void Joysticks::ReadyToRun() +{ + fJoywin = new JoyWin(BRect(100, 100, 500, 400), "Joysticks", + B_DOCUMENT_WINDOW_LOOK, + B_NORMAL_WINDOW_FEEL, + B_NOT_ZOOMABLE); + + if (fJoywin != NULL) + fJoywin->Show(); + else + be_app->PostMessage(B_QUIT_REQUESTED); +} + diff --git a/src/preferences/joysticks/Joysticks.h b/src/preferences/joysticks/Joysticks.h new file mode 100644 index 0000000000..4c7df1b668 --- /dev/null +++ b/src/preferences/joysticks/Joysticks.h @@ -0,0 +1,33 @@ +/* + * Copyright 2007 Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * Ryan Leavengood, leavengood@gmail.com + */ +#ifndef _JOYSTICKS_H +#define _JOYSTICKS_H + + +#include + +class JoyWin; +class BWindow; + + +class Joysticks : public BApplication +{ + public: + Joysticks(const char *signature); + ~Joysticks(); + + virtual void ReadyToRun(); + + protected: + JoyWin* fJoywin; + +}; + + +#endif /* _JOYSTICKS_H */ diff --git a/src/preferences/joysticks/Joysticks.rdef b/src/preferences/joysticks/Joysticks.rdef new file mode 100644 index 0000000000..2acd3da5d9 --- /dev/null +++ b/src/preferences/joysticks/Joysticks.rdef @@ -0,0 +1,95 @@ + +resource app_signature "application/x-vnd.Haiku-Joysticks"; + +resource app_version { + major = 1, + middle = 0, + minor = 0, + + /* 0 = development 1 = alpha 2 = beta + 3 = gamma 4 = golden master 5 = final */ + variety = 2, + + internal = 0, + + short_info = "Joysticks", + long_info = "Joysticks ©2007 Haiku" +}; + +resource app_flags B_SINGLE_LAUNCH; + +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + +resource vector_icon { + $"6E63696608050004005F020006023D5F39368F62B905F93FFB6B4ACB36BEDE32" + $"00032288FF1944E7020006023AAFCC3BFAA8BF50A93E3D044B460F48AEEC0002" + $"0258FF1919E7020006023BA7EB3CD6E4BF5D013E2A4C4B0DDA478DDF0097C3FF" + $"FF376AFF02000602380D3A384399BEF6CA3EAF9C4B2833C6F2DC00E3ECFFFFAC" + $"C7FF02000602371F7FB98A813FA8F13D3A58C4B8AC48909300CEDEFFFF3778FF" + $"02000602371F7FB98A813FA8F13D3A58C60C5648909300BADAFFFF032E850B0A" + $"0432482C503E543C4B0A0550485452485E565A60500A0A47273D24322A244A2C" + $"4E34C2B0BE5BC408BFBFC94F485C52520A0447273C2D485C52520A08BE5AC40E" + $"4058485CBE3D2D322A244A2C4EB935C20F0A03BC12BB843BC1D3B9EBC0700A03" + $"BC12BB84BCC2BE1AB9EBC0700A03BD75C0B13BC1D3B9EBC0700A03BCC2BE1ABD" + $"75C0B1B9EBC0700A032C4E34C2B0B939C20A0A043D24322A3C2D4727090A0102" + $"0001000A0001021001178400040A020103000A030109000A030106000A060107" + $"000A070108000A04020405000A05010A00" +}; + +#else // HAIKU_TARGET_PLATFORM_HAIKU + +resource large_icon { + $"FFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFFFFFF001012FFFFFF000D0D0D0D00FFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFFFF00000D0DFFFFFFFF00090D0D0000FFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFFFF000D0D001012FFFFFF000D09060600FFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FFFF000D0000FFFFFFFFFFFF000D0A090600FFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FF000D00FFFFFFFFFFFFFFFF000D0A090600FFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"FF000D00FFFFFFFFFFFFFFFF000D0A090600FFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"001000FFFFFFFFFFFFFFFF00000D0A090600FFFFFFFFFFFFFFFFFFFFFFFFFFFF" + $"001000FFFFFFFFFFFFFF000D000D0A09060000FFFFFFFFFFFFFFFFFFFFFFFFFF" + $"00100000FFFFFFFFFF000D0D000D0A0906000D0000FFFFFFFFFFFFFFFFFFFFFF" + $"FF0010100000FFFF000D0D0D000D0A0906000D0D0D0000FFFFFFFFFFFFFFFFFF" + $"FFFF00000D0D00000DA50D0D000D0A0906000D7DA50D0D0000FFFFFFFFFFFFFF" + $"FFFFFFFF000D000DA57DA50000000A09060000090D0D0D0D0D0000FFFFFFFFFF" + $"FFFFFFFF00000D0D0D0D00007B7B000906000000090D0D0D0D0D0D0000FFFFFF" + $"FFFFFFFF000D0D0D0D000A00DA7B7B000600000000090D0D0D0D0D0D0D00FFFF" + $"FFFFFF000D0D0D0D0D00002B2BDA7B000000000600097DA50D0D0D0D0D00FFFF" + $"FFFF00A57DA50D7DA500002B2F2F00000009000600090D0D0D0D0D0D0600FFFF" + $"FF000D7D7D7DAA0D0D002B2CEB2F00090900000900090D0D0D0D0D060600FFFF" + $"00100D5B7DA50D0D0D002B2F2F00000000090900090D0D0D0D0D060606001111" + $"000A10100D0D0D0D002B2CEB2F000A0A090000090D7D0D0D0D06060600111111" + $"000A000000100D0D002B2F2F0000000000090D0D0D0D0D0D0606060600111111" + $"00007B7B7B0010002B2CEB2F000D0D0D7DA50D0D0D0D0D060606060600111111" + $"007B7B7BDA000A002B2F2F000D0D0D0D0D0D0D0D0D0D060606060600111111FF" + $"002B2CDA7B7B002B2CEB2F000D0D0D0D0D0D0D0D0D060606060600111111FFFF" + $"FF002B2CDA7B2B2CEB2F000A10100D0D0D0D0D0D060606060600111111FFFFFF" + $"FF002B2CDA7B2B2CEB2F000A0A0A10100D0D0D060606060600111111FFFFFFFF" + $"FFFF002B2C2B2B2F2F000A0A0A0A0A0A1010060606060600111111FFFFFFFFFF" + $"FFFF002B2C2B2B2F2F000A0A0A0A0A0A0A060606060600111111FFFFFFFFFFFF" + $"FFFFFF002B2CEB2F0000000A0A0A0A0A0A0606060600111111FFFFFFFFFFFFFF" + $"FFFFFF002B2CEB2F00FFFF00000A0A0A0A06060600111111FFFFFFFFFFFFFFFF" + $"FFFFFFFF002B2F00111111111100000A0A060000111111FFFFFFFFFFFFFFFFFF" + $"FFFFFFFF000000111111111111111100000011111111FFFFFFFFFFFFFFFFFFFF" +}; + +resource mini_icon { + $"FFFFFFFFFFFFFF00FFFFFFFFFFFFFFFF" + $"FFFF010BFFFF000C00FFFFFFFFFFFFFF" + $"FF0505FFFFFF000903FFFFFFFFFFFFFF" + $"FF05FFFFFFFF000903FFFFFFFFFFFFFF" + $"FF05FFFFFF0400090407FFFFFFFFFFFF" + $"FF060606040D000904890707FFFFFFFF" + $"FFFF0704AAD7000904000D0D0707FFFF" + $"FFFF040D0D007B000001027D0D0D05FF" + $"FF047DAA0E002F000702010D0D0605FF" + $"0410100C002F00090702AA0D06050F0F" + $"04000710002F000D7D0D0D0606050F0F" + $"002B00002F00100D0D0D0606050F10FF" + $"002B7B2CEB000910100606050F0FFFFF" + $"FF002B2F00000A0A0806050F0FFFFFFF" + $"FF002B2F00FF000005050F0FFFFFFFFF" + $"FFFF00000E0F0F0F0FFFFFFFFFFFFFFF" +}; + +#endif // HAIKU_TARGET_PLATFORM_HAIKU diff --git a/src/preferences/joysticks/MessageWin.cpp b/src/preferences/joysticks/MessageWin.cpp new file mode 100644 index 0000000000..c3d7e896e7 --- /dev/null +++ b/src/preferences/joysticks/MessageWin.cpp @@ -0,0 +1,72 @@ +/* + * Copyright 2007 Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * Ryan Leavengood, leavengood@gmail.com + */ + + +#include "MessageWin.h" + +#include +#include +#include +#include + +/* frame will be the frame of the parent window as*/ +MessageWin::MessageWin(BRect parentFrame, const char *title, + window_look look, window_feel feel, uint32 flags, uint32 workspace) + : BWindow(parentFrame ,title ,look ,feel, flags, workspace) +{ + fBox = new BBox(Bounds(), "", B_FOLLOW_ALL, B_WILL_DRAW, B_PLAIN_BORDER); + fBox->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + fBox->SetLowColor(fBox->ViewColor()); + + // Rects for the text view + BRect outside(fBox->Bounds()); + outside.InsetBy(10, 10); + BRect insider(outside); + insider.OffsetTo(B_ORIGIN); + + fText = new BTextView(outside, "message", insider, B_FOLLOW_NONE, B_WILL_DRAW); + fText->MakeEditable(false); + fText->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + fText->SetLowColor(fText->ViewColor()); + + fBox->AddChild(fText); + AddChild(fBox); + + /* Relocate the window to the center of what its being given */ + ResizeTo(parentFrame.Width(), floor(parentFrame.Height() / 3)); + MoveBy(0, floor(parentFrame.Height() / 2 - (parentFrame.Height()/3) / 2 )); + +} + + +void MessageWin::SetText(const char* str) +{ + Lock(); + fText->SetText(str); + fText->Flush(); + Unlock(); +} + + +void MessageWin::MessageReceived(BMessage *message) +{ + switch(message->what) + { + default: + BWindow::MessageReceived(message); + break; + } +} + + +bool MessageWin::QuitRequested() +{ + return BWindow::QuitRequested(); +} + diff --git a/src/preferences/joysticks/MessageWin.h b/src/preferences/joysticks/MessageWin.h new file mode 100644 index 0000000000..2353171fa1 --- /dev/null +++ b/src/preferences/joysticks/MessageWin.h @@ -0,0 +1,42 @@ +/* + * Copyright 2007 Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * Ryan Leavengood, leavengood@gmail.com + */ +#ifndef _MESSAGE_WIN_H +#define _MESSAGE_WIN_H + + +#include + +class BBox; +class BButton; +class BCheckBox; +class BStringView; +class BView; +class BTextView; + + +class MessageWin : public BWindow +{ + public: + MessageWin(BRect parent_frame, const char *title, + window_look look, + window_feel feel, + uint32 flags, + uint32 workspace = B_CURRENT_WORKSPACE); + + void SetText(const char* str); + virtual void MessageReceived(BMessage *message); + virtual bool QuitRequested(); + + protected: + BBox* fBox; + BTextView* fText; +}; + +#endif /* _MESSAGE_WIN_H */ + diff --git a/src/preferences/joysticks/MessagedItem.h b/src/preferences/joysticks/MessagedItem.h new file mode 100644 index 0000000000..2d80d97707 --- /dev/null +++ b/src/preferences/joysticks/MessagedItem.h @@ -0,0 +1,43 @@ +/* + * Copyright 2007 Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * Ryan Leavengood, leavengood@gmail.com + */ +#ifndef MESSAGED_ITEM_H +#define MESSAGED_ITEM_H + + +#include +#include +#include +#include + + +class MessagedItem : public BStringItem { + public: + MessagedItem(const char* label, BMessage* information) : BStringItem(label) + { + fMessage = information; + } + + ~MessagedItem() + { + delete fMessage; + } + + BMessage* getMessage() + { + return fMessage; + } + + protected: + BMessage* fMessage; + +}; + + +#endif /* MESSAGED_ITEM_H */ +