Пример #1
0
// PANGO init funcs {{{
func init() {

	// Initialize PangoWeight
	PangoWeight.THIN = 100
	PangoWeight.ULTRALIGHT = 200
	PangoWeight.LIGHT = 300
	PangoWeight.BOOK = 380
	PangoWeight.NORMAL = 400
	PangoWeight.MEDIUM = 500
	PangoWeight.SEMIBOLD = 600
	PangoWeight.BOLD = 700
	PangoWeight.ULTRABOLD = 800
	PangoWeight.HEAVY = 900
	PangoWeight.ULTRAHEAVY = 1000

	// Initialize PangoStyle
	PangoStyle.NORMAL = 0
	PangoStyle.OBLIQUE = 1
	PangoStyle.ITALIC = 2

	// Initialize PangoScale
	PangoScale.Scale = 1024
	PangoScale.XX_SMALL = float64(0.5787037037037)
	PangoScale.X_SMALL = float64(0.6444444444444)
	PangoScale.SMALL = float64(0.8333333333333)
	PangoScale.MEDIUM = float64(1.0)
	PangoScale.LARGE = float64(1.2)
	PangoScale.X_LARGE = float64(1.4399999999999)
	PangoScale.XX_LARGE = float64(1.728)

	// Initialize PangoUnderline
	PangoUnderline.NONE = 0
	PangoUnderline.SINGLE = 1
	PangoUnderline.DOUBLE = 2
	PangoUnderline.LOW = 3
	PangoUnderline.ERROR = 4

	// Initialize PangoVariant
	PangoVariant.NORMAL = 0
	PangoVariant.SMALL_CAPS = 1

	// Initialize PangoStretch
	PangoStretch.ULTRA_CONDENSED = 0
	PangoStretch.EXTRA_CONDENSED = 1
	PangoStretch.CONDENSED = 2
	PangoStretch.SEMI_CONDENSED = 3
	PangoStretch.NORMAL = 4
	PangoStretch.SEMI_EXPANDED = 5
	PangoStretch.EXPANDED = 6
	PangoStretch.EXTRA_EXPANDED = 7
	PangoStretch.ULTRA_EXPANDED = 8

	// Initialize PangoGravity
	PangoGravity.SOUTH = 0
	PangoGravity.EAST = 1
	PangoGravity.NORTH = 2
	PangoGravity.WEST = 3
	PangoGravity.AUTO = 4

	// Initialize PangoFontMask
	PangoFontMask.FAMILY = 1 << 0
	PangoFontMask.STYLE = 1 << 1
	PangoFontMask.VARIANT = 1 << 2
	PangoFontMask.WEIGHT = 1 << 3
	PangoFontMask.STRETCH = 1 << 4
	PangoFontMask.SIZE = 1 << 5
	PangoFontMask.GRAVITY = 1 << 6

	// Init PangoTypes
	PangoTypes.CONTEXT = gobject.GType(C.pango_context_get_type())
	PangoTypes.FONT = gobject.GType(C.pango_font_get_type())
	PangoTypes.FONT_FAMILY = gobject.GType(C.pango_font_family_get_type())
	PangoTypes.FONT_FACE = gobject.GType(C.pango_font_face_get_type())
	PangoTypes.FONT_MAP = gobject.GType(C.pango_font_map_get_type())
	PangoTypes.FONTSET = gobject.GType(C.pango_fontset_get_type())
	PangoTypes.FONT_DESCRIPTION = gobject.GType(C.pango_font_description_get_type())
	PangoTypes.LAYOUT = gobject.GType(C.pango_layout_get_type())

	// Register PangoContext type
	gobject.RegisterCType(PangoTypes.CONTEXT, newContextFromNative)
	gobject.RegisterGoType(PangoTypes.CONTEXT, nativeFromContext)

	// Register Font type
	gobject.RegisterCType(PangoTypes.FONT, newFontFromNative)
	gobject.RegisterGoType(PangoTypes.FONT, nativeFromFont)

	// Register FontFamily type
	gobject.RegisterCType(PangoTypes.FONT_FAMILY, newFontFamilyFromNative)
	gobject.RegisterGoType(PangoTypes.FONT_FAMILY, nativeFromFontFamily)

	// Register FontFace type
	gobject.RegisterCType(PangoTypes.FONT_FACE, newFontFaceFromNative)
	gobject.RegisterGoType(PangoTypes.FONT_FACE, nativeFromFontFace)

	// Register FontMap type
	gobject.RegisterCType(PangoTypes.FONT_MAP, newFontMapFromNative)
	gobject.RegisterGoType(PangoTypes.FONT_MAP, nativeFromFontMap)

	// Register Fontset type
	gobject.RegisterCType(PangoTypes.FONTSET, newFontsetFromNative)
	gobject.RegisterGoType(PangoTypes.FONTSET, nativeFromFontset)

	// Register FontDescription type
	gobject.RegisterCType(PangoTypes.FONT_DESCRIPTION, newFontDescriptionFromNative)
	gobject.RegisterGoType(PangoTypes.FONT_DESCRIPTION, nativeFromFontDescription)

	// Register Layout type
	gobject.RegisterCType(PangoTypes.LAYOUT, newLayoutFromNative)
	gobject.RegisterGoType(PangoTypes.LAYOUT, nativeFromLayout)

} // }}}
Пример #2
0
// GDK3 INIT FUNCS {{{
func init() {
	C.gdk_init(nil, nil)
	GdkType.DEVICE = gobject.GType(C.gdk_device_get_type())
	GdkType.RECTANGLE = gobject.GType(C.gdk_rectangle_get_type())
	GdkType.RGBA = gobject.GType(C.gdk_rgba_get_type())
	GdkType.COLOR = gobject.GType(C.gdk_color_get_type())
	GdkType.EVENT = gobject.GType(C.gdk_event_get_type())
	GdkType.DISPLAY = gobject.GType(C.gdk_display_get_type())
	GdkType.SCREEN = gobject.GType(C.gdk_screen_get_type())
	GdkType.WINDOW = gobject.GType(C.gdk_window_get_type())
	GdkType.MODIFIER_TYPE = gobject.GType(C.gdk_modifier_type_get_type())

	// Register Rectangle
	gobject.RegisterCType(GdkType.RECTANGLE, newRectangleFromNative)
	gobject.RegisterGoType(GdkType.RECTANGLE, nativeFromRectangle)

	// Register RGBA type
	gobject.RegisterCType(GdkType.RGBA, newRGBAFromNative)
	gobject.RegisterGoType(GdkType.RGBA, nativeFromRGBA)

	// Register GdkModifier
	gobject.RegisterCType(GdkType.MODIFIER_TYPE, gdkModifierFromNative)

	// Initialize GdkModifier
	GdkModifier.SHIFT_MASK = 1 << 0
	GdkModifier.LOCK_MASK = 1 << 1
	GdkModifier.CONTROL_MASK = 1 << 2
	GdkModifier.MOD1_MASK = 1 << 3
	GdkModifier.MOD2_MASK = 1 << 4
	GdkModifier.MOD3_MASK = 1 << 5
	GdkModifier.MOD4_MASK = 1 << 6
	GdkModifier.MOD5_MASK = 1 << 7
	GdkModifier.BUTTON1_MASK = 1 << 8
	GdkModifier.BUTTON2_MASK = 1 << 9
	GdkModifier.BUTTON3_MASK = 1 << 10
	GdkModifier.BUTTON4_MASK = 1 << 11
	GdkModifier.BUTTON5_MASK = 1 << 12
	GdkModifier.SUPER_MASK = 1 << 26
	GdkModifier.HYPER_MASK = 1 << 27
	GdkModifier.META_MASK = 1 << 28
	GdkModifier.RELEASE_MASK = 1 << 30
	GdkModifier.MODIFIER_MASK = 0x5c001fff

	//Register GdkEvent to gobject (In Go)
	gobject.RegisterCType(GdkType.EVENT, newEventFromNative)
	init_events()
	init_mask()


	// Register GdkDisplay type
	gobject.RegisterCType(GdkType.DISPLAY, newDisplayFromNative)
	gobject.RegisterGoType(GdkType.DISPLAY, nativeFromDisplay)

	// Register GdkDevice type
	gobject.RegisterCType(GdkType.DEVICE, newDeviceFromNative)
	gobject.RegisterGoType(GdkType.DEVICE, nativeFromDevice)

	// Register GdkScreen type
	gobject.RegisterCType(GdkType.SCREEN, newScreenFromNative)
	gobject.RegisterGoType(GdkType.SCREEN, nativeFromScreen)

	//Register GdkWindow type
	gobject.RegisterCType(GdkType.WINDOW, newWindowFromNative)
	gobject.RegisterGoType(GdkType.WINDOW, nativeFromWindow)
}