mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-22 18:59:59 +08:00
Update docs to use std::string. (#184)
This commit is contained in:
parent
9a54528bca
commit
4450cca31a
@ -52,9 +52,9 @@ A simple C++ library for terminal based user interface.
|
|||||||
~~~cpp
|
~~~cpp
|
||||||
vbox({
|
vbox({
|
||||||
hbox({
|
hbox({
|
||||||
text(L"left") | border,
|
text("left") | border,
|
||||||
text(L"middle") | border | flex,
|
text("middle") | border | flex,
|
||||||
text(L"right") | border,
|
text("right") | border,
|
||||||
}),
|
}),
|
||||||
gauge(0.5) | border,
|
gauge(0.5) | border,
|
||||||
});
|
});
|
||||||
|
@ -21,9 +21,9 @@ int main(void) {
|
|||||||
// Define the document
|
// Define the document
|
||||||
Element document =
|
Element document =
|
||||||
hbox({
|
hbox({
|
||||||
text(L"left") | border,
|
text("left") | border,
|
||||||
text(L"middle") | border | flex,
|
text("middle") | border | flex,
|
||||||
text(L"right") | border,
|
text("right") | border,
|
||||||
});
|
});
|
||||||
|
|
||||||
auto screen = Screen::Create(
|
auto screen = Screen::Create(
|
||||||
@ -141,9 +141,9 @@ can be responsive to the terminal dimensions.
|
|||||||
```cpp
|
```cpp
|
||||||
// Define the document
|
// Define the document
|
||||||
Element document = vbox({
|
Element document = vbox({
|
||||||
text(L"The window") | bold | color(Color::Blue),
|
text("The window") | bold | color(Color::Blue),
|
||||||
gauge(0.5)
|
gauge(0.5)
|
||||||
text(L"The footer")
|
text("The footer")
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add a border.
|
// Add a border.
|
||||||
@ -160,7 +160,7 @@ You only need one header: ftxui/dom/elements.hpp
|
|||||||
|
|
||||||
The most simple widget. It displays a text.
|
The most simple widget. It displays a text.
|
||||||
~~~cpp
|
~~~cpp
|
||||||
text(L"I am a piece of text");
|
text("I am a piece of text");
|
||||||
~~~
|
~~~
|
||||||
~~~bash
|
~~~bash
|
||||||
I am a piece of text.
|
I am a piece of text.
|
||||||
@ -170,7 +170,7 @@ I am a piece of text.
|
|||||||
|
|
||||||
Add a border around an element
|
Add a border around an element
|
||||||
~~~cpp
|
~~~cpp
|
||||||
border(text(L"The element"))
|
border(text("The element"))
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
~~~bash
|
~~~bash
|
||||||
@ -184,7 +184,7 @@ border(text(L"The element"))
|
|||||||
A `ftxui::window` is a `ftxui::border`, but with some text on top of the border.
|
A `ftxui::window` is a `ftxui::border`, but with some text on top of the border.
|
||||||
Add a border around an element
|
Add a border around an element
|
||||||
~~~cpp
|
~~~cpp
|
||||||
window(L"The window", text(L"The element"))
|
window("The window", text("The element"))
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
~~~bash
|
~~~bash
|
||||||
@ -201,9 +201,9 @@ container in two.
|
|||||||
~~~cpp
|
~~~cpp
|
||||||
border(
|
border(
|
||||||
hbox({
|
hbox({
|
||||||
text(L"Left"),
|
text("Left"),
|
||||||
separator(),
|
separator(),
|
||||||
text(L"Right")
|
text("Right")
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
~~~
|
~~~
|
||||||
@ -272,9 +272,9 @@ On most terminal the following colors are supported:
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
```cpp
|
```cpp
|
||||||
text(L"Blue foreground") | color(Color::Blue);
|
text("Blue foreground") | color(Color::Blue);
|
||||||
text(L"Blue background") | bgcolor(Color::Blue);
|
text("Blue background") | bgcolor(Color::Blue);
|
||||||
text(L"Black on white") | color(Color::Black) | bgcolor(Color::White);
|
text("Black on white") | color(Color::Black) | bgcolor(Color::White);
|
||||||
```
|
```
|
||||||
|
|
||||||
### Palette256
|
### Palette256
|
||||||
@ -285,7 +285,7 @@ On terminal supporting 256 colors.
|
|||||||
@endhtmlonly
|
@endhtmlonly
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
text(L"HotPink") | color(Color::HotPink);
|
text("HotPink") | color(Color::HotPink);
|
||||||
```
|
```
|
||||||
|
|
||||||
### TrueColor
|
### TrueColor
|
||||||
@ -320,12 +320,12 @@ Decorator bgcolor(Color);
|
|||||||
|
|
||||||
Example:
|
Example:
|
||||||
~~~cpp
|
~~~cpp
|
||||||
underlined(bold(text(L"This text is bold and underlined")))
|
underlined(bold(text("This text is bold and underlined")))
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
Tips: The pipe operator can be used to chain Decorator:
|
Tips: The pipe operator can be used to chain Decorator:
|
||||||
~~~cpp
|
~~~cpp
|
||||||
text(L"This text is bold")) | bold | underlined
|
text("This text is bold")) | bold | underlined
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
## Layout
|
## Layout
|
||||||
@ -348,10 +348,10 @@ An horizontal flow layout is implemented by:
|
|||||||
**Examples**
|
**Examples**
|
||||||
~~~cpp
|
~~~cpp
|
||||||
hbox({
|
hbox({
|
||||||
text(L"left") | border ,
|
text("left") | border ,
|
||||||
text(L"middle") | border | flex,
|
text("middle") | border | flex,
|
||||||
text(L"right") | border,
|
text("right") | border,
|
||||||
});
|
});
|
||||||
~~~
|
~~~
|
||||||
~~~bash
|
~~~bash
|
||||||
┌────┐┌─────────────────────────────────────────────────────────────────┐┌─────┐
|
┌────┐┌─────────────────────────────────────────────────────────────────┐┌─────┐
|
||||||
@ -361,10 +361,10 @@ An horizontal flow layout is implemented by:
|
|||||||
|
|
||||||
~~~cpp
|
~~~cpp
|
||||||
hbox({
|
hbox({
|
||||||
text(L"left") | border ,
|
text("left") | border ,
|
||||||
text(L"middle") | border | flex,
|
text("middle") | border | flex,
|
||||||
text(L"right") | border | flex,
|
text("right") | border | flex,
|
||||||
});
|
});
|
||||||
~~~
|
~~~
|
||||||
~~~bash
|
~~~bash
|
||||||
┌────┐┌───────────────────────────────────┐┌───────────────────────────────────┐
|
┌────┐┌───────────────────────────────────┐┌───────────────────────────────────┐
|
||||||
|
Loading…
Reference in New Issue
Block a user