/
clipboarddef.go
51 lines (41 loc) · 1.3 KB
/
clipboarddef.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//----------------------------------------
//
// Copyright © ying32. All Rights Reserved.
//
// Licensed under Apache License 2.0
//
//----------------------------------------
package vcl
import (
. "github.com/ying32/govcl/vcl/api"
"github.com/ying32/govcl/vcl/types"
)
func SetClipboard(newClipboard IObject) *TClipboard {
return AsClipboard(DSetClipboard(CheckPtr(newClipboard)))
}
func RegisterClipboardFormat(aFormat string) types.TClipboardFormat {
return DRegisterClipboardFormat(aFormat)
}
func PredefinedClipboardFormat(aFormat types.TPredefinedClipboardFormat) types.TClipboardFormat {
return DPredefinedClipboardFormat(aFormat)
}
func (c *TClipboard) HasFormat(aFormatID types.TClipboardFormat) bool {
return Clipboard_HasFormat(c._instance(), aFormatID)
}
func (c *TClipboard) GetAsHtml(ExtractFragmentOnly bool) string {
return Clipboard_GetAsHtml(c._instance(), ExtractFragmentOnly)
}
func (c *TClipboard) GetTextBuf(Buffer *string, BufSize int32) int32 {
return Clipboard_GetTextBuf(c._instance(), Buffer, BufSize)
}
func (c *TClipboard) AsText() string {
mem := NewMemoryStream()
defer mem.Free()
if c.GetFormat(PredefinedClipboardFormat(types.PcfText), mem) {
return getStreamText(mem)
}
return ""
}
func (c *TClipboard) SetAsText(value string) {
Clipboard_SetAsText(c._instance(), value)
}