// Conversion function func newEventFromNative(obj unsafe.Pointer) interface{} { // Cast to EventAny to extract type and send var var window *Window = nil ceventAny := (*C.GdkEventAny)(obj) t := int(ceventAny._type) if win, err := gobject.ConvertToGo(unsafe.Pointer(ceventAny.window)); err == nil { window = win.(*Window) } se := ceventAny.send_event send := gobject.GoBool(unsafe.Pointer(&se)) // Create new EventAny Struct eventAny := EventAny{t, window, send} // test specific events switch t { case GdkEventType.KEY_PRESS, GdkEventType.KEY_RELEASE: ek := createEventKey(obj) ek.EventAny = eventAny return ek case GdkEventType.BUTTON_PRESS, GdkEventType.BUTTON_PRESS_2, GdkEventType.BUTTON_PRESS_3, GdkEventType.BUTTON_RELEASE: eb := createEventButton(obj) eb.EventAny = eventAny return eb } return eventAny }
func (self *Widget) GetTopLevel() WidgetLike { w := C.gtk_widget_get_toplevel(self.object) if tl, err := gobject.ConvertToGo(unsafe.Pointer(&w)); err == nil { return tl.(WidgetLike) } return nil }
func (self Container) GetFocusChild() WidgetLike { w := C.gtk_container_get_focus_child(self.object) i, err := gobject.ConvertToGo(unsafe.Pointer(w)) if err != nil { return i.(WidgetLike) } return nil }
func (self *Frame) GetLabelWidget() WidgetLike { cw := C.gtk_frame_get_label_widget(self.object) w, err := gobject.ConvertToGo(unsafe.Pointer(cw)) if err != nil { return w.(WidgetLike) } return nil }
func (self *Button) GetImage() WidgetLike { cw := C.gtk_button_get_image(self.object) widget, err := gobject.ConvertToGo(unsafe.Pointer(&cw)) if err != nil { return widget.(WidgetLike) } return nil }
func (self *Window) GetFocus() WidgetLike { widget := C.gtk_window_get_focus(self.object) val, err := gobject.ConvertToGo(unsafe.Pointer(widget)) if err != nil { return nil } return val.(WidgetLike) }
func (self *Widget) GetAncestor(widget_type gobject.GType) WidgetLike { w := C.gtk_widget_get_ancestor(self.object, C.GType(widget_type)) if w == nil { return nil } if par, err := gobject.ConvertToGo(unsafe.Pointer(&w)); err == nil { return par.(WidgetLike) } return nil }
func (self *Window) GetApplication() *Application { a := gobject.GetProperty(self, "application") defer a.Free() app, _ := gobject.ConvertToGo(a.GetPtr()) if app != nil { return app.(*Application) } return nil }
func (self *Label) GetMnemonicWidget() WidgetLike { w := C.gtk_label_get_mnemonic_widget(self.object) if w == nil { return nil } widget, err := gobject.ConvertToGo(unsafe.Pointer(w)) if err != nil { return widget.(WidgetLike) } return nil }
func createEventButton(obj unsafe.Pointer) EventButton { eb := (*C.GdkEventButton)(obj) eventButton := EventButton{} eventButton.Time = uint32(eb.time) eventButton.X = float64(eb.x) eventButton.Y = float64(eb.y) eventButton.State = uint(eb.state) eventButton.Button = uint(eb.button) gd, _ := gobject.ConvertToGo(unsafe.Pointer(eb.device), GdkType.DEVICE) eventButton.Device = gd.(*Device) eventButton.X_Root = float64(eb.x_root) eventButton.Y_Root = float64(eb.y_root) return eventButton }
func (self *Window) HasTopLevelFocus() bool { b := C.gtk_window_has_toplevel_focus(self.object) cb, _ := gobject.ConvertToGo(unsafe.Pointer(&b), gobject.G_TYPE_BOOLEAN) return cb.(bool) }
func (self *Window) IsActive() bool { b := C.gtk_window_is_active(self.object) cb, _ := gobject.ConvertToGo(unsafe.Pointer(&b), gobject.G_TYPE_BOOLEAN) return cb.(bool) }
func (self *Window) ActivateDefault() bool { b := C.gtk_window_activate_default(self.object) gb, _ := gobject.ConvertToGo(unsafe.Pointer(&b), gobject.G_TYPE_BOOLEAN) return gb.(bool) }