Files
haiku-beta6/src/apps/diskprobe/AttributeWindow.cpp
T
Axel Dörfler 7fff3ed096 Implemented R5 compatible settings.
The number base type (hex or decimal) and the window frame is already
correctly maintained (font size is only displayed, but not yet changed).
I don't know the meaning of the last 4 bytes in DiskProbe_data, but
it's probably not that bad.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6714 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-02-24 08:52:35 +00:00

63 lines
1.4 KiB
C++

/*
** Copyright 2004, Axel Dörfler, [email protected]. All rights reserved.
** Distributed under the terms of the OpenBeOS License.
*/
#include "AttributeWindow.h"
#include "ProbeView.h"
#include <MenuBar.h>
#include <MenuItem.h>
#include <stdio.h>
AttributeWindow::AttributeWindow(BRect rect, entry_ref *ref, const char *attribute,
const BMessage *settings)
: ProbeWindow(rect, ref),
fAttribute(strdup(attribute))
{
char buffer[256];
snprintf(buffer, sizeof(buffer), "%s: %s", ref->name, attribute);
SetTitle(buffer);
// add the menu
BMenuBar *menuBar = new BMenuBar(BRect(0, 0, 0, 0), NULL);
AddChild(menuBar);
BMenu *menu = new BMenu("Attribute");
// the ProbeView file menu items will be inserted here
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Close", new BMessage(B_CLOSE_REQUESTED), 'W', B_COMMAND_KEY));
menu->SetTargetForItems(this);
menuBar->AddItem(menu);
// add our interface widgets
BRect rect = Bounds();
rect.top = menuBar->Bounds().Height() + 1;
ProbeView *probeView = new ProbeView(rect, ref, attribute, settings);
probeView->AddFileMenuItems(menu, 0);
AddChild(probeView);
probeView->UpdateSizeLimits();
}
AttributeWindow::~AttributeWindow()
{
free(fAttribute);
}
bool
AttributeWindow::Contains(const entry_ref &ref, const char *attribute)
{
return ref == Ref() && attribute != NULL && !strcmp(attribute, fAttribute);
}