本文整理汇总了C++中Text函数的典型用法代码示例。如果您正苦于以下问题:C++ Text函数的具体用法?C++ Text怎么用?C++ Text使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Text函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: splitText
Text splitText(int offset)
{
return Text(tImpl()->splitText(offset));
} // splitText
示例2: Text
glt::Text glt::makeSegoeUI(size_t buffers, size_t capacity)
{
auto bitmap = glt::BitmapFont(segoeui.data(), segoeui.size());
return Text(bitmap, buffers, capacity);
}
示例3: BMessage
void URLView::DoPersonDrag() {
// Handle all of the bookmark dragging. This includes setting up
// the drag message and drawing the dragged bitmap.
// Set up the drag message to support both BTextView dragging (using
// the e-mail address) and file dropping (to Tracker).
BMessage *dragMessage = new BMessage( B_MIME_DATA );
dragMessage->AddInt32( "be:actions", B_COPY_TARGET );
dragMessage->AddString( "be:types", "application/octet-stream" );
dragMessage->AddString( "be:filetypes", "application/x-person" );
dragMessage->AddString( "be:type_descriptions", "person" );
dragMessage->AddString( "be:clip_name", Text() );
// This allows the user to drag the e-mail address into a
// standard BTextView.
BString email = GetImportantURL();
dragMessage->AddData( "text/plain", B_MIME_DATA, email.String(),
email.Length() + 1 );
// Query for the system's icon for bookmarks.
BBitmap *personIcon = new BBitmap( BRect( 0, 0, iconSize - 1,
iconSize - 1 ), B_CMAP8 );
#ifdef ZETA
BMimeType mime( "application/x-vnd.Be-PEPL" );
#else
BMimeType mime( "application/x-person" );
#endif
if( iconSize == 16 ) mime.GetIcon( personIcon, B_MINI_ICON );
else mime.GetIcon( personIcon, B_LARGE_ICON );
// Find the size of the bitmap to drag. If the text is bigger than the
// icon, use that size. Otherwise, use the icon's. Center the icon
// vertically in the bitmap.
BRect rect = GetTextRect();
rect.right += iconSize + 4;
if( (rect.bottom - rect.top) < iconSize ) {
int adjustment = (int) ((iconSize - (rect.bottom - rect.top)) / 2) + 1;
rect.top -= adjustment;
rect.bottom += adjustment;
}
// Make sure the rectangle starts at 0,0.
rect.bottom += 0 - rect.top;
rect.top = 0;
// Create the bitmap to draw the dragged image in.
BBitmap *dragBitmap = new BBitmap( rect, B_RGBA32, true );
BView *dragView = new BView( rect, "Drag View", 0, 0 );
dragBitmap->Lock();
dragBitmap->AddChild( dragView );
BRect frameRect = dragView->Frame();
// Make the background of the dragged image transparent.
dragView->SetHighColor( B_TRANSPARENT_COLOR );
dragView->FillRect( frameRect );
// We want 'g's, etc. to go below the underline. When the BeOS can
// do underlining of any font, this code can be removed.
font_height height;
GetFontHeight( &height );
float descent = height.descent;
// Find the vertical center of the view so we can vertically
// center everything.
int centerPixel = (int) ((frameRect.bottom - frameRect.top) / 2);
int textCenter = (int) (descent + underlineThickness) + centerPixel;
// We want to draw everything only half opaque.
dragView->SetDrawingMode( B_OP_ALPHA );
dragView->SetHighColor( 0.0, 0.0, 0.0, 128.0 );
dragView->SetBlendingMode( B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE );
// Center the icon in the view.
dragView->MovePenTo( BPoint( frameRect.left,
centerPixel - (iconSize / 2) ) );
dragView->DrawBitmap( personIcon );
// Draw the text in the same font (size, etc.) as the link view.
// Note: DrawString() draws the text at one pixel above the pen's
// current y coordinate.
BFont font;
GetFont( &font );
dragView->SetFont( &font );
dragView->MovePenTo( BPoint( frameRect.left + iconSize + 4, textCenter ) );
dragView->DrawString( Text() );
// Be sure to flush the view buffer so everything is drawn.
dragView->Flush();
dragBitmap->Unlock();
// The Person icon adds some width to the bitmap that we are
// going to draw. So horizontally offset the bitmap proportionally
// to where the user clicked on the link.
float horiz = dragOffset.x / GetTextRect().Width();
dragOffset.x = horiz * frameRect.right;
DragMessage( dragMessage, dragBitmap, B_OP_ALPHA,
BPoint( dragOffset.x,
(rect.Height() + underlineThickness) / 2 + 2), this );
//.........这里部分代码省略.........
示例4: MbrIntersects
void SpatiaLiteDB::queryGeometry(
std::string table,
std::string geometry_col,
double left,
double bottom,
double right,
double top,
std::string label_col) {
_pointlist.clear();
_linestringlist.clear();
_polygonlist.clear();
bool getLabel = label_col.size() != 0;
// Search for geometry and name
// The query will be either
//
// SELECT Geometry FROM table WHERE MbrWithin(Column, BuildMbr(left, bottom, right, top));
// or
// SELECT Geometry,Label FROM table WHERE MbrWithin(Column, BuildMbr(left, bottom, right, top));
//
// where Geometry is the geometry column name and Label is the column containing a name or label.
std::string label;
if (getLabel) {
label = "," + label_col;
}
std::stringstream s;
s <<
"SELECT " <<
geometry_col <<
label <<
" FROM " <<
table <<
" WHERE MbrIntersects(" <<
geometry_col <<
", BuildMbr(" <<
left <<
"," <<
bottom <<
"," <<
right <<
"," <<
top <<
"));";
// prepare the query
prepare(s.str());
// fetch the next result row
while (step()) {
// get the geometry
gaiaGeomCollPtr geom = Geom(0);
// get the label, if we asked for it
std::string label;
if (getLabel) {
label = Text(1);
}
// the following will create lists for points, lines and polygons found in
// a single geometry. In practice it seems that only one of those types
// exists for a given geometry, but it's not clear if this is a requirement
// or just occurs in the sample databases we have been working with.
PointList points = point_list(geom, label);
for (PointList::iterator i = points.begin(); i != points.end(); i++) {
_pointlist.push_back(*i);
}
LinestringList lines = linestring_list(geom, label);
for (LinestringList::iterator i = lines.begin(); i != lines.end(); i++) {
_linestringlist.push_back(*i);
}
PolygonList polys = polygon_list(geom, label);
for (PolygonList::iterator i = polys.begin(); i != polys.end(); i++) {
_polygonlist.push_back(*i);
}
}
// finish with this query
finalize();
}
示例5: Compound
const Compound operator+(const Item &a, const char * const text)
{
return Compound(a, Text(text));
}
示例6: generator
//Convenience constructor so you can say Item("foo")
Item::Item(const char * const text) : generator(Text(QByteArray(text)).generator) {}
示例7: Text
template <> void XMLWriter_Element::Text<const wchar_t*>(const wchar_t* text, bool cdata)
{
Text( CStrW(text).ToUTF8().c_str(), cdata );
}
示例8: atof
// FloatValue
float
NummericalTextView::FloatValue() const
{
fFloatValueCache = atof(Text());
return fFloatValueCache;
}
示例9: atoi
// IntValue
int32
NummericalTextView::IntValue() const
{
fIntValueCache = atoi(Text());
return fIntValueCache;
}
示例10: LayoutTitle
void LayoutTitle (Layout layout, char *string, int x, int y, double dir) {
float x_sense, y_sense, x_offset;
Display display = layout->display;
char temp[1024], *line;
unsigned int lines = 1, i;
int right_justify = FALSE, center_justify = FALSE;
/* Handle carriage returns. */
for ( i = 0; i < strlen( string ); i++ ) {
if ( string[i] == '\n' ) lines++;
}
x_sense = layout->display_right > layout->display_left ? 1 : -1;
y_sense = layout->display_bottom > layout->display_top ? 1 : -1;
/*
A value less than 0 for x or y implies a keyword.
*/
if (x < 0) {
switch ( (int) x ) {
case (INSIDE_LEFT):
x = layout->display_left;
break;
case (OUTSIDE_LEFT):
x = layout->display_left - x_sense;
right_justify = TRUE;
/* x_sense * TextWidth(display, string); */
break;
case (INSIDE_RIGHT):
x = layout->display_right - 1;
right_justify = TRUE;
/* x_sense * TextWidth(display, string); */
break;
case (OUTSIDE_RIGHT):
x = layout->display_right;
break;
case (CENTER):
x = ( layout->display_left + layout->display_right
- x_sense * TextWidth(display, string)) / 2;
center_justify = TRUE;
break;
default:
fprintf(stderr, "Unknown title x alignment code: %d\n", x);
break;
}
}
if (y < 0) {
switch ( (int) y ) {
case (INSIDE_BOTTOM):
y = layout->display_bottom -
y_sense * ( lines - 1) * TextHeight(display, string);
break;
case (OUTSIDE_BOTTOM):
y = layout->display_bottom +
y_sense * ( TextHeight(display, string) - 2 );
break;
case (INSIDE_TOP):
y = layout->display_top +
y_sense * TextHeight(display, string);
break;
case (OUTSIDE_TOP):
y = layout->display_top;
break;
case (CENTER):
y = ( layout->display_bottom + layout->display_top
+ y_sense * lines * TextHeight(display, string)) / 2;
break;
default:
fprintf(stderr, "Unknown title y alignment code: %d\n", y);
break;
}
}
strcpy( temp, string );
line = strtok( temp, "\n" );
while ( line ) {
if ( right_justify ) x_offset = - x_sense * TextWidth( display, line );
else if ( center_justify ) x_offset = ( - x_sense * TextWidth( display, line )) / 2.0;
//.........这里部分代码省略.........
示例11: Value
// Get integer value
long Value(void)
{
return atol(Text());
}
示例12: strlen
void Painter::Text (Canvas* c, const char* s) {
int len = strlen(s);
Text(c, s, len, curx, cury);
curx += font->Width(s, len);
}
示例13:
// ApplyChanges
void
PopupTextView::ApplyChanges(int32 next)
{
fPopup->TextEdited(Text(), next);
}
示例14: Text
void Painter::Text (Canvas* c, const char* s, int len) {
Text(c, s, len, curx, cury);
curx += font->Width(s, len);
}
示例15: ShowSaver
static void ShowSaver(int Step)
{
for (size_t I=0; I<ARRAYSIZE(Star); I++)
if (Star[I].Type!=STAR_NONE && !(Step%Star[I].Speed))
{
SetColor(F_LIGHTCYAN|B_BLACK);
GotoXY(Star[I].X/100,Star[I].Y/100);
Text(L" ");
int dx=Star[I].X/100-ScrX/2;
Star[I].X+=dx*10+((dx<0) ? -1:1);
int dy=Star[I].Y/100-ScrY/2;
Star[I].Y+=dy*10+((dy<0) ? -1:1);
if (Star[I].X<0 || Star[I].X/100>ScrX || Star[I].Y<0 || Star[I].Y/100>ScrY)
Star[I].Type=STAR_NONE;
else
{
SetColor(Star[I].Color|B_BLACK);
GotoXY(Star[I].X/100,Star[I].Y/100);
if (abs(dx)>3*ScrX/8 || abs(dy)>3*ScrY/8)
{
if (Star[I].Type==STAR_PLANET)
{
SetColor(Star[I].Color|FOREGROUND_INTENSITY|B_BLACK);
Text(StarSymbol[0]);
}
else
{
SetColor(F_WHITE|B_BLACK);
Text(StarSymbol[1]);
}
}
else if (abs(dx)>ScrX/7 || abs(dy)>ScrY/7)
{
if (Star[I].Type==STAR_PLANET)
{
SetColor(Star[I].Color|FOREGROUND_INTENSITY|B_BLACK);
Text(StarSymbol[1]);
}
else
{
if (abs(dx)>ScrX/4 || abs(dy)>ScrY/4)
SetColor(F_LIGHTCYAN|B_BLACK);
else
SetColor(F_CYAN|B_BLACK);
Text(StarSymbol[2]);
}
}
else
{
if (Star[I].Type==STAR_PLANET)
{
SetColor(Star[I].Color|B_BLACK);
Text(StarSymbol[3]);
}
else
{
SetColor(F_CYAN|B_BLACK);
Text(StarSymbol[4]);
}
}
}
}
for (size_t I=0; I<ARRAYSIZE(Star); I++)
if (Star[I].Type==STAR_NONE)
{
static const int Colors[]={F_MAGENTA,F_RED,F_BLUE};
Star[I].Type=random(77)<3 ? STAR_PLANET:STAR_NORMAL;
Star[I].X=(ScrX/2-ScrX/4+random(ScrX/2))*100;
Star[I].Y=(ScrY/2-ScrY/4+random(ScrY/2))*100;
Star[I].Color=Colors[random(ARRAYSIZE(Colors))];
Star[I].Speed=(Star[I].Type==STAR_PLANET) ? 1:2;
break;
}
}