• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TDrawBuffer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TDrawBuffer的典型用法代码示例。如果您正苦于以下问题:C++ TDrawBuffer类的具体用法?C++ TDrawBuffer怎么用?C++ TDrawBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TDrawBuffer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: sysErr

short TSystemError::sysErr( short errorCode, uchar drive )
{
    ushort c = ( (TScreen::screenMode & 0x00FF) != TDisplay::smMono  ) ?
                                        sysColorAttr : sysMonoAttr;
    char s[ 63 ];
    TDrawBuffer b;

//  bug-fix TV2B-31 ---------------------------------------
    /* There are 22 documented device errors, all of which have their
     * own strings in errorString[].  However, just in case we run into
     * something weird this will prevent a crash.
     */
//  end of bug-fix. ---------------------------------------
    if( errorCode < (sizeof(errorString) / sizeof(errorString[0])) )
        sprintf( s, errorString[ errorCode ], drive + 'A' );
    else
        sprintf( s, "Unknown critical error %d on drive %c", errorCode, drive + 'A' );

// modification #TV2N-04 ----------------------------------
    // EFW - Modified to be screen size aware.
    b.moveChar( 0, ' ', c, TScreen::screenWidth);
    b.moveCStr( 1, s, c);
    b.moveCStr( TScreen::screenWidth - cstrlen(sRetryOrCancel) - 1,
        sRetryOrCancel, c);
// end of modification ------------------------------------
    swapStatusLine(b);
    int res = selectKey();
    swapStatusLine(b);
    return res;
}
开发者ID:gdobra,项目名称:tvision,代码行数:30,代码来源:SYSERR.cpp


示例2: drawTitle

void TButton::drawTitle( TDrawBuffer &b,
                         int s,
                         int i,
                         ushort cButton,
                         Boolean down
                       )
{
    int l, scOff;
    if( (flags & bfLeftJust) != 0 )
        l = 1;
    else
        {
        l = (s - cstrlen(title) - 1)/2;
        if( l < 1 )
            l = 1;
        }
    b.moveCStr( i+l, title, cButton );

    if( showMarkers == True && !down )
        {
        if( (state & sfSelected) != 0 )
            scOff = 0;
        else if( amDefault )
            scOff = 2;
        else
            scOff = 4;
        b.putChar( 0, specialChars[scOff] );
        b.putChar( s, specialChars[scOff+1] );
        }
}
开发者ID:LucasvBerkel,项目名称:TweedejaarsProject,代码行数:30,代码来源:TBUTTON.CPP


示例3: getColor

void TInterior::draw()       // modified for scroller
{
    ushort color = getColor(0x0301);
    for( int i = 0; i < size.y; i++ )
        // for each line:
    {
        TDrawBuffer b;
        b.moveChar( 0, ' ', color, size.x );
        // fill line buffer with spaces
        int j = delta.y + i;       // delta is scroller offset
        if( j < lineCount && lines[j] != 0 )
        {
            char s[maxLineLength];
            if( delta.x > strlen(lines[j] ) )
                s[0] = EOS;
            else
            {
                strncpy( s, lines[j]+delta.x, size.x );
                s[size.x] = EOS;
            }
            b.moveCStr( 0, s, color );
        }
        writeLine( 0, i, size.x, 1, b);
    }

}
开发者ID:Mikelle02,项目名称:GameMaker,代码行数:26,代码来源:TVGUID12.CPP


示例4: getColor

void TPercentageText::draw()
{
	ushort color = getColor(1);

	char *string = new char[size.x + 1];
	itoa( Round( percentage * pow10( precisionDigits ) ), string, 10 );

	if( precisionDigits > 0 )
		{
		memmove( &string[strlen( string ) - precisionDigits + 1],
			    &string[strlen( string ) - precisionDigits],
			    precisionDigits + 1 );
		string[strlen( string ) - 1 - precisionDigits] = point;
		}
	strcat( string, percentageString );
	if( string[0] == point )
		{
		memmove( &string[1], string, strlen( string ) + 1 );
		string[0] = '0';
		}

	TDrawBuffer b;
	b.moveChar( 0, ' ', color, size.x );
	b.moveStr( size.x - 1 - strlen( string ), string, color );
	writeLine( 0, 0, size.x, 1, b );

	delete[] string;
}
开发者ID:jskripsky,项目名称:ancient,代码行数:28,代码来源:PRCNTTXT.CPP


