diff --git a/src/preferences/input/InputDeviceView.cpp b/src/preferences/input/InputDeviceView.cpp new file mode 100644 index 0000000000..0776d8c7b2 --- /dev/null +++ b/src/preferences/input/InputDeviceView.cpp @@ -0,0 +1,71 @@ +/* + * Copyright 2019, Haiku, Inc. + * Distributed under the terms of the MIT License. + * + * Author: + * Preetpal Kaur +*/ + + +#include "InputDeviceView.h" + + +#include +#include +#include +#include +#include +#include +#include +#include + + +#undef B_TRANSLATION_CONTEXT +#define B_TRANSLATION_CONTEXT "DeviceList" + + +DeviceName::DeviceName(const char* item, int d) + : + BStringItem(item) +{ + this->fDevice = d; +} + +DeviceName::~DeviceName() +{ +} + +DeviceListView::DeviceListView(const char* name) + : + BView(name, B_WILL_DRAW) +{ + fDeviceList = new BListView("Device Names"); + + fScrollView = new BScrollView("ScrollView",fDeviceList, + 0 , false, B_FANCY_BORDER); + + SetExplicitMinSize(BSize(160, B_SIZE_UNSET)); + SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); + + fDeviceList->AddItem(new DeviceName("Mouse", 101)); + fDeviceList->AddItem(new DeviceName("Touchpad", 102)); + + BLayoutBuilder::Group<>(this, B_VERTICAL) + .SetInsets(B_USE_DEFAULT_SPACING) + .Add(fScrollView) + .End(); + fDeviceList->SetSelectionMessage(new BMessage(ITEM_SELECTED)); +} + +DeviceListView::~DeviceListView() +{ +} + +void +DeviceListView::AttachedToWindow() +{ + fDeviceList->SetTarget(this); + + fDeviceList->Select(0); + SetViewUIColor(B_PANEL_BACKGROUND_COLOR); +} diff --git a/src/preferences/input/InputDeviceView.h b/src/preferences/input/InputDeviceView.h new file mode 100644 index 0000000000..71f501286b --- /dev/null +++ b/src/preferences/input/InputDeviceView.h @@ -0,0 +1,52 @@ +/* + * Copyright 2019, Haiku, Inc. + * Distributed under the terms of the MIT License. + * + * Author: + * Preetpal Kaur + */ + + +#ifndef _INPUT_DEVICE_VIEW_H +#define _INPUT_DEVICE_VIEW_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "InputTouchpadPref.h" +#include "MouseSettings.h" + +#define ITEM_SELECTED 'I1s' + +class TouchpadPref; +class MouseSettings; + + +class DeviceName : public BStringItem { +public: + DeviceName(const char* item, int d); + virtual ~DeviceName(); + int WhichDevice() { return fDevice; }; +private: + int fDevice; +}; + +class DeviceListView: public BView { +public: + DeviceListView(const char *name); + virtual ~DeviceListView(); + virtual void AttachedToWindow(); +private: + BScrollView* fScrollView; + BListView* fDeviceList; + TouchpadPref fTouchpadPref; + MouseSettings fMouseSettings; +}; + +#endif // _INPUT_DEVICE_VIEW_H */ diff --git a/src/preferences/input/InputWindow.cpp b/src/preferences/input/InputWindow.cpp index d47f7f6196..e604dbf3c1 100644 --- a/src/preferences/input/InputWindow.cpp +++ b/src/preferences/input/InputWindow.cpp @@ -24,7 +24,6 @@ #include "InputWindow.h" -#include "InputDeviceView.h" #include "MouseSettings.h" #include "InputMouse.h" #include "InputConstants.h" diff --git a/src/preferences/input/InputWindow.h b/src/preferences/input/InputWindow.h index e76f1144d8..0a69005bd4 100644 --- a/src/preferences/input/InputWindow.h +++ b/src/preferences/input/InputWindow.h @@ -21,9 +21,10 @@ #include #include -#include "MouseSettings.h" +#include "InputDeviceView.h" #include "InputMouse.h" #include "InputTouchpadPrefView.h" +#include "MouseSettings.h" #include "touchpad_settings.h" @@ -31,7 +32,6 @@ class BSplitView; class BCardView; class BCardLayout; -class DeviceListView; class SettingsView; class DeviceName; class TouchpadPrefView; diff --git a/src/preferences/input/Jamfile b/src/preferences/input/Jamfile index 6c1025ed70..ba407c21f2 100644 --- a/src/preferences/input/Jamfile +++ b/src/preferences/input/Jamfile @@ -4,11 +4,11 @@ UsePrivateHeaders input ; Preference Input : Input.cpp - InputWindow.cpp InputDeviceView.cpp + InputMouse.cpp InputTouchpadPref.cpp InputTouchpadPrefView.cpp - InputMouse.cpp + InputWindow.cpp MouseView.cpp MouseSettings.cpp SettingsView.cpp @@ -18,11 +18,11 @@ DoCatalogs Input : x-vnd.Haiku-Input : Input.cpp - InputWindow.cpp InputDeviceView.cpp + InputMouse.cpp InputTouchpadPref.cpp InputTouchpadPrefView.cpp - InputMouse.cpp + InputWindow.cpp MouseView.cpp MouseSettings.cpp SettingsView.cpp