Added a BBox, BButton and several BStringViews.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2919 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Phil Greenway 2003-03-15 01:19:52 +00:00
parent 6c69f6e9c3
commit 395ea9a9b7

View File

@ -11,10 +11,12 @@ Devices - DevicesWindow by Sikosis
#include <Alert.h>
#include <Application.h>
#include <Bitmap.h>
#include <Box.h>
#include <Button.h>
#include <MenuBar.h>
#include <Menu.h>
#include <MenuItem.h>
#include <OutlineListView.h>
#include <Path.h>
#include <Screen.h>
#include <ScrollView.h>
@ -35,6 +37,8 @@ const uint32 MENU_DEVICES_REMOVE_JUMPERED_DEVICE = 'mdrj';
const uint32 MENU_DEVICES_NEW_JUMPERED_DEVICE = 'mdnj';
const uint32 MENU_DEVICES_RESOURCE_USAGE = 'mdru';
const uint32 BTN_CONFIGURE = 'bcfg';
// CenterWindowOnScreen -- Centers the BWindow to the Current Screen
static void CenterWindowOnScreen(BWindow* w)
@ -95,15 +99,87 @@ void DevicesWindow::InitWindow(void)
menubar->AddItem(FileMenu);
menubar->AddItem(DevicesMenu);
// Create the StringViews
stvDeviceName = new BStringView(BRect(LeftMargin, 16, 150, 40), "DeviceName", "Device Name");
stvCurrentState = new BStringView(BRect(RightMargin, 16, r.right-10, 40), "CurrentState", "Current State");
BStringView *stvIRQ;
BStringView *stvDMA;
BStringView *stvIORanges;
BStringView *stvMemoryRanges;
float fCurrentHeight = 280;
float fCurrentGap = 16;
stvIRQ = new BStringView(BRect(r.left+20,r.top+fCurrentHeight,r.left+80,r.top+fCurrentHeight+20),"IRQ","IRQs:");
fCurrentHeight = fCurrentHeight + fCurrentGap;
stvDMA = new BStringView(BRect(r.left+20,r.top+fCurrentHeight,r.left+80,r.top+fCurrentHeight+20),"DMA","DMAs:");
fCurrentHeight = fCurrentHeight + fCurrentGap;
stvIORanges = new BStringView(BRect(r.left+20,r.top+fCurrentHeight,r.left+80,r.top+fCurrentHeight+20),"IORanges","IO Ranges:");
fCurrentHeight = fCurrentHeight + fCurrentGap;
stvMemoryRanges = new BStringView(BRect(r.left+20,r.top+fCurrentHeight,r.left+160,r.top+fCurrentHeight+20),"MemoryRanges","Memory Ranges:");
fCurrentHeight = fCurrentHeight + fCurrentGap;
// Create the OutlineView
BRect outlinerect(r.left+12,r.top+50,r.right-29,r.top+262);
BOutlineListView *outline;
BListItem *topmenu;
BListItem *submenu;
BScrollView *outlinesv;
outline = new BOutlineListView(outlinerect,"devices_list", B_SINGLE_SELECTION_LIST);
outline->AddItem(topmenu = new BStringItem("System Devices"));
outline->AddUnder(new BStringItem("<no devices>"), topmenu);
outline->AddUnder(new BStringItem("<no devices>"), topmenu);
outline->AddItem(topmenu = new BStringItem("ISA/Plug and Play Devices"));
outline->AddUnder(submenu = new BStringItem("<no devices>"), topmenu);
outline->AddItem(topmenu = new BStringItem("PCI Devices"));
outline->AddUnder(submenu = new BStringItem("<no devices>"), topmenu);
outline->AddItem(topmenu = new BStringItem("Jumpered Devices"));
outline->AddUnder(submenu = new BStringItem("<no devices>"), topmenu);
// Add ScrollView to Devices Window
outlinesv = new BScrollView("scroll_devices", outline, B_FOLLOW_LEFT|B_FOLLOW_TOP, 0, false, true, B_FANCY_BORDER);
// Setup the OutlineView
outline->AllAttached();
outlinesv->SetBorderHighlighted(true);
// Back and Fore ground Colours
outline->SetHighColor(0,0,0,0);
outline->SetLowColor(255,255,255,0);
// Font Settings
BFont OutlineFont;
OutlineFont.SetSpacing(B_CHAR_SPACING);
OutlineFont.SetSize(12);
outline->SetFont(&OutlineFont,B_FONT_SHEAR | B_FONT_SPACING);
// Create BBox (or Frame)
BBox *BottomFrame;
BRect BottomFrameRect(r.left+11,r.bottom-124,r.right-12,r.bottom-12);
BottomFrame = new BBox(BottomFrameRect, "BottomFrame", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW, B_FANCY_BORDER);
// Create BButton - Configure
BButton *btnConfigure;
BRect ConfigureButtonRect(r.left+298,r.bottom-44,r.right-23,r.bottom-20);
btnConfigure = new BButton(ConfigureButtonRect,"btnConfigure","Configure", new BMessage(BTN_CONFIGURE), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
btnConfigure->MakeDefault(true);
btnConfigure->SetEnabled(false);
// Create a basic View
AddChild(ptrDevicesView = new DevicesView(r));
// Add Child(ren)
ptrDevicesView->AddChild(menubar);
ptrDevicesView->AddChild(stvDeviceName);
ptrDevicesView->AddChild(stvCurrentState);
ptrDevicesView->AddChild(stvIRQ);
ptrDevicesView->AddChild(stvDMA);
ptrDevicesView->AddChild(stvIORanges);
ptrDevicesView->AddChild(stvMemoryRanges);
ptrDevicesView->AddChild(outlinesv);
ptrDevicesView->AddChild(btnConfigure);
ptrDevicesView->AddChild(BottomFrame);
}
// ---------------------------------------------------------------------------------------------------------- //