Exemplo n.º 1
0
/*
Ends the drag operation after a drop.

This function is called by the drag destination.
*/
func DropFinish(context IsDragContext, success bool, time_ uint32) {
	__cgo__success := C.gboolean(0)
	if success {
		__cgo__success = C.gboolean(1)
	}
	C.gdk_drop_finish(context.GetDragContextPointer(), __cgo__success, C.guint32(time_))
	return
}
Exemplo n.º 2
0
/*
Accepts or rejects a drop.

This function is called by the drag destination in response
to a drop initiated by the drag source.
*/
func DropReply(context IsDragContext, accepted bool, time_ uint32) {
	__cgo__accepted := C.gboolean(0)
	if accepted {
		__cgo__accepted = C.gboolean(1)
	}
	C.gdk_drop_reply(context.GetDragContextPointer(), __cgo__accepted, C.guint32(time_))
	return
}
Exemplo n.º 3
0
func (self Color) ToNative() unsafe.Pointer {
	var cColor *C.GdkColor = C._new_color()

	cColor.pixel = C.guint32(self.Pixel)
	cColor.red = C.guint16(self.Red)
	cColor.green = C.guint16(self.Green)
	cColor.blue = C.guint16(self.Blue)

	return unsafe.Pointer(cColor)
}
Exemplo n.º 4
0
// Grab() is a wrapper around gdk_device_grab().
func (v *Device) Grab(w *Window, ownership GrabOwnership, owner_events bool, event_mask EventMask, cursor *Cursor, time uint32) GrabStatus {
	ret := C.gdk_device_grab(
		v.native(),
		w.native(),
		C.GdkGrabOwnership(ownership),
		gbool(owner_events),
		C.GdkEventMask(event_mask),
		cursor.native(),
		C.guint32(time),
	)
	return GrabStatus(ret)
}
Exemplo n.º 5
0
/*
Sets the owner of the given selection.
*/
func SelectionOwnerSet(owner IsWindow, selection C.GdkAtom, time_ uint32, send_event bool) (return__ bool) {
	var __cgo__owner *C.GdkWindow
	if owner != nil {
		__cgo__owner = owner.GetWindowPointer()
	}
	__cgo__send_event := C.gboolean(0)
	if send_event {
		__cgo__send_event = C.gboolean(1)
	}
	var __cgo__return__ C.gboolean
	__cgo__return__ = C.gdk_selection_owner_set(__cgo__owner, selection, C.guint32(time_), __cgo__send_event)
	return__ = __cgo__return__ == C.gboolean(1)
	return
}
Exemplo n.º 6
0
func NewHTMLFilter(flags uint32, colour int32) *aFilter {
	f := C.g_mime_filter_html_new(C.guint32(flags), C.guint32(colour))
	defer unref(C.gpointer(f))
	return castFilter(f)
}
Exemplo n.º 7
0
func NewEnrichedFilter(flags int32) *aFilter {
	f := C.g_mime_filter_enriched_new(C.guint32(flags))
	return castFilter(f)
}
Exemplo n.º 8
0
// PresentWithTime is a wrapper around gtk_window_present_with_time().
func (v *Window) PresentWithTime(ts uint32) {
	C.gtk_window_present_with_time(v.native(), C.guint32(ts))
}
Exemplo n.º 9
0
Arquivo: glib.go Projeto: jrick/gotk3
// Set() is a wrapper around g_object_set().  However, unlike
// g_object_set(), this function only sets one name value pair.  Make
// multiple calls to this function to set multiple properties.
func (v *Object) Set(name string, value interface{}) error {
	cstr := C.CString(name)
	defer C.free(unsafe.Pointer(cstr))

	if _, ok := value.(Object); ok {
		value = value.(Object).GObject
	}

	var p unsafe.Pointer = nil
	switch value.(type) {
	case bool:
		c := gbool(value.(bool))
		p = unsafe.Pointer(&c)
	case int8:
		c := C.gint8(value.(int8))
		p = unsafe.Pointer(&c)
	case int16:
		c := C.gint16(value.(int16))
		p = unsafe.Pointer(&c)
	case int32:
		c := C.gint32(value.(int32))
		p = unsafe.Pointer(&c)
	case int64:
		c := C.gint64(value.(int64))
		p = unsafe.Pointer(&c)
	case int:
		c := C.gint(value.(int))
		p = unsafe.Pointer(&c)
	case uint8:
		c := C.guchar(value.(uint8))
		p = unsafe.Pointer(&c)
	case uint16:
		c := C.guint16(value.(uint16))
		p = unsafe.Pointer(&c)
	case uint32:
		c := C.guint32(value.(uint32))
		p = unsafe.Pointer(&c)
	case uint64:
		c := C.guint64(value.(uint64))
		p = unsafe.Pointer(&c)
	case uint:
		c := C.guint(value.(uint))
		p = unsafe.Pointer(&c)
	case uintptr:
		p = unsafe.Pointer(C.gpointer(value.(uintptr)))
	case float32:
		c := C.gfloat(value.(float32))
		p = unsafe.Pointer(&c)
	case float64:
		c := C.gdouble(value.(float64))
		p = unsafe.Pointer(&c)
	case string:
		cstr := C.CString(value.(string))
		defer C.free(unsafe.Pointer(cstr))
		p = unsafe.Pointer(cstr)
	default:
		if pv, ok := value.(unsafe.Pointer); ok {
			p = pv
		} else {
			// Constants with separate types are not type asserted
			// above, so do a runtime check here instead.
			val := reflect.ValueOf(value)
			switch val.Kind() {
			case reflect.Int, reflect.Int8, reflect.Int16,
				reflect.Int32, reflect.Int64:
				c := C.int(val.Int())
				p = unsafe.Pointer(&c)
			case reflect.Uintptr:
				p = unsafe.Pointer(C.gpointer(val.Pointer()))
			}
		}
	}
	// Can't call g_object_set() as it uses a variable arg list, use a
	// wrapper instead
	if p != nil {
		C._g_object_set_one(C.gpointer(v.GObject), (*C.gchar)(cstr), p)
		return nil
	} else {
		return errors.New("Unable to perform type conversion")
	}
}
Exemplo n.º 10
0
/*
Drops on the current destination.

This function is called by the drag source.
*/
func DragDrop(context IsDragContext, time_ uint32) {
	C.gdk_drag_drop(context.GetDragContextPointer(), C.guint32(time_))
	return
}
Exemplo n.º 11
0
func (p *Pixbuf) Fill(pixel uint32) {
	C.gdk_pixbuf_fill(p.GPixbuf, C.guint32(pixel))
}
Exemplo n.º 12
0
/*
Clears a pixbuf to the given RGBA value, converting the RGBA value into
the pixbuf's pixel format. The alpha will be ignored if the pixbuf
doesn't have an alpha channel.
*/
func (self *TraitPixbuf) Fill(pixel uint32) {
	C.gdk_pixbuf_fill(self.CPointer, C.guint32(pixel))
	return
}
Exemplo n.º 13
0
/*
Sends a response to SelectionRequest event.
*/
func SelectionSendNotify(requestor IsWindow, selection C.GdkAtom, target C.GdkAtom, property C.GdkAtom, time_ uint32) {
	C.gdk_selection_send_notify(requestor.GetWindowPointer(), selection, target, property, C.guint32(time_))
	return
}
Exemplo n.º 14
0
Arquivo: gdk.go Projeto: gotk3/gotk3
func UnicodeToKeyval(v rune) uint {
	return uint(C.gdk_unicode_to_keyval(C.guint32(v)))
}
Exemplo n.º 15
0
/*
Send a response to SelectionRequest event.
*/
func SelectionSendNotifyForDisplay(display IsDisplay, requestor IsWindow, selection C.GdkAtom, target C.GdkAtom, property C.GdkAtom, time_ uint32) {
	C.gdk_selection_send_notify_for_display(display.GetDisplayPointer(), requestor.GetWindowPointer(), selection, target, property, C.guint32(time_))
	return
}
Exemplo n.º 16
0
/*
Selects one of the actions offered by the drag source.

This function is called by the drag destination in response to
gdk_drag_motion() called by the drag source.
*/
func DragStatus(context IsDragContext, action C.GdkDragAction, time_ uint32) {
	C.gdk_drag_status(context.GetDragContextPointer(), action, C.guint32(time_))
	return
}
Exemplo n.º 17
0
/*
Updates the drag context when the pointer moves or the
set of actions changes.

This function is called by the drag source.
*/
func DragMotion(context IsDragContext, dest_window IsWindow, protocol C.GdkDragProtocol, x_root int, y_root int, suggested_action C.GdkDragAction, possible_actions C.GdkDragAction, time_ uint32) (return__ bool) {
	var __cgo__return__ C.gboolean
	__cgo__return__ = C.gdk_drag_motion(context.GetDragContextPointer(), dest_window.GetWindowPointer(), protocol, C.gint(x_root), C.gint(y_root), suggested_action, possible_actions, C.guint32(time_))
	return__ = __cgo__return__ == C.gboolean(1)
	return
}
Exemplo n.º 18
0
/*
Creates a transformation of the source image @src by scaling by
@scale_x and @scale_y then translating by @offset_x and @offset_y,
then composites the rectangle (@dest_x ,@dest_y, @dest_width,
@dest_height) of the resulting image with a checkboard of the
colors @color1 and @color2 and renders it onto the destination
image.

See gdk_pixbuf_composite_color_simple() for a simpler variant of this
function suitable for many tasks.
*/
func (self *TraitPixbuf) CompositeColor(dest IsPixbuf, dest_x int, dest_y int, dest_width int, dest_height int, offset_x float64, offset_y float64, scale_x float64, scale_y float64, interp_type C.GdkInterpType, overall_alpha int, check_x int, check_y int, check_size int, color1 uint32, color2 uint32) {
	C.gdk_pixbuf_composite_color(self.CPointer, dest.GetPixbufPointer(), C.int(dest_x), C.int(dest_y), C.int(dest_width), C.int(dest_height), C.double(offset_x), C.double(offset_y), C.double(scale_x), C.double(scale_y), interp_type, C.int(overall_alpha), C.int(check_x), C.int(check_y), C.int(check_size), C.guint32(color1), C.guint32(color2))
	return
}
Exemplo n.º 19
0
func (t *track) SetRating(val RatingT) {
	t.t.rating = C.guint32(val)
}
Exemplo n.º 20
0
/*
Creates a new #GdkPixbuf by scaling @src to @dest_width x
@dest_height and compositing the result with a checkboard of colors
@color1 and @color2.
*/
func (self *TraitPixbuf) CompositeColorSimple(dest_width int, dest_height int, interp_type C.GdkInterpType, overall_alpha int, check_size int, color1 uint32, color2 uint32) (return__ *Pixbuf) {
	var __cgo__return__ *C.GdkPixbuf
	__cgo__return__ = C.gdk_pixbuf_composite_color_simple(self.CPointer, C.int(dest_width), C.int(dest_height), interp_type, C.int(overall_alpha), C.int(check_size), C.guint32(color1), C.guint32(color2))
	if __cgo__return__ != nil {
		return__ = NewPixbufFromCPointer(unsafe.Pointer(reflect.ValueOf(__cgo__return__).Pointer()))
	}
	return
}
Exemplo n.º 21
0
// Sets the ordering index for the indicator which affects the placement of it on the panel. For almost all app indicators this is not he function you're looking for.
func (indicator *AppIndicator) SetOrderingIndex(index uint32) {
	C.app_indicator_set_ordering_index((*C.AppIndicator)(indicator.IndicatorPtr), C.guint32(index))
}
Exemplo n.º 22
0
// MoveToDesktop is a wrapper around gdk_x11_window_move_to_desktop().
// It only works on GDK versions compiled with X11 support - its return value can't be used if WorkspaceControlSupported returns false
func (v *Window) MoveToDesktop(d uint32) {
	C.gdk_x11_window_move_to_desktop(v.native(), C.guint32(d))
}
Exemplo n.º 23
0
/*
Convert from a ISO10646 character to a key symbol.
*/
func UnicodeToKeyval(wc uint32) (return__ uint) {
	var __cgo__return__ C.guint
	__cgo__return__ = C.gdk_unicode_to_keyval(C.guint32(wc))
	return__ = uint(__cgo__return__)
	return
}
Exemplo n.º 24
0
func (t *track) SetSize(val int32) {
	t.t.size = C.guint32(val)
}
Exemplo n.º 25
0
func GlibUInt32(i uint32) C.guint32 {
	return C.guint32(i)
}
Exemplo n.º 26
0
func (t *track) SetPlaycount(val int32) {
	t.t.playcount = C.guint32(val)
}
Exemplo n.º 27
0
// Ungrab() is a wrapper around gdk_device_ungrab().
func (v *Device) Ungrab(time uint32) {
	C.gdk_device_ungrab(v.native(), C.guint32(time))
}
Exemplo n.º 28
0
Arquivo: glib.go Projeto: vvanpo/gotk3
// pointerVal attempts to return an unsafe.Pointer for value.
// Not all types are understood, in which case a nil Pointer
// is returned.
func pointerVal(value interface{}) unsafe.Pointer {
	var p unsafe.Pointer
	switch v := value.(type) {
	case bool:
		c := gbool(v)
		p = unsafe.Pointer(&c)

	case int8:
		c := C.gint8(v)
		p = unsafe.Pointer(&c)

	case int16:
		c := C.gint16(v)
		p = unsafe.Pointer(&c)

	case int32:
		c := C.gint32(v)
		p = unsafe.Pointer(&c)

	case int64:
		c := C.gint64(v)
		p = unsafe.Pointer(&c)

	case int:
		c := C.gint(v)
		p = unsafe.Pointer(&c)

	case uint8:
		c := C.guchar(v)
		p = unsafe.Pointer(&c)

	case uint16:
		c := C.guint16(v)
		p = unsafe.Pointer(&c)

	case uint32:
		c := C.guint32(v)
		p = unsafe.Pointer(&c)

	case uint64:
		c := C.guint64(v)
		p = unsafe.Pointer(&c)

	case uint:
		c := C.guint(v)
		p = unsafe.Pointer(&c)

	case uintptr:
		p = unsafe.Pointer(C.gpointer(v))

	case float32:
		c := C.gfloat(v)
		p = unsafe.Pointer(&c)

	case float64:
		c := C.gdouble(v)
		p = unsafe.Pointer(&c)

	case string:
		cstr := C.CString(v)
		defer C.free(unsafe.Pointer(cstr))
		p = unsafe.Pointer(cstr)

	default:
		if pv, ok := value.(unsafe.Pointer); ok {
			p = pv
		} else {
			val := reflect.ValueOf(value)
			switch val.Kind() {
			case reflect.Int, reflect.Int8, reflect.Int16,
				reflect.Int32, reflect.Int64:
				c := C.int(val.Int())
				p = unsafe.Pointer(&c)

			case reflect.Uintptr, reflect.Ptr, reflect.UnsafePointer:
				p = unsafe.Pointer(C.gpointer(val.Pointer()))
			}
		}
	}

	return p
}
Exemplo n.º 29
0
/*
Retrieves the contents of a selection in a given
form.
*/
func SelectionConvert(requestor IsWindow, selection C.GdkAtom, target C.GdkAtom, time_ uint32) {
	C.gdk_selection_convert(requestor.GetWindowPointer(), selection, target, C.guint32(time_))
	return
}