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


C++ TextLength函数代码示例

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


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

示例1: statusbar_create

int statusbar_create(video_canvas_t *canvas)
{
  int i;

  canvas->os->font = OpenDiskFont((struct TextAttr *)&led_font_attr);
  if (canvas->os->font) {
    SetFont(canvas->os->window->RPort, canvas->os->font);
  }
  /* else we use system default font */

  for (i=0; i<b_num; i++) {
#ifndef AMIGAOS4
    canvas->os->pens[i] = ObtainBestPen(canvas->os->window->WScreen->ViewPort.ColorMap, palette[i].red * 0x01010101, palette[i].green * 0x01010101, palette[i].blue * 0x01010101, TAG_DONE);
#else
    canvas->os->pens[i] = ObtainBestPen(canvas->os->window->WScreen->ViewPort.ColorMap, palette[i].red * 0x01010101, palette[i].green * 0x01010101, palette[i].blue * 0x01010101);
#endif
  }

  #define MAXSTR "00: 00.0"
  canvas->os->disk_width = TextLength(canvas->os->window->RPort, MAXSTR, strlen(MAXSTR)) + 14 + 7;
  #undef MAXSTR

  #define MAXSTR "000"
  canvas->os->tape_width = TextLength(canvas->os->window->RPort, MAXSTR, strlen(MAXSTR)) + 28 + 7 ;
  #undef MAXSTR

  canvas->os->has_statusbar = 1;

  statusbar_refresh(REFRESH_ALL);

  return 0;
}
开发者ID:martinpiper,项目名称:VICE,代码行数:32,代码来源:statusbar.c

示例2: SetText

