| 1 |
// gomuks - A terminal Matrix client written in Go. |
| 2 |
// Copyright (C) 2020 Tulir Asokan |
| 3 |
// |
| 4 |
// This program is free software: you can redistribute it and/or modify |
| 5 |
// it under the terms of the GNU Affero General Public License as published by |
| 6 |
// the Free Software Foundation, either version 3 of the License, or |
| 7 |
// (at your option) any later version. |
| 8 |
// |
| 9 |
// This program is distributed in the hope that it will be useful, |
| 10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
// GNU Affero General Public License for more details. |
| 13 |
// |
| 14 |
// You should have received a copy of the GNU Affero General Public License |
| 15 |
// along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 |
|
| 17 |
package htmlscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/ |
| 18 |
|
| 19 |
import ( |
| 20 |
"go.mau.fi/mauviewscip-go gomod go.mau.fi/mauview v0.2.1 `go.mau.fi/mauview`/" |
| •21 |
"github.com/gdamore/tcell/v2scip-go gomod github.com/golang/go/src go1.21 `github.com/gdamore/tcell/v2`/" |
| 22 |
) |
| 23 |
|
| 24 |
// AdjustStyleFunc is a lambda function type to edit an existing tcell Style. |
| 25 |
type AdjustStyleFuncscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/AdjustStyleFunc# func(tcell.Style) tcell.Style |
| 26 |
|
| 27 |
type AdjustStyleReasonscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/AdjustStyleReason# int |
| 28 |
|
| 29 |
const ( |
| 30 |
AdjustStyleReasonNormalscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/AdjustStyleReasonNormal. AdjustStyleReasonscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/AdjustStyleReason# = iota |
| 31 |
AdjustStyleReasonHideSpoilerscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/AdjustStyleReasonHideSpoiler. |
| 32 |
) |
| 33 |
|
| 34 |
type DrawContextscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/DrawContext# struct { |
| 35 |
IsSelectedscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/DrawContext#IsSelected. bool |
| 36 |
BareMessagesscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/DrawContext#BareMessages. bool |
| 37 |
} |
| 38 |
|
| 39 |
type Entityscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/Entity# interface { |
| 40 |
// AdjustStyle recursively changes the style of the entity and all its children. |
| 41 |
AdjustStylescip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/Entity#AdjustStyle.(AdjustStyleFuncscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/AdjustStyleFunc#, AdjustStyleReasonscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/AdjustStyleReason#) Entityscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/Entity# |
| 42 |
// Draw draws the entity onto the given mauview Screen. |
| 43 |
Drawscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/Entity#Draw.(screen mauviewscip-go gomod go.mau.fi/mauview v0.2.1 `go.mau.fi/mauview`/.Screenscip-go gomod go.mau.fi/mauview v0.2.1 `go.mau.fi/mauview`/Screen#, ctx DrawContextscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/DrawContext#) |
| 44 |
// IsBlock returns whether or not it's a block-type entity. |
| 45 |
IsBlockscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/Entity#IsBlock.() bool |
| 46 |
// GetTag returns the HTML tag of the entity. |
| 47 |
GetTagscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/Entity#GetTag.() string |
| 48 |
// PlainText returns the plaintext content in the entity and all its children. |
| 49 |
PlainTextscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/Entity#PlainText.() string |
| 50 |
// String returns a string representation of the entity struct. |
| 51 |
Stringscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/Entity#String.() string |
| 52 |
// Clone creates a deep copy of the entity. |
| 53 |
Clonescip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/Entity#Clone.() Entityscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/Entity# |
| 54 |
|
| 55 |
// Height returns the render height of the entity. |
| 56 |
Heightscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/Entity#Height.() int |
| 57 |
// CalculateBuffer prepares the entity and all its children for rendering with the given parameters |
| 58 |
CalculateBufferscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/Entity#CalculateBuffer.(width, startX int, ctx DrawContextscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/DrawContext#) int |
| 59 |
|
| 60 |
getStartXscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/Entity#getStartX.() int |
| 61 |
|
| 62 |
IsEmptyscip-go gomod maunium.net/go/gomuks . `maunium.net/go/gomuks/ui/messages/html`/Entity#IsEmpty.() bool |
| 63 |
} |