1// Package gtk was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gtk
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8 "github.com/bnema/puregotk/v4/gobject"
9 "github.com/bnema/puregotk/v4/gobject/types"
10)
11
12// Renders numbers as progress bars
13//
14// `GtkCellRendererProgress` renders a numeric value as a progress par in a cell.
15// Additionally, it can display a text on top of the progress bar.
16type CellRendererProgress struct {
17 CellRenderer
18}
19
20var xCellRendererProgressGLibType func() types.GType
21
22func CellRendererProgressGLibType() types.GType {
23 return xCellRendererProgressGLibType()
24}
25
26func CellRendererProgressNewFromInternalPtr(ptr uintptr) *CellRendererProgress {
27 cls := &CellRendererProgress{}
28 cls.Ptr = ptr
29 return cls
30}
31
32var xNewCellRendererProgress func() uintptr
33
34// Creates a new `GtkCellRendererProgress`.
35func NewCellRendererProgress() *CellRendererProgress {
36 var cls *CellRendererProgress
37
38 cret := xNewCellRendererProgress()
39
40 if cret == 0 {
41 return nil
42 }
43 gobject.IncreaseRef(cret)
44 cls = &CellRendererProgress{}
45 cls.Ptr = cret
46 return cls
47}
48
49func (c *CellRendererProgress) GoPointer() uintptr {
50 if c == nil {
51 return 0
52 }
53 return c.Ptr
54}
55
56func (c *CellRendererProgress) SetGoPointer(ptr uintptr) {
57 c.Ptr = ptr
58}
59
60// SetPropertyInverted sets the "inverted" property.
61// Whether progess is inverted.
62func (x *CellRendererProgress) SetPropertyInverted(value bool) {
63 var v gobject.Value
64 v.Init(gobject.TypeBooleanVal)
65 v.SetBoolean(value)
66 x.SetProperty("inverted", &v)
67}
68
69// GetPropertyInverted gets the "inverted" property.
70// Whether progess is inverted.
71func (x *CellRendererProgress) GetPropertyInverted() bool {
72 var v gobject.Value
73 x.GetProperty("inverted", &v)
74 return v.GetBoolean()
75}
76
77// SetPropertyPulse sets the "pulse" property.
78// Setting this to a non-negative value causes the cell renderer to
79// enter "activity mode", where a block bounces back and forth to
80// indicate that some progress is made, without specifying exactly how
81// much.
82//
83// Each increment of the property causes the block to move by a little
84// bit.
85//
86// To indicate that the activity has not started yet, set the property
87// to zero. To indicate completion, set the property to %G_MAXINT.
88func (x *CellRendererProgress) SetPropertyPulse(value int) {
89 var v gobject.Value
90 v.Init(gobject.TypeIntVal)
91 v.SetInt(value)
92 x.SetProperty("pulse", &v)
93}
94
95// GetPropertyPulse gets the "pulse" property.
96// Setting this to a non-negative value causes the cell renderer to
97// enter "activity mode", where a block bounces back and forth to
98// indicate that some progress is made, without specifying exactly how
99// much.
100//
101// Each increment of the property causes the block to move by a little
102// bit.
103//
104// To indicate that the activity has not started yet, set the property
105// to zero. To indicate completion, set the property to %G_MAXINT.
106func (x *CellRendererProgress) GetPropertyPulse() int {
107 var v gobject.Value
108 x.GetProperty("pulse", &v)
109 return v.GetInt()
110}
111
112// SetPropertyText sets the "text" property.
113// The "text" property determines the label which will be drawn
114// over the progress bar. Setting this property to %NULL causes the default
115// label to be displayed. Setting this property to an empty string causes
116// no label to be displayed.
117func (x *CellRendererProgress) SetPropertyText(value string) {
118 var v gobject.Value
119 v.Init(gobject.TypeStringVal)
120 v.SetString(&value)
121 x.SetProperty("text", &v)
122}
123
124// GetPropertyText gets the "text" property.
125// The "text" property determines the label which will be drawn
126// over the progress bar. Setting this property to %NULL causes the default
127// label to be displayed. Setting this property to an empty string causes
128// no label to be displayed.
129func (x *CellRendererProgress) GetPropertyText() string {
130 var v gobject.Value
131 x.GetProperty("text", &v)
132 return v.GetString()
133}
134
135// SetPropertyTextXalign sets the "text-xalign" property.
136// The "text-xalign" property controls the horizontal alignment of the
137// text in the progress bar. Valid values range from 0 (left) to 1
138// (right). Reserved for RTL layouts.
139func (x *CellRendererProgress) SetPropertyTextXalign(value float32) {
140 var v gobject.Value
141 v.Init(gobject.TypeFloatVal)
142 v.SetFloat(value)
143 x.SetProperty("text-xalign", &v)
144}
145
146// GetPropertyTextXalign gets the "text-xalign" property.
147// The "text-xalign" property controls the horizontal alignment of the
148// text in the progress bar. Valid values range from 0 (left) to 1
149// (right). Reserved for RTL layouts.
150func (x *CellRendererProgress) GetPropertyTextXalign() float32 {
151 var v gobject.Value
152 x.GetProperty("text-xalign", &v)
153 return v.GetFloat()
154}
155
156// SetPropertyTextYalign sets the "text-yalign" property.
157// The "text-yalign" property controls the vertical alignment of the
158// text in the progress bar. Valid values range from 0 (top) to 1
159// (bottom).
160func (x *CellRendererProgress) SetPropertyTextYalign(value float32) {
161 var v gobject.Value
162 v.Init(gobject.TypeFloatVal)
163 v.SetFloat(value)
164 x.SetProperty("text-yalign", &v)
165}
166
167// GetPropertyTextYalign gets the "text-yalign" property.
168// The "text-yalign" property controls the vertical alignment of the
169// text in the progress bar. Valid values range from 0 (top) to 1
170// (bottom).
171func (x *CellRendererProgress) GetPropertyTextYalign() float32 {
172 var v gobject.Value
173 x.GetProperty("text-yalign", &v)
174 return v.GetFloat()
175}
176
177// SetPropertyValue sets the "value" property.
178// The "value" property determines the percentage to which the
179// progress bar will be "filled in".
180func (x *CellRendererProgress) SetPropertyValue(value int) {
181 var v gobject.Value
182 v.Init(gobject.TypeIntVal)
183 v.SetInt(value)
184 x.SetProperty("value", &v)
185}
186
187// GetPropertyValue gets the "value" property.
188// The "value" property determines the percentage to which the
189// progress bar will be "filled in".
190func (x *CellRendererProgress) GetPropertyValue() int {
191 var v gobject.Value
192 x.GetProperty("value", &v)
193 return v.GetInt()
194}
195
196// Retrieves the orientation of the @orientable.
197func (x *CellRendererProgress) GetOrientation() Orientation {
198
199 cret := XGtkOrientableGetOrientation(x.GoPointer())
200 return cret
201}
202
203// Sets the orientation of the @orientable.
204func (x *CellRendererProgress) SetOrientation(OrientationVar Orientation) {
205
206 XGtkOrientableSetOrientation(x.GoPointer(), OrientationVar)
207
208}
209
210func init() {
211 core.SetPackageName("GTK", "gtk4")
212 core.SetSharedLibraries("GTK", []string{"libgtk-4.so.1"})
213 var libs []uintptr
214 for _, libPath := range core.GetPaths("GTK") {
215 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
216 if err != nil {
217 panic(err)
218 }
219 libs = append(libs, lib)
220 }
221
222 core.PuregoSafeRegister(&xCellRendererProgressGLibType, libs, "gtk_cell_renderer_progress_get_type")
223
224 core.PuregoSafeRegister(&xNewCellRendererProgress, libs, "gtk_cell_renderer_progress_new")
225
226}