示例5: draw

void TBackground::draw()
{
    TDrawBuffer b;

    b.moveChar( 0, pattern, getColor(0x01), size.x );
    writeLine( 0, 0, size.x, size.y, b );
}
开发者ID:gdobra,项目名称:tvision,代码行数:7,代码来源:TBKGRND.cpp


示例6: draw

void TIndicator::draw()
{
    uchar color, frame;
    TDrawBuffer b;
    char s[15];

    if( (state & sfDragging) == 0 )
        {
        color = getColor(1);
        frame = dragFrame;
        }
    else
        {
        color = getColor(2);
        frame = normalFrame;
        }

    b.moveChar( 0, frame, color, size.x );
    if( modified )
        b.putChar( 0, 15 );
    ostrstream os( s, 15 );

    os << ' ' << (location.y+1)
       << ':' << (location.x+1) << ' ' << ends;

    b.moveCStr( 8-int(strchr(s, ':')-s), s, color);
    writeBuf(0, 0, size.x, 1, b);
}
开发者ID:LucasvBerkel,项目名称:TweedejaarsProject,代码行数:28,代码来源:TINDICTR.CPP


示例7: sprintf

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);
}
开发者ID:idispatch,项目名称:tvision,代码行数:26,代码来源:tprogbar.cpp


示例8: draw

