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
|
package gtk
// #include <gtk/gtk.h>
// #include "gtk.go.h"
import "C"
import (
"unsafe"
"github.com/gotk3/gotk3/glib"
)
func init() {
tm := []glib.TypeMarshaler{
{glib.Type(C.gtk_info_bar_get_type()), marshalInfoBar},
}
glib.RegisterGValueMarshalers(tm)
WrapMap["GtkInfoBar"] = wrapInfoBar
}
type InfoBar struct {
Box
}
func (v *InfoBar) native() *C.GtkInfoBar {
if v == nil || v.GObject == nil {
return nil
}
p := unsafe.Pointer(v.GObject)
return C.toGtkInfoBar(p)
}
func marshalInfoBar(p uintptr) (interface{}, error) {
c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p)))
return wrapInfoBar(glib.Take(unsafe.Pointer(c))), nil
}
func wrapInfoBar(obj *glib.Object) *InfoBar {
if obj == nil {
return nil
}
return &InfoBar{Box{Container{Widget{glib.InitiallyUnowned{obj}}}}}
}
// InfoBarNew is a wrapper around gtk_info_bar_new().
func InfoBarNew() (*InfoBar, error) {
c := C.gtk_info_bar_new()
if c == nil {
return nil, nilPtrErr
}
return wrapInfoBar(glib.Take(unsafe.Pointer(c))), nil
}
// TODO:
// gtk_info_bar_new_with_buttons().
// AddActionWidget is a wrapper around gtk_info_bar_add_action_widget().
func (v *InfoBar) AddActionWidget(w IWidget, responseId ResponseType) {
C.gtk_info_bar_add_action_widget(v.native(), w.toWidget(), C.gint(responseId))
}
// AddButton is a wrapper around gtk_info_bar_add_button().
func (v *InfoBar) AddButton(buttonText string, responseId ResponseType) {
cstr := C.CString(buttonText)
defer C.free(unsafe.Pointer(cstr))
C.gtk_info_bar_add_button(v.native(), (*C.gchar)(cstr), C.gint(responseId))
}
// TODO:
// gtk_info_bar_add_buttons().
// SetResponseSensitive is a wrapper around gtk_info_bar_set_response_sensitive().
func (v *InfoBar) SetResponseSensitive(responseId ResponseType, setting bool) {
C.gtk_info_bar_set_response_sensitive(v.native(), C.gint(responseId), gbool(setting))
}
// SetDefaultResponse is a wrapper around gtk_info_bar_set_default_response().
func (v *InfoBar) SetDefaultResponse(responseId ResponseType) {
C.gtk_info_bar_set_default_response(v.native(), C.gint(responseId))
}
// TODO:
// gtk_info_bar_response().
// SetMessageType is a wrapper around gtk_info_bar_set_message_type().
func (v *InfoBar) SetMessageType(messageType MessageType) {
C.gtk_info_bar_set_message_type(v.native(), C.GtkMessageType(messageType))
}
// GetMessageType is a wrapper around gtk_info_bar_get_message_type().
func (v *InfoBar) GetMessageType() MessageType {
messageType := C.gtk_info_bar_get_message_type(v.native())
return MessageType(messageType)
}
// GetActionArea is a wrapper around gtk_info_bar_get_action_area().
func (v *InfoBar) GetActionArea() (IWidget, error) {
c := C.gtk_info_bar_get_action_area(v.native())
if c == nil {
return nil, nilPtrErr
}
return castWidget(c)
}
// GetContentArea is a wrapper around gtk_info_bar_get_content_area().
func (v *InfoBar) GetContentArea() (*Box, error) {
c := C.gtk_info_bar_get_content_area(v.native())
if c == nil {
return nil, nilPtrErr
}
return wrapBox(glib.Take(unsafe.Pointer(c))), nil
}
// GetShowCloseButton is a wrapper around gtk_info_bar_get_show_close_button().
func (v *InfoBar) GetShowCloseButton() bool {
b := C.gtk_info_bar_get_show_close_button(v.native())
return gobool(b)
}
// SetShowCloseButton is a wrapper around gtk_info_bar_set_show_close_button().
func (v *InfoBar) SetShowCloseButton(setting bool) {
C.gtk_info_bar_set_show_close_button(v.native(), gbool(setting))
}
// TODO: for GTK+ 3.22.29
// gtk_info_bar_get_revealed().
// gtk_info_bar_set_revealed().
|