status_t
FindTextView::SetMode(find_mode mode)
{
	if (fMode == mode)
		return B_OK;

	if (mode == kHexMode) {
		// convert text to hex mode

		char* hex;
		size_t hexSize;
		if (_GetHexFromData((const uint8*)Text(), TextLength(), &hex, &hexSize)
				< B_OK)
			return B_NO_MEMORY;

		fMode = mode;

		SetText(hex, hexSize);
		free(hex);
	} else {
		// convert hex to ascii

		uint8* data;
		size_t dataSize;
		if (_GetDataFromHex(Text(), TextLength(), &data, &dataSize) < B_OK)
			return B_NO_MEMORY;

		fMode = mode;

		SetText((const char*)data, dataSize);
		free(data);
	}

	return B_OK;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:35,代码来源:FindWindow.cpp

示例3: switch

void
TSigTextView::KeyDown(const char *key, int32 count)
{
	bool	up = false;
	int32	height;
	BRect	r;

	switch (key[0]) {
		case B_HOME:
			Select(0, 0);
			ScrollToSelection();
			break;

		case B_END:
			Select(TextLength(), TextLength());
			ScrollToSelection();
			break;

		case B_PAGE_UP:
			up = true;
		case B_PAGE_DOWN:
			r = Bounds();
			height = (int32)((up ? r.top - r.bottom : r.bottom - r.top) - 25);
			if ((up) && (!r.top))
				break;
			ScrollBy(0, height);
			break;

		default:
			BTextView::KeyDown(key, count);
	}
}
开发者ID:HaikuArchives,项目名称:BeMailDaemon,代码行数:32,代码来源:Signature.cpp

示例4: TextLength

void
HyperTextView::InsertHyperText(const char* inText, int32 inLength,
	HyperTextAction* action, const text_run_array* inRuns)
{
	int32 startOffset = TextLength();
	Insert(inText, inLength, inRuns);
	int32 endOffset = TextLength();

	AddHyperTextAction(startOffset, endOffset, action);
}
开发者ID:looncraz,项目名称:haiku,代码行数:10,代码来源:HyperTextView.cpp

示例5: FillSolEol

void TexView::GoToLine(int32 index)
{
	if(index < 0 || index > CountLines() || TextLength() <= 0)
		return;
		
	vector<int> eols;
	vector<int> sols;
	
	FillSolEol(sols,eols,0,TextLength()-1);
	Select(sols[index],eols[index]);
}
开发者ID:HaikuArchives,项目名称:BeTeX,代码行数:11,代码来源:TexView.cpp

示例6: PointAt

// ---------------------------------------------------------------------------------- RHTML_text_view - Draw -
void RHTMLtextview::Draw(BRect inRect)
{
	BTextView::Draw(inRect);
	if (fTarget->fNumView->Frame().top != fScrollView->ScrollBar(B_VERTICAL)->Value())
	fTarget->fNumView->MoveTo(BPoint(0, 0 - fScrollView->ScrollBar(B_VERTICAL)->Value()));

	if (fTarget->IsEnabled())
		fTarget->fNumView->UpdateNum();
	if (PointAt(TextLength() - 1).y + 50 > fTarget->fNumView->Bounds().bottom)
		fTarget->fNumView->ResizeTo(fTarget->fNumView->Bounds().right, PointAt(TextLength() - 1).y + 50);
}
开发者ID:HaikuArchives,项目名称:Globe,代码行数:12,代码来源:RHTML_textview.cpp

示例7: DrawText

static VOID DrawText(struct RastPort *rport, WORD x, WORD y, STRPTR text, char hotkey, UWORD textcolor, BOOL parse)
{
  ULONG length = strlen(text);
  y += rport->TxBaseline;

  SetAPen(rport, textcolor);
  Move(rport, x, y);

  if(hotkey)
  {
    if(parse)
    {
      char *textpnt = text;
      UWORD delta = 0;
      while(*textpnt != '\0')
      {
        if(*textpnt == '_')
        {
          Text(rport, text, delta);
          x += TextLength(rport, text, delta);
          text = textpnt+1;
          RectFill(rport, x, y+2, x+TextLength(rport, text, 1)-2, y+2);
          Move(rport, x, y);
          break;
        }
        delta++;
        textpnt++;
      }
      Text(rport, text, strlen(text));
    }
    else
    {
      ULONG i=0;
      Text(rport, text, length);

      for(i=0; i != length; i++)
      {
        if(hotkey == ToLower(text[i]))
        {
          ULONG width = TextLength(rport, text, i);
          RectFill(rport, x+width, y+2, x+width+TextLength(rport, &text[i], 1)-2, y+2);
          break;
        }

      }
    }
  }
  else
  {
    Text(rport, text, length);
  }
}
开发者ID:amiga-mui,项目名称:toolbar,代码行数:52,代码来源:Draw.c

示例8: free

void
FindTextView::GetData(BMessage& message)
{
	if (fMode == kHexMode) {
		// convert hex-text to real data
		uint8* data;
		size_t dataSize;
		if (_GetDataFromHex(Text(), TextLength(), &data, &dataSize) != B_OK)
			return;

		message.AddData("data", B_RAW_TYPE, data, dataSize);
		free(data);
	} else
		message.AddData("data", B_RAW_TYPE, Text(), TextLength());
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:15,代码来源:FindWindow.cpp

示例9: font

void TexView::ParseAll(int start,int finish,bool IsInteractive)
{
	BFont font(be_fixed_font);
	font.SetSize(prefs->FontSize);
	
	int text_length = TextLength();
	if(text_length > 0)
	{
		vector<int> eols;
		vector<int> sols;
		FillSolEol(sols,eols,start,finish);
		
		int i;
		int size;
		
		if(!IsInteractive)
		{
			size = text_length;
			vector<rgb_color> colorVec(size,prefs->fg_color);

			for(i=0;i<sols.size();i++)
			{
				ParseLine(sols[i],eols[i],colorVec);		
			}
			
			int offset_size=1;
			vector<int> offsets;
			offsets.push_back(0);
			
			for(i=1;i<size;i++)
			{
				if(colorVec[i-1] != colorVec[i])
				{
					offsets.push_back(i);	
					offset_size++;
				}
			}
			text_run_array* tra = (text_run_array*)malloc(sizeof(text_run_array)*(size));
			tra->count = offset_size;
			for(i=0;i<offset_size;i++)
			{
				tra->runs[i].color=colorVec[offsets[i]];
				tra->runs[i].font=font;
				tra->runs[i].offset=offsets[i];
			}
			SetRunArray(0,text_length-1,tra);
		}		
		else
		{
			int32 start,finish;
			GetSelection(&start,&finish);
			Select(start,start);
			for(i=0;i<sols.size();i++)
			{
				IParseLine(sols[i],eols[i]);		
			}
			Select(start,finish);
		}
	}
}
开发者ID:HaikuArchives,项目名称:BeTeX,代码行数:60,代码来源:TexView.cpp

示例10: SetHighlightL

// ---------------------------------------------------------
// CMsgBodyControlEditor::DoHandleParsingCompleteL
// ---------------------------------------------------------
//
void CMsgBodyControlEditor::DoHandleParsingCompleteL()
    {
    iTextParsed = ETrue;
    // this needs to be changed so that bottom init can also be set
    if ( iFocusChangedBeforeParseFinish )
        {
        iFocusChangedBeforeParseFinish = EFalse; // just to make sure this is done only once
        if ( iInitTop )
            {
            SetHighlightL( 0, EMsgFocusDown, ETrue ); 
            }
        else
            {
            SetHighlightL( TextLength(), EMsgFocusUp, ETrue ); 
            }
        
        if ( iBaseControlObserver )
            {
            iBaseControlObserver->HandleBaseControlEventRequestL( NULL, 
                                                                  EMsgUpdateScrollbar );
            }
        }
    else
        {
        // In some cases the text view is left to some
        // strange state. Make sure the view is in sync
        // with cursor position.
        SetCursorPosL( CursorPos(), EFalse );
        }
    }
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:34,代码来源:MsgBodyControlEditor.cpp

示例11: ExceededMaxLines

static Bool
ExceededMaxLines(Widget w)
{
    XawTextPosition end_of_last_line;
    Bool retval = False;

    if (app_resources.saveLines > 0)
    {
    /*
     * XawTextSourceScan() will return the end of the widget if it cannot
     * find what it is searching for.
     */
	end_of_last_line = XawTextSourceScan (XawTextGetSource (w),
					      (XawTextPosition) 0,
					      XawstEOL, XawsdRight,
					      app_resources.saveLines, TRUE);
	if (TextLength(w) > end_of_last_line)
	    retval = True;
	else
	    retval = False;
    }
    else
	retval = False;
    return retval;
}
开发者ID:Bluerise,项目名称:openbsd-xenocara,代码行数:25,代码来源:xconsole.c

示例12: TextLength

// Make a text string from the internal data structures.
// The input page_res is deleted.
char* TessBaseAPI::TesseractToText(PAGE_RES* page_res) {
  if (page_res != NULL) {
    int total_length = TextLength(page_res);
    PAGE_RES_IT   page_res_it(page_res);
    char* result = new char[total_length];
    char* ptr = result;
    for (page_res_it.restart_page(); page_res_it.word () != NULL;
         page_res_it.forward()) {
      WERD_RES *word = page_res_it.word();
      WERD_CHOICE* choice = word->best_choice;
      if (choice != NULL) {
        strcpy(ptr, choice->string().string());
        ptr += strlen(ptr);
        if (word->word->flag(W_EOL))
          *ptr++ = '\n';
        else
          *ptr++ = ' ';
      }
    }
    *ptr++ = '\n';
    *ptr = '\0';
    delete page_res;
    return result;
  }
  return NULL;
}
开发者ID:GaryShearer,项目名称:BasicOCR,代码行数:28,代码来源:baseapi.cpp

示例13: NewCurrentClipContents

static void
NewCurrentClipContents(char *data, int len)
{
    XawTextBlock textBlock;

    SaveClip (text, currentClip);

    /* append new clips at the end */
    while (currentClip && currentClip->next)
	currentClip = currentClip->next;
    /* any trailing clips with no text get overwritten */
    if (strlen (currentClip->clip) != 0)
	currentClip = NewClip (text, currentClip);
    
    textBlock.ptr = data;
    textBlock.firstPos = 0;
    textBlock.length = len;
    textBlock.format = FMT8BIT;
    if (XawTextReplace(text, 0, TextLength (text), &textBlock)) {
#ifdef XKB
	XkbStdBell(XtDisplay(text), XtWindow(text), 0, XkbBI_Info);
#else
	XBell( XtDisplay(text), 0);
#endif
    }
    set_button_state ();
}
开发者ID:alepharchives,项目名称:bitrig-xenocara,代码行数:27,代码来源:xclipboard.c

示例14: TextAppend

static void
TextAppend(Widget w, char *s, int len)
{
    long	    last, current;
    XawTextBlock    block;

    current = XawTextGetInsertionPoint (w);
    last = TextLength (w);
    block.ptr = s;
    block.firstPos = 0;
    block.length = len;
    block.format = FMT8BIT;
    /*
     * If saveLines is 1, just replace the entire contents of the widget
     * each time, so the test in ExceededMaxLines() isn't fooled.
     */
    if (app_resources.saveLines == 1)
	TextReplace (w, 0, last, &block);
    else
	TextReplace (w, last, last, &block);
    if (current == last)
	XawTextSetInsertionPoint (w, last + block.length);
    if (ExceededMaxLines(w))
	ScrollLine(w);
}
开发者ID:Bluerise,项目名称:openbsd-xenocara,代码行数:25,代码来源:xconsole.c

示例15: TextLength

// Return the message as raw text
char* HTMLView::GetRawTextMessage() {

	// Copy the text out of the buffer, and into string FullText
	message = (char*)malloc( TextLength() + 1 );
	strcpy( message, Text() );
	
	return message;
}
开发者ID:HaikuArchives,项目名称:BeAIM,代码行数:9,代码来源:HTMLView.cpp


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