本文整理汇总了C++中Label函数的典型用法代码示例。如果您正苦于以下问题:C++ Label函数的具体用法?C++ Label怎么用?C++ Label使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Label函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: return
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);
}
开发者ID:2php,项目名称:FBReaderJ,代码行数:8,代码来源:BookModel.cpp
示例2: Label
/*------------------------------------------------------------------------------*\
( )
-
\*------------------------------------------------------------------------------*/
float BmCheckControl::LabelWidth() {
const char* label = Label();
if (!label)
return 0;
BFont font;
GetFont( &font);
return font.StringWidth( label);
}
开发者ID:HaikuArchives,项目名称:Beam,代码行数:12,代码来源:BmCheckControl.cpp
示例3: atoi
void
CPUButton::_InitData()
{
fOffColor.red = fOffColor.green = fOffColor.blue = 184;
fOffColor.alpha = 255;
fCPU = atoi(Label()) - 1;
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:8,代码来源:CPUButton.cpp
示例4: Window
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);
};
开发者ID:babymastodon,项目名称:chibitracker,代码行数:8,代码来源:input_dialog.cpp
示例5: FillRect
// 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);
}
}
开发者ID:stippi,项目名称:Clockwerk,代码行数:19,代码来源:IconOptionsControl.cpp
示例6: Variant
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;
}
开发者ID:deliciousfudge,项目名称:godot,代码行数:57,代码来源:scene_tree_editor.cpp
示例7:
void
MediaListItem::DrawItem(BView* owner, BRect frame, bool complete)
{
Renderer renderer;
renderer.SetSelected(IsSelected());
renderer.SetTitle(Label());
SetRenderParameters(renderer);
renderer.Render(owner, frame, complete);
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:9,代码来源:MediaListItem.cpp
示例8: MenuBar
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);
}
开发者ID:HaikuArchives,项目名称:Sequitur,代码行数:44,代码来源:ViewStubs.cpp
示例9: StringWidth
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);
}
开发者ID:bhanug,项目名称:haiku,代码行数:44,代码来源:AbstractSpinner.cpp
示例10: _UpdateFontDimens
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));
}
}
}
}
开发者ID:mmadia,项目名称:Haiku-services-branch,代码行数:44,代码来源:ChannelSlider.cpp
示例11: while
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;
}
开发者ID:nomicflux,项目名称:chronusq_public,代码行数:56,代码来源:gaumatel.cpp
示例12: Handle
//=======================================================================
//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;
}
开发者ID:triggerfish1,项目名称:pythonocc,代码行数:47,代码来源:GEOMImpl_SphereDriver.cpp
示例13: MainTask
void MainTask(void) {
GUI_Init();
GUI_MEMDEV_Load();
Label();
while(1) {
DemoRandomGraph();
DemoSineWave();
DemoOrData();
}
}
开发者ID:byxob,项目名称:calendar,代码行数:10,代码来源:MEMDEV_DrawGraph.c
示例14: Label
/*public*/
void
Node::setLabel(int argIndex, int onLocation)
{
if ( label.isNull() ) {
label = Label(argIndex, onLocation);
} else
label.setLocation(argIndex, onLocation);
testInvariant();
}
开发者ID:drownedout,项目名称:datamap,代码行数:11,代码来源:Node_geomgraph.cpp
示例15: GlobalOptReal
static void GlobalOptReal( char *name, double *value )
{
EXPR *expr ;
expr = Label( name ) ;
expr = ExprGetDefinition( expr ) ;
if( !expr )
return ;
*value = ExprValue( expr ) ;
}
开发者ID:skewray,项目名称:skewray_old,代码行数:10,代码来源:globals.c
示例16: GlobalOptInt
static void GlobalOptInt( char *name, int *value )
{
EXPR *expr ;
expr = Label( name ) ;
expr = ExprGetDefinition( expr ) ;
if( !expr )
return ;
*value = (int) ExprValue( expr ) ;
}
开发者ID:skewray,项目名称:skewray_old,代码行数:10,代码来源:globals.c
示例17: _label
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));
}
开发者ID:kaitokidi,项目名称:JacobsHack,代码行数:10,代码来源:TextButton.cpp
示例18: small_font
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);
}
}
开发者ID:Aceler,项目名称:Clementine,代码行数:42,代码来源:freespacebar.cpp
示例19: SDL_LoadBMP
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);
}
开发者ID:KyleNokes,项目名称:SupplementalProject,代码行数:11,代码来源:CheckBox.cpp
示例20: ResizeToPreferred
/*------------------------------------------------------------------------------*\
( )
-
\*------------------------------------------------------------------------------*/
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));
}
开发者ID:HaikuArchives,项目名称:Beam,代码行数:15,代码来源:BmCheckControl.cpp
注:本文中的Label函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论