BookModel::Label BookModel::label(const std::string &id) const { if (!myHyperlinkMatcher.isNull()) { return myHyperlinkMatcher->match(myInternalHyperlinks, id); } std::map<std::string,Label>::const_iterator it = myInternalHyperlinks.find(id); return (it != myInternalHyperlinks.end()) ? it->second : Label(0, -1); }
/*------------------------------------------------------------------------------*\ ( ) - \*------------------------------------------------------------------------------*/ float BmCheckControl::LabelWidth() { const char* label = Label(); if (!label) return 0; BFont font; GetFont( &font); return font.StringWidth( label); }
void CPUButton::_InitData() { fOffColor.red = fOffColor.green = fOffColor.blue = 184; fOffColor.alpha = 255; fCPU = atoi(Label()) - 1; }
QuestionInputDialog::QuestionInputDialog(Window* p_parent) : Window(p_parent,MODE_POPUP,SIZE_CENTER) { VBoxContainer * vb=GUI_NEW( VBoxContainer ); set_root_frame(vb); l=vb->add( GUI_NEW( Label("Question")) ); button_hbox = vb->add( GUI_NEW(CenterContainer) )->set( GUI_NEW( HBoxContainer) ); button_hbox->set_separation(5); };
// Draw void IconOptionsControl::Draw(BRect updateRect) { FillRect(updateRect, B_SOLID_LOW); if (Label()) { if (!IsEnabled()) SetHighColor(tint_color(LowColor(), B_DISABLED_LABEL_TINT)); else SetHighColor(tint_color(LowColor(), B_DARKEN_MAX_TINT)); font_height fh; GetFontHeight(&fh); BPoint p(Bounds().LeftTop()); p.y += floorf(Bounds().Height() / 2.0 + (fh.ascent + fh.descent) / 2.0) - 2.0; DrawString(Label(), p); } }
Variant SceneTreeEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) { if (!can_rename) return Variant(); //not editable tree Vector<Node *> selected; Vector<Ref<Texture> > icons; TreeItem *next = tree->get_next_selected(NULL); while (next) { NodePath np = next->get_metadata(0); Node *n = get_node(np); if (n) { // Only allow selection if not part of an instanced scene. if (!n->get_owner() || n->get_owner() == get_scene_node() || n->get_owner()->get_filename() == String()) { selected.push_back(n); icons.push_back(next->get_icon(0)); } } next = tree->get_next_selected(next); } if (selected.empty()) return Variant(); VBoxContainer *vb = memnew(VBoxContainer); Array objs; int list_max = 10; float opacity_step = 1.0f / list_max; float opacity_item = 1.0f; for (int i = 0; i < selected.size(); i++) { if (i < list_max) { HBoxContainer *hb = memnew(HBoxContainer); TextureRect *tf = memnew(TextureRect); tf->set_texture(icons[i]); hb->add_child(tf); Label *label = memnew(Label(selected[i]->get_name())); hb->add_child(label); vb->add_child(hb); hb->set_modulate(Color(1, 1, 1, opacity_item)); opacity_item -= opacity_step; } NodePath p = selected[i]->get_path(); objs.push_back(p); } set_drag_preview(vb); Dictionary drag_data; drag_data["type"] = "nodes"; drag_data["nodes"] = objs; tree->set_drop_mode_flags(Tree::DROP_MODE_INBETWEEN | Tree::DROP_MODE_ON_ITEM); emit_signal("nodes_dragged"); return drag_data; }
void MediaListItem::DrawItem(BView* owner, BRect frame, bool complete) { Renderer renderer; renderer.SetSelected(IsSelected()); renderer.SetTitle(Label()); SetRenderParameters(renderer); renderer.Render(owner, frame, complete); }
void ArpMenuField::ComputeDimens(ArpDimens& cur_dimens) { BMenu* menu = MenuBar(); BMenu* popup = Menu(); if( menu ) { copy_attrs(menu); copy_attrs(popup); menu->SetFont(&PV_MenuFont); menu->InvalidateLayout(); } get_view_dimens(&cur_dimens, this, false); font_height fhs; BasicFont()->GetHeight(&fhs); const float fh = fhs.ascent+fhs.descent+fhs.leading; float fw = BasicFont()->StringWidth("WWWW"); float pref_w=0; if( popup ) { int32 num = popup->CountItems(); for( int32 i=0; i<num; i++ ) { BMenuItem* item = popup->ItemAt(i); if( item ) { const float w=BasicFont()->StringWidth(item->Label()); ArpD(cdb << ADH << "Dimensions for popup label " << item->Label() << ": " << w << endl); if( w > pref_w ) pref_w = w; } } } cur_dimens.Y().SetTo(0, fh+12, fh+12, fh+12, 0); float labelWidth = (Label() && *Label()) ? BasicFont()->StringWidth(Label()) + BasicFont()->StringWidth(" ") : 0; cur_dimens.X().SetTo(labelWidth, (fw < pref_w ? fw : pref_w) + 20, pref_w + 20, pref_w + 20, 0); }
void BAbstractSpinner::_InitObject() { fAlignment = B_ALIGN_LEFT; fButtonStyle = SPINNER_BUTTON_PLUS_MINUS; if (Label() != NULL) { fDivider = StringWidth(Label()) + be_control_look->DefaultLabelSpacing(); } else fDivider = 0.0f; BControl::SetEnabled(true); BControl::SetValue(0); BRect rect(Bounds()); fLayoutData = new LayoutData(rect.Width(), rect.Height()); rect.left = fDivider; rect.InsetBy(kFrameMargin, kFrameMargin); rect.right -= rect.Height() * 2 + kFrameMargin * 2 + 1.0f; BRect textRect(rect.OffsetToCopy(B_ORIGIN)); fTextView = new SpinnerTextView(rect, textRect); AddChild(fTextView); rect.InsetBy(0.0f, -kFrameMargin); rect.left = rect.right + kFrameMargin * 2; rect.right = rect.left + rect.Height() - kFrameMargin * 2; fDecrement = new SpinnerButton(rect, "decrement", SPINNER_DECREMENT); AddChild(fDecrement); rect.left = rect.right + 1.0f; rect.right = rect.left + rect.Height() - kFrameMargin * 2; fIncrement = new SpinnerButton(rect, "increment", SPINNER_INCREMENT); AddChild(fIncrement); uint32 navigableFlags = Flags() & B_NAVIGABLE; if (navigableFlags != 0) BControl::SetFlags(Flags() & ~B_NAVIGABLE); }
void BChannelSlider::Draw(BRect updateRect) { _UpdateFontDimens(); _DrawThumbs(); BRect bounds(Bounds()); if (Label()) { float labelWidth = StringWidth(Label()); DrawString(Label(), BPoint((bounds.Width() - labelWidth) / 2.0, fBaseLine)); } if (MinLimitLabel()) { if (fIsVertical) { if (MinLimitLabel()) { float x = (bounds.Width() - StringWidth(MinLimitLabel())) / 2.0; DrawString(MinLimitLabel(), BPoint(x, bounds.bottom - kPadding)); } } else { if (MinLimitLabel()) { DrawString(MinLimitLabel(), BPoint(kPadding, bounds.bottom - kPadding)); } } } if (MaxLimitLabel()) { if (fIsVertical) { if (MaxLimitLabel()) { float x = (bounds.Width() - StringWidth(MaxLimitLabel())) / 2.0; DrawString(MaxLimitLabel(), BPoint(x, 2 * fLineFeed)); } } else { if (MaxLimitLabel()) { DrawString(MaxLimitLabel(), BPoint(bounds.right - kPadding - StringWidth(MaxLimitLabel()), bounds.bottom - kPadding)); } } } }
double * GauMatEl::readRec(int rec){ bool found = false; std::string FileTerm = "END"; FileTerm.resize(LEN_GAU_STR,' '); infile_.seekg(this->lenInit_,infile_.beg); while(!infile_.eof()){ int *ID = NULL; double *DX = NULL; std::string Label(LEN_GAU_STR,'\0'); int NI, NR, NTot, NPerRec, N1, N2, N3, N4, N5, ISym; infile_.read(&Label[0], LEN_GAU_STR ); if(!Label.compare(FileTerm)) break; infile_.read((char*)&NI, sizeof(int) ); infile_.read((char*)&NR, sizeof(int) ); infile_.read((char*)&NTot, sizeof(int) ); infile_.read((char*)&NPerRec,sizeof(int) ); infile_.read((char*)&N1, sizeof(int) ); infile_.read((char*)&N2, sizeof(int) ); infile_.read((char*)&N3, sizeof(int) ); infile_.read((char*)&N4, sizeof(int) ); infile_.read((char*)&N5, sizeof(int) ); infile_.read((char*)&ISym, sizeof(int) ); int NRec = (NTot+NPerRec-1)/NPerRec; ID = new int[NRec*NI*NPerRec]; DX = new double[NRec*NR*NPerRec]; for(auto iRec = 0; iRec < NRec; iRec++){ if(NI != 0) { infile_.read((char*)(ID+iRec*NI*NPerRec),NI*NPerRec*sizeof(int)); } if(NR > 0) { infile_.read((char*)(DX+iRec*NR*NPerRec),NR*NPerRec*sizeof(double)); } } if(!Label.compare(GauHeader[rec])){ double *data = new double[NTot]; for(auto i = 0; i < NTot; i++){ data[i] = DX[i]; } found = true; delete [] ID; delete [] DX; return data; break; } delete [] ID; delete [] DX; } //if(found) std::cout << "FOUND " << GauHeader[rec] << std::endl; }
//======================================================================= //function : Execute //purpose : //======================================================================= Standard_Integer GEOMImpl_SphereDriver::Execute(TFunction_Logbook& log) const { if (Label().IsNull()) return 0; Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label()); GEOMImpl_ISphere aCI (aFunction); Standard_Integer aType = aFunction->GetType(); TopoDS_Shape aShape; char aMsg[] = "Sphere creation aborted: radius value less than 1e-07 is not acceptable"; if (aType == SPHERE_R) { double anR = aCI.GetR(); if (anR < Precision::Confusion()) Standard_ConstructionError::Raise(aMsg); aShape = BRepPrimAPI_MakeSphere(anR).Shape(); } else if (aType == SPHERE_PNT_R) { double anR = aCI.GetR(); if (anR < Precision::Confusion()) Standard_ConstructionError::Raise(aMsg); Handle(GEOM_Function) aRefPoint = aCI.GetPoint(); TopoDS_Shape aShapePnt = aRefPoint->GetValue(); if (aShapePnt.ShapeType() != TopAbs_VERTEX) Standard_ConstructionError::Raise("Invalid shape given for sphere center: it must be a point"); gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt)); aShape = BRepPrimAPI_MakeSphere(aP, anR).Shape(); } else { } if (aShape.IsNull()) return 0; aFunction->SetValue(aShape); log.SetTouched(Label()); return 1; }
void MainTask(void) { GUI_Init(); GUI_MEMDEV_Load(); Label(); while(1) { DemoRandomGraph(); DemoSineWave(); DemoOrData(); } }
/*public*/ void Node::setLabel(int argIndex, int onLocation) { if ( label.isNull() ) { label = Label(argIndex, onLocation); } else label.setLocation(argIndex, onLocation); testInvariant(); }
static void GlobalOptReal( char *name, double *value ) { EXPR *expr ; expr = Label( name ) ; expr = ExprGetDefinition( expr ) ; if( !expr ) return ; *value = ExprValue( expr ) ; }
static void GlobalOptInt( char *name, int *value ) { EXPR *expr ; expr = Label( name ) ; expr = ExprGetDefinition( expr ) ; if( !expr ) return ; *value = (int) ExprValue( expr ) ; }
TextButton::TextButton(const std::string &text, sf::Font& font, Widget *parent) :Button(parent), _label(text, font, nullptr){ _label = Label (text, font, this); setFillColor(sf::Color(153,204,255)); setOutlineThickness(2); setOutlineColor(sf::Color(0,153,153)); }
void FreeSpaceBar::DrawText(QPainter* p, const QRect& r) { QFont small_font(font()); small_font.setPointSize(small_font.pointSize() - 1); small_font.setBold(true); QFontMetrics small_metrics(small_font); p->setFont(small_font); // Work out the geometry for the text QList<Label> labels; labels << Label(TextForSize(used_text_, total_ - free_), kColorBar1); if (additional_) labels << Label(TextForSize(additional_text_, additional_), kColorAdd1); labels << Label(TextForSize(free_text_, free_ - additional_), kColorBg2); int text_width = 0; for (const Label& label : labels) { text_width += kLabelBoxSize + kLabelBoxPadding + kLabelSpacing + small_metrics.width(label.text); } // Draw the text int x = (r.width() - text_width) / 2; p->setRenderHint(QPainter::Antialiasing, false); for (const Label& label : labels) { const bool light = palette().color(QPalette::Base).value() > 128; QRect box(x, r.top() + (r.height() - kLabelBoxSize) / 2, kLabelBoxSize, kLabelBoxSize); p->setPen(label.color.darker()); p->setBrush(label.color); p->drawRect(box); QRect text(x + kLabelBoxSize + kLabelBoxPadding, r.top(), small_metrics.width(label.text), r.height()); p->setPen(light ? label.color.darker() : label.color); p->drawText(text, Qt::AlignCenter, label.text); x += kLabelBoxSize + kLabelBoxPadding + kLabelSpacing + small_metrics.width(label.text); } }
CheckBox::CheckBox(int _x, int _y, bool _selected, Panel* _parent, const char* labelText) { selected = _selected; parent = _parent; selTexture = SDL_LoadBMP("selct.bmp"); desTexture = SDL_LoadBMP("dslct.bmp"); position.x = parent->width - (parent->width - _x); position.y = parent->height - (parent->height - _y); black = { 0, 0, 0 }; label = Label(position.x + selTexture->w, position.y, labelText, black, parent); }
/*------------------------------------------------------------------------------*\ ( ) - \*------------------------------------------------------------------------------*/ void BmCheckControl::_InitSize() { ResizeToPreferred(); float width, height; GetPreferredSize(&width, &height); // if there's no label, just use the space required for the checkbox if (Label() == NULL) ct_mpm = minimax(17, int(height), 17, int(height)); else ct_mpm = minimax(int(width), int(height), 1E5, int(height)); }
extern void BEFiniBack( b *bk ) { //=================================== Action( "BEFiniBack" ); if( !IS_REAL_BACK( bk ) ) { Action( "( %s )%n", FEName( TO_REAL_BACK( bk )->s ) ); return; } VerBack(bk); Action( "( %s [ %s ] )%n", FEName( bk->s ), Label( bk->lp ) ); }
Group::Group() : freq_label(Label("f")), freq_slider(220, 1000), phase_label(Label("φ")), phase_slider((int)(100 * PI), (int)(2 * 100 * PI)), /* -π .. π */ gain_label(Label("Gain")), gain_slider(33, 100), /* 0.0 .. 1.0 */ pan_label(Label("Pan")), pan_slider(100, 200), /* -1.0 .. 1.0 */ t(0.0), last_gain(-10000), last_pan(-10000) { /* Order must correspond with Waveform. */ list.append_item("Off"); list.append_item("Sine"); list.append_item("Square"); list.append_item("Triangle"); list.append_item("Sawtooth"); }
wxString RibbonPanelWrapper::CppCtorCode() const { wxString cppCode; wxcCodeGeneratorHelper::Get().AddBitmap(PropertyFile(PROP_BITMAP_PATH)); cppCode << GetName() << " = new " << GetRealClassName() << "(" << GetWindowParent() << ", " << GetId() << ", " << Label() << ", " << wxcCodeGeneratorHelper::Get().BitmapCode(PropertyFile(PROP_BITMAP_PATH)) << ", " << "wxDefaultPosition, " << SizeAsString() << ", " << StyleFlags("wxRIBBON_PANEL_DEFAULT_STYLE") << ");\n"; cppCode << CPPCommonAttributes(); return cppCode; }
void BRadioButton::GetPreferredSize(float* _width, float* _height) { font_height fontHeight; GetFontHeight(&fontHeight); if (_width) { BRect rect = _KnobFrame(fontHeight); float width = rect.right + floorf(ceilf(fontHeight.ascent + fontHeight.descent) / 2.0); if (Label()) width += StringWidth(Label()); *_width = ceilf(width); } if (_height) *_height = ceilf(fontHeight.ascent + fontHeight.descent) + 6.0; }
void CAgnAttachment::ExternalizeL(RWriteStream& aStream) const { aStream.WriteUint8L(Type()); aStream << MimeType(); aStream.WriteUint32L(iUid); aStream.WriteUint16L(iAttributes); aStream.WriteUint16L(iFlags); aStream.WriteInt32L(iSize); aStream << Label(); }
void TWindowMenuItem::DrawContent() { BMenu* menu = Menu(); BPoint contentLocation = ContentLocation() + BPoint(kHPad, 0); if (fID >= 0) { menu->SetDrawingMode(B_OP_OVER); float width = fBitmap->Bounds().Width(); if (width > 16) contentLocation.x -= 8; float height; GetContentSize(NULL, &height); contentLocation.y += (height - fBitmap->Bounds().Height()) / 2; menu->MovePenTo(contentLocation); menu->DrawBitmapAsync(fBitmap); if (width > 16) contentLocation.x += 8; contentLocation.x += kIconRect.Width() + kLabelOffset; } contentLocation.y = ContentLocation().y + kVPad + fLabelAscent; menu->SetDrawingMode(B_OP_COPY); menu->MovePenTo(contentLocation); if (IsSelected()) menu->SetHighColor(ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR)); else menu->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR)); float labelWidth = menu->StringWidth(Label()); BPoint penLocation = menu->PenLocation(); float offset = penLocation.x - Frame().left; menu->DrawString(Label(labelWidth + offset)); }
void StringItem::DrawItem( View *owner, Rect frame ) { if ( isSelected() ) { owner->FillRect( frame, 0x404050 ); owner->DrawRect( frame, 0 ); } else { owner->FillRect( frame, 0xAAAAAA ); } if ( Label() == NULL ) return; if ( Width() <= frame.Width() ) { owner->DrawString( frame.left + 2, frame.top + 2, (char*)Label(), 0x0 ); return; } int playfield = frame.Width() - 2 - 2; // we have playfield area left to show our text.. playfield = playfield / 8; for ( int i = 0; i < playfield; i++ ) { char letter[2]; letter[0] = m_label[i]; letter[1] = 0; owner->DrawString( frame.left + 2 + i * 8, frame.top + 2, letter, 0x0 ); } }
//========================================================= bool Parser::DelimitedStatement () { PrintRule rule("DelimitedStatement"); return rule.Accept( Label() || Goto() || Return() || Accept(TokenType::Break) || Accept(TokenType::Continue) || Var() || Expression() ); }
void BTextControl::ResizeToPreferred() { BView::ResizeToPreferred(); fDivider = 0.0; const char* label = Label(); if (label) fDivider = ceil(StringWidth(label)) + 2.0; _LayoutTextView(); }
int Assembler::AddLabel(string& name, LabelVector& labels) { int index = 0; LabelVector::iterator i; for (i = labels.begin(); i != labels.end(); i ++, index ++) { if(i->label == name) return index; } labels.push_back(Label(name)); return index; }