edvin / tornadofx2

TornadoFX 2.0
Apache License 2.0
156 stars 41 forks source link

add footer below workspace bottom drawer #29

Open SKeeneCode opened 3 years ago

SKeeneCode commented 3 years ago

This feature would add a footer below the bottom drawer of the workspace - giving the developer another option in where to place controls in their workspace application.

A footer like this is used in IntelliJ to display various information underneath its own bottom drawer:

image

Another example, of how Microsoft Word uses this space:

image

My understanding is the use of a footer like this is to hold controls and information that is not important or suitable to be displayed in the main toolbar, but are important enough to be visible on screen and not hidden inside some menu.

I've created a WIP pull request that gives a first draft implementation.

This implementation includes a togglable property in the workspace to show/hide the footer. It also allows the dynamic adding/removing of controls much like the normal header does.

If you checkout the PR, you can play with it with the following minimal example:

Example

``` class MyWorkspace : Workspace(navigationMode = NavigationMode.Tabs) { init { primaryStage.width = 800.0 primaryStage.height = 600.0 } init { with(leftDrawer) { item("Left Drawer Item", expanded = true) { vbox { button("new page") { action { dockInNewScope() } } } } } with(bottomDrawer) { item("Bottom Drawer Item", expanded = false) { vbox { label("Hello I am a label") } } } with(footer) { button("Static Button Added In Custom Workspace init") } } } class Page : View("My Page") { val myTitle = UUID.randomUUID().toString().take(4) init { title = myTitle } override fun onDock() { with(workspace.rightDrawer) { item("Right Drawer Item $title", expanded = false) { label(this.toString()) } } with(workspace.footer) { button("Dynamic button added inside ondock of page $title") label("Dynamic Label: $title") } } override val root = flowpane { button("toggle footer") { action { workspace.showFooter = !workspace.showFooter } } } } class MyApp : App(MyWorkspace::class) { } fun main() { launch() } ```

image

Happy to have a discussion of the usefulness of this feature (feature creep?). Suggestions on enhancements etc welcome.