Skip to content

Commit a39b22c

Browse files
committed
docs: update documentation for Panel system replacing StatusBarOptions
- Add docs/PANELS.md with full Panel system reference (elements, builders, runtime access, migration guide) - Rewrite CONFIGURATION.md to use TopPanelConfig/BottomPanelConfig instead of StatusBarOptions - Rewrite STATUS_SYSTEM.md for Panel-based architecture with Elements.* factory - Add PanelStateService section to STATE-SERVICES.md - Add Panel and Element Builders section to BUILDERS.md - Update README.md doc table and Built-in Services example - Fix stale StatusBarOptions reference in VIDEO_PLAYBACK.md
1 parent 3df5ceb commit a39b22c

7 files changed

Lines changed: 1063 additions & 525 deletions

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ window.AddControl(Controls.Button("Submit")
170170
// Notifications
171171
windowSystem.NotificationStateService.ShowNotification("Title", "Message", NotificationSeverity.Info);
172172

173+
// Panel status text
174+
windowSystem.PanelStateService.TopStatus = "[bold]My App[/]";
175+
windowSystem.PanelStateService.BottomStatus = "Ready";
176+
173177
// Debug logging (file-based, never console)
174178
// export SHARPCONSOLEUI_DEBUG_LOG=/tmp/consoleui.log
175179
windowSystem.LogService.LogAdded += (s, entry) => { /* handle */ };
@@ -281,7 +285,8 @@ dotnet run --project Examples/DemoApp
281285
| **[DOM Layout System](docs/DOM_LAYOUT_SYSTEM.md)** | Layout engine internals |
282286
| **[Rendering Pipeline](docs/RENDERING_PIPELINE.md)** | Rendering architecture details |
283287
| **[Portal System](docs/PORTAL_SYSTEM.md)** | Floating portals and overlay system |
284-
| **[Status System](docs/STATUS_SYSTEM.md)** | Status bars, window task bar, Start Menu |
288+
| **[Panel System](docs/PANELS.md)** | Configurable top/bottom panels with elements |
289+
| **[Panels, Task Bar & Start Menu](docs/STATUS_SYSTEM.md)** | Task bar, Start Menu, performance metrics |
285290
| **[Desktop Host (schost)](docs/SCHOST.md)** | Launch, package, and distribute TUI apps as desktop apps |
286291

287292
**API Reference**: [nickprotop.github.io/ConsoleEx](https://nickprotop.github.io/ConsoleEx/)

docs/BUILDERS.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SharpConsoleUI provides fluent builder APIs for creating windows and controls wi
77
## Table of Contents
88

99
- [WindowBuilder](#windowbuilder)
10+
- [Panel and Element Builders](#panel-and-element-builders)
1011
- [Control Builders](#control-builders)
1112
- [Controls Static Factory](#controls-static-factory)
1213
- [Builder Patterns](#builder-patterns)
@@ -122,6 +123,93 @@ var mainWindow = new WindowBuilder(windowSystem)
122123
.Build();
123124
```
124125

126+
## Panel and Element Builders
127+
128+
Panel builders configure the top and bottom screen-level bars. See the [Panel System guide](PANELS.md) for the full reference.
129+
130+
### PanelBuilder
131+
132+
```csharp
133+
using SharpConsoleUI.Panel;
134+
135+
// Used via ConsoleWindowSystemOptions
136+
var options = new ConsoleWindowSystemOptions(
137+
TopPanelConfig: panel => panel
138+
.Left(Elements.StatusText("[bold cyan]My App[/]"))
139+
.Left(Elements.Separator())
140+
.Right(Elements.Performance()),
141+
BottomPanelConfig: panel => panel
142+
.Left(Elements.StartMenu())
143+
.Center(Elements.TaskBar())
144+
.Right(Elements.Clock().WithFormat("HH:mm:ss"))
145+
);
146+
147+
// Or standalone
148+
var panel = Panel.Builder()
149+
.Left(Elements.StatusText("Left"))
150+
.Center(Elements.TaskBar())
151+
.Right(Elements.Clock())
152+
.WithBackgroundColor(Color.DarkBlue)
153+
.Build();
154+
```
155+
156+
**Methods:**
157+
- `.Left(element)` / `.Center(element)` / `.Right(element)` — Add element to zone
158+
- `.WithBackgroundColor(Color)` — Set background color
159+
- `.WithForegroundColor(Color)` — Set foreground color
160+
- `.Visible(bool)` — Set initial visibility
161+
- `.Build()` — Build the Panel
162+
163+
### Elements Factory
164+
165+
The `Elements` static class returns element builders:
166+
167+
```csharp
168+
Elements.StatusText("text") // StatusTextElementBuilder
169+
Elements.Separator() // SeparatorElementBuilder
170+
Elements.TaskBar() // TaskBarElementBuilder
171+
Elements.Clock() // ClockElementBuilder
172+
Elements.Performance() // PerformanceElementBuilder
173+
Elements.StartMenu() // StartMenuElementBuilder
174+
Elements.Custom("name") // CustomElementBuilder
175+
```
176+
177+
### Element Builder Examples
178+
179+
```csharp
180+
// StatusText with click handler
181+
Elements.StatusText("[bold]Title[/]")
182+
.WithName("title")
183+
.WithColor(Color.Cyan1)
184+
.OnClick(() => ShowAbout())
185+
186+
// Clock with custom format
187+
Elements.Clock()
188+
.WithFormat("HH:mm:ss")
189+
.WithColor(Color.Yellow)
190+
.WithUpdateInterval(1000)
191+
192+
// Start Menu with options
193+
Elements.StartMenu()
194+
.WithText("☰ Start")
195+
.WithColors(Color.White, Color.DarkBlue)
196+
.WithShortcutKey(ConsoleKey.Spacebar, ConsoleModifiers.Control)
197+
.WithOptions(new StartMenuOptions { AppName = "My App" })
198+
199+
// TaskBar with colors
200+
Elements.TaskBar()
201+
.WithActiveColor(Color.Cyan1)
202+
.WithInactiveColor(Color.Grey50)
203+
204+
// Custom element
205+
Elements.Custom("indicator")
206+
.WithFixedWidth(12)
207+
.WithRenderCallback((buffer, x, y, width, fg, bg) =>
208+
{
209+
buffer.WriteString(x, y, "● Online", fg, bg);
210+
})
211+
```
212+
125213
## Control Builders
126214

127215
Control builders provide fluent APIs for configuring controls before adding them to windows.

0 commit comments

Comments
 (0)