Ejemplo n.º 1
0
// 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
}
Ejemplo n.º 2
0
func (self *FontDescription) BetterMatch(oldMatch, newMatch *FontDescription) bool {
	var fDesc *C.PangoFontDescription = nil

	if oldMatch != nil {
		fDesc = oldMatch.object
	}

	b := C.pango_font_description_better_match(self.object, fDesc, newMatch.object)
	return gobject.GoBool(unsafe.Pointer(&b))
}
Ejemplo n.º 3
0
func (self Rectangle) Intersect(r2 Rectangle) (bool, Rectangle) {
	var cr3 C.GdkRectangle
	cr1 := nativeFromRectangle(self)
	defer cr1.Free()
	cr2 := nativeFromRectangle(r2)
	defer cr2.Free()
	b := C.gdk_rectangle_intersect((*C.GdkRectangle)(cr1.GetPtr()), (*C.GdkRectangle)(cr2.GetPtr()), &cr3)
	rec := newRectangleFromNative(unsafe.Pointer(&cr3)).(Rectangle)

	return gobject.GoBool(unsafe.Pointer(&b)), rec
}
Ejemplo n.º 4
0
func (self *FontDescription) GetSizeIsAbsolute() bool {
	b := C.pango_font_description_get_size_is_absolute(self.object)
	return gobject.GoBool(unsafe.Pointer(&b))
}
Ejemplo n.º 5
0
func GSourceRemove(tag uint) bool {
	b := C.g_source_remove(C.guint(tag))
	return gobject.GoBool(unsafe.Pointer(&b))
}