1 /* 2 * Copyright 2019, Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * Author: 6 * Preetpal Kaur <preetpalok123@gmail.com> 7 */ 8 9 10 #include "InputDeviceView.h" 11 12 13 #include <Catalog.h> 14 #include <DateFormat.h> 15 #include <Input.h> 16 #include <LayoutBuilder.h> 17 #include <ListView.h> 18 #include <Locale.h> 19 #include <ScrollView.h> 20 #include <String.h> 21 #include <StringItem.h> 22 23 24 #undef B_TRANSLATION_CONTEXT 25 #define B_TRANSLATION_CONTEXT "DeviceList" 26 27 28 DeviceListView::DeviceListView(const char* name) 29 : 30 BView(name, B_WILL_DRAW) 31 { 32 fDeviceList = new BListView("Device Names"); 33 34 fScrollView = new BScrollView("ScrollView",fDeviceList, 35 0 , false, B_FANCY_BORDER); 36 37 SetExplicitMinSize(BSize(160, B_SIZE_UNSET)); 38 SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); 39 40 41 BLayoutBuilder::Group<>(this, B_VERTICAL) 42 .Add(fScrollView) 43 .End(); 44 fDeviceList->SetSelectionMessage(new BMessage(ITEM_SELECTED)); 45 } 46 47 DeviceListView::~DeviceListView() 48 { 49 } 50 51 void 52 DeviceListView::AttachedToWindow() 53 { 54 fDeviceList->SetTarget(this); 55 56 fDeviceList->Select(0); 57 SetViewUIColor(B_PANEL_BACKGROUND_COLOR); 58 } 59