void TFrame::draw()
{
    ushort cFrame, cTitle;
    short  f, i, l, width;
    TDrawBuffer b;

    if( (state & sfActive) == 0 )
        {
        cFrame = 0x0101;
        cTitle = 0x0002;
        f = 0;
        }
    else
        if( (state & sfDragging) != 0 )
            {
            cFrame = 0x0505;
            cTitle = 0x0005;
            f = 0;
            }
        else
            {
            cFrame = 0x0503;
            cTitle = 0x0004;
            f = 9;
            }

    cFrame = getColor(cFrame);
    cTitle = getColor(cTitle);

    width = size.x;
    l = width - 10;

    if( ( ((TWindow *)owner)->flags & (wfClose | wfZoom) ) != 0 )
        l -= 6;
    frameLine( b, 0, f, uchar(cFrame) );
    if( ((TWindow *)owner)->number != wnNoNumber &&
        ((TWindow *)owner)->number < 10
      )
        {
        l -= 4;
        if( ( ((TWindow *)owner)->flags & wfZoom ) != 0 )
            i = 7;
        else
            i = 3;
        b.putChar( width-i, ((TWindow *)owner)->number + '0' );
        }

    if( owner != 0 )
        {
        const char *title = ((TWindow *)owner)->getTitle(l);
        if( title != 0 )
            {
            l = min( cstrlen(title), width - 10 );
            l = max( l, 0 );
            i = (width - l) >> 1;
            b.putChar( i-1, ' ' );
            b.moveBuf( i, title, cTitle, l );
            b.putChar( i+l, ' ' );
            }
        }
开发者ID:WiLLStenico,项目名称:TestesEOutrasBrincadeiras,代码行数:60,代码来源:tframe.cpp


示例9: setLimit

/*
 * Deseneaza textul pe ecran.
 */
void TInterior::draw()
{
	setLimit(maxLineLength, lineCount);
	ushort color = getColor(0x0301);
	for (int i = 0; i < size.y; i++)
	{
		TDrawBuffer b;
		b.moveChar(0, ' ', color, size.x);	// umplu cu spatii

		int j = delta.y + i;

		if (j < lineCount && lines[j] != 0)
		{
			char s[maxLineLength];
			if (delta.x > strlen(lines[j]))
				s[0] = EOS;
			else
			{
				strncpy(s, lines[j] + delta.x, size.x);
				s[size.x] = EOS;
			}

			b.moveCStr(0, s, color);
		}

		writeLine(0, i, size.x, 1, b);
	}
}
开发者ID:bdumitriu,项目名称:playground,代码行数:31,代码来源:helpwin.cpp


示例10: getColor

void TFileViewer::draw()
{
    char *p;

    ushort c =  getColor(0x0301);
    for( int i = 0; i < size.y; i++ )
        {
        TDrawBuffer b;
	b.moveChar( 0, ' ', c, size.x );

        if( delta.y + i < fileLines->getCount() )
            {
            char s[maxLineLength+1];
            p = (char *)( fileLines->at(delta.y+i) );
            if( p == 0 || strlen(p) < delta.x )
                s[0] = EOS;
            else
		{
		strncpy( s, p+delta.x, size.x );
		if( strlen( p + delta.x ) > size.x )
                    s[size.x] = EOS;
                }
            b.moveStr( 0, s, c );
            }
        writeBuf( 0, i, size.x, 1, b );
        }
}
开发者ID:WiLLStenico,项目名称:TestesEOutrasBrincadeiras,代码行数:27,代码来源:fileview.cpp


示例11: getColor

void TInterior::draw() {
    const char *hstr = "Hello World!";
    ushort color = getColor(0x0301);
    TView::draw();
    TDrawBuffer b;
    b.moveStr(0, hstr, color);
    writeLine(0, 0, 12, 1, b);
}
开发者ID:idispatch,项目名称:tvtest,代码行数:8,代码来源:main.cpp


示例12: draw

void DynamicText::draw()
{
  TDrawBuffer b;
  uchar color = getColor(1);
  int offset = ( rightJustify ) ? size.x-strlen(text) : 0;

  b.moveChar( 0, ' ', color, size.x );
  b.moveStr( offset, text, color );
  writeBuf( 0, 0, size.x, 1, b );
}
开发者ID:Mermouy,项目名称:archlinux-stuff,代码行数:10,代码来源:dyntext.cpp


示例13: draw

void TStaticText::draw()
{
    uchar color;
    Boolean center;
    int i, j, l, p, y;
    TDrawBuffer b;
    char s[256];

    color = getColor(1);
    getText(s);
    l = strlen(s);
    p = 0;
    y = 0;
    center = False;
    while (y < size.y)
        {
        b.moveChar(0, ' ', color, size.x);
        if (p < l)
            {
            if (s[p] == 3)
                {
                center = True;
                ++p;
                }
            i = p;
            do {
               j = p;
               while ((p < l) && (s[p] == ' '))
                   ++p;
               while ((p < l) && (s[p] != ' ') && (s[p] != '\n'))
                   ++p;
               } while ((p < l) && (p < i + size.x) && (s[p] != '\n'));
            if (p > i + size.x)
                if (j > i)
                    p = j;
                else
                    p = i + size.x;
            if (center == True)
               j = (size.x - p + i) / 2 ;
            else
               j = 0;
            b.moveBuf(j, &s[i], color, (p - i));
            while ((p < l) && (s[p] == ' '))
                p++;
            if ((p < l) && (s[p] == '\n'))
                {
                center = False;
                p++;
                if ((p < l) && (s[p] == 10))
                    p++;
                }
            }
        writeLine(0, y++, size.x, 1, b);
        }
}
开发者ID:hackshields,项目名称:antivirus,代码行数:55,代码来源:TSTATICT.cpp


示例14: getColor

void TProgressBar::draw()
{
    char color = getColor(1);
    TDrawBuffer nbuf;

	 nbuf.moveChar(0,' ',color,size.x);

	 nbuf.moveStr( 0, bar, color ) ;

    writeLine(0, 0, size.x, 1, nbuf);
}
开发者ID:idispatch,项目名称:tvision,代码行数:11,代码来源:tprogbar.cpp


示例15: draw

void TTable::draw() {
    TDrawBuffer buf;
    char color = getColor(6);

    for (ushort y = 0; y <= size.y - 1; y++) {
        buf.moveChar(0, ' ', color, (short) size.x);
        for (ushort x = 0; x <= size.x - 1; x++)
            buf.moveChar(x, (ushort)(32 * y + x), color, (ushort) 1);
        writeLine(0, y, (short) size.x, (ushort) 1, buf);
    }
    showCursor();
}
开发者ID:idispatch,项目名称:tvtest,代码行数:12,代码来源:main.cpp


示例16: getColor

void TCalcDisplay::draw()
{
    char color = getColor(1);
    int i;
    TDrawBuffer buf;

    i = size.x - strlen(number) - 2;
    buf.moveChar(0, ' ', color, size.x);
    buf.moveChar(i, sign, color, 1);
    buf.moveStr(i+1, number, color);
    writeLine(0, 0, size.x, 1, buf);
}
开发者ID:WiLLStenico,项目名称:TestesEOutrasBrincadeiras,代码行数:12,代码来源:calc.cpp


示例17: getColor

void TCalcDisplay::draw()
{
    char color = getColor(1);
    short i;
    TDrawBuffer buf;

    i = (short)(size.x - strlen(number) - 2);
    buf.moveChar(0, ' ', color, (short)size.x);
    buf.moveChar(i, sign, color, (short)1 );
    buf.moveStr((short)(i+1), number, color);
    writeLine(0, 0, (short)size.x, 1, buf);
}
开发者ID:OS2World,项目名称:DEV-CPLUSPLUS-UTIL-Turbo_Vision_C--,代码行数:12,代码来源:calc.cpp


示例18: getColor

void EnhancedStatusLine::draw()
{
    TStatusLine::draw();
    ushort cNormal = getColor(0x0301);
    for (int i=0; i < count; i++)
    {
        TDrawBuffer b;
        if (i != 0)
            b.moveChar(0, '\263', cNormal, 1);
        b.moveCStr(i ? 1 : 0, items[i].text, cNormal);
        writeBuf(items[i].offset - (i ? 1 : 0), 0, (i ? 1 : 0) + strlen(items[i].text), 1, b);
    }
}
开发者ID:NoSuchProcess,项目名称:OrangeC,代码行数:13,代码来源:esl.cpp


示例19: draw

void TClickTester::draw()
{
    TDrawBuffer buf;
    char c;

    if (clicked)
        c = getColor(2);
    else
        c = getColor(1);

    buf.moveChar(0, ' ', c, size.x);
    buf.moveStr(0, text, c);
    writeLine(0, 0, size.x, 1, buf);
}
开发者ID:LucasvBerkel,项目名称:TweedejaarsProject,代码行数:14,代码来源:MOUSEDLG.CPP


示例20: sysErr

short TSystemError::sysErr( short errorCode, uchar drive )
{
    ushort c = ( (TScreen::screenMode & 0x00fF) != TDisplay::smMono  ) ?
                                        sysColorAttr : sysMonoAttr;
    char s[ 63 ];
    TDrawBuffer b;

    sprintf( s, errorString[ errorCode ], drive + 'a' );

    b.moveChar( 0, ' ', c, 80);
    b.moveCStr( 1, s, c);
    b.moveCStr( 79-cstrlen(sRetryOrCancel), sRetryOrCancel, c);
    swapStatusLine(b);
    int res = selectKey();
    swapStatusLine(b);
    return res;
}
开发者ID:LucasvBerkel,项目名称:TweedejaarsProject,代码行数:17,代码来源:SYSERR.CPP



注:本文中的TDrawBuffer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TDriveUnit类代码示例发布时间:2022-05-31
下一篇:
C++ TDomain类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap