本文整理汇总了C++中BTab类的典型用法代码示例。如果您正苦于以下问题:C++ BTab类的具体用法?C++ BTab怎么用?C++ BTab使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BTab类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InterfaceHardwareView
status_t
InterfaceWindow::_PopulateTabs()
{
BRect frame = fTabView->Bounds();
protocols* supportedFamilies = fNetworkSettings->ProtocolVersions();
BTab* hardwareTab = new BTab;
fTabHardwareView = new InterfaceHardwareView(frame,
fNetworkSettings);
fTabView->AddTab(fTabHardwareView, hardwareTab);
hardwareTab->SetLabel(B_TRANSLATE("Interface"));
for (int index = 0; index < MAX_PROTOCOLS; index++) {
if (supportedFamilies[index].present) {
int inet_id = supportedFamilies[index].inet_id;
fTabIPView[inet_id] = new InterfaceAddressView(frame,
inet_id, fNetworkSettings);
BTab* tab = new BTab;
fTabView->AddTab(fTabIPView[inet_id], tab);
tab->SetLabel(supportedFamilies[index].name);
}
}
return B_OK;
}
示例2: BView
InTextView::InTextView(BRect rect, char *name)
: BView(rect, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS |B_SUBPIXEL_PRECISE)
{
BRect r;
BTabView *tabView;
BTab *tab;
TOCView *tocView;
r = Bounds();
//r.InsetBy(5,5);
tabView = new BTabView(r, "tab_view");
tabView->SetViewColor(216,216,216,0);
r = tabView->Bounds();
r.InsetBy(5,5);
r.bottom -= tabView->TabHeight();
tab = new BTab();
tocView = new TOCView(r, "TOC_View");
tabView->AddTab(tocView, tab);
tab->SetLabel("Table of Contents");
tab = new BTab();
unitView = new UnitView(r,"Unit_View");
tabView->AddTab(unitView, tab);
tab->SetLabel("Lesson");
AddChild(tabView);
}
示例3: archiver
status_t
BTabView::Archive(BMessage* archive, bool deep) const
{
BArchiver archiver(archive);
status_t ret = BView::Archive(archive, deep);
if (ret == B_OK)
ret = archive->AddInt16("_but_width", fTabWidthSetting);
if (ret == B_OK)
ret = archive->AddFloat("_high", fTabHeight);
if (ret == B_OK)
ret = archive->AddInt32("_sel", fSelection);
if (ret == B_OK && fBorderStyle != B_FANCY_BORDER)
ret = archive->AddInt32("_border_style", fBorderStyle);
if (ret == B_OK && deep) {
for (int32 i = 0; i < CountTabs(); i++) {
BTab* tab = TabAt(i);
if ((ret = archiver.AddArchivable("_l_items", tab, deep)) != B_OK)
break;
ret = archiver.AddArchivable("_view_list", tab->View(), deep);
}
}
return archiver.Finish(ret);
}
示例4:
BTab *
BTabView::RemoveTab(int32 index)
{
if (index < 0 || index >= CountTabs())
return NULL;
BTab *tab = (BTab *)fTabList->RemoveItem(index);
if (tab == NULL)
return NULL;
tab->Deselect();
if (fContainerView->GetLayout())
fContainerView->GetLayout()->RemoveItem(index);
if (index <= fSelection && fSelection != 0)
fSelection--;
if (CountTabs() == 0)
fFocus = -1;
else
Select(fSelection);
if (fFocus == CountTabs() - 1 || CountTabs() == 0)
SetFocusTab(fFocus, false);
else
SetFocusTab(fFocus, true);
return tab;
}
示例5: ChildAt
status_t
BTabView::AllUnarchived(const BMessage* archive)
{
status_t err = BView::AllUnarchived(archive);
if (err != B_OK)
return err;
fContainerView = ChildAt(0);
_InitContainerView(Flags() & B_SUPPORTS_LAYOUT);
BUnarchiver unarchiver(archive);
int32 tabCount;
archive->GetInfo("_l_items", NULL, &tabCount);
for (int32 i = 0; i < tabCount && err == B_OK; i++) {
BTab* tab;
err = unarchiver.FindObject("_l_items", i, tab);
if (err == B_OK && tab) {
BView* view;
if ((err = unarchiver.FindObject("_view_list", i,
BUnarchiver::B_DONT_ASSUME_OWNERSHIP, view)) != B_OK)
break;
tab->SetView(view);
fTabList->AddItem(tab);
}
}
if (err == B_OK)
Select(fSelection);
return err;
}
示例6: TabAt
BView *
BTabView::ViewForTab(int32 tabIndex) const
{
BTab *tab = TabAt(tabIndex);
if (tab)
return tab->View();
return NULL;
}
示例7: haikuTabsSetTabTitleAttrib
static int haikuTabsSetTabTitleAttrib(Ihandle* ih, int pos, const char* value)
{
if (value)
{
BTabView* tv = (BTabView*)ih->handle;
BTab* tab = tv->TabAt(pos);
tab->SetLabel(value);
}
return 1;
}
示例8: SetPulseRate
void
TTimeWindow::_InitWindow()
{
SetPulseRate(500000);
fDateTimeView = new DateTimeView(Bounds());
BRect bounds = fDateTimeView->Bounds();
fTimeZoneView = new TimeZoneView(bounds);
fBaseView = new TTimeBaseView(bounds, "baseView");
AddChild(fBaseView);
fBaseView->StartWatchingAll(fDateTimeView);
fBaseView->StartWatchingAll(fTimeZoneView);
bounds.OffsetBy(10.0, 10.0);
BTabView *tabView = new BTabView(bounds.InsetByCopy(-5.0, -5.0),
"tabView" , B_WIDTH_AS_USUAL, B_FOLLOW_NONE);
BTab *tab = new BTab();
tabView->AddTab(fDateTimeView, tab);
tab->SetLabel("Date & Time");
tab = new BTab();
tabView->AddTab(fTimeZoneView, tab);
tab->SetLabel("Time zone");
fBaseView->AddChild(tabView);
tabView->ResizeBy(0.0, tabView->TabHeight());
BRect rect = Bounds();
rect.left = 10;
rect.top = rect.bottom - 10;
fRevertButton = new BButton(rect, "revert", "Revert",
new BMessage(kMsgRevert), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW);
fRevertButton->ResizeToPreferred();
fRevertButton->SetEnabled(false);
float buttonHeight = fRevertButton->Bounds().Height();
fRevertButton->MoveBy(0, -buttonHeight);
fBaseView->AddChild(fRevertButton);
fRevertButton->SetTarget(this);
fBaseView->ResizeTo(tabView->Bounds().Width() + 10.0,
tabView->Bounds().Height() + buttonHeight + 30.0);
ResizeTo(fBaseView->Bounds().Width(), fBaseView->Bounds().Height());
}
示例9: BWindow
/*
* BLSettingsWindow(BRect frame);
*
* The constructor of the window adds the child to the view chain
*/
BLSettingsWindow::BLSettingsWindow(BRect frame, BLSettings* bls)
: BWindow(frame, SETTINGS_TITLE_WINDOW, B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE), Settings(bls)
{
/* Offset to windows coordinates*/
frame.OffsetTo(B_ORIGIN);
BTab* tab;
/* Create the background box (grey) */
Box = new BBox(frame, "Background", B_FOLLOW_ALL_SIDES, B_PLAIN_BORDER);
AddChild(Box);
/* Create our rect and inset it by 5 px */
BRect r = Bounds();
r.InsetBy(5, 5);
/* Create a TabView, and set its color. Then add it to the Box's Hierachy */
TabView = new BTabView(r, "tabview");
TabView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
Box->AddChild(TabView);
/* Calc the size of the views and inset by 5 px*/
r = TabView->Bounds();
r.InsetBy(5, 5);
r.bottom -= TabView->TabHeight();
/* Create the users tab */
tab = new BTab();
UserView = new BLSettingsUserView(r, Settings);
TabView->AddTab(UserView, tab);
tab->SetLabel("Users");
/* Create the Blocked tab */
tab = new BTab();
BlockedView = new BLSettingsBlockedView(r, Settings);
TabView->AddTab(BlockedView, tab);
tab->SetLabel("Blocked");
/* Create the Runnable tab */
tab = new BTab();
RunnableView = new BLSettingsRunnableView(r, Settings);
TabView->AddTab(RunnableView, tab);
tab->SetLabel("Runnable");
/* Select the first one (users) */
TabView->Select(0);
/* Add some shortcuts */
AddShortcut('A', B_COMMAND_KEY, new BMessage(B_ABOUT_REQUESTED));
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
AddShortcut('Q', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
}
示例10: rect
BBox*
DocInfoWindow::_CreateTabPanel(BTabView* tabView, const char* label)
{
BRect rect(tabView->Bounds().InsetByCopy(3.0, 15.0));
rect.OffsetTo(B_ORIGIN);
BBox* panel = new BBox(rect, "top_panel", B_FOLLOW_ALL,
B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_NO_BORDER);
BTab* tab = new BTab();
tabView->AddTab(panel, tab);
tab->SetLabel(label);
return panel;
}
示例11: TabAt
void ArpConfigurePanel::Select(int32 tab)
{
inherited::Select(tab);
if( Parent() ) {
BTab* tabobj = TabAt(tab);
if( tabobj ) {
BView* view = tabobj->View();
BRect frame(Frame());
if( view ) {
view->ResizeTo(frame.Width()-mTabWidth,
frame.Height()-mTabHeight);
}
}
SendSetPanel(tab);
}
}
示例12: BTab
void TVideoSettingsTabView::Init()
{
BMessage *theMessage = NULL;
//
// Create all the tab views
//
// Get VideoCompressionView from resource
BTab *compressionTab = new BTab();
theMessage = GetWindowFromResource("VideoCompressionView");
ASSERT(theMessage);
m_CompressionView = new TVideoCompressionView(this, theMessage);
AddTab(m_CompressionView, compressionTab);
compressionTab->SetLabel("Compression");
// Get VideoImageView from resource
BTab *imageTab = new BTab();
theMessage = GetWindowFromResource("VideoImageView");
ASSERT(theMessage);
m_ImageView = new TVideoImageView(this, theMessage);
AddTab(m_ImageView, imageTab);
imageTab->SetLabel("Image");
// Get VideoImageSource from resource
BTab *sourceTab = new BTab();
theMessage = GetWindowFromResource("VideoSourceView");
ASSERT(theMessage);
m_SourceView = new TVideoSourceView(this, theMessage);
AddTab(m_SourceView, sourceTab);
sourceTab->SetLabel("Source");
}
示例13: BTabView
PrefletView::PrefletView(SettingsHost* host)
:
BTabView("pages")
{
// Pages
GeneralView* general = new GeneralView(host);
DisplayView* display = new DisplayView(host);
NotificationsView* apps = new NotificationsView(host);
// Page selector
BTab* tab = new BTab();
AddTab(general, tab);
tab->SetLabel(B_TRANSLATE("General"));
tab = new BTab();
AddTab(display, tab);
tab->SetLabel(B_TRANSLATE("Display"));
tab = new BTab();
AddTab(apps, tab);
tab->SetLabel(B_TRANSLATE("Notifications"));
}
示例14: Selection
void
BTabView::Select(int32 index)
{
if (index < 0 || index >= CountTabs())
index = Selection();
BTab *tab = TabAt(Selection());
if (tab)
tab->Deselect();
tab = TabAt(index);
if (tab && ContainerView()) {
if (index == 0)
fTabOffset = 0.0f;
tab->Select(ContainerView());
fSelection = index;
// make the view visible through the layout if there is one
BCardLayout* layout
= dynamic_cast<BCardLayout*>(fContainerView->GetLayout());
if (layout)
layout->SetVisibleItem(index);
}
Invalidate();
if (index != 0 && !Bounds().Contains(TabFrame(index))){
if (!Bounds().Contains(TabFrame(index).LeftTop()))
fTabOffset += TabFrame(index).left - Bounds().left - 20.0f;
else
fTabOffset += TabFrame(index).right - Bounds().right + 20.0f;
Invalidate();
}
SetFocusTab(index, true);
}
示例15: Bounds
// ResourceUsageWindow::InitWindow -- Initialization Commands here
void ResourceUsageWindow::InitWindow(BList &list)
{
BRect rtab = Bounds();
BRect rlist = Bounds();
rtab.top += 10;
rlist.top += 10;
rlist.left += 12;
rlist.right -= 15 + B_V_SCROLL_BAR_WIDTH;
rlist.bottom -= 47;
// Create the TabView and Tabs
BTabView *tabView = new BTabView(rtab,"resource_usage_tabview");
tabView->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
rtab = tabView->Bounds();
rtab.InsetBy(5,5);
// Create the ListViews
BListView *IRQListView = new BListView(rlist, "IRQListView",
B_SINGLE_SELECTION_LIST, B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW | B_NAVIGABLE);
BListView *DMAListView = new BListView(rlist, "DMAListView",
B_SINGLE_SELECTION_LIST, B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW | B_NAVIGABLE);
BListView *IORangeListView = new BListView(rlist, "IORangeListView",
B_SINGLE_SELECTION_LIST, B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW | B_NAVIGABLE);
BListView *memoryListView = new BListView(rlist, "memoryListView",
B_SINGLE_SELECTION_LIST, B_FOLLOW_LEFT | B_FOLLOW_TOP,
B_WILL_DRAW | B_NAVIGABLE);
BScrollView *IRQScrollView = new BScrollView("scroll_list1", IRQListView,
B_FOLLOW_LEFT|B_FOLLOW_TOP, 0, false, true, B_FANCY_BORDER);
BScrollView *DMAScrollView = new BScrollView("scroll_list2", DMAListView,
B_FOLLOW_LEFT|B_FOLLOW_TOP, 0, false, true, B_FANCY_BORDER);
BScrollView *IORangeScrollView = new BScrollView("scroll_list3",
IORangeListView, B_FOLLOW_LEFT|B_FOLLOW_TOP, 0, false, true,
B_FANCY_BORDER);
BScrollView *memoryScrollView = new BScrollView("scroll_list4",
memoryListView, B_FOLLOW_LEFT|B_FOLLOW_TOP, 0, false, true,
B_FANCY_BORDER);
BTab *tab = new BTab();
tabView->AddTab(IRQScrollView, tab);
tab->SetLabel(B_TRANSLATE("IRQ"));
tab = new BTab();
tabView->AddTab(DMAScrollView, tab);
tab->SetLabel(B_TRANSLATE("DMA"));
tab = new BTab();
tabView->AddTab(IORangeScrollView, tab);
tab->SetLabel(B_TRANSLATE("IO Range"));
tab = new BTab();
tabView->AddTab(memoryScrollView, tab);
tab->SetLabel(B_TRANSLATE("Memory Range"));
{
uint32 mask = 1;
for (int i=0;i<16;mask<<=1,i++) {
bool first = true;
for (int32 j=0; j<list.CountItems(); j++) {
DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j);
struct device_configuration *current = deviceInfo->GetCurrent();
resource_descriptor r;
int32 num = count_resource_descriptors_of_type(current,
B_IRQ_RESOURCE);
for (int32 k=0;k<num;k++) {
get_nth_resource_descriptor_of_type(current, k, B_IRQ_RESOURCE,
&r, sizeof(resource_descriptor));
if (mask & r.d.m.mask) {
IRQListView->AddItem(new IRQDMAItem(first ? i : -1,
deviceInfo->GetCardName()));
first = false;
}
}
}
if (first) {
IRQListView->AddItem(new IRQDMAItem(i, ""));
}
}
}
{
uint32 mask = 1;
for (int i=0;i<8;mask<<=1,i++) {
bool first = true;
for (int32 j=0; j<list.CountItems(); j++) {
DevicesInfo *deviceInfo = (DevicesInfo *)list.ItemAt(j);
struct device_configuration *current = deviceInfo->GetCurrent();
resource_descriptor r;
int32 num = count_resource_descriptors_of_type(current,
//.........这里部分代码省略.........