当前位置: 首页>>代码示例>>C++>>正文


C++ TDrawBuffer::moveStr方法代码示例

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


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

示例1: draw

void TPuzzleView::draw() {
    char tmp[8];
    char color[2], colorBack;
    TDrawBuffer buf;

    color[0] = color[1] = colorBack = getColor(1);
    if (!solved)
        color[1] = getColor(2);

    /* SS: little change */
    short i;
    for (i = 0; i <= 3; i++)
    //for(short i = 0; i <= 3; i++)
            {
        buf.moveChar(0, ' ', colorBack, 18);
        if (i == 1)
            buf.moveStr(13, "Move", colorBack);
        if (i == 2) {
            sprintf(tmp, "%d", moves);
            buf.moveStr(14, tmp, colorBack);
        }
        for (short j = 0; j <= 3; j++) {
            strcpy(tmp, "   ");
            tmp[1] = board[i][j];
            if (board[i][j] == ' ')
                buf.moveStr((short) (j * 3), tmp, color[0]);
            else
                buf.moveStr((short) (j * 3), tmp, color[(int) map[board[i][j] - 'A']]);
        }
        writeLine(0, i, 18, 1, buf);
    }
}
开发者ID:idispatch,项目名称:tvtest,代码行数:32,代码来源:main.cpp

示例2: drawSelect

void TStatusLine::drawSelect( TStatusItem *selected )
{
    TDrawBuffer b;
    ushort color;
    char hintBuf[256];

    ushort cNormal = getColor(0x0301);
    ushort cSelect = getColor(0x0604);
    ushort cNormDisabled = getColor(0x0202);
    ushort cSelDisabled = getColor(0x0505);
    b.moveChar( 0, ' ', cNormal, size.x );
    TStatusItem *T =  items;
    ushort i = 0;

    while( T != 0 )
        {
        if( T->text != 0 )
            {
            ushort l = cstrlen( T->text );
            if( i + l < size.x )
                {
                if( commandEnabled( T->command) )
                    if( T == selected )
                        color = cSelect;
                    else
                        color = cNormal;
                else
                    if( T == selected )
                        color = cSelDisabled;
                    else
                        color = cNormDisabled;

                b.moveChar( i, ' ', color, 1 );
                b.moveCStr( i+1, T->text, color );
                b.moveChar( i+l+1, ' ', color, 1 );
                }
            i += l+2;
            }
        T = T->next;
        }
    if( i < size.x - 2 )
        {
        strcpy( hintBuf, hint( helpCtx ) );
        if( *hintBuf != EOS )
            {
            b.moveStr( i, hintSeparator, cNormal );
            i += 2;
            if( strlen(hintBuf) + i > size.x )
                hintBuf[size.x-i] = EOS;
            b.moveStr( i, hintBuf, cNormal );
            i += strlen(hintBuf);
            }
        }
    writeLine( 0, 0, size.x, 1, b );
}
开发者ID:LucasvBerkel,项目名称:TweedejaarsProject,代码行数:55,代码来源:TSTATUSL.CPP

示例3: draw

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

示例4: draw

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 TInputLine::draw()
{
    int l, r;
    TDrawBuffer b;

    uchar color = (state & sfFocused) ? getColor( 2 ) : getColor( 1 );

    b.moveChar( 0, ' ', color, size.x );
    char buf[256];
    strncpy( buf, data+firstPos, size.x - 2 );
    buf[size.x - 2 ] = EOS;
    b.moveStr( 1, buf, color );

    if( canScroll(1) )
        b.moveChar( size.x-1, rightArrow, getColor(4), 1 );
    if( (state & sfSelected) != 0 )
        {
        if( canScroll(-1) )
            b.moveChar( 0, leftArrow, getColor(4), 1 );
        l = selStart - firstPos;
        r = selEnd - firstPos;
        l = max( 0, l );
        r = min( size.x - 2, r );
        if (l <  r)
            b.moveChar( l+1, 0, getColor(3), r - l );
        }
    writeLine( 0, 0, size.x, size.y, b );
    setCursor( curPos-firstPos+1, 0);
}
开发者ID:WiLLStenico,项目名称:TestesEOutrasBrincadeiras,代码行数:29,代码来源:tinputli.cpp

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

示例7: draw

void TCalendarView::draw()
{
    char str[23];
    char current = 1 - dayOfWeek(1, month, year);
    char days = daysInMonth[month] + ((year % 4 == 0 && month == 2) ? 1 : 0);
    char color, boldColor;
    int  i, j;
    TDrawBuffer buf;

    color = getColor(6);
    boldColor = getColor(7);

    buf.moveChar(0, ' ', color, 22);

    ostrstream( str, sizeof str)
      << setw(9) << monthNames[month] << " " << setw(4) << year
      << " " << (char) 30 << "  " << (char) 31 << " " << ends;

    buf.moveStr(0, str, color);
    writeLine(0, 0, 22, 1, buf);

    buf.moveChar(0, ' ', color, 22);
    buf.moveStr(0, "Su Mo Tu We Th Fr Sa", color);
    writeLine(0, 1, 22, 1, buf);

    for(i = 1; i <= 6; i++)
        {
        buf.moveChar(0, ' ', color, 22);
        for(j = 0; j <= 6; j++)
            {
            if(current < 1 || current > days)
                buf.moveStr(j*3, "   ", color);
            else
                {
                ostrstream( str, sizeof str )
                  << setw(2) << (int) current << ends;
                if(year == curYear && month == curMonth && current == curDay)
                    buf.moveStr(j*3, str, boldColor);
                else
                    buf.moveStr(j*3, str, color);
                }
            current++;
            }
        writeLine(0, i+1, 22, 1, buf);
        }
}
开发者ID:WiLLStenico,项目名称:TestesEOutrasBrincadeiras,代码行数:46,代码来源:calendar.cpp

