1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "structs"
6 "unsafe"
7
8 "github.com/ebitengine/purego"
9
10 "github.com/bnema/puregotk/pkg/core"
11 "github.com/bnema/puregotk/v4/gobject/types"
12)
13
14type IMContextSimpleClass struct {
15 _ structs.HostLayout
16
17 ParentClass IMContextClass
18}
19
20func (x *IMContextSimpleClass) GoPointer() uintptr {
21 return uintptr(unsafe.Pointer(x))
22}
23
24type IMContextSimplePrivate struct {
25 _ structs.HostLayout
26}
27
28func (x *IMContextSimplePrivate) GoPointer() uintptr {
29 return uintptr(unsafe.Pointer(x))
30}
31
32const (
33 // Evaluates to the maximum length of a compose sequence.
34 //
35 // This macro is longer used by GTK.
36 MAX_COMPOSE_LEN int = 7
37)
38
39// Supports compose sequences, dead keys and numeric Unicode input.
40//
41// ## Compose sequences
42//
43// `GtkIMContextSimple` reads compose sequences from the first of the
44// following files that is found: ~/.config/gtk-4.0/Compose, ~/.XCompose,
45// /usr/share/X11/locale/$locale/Compose (for locales that have a nontrivial
46// Compose file). A subset of the file syntax described in the Compose(5)
47// manual page is supported. Additionally, `include "%L"` loads GTK’s built-in
48// table of compose sequences rather than the locale-specific one from X11.
49//
50// If none of these files is found, `GtkIMContextSimple` uses a built-in table
51// of compose sequences that is derived from the X11 Compose files.
52//
53// Note that compose sequences typically start with the Compose_key, which is
54// often not available as a dedicated key on keyboards. Keyboard layouts may
55// map this keysym to other keys, such as the right Control key.
56//
57// ## Unicode characters
58//
59// `GtkIMContextSimple` also supports numeric entry of Unicode characters
60// by typing <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>u</kbd>, followed by a
61// hexadecimal Unicode codepoint.
62//
63// For example,
64//
65// Ctrl-Shift-u 1 2 3 Enter
66//
67// yields U+0123 LATIN SMALL LETTER G WITH CEDILLA, i.e. ģ.
68//
69// ## Dead keys
70//
71// `GtkIMContextSimple` supports dead keys. For example, typing
72//
73// dead_acute a
74//
75// yields U+00E! LATIN SMALL LETTER_A WITH ACUTE, i.e. á. Note that this
76// depends on the keyboard layout including dead keys.
77type IMContextSimple struct {
78 IMContext
79}
80
81var xIMContextSimpleGLibType func() types.GType
82
83func IMContextSimpleGLibType() types.GType {
84 return xIMContextSimpleGLibType()
85}
86
87func IMContextSimpleNewFromInternalPtr(ptr uintptr) *IMContextSimple {
88 cls := &IMContextSimple{}
89 cls.Ptr = ptr
90 return cls
91}
92
93var xNewIMContextSimple func() uintptr
94
95// Creates a new `GtkIMContextSimple`.
96func NewIMContextSimple() *IMContextSimple {
97 var cls *IMContextSimple
98
99 cret := xNewIMContextSimple()
100
101 if cret == 0 {
102 return nil
103 }
104 cls = &IMContextSimple{}
105 cls.Ptr = cret
106 return cls
107}
108
109var xIMContextSimpleAddComposeFile func(uintptr, string)
110
111// Adds an additional table from the X11 compose file.
112func (x *IMContextSimple) AddComposeFile(ComposeFileVar string) {
113
114 xIMContextSimpleAddComposeFile(x.GoPointer(), ComposeFileVar)
115
116}
117
118var xIMContextSimpleAddTable func(uintptr, []uint16, int, int)
119
120// Adds an additional table to search to the input context.
121// Each row of the table consists of @max_seq_len key symbols
122// followed by two #guint16 interpreted as the high and low
123// words of a #gunicode value. Tables are searched starting
124// from the last added.
125//
126// The table must be sorted in dictionary order on the
127// numeric value of the key symbol fields. (Values beyond
128// the length of the sequence should be zero.)
129func (x *IMContextSimple) AddTable(DataVar []uint16, MaxSeqLenVar int, NSeqsVar int) {
130
131 xIMContextSimpleAddTable(x.GoPointer(), DataVar, MaxSeqLenVar, NSeqsVar)
132
133}
134
135func (c *IMContextSimple) GoPointer() uintptr {
136 if c == nil {
137 return 0
138 }
139 return c.Ptr
140}
141
142func (c *IMContextSimple) SetGoPointer(ptr uintptr) {
143 c.Ptr = ptr
144}
145
146func init() {
147 core.SetPackageName("GTK", "gtk4")
148 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
149 var libs []uintptr
150 for _, libPath := range core.GetPaths("GTK") {
151 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
152 if err != nil {
153 panic(err)
154 }
155 libs = append(libs, lib)
156 }
157
158 core.PuregoSafeRegister(&xIMContextSimpleGLibType, libs, "gtk_im_context_simple_get_type")
159
160 core.PuregoSafeRegister(&xNewIMContextSimple, libs, "gtk_im_context_simple_new")
161
162 core.PuregoSafeRegister(&xIMContextSimpleAddComposeFile, libs, "gtk_im_context_simple_add_compose_file")
163 core.PuregoSafeRegister(&xIMContextSimpleAddTable, libs, "gtk_im_context_simple_add_table")
164
165}