这篇教程C++ AddChild函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中AddChild函数的典型用法代码示例。如果您正苦于以下问题:C++ AddChild函数的具体用法?C++ AddChild怎么用?C++ AddChild使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了AddChild函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: r/** * _ConstructGUI() * * Creates the GUI for the View. MUST be called AFTER the View is attached to * the Window, or will crash and/or create strange behaviour * * @param none * @return void */voidMarginView::_ConstructGUI(){ BString str; // Create text fields BRect r(Frame().Width() - be_plain_font->StringWidth("Top#") - kWidth, kOffsetY, Frame().Width() - kOffsetX, kWidth); // top str << fMargins.top/fUnitValue; fTop = new BTextControl( r, "top", "Top:", str.String(), NULL, B_FOLLOW_RIGHT); fTop->SetModificationMessage(new BMessage(TOP_MARGIN_CHANGED)); fTop->SetDivider(be_plain_font->StringWidth("Top#")); fTop->SetTarget(this); _AllowOnlyNumbers(fTop, kNumCount); AddChild(fTop); //left r.OffsetBy(0, kOffsetY); r.left = Frame().Width() - be_plain_font->StringWidth("Left#") - kWidth; str = ""; str << fMargins.left/fUnitValue; fLeft = new BTextControl( r, "left", "Left:", str.String(), NULL, B_FOLLOW_RIGHT); fLeft->SetModificationMessage(new BMessage(LEFT_MARGIN_CHANGED)); fLeft->SetDivider(be_plain_font->StringWidth("Left#")); fLeft->SetTarget(this); _AllowOnlyNumbers(fLeft, kNumCount); AddChild(fLeft); //bottom r.OffsetBy(0, kOffsetY); r.left = Frame().Width() - be_plain_font->StringWidth("Bottom#") - kWidth; str = ""; str << fMargins.bottom/fUnitValue; fBottom = new BTextControl( r, "bottom", "Bottom:", str.String(), NULL, B_FOLLOW_RIGHT); fBottom->SetModificationMessage(new BMessage(BOTTOM_MARGIN_CHANGED)); fBottom->SetDivider(be_plain_font->StringWidth("Bottom#")); fBottom->SetTarget(this); _AllowOnlyNumbers(fBottom, kNumCount); AddChild(fBottom); //right r.OffsetBy(0, kOffsetY); r.left = Frame().Width() - be_plain_font->StringWidth("Right#") - kWidth; str = ""; str << fMargins.right/fUnitValue; fRight = new BTextControl( r, "right", "Right:", str.String(), NULL, B_FOLLOW_RIGHT); fRight->SetModificationMessage(new BMessage(RIGHT_MARGIN_CHANGED)); fRight->SetDivider(be_plain_font->StringWidth("Right#")); fRight->SetTarget(this); _AllowOnlyNumbers(fRight, kNumCount); AddChild(fRight);// Create Units popup r.OffsetBy(-kOffsetX, kOffsetY); r.right += kOffsetY; BPopUpMenu *menu = new BPopUpMenu("units"); BMenuField *mf = new BMenuField(r, "units", "Units", menu, B_FOLLOW_BOTTOM | B_FOLLOW_RIGHT); mf->ResizeToPreferred(); mf->SetDivider(be_plain_font->StringWidth("Units#")); BMenuItem *item; // Construct menu items for (int32 i = 0; kUnitNames[i] != NULL; i++) { BMessage *msg = new BMessage(MARGIN_UNIT_CHANGED); msg->AddInt32("marginUnit", kUnitMsg[i]); menu->AddItem(item = new BMenuItem(kUnitNames[i], msg)); item->SetTarget(this); if (fMarginUnit == kUnitMsg[i])//.........这里部分代码省略.........
开发者ID:mariuz,项目名称:haiku,代码行数:101,
示例2: AddChildvoid Node::AddChild(Node* const child, int zOrder){ AddChild(child); child->SetZorder(zOrder);}
开发者ID:YangJinwoo,项目名称:Fortress,代码行数:5,
示例3: BWindowSettingsWindow::SettingsWindow(BRect frame): BWindow(frame, "Settings", B_FLOATING_WINDOW_LOOK,B_FLOATING_SUBSET_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS|B_NOT_ZOOMABLE|B_NOT_RESIZABLE){ view = new BView(Bounds(), "Settings View", B_FOLLOW_ALL_SIDES, B_WILL_DRAW); BRect the_rect = Bounds(); the_rect.InsetBy(5.0f, 5.0f); float rectHOffset = frame.Width() / 2.0f - 2.0f; float rectVOffset = 18.0f; char buffer[10]; the_rect.right = the_rect.left + rectHOffset; the_rect.bottom = the_rect.top + rectVOffset; gState->Register(this); if (gState->LockAsReader()) { sprintf(buffer,FLOAT_FORMAT, ixMin); XMinBox = new BTextControl( the_rect, "xMin", "x-Min", buffer, new BMessage(XMIN_CHG)); XMinBox->SetTarget(this); XMinBox->SetDivider(30); view->AddChild(XMinBox); the_rect.OffsetBy(rectHOffset + 4,0); sprintf(buffer,FLOAT_FORMAT, ixMax); XMaxBox = new BTextControl( the_rect, "xMax", "x-Max", buffer, new BMessage(XMAX_CHG)); XMaxBox->SetTarget(this); XMaxBox->SetDivider(30); view->AddChild(XMaxBox); the_rect.OffsetBy(-(rectHOffset + 4.0f), XMinBox->Bounds().Height() + 4.0f); sprintf(buffer,FLOAT_FORMAT, iyMin); YMinBox = new BTextControl( the_rect, "yMin", "y-Min", buffer, new BMessage(YMIN_CHG)); YMinBox->SetTarget(this); YMinBox->SetDivider(30); view->AddChild(YMinBox); the_rect.OffsetBy(rectHOffset + 4.0f, 0.0f); sprintf(buffer,FLOAT_FORMAT, iyMax); YMaxBox = new BTextControl( the_rect, "yMax", "y-Max", buffer, new BMessage(YMAX_CHG)); YMaxBox->SetTarget(this); YMaxBox->SetDivider(30); view->AddChild(YMaxBox); the_rect.OffsetBy(-(rectHOffset + 4.0f), YMaxBox->Bounds().Height()+4.0f); sprintf(buffer,FLOAT_FORMAT, gState->TellxStep()); XStepBox = new BTextControl(the_rect,"x step", "x step", buffer, new BMessage(XSTEP_CHG)); XStepBox->SetDivider(35); XStepBox->SetTarget(this);// XStepBox->ResizeToPreferred(); view->AddChild(XStepBox); the_rect.OffsetBy(rectHOffset +4.0f,0.0f); sprintf(buffer,FLOAT_FORMAT, gState->TellyStep()); YStepBox = new BTextControl(the_rect,"y step", "y step", buffer, new BMessage(YSTEP_CHG)); YStepBox->SetDivider(35); YStepBox->SetTarget(this);// YStepBox->ResizeToPreferred(); view->AddChild(YStepBox); the_rect.OffsetBy(-(rectHOffset+4.0f),XStepBox->Bounds().Height()+4.0f); sprintf(buffer,FLOAT_FORMAT, gState->TellThetaStep()); ThetaStepBox = new BTextControl(the_rect,"theta step", "theta step", buffer, new BMessage(THETA_STEP_CHG)); ThetaStepBox->SetDivider(50); ThetaStepBox->SetTarget(this);// ThetaStepBox->ResizeToPreferred(); view->AddChild(ThetaStepBox); the_rect.OffsetBy(0,ThetaStepBox->Bounds().Height()+4.0f); sprintf(buffer,FLOAT_FORMAT, gState->TellThetaStart()); ThetaStartBox = new BTextControl(the_rect,"theta start", "theta start", buffer, new BMessage(THETA_START_CHG)); ThetaStartBox->SetDivider(53); ThetaStartBox->SetTarget(this);// ThetaStartBox->ResizeToPreferred(); view->AddChild(ThetaStartBox); the_rect.OffsetBy(rectHOffset+4.0f,0.0f); sprintf(buffer,FLOAT_FORMAT, gState->TellThetaStop()); ThetaStopBox = new BTextControl(the_rect,"theta stop", "theta stop", buffer, new BMessage(THETA_STOP_CHG)); ThetaStopBox->SetDivider(50); ThetaStopBox->SetTarget(this);// ThetaStopBox->ResizeToPreferred(); view->AddChild(ThetaStopBox); the_rect.OffsetBy(-(rectHOffset+4.0f),ThetaStartBox->Bounds().Height()+4.0f); sprintf(buffer,FLOAT_FORMAT, gState->TellTStep()); TStepBox = new BTextControl(the_rect,"t step", "t step", buffer, new BMessage(T_STEP_CHG)); TStepBox->SetDivider(35); TStepBox->SetTarget(this);// TStepBox->ResizeToPreferred(); view->AddChild(TStepBox); the_rect.OffsetBy(0,TStepBox->Bounds().Height()+4.0f); sprintf(buffer,FLOAT_FORMAT, gState->TellTStart()); TStartBox = new BTextControl(the_rect,"t start", "t start", buffer, new BMessage(T_START_CHG)); TStartBox->SetDivider(35); TStartBox->SetTarget(this);// TStartBox->ResizeToPreferred();//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:Graph,代码行数:101,
示例4: rectvoidRowSummaryView::AllAttached(){ //Bitmaps used to hold the pictures for the Primay key picture button BRect rect(0,0,13,11); PrefilledBitmap firstRowOffBitmap(rect, B_COLOR_8_BIT, FirstRowOffRaw, 1344); PrefilledBitmap firstRowOnBitmap(rect, B_COLOR_8_BIT, FirstRowOnRaw, 1344); PrefilledBitmap previousRowOffBitmap(rect, B_COLOR_8_BIT, PreviousRowOffRaw, 1344); PrefilledBitmap previousRowOnBitmap(rect, B_COLOR_8_BIT, PreviousRowOnRaw, 1344); PrefilledBitmap nextRowOffBitmap(rect, B_COLOR_8_BIT, NextRowOffRaw, 1344); PrefilledBitmap nextRowOnBitmap(rect, B_COLOR_8_BIT, NextRowOnRaw, 1344); PrefilledBitmap lastRowOffBitmap(rect, B_COLOR_8_BIT, LastRowOffRaw, 1344); PrefilledBitmap lastRowOnBitmap(rect, B_COLOR_8_BIT, LastRowOnRaw, 1344); PrefilledBitmap newRowOffBitmap(rect, B_COLOR_8_BIT, NewRowOffRaw, 1344); PrefilledBitmap newRowOnBitmap(rect, B_COLOR_8_BIT, NewRowOnRaw, 1344); PrefilledBitmap previousRowOffDisabledBitmap(rect, B_COLOR_8_BIT, PreviousRowOffDisabledRaw, 1344); PrefilledBitmap nextRowOffDisabledBitmap(rect, B_COLOR_8_BIT, NextRowOffDisabledRaw, 1344); PrefilledBitmap newRowOffDisabledBitmap(rect, B_COLOR_8_BIT, NewRowOffDisabledRaw, 1344); //TempView used to create BPictures BView *tempView = new BView(rect, "temp", B_FOLLOW_NONE, B_WILL_DRAW); AddChild(tempView); //Record BPictures for Off bitmaps tempView->BeginPicture(new BPicture); tempView->DrawBitmap(&firstRowOnBitmap); BPicture* firstRowPictureOn = tempView->EndPicture(); tempView->BeginPicture(new BPicture); tempView->DrawBitmap(&previousRowOffBitmap); BPicture* previousRowPictureOff = tempView->EndPicture(); tempView->BeginPicture(new BPicture); tempView->DrawBitmap(&nextRowOffBitmap); BPicture* nextRowPictureOff = tempView->EndPicture(); tempView->BeginPicture(new BPicture); tempView->DrawBitmap(&lastRowOffBitmap); BPicture* lastRowPictureOff = tempView->EndPicture(); tempView->BeginPicture(new BPicture); tempView->DrawBitmap(&newRowOffBitmap); BPicture* newRowPictureOff = tempView->EndPicture(); //Record BPicture for DisabledOff bitmaps tempView->BeginPicture(new BPicture); tempView->DrawBitmap(&previousRowOffDisabledBitmap); BPicture* previousRowDisabledPictureOff = tempView->EndPicture(); tempView->BeginPicture(new BPicture); tempView->DrawBitmap(&nextRowOffDisabledBitmap); BPicture* nextRowDisabledPictureOff = tempView->EndPicture(); tempView->BeginPicture(new BPicture); tempView->DrawBitmap(&newRowOffDisabledBitmap); BPicture* newRowDisabledPictureOff = tempView->EndPicture(); //Record BPictures for On bitmaps tempView->BeginPicture(new BPicture); tempView->DrawBitmap(&firstRowOffBitmap); BPicture* firstRowPictureOff = tempView->EndPicture(); tempView->BeginPicture(new BPicture); tempView->DrawBitmap(&previousRowOnBitmap); BPicture* previousRowPictureOn = tempView->EndPicture(); tempView->BeginPicture(new BPicture); tempView->DrawBitmap(&nextRowOnBitmap); BPicture* nextRowPictureOn = tempView->EndPicture(); tempView->BeginPicture(new BPicture); tempView->DrawBitmap(&lastRowOnBitmap); BPicture* lastRowPictureOn = tempView->EndPicture(); tempView->BeginPicture(new BPicture); tempView->DrawBitmap(&newRowOnBitmap); BPicture* newRowPictureOn = tempView->EndPicture(); RemoveChild(tempView); delete tempView; // First Row Button BMessage* homeMsg = new BMessage(GRID_GOTO_ROW_MSG); homeMsg->AddInt32("rowNumber", int32(0)); fFirstRowButton = new BPictureButton(BRect(48,1,61,12), "homeButton", firstRowPictureOff, firstRowPictureOn, homeMsg); // Previous Row Button BMessage* prevMsg = new BMessage(GRID_GOTO_PREV_ROW_MSG); fPreviousRowButton = new BPictureButton(BRect(63,1,76,12), "previousButton", previousRowPictureOff, previousRowPictureOn, prevMsg); fPreviousRowButton->SetDisabledOff(previousRowDisabledPictureOff);//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:BeAccessible,代码行数:101,
示例5: StringEditWin::EditWin(const Rect & r, const String& name, Message *pcMsg, Looper *pcParent, const String& id) :Window(r, "EditWin", String().Format("%s - %s", name.c_str(),ID_SETTINGS_EDITOR_WINDOW.c_str()), 0, CURRENT_DESKTOP){ Rect bounds = GetBounds(); m_pcMessage = pcMsg; m_cName = name; m_cID = id; m_nIDCtr = 0; m_pcMessenger = new Messenger(pcParent, pcParent); int nCount; pcMsg->GetNameInfo(name.c_str(), &m_nType, &nCount); // --- Root layout node --------------------------------------------------------- LayoutNode* pcRoot = new VLayoutNode("pcRoot"); // --- ListView ----------------------------------------------------------------- m_pcItems = new ListView(Rect(), "m_pcListView", ListView::F_NO_AUTO_SORT|ListView::F_RENDER_BORDER); m_pcItems->InsertColumn(ID_LISTVIEW_INDEX.c_str(), 50); m_pcItems->InsertColumn(ID_LISTVIEW_VALUE.c_str(), 250); for(int i = 0; i < nCount; i++) { ListViewStringRow *lvs = new ListViewStringRow; char bfr[16]; sprintf(bfr, "%d", i); lvs->AppendString(bfr); lvs->AppendString(MsgDataToText(name, i, pcMsg)); sprintf(bfr, "%d", ++m_nIDCtr); lvs->AppendString(bfr); m_pcItems->InsertRow(lvs); } m_pcItems->SetInvokeMsg(new Message(ID_EDIT_ITEM)); pcRoot->AddChild(m_pcItems); // --- Buttons ------------------------------------------------------------------ pcRoot->AddChild(new VLayoutSpacer("ButtonTopSpacer", 8, 8)); LayoutNode *pcButtons = new HLayoutNode("pcButtons", 0.0f); pcButtons->AddChild(new HLayoutSpacer("ButtonLeftSpacer", 8, 8)); pcButtons->AddChild(new Button(Rect(), "pcAdd", ID_BUTTON_PLUS, new Message(ID_EDIT_ADD))); pcButtons->AddChild(new HLayoutSpacer("ButtonIntermediateSpacer", 8, 8)); pcButtons->AddChild(new Button(Rect(), "pcRem", ID_BUTTON_MINUS, new Message(ID_EDIT_DELETE))); pcButtons->AddChild(new HLayoutSpacer("ButtonIntermediateSpacer", 0, COORD_MAX)); pcButtons->AddChild(new Button(Rect(), "pcSave", ID_BUTTON_SAVE, new Message(ID_EDIT_SAVE))); pcButtons->AddChild(new HLayoutSpacer("ButtonIntermediateSpacer", 8, 8)); pcButtons->AddChild(new Button(Rect(), "pcCancel", ID_BUTTON_CLOSE, new Message(ID_EDIT_CANCEL))); pcButtons->AddChild(new HLayoutSpacer("ButtonRightSpacer", 8, 8)); pcButtons->SameWidth("pcSave", "pcCancel", NULL); pcButtons->SameWidth("pcRem", "pcAdd", NULL); pcRoot->AddChild(pcButtons); pcRoot->AddChild(new VLayoutSpacer("ButtonBottomSpacer", 8, 8)); AddChild(new LayoutView(bounds, "pcLayout", pcRoot));}
开发者ID:PyroOS,项目名称:Pyro,代码行数:62,
示例6: AddChildvoid Ctrl::AddChild(Ctrl *child){ AddChild(child, lastchild);}
开发者ID:pedia,项目名称:raidget,代码行数:4,
示例7: Bounds//------------------------------------------------------------------------------void WindowEditor::InitFlagsBoxes(){ BRect work = Bounds(); work.left = 10; work.top = 100; work.bottom -= 5; work.right -= 10; work.right -= 10; int i = 20; int inc = 10; BBox* box = new BBox(work, "flags"); BCheckBox* cbox; BMessage* msg; box->SetLabel("Window Flags"); uint32 flags = fWindowInfo.flags; bool longLabel; for (int index = 0; WindowFlags[index].name; ++index) { longLabel = strlen(WindowFlags[index].label) > 20; // First column of checkboxes msg = new BMessage(MSG_WINDOW_SET_FLAG); msg->AddInt32("flags", WindowFlags[index].flag); cbox = new BCheckBox(BRect(10, i, longLabel ? 210 : 125, i + inc), WindowFlags[index].name, WindowFlags[index].label, msg); fFlagBoxes.push_back(cbox); box->AddChild(cbox); if (WindowFlags[index].flip == (flags & WindowFlags[index].flag)) { cbox->SetValue(B_CONTROL_ON); } // We skip to the next row as needed to make room for long labels if (!longLabel && WindowFlags[index + 1].name) { ++index; // Second column of checkboxes msg = new BMessage(MSG_WINDOW_SET_FLAG); msg->AddInt32("flags", WindowFlags[index].flag); cbox = new BCheckBox(BRect(130, i, 210, i + inc), WindowFlags[index].name, WindowFlags[index].label, msg); fFlagBoxes.push_back(cbox); box->AddChild(cbox); if (WindowFlags[index].flip == (flags & WindowFlags[index].flag)) { cbox->SetValue(B_CONTROL_ON); } } i += inc * 2; }#if 0 msg = new BMessage(MSG_WINDOW_SET_FLAG); msg->AddInt32("flags",B_NOT_MOVABLE); box->AddChild(new BCheckBox(BRect(10,i,120,i+inc),"nmov","Movable",msg)); msg = new BMessage(MSG_WINDOW_SET_FLAG); msg->AddInt32("flags",B_NOT_CLOSABLE); box->AddChild(new BCheckBox(BRect(130,i,210,i+inc),"clos","Closable",msg)); msg = new BMessage(MSG_WINDOW_SET_FLAG); i+= inc*2; msg->AddInt32("flags",B_NOT_ZOOMABLE); box->AddChild(new BCheckBox(BRect(10,i,120,i+inc),"zoom","Zoomable",msg)); msg = new BMessage(MSG_WINDOW_SET_FLAG); msg->AddInt32("flags",B_NOT_MINIMIZABLE); box->AddChild(new BCheckBox(BRect(130,i,210,i+inc),"mini","Minimizable",msg)); msg = new BMessage(MSG_WINDOW_SET_FLAG); i+= inc*2; msg->AddInt32("flags",B_NOT_H_RESIZABLE); box->AddChild(new BCheckBox(BRect(10,i,210,i+inc),"hres","Horizontally Resizable",msg)); msg = new BMessage(MSG_WINDOW_SET_FLAG); i+= inc*2; msg->AddInt32("flags",B_NOT_V_RESIZABLE); box->AddChild(new BCheckBox(BRect(10,i,125,i+inc),"vres","Vertically Resizable",msg)); menubox = new BCheckBox(BRect(130,i,210,i+inc),"menus","Menu Bar",new BMessage(MSG_WINDOW_ADD_MENU)); box->AddChild(menubox); if (fWindowInfo.has_menu) menubox->SetValue(B_CONTROL_ON); msg = new BMessage(MSG_WINDOW_SET_FLAG); i+= inc*2; msg->AddInt32("flags",B_OUTLINE_RESIZE); box->AddChild(new BCheckBox(BRect(10,i,210,i+inc),"roiw","Resize with Outline Instead of Window",msg)); msg = new BMessage(MSG_WINDOW_SET_FLAG); i+= inc*2; msg->AddInt32("flags",B_WILL_ACCEPT_FIRST_CLICK); box->AddChild(new BCheckBox(BRect(10,i,210,i+inc),"wafc","Will Accept First Click",msg)); msg = new BMessage(MSG_WINDOW_SET_FLAG); i+= inc*2; msg->AddInt32("flags",B_AVOID_FRONT); box->AddChild(new BCheckBox(BRect(10,i,120,i+inc),"avfr","Avoid Front",msg)); msg = new BMessage(MSG_WINDOW_SET_FLAG); msg->AddInt32("flags",B_AVOID_FOCUS); box->AddChild(new BCheckBox(BRect(130,i,210,i+inc),"avfo","Avoid Focus",msg)); msg = new BMessage(MSG_WINDOW_SET_FLAG); i+= inc*2; msg->AddInt32("flags",B_NO_WORKSPACE_ACTIVATION); box->AddChild(new BCheckBox(BRect(10,i,210,i+inc),"nwoa","Do Not Activate Workspace",msg)); msg = new BMessage(MSG_WINDOW_SET_FLAG);//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:Resourcer,代码行数:101,
示例8: BWindowCharismaWindow::CharismaWindow(BPoint origin): BWindow(BRect(origin.x,origin.y,origin.x+200,origin.y+80), "Charisma", B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_WILL_ACCEPT_FIRST_CLICK){ BRect nullrect(0,0,0,0),r; BMenu *m; BWindow *w; char buf[100]; isminim=0; // le menu menubar=new BMenuBar(BRect(0,0,0,0),"menu bar"); m=new BMenu("File"); m->AddItem(new BMenuItem("About…",new BMessage(kMsg_About))); m->AddSeparatorItem(); m->AddItem(new BMenuItem("Quit",new BMessage(B_QUIT_REQUESTED),'Q')); menubar->AddItem(m); m=new BMenu("Settings"); m->AddItem(new BMenuItem("Select Web Directory…",new BMessage(kMsg_SelectDirectory))); m->AddSeparatorItem(); m->AddItem(extcontrol_item=new BMenuItem("External Control",new BMessage(kMsg_ExternalControl))); m->AddItem(netposautoset_item=new BMenuItem("Net+ Autosettings",new BMessage(kMsg_NetposAutosettings))); m->AddSeparatorItem(); m->AddItem(new BMenuItem("Clear Hits",new BMessage(kMsg_ClearHits))); menubar->AddItem(m); AddChild(menubar); // le fond gris r=Frame(); setupview=new BView( BRect(0,menubar->Frame().bottom,r.Width(),r.Height()), "background",B_FOLLOW_NONE,B_WILL_DRAW); setupview->SetViewColor(0xDD,0xDD,0xDD); AddChild(setupview); // "Mode" m=new BPopUpMenu(""); m->AddItem(new BMenuItem("Disabled",MSG)); m->AddItem(new BMenuItem("Offline",MSG)); m->AddItem(new BMenuItem("Online",MSG)); modemenu=new BMenuField( BRect(10.0f,10.0f,20.0f,20.0f),"mode", "Mode:", m); BMenuField_resize(modemenu); setupview->AddChild(modemenu); // "Refresh" m=new BPopUpMenu(""); m->AddItem(new BMenuItem("Dumb",MSG)); m->AddSeparatorItem(); m->AddItem(new BMenuItem("Always",MSG)); m->AddItem(new BMenuItem("Once per session",MSG)); m->AddSeparatorItem(); m->AddItem(new BMenuItem("After 1 hour",MSG)); m->AddItem(new BMenuItem("After 6 hours",MSG)); m->AddItem(new BMenuItem("After 12 hours",MSG)); m->AddSeparatorItem(); m->AddItem(new BMenuItem("After 1 day",MSG)); m->AddItem(new BMenuItem("After 2 days",MSG)); m->AddItem(new BMenuItem("After 3 days",MSG)); m->AddSeparatorItem(); m->AddItem(new BMenuItem("After 1 week",MSG)); m->AddItem(new BMenuItem("After 2 weeks",MSG)); m->AddSeparatorItem(); m->AddItem(new BMenuItem("After 1 month",MSG)); m->AddItem(new BMenuItem("After 2 month",MSG)); m->AddItem(new BMenuItem("After 6 month",MSG)); m->AddSeparatorItem(); m->AddItem(new BMenuItem("After 1 year",MSG)); m->AddItem(new BMenuItem("After 2 years",MSG)); m->AddSeparatorItem(); m->AddItem(new BMenuItem("never",MSG)); smartrefresh=new BMenuField( rectunder(modemenu),"refresh", "Refresh:", m); BMenuField_resize(smartrefresh); setupview->AddChild(smartrefresh); // "Hits" r.left=10.0f; r.top=smartrefresh->Frame().bottom+10.0f; r.right=r.left+setupview->StringWidth("hits: 99999"); r.bottom=r.top+BView_textheight(setupview); hits=new BStringView(r,"hits",""); setupview->AddChild(hits); if(!gregistered){ sprintf(buf,"This copy is not registered"); r.left=10.0f; r.top=hits->Frame().bottom+10.0f; r.right=r.left+setupview->StringWidth(buf); r.bottom=r.top+BView_textheight(setupview); setupview->AddChild(new BStringView(r,NULL,buf)); } r=BView_childrenframe(setupview);//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:Stamina,代码行数:101,
示例9: switchvoid Slider::KeyDown (const char *bytes, int32 numBytes){ if (numBytes == 1) { switch (*bytes) { case B_ESCAPE: { if (tc) { // printf ("TextControl is open/n"); RemoveChild (tc); delete (tc); tc = NULL; } break; } case B_SPACE: case B_ENTER: { //printf ("Enter/n"); if (tc) { // printf ("TextControl is open/n"); BMessage *key = new BMessage ('tcVC'); MessageReceived (key); delete key; } else { knobpos = BPoint (float (value - min)/(max - min)*(width - knobsize), 1); BRect kbr = BRect (knobpos.x + sep, knobpos.y, knobpos.x + knobsize - 2 + sep, knobpos.y + height - 3); // kbr.PrintToStream(); tc = new BTextControl (kbr, "slider value field", "", "", new BMessage ('tcVC')); tc->SetTarget (this); tc->SetDivider (0); EnterFilter *filter = new EnterFilter (this); tc->TextView()->AddFilter (filter); char vs[64]; sprintf (vs, fmt, value); tc->SetText (vs); AddChild (tc); tc->MakeFocus (true); inherited::KeyDown (bytes, numBytes); } break; } case B_LEFT_ARROW: //printf ("Left/n"); if (value > min) { value -= step; Invalidate(); NotifyTarget(); } break; case B_RIGHT_ARROW: //printf ("Right/n"); if (value < max) { value += step; Invalidate(); NotifyTarget(); } break; case B_TAB: // printf ("Tab/n"); if (tc) { // printf ("TextControl is open/n"); BMessage *key = new BMessage ('tcVC'); MessageReceived (key); delete key; } else { // MakeFocus (false); inherited::KeyDown (bytes, numBytes); Invalidate(); break; } default: inherited::KeyDown (bytes, numBytes); } } else inherited::KeyDown (bytes, numBytes);}
开发者ID:gedrin,项目名称:Becasso,代码行数:88,
示例10: strncpy//=======================================================================================// CFuiTBROS Terra Browser//=======================================================================================CFuiTBROS::CFuiTBROS(Tag idn, const char *filename):CFuiWindow(idn,filename,600,360,0){ strncpy(text,"TERRA BROWSER",255); //------------------------------------------------- state = 0; sel = 0; chng = 0; Type = -1; inf.mADR = 0; inf.xOBJ = 0; inf.res = TX_HIGHTR; obtn = 0; abtn = 0; lock = 1; //----Create a label title ---------------------- CFuiLabel *lab1 = new CFuiLabel(20,10,280, 20,this); lab1->SetText("TYPE OF TERRAIN TEXTURES"); AddChild('lbl1',lab1); //----Create the List box ----------------------- xWIN = new CFuiList (20,30,270,256,this); xWIN->SetVScroll(); AddChild('xlst',xWIN); //----Create a Canvas --------------------------- xCNV = new CFuiCanva(320,30,256,256,this); AddChild('xcnv',xCNV); xCNV->EraseCanvas(); //----Create Canvas Title ----------------------- wLB1 = new CFuiLabel(320,10,256,20,this); AddChild('wlb1',wLB1); //----Create RadioButton ------------------------ wLOK = new CFuiCheckbox(20, 300,420,16,this); AddChild('wlok',wLOK,OptTXT[lock]); wLOK->SetState(lock); //----Create the button ------------------------- wBT1 = new CFuiButton(420, 300, 140,20,this); AddChild('wbt1',wBT1,"Assign selected Texture"); //----Create Cancel button ---------------------- zBTN = new CFuiButton(420, 326, 140,20,this); AddChild('zbtn',zBTN,"CANCEL"); //--- Create group edit ------------------------- BuildGroupEdit(10,320); //----Create surface ---------------------------- CFuiWindow::ReadFinished(); aBOX = globals->tcm->GetTerraBox(); aBOX->SetParameters(this,'xlst',LIST_DONT_FREE); //---Get a camera to draw texture --------------- Cam = new CCameraSpot(); //----------------------------------------------- tFIL = globals->tcm->GetTerraFile(); //----------------------------------------------- aBOX->SortAndDisplay(); int tex = globals->tcm->GetGroundType(); aBOX->GoToKey(&tex); GetSelection(); //--- Set application profile ------------------- ctx.prof = TBROS_PROF; ctx.mode = SLEW_RCAM; rcam = globals->ccm->SetRabbitCamera(ctx,RABBIT_S_AND_C);}
开发者ID:FlySimvol,项目名称:FlyLegacy,代码行数:66,
示例11: BPoint//.........这里部分代码省略......... { while (system_time() - start < dcspeed) { snooze (20000); GetMouse (&bp, &bt, true); if (!bt && click != 2) { click = 0; } if (bt && !click) { click = 2; } if (bp != pbp) break; } } if (click != 2) { // Now we're dragging... while (buttons) { BPoint p = BPoint (point.x - sep, point.y); float x = p.x; if (!(knob.Contains (p)) && !dragging) { if (x > knob.left) { value += step * (x - knob.right)/10; } else { value += step * (x - knob.left)/10; } if (value < min) value = min; if (value > max) value = max; if (step > 1 && fmod (value - min, step)) // Hack hack! value = int ((value - min)/step)*step + min; // if (fmt[strlen (fmt) - 2] == '0') // value = int (value + 0.5); offslid->Lock(); Invalidate (BRect (sep + 1, 0, offslid->Bounds().Width() + sep, height)); offslid->Unlock(); NotifyTarget(); } else if (px != p.x && step <= 1) // Hacks galore! { dragging = true; value = (x - knobsize/2) / (width - knobsize) * (max - min) + min; //printf ("x = %f, knobsize = %f, value = %f/n", x, knobsize, value); //printf ("Value: %f ", value); if (value < min) value = min; if (value > max) value = max; if (step > 1 && fmod (value - min, step)) value = int ((value - min)/step)*step + min; if (fmt[strlen (fmt) - 2] == '0') value = int (value + 0.5); //printf ("-> %f/n", value); offslid->Lock(); Invalidate (BRect (sep + 1, 0, offslid->Bounds().Width() + sep, height)); offslid->Unlock(); px = p.x; NotifyTarget(); } knobpos = BPoint (float (value - min)/(max - min)*(width - knobsize), 1); knob = BRect (knobpos.x + 1, knobpos.y + 1, knobpos.x + knobsize - 2, knobpos.y + height - 2); snooze (20000); GetMouse (&point, &buttons, true); } click = 1; } } if (click == 2 || buttons & B_SECONDARY_MOUSE_BUTTON || modifiers() & B_CONTROL_KEY) { click = 1; if (tc) { RemoveChild (tc); delete tc; } knobpos = BPoint (float (value - min)/(max - min)*(width - knobsize), 1); BRect kbr = BRect (knobpos.x + sep, knobpos.y, knobpos.x + knobsize - 2 + sep, knobpos.y + height - 3);// kbr.PrintToStream(); tc = new BTextControl (kbr, "slider value field", "", "", new BMessage ('tcVC')); tc->SetTarget (this); tc->SetDivider (0); EnterFilter *filter = new EnterFilter (this); tc->TextView()->AddFilter (filter); char vs[64]; sprintf (vs, fmt, value); tc->SetText (vs); AddChild (tc); tc->MakeFocus (true); } NotifyTarget ();}
开发者ID:gedrin,项目名称:Becasso,代码行数:101,
示例12: StringWidth/*********************************************************** * InitGUI ***********************************************************/voidHAddressView::InitGUI(){ float divider = StringWidth(_("Subject:")) + 20; divider = max_c(divider , StringWidth(_("From:"))+20); divider = max_c(divider , StringWidth(_("To:"))+20); divider = max_c(divider , StringWidth(_("Bcc:"))+20); BRect rect = Bounds(); rect.top += 5; rect.left += 20 + divider; rect.right = Bounds().right - 5; rect.bottom = rect.top + 25; BTextControl *ctrl; ResourceUtils rutils; const char* name[] = {"to","subject","from","cc","bcc"}; for(int32 i = 0;i < 5;i++) { ctrl = new BTextControl(BRect(rect.left,rect.top ,(i == 1)?rect.right+divider:rect.right ,rect.bottom) ,name[i],"","",NULL ,B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP,B_WILL_DRAW|B_NAVIGABLE); if(i == 1) { ctrl->SetLabel(_("Subject:")); ctrl->SetDivider(divider); ctrl->MoveBy(-divider,0); }else{ ctrl->SetDivider(0); } BMessage *msg = new BMessage(M_MODIFIED); msg->AddPointer("pointer",ctrl); ctrl->SetModificationMessage(msg); ctrl->SetEnabled(!fReadOnly); AddChild(ctrl); rect.OffsetBy(0,25); switch(i) { case 0: fTo = ctrl; break; case 1: fSubject = ctrl; break; case 2: fFrom = ctrl; fFrom->SetEnabled(false); fFrom->SetFlags(fFrom->Flags() & ~B_NAVIGABLE); break; case 3: fCc = ctrl; break; case 4: fBcc = ctrl; break; } } // BRect menuRect= Bounds(); menuRect.top += 5; menuRect.left += 22; menuRect.bottom = menuRect.top + 25; menuRect.right = menuRect.left + 16; BMenu *toMenu = new BMenu(_("To:")); BMenu *ccMenu = new BMenu(_("Cc:")); BMenu *bccMenu = new BMenu(_("Bcc:")); BQuery query; BVolume volume; BVolumeRoster().GetBootVolume(&volume); query.SetVolume(&volume); query.SetPredicate("((META:email=*)&&(BEOS:TYPE=application/x-person))"); if(!fReadOnly && query.Fetch() == B_OK) { BString addr[4],name,group,nick; entry_ref ref; BList peopleList; while(query.GetNextRef(&ref) == B_OK) { BNode node(&ref); if(node.InitCheck() != B_OK) continue; ReadNodeAttrString(&node,"META:name",&name); ReadNodeAttrString(&node,"META:email",&addr[0]); ReadNodeAttrString(&node,"META:email2",&addr[1]); ReadNodeAttrString(&node,"META:email3",&addr[2]); ReadNodeAttrString(&node,"META:email4",&addr[3]); ReadNodeAttrString(&node,"META:group",&group);//.........这里部分代码省略.........
开发者ID:HaikuArchives,项目名称:Scooby,代码行数:101,
示例13: BWindowAddTorrentWindow::AddTorrentWindow(TorrentObject* torrent) : BWindow(BRect(), "Add torrent", B_TITLED_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_AUTO_UPDATE_SIZE_LIMITS | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_PULSE_NEEDED ), fTorrent(torrent), fCancelAdd(true){ SetPulseRate(1000000); SetLayout(new BGroupLayout(B_VERTICAL)); float spacing = be_control_look->DefaultItemSpacing(); // // // fInfoHeaderView = new InfoHeaderView(fTorrent); fFileList = new BColumnListView("FileList", 0, B_PLAIN_BORDER, true); fStartCheckBox = new BCheckBox("", "Start when added", NULL); fCancelButton = new BButton("Cancel", new BMessage(B_QUIT_REQUESTED)); fAddButton = new BButton("Add", new BMessage(MSG_BUTTON_ADD)); fLoadingView = new BStatusBar("", "Downloading Metadata"); fLoadingView->SetBarHeight(12); fLoadingView->SetMaxValue(1.0); if( !fTorrent->IsMagnet() ) fLoadingView->Hide(); fStartCheckBox->SetValue(B_CONTROL_ON); // // // fFileList->SetColumnFlags(B_ALLOW_COLUMN_RESIZE); fFileList->SetSortingEnabled(false); fFileList->SetExplicitMinSize(BSize(550, FILE_COLUMN_HEIGHT * 5)); fFileList->AddColumn(new FileColumn("Name", 400, 400, 500), COLUMN_FILE_NAME); fFileList->AddColumn(new CheckBoxColumn("DL", 40, 40, 40), COLUMN_FILE_DOWNLOAD); // // We're a magnet or a complete torrent file? // if( fTorrent->IsMagnet() ) { fTorrent->SetMetadataCallbackHandler(this); //const_cast<TorrentObject*>(fTorrent)->StartTransfer(); } else UpdateFileList(); AddChild(BGroupLayoutBuilder(B_VERTICAL, spacing) .Add(fInfoHeaderView) .AddGlue() .Add(fFileList) .Add(BGroupLayoutBuilder(B_HORIZONTAL, spacing) .SetInsets(spacing, spacing, spacing, spacing) .Add(fStartCheckBox) .AddGlue() .Add(fCancelButton) .Add(fAddButton) .Add(fLoadingView) ) .SetInsets(spacing, spacing, spacing, spacing) ); CenterOnScreen(); Run();}
开发者ID:Prodito,项目名称:Torrentor,代码行数:75,
示例14: RETURN_IF_ERROROP_STATUS TransfersPanel::Init(){ RETURN_IF_ERROR(OpTreeView::Construct(&m_transfers_view)); m_transfers_view->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL); AddChild(m_transfers_view, TRUE); RETURN_IF_ERROR(OpGroup::Construct(&m_item_details_group)); AddChild(m_item_details_group, TRUE); m_item_details_group->SetSkinned(TRUE); m_item_details_group->GetBorderSkin()->SetImage("Transfer Panel Details Skin", "Window Skin"); RETURN_IF_ERROR(OpLabel::Construct(&m_item_details_from_label)); m_item_details_from_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL); m_item_details_group->AddChild(m_item_details_from_label, TRUE); RETURN_IF_ERROR(OpLabel::Construct(&m_item_details_to_label)); m_item_details_to_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL); m_item_details_group->AddChild(m_item_details_to_label, TRUE); RETURN_IF_ERROR(OpLabel::Construct(&m_item_details_size_label)); m_item_details_size_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL); m_item_details_group->AddChild(m_item_details_size_label, TRUE); RETURN_IF_ERROR(OpLabel::Construct(&m_item_details_transferred_label)); m_item_details_transferred_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL); m_item_details_group->AddChild(m_item_details_transferred_label, TRUE); RETURN_IF_ERROR(OpLabel::Construct(&m_item_details_connections_label)); m_item_details_connections_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL); m_item_details_group->AddChild(m_item_details_connections_label, TRUE); RETURN_IF_ERROR(OpLabel::Construct(&m_item_details_activetransfers_label)); m_item_details_activetransfers_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL); m_item_details_group->AddChild(m_item_details_activetransfers_label, TRUE); RETURN_IF_ERROR(OpEdit::Construct(&m_item_details_from_info_label)); m_item_details_from_info_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL); m_item_details_from_info_label->SetForceTextLTR(TRUE); m_item_details_group->AddChild(m_item_details_from_info_label, TRUE); m_item_details_from_info_label->SetFlatMode(); RETURN_IF_ERROR(OpEdit::Construct(&m_item_details_to_info_label)); m_item_details_to_info_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL); m_item_details_to_info_label->SetForceTextLTR(TRUE); m_item_details_group->AddChild(m_item_details_to_info_label, TRUE); m_item_details_to_info_label->SetFlatMode(); RETURN_IF_ERROR(OpEdit::Construct(&m_item_details_size_info_label)); m_item_details_size_info_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL); m_item_details_group->AddChild(m_item_details_size_info_label, TRUE); m_item_details_size_info_label->SetFlatMode(); RETURN_IF_ERROR(OpEdit::Construct(&m_item_details_transferred_info_label)); m_item_details_transferred_info_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL); m_item_details_group->AddChild(m_item_details_transferred_info_label, TRUE); m_item_details_transferred_info_label->SetFlatMode(); RETURN_IF_ERROR(OpEdit::Construct(&m_item_details_connections_info_label)); m_item_details_connections_info_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL); m_item_details_group->AddChild(m_item_details_connections_info_label, TRUE); m_item_details_connections_info_label->SetFlatMode(); RETURN_IF_ERROR(OpEdit::Construct(&m_item_details_activetransfers_info_label)); m_item_details_activetransfers_info_label->SetSystemFont(OP_SYSTEM_FONT_UI_PANEL); m_item_details_group->AddChild(m_item_details_activetransfers_info_label, TRUE); m_item_details_activetransfers_info_label->SetFlatMode(); SetToolbarName("Transfers Panel Toolbar", "Transfers Full Toolbar"); SetName("Transfers"); m_showdetails = g_pcui->GetIntegerPref(PrefsCollectionUI::TransWinShowDetails); m_show_extra_info = FALSE; m_transfers_view->SetListener(this); OpString ui_text; g_languageManager->GetString(Str::DI_IDL_SOURCE, ui_text); m_item_details_from_label->SetLabel(ui_text.CStr()); g_languageManager->GetString(Str::DI_IDL_DESTINATION, ui_text); m_item_details_to_label->SetLabel(ui_text.CStr()); g_languageManager->GetString(Str::DI_IDL_SIZE, ui_text); m_item_details_size_label->SetLabel(ui_text.CStr()); g_languageManager->GetString(Str::DI_IDL_TRANSFERED, ui_text); m_item_details_transferred_label->SetLabel(ui_text.CStr()); g_languageManager->GetString(Str::S_TRANSFERS_PANEL_CONNECTION_SHORT, ui_text); m_item_details_connections_label->SetLabel(ui_text.CStr()); g_languageManager->GetString(Str::S_TRANSFERS_PANEL_ACTIVE_TRANSFERS, ui_text); m_item_details_activetransfers_label->SetLabel(ui_text.CStr()); m_transfers_view->SetMultiselectable(TRUE);#ifdef WINDOW_COMMANDER_TRANSFER m_transfers_view->SetTreeModel((OpTreeModel *)g_desktop_transfer_manager);#endif // WINDOW_COMMANDER_TRANSFER m_transfers_view->SetColumnWeight(1, 250); m_transfers_view->SetColumnFixedWidth(0, 18); m_transfers_view->SetVisibility(TRUE); if(g_pcui->GetIntegerPref(PrefsCollectionUI::EnableDrag)&DRAG_BOOKMARK) { m_transfers_view->SetDragEnabled(TRUE); }//.........这里部分代码省略.........
开发者ID:prestocore,项目名称:browser,代码行数:101,
示例15: SetProperty//=====================================================================================// Window to control camera//=====================================================================================CFuiCamControl::CFuiCamControl(Tag idn, const char *filename):CFuiWindow(idn,filename,240,180,0){ SetProperty(FUI_TRANSPARENT); SetProperty(FUI_NO_BORDER); //---- Set the back bitmap ---------------------- SetBackPicture("CamControl.bmp"); CFuiWindow::ReadFinished(); //----Create all buttons ------------------------ U_INT col = MakeRGBA(255,255,255,255); lrot = new CFuiLabel (43,48,47,19,this); lrot->RazProperty(FUI_NO_BORDER); lrot->SetColour(col); AddChild('lrot',lrot,""); rtlf = new CFuiButton( 6,48,36,20,this); AddChild('rtlf',rtlf,"-",FUI_REPEAT_BT); rtrt = new CFuiButton(91,48,36,20,this); AddChild('rtrt',rtrt,"+",FUI_REPEAT_BT); rtup = new CFuiButton(40,26,52,20,this); AddChild('rtup',rtup,"+",FUI_REPEAT_BT); rtdn = new CFuiButton(40,68,52,20,this); AddChild('rtdn',rtdn,"-",FUI_REPEAT_BT); //----Create range items ------------------------ lrng = new CFuiLabel (168,48,36,19,this); lrng->RazProperty(FUI_NO_BORDER); lrng->SetColour(col); AddChild('lrng',lrng,""); rnut = new CFuiButton(168,26,36,20,this); AddChild('rnut',rnut,"+",FUI_REPEAT_BT); rnin = new CFuiButton(168,68,36,20,this); AddChild('rnin',rnin,"-",FUI_REPEAT_BT); //----Create zoom items ------------------------- lzom = new CFuiLabel (101,130,38,19,this); lzom->RazProperty(FUI_NO_BORDER); lzom->SetColour(col); AddChild('lzom',lzom,""); zmin = new CFuiButton( 64,129,36,20,this); AddChild('zmin',zmin,"-",FUI_REPEAT_BT); zmup = new CFuiButton(140,129,36,20,this); AddChild('zmup',zmup,"+",FUI_REPEAT_BT);}
开发者ID:PierrotG,项目名称:FlyLegacy,代码行数:45,
示例16: BWindowMainWin::MainWin(BRect frame_rect) : BWindow(frame_rect, B_TRANSLATE_SYSTEM_NAME(NAME), B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS /* | B_WILL_ACCEPT_FIRST_CLICK */) , fController(new Controller) , fIsFullscreen(false) , fKeepAspectRatio(true) , fAlwaysOnTop(false) , fNoMenu(false) , fNoBorder(false) , fSourceWidth(720) , fSourceHeight(576) , fWidthScale(1.0) , fHeightScale(1.0) , fMouseDownTracking(false) , fFrameResizedTriggeredAutomatically(false) , fIgnoreFrameResized(false) , fFrameResizedCalled(true){ BRect rect = Bounds(); // background fBackground = new BView(rect, "background", B_FOLLOW_ALL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); fBackground->SetViewColor(0,0,0); AddChild(fBackground); // menu fMenuBar = new BMenuBar(fBackground->Bounds(), "menu"); CreateMenu(); fBackground->AddChild(fMenuBar); fMenuBar->ResizeToPreferred(); fMenuBarHeight = (int)fMenuBar->Frame().Height() + 1; fMenuBar->SetResizingMode(B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT); // video view BRect video_rect = BRect(0, fMenuBarHeight, rect.right, rect.bottom); fVideoView = new VideoView(video_rect, "video display", B_FOLLOW_ALL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); fBackground->AddChild(fVideoView); fVideoView->MakeFocus();// SetSizeLimits(fControlViewMinWidth - 1, 32767,// fMenuBarHeight + fControlViewHeight - 1, fMenuBarHeight// + fControlViewHeight - 1);// SetSizeLimits(320 - 1, 32767, 240 + fMenuBarHeight - 1, 32767); SetSizeLimits(0, 32767, fMenuBarHeight - 1, 32767); fController->SetVideoView(fVideoView); fController->SetVideoNode(fVideoView->Node()); fVideoView->IsOverlaySupported(); SetupInterfaceMenu(); SelectInitialInterface(); SetInterfaceMenuMarker(); SetupChannelMenu(); SetChannelMenuMarker(); VideoFormatChange(fSourceWidth, fSourceHeight, fWidthScale, fHeightScale); CenterOnScreen();}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:66,
示例17: BWindowShowImageWindow::ShowImageWindow(BRect frame, const entry_ref& ref, const BMessenger& trackerMessenger) : BWindow(frame, "", B_DOCUMENT_WINDOW, B_AUTO_UPDATE_SIZE_LIMITS), fNavigator(ref, trackerMessenger), fSavePanel(NULL), fBar(NULL), fBrowseMenu(NULL), fGoToPageMenu(NULL), fSlideShowDelayMenu(NULL), fToolBar(NULL), fImageView(NULL), fStatusView(NULL), fProgressWindow(new ProgressWindow()), fModified(false), fFullScreen(false), fShowCaption(true), fShowToolBar(true), fPrintSettings(NULL), fSlideShowRunner(NULL), fSlideShowDelay(kDefaultSlideShowDelay){ _ApplySettings(); SetLayout(new BGroupLayout(B_VERTICAL, 0)); // create menu bar fBar = new BMenuBar("menu_bar"); _AddMenus(fBar); float menuBarMinWidth = fBar->MinSize().width; AddChild(fBar); // Add a content view so the tool bar can be moved outside of the // visible portion without colliding with the menu bar. BView* contentView = new BView(BRect(), "content", B_FOLLOW_NONE, 0); contentView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); contentView->SetExplicitMinSize(BSize(250, 100)); AddChild(contentView); // Create the tool bar BRect viewFrame = contentView->Bounds(); viewFrame.right -= B_V_SCROLL_BAR_WIDTH; fToolBar = new BToolBar(viewFrame); // Add the tool icons.// fToolBar->AddAction(MSG_FILE_OPEN, be_app,// tool_bar_icon(kIconDocumentOpen), B_TRANSLATE("Open" B_UTF8_ELLIPSIS)); fToolBar->AddAction(MSG_FILE_PREV, this, tool_bar_icon(kIconGoPrevious), B_TRANSLATE("Previous file"), false); fToolBar->AddAction(MSG_FILE_NEXT, this, tool_bar_icon(kIconGoNext), B_TRANSLATE("Next file"), false); BMessage* fullScreenSlideShow = new BMessage(MSG_SLIDE_SHOW); fullScreenSlideShow->AddBool("full screen", true); fToolBar->AddAction(fullScreenSlideShow, this, tool_bar_icon(kIconMediaMovieLibrary), B_TRANSLATE("Slide show"), false); fToolBar->AddSeparator(); fToolBar->AddAction(MSG_SELECTION_MODE, this, tool_bar_icon(kIconDrawRectangularSelection), B_TRANSLATE("Selection mode"), false); fToolBar->AddSeparator(); fToolBar->AddAction(kMsgOriginalSize, this, tool_bar_icon(kIconZoomOriginal), B_TRANSLATE("Original size"), true); fToolBar->AddAction(kMsgFitToWindow, this, tool_bar_icon(kIconZoomFitBest), B_TRANSLATE("Fit to window"), false); fToolBar->AddAction(MSG_ZOOM_IN, this, tool_bar_icon(kIconZoomIn), B_TRANSLATE("Zoom in"), false); fToolBar->AddAction(MSG_ZOOM_OUT, this, tool_bar_icon(kIconZoomOut), B_TRANSLATE("Zoom out"), false); fToolBar->AddSeparator(); fToolBar->AddAction(MSG_PAGE_PREV, this, tool_bar_icon(kIconPagePrevious), B_TRANSLATE("Previous page"), false); fToolBar->AddAction(MSG_PAGE_NEXT, this, tool_bar_icon(kIconPageNext), B_TRANSLATE("Next page"), false); fToolBar->AddGlue(); fToolBar->AddAction(MSG_FULL_SCREEN, this, tool_bar_icon(kIconViewWindowed), B_TRANSLATE("Leave full screen"), false); fToolBar->SetActionVisible(MSG_FULL_SCREEN, false); fToolBar->ResizeTo(viewFrame.Width(), fToolBar->MinSize().height); contentView->AddChild(fToolBar); if (fShowToolBar) viewFrame.top = fToolBar->Frame().bottom + 1; else fToolBar->Hide(); fToolBarVisible = fShowToolBar; viewFrame.bottom = contentView->Bounds().bottom; viewFrame.bottom -= B_H_SCROLL_BAR_HEIGHT; // create the image view fImageView = new ShowImageView(viewFrame, "image_view", B_FOLLOW_ALL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_PULSE_NEEDED | B_FRAME_EVENTS);//.........这里部分代码省略.........
开发者ID:yunxiaoxiao110,项目名称:haiku,代码行数:101,
示例18: BViewStatusView::StatusView() : BView(NULL, B_WILL_DRAW), fCurrentFileInfo(NULL){ SetViewColor(kPieBGColor); SetLowColor(kPieBGColor); fSizeView = new BStringView(NULL, kEmptyStr); fSizeView->SetExplicitMinSize(BSize(StringWidth("9999.99 GiB"), B_SIZE_UNSET)); fSizeView->SetExplicitMaxSize(BSize(StringWidth("9999.99 GiB"), B_SIZE_UNSET)); char testLabel[256]; snprintf(testLabel, sizeof(testLabel), B_TRANSLATE_COMMENT("%d files", "For UI layouting only, use the longest plural form for your language"), 999999); fCountView = new BStringView(NULL, kEmptyStr); float width, height; fCountView->GetPreferredSize(&width, &height); fCountView->SetExplicitMinSize(BSize(StringWidth(testLabel), B_SIZE_UNSET)); fCountView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, height)); fPathView = new BStringView(NULL, kEmptyStr); fPathView->GetPreferredSize(&width, &height); fPathView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, height)); fRefreshBtn = new BButton(NULL, B_TRANSLATE("Scan"), new BMessage(kBtnRescan)); fRefreshBtn->SetExplicitMaxSize(BSize(B_SIZE_UNSET, B_SIZE_UNLIMITED)); BBox* divider1 = new BBox(BRect(), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER); BBox* divider2 = new BBox(BRect(), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER); divider1->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1)); divider2->SetExplicitMaxSize(BSize(1, B_SIZE_UNLIMITED)); SetLayout(new BGroupLayout(B_VERTICAL)); AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, 0) .AddGroup(B_VERTICAL, 0) .Add(fPathView) .Add(divider1) .AddGroup(B_HORIZONTAL, 0) .Add(fCountView) .Add(divider2) .Add(fSizeView) .End() .End() .AddStrut(kSmallHMargin) .Add(fRefreshBtn) .SetInsets(kSmallVMargin, kSmallVMargin, kSmallVMargin, kSmallVMargin) );}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:61,
示例19: BView// ---------------------------------------------------------------// Constructor//// Sets up the view settings//// Preconditions://// Parameters://// Postconditions://// Returns:// ---------------------------------------------------------------SlideShowConfigView::SlideShowConfigView(const BRect &frame, const char *name, uint32 resize, uint32 flags, LiveSettings *settings) : BView(frame, name, resize, flags){ fSettings = settings; SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); BMessage *pMsg; int32 val; // Show Caption checkbox pMsg = new BMessage(CHANGE_CAPTION); fShowCaption = new BCheckBox(BRect(10, 45, 180, 62), "Show caption", "Show caption", pMsg); val = (fSettings->SetGetBool(SAVER_SETTING_CAPTION)) ? 1 : 0; fShowCaption->SetValue(val); fShowCaption->SetViewColor(ViewColor()); AddChild(fShowCaption); // Change Border checkbox pMsg = new BMessage(CHANGE_BORDER); fShowBorder = new BCheckBox(BRect(10, 70, 180, 87), "Show border", "Show border", pMsg); val = (fSettings->SetGetBool(SAVER_SETTING_BORDER)) ? 1 : 0; fShowBorder->SetValue(val); fShowBorder->SetViewColor(ViewColor()); AddChild(fShowBorder); // Delay Menu // setup PNG interlace options menu int32 currentDelay = fSettings->SetGetInt32(SAVER_SETTING_DELAY) / 1000; fDelayMenu = new BPopUpMenu("Delay menu"); struct DelayItem { const char *name; int32 delay; }; DelayItem items[] = { {"No delay", 0}, {"1 second", 1}, {"2 seconds", 2}, {"3 seconds", 3}, {"4 seconds", 4}, {"5 seconds", 5}, {"6 seconds", 6}, {"7 seconds", 7}, {"8 seconds", 8}, {"9 seconds", 9}, {"10 seconds", 10}, {"15 seconds", 15}, {"20 seconds", 20}, {"30 seconds", 30}, {"1 minute", 1 * 60}, {"2 minutes", 2 * 60}, {"5 minutes", 5 * 60}, {"10 minutes", 10 * 60}, {"15 minutes", 15 * 60} }; for (uint32 i = 0; i < sizeof(items) / sizeof(DelayItem); i++) { BMenuItem *menuItem = new BMenuItem(items[i].name, delay_msg(items[i].delay)); fDelayMenu->AddItem(menuItem); if (items[i].delay == currentDelay) menuItem->SetMarked(true); } fDelayMenuField = new BMenuField(BRect(10, 100, 180, 120), "Delay Menu Field", "Delay:", fDelayMenu); fDelayMenuField->SetViewColor(ViewColor()); fDelayMenuField->SetDivider(40); AddChild(fDelayMenuField); // Choose Image Folder button pMsg = new BMessage(CHOOSE_DIRECTORY); fChooseFolder = new BButton(BRect(50, 160, 180, 180), "Choose Folder", "Choose image folder" B_UTF8_ELLIPSIS, pMsg); AddChild(fChooseFolder); // Setup choose folder file panel pMsg = new BMessage(CHANGE_DIRECTORY); fFilePanel = new BFilePanel(B_OPEN_PANEL, NULL, (const entry_ref *) NULL, B_DIRECTORY_NODE, false, pMsg, NULL, true, true); fFilePanel->SetButtonLabel(B_DEFAULT_BUTTON, "Select"); delete pMsg;}
开发者ID:DonCN,项目名称:haiku,代码行数:97,
示例20: SetSpritePath/*========================idMenuScreen_Shell_MatchSettings::Initialize========================*/void idMenuScreen_Shell_MatchSettings::Initialize( idMenuHandler * data ) { idMenuScreen::Initialize( data ); if ( data != NULL ) { menuGUI = data->GetGUI(); } SetSpritePath( "menuMatchSettings" ); options = new (TAG_SWF) idMenuWidget_DynamicList(); options->SetNumVisibleOptions( NUM_GAME_OPTIONS_OPTIONS ); options->SetSpritePath( GetSpritePath(), "info", "options" ); options->SetWrappingAllowed( true ); options->SetControlList( true ); options->Initialize( data ); AddChild( options ); btnBack = new (TAG_SWF) idMenuWidget_Button(); btnBack->Initialize( data ); btnBack->SetLabel( "#str_swf_multiplayer" ); btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" ); btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK ); AddChild( btnBack ); idMenuWidget_ControlButton * control; control = new (TAG_SWF) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TEXT ); control->SetLabel( "#str_swf_mode" ); // Mode control->SetDataSource( &matchData, idMenuDataSource_MatchSettings::MATCH_FIELD_MODE ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() ); options->AddChild( control ); control = new (TAG_SWF) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TEXT ); control->SetLabel( "#str_02049" ); // Map control->SetDataSource( &matchData, idMenuDataSource_MatchSettings::MATCH_FIELD_MAP ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() ); options->AddChild( control ); control = new (TAG_SWF) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TEXT ); control->SetLabel( "#str_02183" ); // Time control->SetDataSource( &matchData, idMenuDataSource_MatchSettings::MATCH_FIELD_TIME ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() ); options->AddChild( control ); control = new (TAG_SWF) idMenuWidget_ControlButton(); control->SetOptionType( OPTION_SLIDER_TEXT ); control->SetLabel( "#str_00100917" ); // Score control->SetDataSource( &matchData, idMenuDataSource_MatchSettings::MATCH_FIELD_SCORE ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); control->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() ); options->AddChild( control ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) ); options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new (TAG_SWF) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) );}
开发者ID:469486139,项目名称:DOOM-3-BFG,代码行数:71,
示例21: AgentDockWinListvoidClientWindowDock::AddWinList (void){ fWinListAgent = new AgentDockWinList (fWorkingFrame); AddChild (fWinListAgent);}
开发者ID:jessicah,项目名称:Vision,代码行数:6,
示例22: ASSERTvoid DialogPane::SetMode(int32 mode, bool initialSetup){ ASSERT(mode < 3 && mode >= 0); if (!initialSetup && mode == fMode) return; int32 oldMode = fMode; fMode = mode; bool followBottom = (ResizingMode() & B_FOLLOW_BOTTOM) != 0; // if we are follow bottom, we will move ourselves, need to place us back float bottomOffset = 0; if (followBottom) bottomOffset = Window()->Bounds().bottom - Frame().bottom; BRect newBounds(BoundsForMode(fMode)); if (!initialSetup) ResizeParentWindow(fMode, oldMode); ResizeTo(newBounds.Width(), newBounds.Height()); float delta = 0; if (followBottom) delta = (Window()->Bounds().bottom - Frame().bottom) - bottomOffset; if (delta != 0) { MoveBy(0, delta); if (fLatch && (fLatch->ResizingMode() & B_FOLLOW_BOTTOM)) fLatch->MoveBy(0, delta); } switch (fMode) { case 0: { if (oldMode > 1) fMode3Items.RemoveAll(this); if (oldMode > 0) fMode2Items.RemoveAll(this); BView *separator = FindView("separatorLine"); if (separator) { BRect frame(separator->Frame()); frame.InsetBy(-1, -1); RemoveChild(separator); Invalidate(); } AddChild(new SeparatorLine(BPoint(newBounds.left, newBounds.top + newBounds.Height() / 2), newBounds.Width(), false, "separatorLine")); } break; case 1: { if (oldMode > 1) fMode3Items.RemoveAll(this); else fMode2Items.AddAll(this); BView *separator = FindView("separatorLine"); if (separator) { BRect frame(separator->Frame()); frame.InsetBy(-1, -1); RemoveChild(separator); Invalidate(); } } break; case 2: { fMode3Items.AddAll(this); if (oldMode < 1) fMode2Items.AddAll(this); BView *separator = FindView("separatorLine"); if (separator) { BRect frame(separator->Frame()); frame.InsetBy(-1, -1); RemoveChild(separator); Invalidate(); } } break; }}
开发者ID:Ithamar,项目名称:cosmoe,代码行数:87,
示例23: initAudio//.........这里部分代码省略......... whiteBanner->m_ScaleY = (float)IwGxGetScreenHeight() / whiteBanner->GetImage()->GetHeight() / 5; // Create menu background playWrapper = new CSprite(); playWrapper->SetImage(g_pResources->getPlayWrapper()); playWrapper->m_X = (float)IwGxGetScreenWidth() / 2; playWrapper->m_Y = (float)IwGxGetScreenHeight() / 1.09; playWrapper->m_W = playWrapper->GetImage()->GetWidth(); playWrapper->m_H = playWrapper->GetImage()->GetHeight(); playWrapper->m_AnchorX = 0.5; playWrapper->m_AnchorY = 0.5; //playWrapper->m_Alpha = 0.9; // Fit background to screen size playWrapper->m_ScaleX = (float)IwGxGetScreenWidth() / playWrapper->GetImage()->GetWidth() / 1; playWrapper->m_ScaleY = (float)IwGxGetScreenHeight() / playWrapper->GetImage()->GetHeight() / 6; playButton = new CSprite(); playButton->SetImage(g_pResources->getPlayButton()); playButton->m_X = (float)IwGxGetScreenWidth() / 2; playButton->m_Y = (float)IwGxGetScreenHeight() / 1.13; //buttonTop = (float)IwGxGetScreenHeight() / 1.14 - (playButton->GetImage()->GetHeight() / 8); playButton->m_W = playButton->GetImage()->GetWidth(); playButton->m_H = playButton->GetImage()->GetHeight(); playButton->m_AnchorX = 0.5; playButton->m_AnchorY = 0.5; // Fit background to screen size playButton->m_ScaleX = (float)IwGxGetScreenWidth() / playButton->GetImage()->GetWidth() / 3.2; playButton->m_ScaleY = (float)IwGxGetScreenHeight() / playButton->GetImage()->GetHeight() / 4.5; //buttonTop = ((float)IwGxGetScreenHeight() / 1.14) - (playButton->GetImage()->GetHeight() / 3.7); stopButton = new CSprite(); stopButton->SetImage(g_pResources->getStopButton()); stopButton->m_X = (float)IwGxGetScreenWidth() / 2; stopButton->m_Y = (float)IwGxGetScreenHeight() / 1.13; stopButton->m_W = stopButton->GetImage()->GetWidth(); stopButton->m_H = stopButton->GetImage()->GetHeight(); stopButton->m_AnchorX = 0.5; stopButton->m_AnchorY = 0.5; // Fit background to screen size stopButton->m_ScaleX = (float)IwGxGetScreenWidth() / stopButton->GetImage()->GetWidth() / 3.2; stopButton->m_ScaleY = (float)IwGxGetScreenHeight() / stopButton->GetImage()->GetHeight() / 4.5; banner = new CSprite(); banner->SetImage(g_pResources->getGreyBanner()); banner->m_X = (float)IwGxGetScreenWidth() / 2; banner->m_Y = (float)IwGxGetScreenHeight() /6; banner->m_W = banner->GetImage()->GetWidth(); banner->m_H = banner->GetImage()->GetHeight(); banner->m_AnchorX = 0.5; banner->m_AnchorY = 0.5; // Fit background to screen size banner->m_ScaleX = (float)IwGxGetScreenWidth() / banner->GetImage()->GetWidth() / 1; banner->m_ScaleY = (float)IwGxGetScreenHeight() / banner->GetImage()->GetHeight() / 8; buttonTop = IwGxGetScreenHeight() / 4; labelLeft = new CLabel(); labelLeft->m_Font = g_pResources->getBannerFontSmall(); labelLeft->m_Text = "Cal."; labelLeft->m_Y = IwGxGetDisplayHeight() / 6.5; labelLeft->m_W = IwGxGetDisplayWidth() / 2; labelLeft->m_ScaleX = 1.0; labelLeft->m_AlignHor = IW_2D_FONT_ALIGN_LEFT; labelLeft->m_X += 10; labelLeft->m_Color = CColor(114, 114, 114, 0xff); labelRight = new CLabel(); labelRight->m_Font = g_pResources->getBannerFontSmall(); labelRight->m_Text = "Events"; labelRight->m_Y = IwGxGetDisplayHeight() / 6.5; labelRight->m_W = IwGxGetDisplayWidth() / 2; labelRight->m_AlignHor = IW_2D_FONT_ALIGN_RIGHT; labelRight->m_X += (IwGxGetDisplayWidth() / 2.0) -10; labelRight->m_Color = CColor(114, 114, 114, 0xff); labelMain = new CLabel(); labelMain->m_Font = g_pResources->getBannerFontLarge(); labelMain->m_Text = "News"; labelMain->m_Y = IwGxGetDisplayHeight() / 7.5; labelMain->m_W = IwGxGetDisplayWidth(); labelMain->m_AlignHor = IW_2D_FONT_ALIGN_CENTRE; AddChild(banner); AddChild(whiteBanner); AddChild(header); AddChild(labelRight); AddChild(labelLeft); AddChild(playWrapper); AddChild(playButton); AddChild(stopButton); AddChild(labelMain); AddChild(facebook); AddChild(twitter); stopButton->m_X = IwGxGetScreenWidth() * 2.0; currentPage = 0; }
开发者ID:ghmeier,项目名称:RadioApp,代码行数:101,
示例24: Boundsvoid PasswordWindow::_Setup(){ BRect bounds = Bounds(); BView* topView = new BView(bounds, "topView", B_FOLLOW_ALL, B_WILL_DRAW); topView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); AddChild(topView); bounds.InsetBy(10.0, 10.0); fUseNetwork = new BRadioButton(bounds, "useNetwork", "Use network password", new BMessage(kMsgPasswordTypeChanged), B_FOLLOW_NONE); topView->AddChild(fUseNetwork); fUseNetwork->ResizeToPreferred(); fUseNetwork->MoveBy(10.0, 0.0); bounds.OffsetBy(0.0, fUseNetwork->Bounds().Height()); BBox *customBox = new BBox(bounds, "customBox", B_FOLLOW_NONE); topView->AddChild(customBox); fUseCustom = new BRadioButton(BRect(), "useCustom", "Use custom password", new BMessage(kMsgPasswordTypeChanged), B_FOLLOW_NONE); customBox->SetLabel(fUseCustom); fUseCustom->ResizeToPreferred(); fPasswordControl = new BTextControl(bounds, "passwordControl", "Password:", NULL, B_FOLLOW_NONE); customBox->AddChild(fPasswordControl); fPasswordControl->ResizeToPreferred(); fPasswordControl->TextView()->HideTyping(true); fPasswordControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); bounds.OffsetBy(0.0, fPasswordControl->Bounds().Height() + 5.0); fConfirmControl = new BTextControl(bounds, "confirmControl", "Confirm password:", "VeryLongPasswordPossible", B_FOLLOW_NONE); customBox->AddChild(fConfirmControl); fConfirmControl->TextView()->HideTyping(true); fConfirmControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_LEFT); float width, height; fConfirmControl->GetPreferredSize(&width, &height); fPasswordControl->ResizeTo(width, height); fConfirmControl->ResizeTo(width, height); float divider = be_plain_font->StringWidth("Confirm password:") + 5.0; fConfirmControl->SetDivider(divider); fPasswordControl->SetDivider(divider); customBox->ResizeTo(fConfirmControl->Frame().right + 10.0, fConfirmControl->Frame().bottom + 10.0); BButton* button = new BButton(BRect(), "done", "Done", new BMessage(kMsgDone)); topView->AddChild(button); button->ResizeToPreferred(); BRect frame = customBox->Frame(); button->MoveTo(frame.right - button->Bounds().Width(), frame.bottom + 10.0); frame = button->Frame(); button->MakeDefault(true); button = new BButton(frame, "cancel", "Cancel", new BMessage(B_CANCEL)); topView->AddChild(button); button->ResizeToPreferred(); button->MoveBy(-(button->Bounds().Width() + 10.0), 0.0); ResizeTo(customBox->Frame().right + 10.0, frame.bottom + 10.0);}
开发者ID:mariuz,项目名称:haiku,代码行数:67,
示例25: Unload//.........这里部分代码省略......... if( DoesFileExist(sPathToIni) ) { // This is a new style BGAnimation (using .ini) AddLayersFromAniDir( sAniDir, m_SubActors, m_bGeneric ); // TODO: Check for circular load IniFile ini; ini.ReadFile( sPathToIni ); if( !ini.GetValue( "BGAnimation", "LengthSeconds", m_fLengthSeconds ) ) { /* XXX: if m_bGeneric, simply constructing the BG layer won't run "On", * so at this point GetMaxTweenTimeLeft is probably 0 */ m_fLengthSeconds = this->GetTweenTimeLeft(); } bool bUseScroller; if( ini.GetValue( "BGAnimation", "UseScroller", bUseScroller ) && bUseScroller ) { // TODO: Move this into ActorScroller #define REQUIRED_GET_VALUE( szName, valueOut ) / if( !ini.GetValue( "Scroller", szName, valueOut ) ) / Dialog::OK( ssprintf("File '%s' is missing the value Scroller::%s", sPathToIni.c_str(), szName) ); float fSecondsPerItem = 1; int iNumItemsToDraw = 7; RageVector3 vRotationDegrees = RageVector3(0,0,0); RageVector3 vTranslateTerm0 = RageVector3(0,0,0); RageVector3 vTranslateTerm1 = RageVector3(0,0,0); RageVector3 vTranslateTerm2 = RageVector3(0,0,0); float fItemPaddingStart = 0; float fItemPaddingEnd = 0; REQUIRED_GET_VALUE( "SecondsPerItem", fSecondsPerItem ); REQUIRED_GET_VALUE( "NumItemsToDraw", iNumItemsToDraw ); REQUIRED_GET_VALUE( "RotationDegreesX", vRotationDegrees[0] ); REQUIRED_GET_VALUE( "RotationDegreesY", vRotationDegrees[1] ); REQUIRED_GET_VALUE( "RotationDegreesZ", vRotationDegrees[2] ); REQUIRED_GET_VALUE( "TranslateTerm0X", vTranslateTerm0[0] ); REQUIRED_GET_VALUE( "TranslateTerm0Y", vTranslateTerm0[1] ); REQUIRED_GET_VALUE( "TranslateTerm0Z", vTranslateTerm0[2] ); REQUIRED_GET_VALUE( "TranslateTerm1X", vTranslateTerm1[0] ); REQUIRED_GET_VALUE( "TranslateTerm1Y", vTranslateTerm1[1] ); REQUIRED_GET_VALUE( "TranslateTerm1Z", vTranslateTerm1[2] ); REQUIRED_GET_VALUE( "TranslateTerm2X", vTranslateTerm2[0] ); REQUIRED_GET_VALUE( "TranslateTerm2Y", vTranslateTerm2[1] ); REQUIRED_GET_VALUE( "TranslateTerm2Z", vTranslateTerm2[2] ); REQUIRED_GET_VALUE( "ItemPaddingStart", fItemPaddingStart ); REQUIRED_GET_VALUE( "ItemPaddingEnd", fItemPaddingEnd );#undef REQUIRED_GET_VALUE ActorScroller::Load( fSecondsPerItem, iNumItemsToDraw, vRotationDegrees, vTranslateTerm0, vTranslateTerm1, vTranslateTerm2 ); ActorScroller::SetCurrentAndDestinationItem( int(-fItemPaddingStart) ); ActorScroller::SetDestinationItem( int(m_SubActors.size()-1+fItemPaddingEnd) ); } CString InitCommand; if( ini.GetValue( "BGAnimation", "InitCommand", InitCommand ) ) { /* There's an InitCommand. Run it now. This can be used to eg. change Z to * modify draw order between BGAs in a Foreground. Most things should be done * in metrics.ini commands, not here. */ this->Command( InitCommand ); } } else { // This is an old style BGAnimation (not using .ini) // loading a directory of layers CStringArray asImagePaths; ASSERT( sAniDir != "" ); GetDirListing( sAniDir+"*.png", asImagePaths, false, true ); GetDirListing( sAniDir+"*.jpg", asImagePaths, false, true ); GetDirListing( sAniDir+"*.gif", asImagePaths, false, true ); GetDirListing( sAniDir+"*.avi", asImagePaths, false, true ); GetDirListing( sAniDir+"*.mpg", asImagePaths, false, true ); GetDirListing( sAniDir+"*.mpeg", asImagePaths, false, true ); GetDirListing( sAniDir+"*.sprite", asImagePaths, false, true ); SortCStringArray( asImagePaths ); for( unsigned i=0; i<asImagePaths.size(); i++ ) { const CString sPath = asImagePaths[i]; if( Basename(sPath).Left(1) == "_" ) continue; // don't directly load files starting with an underscore BGAnimationLayer* pLayer = new BGAnimationLayer( m_bGeneric ); pLayer->LoadFromAniLayerFile( asImagePaths[i] ); AddChild( pLayer ); } }}
开发者ID:augustg,项目名称:stepmania-3.9,代码行数:101,
示例26: BViewAppView::AppView(BRect r) : BView(r, "TimeBombView", B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED){ time_t now; struct tm *ptr; int loop=0; cd = new D_CD(); cd->Init(settings.CDdevice); //Set up program settings FirstRun = true; min = hour = ampm = 90; TimeUp = false; CDPlaying = false; LastMin = 90; LastHour = 90; RingCount = 0; WhichAlarm = 0; //Set up and add the string view used to display the current time appSV = new BStringView(BRect(r.left,r.top+24,r.right,r.top+48), "TimeString", "", B_FOLLOW_NONE, B_WILL_DRAW); appSV->SetHighColor(settings.FontColor); appSV->SetFontSize(24); appSV->SetAlignment(B_ALIGN_CENTER); AddChild(appSV); //Now get the current time and display it time(&now); ptr = localtime(&now); strftime(buf1,3,"%I",ptr); hour = atoi(buf1); strftime(buf1,3,"%M",ptr); min = atoi(buf1); strftime(buf1,3,"%p",ptr); if(strcmp(buf1,"AM") == 0) ampm = 0; else ampm = 1; for(loop=0;loop<(signed)strlen(buf1);loop++) { buf1[loop]=tolower(buf1[loop]); }//end for loop convert to lowercase if(min<10) sprintf(totaltime,"%d:%d%d %s",hour,0,min,buf1); else sprintf(totaltime,"%d:%d %s",hour,min,buf1); LastMin = min; LastHour = hour; appSV->SetText(totaltime); //Set up and add the string view used to display the current time messageSV = new BStringView(BRect(r.left,r.top+44,r.right,r.top+65), "MessageString", "", B_FOLLOW_NONE, B_WILL_DRAW); messageSV->SetHighColor(settings.FontColor); messageSV->SetFontSize(14); messageSV->SetAlignment(B_ALIGN_CENTER); AddChild(messageSV); Invalidate(); //Re-Draw view }// end AppView
开发者ID:HaikuArchives,项目名称:TimeBomb,代码行数:71,
示例27: BGroupViewConfigView::ConfigView(TranslatorSettings *settings) : BGroupView("ICNSTranslator Settings", B_VERTICAL, 0){ fSettings = settings; BAlignment leftAlignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_UNSET); BStringView *stringView = new BStringView("title", "OptiPNG Translator"); stringView->SetFont(be_bold_font); stringView->SetExplicitAlignment(leftAlignment); AddChild(stringView); float spacing = be_control_look->DefaultItemSpacing(); AddChild(BSpaceLayoutItem::CreateVerticalStrut(spacing)); char version[256]; sprintf(version, "Version %d.%d.%d, %s", int(B_TRANSLATION_MAJOR_VERSION(OPTIPNG_TRANSLATOR_VERSION)), int(B_TRANSLATION_MINOR_VERSION(OPTIPNG_TRANSLATOR_VERSION)), int(B_TRANSLATION_REVISION_VERSION(OPTIPNG_TRANSLATOR_VERSION)), __DATE__); stringView = new BStringView("version", version); stringView->SetExplicitAlignment(leftAlignment); AddChild(stringView); stringView = new BStringView("my_copyright", B_UTF8_COPYRIGHT "2013 Luke <[email C++ AddCommand函数代码示例 C++ AddChannel函数代码示例
|