示例8: 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

示例9: draw

void TCalendarView::draw() {
   char str[28];
   char current = 1 - dayOfWeek(1, month, year);
   char    days = daysInMonth[month] + (year%4==0 && month==2?1:0);
   char   color = getColor(6),
         hcolor = (color&0xF0)+0x09,
         tcolor = 0x2F,
        ticolor = (color&0xF0)>>4|(tcolor&0xF0),
        odcolor = (color&0xF0)+0x01,
        wdcolor = (color&0xF0)+0x04;
   int  ii, jj;
   TDrawBuffer buf;

   buf.moveChar(0, ' ', color, 24);
   snprintf(str, 28,"%12s %4d \x1E \x1F", monthNames[month], year);
   buf.moveStr(0, str, hcolor);
   writeLine(0, 0, 24, 1, buf);

   buf.moveChar(0, ' ', color, 22);
   buf.moveStr(0, " Mo Tu We Th Fr Sa Su", hcolor);
   writeLine(0, 1, 24, 1, buf);

   for (ii=1; ii<=6; ii++) {
      buf.moveChar(0, ' ', color, 24);
      for (jj=0; jj<=6; jj++) {
         if (current<1 || current>days) buf.moveStr(1+jj*3, "   ", color);
         else {
            int today = year==curYear&&month==curMonth&&current==curDay,
              onechar = current<10?1:0;
            snprintf(str, 24, "%d", current);
            buf.moveStr(1+jj*3+onechar, str, today?tcolor:(jj<5?odcolor:wdcolor));
            if (today) {
               buf.moveChar(1+jj*3-1+onechar,0xDD,ticolor,1);
               buf.moveChar(1+jj*3+2,0xDE,ticolor,1);
            }
         }
         current++;
      }
      writeLine(0, ii+1, 24, 1, buf);
   }
}
开发者ID:OS2World,项目名称:SYSTEM-LOADER-QSINIT,代码行数:41,代码来源:calendar.cpp

示例10: draw

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

示例11: draw

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

示例12: 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

示例13: draw

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

   i = size.x - strlen(number) - 2;
   buf.moveChar(0, ' ', color, size.x);
   if (hexmode)
      buf.moveChar(1, 'x', color&0xF0|0xC , 1);
   if (memory)
      buf.moveChar(2, 'm', color&0xF0|0xD , 1);
   buf.moveChar(i, sign, color, 1);
   buf.moveStr(i + 1, number, color);
   writeLine(0, 0, size.x, 1, buf);
}
开发者ID:OS2World,项目名称:SYSTEM-LOADER-QSINIT,代码行数:15,代码来源:calc.cpp

示例14: draw

void TListViewer::draw() {
   int i, j, item;
   ushort normalColor, selectedColor, focusedColor, color;
   short colWidth, curCol, indent;
   TDrawBuffer b;
   uchar scOff;

   if ((state&(sfSelected | sfActive)) == (sfSelected | sfActive)) {
      normalColor = getColor(1);
      focusedColor = getColor(3);
      selectedColor = getColor(4);
   } else {
      normalColor = getColor(2);
      selectedColor = getColor(4);
   }

   if (hScrollBar != 0)
      indent = hScrollBar->value;
   else
      indent = 0;

   colWidth = size.x / numCols + 1;
   for (i = 0; i < size.y; i++) {
      for (j = 0; j < numCols; j++) {
         item =  j * size.y + i + topItem;
         curCol = j * colWidth;
         if ((state & (sfSelected | sfActive)) == (sfSelected | sfActive) &&
             focused == item &&
             range > 0) {
            color = focusedColor;
            setCursor(curCol + 1, i);
            scOff = 0;
         } else if (item < range && isSelected(item)) {
            color = selectedColor;
            scOff = 2;
         } else {
            color = normalColor;
            scOff = 4;
         }

         b.moveChar(curCol, ' ', color, colWidth);
         if (item < range) {
            char text[MAXSTR];
            getText(text, item, colWidth + indent);
            char buf[MAXSTR];
            buf[0] = '\0';
            if (strlen(text) > indent) {
               memcpy(buf, text+indent, colWidth);
               buf[colWidth] = EOS;
            }
            b.moveStr(curCol+1, buf, color);
            if (showMarkers) {
               b.putChar(curCol, specialChars[scOff]);
               b.putChar(curCol+colWidth-2, specialChars[scOff+1]);
            }
         } else if (i == 0 && j == 0)
            b.moveStr(curCol+1, emptyText, getColor(1));

         b.moveChar(curCol+colWidth-1, 179, getColor(5), 1);
      }
      writeLine(0, i, size.x, 1, b);
   }
}
开发者ID:OS2World,项目名称:SYSTEM-LOADER-QSINIT,代码行数:63,代码来源:tlstview.cpp


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