本文整理汇总了C++中TDrawBuffer::putAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ TDrawBuffer::putAttribute方法的具体用法?C++ TDrawBuffer::putAttribute怎么用?C++ TDrawBuffer::putAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDrawBuffer
的用法示例。
在下文中一共展示了TDrawBuffer::putAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void TProgressBar::draw() {
char string[4];
sprintf(string,"%d",curPercent);
string[3] = '\0';
if(curPercent<10) {
string[2] = string[0];
string[1] = string[0] = ' ';
}
else if(curPercent<100 && curPercent>9) {
string[2] = string[1];
string[1] = string[0];
string[0] = ' ';
}
TDrawBuffer nbuf;
uchar colorNormal, colorHiLite;
colorNormal = getColor(1);
uchar fore = colorNormal >>4; // >>4 is same as /16
colorHiLite = fore+((colorNormal-(fore<<4))<<4); // <<4 is same as *16
nbuf.moveChar(0,backChar,colorNormal,size.x);
nbuf.moveStr(numOffset,string,colorNormal);
nbuf.moveStr(numOffset+3," %",colorNormal);
unsigned i;
for(i=0;i<curWidth;i++)
nbuf.putAttribute(i,colorHiLite);
writeLine(0, 0, size.x, 1, nbuf);
}
示例2: draw
void TColorSelector::draw() {
TDrawBuffer b;
b.moveChar(0, ' ', 0x70, size.x);
for (int i = 0; i <= size.y; i++) {
if (i < 4) {
for (int j = 0; j < 4; j++) {
int c = i * 4 + j;
b.moveChar(j * 3, icon, c, 3);
if (c == color) {
b.putChar(j * 3 + 1, 8);
if (c == 0)
b.putAttribute(j * 3 + 1, 0x70);
}
}
}
writeLine(0, i, size.x, 1, b);
}
}
示例3: drawState
void TButton::drawState(Boolean down)
{
ushort cButton, cShadow;
char ch;
int i;
TDrawBuffer b;
if( (state & sfDisabled) != 0 )
cButton = getColor(0x0404);
else
{
cButton = getColor(0x0501);
if( (state & sfActive) != 0 )
if( (state & sfSelected) != 0 )
cButton = getColor(0x0703);
else if( amDefault )
cButton = getColor(0x0602);
}
cShadow = getColor(8);
int s = size.x-1;
int T = size.y / 2 - 1;
for( int y = 0; y <= size.y-2; y++ )
{
b.moveChar( 0, ' ', cButton, size.x );
b.putAttribute( 0, cShadow );
if( down )
{
b.putAttribute( 1, cShadow );
ch = ' ';
i = 2;
}
else
{
b.putAttribute( s, cShadow );
if( showMarkers == True )
ch = ' ';
else
{
if( y == 0 )
b.putChar( s, shadows[0] );
else
b.putChar( s, shadows[1] );
ch = shadows[2];
}
i = 1;
}
if( y == T && title != 0 )
drawTitle( b, s, i, cButton, down );
if( showMarkers && !down )
{
b.putChar( 1, markers[0] );
b.putChar( s-1, markers[1] );
}
writeLine( 0, y, size.x, 1, b );
}
b.moveChar( 0, ' ', cShadow, 2 );
b.moveChar( 2, ch, cShadow, s-1 );
writeLine( 0, size.y-1, size.x, 1, b );
}