本文整理汇总了C++中BView::Name方法的典型用法代码示例。如果您正苦于以下问题:C++ BView::Name方法的具体用法?C++ BView::Name怎么用?C++ BView::Name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BView
的用法示例。
在下文中一共展示了BView::Name方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KeyFilter
filter_result
AutoTextControlFilter::Filter(BMessage* msg, BHandler** target)
{
int32 rawchar, mod;
msg->FindInt32("raw_char", &rawchar);
msg->FindInt32("modifiers", &mod);
BView* view = dynamic_cast<BView*>(*target);
if (view != NULL || view->Name() != NULL && strcmp("_input_", view->Name()))
return B_DISPATCH_MESSAGE;
AutoTextControl* text = dynamic_cast<AutoTextControl*>(view->Parent());
if (!text || text != fBox)
return B_DISPATCH_MESSAGE;
fCurrentMessage = msg;
filter_result result = KeyFilter(rawchar, mod);
fCurrentMessage = NULL;
if (fBox->fCharLimit && result == B_DISPATCH_MESSAGE) {
// See to it that we still allow shortcut keys
if (mod & B_COMMAND_KEY)
return B_DISPATCH_MESSAGE;
// We don't use strlen() because it is not UTF-8 aware, which can
// affect how many characters can be typed.
if (isprint(rawchar) &&
(uint32)BString(text->Text()).CountChars() == text->fCharLimit)
return B_SKIP_MESSAGE;
}
return result;
}
示例2: SelectionChanged
// Buttons are enabled or not depending on the selection in the list
// so each time you click in the list, this method is called to update the buttons
void NetListView::SelectionChanged(void)
{
int32 index = CurrentSelection();
BView *parent = Parent();
if (index >= 0) {
// There are 2 lists that are instances of this class, so we have to see in which list you are clicking
if (strcmp(parent->Name(),"Interfaces_Scroller") == 0) {
BButton *settings = dynamic_cast <BButton *> ((parent->Parent())->FindView("Settings"));
BButton *clear = dynamic_cast <BButton *> ((parent->Parent())->FindView("Clear"));
settings->SetEnabled(true);
clear->SetEnabled(true);
}
else if (strcmp(parent->Name(),"Configurations_Scroller") == 0) {
BButton *restore = dynamic_cast <BButton *> ((parent->Parent())->FindView("Restore"));
BButton *remove = dynamic_cast <BButton *> ((parent->Parent())->FindView("Delete"));
restore ->SetEnabled(true);
remove ->SetEnabled(true);
}
}
else {
// There are 2 lists that are instances of this class, so we have to see in which list you are clicking
if (strcmp(parent->Name(),"Interfaces_Scroller") == 0) {
BButton *settings=dynamic_cast <BButton *> ((parent->Parent())->FindView("Settings"));
BButton *clear=dynamic_cast <BButton *> ((parent->Parent())->FindView("Clear"));
settings->SetEnabled(false);
clear->SetEnabled(false);
}
else if (strcmp(parent->Name(),"Configurations_Scroller") == 0) {
BButton *restore=dynamic_cast <BButton *> ((parent->Parent())->FindView("Restore"));
BButton *remove=dynamic_cast <BButton *> ((parent->Parent())->FindView("Delete"));
restore->SetEnabled(false);
remove->SetEnabled(false);
}
}
}
示例3:
BView*
TReplicantTray::ViewAt(int32* index, int32* id, const char* name)
{
*index = -1;
*id = -1;
BView* view;
int32 count = fShelf->CountReplicants()-1;
for (int32 repIndex = count ; repIndex >= 0 ; repIndex--) {
fShelf->ReplicantAt(repIndex, &view, (uint32*)id);
if (view && view->Name() && strcmp(name, view->Name()) == 0) {
*index = repIndex;
return view;
}
}
return NULL;
}
示例4: HasAddonView
bool AppView::HasAddonView(const char *name)
{
int32 count = m_pick_list_view->CountViews();
for (; count > 0;) {
BView *v = m_pick_list_view->ViewAt(--count);
if (!strcmp(v->Name(), name))
return true;
}
return false;
}
示例5: ViewAt
status_t
TReplicantTray::ItemInfo(int32 id, const char** name)
{
if (id < 0)
return B_ERROR;
int32 index, temp;
BView* view = ViewAt(&index, &temp, id, false);
if (view) {
*name = view->Name();
return B_OK;
}
return B_ERROR;
}
示例6:
void
MixerView::ArrangeChildren()
{
BRect f1 = channelSelector->Frame();
for (short i=0; i<back->CountChildren(); i++) {
BView *v = back->ChildAt(i);
if (strcmp(v->Name(), "schedulable") == 0) {
v->MoveTo(f1.left,f1.bottom+1);
f1 = v->Frame();
}
}
lastPanelBottom = f1.bottom;
BRect f0 = back->Bounds();
float x = lastPanelBottom-(f0.bottom-f0.top);
if (x < 0)
x = 0;
verticalScroll->SetRange(0,x);
}
示例7: GetPreferredSize
void ArpConfigurePanel::GetPreferredSize(float* width, float* height)
{
float maxw=0, maxh=0;
size_t i;
// Get dimensions of all configuration views.
for( i=0; i<mConfigViews->size(); i++ ) {
BView* view = 0;
if( (view=mConfigViews->at(i)) != 0 ) {
ArpD(cdb << ADH << "Processing dimens for view #" << i
<< ", name="
<< view->Name() << endl);
float vwidth=0, vheight=0;
// If this view is not attached to the window (i.e., it
// is not currently displayed by the tab view), then it
// may not be able to report correct dimensions. To fix
// this, we temporarily add it to your view.
if( !view->Window() ) {
ArpD(cdb << ADH << "Temporarily attaching view to window."
<< endl);
bool hidden = view->IsHidden();
view->Hide();
AddChild(view);
view->GetPreferredSize(&vwidth, &vheight);
RemoveChild(view);
if( !hidden ) view->Show();
} else {
view->GetPreferredSize(&vwidth, &vheight);
}
ArpD(cdb << ADH << "Preferred width=" << vwidth
<< ", height=" << vheight << endl);
if( vwidth > maxw ) maxw = vwidth;
if( vheight > maxh ) maxh = vheight;
}
}
ArpD(cdb << ADH << "Final size=(" << (maxw+mTabWidth)
<< ", " << (maxh+mTabHeight) << ")" << endl);
if( width ) *width = maxw + mTabWidth + 2;
if( height ) *height = maxh + mTabHeight + 2;
}
示例8: oMessenger
void
BF_GUI_SetupDialog::MessageReceived(BMessage* po_Message)
{
switch(po_Message->what){
case BF_MSG_MAINVIEW_MAINSETUP_STYLES_UPDATED:{
EnableDialog(true);
poMenu->MakeFocus();
//
int32 iMenuRes=-1;
if(B_OK==po_Message->FindInt32("menu",&iMenuRes)) oSetup.SetMainStyle(iSetupMainStyle);
//
break;}
case BF_MSG_MAINVIEW_MAINSETUP_0:{
EnableDialog(true);
poMenu->MakeFocus();
break;}
case BF_MSG_DIALOG_PRESSED_OK:{
BView *po;
const char *pc;
ASSERT(B_OK==po_Message->FindPointer("bf_DlgView_Focus",(void**)&po),"BF_GUI_SetupDialog::MessageReceived");
pc = po->Name();
if(strcmp(pc,"main_menu")==0){
InvokeMenu(-1,poMenu->iNavCursorIndex);
}else{
//
poSysSetup->UpdateFrom(oSetup);
if(poSysSetup->MainStyle() & BF_SETUP_AUTOSAVE) poSysSetup->Save();
//
BF_GUI_Dialog::MessageReceived(po_Message);
//
BMessenger oMessenger(poWin);
BMessage oMessage(BF_MSG_SETUP_UPDATED);
oMessenger.SendMessage(&oMessage);
}
break;}
default:
BF_GUI_Dialog::MessageReceived(po_Message);
};
}
示例9: cdactivate
static int cdactivate(cdCtxCanvas *ctxcanvas)
{
BView* view = ctxcanvas->view;
BLooper* looper = view->Looper();
const char* ln = "";
if (looper != NULL) {
ln = looper->Name();
}
printf("CD Activate view %p (%s), looper is %s\n", view, view->Name(), ln);
BRect rect = view->Bounds();
ctxcanvas->canvas->w = (int)(rect.Width());
ctxcanvas->canvas->h = (int)(rect.Height());
ctxcanvas->canvas->w_mm = ((double)ctxcanvas->canvas->w) / ctxcanvas->canvas->xres;
ctxcanvas->canvas->h_mm = ((double)ctxcanvas->canvas->h) / ctxcanvas->canvas->yres;
if (ctxcanvas->canvas->use_matrix)
ctxcanvas->canvas->cxTransform(ctxcanvas, ctxcanvas->canvas->matrix);
return CD_OK;
}
示例10: node
/*! The add-ons must support the exported C function API
if they do, they will be loaded and added to deskbar
primary function is the Instantiate function
*/
status_t
TReplicantTray::LoadAddOn(BEntry* entry, int32* id, bool addToSettings)
{
if (!entry)
return B_ERROR;
node_ref nodeRef;
entry->GetNodeRef(&nodeRef);
// no duplicates
if (NodeExists(nodeRef))
return B_ERROR;
BNode node(entry);
BPath path;
status_t status = entry->GetPath(&path);
if (status < B_OK)
return status;
// load the add-on
image_id image = load_add_on(path.Path());
if (image < B_OK)
return image;
// get the view loading function symbol
// we first look for a symbol that takes an image_id
// and entry_ref pointer, if not found, go with normal
// instantiate function
BView* (*entryFunction)(image_id, const entry_ref*);
BView* (*itemFunction)(void);
BView* view = NULL;
entry_ref ref;
entry->GetRef(&ref);
if (get_image_symbol(image, kInstantiateEntryCFunctionName,
B_SYMBOL_TYPE_TEXT, (void**)&entryFunction) >= B_OK) {
view = (*entryFunction)(image, &ref);
} else if (get_image_symbol(image, kInstantiateItemCFunctionName,
B_SYMBOL_TYPE_TEXT, (void**)&itemFunction) >= B_OK) {
view = (*itemFunction)();
} else {
unload_add_on(image);
return B_ERROR;
}
if (view == NULL || IconExists(view->Name())) {
delete view;
unload_add_on(image);
return B_ERROR;
}
BMessage* data = new BMessage;
view->Archive(data);
delete view;
AddIcon(data, id, &ref);
// add the rep; adds info to list
if (addToSettings) {
fAddOnSettings.AddString(kReplicantPathField, path.Path());
_SaveSettings();
}
return B_OK;
}
示例11: DynamicScrollView
BView *
DefaultMediaTheme::MakeViewFor(BParameterWeb *web, const BRect *hintRect)
{
CALLED();
if (web == NULL)
return NULL;
BRect rect;
if (hintRect)
rect = *hintRect;
BRect bestRect;
// do we have more than one attached parameter group?
// if so, use a tabbed view with a tab for each group
TabView *tabView = NULL;
if (web->CountGroups() > 1)
tabView = new TabView(rect, "web");
rect.OffsetTo(B_ORIGIN);
for (int32 i = 0; i < web->CountGroups(); i++) {
BParameterGroup *group = web->GroupAt(i);
if (group == NULL)
continue;
BView *groupView = MakeViewFor(*group, hintRect ? &rect : NULL);
if (groupView == NULL)
continue;
if (GroupView *view = dynamic_cast<GroupView *>(groupView)) {
// the top-level group views must not be larger than their hintRect,
// but unlike their children, they should follow all sides when
// their parent is resized
if (hintRect != NULL)
view->ResizeTo(rect.Width() - 10, rect.Height() - 10);
view->SetResizingMode(B_FOLLOW_ALL);
}
if (tabView == NULL) {
// if we don't need a container to put that view into,
// we're done here (but the groupView may span over the
// whole hintRect)
if (groupView->Frame().LeftTop() == BPoint(5, 5)) {
// remove insets, as they are not needed
groupView->MoveBy(-5, -5);
groupView->ResizeBy(10, 10);
}
return new DynamicScrollView(groupView->Name(), groupView);
}
DynamicScrollView *scrollView = new DynamicScrollView(groupView->Name(), groupView);
tabView->AddTab(scrollView);
if (!hintRect) {
bestRect = bestRect | scrollView->Bounds();
}
}
if (tabView != NULL) {
// this adjustment must be kept in sync with TabView::FrameResized
bestRect.bottom += tabView->TabHeight();
bestRect.InsetBy(-3.0,-3.0);
tabView->ResizeTo(bestRect.Width(), bestRect.Height());
tabView->FrameResized(bestRect.Width(), bestRect.Height());
//needed since we're not attached to a window yet
}
return tabView;
}
示例12: fnr
PrefsWindow::PrefsWindow(uint32 msg) : BWindow(BRect(0, 0, 400, 289), GetString(STR_PREFS_TITLE), B_TITLED_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS), this_messenger(this)
{
int i;
ok_message = msg;
send_quit_on_close = true;
get_system_info(&sys_info);
// Move window to right position
Lock();
MoveTo(80, 80);
// Set up menus
BMenuBar *bar = new BMenuBar(Bounds(), "menu");
BMenu *menu = new BMenu(GetString(STR_PREFS_MENU));
menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_ABOUT), new BMessage(B_ABOUT_REQUESTED)));
menu->AddItem(new BSeparatorItem);
menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_START), new BMessage(MSG_OK)));
menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_ZAP_PRAM), new BMessage(MSG_ZAP_PRAM)));
menu->AddItem(new BSeparatorItem);
menu->AddItem(new BMenuItem(GetString(STR_PREFS_ITEM_QUIT), new BMessage(MSG_CANCEL), 'Q'));
bar->AddItem(menu);
AddChild(bar);
SetKeyMenuBar(bar);
int mbar_height = int(bar->Bounds().bottom) + 1;
// Resize window to fit menu bar
ResizeBy(0, mbar_height);
// Light gray background
BRect b = Bounds();
top = new BView(BRect(0, mbar_height, b.right, b.bottom), "top", B_FOLLOW_NONE, B_WILL_DRAW);
AddChild(top);
top->SetViewColor(fill_color);
top_frame = top->Bounds();
// Create panes
panes[0] = create_volumes_pane();
panes[1] = create_graphics_pane();
panes[2] = create_serial_pane();
panes[3] = create_memory_pane();
// Prefs item tab view
pane_tabs = new BTabView(BRect(10, 10, top_frame.right-10, top_frame.bottom-50), "items", B_WIDTH_FROM_LABEL);
for (i=0; i<NUM_PANES; i++)
pane_tabs->AddTab(panes[i]);
top->AddChild(pane_tabs);
volume_list->Select(0);
// Create volume file panels
add_volume_panel = new BFilePanel(B_OPEN_PANEL, &this_messenger, NULL, B_FILE_NODE | B_DIRECTORY_NODE, false, new BMessage(MSG_ADD_VOLUME_PANEL));
add_volume_panel->SetButtonLabel(B_DEFAULT_BUTTON, GetString(STR_ADD_VOLUME_PANEL_BUTTON));
add_volume_panel->Window()->SetTitle(GetString(STR_ADD_VOLUME_TITLE));
create_volume_panel = new BFilePanel(B_SAVE_PANEL, &this_messenger, NULL, B_FILE_NODE | B_DIRECTORY_NODE, false, new BMessage(MSG_CREATE_VOLUME_PANEL));
create_volume_panel->SetButtonLabel(B_DEFAULT_BUTTON, GetString(STR_CREATE_VOLUME_PANEL_BUTTON));
create_volume_panel->Window()->SetTitle(GetString(STR_CREATE_VOLUME_TITLE));
create_volume_panel->Window()->Lock();
BView *background = create_volume_panel->Window()->ChildAt(0);
background->FindView("PoseView")->ResizeBy(0, -30);
background->FindView("VScrollBar")->ResizeBy(0, -30);
background->FindView("CountVw")->MoveBy(0, -30);
BView *v = background->FindView("HScrollBar");
if (v)
v->MoveBy(0, -30);
else {
i = 0;
while ((v = background->ChildAt(i++)) != NULL) {
if (v->Name() == NULL || v->Name()[0] == 0) {
v->MoveBy(0, -30); // unnamed horizontal scroll bar
break;
}
}
}
BView *filename = background->FindView("text view");
BRect fnr(filename->Frame());
fnr.OffsetBy(0, -30);
NumberControl *nc = new NumberControl(fnr, 80, "hardfile_size", GetString(STR_HARDFILE_SIZE_CTRL), 40, NULL);
background->AddChild(nc);
create_volume_panel->Window()->Unlock();
// "Start" button
BButton *button = new BButton(BRect(20, top_frame.bottom-35, 90, top_frame.bottom-10), "start", GetString(STR_START_BUTTON), new BMessage(MSG_OK));
top->AddChild(button);
SetDefaultButton(button);
// "Quit" button
top->AddChild(new BButton(BRect(top_frame.right-90, top_frame.bottom-35, top_frame.right-20, top_frame.bottom-10), "cancel", GetString(STR_QUIT_BUTTON), new BMessage(MSG_CANCEL)));
Unlock();
Show();
}