123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053 |
- <!DOCTYPE html>
- <!--[if IE]><![endif]-->
- <html>
-
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <title>Class TextFormatter
- </title>
- <meta name="viewport" content="width=device-width">
- <meta name="title" content="Class TextFormatter
- ">
- <meta name="generator" content="docfx 2.56.7.0">
-
- <link rel="shortcut icon" href="../../favicon.ico">
- <link rel="stylesheet" href="../../styles/docfx.vendor.css">
- <link rel="stylesheet" href="../../styles/docfx.css">
- <link rel="stylesheet" href="../../styles/main.css">
- <meta property="docfx:navrel" content="../../toc.html">
- <meta property="docfx:tocrel" content="toc.html">
-
- <meta property="docfx:rel" content="../../">
-
- </head>
- <body data-spy="scroll" data-target="#affix" data-offset="120">
- <div id="wrapper">
- <header>
-
- <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
- <div class="container">
- <div class="navbar-header">
- <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
- <span class="sr-only">Toggle navigation</span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- <span class="icon-bar"></span>
- </button>
-
- <a class="navbar-brand" href="../../index.html">
- <img id="logo" class="svg" src="../../images/logo48.png" alt="">
- </a>
- </div>
- <div class="collapse navbar-collapse" id="navbar">
- <form class="navbar-form navbar-right" role="search" id="search">
- <div class="form-group">
- <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
- </div>
- </form>
- </div>
- </div>
- </nav>
-
- <div class="subnav navbar navbar-default">
- <div class="container hide-when-search" id="breadcrumb">
- <ul class="breadcrumb">
- <li></li>
- </ul>
- </div>
- </div>
- </header>
- <div class="container body-content">
-
- <div id="search-results">
- <div class="search-list">Search Results for <span></span></div>
- <div class="sr-items">
- <p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
- </div>
- <ul id="pagination" data-first="First" data-prev="Previous" data-next="Next" data-last="Last"></ul>
- </div>
- </div>
- <div role="main" class="container body-content hide-when-search">
-
- <div class="sidenav hide-when-search">
- <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
- <div class="sidetoggle collapse" id="sidetoggle">
- <div id="sidetoc"></div>
- </div>
- </div>
- <div class="article row grid-right">
- <div class="col-md-10">
- <article class="content wrap" id="_content" data-uid="Terminal.Gui.TextFormatter">
-
-
- <h1 id="Terminal_Gui_TextFormatter" data-uid="Terminal.Gui.TextFormatter" class="text-break">Class TextFormatter
- </h1>
- <div class="markdown level0 summary">
- Provides text formatting capabilities for console apps. Supports, hotkeys, horizontal alignment, multiple lines, and word-based line wrap.
- </div>
- <div class="markdown level0 conceptual"></div>
- <div class="inheritance">
- <h5>Inheritance</h5>
- <div class="level0"><span class="xref">System.Object</span></div>
- <div class="level1"><span class="xref">TextFormatter</span></div>
- </div>
- <div class="inheritedMembers">
- <h5>Inherited Members</h5>
- <div>
- <span class="xref">System.Object.Equals(System.Object)</span>
- </div>
- <div>
- <span class="xref">System.Object.Equals(System.Object, System.Object)</span>
- </div>
- <div>
- <span class="xref">System.Object.GetHashCode()</span>
- </div>
- <div>
- <span class="xref">System.Object.GetType()</span>
- </div>
- <div>
- <span class="xref">System.Object.MemberwiseClone()</span>
- </div>
- <div>
- <span class="xref">System.Object.ReferenceEquals(System.Object, System.Object)</span>
- </div>
- <div>
- <span class="xref">System.Object.ToString()</span>
- </div>
- </div>
- <h6><strong>Namespace</strong>: <a class="xref" href="Terminal.Gui.html">Terminal.Gui</a></h6>
- <h6><strong>Assembly</strong>: Terminal.Gui.dll</h6>
- <h5 id="Terminal_Gui_TextFormatter_syntax">Syntax</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public class TextFormatter</code></pre>
- </div>
- <h3 id="properties">Properties
- </h3>
-
-
- <a id="Terminal_Gui_TextFormatter_Alignment_" data-uid="Terminal.Gui.TextFormatter.Alignment*"></a>
- <h4 id="Terminal_Gui_TextFormatter_Alignment" data-uid="Terminal.Gui.TextFormatter.Alignment">Alignment</h4>
- <div class="markdown level1 summary">
- Controls the horizontal text-alignment property.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public TextAlignment Alignment { get; set; }</code></pre>
- </div>
- <h5 class="propertyValue">Property Value</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><a class="xref" href="Terminal.Gui.TextAlignment.html">TextAlignment</a></td>
- <td>The text alignment.</td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_CursorPosition_" data-uid="Terminal.Gui.TextFormatter.CursorPosition*"></a>
- <h4 id="Terminal_Gui_TextFormatter_CursorPosition" data-uid="Terminal.Gui.TextFormatter.CursorPosition">CursorPosition</h4>
- <div class="markdown level1 summary">
- Gets the cursor position from <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_HotKey">HotKey</a>. If the <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_HotKey">HotKey</a> is defined, the cursor will be positioned over it.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public int CursorPosition { get; set; }</code></pre>
- </div>
- <h5 class="propertyValue">Property Value</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td></td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_HotKey_" data-uid="Terminal.Gui.TextFormatter.HotKey*"></a>
- <h4 id="Terminal_Gui_TextFormatter_HotKey" data-uid="Terminal.Gui.TextFormatter.HotKey">HotKey</h4>
- <div class="markdown level1 summary">
- Gets the hotkey. Will be an upper case letter or digit.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public Key HotKey { get; }</code></pre>
- </div>
- <h5 class="propertyValue">Property Value</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><a class="xref" href="Terminal.Gui.Key.html">Key</a></td>
- <td></td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_HotKeyPos_" data-uid="Terminal.Gui.TextFormatter.HotKeyPos*"></a>
- <h4 id="Terminal_Gui_TextFormatter_HotKeyPos" data-uid="Terminal.Gui.TextFormatter.HotKeyPos">HotKeyPos</h4>
- <div class="markdown level1 summary">
- The position in the text of the hotkey. The hotkey will be rendered using the hot color.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public int HotKeyPos { get; set; }</code></pre>
- </div>
- <h5 class="propertyValue">Property Value</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td></td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_HotKeySpecifier_" data-uid="Terminal.Gui.TextFormatter.HotKeySpecifier*"></a>
- <h4 id="Terminal_Gui_TextFormatter_HotKeySpecifier" data-uid="Terminal.Gui.TextFormatter.HotKeySpecifier">HotKeySpecifier</h4>
- <div class="markdown level1 summary">
- The specifier character for the hotkey (e.g. '_'). Set to '\xffff' to disable hotkey support for this View instance. The default is '\xffff'.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public Rune HotKeySpecifier { get; set; }</code></pre>
- </div>
- <h5 class="propertyValue">Property Value</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">System.Rune</span></td>
- <td></td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_HotKeyTagMask_" data-uid="Terminal.Gui.TextFormatter.HotKeyTagMask*"></a>
- <h4 id="Terminal_Gui_TextFormatter_HotKeyTagMask" data-uid="Terminal.Gui.TextFormatter.HotKeyTagMask">HotKeyTagMask</h4>
- <div class="markdown level1 summary">
- Specifies the mask to apply to the hotkey to tag it as the hotkey. The default value of <code>0x100000</code> causes
- the underlying Rune to be identified as a "private use" Unicode character.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public uint HotKeyTagMask { get; set; }</code></pre>
- </div>
- <h5 class="propertyValue">Property Value</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">System.UInt32</span></td>
- <td></td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_Lines_" data-uid="Terminal.Gui.TextFormatter.Lines*"></a>
- <h4 id="Terminal_Gui_TextFormatter_Lines" data-uid="Terminal.Gui.TextFormatter.Lines">Lines</h4>
- <div class="markdown level1 summary">
- Gets the formatted lines.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public List<ustring> Lines { get; }</code></pre>
- </div>
- <h5 class="propertyValue">Property Value</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">System.Collections.Generic.List</span><<span class="xref">NStack.ustring</span>></td>
- <td></td>
- </tr>
- </tbody>
- </table>
- <h5 id="Terminal_Gui_TextFormatter_Lines_remarks">Remarks</h5>
- <div class="markdown level1 remarks">
- <p>
- Upon a 'get' of this property, if the text needs to be formatted (if <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_NeedsFormat">NeedsFormat</a> is <code>true</code>)
- <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_Format_NStack_ustring_System_Int32_Terminal_Gui_TextAlignment_System_Boolean_">Format(ustring, Int32, TextAlignment, Boolean)</a> will be called internally.
- </p>
- </div>
-
-
- <a id="Terminal_Gui_TextFormatter_NeedsFormat_" data-uid="Terminal.Gui.TextFormatter.NeedsFormat*"></a>
- <h4 id="Terminal_Gui_TextFormatter_NeedsFormat" data-uid="Terminal.Gui.TextFormatter.NeedsFormat">NeedsFormat</h4>
- <div class="markdown level1 summary">
- Gets or sets whether the <a class="xref" href="Terminal.Gui.TextFormatter.html">TextFormatter</a> needs to format the text when <a class="xref" href="Terminal.Gui.TextFormatter.html#Terminal_Gui_TextFormatter_Draw_Terminal_Gui_Rect_Terminal_Gui_Attribute_Terminal_Gui_Attribute_">Draw(Rect, Attribute, Attribute)</a> is called.
- If it is <code>false</code> when Draw is called, the Draw call will be faster.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public bool NeedsFormat { get; set; }</code></pre>
- </div>
- <h5 class="propertyValue">Property Value</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">System.Boolean</span></td>
- <td></td>
- </tr>
- </tbody>
- </table>
- <h5 id="Terminal_Gui_TextFormatter_NeedsFormat_remarks">Remarks</h5>
- <div class="markdown level1 remarks">
- <p>
- This is set to true when the properties of <a class="xref" href="Terminal.Gui.TextFormatter.html">TextFormatter</a> are set.
- </p>
- </div>
-
-
- <a id="Terminal_Gui_TextFormatter_Size_" data-uid="Terminal.Gui.TextFormatter.Size*"></a>
- <h4 id="Terminal_Gui_TextFormatter_Size" data-uid="Terminal.Gui.TextFormatter.Size">Size</h4>
- <div class="markdown level1 summary">
- Gets or sets the size of the area the text will be constrained to when formatted.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public Size Size { get; set; }</code></pre>
- </div>
- <h5 class="propertyValue">Property Value</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><a class="xref" href="Terminal.Gui.Size.html">Size</a></td>
- <td></td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_Text_" data-uid="Terminal.Gui.TextFormatter.Text*"></a>
- <h4 id="Terminal_Gui_TextFormatter_Text" data-uid="Terminal.Gui.TextFormatter.Text">Text</h4>
- <div class="markdown level1 summary">
- The text to be displayed. This text is never modified.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public virtual ustring Text { get; set; }</code></pre>
- </div>
- <h5 class="propertyValue">Property Value</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td></td>
- </tr>
- </tbody>
- </table>
- <h3 id="methods">Methods
- </h3>
-
-
- <a id="Terminal_Gui_TextFormatter_CalcRect_" data-uid="Terminal.Gui.TextFormatter.CalcRect*"></a>
- <h4 id="Terminal_Gui_TextFormatter_CalcRect_System_Int32_System_Int32_NStack_ustring_" data-uid="Terminal.Gui.TextFormatter.CalcRect(System.Int32,System.Int32,NStack.ustring)">CalcRect(Int32, Int32, ustring)</h4>
- <div class="markdown level1 summary">
- Calculates the rectangle required to hold text, assuming no word wrapping.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public static Rect CalcRect(int x, int y, ustring text)</code></pre>
- </div>
- <h5 class="parameters">Parameters</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Name</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td><span class="parametername">x</span></td>
- <td>The x location of the rectangle</td>
- </tr>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td><span class="parametername">y</span></td>
- <td>The y location of the rectangle</td>
- </tr>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td><span class="parametername">text</span></td>
- <td>The text to measure</td>
- </tr>
- </tbody>
- </table>
- <h5 class="returns">Returns</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><a class="xref" href="Terminal.Gui.Rect.html">Rect</a></td>
- <td></td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_ClipAndJustify_" data-uid="Terminal.Gui.TextFormatter.ClipAndJustify*"></a>
- <h4 id="Terminal_Gui_TextFormatter_ClipAndJustify_NStack_ustring_System_Int32_Terminal_Gui_TextAlignment_" data-uid="Terminal.Gui.TextFormatter.ClipAndJustify(NStack.ustring,System.Int32,Terminal.Gui.TextAlignment)">ClipAndJustify(ustring, Int32, TextAlignment)</h4>
- <div class="markdown level1 summary">
- Justifies text within a specified width.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public static ustring ClipAndJustify(ustring text, int width, TextAlignment talign)</code></pre>
- </div>
- <h5 class="parameters">Parameters</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Name</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td><span class="parametername">text</span></td>
- <td>The text to justify.</td>
- </tr>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td><span class="parametername">width</span></td>
- <td>If the text length is greater that <code>width</code> it will be clipped.</td>
- </tr>
- <tr>
- <td><a class="xref" href="Terminal.Gui.TextAlignment.html">TextAlignment</a></td>
- <td><span class="parametername">talign</span></td>
- <td>Alignment.</td>
- </tr>
- </tbody>
- </table>
- <h5 class="returns">Returns</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td>Justified and clipped text.</td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_Draw_" data-uid="Terminal.Gui.TextFormatter.Draw*"></a>
- <h4 id="Terminal_Gui_TextFormatter_Draw_Terminal_Gui_Rect_Terminal_Gui_Attribute_Terminal_Gui_Attribute_" data-uid="Terminal.Gui.TextFormatter.Draw(Terminal.Gui.Rect,Terminal.Gui.Attribute,Terminal.Gui.Attribute)">Draw(Rect, Attribute, Attribute)</h4>
- <div class="markdown level1 summary">
- Draws the text held by <a class="xref" href="Terminal.Gui.TextFormatter.html">TextFormatter</a> to <a class="xref" href="Terminal.Gui.Application.html#Terminal_Gui_Application_Driver">Driver</a> using the colors specified.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public void Draw(Rect bounds, Attribute normalColor, Attribute hotColor)</code></pre>
- </div>
- <h5 class="parameters">Parameters</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Name</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><a class="xref" href="Terminal.Gui.Rect.html">Rect</a></td>
- <td><span class="parametername">bounds</span></td>
- <td>Specifies the screen-relative location and maximum size for drawing the text.</td>
- </tr>
- <tr>
- <td><a class="xref" href="Terminal.Gui.Attribute.html">Attribute</a></td>
- <td><span class="parametername">normalColor</span></td>
- <td>The color to use for all text except the hotkey</td>
- </tr>
- <tr>
- <td><a class="xref" href="Terminal.Gui.Attribute.html">Attribute</a></td>
- <td><span class="parametername">hotColor</span></td>
- <td>The color to use to draw the hotkey</td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_FindHotKey_" data-uid="Terminal.Gui.TextFormatter.FindHotKey*"></a>
- <h4 id="Terminal_Gui_TextFormatter_FindHotKey_NStack_ustring_System_Rune_System_Boolean_System_Int32__Terminal_Gui_Key__" data-uid="Terminal.Gui.TextFormatter.FindHotKey(NStack.ustring,System.Rune,System.Boolean,System.Int32@,Terminal.Gui.Key@)">FindHotKey(ustring, Rune, Boolean, out Int32, out Key)</h4>
- <div class="markdown level1 summary">
- Finds the hotkey and its location in text.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public static bool FindHotKey(ustring text, Rune hotKeySpecifier, bool firstUpperCase, out int hotPos, out Key hotKey)</code></pre>
- </div>
- <h5 class="parameters">Parameters</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Name</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td><span class="parametername">text</span></td>
- <td>The text to look in.</td>
- </tr>
- <tr>
- <td><span class="xref">System.Rune</span></td>
- <td><span class="parametername">hotKeySpecifier</span></td>
- <td>The hotkey specifier (e.g. '_') to look for.</td>
- </tr>
- <tr>
- <td><span class="xref">System.Boolean</span></td>
- <td><span class="parametername">firstUpperCase</span></td>
- <td>If <code>true</code> the legacy behavior of identifying the first upper case character as the hotkey will be enabled.
- Regardless of the value of this parameter, <code>hotKeySpecifier</code> takes precedence.</td>
- </tr>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td><span class="parametername">hotPos</span></td>
- <td>Outputs the Rune index into <code>text</code>.</td>
- </tr>
- <tr>
- <td><a class="xref" href="Terminal.Gui.Key.html">Key</a></td>
- <td><span class="parametername">hotKey</span></td>
- <td>Outputs the hotKey.</td>
- </tr>
- </tbody>
- </table>
- <h5 class="returns">Returns</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">System.Boolean</span></td>
- <td><code>true</code> if a hotkey was found; <code>false</code> otherwise.</td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_Format_" data-uid="Terminal.Gui.TextFormatter.Format*"></a>
- <h4 id="Terminal_Gui_TextFormatter_Format_NStack_ustring_System_Int32_Terminal_Gui_TextAlignment_System_Boolean_" data-uid="Terminal.Gui.TextFormatter.Format(NStack.ustring,System.Int32,Terminal.Gui.TextAlignment,System.Boolean)">Format(ustring, Int32, TextAlignment, Boolean)</h4>
- <div class="markdown level1 summary">
- Reformats text into lines, applying text alignment and optionally wrapping text to new lines on word boundaries.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public static List<ustring> Format(ustring text, int width, TextAlignment talign, bool wordWrap)</code></pre>
- </div>
- <h5 class="parameters">Parameters</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Name</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td><span class="parametername">text</span></td>
- <td></td>
- </tr>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td><span class="parametername">width</span></td>
- <td>The width to bound the text to for word wrapping and clipping.</td>
- </tr>
- <tr>
- <td><a class="xref" href="Terminal.Gui.TextAlignment.html">TextAlignment</a></td>
- <td><span class="parametername">talign</span></td>
- <td>Specifies how the text will be aligned horizontally.</td>
- </tr>
- <tr>
- <td><span class="xref">System.Boolean</span></td>
- <td><span class="parametername">wordWrap</span></td>
- <td>If <code>true</code>, the text will be wrapped to new lines as need. If <code>false</code>, forces text to fit a single line. Line breaks are converted to spaces. The text will be clipped to <code>width</code></td>
- </tr>
- </tbody>
- </table>
- <h5 class="returns">Returns</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">System.Collections.Generic.List</span><<span class="xref">NStack.ustring</span>></td>
- <td>A list of word wrapped lines.</td>
- </tr>
- </tbody>
- </table>
- <h5 id="Terminal_Gui_TextFormatter_Format_NStack_ustring_System_Int32_Terminal_Gui_TextAlignment_System_Boolean__remarks">Remarks</h5>
- <div class="markdown level1 remarks">
- <p>
- An empty <code>text</code> string will result in one empty line.
- </p>
- <p>
- If <code>width</code> is 0, a single, empty line will be returned.
- </p>
- <p>
- If <code>width</code> is int.MaxValue, the text will be formatted to the maximum width possible.
- </p>
- </div>
-
-
- <a id="Terminal_Gui_TextFormatter_Justify_" data-uid="Terminal.Gui.TextFormatter.Justify*"></a>
- <h4 id="Terminal_Gui_TextFormatter_Justify_NStack_ustring_System_Int32_System_Char_" data-uid="Terminal.Gui.TextFormatter.Justify(NStack.ustring,System.Int32,System.Char)">Justify(ustring, Int32, Char)</h4>
- <div class="markdown level1 summary">
- Justifies the text to fill the width provided. Space will be added between words (demarked by spaces and tabs) to
- make the text just fit <code>width</code>. Spaces will not be added to the ends.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public static ustring Justify(ustring text, int width, char spaceChar = ' ')</code></pre>
- </div>
- <h5 class="parameters">Parameters</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Name</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td><span class="parametername">text</span></td>
- <td></td>
- </tr>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td><span class="parametername">width</span></td>
- <td></td>
- </tr>
- <tr>
- <td><span class="xref">System.Char</span></td>
- <td><span class="parametername">spaceChar</span></td>
- <td>Character to replace whitespace and pad with. For debugging purposes.</td>
- </tr>
- </tbody>
- </table>
- <h5 class="returns">Returns</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td>The justified text.</td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_MaxLines_" data-uid="Terminal.Gui.TextFormatter.MaxLines*"></a>
- <h4 id="Terminal_Gui_TextFormatter_MaxLines_NStack_ustring_System_Int32_" data-uid="Terminal.Gui.TextFormatter.MaxLines(NStack.ustring,System.Int32)">MaxLines(ustring, Int32)</h4>
- <div class="markdown level1 summary">
- Computes the number of lines needed to render the specified text given the width.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public static int MaxLines(ustring text, int width)</code></pre>
- </div>
- <h5 class="parameters">Parameters</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Name</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td><span class="parametername">text</span></td>
- <td>Text, may contain newlines.</td>
- </tr>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td><span class="parametername">width</span></td>
- <td>The minimum width for the text.</td>
- </tr>
- </tbody>
- </table>
- <h5 class="returns">Returns</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td>Number of lines.</td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_MaxWidth_" data-uid="Terminal.Gui.TextFormatter.MaxWidth*"></a>
- <h4 id="Terminal_Gui_TextFormatter_MaxWidth_NStack_ustring_System_Int32_" data-uid="Terminal.Gui.TextFormatter.MaxWidth(NStack.ustring,System.Int32)">MaxWidth(ustring, Int32)</h4>
- <div class="markdown level1 summary">
- Computes the maximum width needed to render the text (single line or multiple lines) given a minimum width.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public static int MaxWidth(ustring text, int width)</code></pre>
- </div>
- <h5 class="parameters">Parameters</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Name</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td><span class="parametername">text</span></td>
- <td>Text, may contain newlines.</td>
- </tr>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td><span class="parametername">width</span></td>
- <td>The minimum width for the text.</td>
- </tr>
- </tbody>
- </table>
- <h5 class="returns">Returns</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td>Max width of lines.</td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_RemoveHotKeySpecifier_" data-uid="Terminal.Gui.TextFormatter.RemoveHotKeySpecifier*"></a>
- <h4 id="Terminal_Gui_TextFormatter_RemoveHotKeySpecifier_NStack_ustring_System_Int32_System_Rune_" data-uid="Terminal.Gui.TextFormatter.RemoveHotKeySpecifier(NStack.ustring,System.Int32,System.Rune)">RemoveHotKeySpecifier(ustring, Int32, Rune)</h4>
- <div class="markdown level1 summary">
- Removes the hotkey specifier from text.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public static ustring RemoveHotKeySpecifier(ustring text, int hotPos, Rune hotKeySpecifier)</code></pre>
- </div>
- <h5 class="parameters">Parameters</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Name</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td><span class="parametername">text</span></td>
- <td>The text to manipulate.</td>
- </tr>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td><span class="parametername">hotPos</span></td>
- <td>Returns the position of the hot-key in the text. -1 if not found.</td>
- </tr>
- <tr>
- <td><span class="xref">System.Rune</span></td>
- <td><span class="parametername">hotKeySpecifier</span></td>
- <td>The hot-key specifier (e.g. '_') to look for.</td>
- </tr>
- </tbody>
- </table>
- <h5 class="returns">Returns</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td>The input text with the hotkey specifier ('_') removed.</td>
- </tr>
- </tbody>
- </table>
-
-
- <a id="Terminal_Gui_TextFormatter_ReplaceHotKeyWithTag_" data-uid="Terminal.Gui.TextFormatter.ReplaceHotKeyWithTag*"></a>
- <h4 id="Terminal_Gui_TextFormatter_ReplaceHotKeyWithTag_NStack_ustring_System_Int32_" data-uid="Terminal.Gui.TextFormatter.ReplaceHotKeyWithTag(NStack.ustring,System.Int32)">ReplaceHotKeyWithTag(ustring, Int32)</h4>
- <div class="markdown level1 summary">
- Replaces the Rune at the index specified by the <code>hotPos</code> parameter with a tag identifying
- it as the hotkey.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public ustring ReplaceHotKeyWithTag(ustring text, int hotPos)</code></pre>
- </div>
- <h5 class="parameters">Parameters</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Name</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td><span class="parametername">text</span></td>
- <td>The text to tag the hotkey in.</td>
- </tr>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td><span class="parametername">hotPos</span></td>
- <td>The Rune index of the hotkey in <code>text</code>.</td>
- </tr>
- </tbody>
- </table>
- <h5 class="returns">Returns</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td>The text with the hotkey tagged.</td>
- </tr>
- </tbody>
- </table>
- <h5 id="Terminal_Gui_TextFormatter_ReplaceHotKeyWithTag_NStack_ustring_System_Int32__remarks">Remarks</h5>
- <div class="markdown level1 remarks">
- The returned string will not render correctly without first un-doing the tag. To undo the tag, search for
- Runes with a bitmask of <code>otKeyTagMask</code> and remove that bitmask.
- </div>
-
-
- <a id="Terminal_Gui_TextFormatter_WordWrap_" data-uid="Terminal.Gui.TextFormatter.WordWrap*"></a>
- <h4 id="Terminal_Gui_TextFormatter_WordWrap_NStack_ustring_System_Int32_" data-uid="Terminal.Gui.TextFormatter.WordWrap(NStack.ustring,System.Int32)">WordWrap(ustring, Int32)</h4>
- <div class="markdown level1 summary">
- Formats the provided text to fit within the width provided using word wrapping.
- </div>
- <div class="markdown level1 conceptual"></div>
- <h5 class="decalaration">Declaration</h5>
- <div class="codewrapper">
- <pre><code class="lang-csharp hljs">public static List<ustring> WordWrap(ustring text, int width)</code></pre>
- </div>
- <h5 class="parameters">Parameters</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Name</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">NStack.ustring</span></td>
- <td><span class="parametername">text</span></td>
- <td>The text to word wrap</td>
- </tr>
- <tr>
- <td><span class="xref">System.Int32</span></td>
- <td><span class="parametername">width</span></td>
- <td>The width to contain the text to</td>
- </tr>
- </tbody>
- </table>
- <h5 class="returns">Returns</h5>
- <table class="table table-bordered table-striped table-condensed">
- <thead>
- <tr>
- <th>Type</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><span class="xref">System.Collections.Generic.List</span><<span class="xref">NStack.ustring</span>></td>
- <td>Returns a list of word wrapped lines.</td>
- </tr>
- </tbody>
- </table>
- <h5 id="Terminal_Gui_TextFormatter_WordWrap_NStack_ustring_System_Int32__remarks">Remarks</h5>
- <div class="markdown level1 remarks">
- <p>
- This method does not do any justification.
- </p>
- <p>
- This method strips Newline ('\n' and '\r\n') sequences before processing.
- </p>
- </div>
- </article>
- </div>
-
- <div class="hidden-sm col-md-2" role="complementary">
- <div class="sideaffix">
- <div class="contribution">
- <ul class="nav">
- </ul>
- </div>
- <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
- <h5>In This Article</h5>
- <div></div>
- </nav>
- </div>
- </div>
- </div>
- </div>
-
- <footer>
- <div class="grad-bottom"></div>
- <div class="footer">
- <div class="container">
- <span class="pull-right">
- <a href="#top">Back to top</a>
- </span>
-
- <span>Generated by <strong>DocFX</strong></span>
- </div>
- </div>
- </footer>
- </div>
-
- <script type="text/javascript" src="../../styles/docfx.vendor.js"></script>
- <script type="text/javascript" src="../../styles/docfx.js"></script>
- <script type="text/javascript" src="../../styles/main.js"></script>
- </body>
- </html>
|