Skip to content

Commit db68d7f

Browse files
authored
Doc updates (#457)
1 parent f83c855 commit db68d7f

File tree

2 files changed

+172
-10
lines changed

2 files changed

+172
-10
lines changed

doc/README.md

+59-10
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,76 @@ TOC
66
- [Hello world app](hello-world-app.md)
77
- [Building for different platforms](building-for-different-platforms.md)
88

9+
- Windows
10+
- Application
11+
912
- Layout
1013
- [Layout DSL](layout-dsl.md)
14+
- Linear Layouts
1115
- Constraint system
1216

1317
- Controls
1418
- Label
15-
- Button
16-
- Text Field
17-
- Slider
19+
- [Buttons](../nimx/button.nim)
20+
- Button
21+
- ImageButton
22+
- Popup Button
23+
- CheckBox
24+
- RadioBox
25+
- Menus
1826
- Progress Indicator
19-
- Popup Button
27+
- Scrollbar
2028
- Segmented Control
29+
- Slider
30+
- Text Field
31+
- Label
32+
- Numeric
33+
- Text
34+
- Toolbar
2135

22-
- Views
23-
- View
24-
- Scroll View
25-
- Table View
26-
- Split View
27-
- Collection View
36+
- [Views](views.md)
37+
- [Collection View](views.md#Collection-View)
38+
- [Expanding View](views.md#Expanding-View)
39+
- [Form View](views.md#Form-View)
40+
- [Horizontal List View](views.md#Horizontal-List-View)
41+
- [Image View](views.md#Image-View)
42+
- [Inspector View](views.md#Inspector-View)
43+
- [Outline View](views.md#Outline-View)
44+
- [Panel (collapsable view)](views.md#Panel-View)
45+
- Inspector Panel
46+
- [Scroll View](views.md#Scroll-View)
47+
- [Split View](views.md#Split-View)
48+
- [Stack View](views.md#Stack-View)
49+
- [Table View](views.md#Table-View)
2850

2951
- Asset management
52+
3053
- Custom views/controls
3154
- Drawing
55+
- Animation
56+
- Image
57+
- Image
58+
- Image Preview
59+
- Color
60+
- Composition
61+
- Context
62+
- Formatted Text
63+
- Screenshot
64+
- [Drag and Drop](../test/sample13_drag_and_drop.nim)
3265
- Event handling
66+
- Pasteboards
67+
- Timer
68+
- Updating controls (setNeedsDisplay() or update())
69+
70+
- Miscellaneous
71+
- [Cursors](../nimx/cursor.nim)
72+
- [Fonts](../nimx/font.nim)
73+
- Gestures
74+
- [HTTP Request](../nimx/http_request.nim)
75+
- [Key Commands](../nimx/key_commands.nim)
76+
- [Keyboard](../nimx/keyboard.nim)
77+
- [Paths](../nimx/pathutils.nim)
78+
- [Property Visitor](../nimx/property_visitor.nim)
79+
- [System Logger](../nimx/system_logger.nim)
80+
- [Unicode strings](../nimx/unistring.nim)
81+
- [Undo Manager](../nimx/undo_manager.nim)

doc/views.md

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
Views
2+
=====
3+
4+
**Views** within a window are used to layout controls or other views.
5+
6+
Note: a Panel view is a collapsable view.
7+
8+
Collection View
9+
---------------
10+
11+
A [**collection** view](../nimx/collection_view.nim) will layout a collection (sequence) of items in a direction of either left-to-right or top-down,
12+
where items is a pre-defined size on the screen.
13+
14+
Each item is wrapped in a subview.
15+
16+
[See Test 7 code](../test/sample07_collections.nim)
17+
18+
Expanding View
19+
--------------
20+
21+
An [**expanding** view](../nimx/expanding_view.nim) has a button that can be clicked to expand the view to display (or hide) the full content of the view.
22+
23+
[See Test 11 code](../test/sample11_expanded_views.nim)
24+
25+
Form View
26+
---------
27+
28+
A **form** view lays out a specified number of label/Text_Field pairs. The labels and values of the Text Fields can then be set with the `setValue()`
29+
or retrieved with the `inputValue()` procs.
30+
31+
Currently, to have different input types other than a Text Field would require overloading the [FormView definition](../nimx/form_view.nim).
32+
33+
34+
Horizontal List View
35+
--------------------
36+
37+
A scrollable [horizontal list](../nimx/horizontal_list_view.nim) of views
38+
39+
40+
Image View
41+
----------
42+
43+
[Image view](../nimx/image_view.nim) is a view for drawing static images.
44+
45+
Filling rules:
46+
- **NoFill** is drawn from the top-left corner with its size
47+
- **Stretch** is stretched to the view size
48+
- **Tile** all of the view
49+
- **FitWidth** to the view's width
50+
- **FitHeight** to the view's height
51+
- **NinePartImage**
52+
53+
Inspector View
54+
--------------
55+
56+
A vertical layout [view](../nimx/inspector_view.nim) for inspecting object properties.
57+
58+
Outline View
59+
------------
60+
61+
An [**Outline** view](../nimx/outline_view.nim) allows dragging of child elements to different levels of a hierarchical list.
62+
63+
Panel View
64+
----------
65+
66+
A collapseable [view](../nimx/panel_view.nim) that allows the showing/hiding of its content.
67+
68+
The [inspector Panel](../nimx/inspector_panel.nim) is collapseable Inspector View.
69+
70+
Scroll View
71+
-----------
72+
73+
[See the main test code](../test/main.nim)
74+
75+
Split View
76+
-----------
77+
78+
A [view](../nimx/split_view.nim) with a movable divider between sections for resizing the sub-views.
79+
80+
```
81+
import nimx / [ window, layout, button, text_field, split_view, scroll_view, context ]
82+
83+
let red = newColor(1, 0, 0)
84+
let blue = newColor(0, 0, 1)
85+
let yellow = newColor(1, 1, 0)
86+
87+
runApplication:
88+
let w = newWindow(newRect(50, 50, 500, 150))
89+
w.makeLayout: # DSL follows
90+
- SplitView:
91+
frame == inset(super, 10)
92+
93+
- ScrollView:
94+
backgroundColor: blue
95+
size >= [200, 500]
96+
- View:
97+
backgroundColor: red
98+
size == [100, 900]
99+
100+
- View:
101+
backgroundColor: yellow
102+
width >= 100
103+
```
104+
105+
Stack View
106+
----------
107+
108+
A [vertical linear](../nimx/stack_view.nim) view.
109+
110+
Table View
111+
----------
112+
113+
A [table or grid](../nimx/table_view.nim) view, with controls/view arranged in a rows and columns.

0 commit comments

Comments
 (0)