/
gtk.go
10521 lines (8915 loc) · 310 KB
/
gtk.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com>
//
// This file originated from: http://opensource.conformal.com/
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
// Go bindings for GTK+ 3. Supports version 3.6 and later.
//
// Functions use the same names as the native C function calls, but use
// CamelCase. In cases where native GTK uses pointers to values to
// simulate multiple return values, Go's native multiple return values
// are used instead. Whenever a native GTK call could return an
// unexpected NULL pointer, an additional error is returned in the Go
// binding.
//
// GTK's C API documentation can be very useful for understanding how the
// functions in this package work and what each type is for. This
// documentation can be found at https://developer.gnome.org/gtk3/.
//
// In addition to Go versions of the C GTK functions, every struct type
// includes a method named Native (either by direct implementation, or
// by means of struct embedding). These methods return a uintptr of the
// native C object the binding type represents. These pointers may be
// type switched to a native C pointer using unsafe and used with cgo
// function calls outside this package.
//
// Memory management is handled in proper Go fashion, using runtime
// finalizers to properly free memory when it is no longer needed. Each
// time a Go type is created with a pointer to a GObject, a reference is
// added for Go, sinking the floating reference when necessary. After
// going out of scope and the next time Go's garbage collector is run, a
// finalizer is run to remove Go's reference to the GObject. When this
// reference count hits zero (when neither Go nor GTK holds ownership)
// the object will be freed internally by GTK.
package gtk
// #cgo pkg-config: gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0
// #include <gtk/gtk.h>
// #include "gtk.go.h"
import "C"
import (
"errors"
"fmt"
"reflect"
"runtime"
"sync"
"unsafe"
"github.com/gotk3/gotk3/cairo"
"github.com/gotk3/gotk3/gdk"
"github.com/gotk3/gotk3/glib"
)
func init() {
tm := []glib.TypeMarshaler{
// Enums
{glib.Type(C.gtk_align_get_type()), marshalAlign},
{glib.Type(C.gtk_accel_flags_get_type()), marshalAccelFlags},
{glib.Type(C.gtk_accel_group_get_type()), marshalAccelGroup},
{glib.Type(C.gtk_accel_map_get_type()), marshalAccelMap},
{glib.Type(C.gtk_arrow_placement_get_type()), marshalArrowPlacement},
{glib.Type(C.gtk_arrow_type_get_type()), marshalArrowType},
{glib.Type(C.gtk_assistant_page_type_get_type()), marshalAssistantPageType},
{glib.Type(C.gtk_buttons_type_get_type()), marshalButtonsType},
{glib.Type(C.gtk_calendar_display_options_get_type()), marshalCalendarDisplayOptions},
{glib.Type(C.gtk_corner_type_get_type()), marshalCornerType},
{glib.Type(C.gtk_dest_defaults_get_type()), marshalDestDefaults},
{glib.Type(C.gtk_dialog_flags_get_type()), marshalDialogFlags},
{glib.Type(C.gtk_entry_icon_position_get_type()), marshalEntryIconPosition},
{glib.Type(C.gtk_file_chooser_action_get_type()), marshalFileChooserAction},
{glib.Type(C.gtk_icon_lookup_flags_get_type()), marshalSortType},
{glib.Type(C.gtk_icon_size_get_type()), marshalIconSize},
{glib.Type(C.gtk_image_type_get_type()), marshalImageType},
{glib.Type(C.gtk_input_hints_get_type()), marshalInputHints},
{glib.Type(C.gtk_input_purpose_get_type()), marshalInputPurpose},
{glib.Type(C.gtk_justification_get_type()), marshalJustification},
{glib.Type(C.gtk_license_get_type()), marshalLicense},
{glib.Type(C.gtk_message_type_get_type()), marshalMessageType},
{glib.Type(C.gtk_orientation_get_type()), marshalOrientation},
{glib.Type(C.gtk_pack_type_get_type()), marshalPackType},
{glib.Type(C.gtk_path_type_get_type()), marshalPathType},
{glib.Type(C.gtk_policy_type_get_type()), marshalPolicyType},
{glib.Type(C.gtk_position_type_get_type()), marshalPositionType},
{glib.Type(C.gtk_relief_style_get_type()), marshalReliefStyle},
{glib.Type(C.gtk_response_type_get_type()), marshalResponseType},
{glib.Type(C.gtk_selection_mode_get_type()), marshalSelectionMode},
{glib.Type(C.gtk_shadow_type_get_type()), marshalShadowType},
{glib.Type(C.gtk_sort_type_get_type()), marshalSortType},
{glib.Type(C.gtk_state_flags_get_type()), marshalStateFlags},
{glib.Type(C.gtk_target_flags_get_type()), marshalTargetFlags},
{glib.Type(C.gtk_text_direction_get_type()), marshalTextDirection},
{glib.Type(C.gtk_text_search_flags_get_type()), marshalTextSearchFlags},
{glib.Type(C.gtk_toolbar_style_get_type()), marshalToolbarStyle},
{glib.Type(C.gtk_tree_model_flags_get_type()), marshalTreeModelFlags},
{glib.Type(C.gtk_window_position_get_type()), marshalWindowPosition},
{glib.Type(C.gtk_window_type_get_type()), marshalWindowType},
{glib.Type(C.gtk_wrap_mode_get_type()), marshalWrapMode},
// Objects/Interfaces
{glib.Type(C.gtk_accel_group_get_type()), marshalAccelGroup},
{glib.Type(C.gtk_accel_map_get_type()), marshalAccelMap},
{glib.Type(C.gtk_adjustment_get_type()), marshalAdjustment},
{glib.Type(C.gtk_application_get_type()), marshalApplication},
{glib.Type(C.gtk_application_window_get_type()), marshalApplicationWindow},
{glib.Type(C.gtk_assistant_get_type()), marshalAssistant},
{glib.Type(C.gtk_bin_get_type()), marshalBin},
{glib.Type(C.gtk_builder_get_type()), marshalBuilder},
{glib.Type(C.gtk_button_get_type()), marshalButton},
{glib.Type(C.gtk_button_box_get_type()), marshalButtonBox},
{glib.Type(C.gtk_box_get_type()), marshalBox},
{glib.Type(C.gtk_calendar_get_type()), marshalCalendar},
{glib.Type(C.gtk_cell_layout_get_type()), marshalCellLayout},
{glib.Type(C.gtk_cell_renderer_get_type()), marshalCellRenderer},
{glib.Type(C.gtk_cell_renderer_spinner_get_type()), marshalCellRendererSpinner},
{glib.Type(C.gtk_cell_renderer_pixbuf_get_type()), marshalCellRendererPixbuf},
{glib.Type(C.gtk_cell_renderer_text_get_type()), marshalCellRendererText},
{glib.Type(C.gtk_cell_renderer_progress_get_type()), marshalCellRendererProgress},
{glib.Type(C.gtk_cell_renderer_toggle_get_type()), marshalCellRendererToggle},
{glib.Type(C.gtk_check_button_get_type()), marshalCheckButton},
{glib.Type(C.gtk_check_menu_item_get_type()), marshalCheckMenuItem},
{glib.Type(C.gtk_clipboard_get_type()), marshalClipboard},
{glib.Type(C.gtk_container_get_type()), marshalContainer},
{glib.Type(C.gtk_dialog_get_type()), marshalDialog},
{glib.Type(C.gtk_drawing_area_get_type()), marshalDrawingArea},
{glib.Type(C.gtk_editable_get_type()), marshalEditable},
{glib.Type(C.gtk_entry_get_type()), marshalEntry},
{glib.Type(C.gtk_entry_buffer_get_type()), marshalEntryBuffer},
{glib.Type(C.gtk_entry_completion_get_type()), marshalEntryCompletion},
{glib.Type(C.gtk_event_box_get_type()), marshalEventBox},
{glib.Type(C.gtk_expander_get_type()), marshalExpander},
{glib.Type(C.gtk_file_chooser_get_type()), marshalFileChooser},
{glib.Type(C.gtk_file_chooser_button_get_type()), marshalFileChooserButton},
{glib.Type(C.gtk_file_chooser_dialog_get_type()), marshalFileChooserDialog},
{glib.Type(C.gtk_file_chooser_widget_get_type()), marshalFileChooserWidget},
{glib.Type(C.gtk_frame_get_type()), marshalFrame},
{glib.Type(C.gtk_aspect_frame_get_type()), marshalAspectFrame},
{glib.Type(C.gtk_grid_get_type()), marshalGrid},
{glib.Type(C.gtk_icon_view_get_type()), marshalIconView},
{glib.Type(C.gtk_image_get_type()), marshalImage},
{glib.Type(C.gtk_label_get_type()), marshalLabel},
{glib.Type(C.gtk_link_button_get_type()), marshalLinkButton},
{glib.Type(C.gtk_layout_get_type()), marshalLayout},
{glib.Type(C.gtk_tree_model_sort_get_type()), marshalTreeModelSort},
{glib.Type(C.gtk_list_store_get_type()), marshalListStore},
{glib.Type(C.gtk_menu_get_type()), marshalMenu},
{glib.Type(C.gtk_menu_bar_get_type()), marshalMenuBar},
{glib.Type(C.gtk_menu_button_get_type()), marshalMenuButton},
{glib.Type(C.gtk_menu_item_get_type()), marshalMenuItem},
{glib.Type(C.gtk_menu_shell_get_type()), marshalMenuShell},
{glib.Type(C.gtk_message_dialog_get_type()), marshalMessageDialog},
{glib.Type(C.gtk_notebook_get_type()), marshalNotebook},
{glib.Type(C.gtk_offscreen_window_get_type()), marshalOffscreenWindow},
{glib.Type(C.gtk_orientable_get_type()), marshalOrientable},
{glib.Type(C.gtk_overlay_get_type()), marshalOverlay},
{glib.Type(C.gtk_paned_get_type()), marshalPaned},
{glib.Type(C.gtk_progress_bar_get_type()), marshalProgressBar},
{glib.Type(C.gtk_radio_button_get_type()), marshalRadioButton},
{glib.Type(C.gtk_radio_menu_item_get_type()), marshalRadioMenuItem},
{glib.Type(C.gtk_range_get_type()), marshalRange},
{glib.Type(C.gtk_scale_button_get_type()), marshalScaleButton},
{glib.Type(C.gtk_scale_get_type()), marshalScale},
{glib.Type(C.gtk_scrollbar_get_type()), marshalScrollbar},
{glib.Type(C.gtk_scrolled_window_get_type()), marshalScrolledWindow},
{glib.Type(C.gtk_search_entry_get_type()), marshalSearchEntry},
//{glib.Type(C.gtk_selection_data_get_type()), marshalSelectionData},
{glib.Type(C.gtk_separator_get_type()), marshalSeparator},
{glib.Type(C.gtk_separator_menu_item_get_type()), marshalSeparatorMenuItem},
{glib.Type(C.gtk_separator_tool_item_get_type()), marshalSeparatorToolItem},
{glib.Type(C.gtk_spin_button_get_type()), marshalSpinButton},
{glib.Type(C.gtk_spinner_get_type()), marshalSpinner},
{glib.Type(C.gtk_statusbar_get_type()), marshalStatusbar},
{glib.Type(C.gtk_switch_get_type()), marshalSwitch},
{glib.Type(C.gtk_text_view_get_type()), marshalTextView},
{glib.Type(C.gtk_text_tag_get_type()), marshalTextTag},
{glib.Type(C.gtk_text_tag_table_get_type()), marshalTextTagTable},
{glib.Type(C.gtk_text_buffer_get_type()), marshalTextBuffer},
{glib.Type(C.gtk_toggle_button_get_type()), marshalToggleButton},
{glib.Type(C.gtk_toolbar_get_type()), marshalToolbar},
{glib.Type(C.gtk_tool_button_get_type()), marshalToolButton},
{glib.Type(C.gtk_toggle_tool_button_get_type()), marshalToggleToolButton},
{glib.Type(C.gtk_tool_item_get_type()), marshalToolItem},
{glib.Type(C.gtk_tooltip_get_type()), marshalTooltip},
{glib.Type(C.gtk_tree_model_get_type()), marshalTreeModel},
{glib.Type(C.gtk_tree_sortable_get_type()), marshalTreeSortable},
{glib.Type(C.gtk_tree_selection_get_type()), marshalTreeSelection},
{glib.Type(C.gtk_tree_store_get_type()), marshalTreeStore},
{glib.Type(C.gtk_tree_view_get_type()), marshalTreeView},
{glib.Type(C.gtk_tree_view_column_get_type()), marshalTreeViewColumn},
{glib.Type(C.gtk_volume_button_get_type()), marshalVolumeButton},
{glib.Type(C.gtk_widget_get_type()), marshalWidget},
{glib.Type(C.gtk_window_get_type()), marshalWindow},
{glib.Type(C.gtk_window_group_get_type()), marshalWindowGroup},
// Boxed
{glib.Type(C.gtk_target_entry_get_type()), marshalTargetEntry},
{glib.Type(C.gtk_text_iter_get_type()), marshalTextIter},
{glib.Type(C.gtk_text_mark_get_type()), marshalTextMark},
{glib.Type(C.gtk_tree_iter_get_type()), marshalTreeIter},
{glib.Type(C.gtk_tree_path_get_type()), marshalTreePath},
}
glib.RegisterGValueMarshalers(tm)
}
/*
* Type conversions
*/
func gbool(b bool) C.gboolean {
if b {
return C.gboolean(1)
}
return C.gboolean(0)
}
func gobool(b C.gboolean) bool {
return b != C.FALSE
}
func cGSList(clist *glib.SList) *C.GSList {
if clist == nil {
return nil
}
return (*C.GSList)(unsafe.Pointer(clist.Native()))
}
func free(str ...interface{}) {
for _, s := range str {
switch x := s.(type) {
case *C.char:
C.free(unsafe.Pointer(x))
case []*C.char:
for _, cp := range x {
C.free(unsafe.Pointer(cp))
}
/*
case C.gpointer:
C.g_free(C.gpointer(c))
*/
default:
fmt.Printf("utils.go free(): Unknown type: %T\n", x)
}
}
}
func goString(cstr *C.gchar) string {
return C.GoString((*C.char)(cstr))
}
// same implementation as package glib
func toGoStringArray(c **C.gchar) []string {
var strs []string
originalc := c
defer C.g_strfreev(originalc)
for *c != nil {
strs = append(strs, C.GoString((*C.char)(*c)))
c = C.next_gcharptr(c)
}
return strs
}
// Wrapper function for TestBoolConvs since cgo can't be used with
// testing package
func testBoolConvs() error {
b := gobool(gbool(true))
if b != true {
return errors.New("Unexpected bool conversion result")
}
cb := gbool(gobool(C.gboolean(0)))
if cb != C.gboolean(0) {
return errors.New("Unexpected bool conversion result")
}
return nil
}
/*
* Unexported vars
*/
var nilPtrErr = errors.New("cgo returned unexpected nil pointer")
/*
* Constants
*/
// Align is a representation of GTK's GtkAlign.
type Align int
const (
ALIGN_FILL Align = C.GTK_ALIGN_FILL
ALIGN_START Align = C.GTK_ALIGN_START
ALIGN_END Align = C.GTK_ALIGN_END
ALIGN_CENTER Align = C.GTK_ALIGN_CENTER
)
func marshalAlign(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return Align(c), nil
}
// ArrowPlacement is a representation of GTK's GtkArrowPlacement.
type ArrowPlacement int
const (
ARROWS_BOTH ArrowPlacement = C.GTK_ARROWS_BOTH
ARROWS_START ArrowPlacement = C.GTK_ARROWS_START
ARROWS_END ArrowPlacement = C.GTK_ARROWS_END
)
func marshalArrowPlacement(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return ArrowPlacement(c), nil
}
// ArrowType is a representation of GTK's GtkArrowType.
type ArrowType int
const (
ARROW_UP ArrowType = C.GTK_ARROW_UP
ARROW_DOWN ArrowType = C.GTK_ARROW_DOWN
ARROW_LEFT ArrowType = C.GTK_ARROW_LEFT
ARROW_RIGHT ArrowType = C.GTK_ARROW_RIGHT
ARROW_NONE ArrowType = C.GTK_ARROW_NONE
)
func marshalArrowType(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return ArrowType(c), nil
}
// AssistantPageType is a representation of GTK's GtkAssistantPageType.
type AssistantPageType int
const (
ASSISTANT_PAGE_CONTENT AssistantPageType = C.GTK_ASSISTANT_PAGE_CONTENT
ASSISTANT_PAGE_INTRO AssistantPageType = C.GTK_ASSISTANT_PAGE_INTRO
ASSISTANT_PAGE_CONFIRM AssistantPageType = C.GTK_ASSISTANT_PAGE_CONFIRM
ASSISTANT_PAGE_SUMMARY AssistantPageType = C.GTK_ASSISTANT_PAGE_SUMMARY
ASSISTANT_PAGE_PROGRESS AssistantPageType = C.GTK_ASSISTANT_PAGE_PROGRESS
ASSISTANT_PAGE_CUSTOM AssistantPageType = C.GTK_ASSISTANT_PAGE_CUSTOM
)
func marshalAssistantPageType(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return AssistantPageType(c), nil
}
// ButtonsType is a representation of GTK's GtkButtonsType.
type ButtonsType int
const (
BUTTONS_NONE ButtonsType = C.GTK_BUTTONS_NONE
BUTTONS_OK ButtonsType = C.GTK_BUTTONS_OK
BUTTONS_CLOSE ButtonsType = C.GTK_BUTTONS_CLOSE
BUTTONS_CANCEL ButtonsType = C.GTK_BUTTONS_CANCEL
BUTTONS_YES_NO ButtonsType = C.GTK_BUTTONS_YES_NO
BUTTONS_OK_CANCEL ButtonsType = C.GTK_BUTTONS_OK_CANCEL
)
func marshalButtonsType(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return ButtonsType(c), nil
}
// TODO:
// GtkSensitivityType
// CalendarDisplayOptions is a representation of GTK's GtkCalendarDisplayOptions
type CalendarDisplayOptions int
const (
CALENDAR_SHOW_HEADING CalendarDisplayOptions = C.GTK_CALENDAR_SHOW_HEADING
CALENDAR_SHOW_DAY_NAMES CalendarDisplayOptions = C.GTK_CALENDAR_SHOW_DAY_NAMES
CALENDAR_NO_MONTH_CHANGE CalendarDisplayOptions = C.GTK_CALENDAR_NO_MONTH_CHANGE
CALENDAR_SHOW_WEEK_NUMBERS CalendarDisplayOptions = C.GTK_CALENDAR_SHOW_WEEK_NUMBERS
CALENDAR_SHOW_DETAILS CalendarDisplayOptions = C.GTK_CALENDAR_SHOW_DETAILS
)
func marshalCalendarDisplayOptions(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return CalendarDisplayOptions(c), nil
}
// DestDefaults is a representation of GTK's GtkDestDefaults.
type DestDefaults int
const (
DEST_DEFAULT_MOTION DestDefaults = C.GTK_DEST_DEFAULT_MOTION
DEST_DEFAULT_HIGHLIGHT DestDefaults = C.GTK_DEST_DEFAULT_HIGHLIGHT
DEST_DEFAULT_DROP DestDefaults = C.GTK_DEST_DEFAULT_DROP
DEST_DEFAULT_ALL DestDefaults = C.GTK_DEST_DEFAULT_ALL
)
func marshalDestDefaults(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return DestDefaults(c), nil
}
// DialogFlags is a representation of GTK's GtkDialogFlags.
type DialogFlags int
const (
DIALOG_MODAL DialogFlags = C.GTK_DIALOG_MODAL
DIALOG_DESTROY_WITH_PARENT DialogFlags = C.GTK_DIALOG_DESTROY_WITH_PARENT
)
func marshalDialogFlags(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return DialogFlags(c), nil
}
// EntryIconPosition is a representation of GTK's GtkEntryIconPosition.
type EntryIconPosition int
const (
ENTRY_ICON_PRIMARY EntryIconPosition = C.GTK_ENTRY_ICON_PRIMARY
ENTRY_ICON_SECONDARY EntryIconPosition = C.GTK_ENTRY_ICON_SECONDARY
)
func marshalEntryIconPosition(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return EntryIconPosition(c), nil
}
// FileChooserAction is a representation of GTK's GtkFileChooserAction.
type FileChooserAction int
const (
FILE_CHOOSER_ACTION_OPEN FileChooserAction = C.GTK_FILE_CHOOSER_ACTION_OPEN
FILE_CHOOSER_ACTION_SAVE FileChooserAction = C.GTK_FILE_CHOOSER_ACTION_SAVE
FILE_CHOOSER_ACTION_SELECT_FOLDER FileChooserAction = C.GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
FILE_CHOOSER_ACTION_CREATE_FOLDER FileChooserAction = C.GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
)
func marshalFileChooserAction(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return FileChooserAction(c), nil
}
// IconLookupFlags is a representation of GTK's GtkIconLookupFlags.
type IconLookupFlags int
const (
ICON_LOOKUP_NO_SVG IconLookupFlags = C.GTK_ICON_LOOKUP_NO_SVG
ICON_LOOKUP_FORCE_SVG = C.GTK_ICON_LOOKUP_FORCE_SVG
ICON_LOOKUP_USE_BUILTIN = C.GTK_ICON_LOOKUP_USE_BUILTIN
ICON_LOOKUP_GENERIC_FALLBACK = C.GTK_ICON_LOOKUP_GENERIC_FALLBACK
ICON_LOOKUP_FORCE_SIZE = C.GTK_ICON_LOOKUP_FORCE_SIZE
)
func marshalIconLookupFlags(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return IconLookupFlags(c), nil
}
// IconSize is a representation of GTK's GtkIconSize.
type IconSize int
const (
ICON_SIZE_INVALID IconSize = C.GTK_ICON_SIZE_INVALID
ICON_SIZE_MENU IconSize = C.GTK_ICON_SIZE_MENU
ICON_SIZE_SMALL_TOOLBAR IconSize = C.GTK_ICON_SIZE_SMALL_TOOLBAR
ICON_SIZE_LARGE_TOOLBAR IconSize = C.GTK_ICON_SIZE_LARGE_TOOLBAR
ICON_SIZE_BUTTON IconSize = C.GTK_ICON_SIZE_BUTTON
ICON_SIZE_DND IconSize = C.GTK_ICON_SIZE_DND
ICON_SIZE_DIALOG IconSize = C.GTK_ICON_SIZE_DIALOG
)
func marshalIconSize(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return IconSize(c), nil
}
// ImageType is a representation of GTK's GtkImageType.
type ImageType int
const (
IMAGE_EMPTY ImageType = C.GTK_IMAGE_EMPTY
IMAGE_PIXBUF ImageType = C.GTK_IMAGE_PIXBUF
IMAGE_STOCK ImageType = C.GTK_IMAGE_STOCK
IMAGE_ICON_SET ImageType = C.GTK_IMAGE_ICON_SET
IMAGE_ANIMATION ImageType = C.GTK_IMAGE_ANIMATION
IMAGE_ICON_NAME ImageType = C.GTK_IMAGE_ICON_NAME
IMAGE_GICON ImageType = C.GTK_IMAGE_GICON
)
// TODO: add GTK_IMAGE_SURFACE for GTK 3.10
func marshalImageType(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return ImageType(c), nil
}
// InputHints is a representation of GTK's GtkInputHints.
type InputHints int
const (
INPUT_HINT_NONE InputHints = C.GTK_INPUT_HINT_NONE
INPUT_HINT_SPELLCHECK InputHints = C.GTK_INPUT_HINT_SPELLCHECK
INPUT_HINT_NO_SPELLCHECK InputHints = C.GTK_INPUT_HINT_NO_SPELLCHECK
INPUT_HINT_WORD_COMPLETION InputHints = C.GTK_INPUT_HINT_WORD_COMPLETION
INPUT_HINT_LOWERCASE InputHints = C.GTK_INPUT_HINT_LOWERCASE
INPUT_HINT_UPPERCASE_CHARS InputHints = C.GTK_INPUT_HINT_UPPERCASE_CHARS
INPUT_HINT_UPPERCASE_WORDS InputHints = C.GTK_INPUT_HINT_UPPERCASE_WORDS
INPUT_HINT_UPPERCASE_SENTENCES InputHints = C.GTK_INPUT_HINT_UPPERCASE_SENTENCES
INPUT_HINT_INHIBIT_OSK InputHints = C.GTK_INPUT_HINT_INHIBIT_OSK
)
// TODO:
// GTK_INPUT_HINT_VERTICAL_WRITING Since 3.18
// GTK_INPUT_HINT_EMOJI Since 3.22.20
// GTK_INPUT_HINT_NO_EMOJI Since 3.22.20
func marshalInputHints(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return InputHints(c), nil
}
// InputPurpose is a representation of GTK's GtkInputPurpose.
type InputPurpose int
const (
INPUT_PURPOSE_FREE_FORM InputPurpose = C.GTK_INPUT_PURPOSE_FREE_FORM
INPUT_PURPOSE_ALPHA InputPurpose = C.GTK_INPUT_PURPOSE_ALPHA
INPUT_PURPOSE_DIGITS InputPurpose = C.GTK_INPUT_PURPOSE_DIGITS
INPUT_PURPOSE_NUMBER InputPurpose = C.GTK_INPUT_PURPOSE_NUMBER
INPUT_PURPOSE_PHONE InputPurpose = C.GTK_INPUT_PURPOSE_PHONE
INPUT_PURPOSE_URL InputPurpose = C.GTK_INPUT_PURPOSE_URL
INPUT_PURPOSE_EMAIL InputPurpose = C.GTK_INPUT_PURPOSE_EMAIL
INPUT_PURPOSE_NAME InputPurpose = C.GTK_INPUT_PURPOSE_NAME
INPUT_PURPOSE_PASSWORD InputPurpose = C.GTK_INPUT_PURPOSE_PASSWORD
INPUT_PURPOSE_PIN InputPurpose = C.GTK_INPUT_PURPOSE_PIN
)
func marshalInputPurpose(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return InputPurpose(c), nil
}
// TODO:
// GtkBaselinePosition
// GtkDeleteType
// GtkDirectionType
// Justify is a representation of GTK's GtkJustification.
type Justification int
const (
JUSTIFY_LEFT Justification = C.GTK_JUSTIFY_LEFT
JUSTIFY_RIGHT Justification = C.GTK_JUSTIFY_RIGHT
JUSTIFY_CENTER Justification = C.GTK_JUSTIFY_CENTER
JUSTIFY_FILL Justification = C.GTK_JUSTIFY_FILL
)
func marshalJustification(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return Justification(c), nil
}
// License is a representation of GTK's GtkLicense.
type License int
const (
LICENSE_UNKNOWN License = C.GTK_LICENSE_UNKNOWN
LICENSE_CUSTOM License = C.GTK_LICENSE_CUSTOM
LICENSE_GPL_2_0 License = C.GTK_LICENSE_GPL_2_0
LICENSE_GPL_3_0 License = C.GTK_LICENSE_GPL_3_0
LICENSE_LGPL_2_1 License = C.GTK_LICENSE_LGPL_2_1
LICENSE_LGPL_3_0 License = C.GTK_LICENSE_LGPL_3_0
LICENSE_BSD License = C.GTK_LICENSE_BSD
LICENSE_MIT_X11 License = C.GTK_LICENSE_MIT_X11
LICENSE_GTK_ARTISTIC License = C.GTK_LICENSE_ARTISTIC
)
func marshalLicense(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return License(c), nil
}
// MessageType is a representation of GTK's GtkMessageType.
type MessageType int
const (
MESSAGE_INFO MessageType = C.GTK_MESSAGE_INFO
MESSAGE_WARNING MessageType = C.GTK_MESSAGE_WARNING
MESSAGE_QUESTION MessageType = C.GTK_MESSAGE_QUESTION
MESSAGE_ERROR MessageType = C.GTK_MESSAGE_ERROR
MESSAGE_OTHER MessageType = C.GTK_MESSAGE_OTHER
)
func marshalMessageType(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return MessageType(c), nil
}
// TODO:
// GtkMovementStep
// Orientation is a representation of GTK's GtkOrientation.
type Orientation int
const (
ORIENTATION_HORIZONTAL Orientation = C.GTK_ORIENTATION_HORIZONTAL
ORIENTATION_VERTICAL Orientation = C.GTK_ORIENTATION_VERTICAL
)
func marshalOrientation(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return Orientation(c), nil
}
// PackType is a representation of GTK's GtkPackType.
type PackType int
const (
PACK_START PackType = C.GTK_PACK_START
PACK_END PackType = C.GTK_PACK_END
)
func marshalPackType(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return PackType(c), nil
}
// PathType is a representation of GTK's GtkPathType.
type PathType int
const (
PATH_WIDGET PathType = C.GTK_PATH_WIDGET
PATH_WIDGET_CLASS PathType = C.GTK_PATH_WIDGET_CLASS
PATH_CLASS PathType = C.GTK_PATH_CLASS
)
func marshalPathType(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return PathType(c), nil
}
// PolicyType is a representation of GTK's GtkPolicyType.
type PolicyType int
const (
POLICY_ALWAYS PolicyType = C.GTK_POLICY_ALWAYS
POLICY_AUTOMATIC PolicyType = C.GTK_POLICY_AUTOMATIC
POLICY_NEVER PolicyType = C.GTK_POLICY_NEVER
)
func marshalPolicyType(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return PolicyType(c), nil
}
// TODO:
// GtkSpinButtonUpdatePolicy
// GtkSpinType
// TreeViewGridLine is a representation of GTK's GtkTreeViewGridLines.
type TreeViewGridLines int
const (
TREE_VIEW_GRID_LINES_NONE TreeViewGridLines = C.GTK_TREE_VIEW_GRID_LINES_NONE
TREE_VIEW_GRID_LINES_HORIZONTAL TreeViewGridLines = C.GTK_TREE_VIEW_GRID_LINES_HORIZONTAL
TREE_VIEW_GRID_LINES_VERTICAL TreeViewGridLines = C.GTK_TREE_VIEW_GRID_LINES_VERTICAL
TREE_VIEW_GRID_LINES_BOTH TreeViewGridLines = C.GTK_TREE_VIEW_GRID_LINES_BOTH
)
// PositionType is a representation of GTK's GtkPositionType.
type PositionType int
const (
POS_LEFT PositionType = C.GTK_POS_LEFT
POS_RIGHT PositionType = C.GTK_POS_RIGHT
POS_TOP PositionType = C.GTK_POS_TOP
POS_BOTTOM PositionType = C.GTK_POS_BOTTOM
)
func marshalPositionType(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return PositionType(c), nil
}
// ReliefStyle is a representation of GTK's GtkReliefStyle.
type ReliefStyle int
const (
RELIEF_NORMAL ReliefStyle = C.GTK_RELIEF_NORMAL
RELIEF_HALF ReliefStyle = C.GTK_RELIEF_HALF
RELIEF_NONE ReliefStyle = C.GTK_RELIEF_NONE
)
func marshalReliefStyle(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return ReliefStyle(c), nil
}
// ResponseType is a representation of GTK's GtkResponseType.
type ResponseType int
const (
RESPONSE_NONE ResponseType = C.GTK_RESPONSE_NONE
RESPONSE_REJECT ResponseType = C.GTK_RESPONSE_REJECT
RESPONSE_ACCEPT ResponseType = C.GTK_RESPONSE_ACCEPT
RESPONSE_DELETE_EVENT ResponseType = C.GTK_RESPONSE_DELETE_EVENT
RESPONSE_OK ResponseType = C.GTK_RESPONSE_OK
RESPONSE_CANCEL ResponseType = C.GTK_RESPONSE_CANCEL
RESPONSE_CLOSE ResponseType = C.GTK_RESPONSE_CLOSE
RESPONSE_YES ResponseType = C.GTK_RESPONSE_YES
RESPONSE_NO ResponseType = C.GTK_RESPONSE_NO
RESPONSE_APPLY ResponseType = C.GTK_RESPONSE_APPLY
RESPONSE_HELP ResponseType = C.GTK_RESPONSE_HELP
)
func marshalResponseType(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return ResponseType(c), nil
}
// TODO:
// GtkScrollStep
// GtkScrollType
// SelectionMode is a representation of GTK's GtkSelectionMode.
type SelectionMode int
const (
SELECTION_NONE SelectionMode = C.GTK_SELECTION_NONE
SELECTION_SINGLE SelectionMode = C.GTK_SELECTION_SINGLE
SELECTION_BROWSE SelectionMode = C.GTK_SELECTION_BROWSE
SELECTION_MULTIPLE SelectionMode = C.GTK_SELECTION_MULTIPLE
)
func marshalSelectionMode(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return SelectionMode(c), nil
}
// ShadowType is a representation of GTK's GtkShadowType.
type ShadowType int
const (
SHADOW_NONE ShadowType = C.GTK_SHADOW_NONE
SHADOW_IN ShadowType = C.GTK_SHADOW_IN
SHADOW_OUT ShadowType = C.GTK_SHADOW_OUT
SHADOW_ETCHED_IN ShadowType = C.GTK_SHADOW_ETCHED_IN
SHADOW_ETCHED_OUT ShadowType = C.GTK_SHADOW_ETCHED_OUT
)
func marshalShadowType(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return ShadowType(c), nil
}
// SizeGroupMode is a representation of GTK's GtkSizeGroupMode
type SizeGroupMode int
const (
SIZE_GROUP_NONE SizeGroupMode = C.GTK_SIZE_GROUP_NONE
SIZE_GROUP_HORIZONTAL SizeGroupMode = C.GTK_SIZE_GROUP_HORIZONTAL
SIZE_GROUP_VERTICAL SizeGroupMode = C.GTK_SIZE_GROUP_VERTICAL
SIZE_GROUP_BOTH SizeGroupMode = C.GTK_SIZE_GROUP_BOTH
)
func marshalSizeGroupMode(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return SizeGroupMode(c), nil
}
// SortType is a representation of GTK's GtkSortType.
type SortType int
const (
SORT_ASCENDING SortType = C.GTK_SORT_ASCENDING
SORT_DESCENDING = C.GTK_SORT_DESCENDING
)
// Use as column id in SetSortColumnId to specify ListStore sorted
// by default column or unsorted
const (
SORT_COLUMN_DEFAULT int = -1
SORT_COLUMN_UNSORTED int = -2
)
func marshalSortType(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return SortType(c), nil
}
// StateFlags is a representation of GTK's GtkStateFlags.
type StateFlags int
const (
STATE_FLAG_NORMAL StateFlags = C.GTK_STATE_FLAG_NORMAL
STATE_FLAG_ACTIVE StateFlags = C.GTK_STATE_FLAG_ACTIVE
STATE_FLAG_PRELIGHT StateFlags = C.GTK_STATE_FLAG_PRELIGHT
STATE_FLAG_SELECTED StateFlags = C.GTK_STATE_FLAG_SELECTED
STATE_FLAG_INSENSITIVE StateFlags = C.GTK_STATE_FLAG_INSENSITIVE
STATE_FLAG_INCONSISTENT StateFlags = C.GTK_STATE_FLAG_INCONSISTENT
STATE_FLAG_FOCUSED StateFlags = C.GTK_STATE_FLAG_FOCUSED
STATE_FLAG_BACKDROP StateFlags = C.GTK_STATE_FLAG_BACKDROP
)
func marshalStateFlags(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return StateFlags(c), nil
}
// TextDirection is a representation of GTK's GtkTextDirection.
type TextDirection int
const (
TEXT_DIR_NONE TextDirection = C.GTK_TEXT_DIR_NONE
TEXT_DIR_LTR TextDirection = C.GTK_TEXT_DIR_LTR
TEXT_DIR_RTL TextDirection = C.GTK_TEXT_DIR_RTL
)
func marshalTextDirection(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return TextDirection(c), nil
}
// TargetFlags is a representation of GTK's GtkTargetFlags.
type TargetFlags int
const (
TARGET_SAME_APP TargetFlags = C.GTK_TARGET_SAME_APP
TARGET_SAME_WIDGET TargetFlags = C.GTK_TARGET_SAME_WIDGET
TARGET_OTHER_APP TargetFlags = C.GTK_TARGET_OTHER_APP
TARGET_OTHER_WIDGET TargetFlags = C.GTK_TARGET_OTHER_WIDGET
)
func marshalTargetFlags(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return TargetFlags(c), nil
}
// ToolbarStyle is a representation of GTK's GtkToolbarStyle.
type ToolbarStyle int
const (
TOOLBAR_ICONS ToolbarStyle = C.GTK_TOOLBAR_ICONS
TOOLBAR_TEXT ToolbarStyle = C.GTK_TOOLBAR_TEXT
TOOLBAR_BOTH ToolbarStyle = C.GTK_TOOLBAR_BOTH
TOOLBAR_BOTH_HORIZ ToolbarStyle = C.GTK_TOOLBAR_BOTH_HORIZ
)
func marshalToolbarStyle(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return ToolbarStyle(c), nil
}
// TreeModelFlags is a representation of GTK's GtkTreeModelFlags.
type TreeModelFlags int
const (
TREE_MODEL_ITERS_PERSIST TreeModelFlags = C.GTK_TREE_MODEL_ITERS_PERSIST
TREE_MODEL_LIST_ONLY TreeModelFlags = C.GTK_TREE_MODEL_LIST_ONLY
)
func marshalTreeModelFlags(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return TreeModelFlags(c), nil
}
// WindowPosition is a representation of GTK's GtkWindowPosition.
type WindowPosition int
const (
WIN_POS_NONE WindowPosition = C.GTK_WIN_POS_NONE
WIN_POS_CENTER WindowPosition = C.GTK_WIN_POS_CENTER
WIN_POS_MOUSE WindowPosition = C.GTK_WIN_POS_MOUSE
WIN_POS_CENTER_ALWAYS WindowPosition = C.GTK_WIN_POS_CENTER_ALWAYS
WIN_POS_CENTER_ON_PARENT WindowPosition = C.GTK_WIN_POS_CENTER_ON_PARENT
)
func marshalWindowPosition(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return WindowPosition(c), nil
}
// WindowType is a representation of GTK's GtkWindowType.
type WindowType int
const (
WINDOW_TOPLEVEL WindowType = C.GTK_WINDOW_TOPLEVEL
WINDOW_POPUP WindowType = C.GTK_WINDOW_POPUP
)
func marshalWindowType(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return WindowType(c), nil
}
// WrapMode is a representation of GTK's GtkWrapMode.
type WrapMode int
const (
WRAP_NONE WrapMode = C.GTK_WRAP_NONE
WRAP_CHAR WrapMode = C.GTK_WRAP_CHAR
WRAP_WORD WrapMode = C.GTK_WRAP_WORD
WRAP_WORD_CHAR WrapMode = C.GTK_WRAP_WORD_CHAR
)
func marshalWrapMode(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return WrapMode(c), nil
}
// TextSearchFlags is a representation of GTK's GtkTextSearchFlags.
type TextSearchFlags int
const (
TEXT_SEARCH_VISIBLE_ONLY TextSearchFlags = C.GTK_TEXT_SEARCH_VISIBLE_ONLY
TEXT_SEARCH_TEXT_ONLY TextSearchFlags = C.GTK_TEXT_SEARCH_TEXT_ONLY
TEXT_SEARCH_CASE_INSENSITIVE TextSearchFlags = C.GTK_TEXT_SEARCH_CASE_INSENSITIVE
)
func marshalTextSearchFlags(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return TextSearchFlags(c), nil
}
// CornerType is a representation of GTK's GtkCornerType.
type CornerType int
const (
CORNER_TOP_LEFT CornerType = C.GTK_CORNER_TOP_LEFT
CORNER_BOTTOM_LEFT CornerType = C.GTK_CORNER_BOTTOM_LEFT
CORNER_TOP_RIGHT CornerType = C.GTK_CORNER_TOP_RIGHT
CORNER_BOTTOM_RIGHT CornerType = C.GTK_CORNER_BOTTOM_RIGHT
)
func marshalCornerType(p uintptr) (interface{}, error) {
c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p)))
return CornerType(c), nil
}
/*
* Init and main event loop
*/
/*
Init() is a wrapper around gtk_init() and must be called before any
other GTK calls and is used to initialize everything necessary.
In addition to setting up GTK for usage, a pointer to a slice of
strings may be passed in to parse standard GTK command line arguments.
args will be modified to remove any flags that were handled.
Alternatively, nil may be passed in to not perform any command line
parsing.
*/
func Init(args *[]string) {
if args != nil {
argc := C.int(len(*args))
argv := C.make_strings(argc)
defer C.destroy_strings(argv)
for i, arg := range *args {
cstr := C.CString(arg)
C.set_string(argv, C.int(i), (*C.gchar)(cstr))
}
C.gtk_init((*C.int)(unsafe.Pointer(&argc)),
(***C.char)(unsafe.Pointer(&argv)))
unhandled := make([]string, argc)
for i := 0; i < int(argc); i++ {
cstr := C.get_string(argv, C.int(i))
unhandled[i] = goString(cstr)
C.free(unsafe.Pointer(cstr))
}
*args = unhandled
} else {
C.gtk_init(nil, nil)
}
}
/*
InitCheck() is a wrapper around gtk_init_check() and works exactly like Init()
only that it doesn't terminate the program if initialization fails.
*/
func InitCheck(args *[]string) error {
success := false
if args != nil {
argc := C.int(len(*args))
argv := C.make_strings(argc)
defer C.destroy_strings(argv)