Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FTXUI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Will2.Mcgregor@live.uwe.ac.uk
FTXUI
Commits
c854d07d
Commit
c854d07d
authored
6 years ago
by
Arthur Sonzogni
Browse files
Options
Downloads
Patches
Plain Diff
Update tutorial.md and readme.md
parent
0b8a2ec1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+33
-0
33 additions, 0 deletions
README.md
tutorial.md
+32
-10
32 additions, 10 deletions
tutorial.md
with
65 additions
and
10 deletions
README.md
0 → 100644
+
33
−
0
View file @
c854d07d
# FTXUI
A C++ library for making text based user interface.
## Feature
*
Functional style.
*
Simple and elegant syntax (in my opinion).
*
No dependencies.
## Example:
~~~
cpp
vbox
(
hbox
(
text
(
L"left"
)
|
frame
,
text
(
L"middle"
)
|
frame
|
flex
,
text
(
L"right"
)
|
frame
),
gauge
(
0.5
)
|
frame
)
~~~
~~~
bash
┌────┐┌───────────────────────────────────────────────────────────────┐┌─────┐
│left││middle ││right│
└────┘└───────────────────────────────────────────────────────────────┘└─────┘
┌────────────────────────────────────────────────────────────────────────────┐
│██████████████████████████████████████ │
└────────────────────────────────────────────────────────────────────────────┘
~~~
## Tutorial
See
[
Tutorial
](
./tutorial.md
)
This diff is collapsed.
Click to expand it.
tutorial.md
+
32
−
10
View file @
c854d07d
...
...
@@ -24,17 +24,18 @@ It declares the following set of elements:
// --- Layout ----
Element
vbox
(
Children
);
Element
hbox
(
Children
);
Element
flex
();
Element
dbox
(
Children
);
Element
filler
();
Element
flex
(
Element
);
// --- Widget --
Element
text
(
std
::
wstring
text
);
Element
separator
();
Element
gauge
(
float
ratio
);
Element
frame
(
Child
);
Element
frame
(
Child
title
,
Child
content
);
Element
frame
(
Element
);
Element
window
(
Child
title
,
Child
content
);
// --
Style
---
// --
Decorator
---
Element
bold
(
Element
);
Element
dim
(
Element
);
Element
inverted
(
Element
);
...
...
@@ -42,6 +43,8 @@ Element underlined(Element);
Element
blink
(
Element
);
Element
color
(
Color
,
Element
);
Element
bgcolor
(
Color
,
Element
);
Decorator
color
(
Color
);
Decorator
bgcolor
(
Color
);
// --- Util ---
Element
hcenter
(
Element
);
...
...
@@ -69,12 +72,16 @@ Element bgcolor(Color, Element);
### Layout
vbox (Vertical-box) and hbox (Horizontal-box) are containers. They are used to
compose all the elements together. They will display their children one by one in one direction.
Each elements will occupy the space it required plus a fraction of the remaining
space dispatched to all the flexible elements.
*
vbox (Vertical-box)
*
hbox (Horizontal-box)
*
fbox (Depth-box)
are containers. They are used to compose all the elements together. Each
children are put side by side. If the container is flexible, the extra space
available will be shared among the remaining flexible children.
flex() is used to make an element flexible.
flex(element) can be used to make a non-flexible element flexible.
filler() is a flexible empty element. You can use it to children on one side of
the container.
#### Examples
~~~
cpp
...
...
@@ -117,7 +124,7 @@ I am a piece of text.
#### frame
Add a border arround an element
~~~
c
+
~~~
c
pp
frame
(
text
(
L"The element"
))
~~~
...
...
@@ -166,6 +173,21 @@ frame(gauge(0.5))
└────────────────────────────────────────────────────────────────────────────┘
~~~
### Decorator
Terminal supports displaying text using differet style: bold, dim, underlined,
inverted, blink. It even support foreground and background color.
Example:
~~~
cpp
underlined
(
bold
(
text
(
L"This text is bold and underlined"
)))
~~~
Tips: The pipe operator can be used to chain Decorator:
~~~
cpp
text
(
L"This text is bold"
))
|
bold
|
underlined
~~~
## Components.
### Input
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment