Documentation
¶
Overview ¶
Package ui consists of console ui components
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package ui consists of console ui components ¶
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package ui consists of console ui components ¶
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package ui consists of console ui components ¶
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package ui consists of console ui components ¶
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package ui consists of console ui components ¶
Copyright 2021 Michael Bungenstock ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func ConnectTabable(prev, next Tabable)
- func ErrorDialog(pages *FocusPages, err error)
- func InfoDialog(pages *FocusPages, message string)
- func NewPadded(p tview.Primitive, left, top int) tview.Primitive
- func OpenFileDialog(pages *FocusPages, selectedFunc func(string))
- type FocusFlex
- type FocusPages
- type FormButton
- func (f *FormButton) After(previous Tabable) *FormButton
- func (f *FormButton) Focus(delegate func(p tview.Primitive))
- func (f *FormButton) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (f *FormButton) Primitive() tview.Primitive
- func (f *FormButton) SetFocusedFunc(ff *FocusFlex, focused func()) *FormButton
- func (f *FormButton) SetNext(next Tabable)
- func (f *FormButton) SetPrev(prev Tabable)
- type FormField
- func (f *FormField) After(previous Tabable) *FormField
- func (f *FormField) Blur()
- func (f *FormField) Draw(screen tcell.Screen)
- func (f *FormField) Focus(delegate func(p tview.Primitive))
- func (f *FormField) GetText() string
- func (f *FormField) HasFocus() bool
- func (f *FormField) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (f *FormField) MouseHandler() ...
- func (f *FormField) Primitive() tview.Primitive
- func (f *FormField) SetFocusedFunc(ff *FocusFlex, focused ...func()) *FormField
- func (f *FormField) SetNext(next Tabable)
- func (f *FormField) SetPrev(prev Tabable)
- func (f *FormField) SetText(text string) *FormField
- type TabButton
- type Tabable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectTabable ¶
func ConnectTabable(prev, next Tabable)
ConnectTabable connects two Tabalbe components
func ErrorDialog ¶
func ErrorDialog(pages *FocusPages, err error)
ErrorDialog shows a modal dialog with a message
func InfoDialog ¶
func InfoDialog(pages *FocusPages, message string)
InfoDialog shows a modal dialog with a message
func OpenFileDialog ¶
func OpenFileDialog(pages *FocusPages, selectedFunc func(string))
OpenFileDialog opens a new file dialog
Types ¶
type FocusFlex ¶
FocusFlex stores the Last primitive with focus and returns the focus to it if method Focus have been called
func NewFocusFlex ¶
func NewFocusFlex() *FocusFlex
NewFocusFlex creates an initialized FocusFlex object
type FocusPages ¶
FocusPages fixes a problem with greedy MouseHandler implementations. If you want to switch a page in a SelectFunc called by the MouseHandler, then this is not possible. Table for example sets back the focus to itself after the execution and that is not what we want.
func NewFocusPages ¶
func NewFocusPages() *FocusPages
NewFocusPages returns an initialized FocusPages object
func (*FocusPages) MouseHandler ¶
func (f *FocusPages) MouseHandler() func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive)
MouseHandler implements the fix. If the numer of pages changes then the focus will be set to the current page.
type FormButton ¶
type FormButton struct { *tview.Button Focused func() Parent *FocusFlex // contains filtered or unexported fields }
FormButton implements a button for home-made forms
func NewFormButton ¶
func NewFormButton(label string) *FormButton
NewFormButton creates an initialzed FormButton object
func (*FormButton) After ¶
func (f *FormButton) After(previous Tabable) *FormButton
After connects this button with the previous Tabable
func (*FormButton) Focus ¶
func (f *FormButton) Focus(delegate func(p tview.Primitive))
Focus calls the original Button Focus function, stores this FormButton as last focused object and calls the Focused function if set
func (*FormButton) InputHandler ¶
func (f *FormButton) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
InputHandler handles the keyboard input
func (*FormButton) Primitive ¶
func (f *FormButton) Primitive() tview.Primitive
Primitive returns the this object with the tview.Primitive interface
func (*FormButton) SetFocusedFunc ¶
func (f *FormButton) SetFocusedFunc(ff *FocusFlex, focused func()) *FormButton
SetFocusedFunc sets the function which will be called when this FormButton receives the focus
func (*FormButton) SetNext ¶
func (f *FormButton) SetNext(next Tabable)
SetNext sets the next tview.Primitive in the navigation order
func (*FormButton) SetPrev ¶
func (f *FormButton) SetPrev(prev Tabable)
SetPrev sets the previous tview.Primitive in the navigation order
type FormField ¶
type FormField struct { *tview.Box Input *focusedInputField Button *focusedButton ButtonFirst bool // contains filtered or unexported fields }
FormField consists of an input fiels and a button.
func NewFileField ¶
func NewFileField(label string, pages *FocusPages) *FormField
NewFileField returns a textfield with a file
func NewPasteField ¶
NewPasteField returns a textfield with a past button
func (*FormField) Blur ¶
func (f *FormField) Blur()
Blur forwards the call to the Inputform and Button
func (*FormField) InputHandler ¶
InputHandler handles the keyboard input
func (*FormField) MouseHandler ¶
func (f *FormField) MouseHandler() func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive)
MouseHandler handles mouse input
func (*FormField) SetFocusedFunc ¶
SetFocusedFunc sets the Focused functions for the InpurtForm and the Button
type TabButton ¶
TabButton extends the tview.Button with a tab navigatioin
func NewTabButton ¶
NewTabButton creates an initialized TabButton object
func (*TabButton) InputHandler ¶
InputHandler captures the tab events, other events are handled by the orignial InputHandler