diff options
Diffstat (limited to 'vendor')
294 files changed, 0 insertions, 55483 deletions
diff --git a/vendor/0xacab.org/leap/go-dialog/LICENSE b/vendor/0xacab.org/leap/go-dialog/LICENSE deleted file mode 100644 index 75bff9f..0000000 --- a/vendor/0xacab.org/leap/go-dialog/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -ISC License - -Copyright (c) 2018, the dialog authors. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
\ No newline at end of file diff --git a/vendor/0xacab.org/leap/go-dialog/README.md b/vendor/0xacab.org/leap/go-dialog/README.md deleted file mode 100644 index afedf80..0000000 --- a/vendor/0xacab.org/leap/go-dialog/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# dialog -Simple cross-platform dialog API for go-lang - -# examples - ok := dialog.Message("%s", "Do you want to continue?").Title("Are you sure?").YesNo() - -Creates a dialog box titled "Are you sure?", containing the message "Do you want to continue?", -a "Yes" button and a "No" button. Returns true iff the dialog could be displayed and the user -pressed the "Yes" button. - - filename, err := dialog.File().Filter("Mp3 audio file", "mp3").Load() - -Creates a file selection dialog allowing the user to select a .mp3 file. The absolute path of -the file is returned, unless an error is encountered or the user cancels/closes the dialog. -In the latter case, `filename` will be the empty string and `err` will equal `dialog.Cancelled`. - - filename, err := dialog.File().Filter("XML files", "xml").Title("Export to XML").Save() - -Asks the user for a filename to write data into. If the user selects a file which already exists, -an additional dialog is spawned to confirm they want to overwrite the existing file. - - directory, err := dialog.Directory().Title("Load images").Browse() - -Asks the user for a directory. - -# platform details -* OSX: uses Cocoa's NSAlert/NSSavePanel/NSOpenPanel clasess -* Win32: uses MessageBox/GetOpenFileName/GetSaveFileName (via package github.com/AllenDang/w32) -* Linux: uses Gtk's MessageDialog/FileChooserDialog (via package github.com/mattn/gtk) diff --git a/vendor/0xacab.org/leap/go-dialog/dlgs.go b/vendor/0xacab.org/leap/go-dialog/dlgs.go deleted file mode 100644 index 602d4e3..0000000 --- a/vendor/0xacab.org/leap/go-dialog/dlgs.go +++ /dev/null @@ -1,145 +0,0 @@ -/* Package dialog provides a simple cross-platform common dialog API. -Eg. to prompt the user with a yes/no dialog: - - if dialog.MsgDlg("%s", "Do you want to continue?").YesNo() { - // user pressed Yes - } - -The general usage pattern is to call one of the toplevel *Dlg functions -which return a *Builder structure. From here you can optionally call -configuration functions (eg. Title) to customise the dialog, before -using a launcher function to run the dialog. -*/ -package dialog - -import ( - "errors" - "fmt" -) - -/* Cancelled is an error returned when a user cancels/closes a dialog. */ -var Cancelled = errors.New("Cancelled") - -type Dlg struct { - Title string -} - -type MsgBuilder struct { - Dlg - Msg string - IconPath string -} - -/* Message initialises a MsgBuilder with the provided message */ -func Message(format string, args ...interface{}) *MsgBuilder { - return &MsgBuilder{Msg: fmt.Sprintf(format, args...)} -} - -/* Title specifies what the title of the message dialog will be */ -func (b *MsgBuilder) Title(title string) *MsgBuilder { - b.Dlg.Title = title - return b -} - -func (b *MsgBuilder) Icon(filename string) *MsgBuilder { - b.IconPath = filename - return b -} - -/* YesNo spawns the message dialog with two buttons, "Yes" and "No". -Returns true iff the user selected "Yes". */ -func (b *MsgBuilder) YesNo() bool { - return b.yesNo() -} - -/* Info spawns the message dialog with an information icon and single button, "Ok". */ -func (b *MsgBuilder) Info() { - b.info() -} - -/* Error spawns the message dialog with an error icon and single button, "Ok". */ -func (b *MsgBuilder) Error() { - b.error() -} - -/* FileFilter represents a category of files (eg. audio files, spreadsheets). */ -type FileFilter struct { - Desc string - Extensions []string -} - -type FileBuilder struct { - Dlg - StartDir string - Filters []FileFilter -} - -/* File initialises a FileBuilder using the default configuration. */ -func File() *FileBuilder { - return &FileBuilder{} -} - -/* Title specifies the title to be used for the dialog. */ -func (b *FileBuilder) Title(title string) *FileBuilder { - b.Dlg.Title = title - return b -} - -/* Filter adds a category of files to the types allowed by the dialog. Multiple -calls to Filter are cumulative - any of the provided categories will be allowed. -By default all files can be selected. - -The special extension '*' allows all files to be selected when the Filter is active. */ -func (b *FileBuilder) Filter(desc string, extensions ...string) *FileBuilder { - filt := FileFilter{desc, extensions} - if len(filt.Extensions) == 0 { - filt.Extensions = append(filt.Extensions, "*") - } - b.Filters = append(b.Filters, filt) - return b -} - -/* SetStartDir specifies the initial directory of the dialog. */ -func (b *FileBuilder) SetStartDir(startDir string) *FileBuilder { - b.StartDir = startDir - return b -} - -/* Load spawns the file selection dialog using the configured settings, -asking the user to select a single file. Returns Cancelled as the error -if the user cancels or closes the dialog. */ -func (b *FileBuilder) Load() (string, error) { - return b.load() -} - -/* Save spawns the file selection dialog using the configured settings, -asking the user for a filename to save as. If the chosen file exists, the -user is prompted whether they want to overwrite the file. Returns -Cancelled as the error if the user cancels/closes the dialog, or selects -not to overwrite the file. */ -func (b *FileBuilder) Save() (string, error) { - return b.save() -} - -type DirectoryBuilder struct { - Dlg - StartDir string -} - -/* Directory initialises a DirectoryBuilder using the default configuration. */ -func Directory() *DirectoryBuilder { - return &DirectoryBuilder{} -} - -/* Browse spawns the directory selection dialog using the configured settings, -asking the user to select a single folder. Returns Cancelled as the error -if the user cancels or closes the dialog. */ -func (b *DirectoryBuilder) Browse() (string, error) { - return b.browse() -} - -/* Title specifies the title to be used for the dialog. */ -func (b *DirectoryBuilder) Title(title string) *DirectoryBuilder { - b.Dlg.Title = title - return b -} diff --git a/vendor/0xacab.org/leap/go-dialog/dlgs_darwin.go b/vendor/0xacab.org/leap/go-dialog/dlgs_darwin.go deleted file mode 100644 index ae28560..0000000 --- a/vendor/0xacab.org/leap/go-dialog/dlgs_darwin.go +++ /dev/null @@ -1,58 +0,0 @@ -package dialog - -import ( - "github.com/sqweek/dialog/cocoa" -) - -func (b *MsgBuilder) yesNo() bool { - return cocoa.YesNoDlg(b.Msg, b.Dlg.Title) -} - -func (b *MsgBuilder) info() { - cocoa.InfoDlg(b.Msg, b.Dlg.Title) -} - -func (b *MsgBuilder) error() { - cocoa.ErrorDlg(b.Msg, b.Dlg.Title) -} - -func (b *FileBuilder) load() (string, error) { - return b.run(false) -} - -func (b *FileBuilder) save() (string, error) { - return b.run(true) -} - -func (b *FileBuilder) run(save bool) (string, error) { - star := false - var exts []string - for _, filt := range b.Filters { - for _, ext := range filt.Extensions { - if ext == "*" { - star = true - } else { - exts = append(exts, ext) - } - } - } - if star && save { - /* OSX doesn't allow the user to switch visible file types/extensions. Also - ** NSSavePanel's allowsOtherFileTypes property has no effect for an open - ** dialog, so if "*" is a possible extension we must always show all files. */ - exts = nil - } - f, err := cocoa.FileDlg(save, b.Dlg.Title, exts, star) - if f == "" && err == nil { - return "", Cancelled - } - return f, err -} - -func (b *DirectoryBuilder) browse() (string, error) { - f, err := cocoa.DirDlg(b.Dlg.Title); - if f == "" && err == nil { - return "", Cancelled - } - return f, err -} diff --git a/vendor/0xacab.org/leap/go-dialog/dlgs_linux.go b/vendor/0xacab.org/leap/go-dialog/dlgs_linux.go deleted file mode 100644 index ea8ac3d..0000000 --- a/vendor/0xacab.org/leap/go-dialog/dlgs_linux.go +++ /dev/null @@ -1,122 +0,0 @@ -package dialog - -import ( - "os" - "path/filepath" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" - "github.com/gotk3/gotk3/gtk" -) - -func closeDialog(dlg *gtk.Dialog) { - dlg.Destroy() -} - -func (b *MsgBuilder) yesNo() bool { - ch := make(chan bool) - _, err := glib.IdleAdd(b._yesNo, ch) - if err != nil { - return false - } - return <-ch -} - -func (b *MsgBuilder) _yesNo(ch chan bool) bool { - dlg := gtk.MessageDialogNew(nil, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, "%s", b.Msg) - dlg.SetTitle(firstOf(b.Dlg.Title, "Confirm?")) - b.setIcon(dlg) - defer closeDialog(&dlg.Dialog) - ch <- dlg.Run() == gtk.RESPONSE_YES - return false -} - -func (b *MsgBuilder) info() { - ch := make(chan bool) - glib.IdleAdd(b._info, ch) - <-ch -} - -func (b *MsgBuilder) _info(ch chan bool) { - dlg := gtk.MessageDialogNew(nil, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, "%s", b.Msg) - dlg.SetTitle(firstOf(b.Dlg.Title, "Information")) - b.setIcon(dlg) - defer closeDialog(&dlg.Dialog) - dlg.Run() - ch <- true -} - -func (b *MsgBuilder) error() { - ch := make(chan bool) - glib.IdleAdd(b._info, ch) - <-ch -} - -func (b *MsgBuilder) _error() { - dlg := gtk.MessageDialogNew(nil, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, "%s", b.Msg) - dlg.SetTitle(firstOf(b.Dlg.Title, "Error")) - b.setIcon(dlg) - defer closeDialog(&dlg.Dialog) - dlg.Run() -} - -func (b *MsgBuilder) setIcon(dlg *gtk.MessageDialog) { - if b.IconPath == "" { - return - } - - pixbuf, err := gdk.PixbufNewFromFile(b.IconPath) - if err != nil { - return - } - dlg.SetIcon(pixbuf) -} - -func (b *FileBuilder) load() (string, error) { - return chooseFile("Load", gtk.FILE_CHOOSER_ACTION_OPEN, b) -} - -func (b *FileBuilder) save() (string, error) { - f, err := chooseFile("Save", gtk.FILE_CHOOSER_ACTION_SAVE, b) - if err != nil { - return "", err - } - _, err = os.Stat(f) - if !os.IsNotExist(err) && !Message("%s already exists, overwrite?", filepath.Base(f)).yesNo() { - return "", Cancelled - } - return f, nil -} - -func chooseFile(title string, action gtk.FileChooserAction, b *FileBuilder) (string, error) { - dlg, err := gtk.FileChooserDialogNewWith2Buttons(firstOf(b.Dlg.Title, title), nil, action, "Ok", gtk.RESPONSE_ACCEPT, "Cancel", gtk.RESPONSE_CANCEL) - if err != nil { - return "", err - } - - for _, filt := range b.Filters { - filter, err := gtk.FileFilterNew() - if err != nil { - return "", err - } - - filter.SetName(filt.Desc) - for _, ext := range filt.Extensions { - filter.AddPattern("*." + ext) - } - dlg.AddFilter(filter) - } - if b.StartDir != "" { - dlg.SetCurrentFolder(b.StartDir) - } - r := dlg.Run() - defer closeDialog(&dlg.Dialog) - if r == gtk.RESPONSE_ACCEPT { - return dlg.GetFilename(), nil - } - return "", Cancelled -} - -func (b *DirectoryBuilder) browse() (string, error) { - return chooseFile("Open Directory", gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, &FileBuilder{Dlg: b.Dlg}) -} diff --git a/vendor/0xacab.org/leap/go-dialog/dlgs_windows.go b/vendor/0xacab.org/leap/go-dialog/dlgs_windows.go deleted file mode 100644 index aca8e2c..0000000 --- a/vendor/0xacab.org/leap/go-dialog/dlgs_windows.go +++ /dev/null @@ -1,141 +0,0 @@ -package dialog - -import ( - "fmt" - "reflect" - "syscall" - "unicode/utf16" - "unsafe" - - "github.com/AllenDang/w32" -) - -type WinDlgError int - -func (e WinDlgError) Error() string { - return fmt.Sprintf("CommDlgExtendedError: %#x", e) -} - -func err() error { - e := w32.CommDlgExtendedError() - if e == 0 { - return Cancelled - } - return WinDlgError(e) -} - -func (b *MsgBuilder) yesNo() bool { - r := w32.MessageBox(w32.HWND(0), b.Msg, firstOf(b.Dlg.Title, "Confirm?"), w32.MB_YESNO) - return r == w32.IDYES -} - -func (b *MsgBuilder) info() { - w32.MessageBox(w32.HWND(0), b.Msg, firstOf(b.Dlg.Title, "Information"), w32.MB_OK|w32.MB_ICONINFORMATION) -} - -func (b *MsgBuilder) error() { - w32.MessageBox(w32.HWND(0), b.Msg, firstOf(b.Dlg.Title, "Error"), w32.MB_OK|w32.MB_ICONERROR) -} - -type filedlg struct { - buf []uint16 - filters []uint16 - opf *w32.OPENFILENAME -} - -func (d filedlg) Filename() string { - i := 0 - for i < len(d.buf) && d.buf[i] != 0 { - i++ - } - return string(utf16.Decode(d.buf[:i])) -} - -func (b *FileBuilder) load() (string, error) { - d := openfile(w32.OFN_FILEMUSTEXIST, b) - if w32.GetOpenFileName(d.opf) { - return d.Filename(), nil - } - return "", err() -} - -func (b *FileBuilder) save() (string, error) { - d := openfile(w32.OFN_OVERWRITEPROMPT, b) - if w32.GetSaveFileName(d.opf) { - return d.Filename(), nil - } - return "", err() -} - -/* syscall.UTF16PtrFromString not sufficient because we need to encode embedded NUL bytes */ -func utf16ptr(utf16 []uint16) *uint16 { - if utf16[len(utf16)-1] != 0 { - panic("refusing to make ptr to non-NUL terminated utf16 slice") - } - h := (*reflect.SliceHeader)(unsafe.Pointer(&utf16)) - return (*uint16)(unsafe.Pointer(h.Data)) -} - -func utf16slice(ptr *uint16) []uint16 { - hdr := reflect.SliceHeader{Data: uintptr(unsafe.Pointer(ptr)), Len: 1, Cap: 1} - slice := *((*[]uint16)(unsafe.Pointer(&hdr))) - i := 0 - for slice[len(slice)-1] != 0 { - i++ - } - hdr.Len = i - slice = *((*[]uint16)(unsafe.Pointer(&hdr))) - return slice -} - -func openfile(flags uint32, b *FileBuilder) (d filedlg) { - d.buf = make([]uint16, w32.MAX_PATH) - d.opf = &w32.OPENFILENAME{ - File: utf16ptr(d.buf), - MaxFile: uint32(len(d.buf)), - Flags: flags, - } - d.opf.StructSize = uint32(unsafe.Sizeof(*d.opf)) - if b.StartDir != "" { - d.opf.InitialDir, _ = syscall.UTF16PtrFromString(b.StartDir) - } - if b.Dlg.Title != "" { - d.opf.Title, _ = syscall.UTF16PtrFromString(b.Dlg.Title) - } - for _, filt := range b.Filters { - /* build utf16 string of form "Music File\0*.mp3;*.ogg;*.wav;\0" */ - d.filters = append(d.filters, utf16.Encode([]rune(filt.Desc))...) - d.filters = append(d.filters, 0) - for _, ext := range filt.Extensions { - s := fmt.Sprintf("*.%s;", ext) - d.filters = append(d.filters, utf16.Encode([]rune(s))...) - } - d.filters = append(d.filters, 0) - } - if d.filters != nil { - d.filters = append(d.filters, 0, 0) // two extra NUL chars to terminate the list - d.opf.Filter = utf16ptr(d.filters) - } - return d -} - -type dirdlg struct { - bi *w32.BROWSEINFO -} - -func selectdir(b *DirectoryBuilder) (d dirdlg) { - d.bi = &w32.BROWSEINFO{Flags: w32.BIF_RETURNONLYFSDIRS} - if b.Dlg.Title != "" { - d.bi.Title, _ = syscall.UTF16PtrFromString(b.Dlg.Title) - } - return d -} - -func (b *DirectoryBuilder) browse() (string, error) { - d := selectdir(b) - res := w32.SHBrowseForFolder(d.bi) - if res == 0 { - return "", Cancelled - } - return w32.SHGetPathFromIDList(res), nil -} diff --git a/vendor/0xacab.org/leap/go-dialog/util.go b/vendor/0xacab.org/leap/go-dialog/util.go deleted file mode 100644 index 28126ee..0000000 --- a/vendor/0xacab.org/leap/go-dialog/util.go +++ /dev/null @@ -1,10 +0,0 @@ -package dialog - -func firstOf(args ...string) string { - for _, arg := range args { - if arg != "" { - return arg - } - } - return "" -} diff --git a/vendor/README b/vendor/README deleted file mode 100644 index 093a7b4..0000000 --- a/vendor/README +++ /dev/null @@ -1,9 +0,0 @@ -2019-01-12 ------------------ -govendor add +external - -2018-11-14 ------------------ -* vendor getlantern/systray with PR #74, to work around menu positioning bug in windows. -* vendor PR #76 too (add separator to visibleitems) -* manually add a patch for the 18x18 icon size for mac diff --git a/vendor/github.com/AllenDang/w32/AUTHORS b/vendor/github.com/AllenDang/w32/AUTHORS deleted file mode 100644 index 93ec5db..0000000 --- a/vendor/github.com/AllenDang/w32/AUTHORS +++ /dev/null @@ -1,19 +0,0 @@ -# This is the official list of 'w32' authors for copyright purposes. - -# Names should be added to this file as -# Name or Organization <email address> -# The email address is not required for organizations. - -# Please keep the list sorted. - -# Contributors -# ============ - -Allen Dang <allengnr@gmail.com> -Benny Siegert <bsiegert@gmail.com> -Bruno Bigras <bigras.bruno@gmail.com> -Daniel Joos -Gerald Rosenberg <gerald.rosenberg@gmail.com> -Liam Bowen <liambowen@gmail.com> -Michael Henke -Paul Maddox <paul.maddox@gmail.com>
\ No newline at end of file diff --git a/vendor/github.com/AllenDang/w32/LICENSE b/vendor/github.com/AllenDang/w32/LICENSE deleted file mode 100644 index 9f36608..0000000 --- a/vendor/github.com/AllenDang/w32/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright (c) 2010-2012 The w32 Authors. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The names of the authors may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/AllenDang/w32/README.md b/vendor/github.com/AllenDang/w32/README.md deleted file mode 100644 index ed196e7..0000000 --- a/vendor/github.com/AllenDang/w32/README.md +++ /dev/null @@ -1,33 +0,0 @@ -About w32 -========== - -w32 is a wrapper of windows apis for the Go Programming Language. - -It wraps win32 apis to "Go style" to make them easier to use. - -Setup -===== - -1. Make sure you have a working Go installation and build environment, - see this go-nuts post for details: - http://groups.google.com/group/golang-nuts/msg/5c87630a84f4fd0c - - Updated versions of the Windows Go build are available here: - http://code.google.com/p/gomingw/downloads/list - -2. Create a "gopath" directory if you do not have one yet and set the - GOPATH variable accordingly. For example: - mkdir -p go-externals/src - export GOPATH=${PWD}/go-externals - -3. go get github.com/AllenDang/w32 - -4. go install github.com/AllenDang/w32... - -Contribute -========== - -Contributions in form of design, code, documentation, bug reporting or other -ways you see fit are very welcome. - -Thank You! diff --git a/vendor/github.com/AllenDang/w32/advapi32.go b/vendor/github.com/AllenDang/w32/advapi32.go deleted file mode 100644 index 10e1416..0000000 --- a/vendor/github.com/AllenDang/w32/advapi32.go +++ /dev/null @@ -1,389 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "errors" - "fmt" - "syscall" - "unsafe" -) - -var ( - modadvapi32 = syscall.NewLazyDLL("advapi32.dll") - - // procRegSetKeyValue = modadvapi32.NewProc("RegSetKeyValueW") - procCloseEventLog = modadvapi32.NewProc("CloseEventLog") - procCloseServiceHandle = modadvapi32.NewProc("CloseServiceHandle") - procControlService = modadvapi32.NewProc("ControlService") - procControlTrace = modadvapi32.NewProc("ControlTraceW") - procInitializeSecurityDescriptor = modadvapi32.NewProc("InitializeSecurityDescriptor") - procOpenEventLog = modadvapi32.NewProc("OpenEventLogW") - procOpenSCManager = modadvapi32.NewProc("OpenSCManagerW") - procOpenService = modadvapi32.NewProc("OpenServiceW") - procReadEventLog = modadvapi32.NewProc("ReadEventLogW") - procRegCloseKey = modadvapi32.NewProc("RegCloseKey") - procRegCreateKeyEx = modadvapi32.NewProc("RegCreateKeyExW") - procRegEnumKeyEx = modadvapi32.NewProc("RegEnumKeyExW") - procRegGetValue = modadvapi32.NewProc("RegGetValueW") - procRegOpenKeyEx = modadvapi32.NewProc("RegOpenKeyExW") - procRegSetValueEx = modadvapi32.NewProc("RegSetValueExW") - procSetSecurityDescriptorDacl = modadvapi32.NewProc("SetSecurityDescriptorDacl") - procStartService = modadvapi32.NewProc("StartServiceW") - procStartTrace = modadvapi32.NewProc("StartTraceW") -) - -var ( - SystemTraceControlGuid = GUID{ - 0x9e814aad, - 0x3204, - 0x11d2, - [8]byte{0x9a, 0x82, 0x00, 0x60, 0x08, 0xa8, 0x69, 0x39}, - } -) - -func RegCreateKey(hKey HKEY, subKey string) HKEY { - var result HKEY - ret, _, _ := procRegCreateKeyEx.Call( - uintptr(hKey), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(subKey))), - uintptr(0), - uintptr(0), - uintptr(0), - uintptr(KEY_ALL_ACCESS), - uintptr(0), - uintptr(unsafe.Pointer(&result)), - uintptr(0)) - _ = ret - return result -} - -func RegOpenKeyEx(hKey HKEY, subKey string, samDesired uint32) HKEY { - var result HKEY - ret, _, _ := procRegOpenKeyEx.Call( - uintptr(hKey), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(subKey))), - uintptr(0), - uintptr(samDesired), - uintptr(unsafe.Pointer(&result))) - - if ret != ERROR_SUCCESS { - panic(fmt.Sprintf("RegOpenKeyEx(%d, %s, %d) failed", hKey, subKey, samDesired)) - } - return result -} - -func RegCloseKey(hKey HKEY) error { - var err error - ret, _, _ := procRegCloseKey.Call( - uintptr(hKey)) - - if ret != ERROR_SUCCESS { - err = errors.New("RegCloseKey failed") - } - return err -} - -func RegGetRaw(hKey HKEY, subKey string, value string) []byte { - var bufLen uint32 - var valptr unsafe.Pointer - if len(value) > 0 { - valptr = unsafe.Pointer(syscall.StringToUTF16Ptr(value)) - } - procRegGetValue.Call( - uintptr(hKey), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(subKey))), - uintptr(valptr), - uintptr(RRF_RT_ANY), - 0, - 0, - uintptr(unsafe.Pointer(&bufLen))) - - if bufLen == 0 { - return nil - } - - buf := make([]byte, bufLen) - ret, _, _ := procRegGetValue.Call( - uintptr(hKey), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(subKey))), - uintptr(valptr), - uintptr(RRF_RT_ANY), - 0, - uintptr(unsafe.Pointer(&buf[0])), - uintptr(unsafe.Pointer(&bufLen))) - - if ret != ERROR_SUCCESS { - return nil - } - - return buf -} - -func RegSetBinary(hKey HKEY, subKey string, value []byte) (errno int) { - var lptr, vptr unsafe.Pointer - if len(subKey) > 0 { - lptr = unsafe.Pointer(syscall.StringToUTF16Ptr(subKey)) - } - if len(value) > 0 { - vptr = unsafe.Pointer(&value[0]) - } - ret, _, _ := procRegSetValueEx.Call( - uintptr(hKey), - uintptr(lptr), - uintptr(0), - uintptr(REG_BINARY), - uintptr(vptr), - uintptr(len(value))) - - return int(ret) -} - -func RegGetString(hKey HKEY, subKey string, value string) string { - var bufLen uint32 - procRegGetValue.Call( - uintptr(hKey), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(subKey))), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(value))), - uintptr(RRF_RT_REG_SZ), - 0, - 0, - uintptr(unsafe.Pointer(&bufLen))) - - if bufLen == 0 { - return "" - } - - buf := make([]uint16, bufLen) - ret, _, _ := procRegGetValue.Call( - uintptr(hKey), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(subKey))), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(value))), - uintptr(RRF_RT_REG_SZ), - 0, - uintptr(unsafe.Pointer(&buf[0])), - uintptr(unsafe.Pointer(&bufLen))) - - if ret != ERROR_SUCCESS { - return "" - } - - return syscall.UTF16ToString(buf) -} - -/* -func RegSetKeyValue(hKey HKEY, subKey string, valueName string, dwType uint32, data uintptr, cbData uint16) (errno int) { - ret, _, _ := procRegSetKeyValue.Call( - uintptr(hKey), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(subKey))), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(valueName))), - uintptr(dwType), - data, - uintptr(cbData)) - - return int(ret) -} -*/ - -func RegEnumKeyEx(hKey HKEY, index uint32) string { - var bufLen uint32 = 255 - buf := make([]uint16, bufLen) - procRegEnumKeyEx.Call( - uintptr(hKey), - uintptr(index), - uintptr(unsafe.Pointer(&buf[0])), - uintptr(unsafe.Pointer(&bufLen)), - 0, - 0, - 0, - 0) - return syscall.UTF16ToString(buf) -} - -func OpenEventLog(servername string, sourcename string) HANDLE { - ret, _, _ := procOpenEventLog.Call( - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(servername))), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(sourcename)))) - - return HANDLE(ret) -} - -func ReadEventLog(eventlog HANDLE, readflags, recordoffset uint32, buffer []byte, numberofbytestoread uint32, bytesread, minnumberofbytesneeded *uint32) bool { - ret, _, _ := procReadEventLog.Call( - uintptr(eventlog), - uintptr(readflags), - uintptr(recordoffset), - uintptr(unsafe.Pointer(&buffer[0])), - uintptr(numberofbytestoread), - uintptr(unsafe.Pointer(bytesread)), - uintptr(unsafe.Pointer(minnumberofbytesneeded))) - - return ret != 0 -} - -func CloseEventLog(eventlog HANDLE) bool { - ret, _, _ := procCloseEventLog.Call( - uintptr(eventlog)) - - return ret != 0 -} - -func OpenSCManager(lpMachineName, lpDatabaseName string, dwDesiredAccess uint32) (HANDLE, error) { - var p1, p2 uintptr - if len(lpMachineName) > 0 { - p1 = uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpMachineName))) - } - if len(lpDatabaseName) > 0 { - p2 = uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpDatabaseName))) - } - ret, _, _ := procOpenSCManager.Call( - p1, - p2, - uintptr(dwDesiredAccess)) - - if ret == 0 { - return 0, syscall.GetLastError() - } - - return HANDLE(ret), nil -} - -func CloseServiceHandle(hSCObject HANDLE) error { - ret, _, _ := procCloseServiceHandle.Call(uintptr(hSCObject)) - if ret == 0 { - return syscall.GetLastError() - } - return nil -} - -func OpenService(hSCManager HANDLE, lpServiceName string, dwDesiredAccess uint32) (HANDLE, error) { - ret, _, _ := procOpenService.Call( - uintptr(hSCManager), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpServiceName))), - uintptr(dwDesiredAccess)) - - if ret == 0 { - return 0, syscall.GetLastError() - } - - return HANDLE(ret), nil -} - -func StartService(hService HANDLE, lpServiceArgVectors []string) error { - l := len(lpServiceArgVectors) - var ret uintptr - if l == 0 { - ret, _, _ = procStartService.Call( - uintptr(hService), - 0, - 0) - } else { - lpArgs := make([]uintptr, l) - for i := 0; i < l; i++ { - lpArgs[i] = uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpServiceArgVectors[i]))) - } - - ret, _, _ = procStartService.Call( - uintptr(hService), - uintptr(l), - uintptr(unsafe.Pointer(&lpArgs[0]))) - } - - if ret == 0 { - return syscall.GetLastError() - } - - return nil -} - -func ControlService(hService HANDLE, dwControl uint32, lpServiceStatus *SERVICE_STATUS) bool { - if lpServiceStatus == nil { - panic("ControlService:lpServiceStatus cannot be nil") - } - - ret, _, _ := procControlService.Call( - uintptr(hService), - uintptr(dwControl), - uintptr(unsafe.Pointer(lpServiceStatus))) - - return ret != 0 -} - -func ControlTrace(hTrace TRACEHANDLE, lpSessionName string, props *EVENT_TRACE_PROPERTIES, dwControl uint32) (success bool, e error) { - - ret, _, _ := procControlTrace.Call( - uintptr(unsafe.Pointer(hTrace)), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpSessionName))), - uintptr(unsafe.Pointer(props)), - uintptr(dwControl)) - - if ret == ERROR_SUCCESS { - return true, nil - } - e = errors.New(fmt.Sprintf("error: 0x%x", ret)) - return -} - -func StartTrace(lpSessionName string, props *EVENT_TRACE_PROPERTIES) (hTrace TRACEHANDLE, e error) { - - ret, _, _ := procStartTrace.Call( - uintptr(unsafe.Pointer(&hTrace)), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpSessionName))), - uintptr(unsafe.Pointer(props))) - - if ret == ERROR_SUCCESS { - return - } - e = errors.New(fmt.Sprintf("error: 0x%x", ret)) - return -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa378863(v=vs.85).aspx -func InitializeSecurityDescriptor(rev uint16) (pSecurityDescriptor *SECURITY_DESCRIPTOR, e error) { - - pSecurityDescriptor = &SECURITY_DESCRIPTOR{} - - ret, _, _ := procInitializeSecurityDescriptor.Call( - uintptr(unsafe.Pointer(pSecurityDescriptor)), - uintptr(rev), - ) - - if ret != 0 { - return - } - e = syscall.GetLastError() - return -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa379583(v=vs.85).aspx -func SetSecurityDescriptorDacl(pSecurityDescriptor *SECURITY_DESCRIPTOR, pDacl *ACL) (e error) { - - if pSecurityDescriptor == nil { - return errors.New("null descriptor") - } - - var ret uintptr - if pDacl == nil { - ret, _, _ = procSetSecurityDescriptorDacl.Call( - uintptr(unsafe.Pointer(pSecurityDescriptor)), - uintptr(1), // DaclPresent - uintptr(0), // pDacl - uintptr(0), // DaclDefaulted - ) - } else { - ret, _, _ = procSetSecurityDescriptorDacl.Call( - uintptr(unsafe.Pointer(pSecurityDescriptor)), - uintptr(1), // DaclPresent - uintptr(unsafe.Pointer(pDacl)), - uintptr(0), //DaclDefaulted - ) - } - - if ret != 0 { - return - } - e = syscall.GetLastError() - return -} diff --git a/vendor/github.com/AllenDang/w32/advapi32_constants.go b/vendor/github.com/AllenDang/w32/advapi32_constants.go deleted file mode 100644 index fa3c767..0000000 --- a/vendor/github.com/AllenDang/w32/advapi32_constants.go +++ /dev/null @@ -1,300 +0,0 @@ -package w32 - -// Registry predefined keys -const ( - HKEY_CLASSES_ROOT HKEY = 0x80000000 - HKEY_CURRENT_USER HKEY = 0x80000001 - HKEY_LOCAL_MACHINE HKEY = 0x80000002 - HKEY_USERS HKEY = 0x80000003 - HKEY_PERFORMANCE_DATA HKEY = 0x80000004 - HKEY_CURRENT_CONFIG HKEY = 0x80000005 - HKEY_DYN_DATA HKEY = 0x80000006 -) - -// Registry Key Security and Access Rights -const ( - KEY_ALL_ACCESS = 0xF003F - KEY_CREATE_SUB_KEY = 0x0004 - KEY_ENUMERATE_SUB_KEYS = 0x0008 - KEY_NOTIFY = 0x0010 - KEY_QUERY_VALUE = 0x0001 - KEY_SET_VALUE = 0x0002 - KEY_READ = 0x20019 - KEY_WRITE = 0x20006 -) - -const ( - NFR_ANSI = 1 - NFR_UNICODE = 2 - NF_QUERY = 3 - NF_REQUERY = 4 -) - -// Registry value types -const ( - RRF_RT_REG_NONE = 0x00000001 - RRF_RT_REG_SZ = 0x00000002 - RRF_RT_REG_EXPAND_SZ = 0x00000004 - RRF_RT_REG_BINARY = 0x00000008 - RRF_RT_REG_DWORD = 0x00000010 - RRF_RT_REG_MULTI_SZ = 0x00000020 - RRF_RT_REG_QWORD = 0x00000040 - RRF_RT_DWORD = (RRF_RT_REG_BINARY | RRF_RT_REG_DWORD) - RRF_RT_QWORD = (RRF_RT_REG_BINARY | RRF_RT_REG_QWORD) - RRF_RT_ANY = 0x0000ffff - RRF_NOEXPAND = 0x10000000 - RRF_ZEROONFAILURE = 0x20000000 - REG_PROCESS_APPKEY = 0x00000001 - REG_MUI_STRING_TRUNCATE = 0x00000001 -) - -// Service Control Manager object specific access types -const ( - SC_MANAGER_CONNECT = 0x0001 - SC_MANAGER_CREATE_SERVICE = 0x0002 - SC_MANAGER_ENUMERATE_SERVICE = 0x0004 - SC_MANAGER_LOCK = 0x0008 - SC_MANAGER_QUERY_LOCK_STATUS = 0x0010 - SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020 - SC_MANAGER_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SC_MANAGER_CONNECT | SC_MANAGER_CREATE_SERVICE | SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_LOCK | SC_MANAGER_QUERY_LOCK_STATUS | SC_MANAGER_MODIFY_BOOT_CONFIG -) - -// Service Types (Bit Mask) -const ( - SERVICE_KERNEL_DRIVER = 0x00000001 - SERVICE_FILE_SYSTEM_DRIVER = 0x00000002 - SERVICE_ADAPTER = 0x00000004 - SERVICE_RECOGNIZER_DRIVER = 0x00000008 - SERVICE_DRIVER = SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | SERVICE_RECOGNIZER_DRIVER - SERVICE_WIN32_OWN_PROCESS = 0x00000010 - SERVICE_WIN32_SHARE_PROCESS = 0x00000020 - SERVICE_WIN32 = SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS - SERVICE_INTERACTIVE_PROCESS = 0x00000100 - SERVICE_TYPE_ALL = SERVICE_WIN32 | SERVICE_ADAPTER | SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS -) - -// Service State -- for CurrentState -const ( - SERVICE_STOPPED = 0x00000001 - SERVICE_START_PENDING = 0x00000002 - SERVICE_STOP_PENDING = 0x00000003 - SERVICE_RUNNING = 0x00000004 - SERVICE_CONTINUE_PENDING = 0x00000005 - SERVICE_PAUSE_PENDING = 0x00000006 - SERVICE_PAUSED = 0x00000007 -) - -// Controls Accepted (Bit Mask) -const ( - SERVICE_ACCEPT_STOP = 0x00000001 - SERVICE_ACCEPT_PAUSE_CONTINUE = 0x00000002 - SERVICE_ACCEPT_SHUTDOWN = 0x00000004 - SERVICE_ACCEPT_PARAMCHANGE = 0x00000008 - SERVICE_ACCEPT_NETBINDCHANGE = 0x00000010 - SERVICE_ACCEPT_HARDWAREPROFILECHANGE = 0x00000020 - SERVICE_ACCEPT_POWEREVENT = 0x00000040 - SERVICE_ACCEPT_SESSIONCHANGE = 0x00000080 - SERVICE_ACCEPT_PRESHUTDOWN = 0x00000100 - SERVICE_ACCEPT_TIMECHANGE = 0x00000200 - SERVICE_ACCEPT_TRIGGEREVENT = 0x00000400 -) - -// Service object specific access type -const ( - SERVICE_QUERY_CONFIG = 0x0001 - SERVICE_CHANGE_CONFIG = 0x0002 - SERVICE_QUERY_STATUS = 0x0004 - SERVICE_ENUMERATE_DEPENDENTS = 0x0008 - SERVICE_START = 0x0010 - SERVICE_STOP = 0x0020 - SERVICE_PAUSE_CONTINUE = 0x0040 - SERVICE_INTERROGATE = 0x0080 - SERVICE_USER_DEFINED_CONTROL = 0x0100 - - SERVICE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | - SERVICE_QUERY_CONFIG | - SERVICE_CHANGE_CONFIG | - SERVICE_QUERY_STATUS | - SERVICE_ENUMERATE_DEPENDENTS | - SERVICE_START | - SERVICE_STOP | - SERVICE_PAUSE_CONTINUE | - SERVICE_INTERROGATE | - SERVICE_USER_DEFINED_CONTROL -) - -const ( - KERNEL_LOGGER_NAME = "NT Kernel Logger" -) - -// WNODE flags, for ETW (Event Tracing for Windows) / WMI -const ( - WNODE_FLAG_ALL_DATA = 0x00000001 - WNODE_FLAG_SINGLE_INSTANCE = 0x00000002 - WNODE_FLAG_SINGLE_ITEM = 0x00000004 - WNODE_FLAG_EVENT_ITEM = 0x00000008 - WNODE_FLAG_FIXED_INSTANCE_SIZE = 0x00000010 - WNODE_FLAG_TOO_SMALL = 0x00000020 - WNODE_FLAG_INSTANCES_SAME = 0x00000040 - WNODE_FLAG_STATIC_INSTANCE_NAMES = 0x00000080 - WNODE_FLAG_INTERNAL = 0x00000100 - WNODE_FLAG_USE_TIMESTAMP = 0x00000200 - WNODE_FLAG_PERSIST_EVENT = 0x00000400 - WNODE_FLAG_EVENT_REFERENCE = 0x00002000 - WNODE_FLAG_ANSI_INSTANCENAMES = 0x00004000 - WNODE_FLAG_METHOD_ITEM = 0x00008000 - WNODE_FLAG_PDO_INSTANCE_NAMES = 0x00010000 - WNODE_FLAG_TRACED_GUID = 0x00020000 - WNODE_FLAG_LOG_WNODE = 0x00040000 - WNODE_FLAG_USE_GUID_PTR = 0x00080000 - WNODE_FLAG_USE_MOF_PTR = 0x00100000 - WNODE_FLAG_NO_HEADER = 0x00200000 - WNODE_FLAG_SEVERITY_MASK = 0xff000000 -) - -// ETW flags and types etc -const ( - EVENT_TRACE_TYPE_INFO = 0x00 - EVENT_TRACE_TYPE_START = 0x01 - EVENT_TRACE_TYPE_END = 0x02 - EVENT_TRACE_TYPE_STOP = 0x02 - EVENT_TRACE_TYPE_DC_START = 0x03 - EVENT_TRACE_TYPE_DC_END = 0x04 - EVENT_TRACE_TYPE_EXTENSION = 0x05 - EVENT_TRACE_TYPE_REPLY = 0x06 - EVENT_TRACE_TYPE_DEQUEUE = 0x07 - EVENT_TRACE_TYPE_RESUME = 0x07 - EVENT_TRACE_TYPE_CHECKPOINT = 0x08 - EVENT_TRACE_TYPE_SUSPEND = 0x08 - EVENT_TRACE_TYPE_WINEVT_SEND = 0x09 - EVENT_TRACE_TYPE_WINEVT_RECEIVE = 0XF0 - TRACE_LEVEL_NONE = 0 - TRACE_LEVEL_CRITICAL = 1 - TRACE_LEVEL_FATAL = 1 - TRACE_LEVEL_ERROR = 2 - TRACE_LEVEL_WARNING = 3 - TRACE_LEVEL_INFORMATION = 4 - TRACE_LEVEL_VERBOSE = 5 - TRACE_LEVEL_RESERVED6 = 6 - TRACE_LEVEL_RESERVED7 = 7 - TRACE_LEVEL_RESERVED8 = 8 - TRACE_LEVEL_RESERVED9 = 9 - EVENT_TRACE_TYPE_LOAD = 0x0A - EVENT_TRACE_TYPE_IO_READ = 0x0A - EVENT_TRACE_TYPE_IO_WRITE = 0x0B - EVENT_TRACE_TYPE_IO_READ_INIT = 0x0C - EVENT_TRACE_TYPE_IO_WRITE_INIT = 0x0D - EVENT_TRACE_TYPE_IO_FLUSH = 0x0E - EVENT_TRACE_TYPE_IO_FLUSH_INIT = 0x0F - EVENT_TRACE_TYPE_MM_TF = 0x0A - EVENT_TRACE_TYPE_MM_DZF = 0x0B - EVENT_TRACE_TYPE_MM_COW = 0x0C - EVENT_TRACE_TYPE_MM_GPF = 0x0D - EVENT_TRACE_TYPE_MM_HPF = 0x0E - EVENT_TRACE_TYPE_MM_AV = 0x0F - EVENT_TRACE_TYPE_SEND = 0x0A - EVENT_TRACE_TYPE_RECEIVE = 0x0B - EVENT_TRACE_TYPE_CONNECT = 0x0C - EVENT_TRACE_TYPE_DISCONNECT = 0x0D - EVENT_TRACE_TYPE_RETRANSMIT = 0x0E - EVENT_TRACE_TYPE_ACCEPT = 0x0F - EVENT_TRACE_TYPE_RECONNECT = 0x10 - EVENT_TRACE_TYPE_CONNFAIL = 0x11 - EVENT_TRACE_TYPE_COPY_TCP = 0x12 - EVENT_TRACE_TYPE_COPY_ARP = 0x13 - EVENT_TRACE_TYPE_ACKFULL = 0x14 - EVENT_TRACE_TYPE_ACKPART = 0x15 - EVENT_TRACE_TYPE_ACKDUP = 0x16 - EVENT_TRACE_TYPE_GUIDMAP = 0x0A - EVENT_TRACE_TYPE_CONFIG = 0x0B - EVENT_TRACE_TYPE_SIDINFO = 0x0C - EVENT_TRACE_TYPE_SECURITY = 0x0D - EVENT_TRACE_TYPE_REGCREATE = 0x0A - EVENT_TRACE_TYPE_REGOPEN = 0x0B - EVENT_TRACE_TYPE_REGDELETE = 0x0C - EVENT_TRACE_TYPE_REGQUERY = 0x0D - EVENT_TRACE_TYPE_REGSETVALUE = 0x0E - EVENT_TRACE_TYPE_REGDELETEVALUE = 0x0F - EVENT_TRACE_TYPE_REGQUERYVALUE = 0x10 - EVENT_TRACE_TYPE_REGENUMERATEKEY = 0x11 - EVENT_TRACE_TYPE_REGENUMERATEVALUEKEY = 0x12 - EVENT_TRACE_TYPE_REGQUERYMULTIPLEVALUE = 0x13 - EVENT_TRACE_TYPE_REGSETINFORMATION = 0x14 - EVENT_TRACE_TYPE_REGFLUSH = 0x15 - EVENT_TRACE_TYPE_REGKCBCREATE = 0x16 - EVENT_TRACE_TYPE_REGKCBDELETE = 0x17 - EVENT_TRACE_TYPE_REGKCBRUNDOWNBEGIN = 0x18 - EVENT_TRACE_TYPE_REGKCBRUNDOWNEND = 0x19 - EVENT_TRACE_TYPE_REGVIRTUALIZE = 0x1A - EVENT_TRACE_TYPE_REGCLOSE = 0x1B - EVENT_TRACE_TYPE_REGSETSECURITY = 0x1C - EVENT_TRACE_TYPE_REGQUERYSECURITY = 0x1D - EVENT_TRACE_TYPE_REGCOMMIT = 0x1E - EVENT_TRACE_TYPE_REGPREPARE = 0x1F - EVENT_TRACE_TYPE_REGROLLBACK = 0x20 - EVENT_TRACE_TYPE_REGMOUNTHIVE = 0x21 - EVENT_TRACE_TYPE_CONFIG_CPU = 0x0A - EVENT_TRACE_TYPE_CONFIG_PHYSICALDISK = 0x0B - EVENT_TRACE_TYPE_CONFIG_LOGICALDISK = 0x0C - EVENT_TRACE_TYPE_CONFIG_NIC = 0x0D - EVENT_TRACE_TYPE_CONFIG_VIDEO = 0x0E - EVENT_TRACE_TYPE_CONFIG_SERVICES = 0x0F - EVENT_TRACE_TYPE_CONFIG_POWER = 0x10 - EVENT_TRACE_TYPE_CONFIG_NETINFO = 0x11 - EVENT_TRACE_TYPE_CONFIG_IRQ = 0x15 - EVENT_TRACE_TYPE_CONFIG_PNP = 0x16 - EVENT_TRACE_TYPE_CONFIG_IDECHANNEL = 0x17 - EVENT_TRACE_TYPE_CONFIG_PLATFORM = 0x19 - EVENT_TRACE_FLAG_PROCESS = 0x00000001 - EVENT_TRACE_FLAG_THREAD = 0x00000002 - EVENT_TRACE_FLAG_IMAGE_LOAD = 0x00000004 - EVENT_TRACE_FLAG_DISK_IO = 0x00000100 - EVENT_TRACE_FLAG_DISK_FILE_IO = 0x00000200 - EVENT_TRACE_FLAG_MEMORY_PAGE_FAULTS = 0x00001000 - EVENT_TRACE_FLAG_MEMORY_HARD_FAULTS = 0x00002000 - EVENT_TRACE_FLAG_NETWORK_TCPIP = 0x00010000 - EVENT_TRACE_FLAG_REGISTRY = 0x00020000 - EVENT_TRACE_FLAG_DBGPRINT = 0x00040000 - EVENT_TRACE_FLAG_PROCESS_COUNTERS = 0x00000008 - EVENT_TRACE_FLAG_CSWITCH = 0x00000010 - EVENT_TRACE_FLAG_DPC = 0x00000020 - EVENT_TRACE_FLAG_INTERRUPT = 0x00000040 - EVENT_TRACE_FLAG_SYSTEMCALL = 0x00000080 - EVENT_TRACE_FLAG_DISK_IO_INIT = 0x00000400 - EVENT_TRACE_FLAG_ALPC = 0x00100000 - EVENT_TRACE_FLAG_SPLIT_IO = 0x00200000 - EVENT_TRACE_FLAG_DRIVER = 0x00800000 - EVENT_TRACE_FLAG_PROFILE = 0x01000000 - EVENT_TRACE_FLAG_FILE_IO = 0x02000000 - EVENT_TRACE_FLAG_FILE_IO_INIT = 0x04000000 - EVENT_TRACE_FLAG_DISPATCHER = 0x00000800 - EVENT_TRACE_FLAG_VIRTUAL_ALLOC = 0x00004000 - EVENT_TRACE_FLAG_EXTENSION = 0x80000000 - EVENT_TRACE_FLAG_FORWARD_WMI = 0x40000000 - EVENT_TRACE_FLAG_ENABLE_RESERVE = 0x20000000 - EVENT_TRACE_FILE_MODE_NONE = 0x00000000 - EVENT_TRACE_FILE_MODE_SEQUENTIAL = 0x00000001 - EVENT_TRACE_FILE_MODE_CIRCULAR = 0x00000002 - EVENT_TRACE_FILE_MODE_APPEND = 0x00000004 - EVENT_TRACE_REAL_TIME_MODE = 0x00000100 - EVENT_TRACE_DELAY_OPEN_FILE_MODE = 0x00000200 - EVENT_TRACE_BUFFERING_MODE = 0x00000400 - EVENT_TRACE_PRIVATE_LOGGER_MODE = 0x00000800 - EVENT_TRACE_ADD_HEADER_MODE = 0x00001000 - EVENT_TRACE_USE_GLOBAL_SEQUENCE = 0x00004000 - EVENT_TRACE_USE_LOCAL_SEQUENCE = 0x00008000 - EVENT_TRACE_RELOG_MODE = 0x00010000 - EVENT_TRACE_USE_PAGED_MEMORY = 0x01000000 - EVENT_TRACE_FILE_MODE_NEWFILE = 0x00000008 - EVENT_TRACE_FILE_MODE_PREALLOCATE = 0x00000020 - EVENT_TRACE_NONSTOPPABLE_MODE = 0x00000040 - EVENT_TRACE_SECURE_MODE = 0x00000080 - EVENT_TRACE_USE_KBYTES_FOR_SIZE = 0x00002000 - EVENT_TRACE_PRIVATE_IN_PROC = 0x00020000 - EVENT_TRACE_MODE_RESERVED = 0x00100000 - EVENT_TRACE_NO_PER_PROCESSOR_BUFFERING = 0x10000000 - EVENT_TRACE_CONTROL_QUERY = 0 - EVENT_TRACE_CONTROL_STOP = 1 - EVENT_TRACE_CONTROL_UPDATE = 2 - EVENT_TRACE_CONTROL_FLUSH = 3 -) diff --git a/vendor/github.com/AllenDang/w32/advapi32_test.go b/vendor/github.com/AllenDang/w32/advapi32_test.go deleted file mode 100644 index 72a9198..0000000 --- a/vendor/github.com/AllenDang/w32/advapi32_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package w32 - -import ( - "testing" -) - -func TestInitializeSecurityDescriptor(t *testing.T) { - sd, err := InitializeSecurityDescriptor(1) - if err != nil { - t.Errorf("Failed: %v", err) - } - t.Logf("SD:\n%#v\n", *sd) -} - -func TestSetSecurityDescriptorDacl(t *testing.T) { - - sd, err := InitializeSecurityDescriptor(1) - if err != nil { - t.Errorf("Failed to initialize: %v", err) - } - err = SetSecurityDescriptorDacl(sd, nil) - if err != nil { - t.Errorf("Failed to set NULL DACL: %v", err) - } - t.Logf("[OK] Set NULL DACL") - - empty := &ACL{ - AclRevision: 4, - Sbz1: 0, - AclSize: 4, - AceCount: 0, - Sbz2: 0, - } - err = SetSecurityDescriptorDacl(sd, empty) - if err != nil { - t.Errorf("Failed to set empty DACL: %v", err) - } - t.Logf("[OK] Set empty DACL") - t.Logf("SD:\n%#v\n", *sd) - -} diff --git a/vendor/github.com/AllenDang/w32/advapi32_typedef.go b/vendor/github.com/AllenDang/w32/advapi32_typedef.go deleted file mode 100644 index 3a4308c..0000000 --- a/vendor/github.com/AllenDang/w32/advapi32_typedef.go +++ /dev/null @@ -1,122 +0,0 @@ -package w32 - -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa374931(v=vs.85).aspx -type ACL struct { - AclRevision byte - Sbz1 byte - AclSize uint16 - AceCount uint16 - Sbz2 uint16 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa379561(v=vs.85).aspx - -type SECURITY_DESCRIPTOR_CONTROL uint16 - -type SECURITY_DESCRIPTOR struct { - Revision byte - Sbz1 byte - Control SECURITY_DESCRIPTOR_CONTROL - Owner uintptr - Group uintptr - Sacl *ACL - Dacl *ACL -} - -type SID_IDENTIFIER_AUTHORITY struct { - Value [6]byte -} - -// typedef struct _SID // 4 elements, 0xC bytes (sizeof) -// { -// /*0x000*/ UINT8 Revision; -// /*0x001*/ UINT8 SubAuthorityCount; -// /*0x002*/ struct _SID_IDENTIFIER_AUTHORITY IdentifierAuthority; // 1 elements, 0x6 bytes (sizeof) -// /*0x008*/ ULONG32 SubAuthority[1]; -// }SID, *PSID; -type SID struct { - Revision byte - SubAuthorityCount byte - IdentifierAuthority SID_IDENTIFIER_AUTHORITY - SubAuthority uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa363646.aspx -type EVENTLOGRECORD struct { - Length uint32 - Reserved uint32 - RecordNumber uint32 - TimeGenerated uint32 - TimeWritten uint32 - EventID uint32 - EventType uint16 - NumStrings uint16 - EventCategory uint16 - ReservedFlags uint16 - ClosingRecordNumber uint32 - StringOffset uint32 - UserSidLength uint32 - UserSidOffset uint32 - DataLength uint32 - DataOffset uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms685996.aspx -type SERVICE_STATUS struct { - DwServiceType uint32 - DwCurrentState uint32 - DwControlsAccepted uint32 - DwWin32ExitCode uint32 - DwServiceSpecificExitCode uint32 - DwCheckPoint uint32 - DwWaitHint uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa364160(v=vs.85).aspx -type WNODE_HEADER struct { - BufferSize uint32 - ProviderId uint32 - HistoricalContext uint64 - KernelHandle HANDLE - Guid GUID - ClientContext uint32 - Flags uint32 -} - -// These partially compensate for the anonymous unions we removed, but there -// are no setters. -func (w WNODE_HEADER) TimeStamp() uint64 { - // TODO: Cast to the stupid LARGE_INTEGER struct which is, itself, nasty - // and union-y - return uint64(w.KernelHandle) -} - -func (w WNODE_HEADER) Version() uint32 { - return uint32(w.HistoricalContext >> 32) -} - -func (w WNODE_HEADER) Linkage() uint32 { - return uint32(w.HistoricalContext) -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa363784(v=vs.85).aspx -type EVENT_TRACE_PROPERTIES struct { - Wnode WNODE_HEADER - BufferSize uint32 - MinimumBuffers uint32 - MaximumBuffers uint32 - MaximumFileSize uint32 - LogFileMode uint32 - FlushTimer uint32 - EnableFlags uint32 - AgeLimit int32 - NumberOfBuffers uint32 - FreeBuffers uint32 - EventsLost uint32 - BuffersWritten uint32 - LogBuffersLost uint32 - RealTimeBuffersLost uint32 - LoggerThreadId HANDLE - LogFileNameOffset uint32 - LoggerNameOffset uint32 -} diff --git a/vendor/github.com/AllenDang/w32/alpc.go b/vendor/github.com/AllenDang/w32/alpc.go deleted file mode 100644 index 408d47e..0000000 --- a/vendor/github.com/AllenDang/w32/alpc.go +++ /dev/null @@ -1,304 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "fmt" - // "github.com/davecgh/go-spew/spew" - "syscall" - "unsafe" -) - -var ( - modntdll = syscall.NewLazyDLL("ntdll.dll") - - procAlpcGetMessageAttribute = modntdll.NewProc("AlpcGetMessageAttribute") - procNtAlpcAcceptConnectPort = modntdll.NewProc("NtAlpcAcceptConnectPort") - procNtAlpcCancelMessage = modntdll.NewProc("NtAlpcCancelMessage") - procNtAlpcConnectPort = modntdll.NewProc("NtAlpcConnectPort") - procNtAlpcCreatePort = modntdll.NewProc("NtAlpcCreatePort") - procNtAlpcDisconnectPort = modntdll.NewProc("NtAlpcDisconnectPort") - procNtAlpcSendWaitReceivePort = modntdll.NewProc("NtAlpcSendWaitReceivePort") - procRtlCreateUnicodeStringFromAsciiz = modntdll.NewProc("RtlCreateUnicodeStringFromAsciiz") -) - -//func RtlCreateUnicodeStringFromAsciiz(s string) (us UNICODE_STRING, e error) { -// -// cs := C.CString(s) -// defer C.free(unsafe.Pointer(cs)) -// -// ret, _, lastErr := procRtlCreateUnicodeStringFromAsciiz.Call( -// uintptr(unsafe.Pointer(&us)), -// uintptr(unsafe.Pointer(cs)), -// ) -// -// if ret != 1 { // ret is a BOOL ( I think ) -// e = lastErr -// } -// -// return -//} - -//func newUnicodeString(s string) (us UNICODE_STRING, e error) { -// // TODO probably not the most efficient way to do this, but I couldn't -// // work out how to manually initialize the UNICODE_STRING struct in a way -// // that the ALPC subsystem liked. -// us, e = RtlCreateUnicodeStringFromAsciiz(s) -// return -//} - -// (this is a macro) -// VOID InitializeObjectAttributes( -// [out] POBJECT_ATTRIBUTES InitializedAttributes, -// [in] PUNICODE_STRING ObjectName, -// [in] ULONG Attributes, -// [in] HANDLE RootDirectory, -// [in, optional] PSECURITY_DESCRIPTOR SecurityDescriptor -// ) -//func InitializeObjectAttributes( -// name string, -// attributes uint32, -// rootDir HANDLE, -// pSecurityDescriptor *SECURITY_DESCRIPTOR, -//) (oa OBJECT_ATTRIBUTES, e error) { -// -// oa = OBJECT_ATTRIBUTES{ -// RootDirectory: rootDir, -// Attributes: attributes, -// SecurityDescriptor: pSecurityDescriptor, -// } -// oa.Length = uint32(unsafe.Sizeof(oa)) -// -// if len(name) > 0 { -// us, err := newUnicodeString(name) -// if err != nil { -// e = err -// return -// } -// oa.ObjectName = &us -// } -// -// return -//} - -// NTSTATUS -// NtAlpcCreatePort( -// __out PHANDLE PortHandle, -// __in POBJECT_ATTRIBUTES ObjectAttributes, -// __in_opt PALPC_PORT_ATTRIBUTES PortAttributes -// ); -func NtAlpcCreatePort(pObjectAttributes *OBJECT_ATTRIBUTES, pPortAttributes *ALPC_PORT_ATTRIBUTES) (hPort HANDLE, e error) { - - ret, _, _ := procNtAlpcCreatePort.Call( - uintptr(unsafe.Pointer(&hPort)), - uintptr(unsafe.Pointer(pObjectAttributes)), - uintptr(unsafe.Pointer(pPortAttributes)), - ) - - if ret != ERROR_SUCCESS { - return hPort, fmt.Errorf("0x%x", ret) - } - - return -} - -// NTSTATUS -// NtAlpcConnectPort( -// __out PHANDLE PortHandle, -// __in PUNICODE_STRING PortName, -// __in POBJECT_ATTRIBUTES ObjectAttributes, -// __in_opt PALPC_PORT_ATTRIBUTES PortAttributes, -// __in ULONG Flags, -// __in_opt PSID RequiredServerSid, -// __inout PPORT_MESSAGE ConnectionMessage, -// __inout_opt PULONG BufferLength, -// __inout_opt PALPC_MESSAGE_ATTRIBUTES OutMessageAttributes, -// __inout_opt PALPC_MESSAGE_ATTRIBUTES InMessageAttributes, -// __in_opt PLARGE_INTEGER Timeout -// ); -//func NtAlpcConnectPort( -// destPort string, -// pClientObjAttrs *OBJECT_ATTRIBUTES, -// pClientAlpcPortAttrs *ALPC_PORT_ATTRIBUTES, -// flags uint32, -// pRequiredServerSid *SID, -// pConnMsg *AlpcShortMessage, -// pBufLen *uint32, -// pOutMsgAttrs *ALPC_MESSAGE_ATTRIBUTES, -// pInMsgAttrs *ALPC_MESSAGE_ATTRIBUTES, -// timeout *int64, -//) (hPort HANDLE, e error) { -// -// destPortU, e := newUnicodeString(destPort) -// if e != nil { -// return -// } -// -// ret, _, _ := procNtAlpcConnectPort.Call( -// uintptr(unsafe.Pointer(&hPort)), -// uintptr(unsafe.Pointer(&destPortU)), -// uintptr(unsafe.Pointer(pClientObjAttrs)), -// uintptr(unsafe.Pointer(pClientAlpcPortAttrs)), -// uintptr(flags), -// uintptr(unsafe.Pointer(pRequiredServerSid)), -// uintptr(unsafe.Pointer(pConnMsg)), -// uintptr(unsafe.Pointer(pBufLen)), -// uintptr(unsafe.Pointer(pOutMsgAttrs)), -// uintptr(unsafe.Pointer(pInMsgAttrs)), -// uintptr(unsafe.Pointer(timeout)), -// ) -// -// if ret != ERROR_SUCCESS { -// e = fmt.Errorf("0x%x", ret) -// } -// return -//} - -// NTSTATUS -// NtAlpcAcceptConnectPort( -// __out PHANDLE PortHandle, -// __in HANDLE ConnectionPortHandle, -// __in ULONG Flags, -// __in POBJECT_ATTRIBUTES ObjectAttributes, -// __in PALPC_PORT_ATTRIBUTES PortAttributes, -// __in_opt PVOID PortContext, -// __in PPORT_MESSAGE ConnectionRequest, -// __inout_opt PALPC_MESSAGE_ATTRIBUTES ConnectionMessageAttributes, -// __in BOOLEAN AcceptConnection -// ); -func NtAlpcAcceptConnectPort( - hSrvConnPort HANDLE, - flags uint32, - pObjAttr *OBJECT_ATTRIBUTES, - pPortAttr *ALPC_PORT_ATTRIBUTES, - pContext *AlpcPortContext, - pConnReq *AlpcShortMessage, - pConnMsgAttrs *ALPC_MESSAGE_ATTRIBUTES, - accept uintptr, -) (hPort HANDLE, e error) { - - ret, _, _ := procNtAlpcAcceptConnectPort.Call( - uintptr(unsafe.Pointer(&hPort)), - uintptr(hSrvConnPort), - uintptr(flags), - uintptr(unsafe.Pointer(pObjAttr)), - uintptr(unsafe.Pointer(pPortAttr)), - uintptr(unsafe.Pointer(pContext)), - uintptr(unsafe.Pointer(pConnReq)), - uintptr(unsafe.Pointer(pConnMsgAttrs)), - accept, - ) - - if ret != ERROR_SUCCESS { - e = fmt.Errorf("0x%x", ret) - } - return -} - -// NTSTATUS -// NtAlpcSendWaitReceivePort( -// __in HANDLE PortHandle, -// __in ULONG Flags, -// __in_opt PPORT_MESSAGE SendMessage, -// __in_opt PALPC_MESSAGE_ATTRIBUTES SendMessageAttributes, -// __inout_opt PPORT_MESSAGE ReceiveMessage, -// __inout_opt PULONG BufferLength, -// __inout_opt PALPC_MESSAGE_ATTRIBUTES ReceiveMessageAttributes, -// __in_opt PLARGE_INTEGER Timeout -// ); -func NtAlpcSendWaitReceivePort( - hPort HANDLE, - flags uint32, - sendMsg *AlpcShortMessage, // Should actually point to PORT_MESSAGE + payload - sendMsgAttrs *ALPC_MESSAGE_ATTRIBUTES, - recvMsg *AlpcShortMessage, - recvBufLen *uint32, - recvMsgAttrs *ALPC_MESSAGE_ATTRIBUTES, - timeout *int64, // use native int64 -) (e error) { - - ret, _, _ := procNtAlpcSendWaitReceivePort.Call( - uintptr(hPort), - uintptr(flags), - uintptr(unsafe.Pointer(sendMsg)), - uintptr(unsafe.Pointer(sendMsgAttrs)), - uintptr(unsafe.Pointer(recvMsg)), - uintptr(unsafe.Pointer(recvBufLen)), - uintptr(unsafe.Pointer(recvMsgAttrs)), - uintptr(unsafe.Pointer(timeout)), - ) - - if ret != ERROR_SUCCESS { - e = fmt.Errorf("0x%x", ret) - } - return -} - -// NTSYSAPI -// PVOID -// NTAPI -// AlpcGetMessageAttribute( -// __in PALPC_MESSAGE_ATTRIBUTES Buffer, -// __in ULONG AttributeFlag -// ); - -// This basically returns a pointer to the correct struct for whichever -// message attribute you asked for. In Go terms, it returns unsafe.Pointer -// which you should then cast. Example: - -// ptr := AlpcGetMessageAttribute(&recvMsgAttrs, ALPC_MESSAGE_CONTEXT_ATTRIBUTE) -// if ptr != nil { -// context := (*ALPC_CONTEXT_ATTR)(ptr) -// } -func AlpcGetMessageAttribute(buf *ALPC_MESSAGE_ATTRIBUTES, attr uint32) unsafe.Pointer { - - ret, _, _ := procAlpcGetMessageAttribute.Call( - uintptr(unsafe.Pointer(buf)), - uintptr(attr), - ) - return unsafe.Pointer(ret) -} - -// NTSYSCALLAPI -// NTSTATUS -// NTAPI -// NtAlpcCancelMessage( -// __in HANDLE PortHandle, -// __in ULONG Flags, -// __in PALPC_CONTEXT_ATTR MessageContext -// ); -func NtAlpcCancelMessage(hPort HANDLE, flags uint32, pMsgContext *ALPC_CONTEXT_ATTR) (e error) { - - ret, _, _ := procNtAlpcCancelMessage.Call( - uintptr(hPort), - uintptr(flags), - uintptr(unsafe.Pointer(pMsgContext)), - ) - - if ret != ERROR_SUCCESS { - e = fmt.Errorf("0x%x", ret) - } - return -} - -// NTSYSCALLAPI -// NTSTATUS -// NTAPI -// NtAlpcDisconnectPort( -// __in HANDLE PortHandle, -// __in ULONG Flags -// ); -func NtAlpcDisconnectPort(hPort HANDLE, flags uint32) (e error) { - - ret, _, _ := procNtAlpcDisconnectPort.Call( - uintptr(hPort), - uintptr(flags), - ) - - if ret != ERROR_SUCCESS { - e = fmt.Errorf("0x%x", ret) - } - return -} diff --git a/vendor/github.com/AllenDang/w32/alpc_constants.go b/vendor/github.com/AllenDang/w32/alpc_constants.go deleted file mode 100644 index 82d9d2e..0000000 --- a/vendor/github.com/AllenDang/w32/alpc_constants.go +++ /dev/null @@ -1,64 +0,0 @@ -package w32 - -const ( - ALPC_PORFLG_ALLOW_LPC_REQUESTS = 0x20000 - ALPC_PORFLG_SYSTEM_PROCESS = 0x100000 - ALPC_PORFLG_WAITABLE_PORT = 0x40000 -) - -const ( - ALPC_MSGFLG_REPLY_MESSAGE = 0x1 - ALPC_MSGFLG_LPC_MODE = 0x2 // ? - ALPC_MSGFLG_RELEASE_MESSAGE = 0x10000 // dbg - ALPC_MSGFLG_SYNC_REQUEST = 0x20000 // dbg - ALPC_MSGFLG_WAIT_USER_MODE = 0x100000 - ALPC_MSGFLG_WAIT_ALERTABLE = 0x200000 - ALPC_MSGFLG_WOW64_CALL = 0x80000000 // dbg -) -const ( - ALPC_MESSAGE_SECURITY_ATTRIBUTE = 0x80000000 - ALPC_MESSAGE_VIEW_ATTRIBUTE = 0x40000000 - ALPC_MESSAGE_CONTEXT_ATTRIBUTE = 0x20000000 - ALPC_MESSAGE_HANDLE_ATTRIBUTE = 0x10000000 -) - -const ( - OBJ_INHERIT = 0x00000002 - OBJ_PERMANENT = 0x00000010 - OBJ_EXCLUSIVE = 0x00000020 - OBJ_CASE_INSENSITIVE = 0x00000040 - OBJ_OPENIF = 0x00000080 - OBJ_OPENLINK = 0x00000100 - OBJ_KERNEL_HANDLE = 0x00000200 -) - -const ( - LPC_REQUEST = 1 - LPC_REPLY = 2 - LPC_DATAGRAM = 3 - LPC_LOST_REPLY = 4 - LPC_PORT_CLOSED = 5 - LPC_CLIENT_DIED = 6 - LPC_EXCEPTION = 7 - LPC_DEBUG_EVENT = 8 - LPC_ERROR_EVENT = 9 - LPC_CONNECTION_REQUEST = 10 - LPC_CONTINUATION_REQUIRED = 0x2000 -) - -const ( - SecurityAnonymous uint32 = 1 - SecurityIdentification uint32 = 2 - SecurityImpersonation uint32 = 3 - SecurityDelegation uint32 = 4 -) - -const ( - SECURITY_DYNAMIC_TRACKING byte = 1 - SECURITY_STATIC_TRACKING byte = 0 -) - -const ( - ALPC_SYNC_OBJECT_TYPE uint32 = 2 - ALPC_THREAD_OBJECT_TYPE uint32 = 4 -) diff --git a/vendor/github.com/AllenDang/w32/alpc_test.go b/vendor/github.com/AllenDang/w32/alpc_test.go deleted file mode 100644 index 6d1c7d4..0000000 --- a/vendor/github.com/AllenDang/w32/alpc_test.go +++ /dev/null @@ -1,137 +0,0 @@ -package w32 - -import ( - "testing" -) - -var testPortName = "\\TestAlpcPort" - -var basicPortAttr = ALPC_PORT_ATTRIBUTES{ - MaxMessageLength: uint64(SHORT_MESSAGE_MAX_SIZE), - SecurityQos: SECURITY_QUALITY_OF_SERVICE{ - Length: SECURITY_QOS_SIZE, - ContextTrackingMode: SECURITY_DYNAMIC_TRACKING, - EffectiveOnly: 1, - ImpersonationLevel: SecurityAnonymous, - }, - Flags: ALPC_PORFLG_ALLOW_LPC_REQUESTS, - DupObjectTypes: ALPC_SYNC_OBJECT_TYPE, -} - -func ObjectAttributes(name string) (oa OBJECT_ATTRIBUTES, e error) { - - sd, e := InitializeSecurityDescriptor(1) - if e != nil { - return - } - - e = SetSecurityDescriptorDacl(sd, nil) - if e != nil { - return - } - - oa, e = InitializeObjectAttributes(name, 0, 0, sd) - return -} - -func Send( - hPort HANDLE, - msg *AlpcShortMessage, - flags uint32, - pMsgAttrs *ALPC_MESSAGE_ATTRIBUTES, - timeout *int64, -) (e error) { - - e = NtAlpcSendWaitReceivePort(hPort, flags, msg, pMsgAttrs, nil, nil, nil, timeout) - return - -} - -func Recv( - hPort HANDLE, - pMsg *AlpcShortMessage, - pMsgAttrs *ALPC_MESSAGE_ATTRIBUTES, - timeout *int64, -) (bufLen uint32, e error) { - - bufLen = uint32(pMsg.TotalLength) - e = NtAlpcSendWaitReceivePort(hPort, 0, nil, nil, pMsg, &bufLen, pMsgAttrs, timeout) - return - -} - -// Convenience method to create an ALPC port with a NULL DACL. Requires an -// absolute port name ( where / is the root of the kernel object directory ) -func CreatePort(name string) (hPort HANDLE, e error) { - - oa, e := ObjectAttributes(name) - if e != nil { - return - } - - hPort, e = NtAlpcCreatePort(&oa, &basicPortAttr) - - return -} - -func ConnectPort(serverName, clientName string, pConnMsg *AlpcShortMessage) (hPort HANDLE, e error) { - - oa, e := InitializeObjectAttributes(clientName, 0, 0, nil) - if e != nil { - return - } - - hPort, e = NtAlpcConnectPort( - serverName, - &oa, - &basicPortAttr, - ALPC_PORFLG_ALLOW_LPC_REQUESTS, - nil, - pConnMsg, - nil, - nil, - nil, - nil, - ) - - return -} - -func Accept( - hSrv HANDLE, - context *AlpcPortContext, - pConnReq *AlpcShortMessage, - accept bool, -) (hPort HANDLE, e error) { - - oa, _ := InitializeObjectAttributes("", 0, 0, nil) - - var accepted uintptr - if accept { - accepted++ - } - - hPort, e = NtAlpcAcceptConnectPort( - hSrv, - 0, - &oa, - &basicPortAttr, - context, - pConnReq, - nil, - accepted, - ) - - return -} - -func TestNtAlpcCreatePort(t *testing.T) { - - hPort, err := CreatePort(testPortName) - - if err != nil { - t.Errorf("failed to create ALPC port %v: %v", testPortName, err) - } else { - t.Logf("[OK] Created ALPC port %v with handle 0x%x", testPortName, hPort) - } -} diff --git a/vendor/github.com/AllenDang/w32/alpc_typedef.go b/vendor/github.com/AllenDang/w32/alpc_typedef.go deleted file mode 100644 index 52b35c9..0000000 --- a/vendor/github.com/AllenDang/w32/alpc_typedef.go +++ /dev/null @@ -1,181 +0,0 @@ -package w32 - -import ( - "errors" -) - -// nt!_ALPC_MESSAGE_ATTRIBUTES -// +0x000 AllocatedAttributes : Uint4B -// +0x004 ValidAttributes : Uint4B -type ALPC_MESSAGE_ATTRIBUTES struct { - AllocatedAttributes uint32 - ValidAttributes uint32 -} - -type ALPC_CONTEXT_ATTR struct { - PortContext *AlpcPortContext - MessageContext uintptr - Sequence uint32 - MessageId uint32 - CallbackId uint32 -} - -type ALPC_HANDLE_ATTR struct { - Flags uint32 - Handle HANDLE - ObjectType uint32 - DesiredAccess uint32 -} - -// nt!_CLIENT_ID -// +0x000 UniqueProcess : Ptr64 Void -// +0x008 UniqueThread : Ptr64 Void -type CLIENT_ID struct { - UniqueProcess uintptr - UniqueThread uintptr -} - -// nt!_UNICODE_STRING -// +0x000 Length : Uint2B -// +0x002 MaximumLength : Uint2B -// +0x008 Buffer : Ptr64 Uint2B -type UNICODE_STRING struct { - Length uint16 - MaximumLength uint16 - _ [4]byte // align to 0x08 - Buffer *uint16 -} - -// nt!_OBJECT_ATTRIBUTES -// +0x000 Length : Uint4B -// +0x008 RootDirectory : Ptr64 Void -// +0x010 ObjectName : Ptr64 _UNICODE_STRING -// +0x018 Attributes : Uint4B -// +0x020 SecurityDescriptor : Ptr64 Void -// +0x028 SecurityQualityOfService : Ptr64 Void -type OBJECT_ATTRIBUTES struct { - Length uint32 - _ [4]byte // align to 0x08 - RootDirectory HANDLE - ObjectName *UNICODE_STRING - Attributes uint32 - _ [4]byte // align to 0x20 - SecurityDescriptor *SECURITY_DESCRIPTOR - SecurityQualityOfService *SECURITY_QUALITY_OF_SERVICE -} - -// cf: http://j00ru.vexillium.org/?p=502 for legacy RPC -// nt!_PORT_MESSAGE -// +0x000 u1 : <unnamed-tag> -// +0x004 u2 : <unnamed-tag> -// +0x008 ClientId : _CLIENT_ID -// +0x008 DoNotUseThisField : Float -// +0x018 MessageId : Uint4B -// +0x020 ClientViewSize : Uint8B -// +0x020 CallbackId : Uint4B -type PORT_MESSAGE struct { - DataLength uint16 // These are the two unnamed unions - TotalLength uint16 // without Length and ZeroInit - Type uint16 - DataInfoOffset uint16 - ClientId CLIENT_ID - MessageId uint32 - _ [4]byte // align up to 0x20 - ClientViewSize uint64 -} - -func (pm PORT_MESSAGE) CallbackId() uint32 { - return uint32(pm.ClientViewSize >> 32) -} - -func (pm PORT_MESSAGE) DoNotUseThisField() float64 { - panic("WE TOLD YOU NOT TO USE THIS FIELD") -} - -const PORT_MESSAGE_SIZE = 0x28 - -// http://www.nirsoft.net/kernel_struct/vista/SECURITY_QUALITY_OF_SERVICE.html -type SECURITY_QUALITY_OF_SERVICE struct { - Length uint32 - ImpersonationLevel uint32 - ContextTrackingMode byte - EffectiveOnly byte - _ [2]byte // align to 12 bytes -} - -const SECURITY_QOS_SIZE = 12 - -// nt!_ALPC_PORT_ATTRIBUTES -// +0x000 Flags : Uint4B -// +0x004 SecurityQos : _SECURITY_QUALITY_OF_SERVICE -// +0x010 MaxMessageLength : Uint8B -// +0x018 MemoryBandwidth : Uint8B -// +0x020 MaxPoolUsage : Uint8B -// +0x028 MaxSectionSize : Uint8B -// +0x030 MaxViewSize : Uint8B -// +0x038 MaxTotalSectionSize : Uint8B -// +0x040 DupObjectTypes : Uint4B -// +0x044 Reserved : Uint4B -type ALPC_PORT_ATTRIBUTES struct { - Flags uint32 - SecurityQos SECURITY_QUALITY_OF_SERVICE - MaxMessageLength uint64 // must be filled out - MemoryBandwidth uint64 - MaxPoolUsage uint64 - MaxSectionSize uint64 - MaxViewSize uint64 - MaxTotalSectionSize uint64 - DupObjectTypes uint32 - Reserved uint32 -} - -const SHORT_MESSAGE_MAX_SIZE uint16 = 65535 // MAX_USHORT -const SHORT_MESSAGE_MAX_PAYLOAD uint16 = SHORT_MESSAGE_MAX_SIZE - PORT_MESSAGE_SIZE - -// LPC uses the first 4 bytes of the payload as an LPC Command, but this is -// NOT represented here, to allow the use of raw ALPC. For legacy LPC, callers -// must include the command as part of their payload. -type AlpcShortMessage struct { - PORT_MESSAGE - Data [SHORT_MESSAGE_MAX_PAYLOAD]byte -} - -func NewAlpcShortMessage() AlpcShortMessage { - sm := AlpcShortMessage{} - sm.TotalLength = SHORT_MESSAGE_MAX_SIZE - return sm -} - -func (sm *AlpcShortMessage) SetData(d []byte) (e error) { - - copy(sm.Data[:], d) - if len(d) > int(SHORT_MESSAGE_MAX_PAYLOAD) { - e = errors.New("data too big - truncated") - sm.DataLength = SHORT_MESSAGE_MAX_PAYLOAD - sm.TotalLength = SHORT_MESSAGE_MAX_SIZE - return - } - sm.TotalLength = uint16(PORT_MESSAGE_SIZE + len(d)) - sm.DataLength = uint16(len(d)) - return - -} - -// TODO - is this still useful? -func (sm *AlpcShortMessage) GetData() []byte { - if int(sm.DataLength) > int(SHORT_MESSAGE_MAX_PAYLOAD) { - return sm.Data[:] // truncate - } - return sm.Data[:sm.DataLength] -} - -func (sm *AlpcShortMessage) Reset() { - // zero the PORT_MESSAGE header - sm.PORT_MESSAGE = PORT_MESSAGE{} - sm.TotalLength = SHORT_MESSAGE_MAX_SIZE - sm.DataLength = 0 -} - -type AlpcPortContext struct { - Handle HANDLE -} diff --git a/vendor/github.com/AllenDang/w32/comctl32.go b/vendor/github.com/AllenDang/w32/comctl32.go deleted file mode 100644 index 4f4e6b5..0000000 --- a/vendor/github.com/AllenDang/w32/comctl32.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "syscall" - "unsafe" -) - -var ( - modcomctl32 = syscall.NewLazyDLL("comctl32.dll") - - procInitCommonControlsEx = modcomctl32.NewProc("InitCommonControlsEx") - procImageList_Create = modcomctl32.NewProc("ImageList_Create") - procImageList_Destroy = modcomctl32.NewProc("ImageList_Destroy") - procImageList_GetImageCount = modcomctl32.NewProc("ImageList_GetImageCount") - procImageList_SetImageCount = modcomctl32.NewProc("ImageList_SetImageCount") - procImageList_Add = modcomctl32.NewProc("ImageList_Add") - procImageList_ReplaceIcon = modcomctl32.NewProc("ImageList_ReplaceIcon") - procImageList_Remove = modcomctl32.NewProc("ImageList_Remove") - procTrackMouseEvent = modcomctl32.NewProc("_TrackMouseEvent") -) - -func InitCommonControlsEx(lpInitCtrls *INITCOMMONCONTROLSEX) bool { - ret, _, _ := procInitCommonControlsEx.Call( - uintptr(unsafe.Pointer(lpInitCtrls))) - - return ret != 0 -} - -func ImageList_Create(cx, cy int, flags uint, cInitial, cGrow int) HIMAGELIST { - ret, _, _ := procImageList_Create.Call( - uintptr(cx), - uintptr(cy), - uintptr(flags), - uintptr(cInitial), - uintptr(cGrow)) - - if ret == 0 { - panic("Create image list failed") - } - - return HIMAGELIST(ret) -} - -func ImageList_Destroy(himl HIMAGELIST) bool { - ret, _, _ := procImageList_Destroy.Call( - uintptr(himl)) - - return ret != 0 -} - -func ImageList_GetImageCount(himl HIMAGELIST) int { - ret, _, _ := procImageList_GetImageCount.Call( - uintptr(himl)) - - return int(ret) -} - -func ImageList_SetImageCount(himl HIMAGELIST, uNewCount uint) bool { - ret, _, _ := procImageList_SetImageCount.Call( - uintptr(himl), - uintptr(uNewCount)) - - return ret != 0 -} - -func ImageList_Add(himl HIMAGELIST, hbmImage, hbmMask HBITMAP) int { - ret, _, _ := procImageList_Add.Call( - uintptr(himl), - uintptr(hbmImage), - uintptr(hbmMask)) - - return int(ret) -} - -func ImageList_ReplaceIcon(himl HIMAGELIST, i int, hicon HICON) int { - ret, _, _ := procImageList_ReplaceIcon.Call( - uintptr(himl), - uintptr(i), - uintptr(hicon)) - - return int(ret) -} - -func ImageList_AddIcon(himl HIMAGELIST, hicon HICON) int { - return ImageList_ReplaceIcon(himl, -1, hicon) -} - -func ImageList_Remove(himl HIMAGELIST, i int) bool { - ret, _, _ := procImageList_Remove.Call( - uintptr(himl), - uintptr(i)) - - return ret != 0 -} - -func ImageList_RemoveAll(himl HIMAGELIST) bool { - return ImageList_Remove(himl, -1) -} - -func TrackMouseEvent(tme *TRACKMOUSEEVENT) bool { - ret, _, _ := procTrackMouseEvent.Call( - uintptr(unsafe.Pointer(tme))) - - return ret != 0 -} diff --git a/vendor/github.com/AllenDang/w32/comdlg32.go b/vendor/github.com/AllenDang/w32/comdlg32.go deleted file mode 100644 index 37bc985..0000000 --- a/vendor/github.com/AllenDang/w32/comdlg32.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "syscall" - "unsafe" -) - -var ( - modcomdlg32 = syscall.NewLazyDLL("comdlg32.dll") - - procGetSaveFileName = modcomdlg32.NewProc("GetSaveFileNameW") - procGetOpenFileName = modcomdlg32.NewProc("GetOpenFileNameW") - procCommDlgExtendedError = modcomdlg32.NewProc("CommDlgExtendedError") -) - -func GetOpenFileName(ofn *OPENFILENAME) bool { - ret, _, _ := procGetOpenFileName.Call( - uintptr(unsafe.Pointer(ofn))) - - return ret != 0 -} - -func GetSaveFileName(ofn *OPENFILENAME) bool { - ret, _, _ := procGetSaveFileName.Call( - uintptr(unsafe.Pointer(ofn))) - - return ret != 0 -} - -func CommDlgExtendedError() uint { - ret, _, _ := procCommDlgExtendedError.Call() - - return uint(ret) -} diff --git a/vendor/github.com/AllenDang/w32/constants.go b/vendor/github.com/AllenDang/w32/constants.go deleted file mode 100644 index 1775ca8..0000000 --- a/vendor/github.com/AllenDang/w32/constants.go +++ /dev/null @@ -1,2628 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -const ( - FALSE = 0 - TRUE = 1 -) - -const ( - NO_ERROR = 0 - ERROR_SUCCESS = 0 - ERROR_FILE_NOT_FOUND = 2 - ERROR_PATH_NOT_FOUND = 3 - ERROR_ACCESS_DENIED = 5 - ERROR_INVALID_HANDLE = 6 - ERROR_BAD_FORMAT = 11 - ERROR_INVALID_NAME = 123 - ERROR_MORE_DATA = 234 - ERROR_NO_MORE_ITEMS = 259 - ERROR_INVALID_SERVICE_CONTROL = 1052 - ERROR_SERVICE_REQUEST_TIMEOUT = 1053 - ERROR_SERVICE_NO_THREAD = 1054 - ERROR_SERVICE_DATABASE_LOCKED = 1055 - ERROR_SERVICE_ALREADY_RUNNING = 1056 - ERROR_SERVICE_DISABLED = 1058 - ERROR_SERVICE_DOES_NOT_EXIST = 1060 - ERROR_SERVICE_CANNOT_ACCEPT_CTRL = 1061 - ERROR_SERVICE_NOT_ACTIVE = 1062 - ERROR_DATABASE_DOES_NOT_EXIST = 1065 - ERROR_SERVICE_DEPENDENCY_FAIL = 1068 - ERROR_SERVICE_LOGON_FAILED = 1069 - ERROR_SERVICE_MARKED_FOR_DELETE = 1072 - ERROR_SERVICE_DEPENDENCY_DELETED = 1075 -) - -const ( - SE_ERR_FNF = 2 - SE_ERR_PNF = 3 - SE_ERR_ACCESSDENIED = 5 - SE_ERR_OOM = 8 - SE_ERR_DLLNOTFOUND = 32 - SE_ERR_SHARE = 26 - SE_ERR_ASSOCINCOMPLETE = 27 - SE_ERR_DDETIMEOUT = 28 - SE_ERR_DDEFAIL = 29 - SE_ERR_DDEBUSY = 30 - SE_ERR_NOASSOC = 31 -) - -const ( - CW_USEDEFAULT = ^0x7fffffff -) - -// ShowWindow constants -const ( - SW_HIDE = 0 - SW_NORMAL = 1 - SW_SHOWNORMAL = 1 - SW_SHOWMINIMIZED = 2 - SW_MAXIMIZE = 3 - SW_SHOWMAXIMIZED = 3 - SW_SHOWNOACTIVATE = 4 - SW_SHOW = 5 - SW_MINIMIZE = 6 - SW_SHOWMINNOACTIVE = 7 - SW_SHOWNA = 8 - SW_RESTORE = 9 - SW_SHOWDEFAULT = 10 - SW_FORCEMINIMIZE = 11 -) - -// Window class styles -const ( - CS_VREDRAW = 0x00000001 - CS_HREDRAW = 0x00000002 - CS_KEYCVTWINDOW = 0x00000004 - CS_DBLCLKS = 0x00000008 - CS_OWNDC = 0x00000020 - CS_CLASSDC = 0x00000040 - CS_PARENTDC = 0x00000080 - CS_NOKEYCVT = 0x00000100 - CS_NOCLOSE = 0x00000200 - CS_SAVEBITS = 0x00000800 - CS_BYTEALIGNCLIENT = 0x00001000 - CS_BYTEALIGNWINDOW = 0x00002000 - CS_GLOBALCLASS = 0x00004000 - CS_IME = 0x00010000 - CS_DROPSHADOW = 0x00020000 -) - -// Predefined cursor constants -const ( - IDC_ARROW = 32512 - IDC_IBEAM = 32513 - IDC_WAIT = 32514 - IDC_CROSS = 32515 - IDC_UPARROW = 32516 - IDC_SIZENWSE = 32642 - IDC_SIZENESW = 32643 - IDC_SIZEWE = 32644 - IDC_SIZENS = 32645 - IDC_SIZEALL = 32646 - IDC_NO = 32648 - IDC_HAND = 32649 - IDC_APPSTARTING = 32650 - IDC_HELP = 32651 - IDC_ICON = 32641 - IDC_SIZE = 32640 -) - -// Predefined icon constants -const ( - IDI_APPLICATION = 32512 - IDI_HAND = 32513 - IDI_QUESTION = 32514 - IDI_EXCLAMATION = 32515 - IDI_ASTERISK = 32516 - IDI_WINLOGO = 32517 - IDI_WARNING = IDI_EXCLAMATION - IDI_ERROR = IDI_HAND - IDI_INFORMATION = IDI_ASTERISK -) - -// Button style constants -const ( - BS_3STATE = 5 - BS_AUTO3STATE = 6 - BS_AUTOCHECKBOX = 3 - BS_AUTORADIOBUTTON = 9 - BS_BITMAP = 128 - BS_BOTTOM = 0X800 - BS_CENTER = 0X300 - BS_CHECKBOX = 2 - BS_DEFPUSHBUTTON = 1 - BS_GROUPBOX = 7 - BS_ICON = 64 - BS_LEFT = 256 - BS_LEFTTEXT = 32 - BS_MULTILINE = 0X2000 - BS_NOTIFY = 0X4000 - BS_OWNERDRAW = 0XB - BS_PUSHBUTTON = 0 - BS_PUSHLIKE = 4096 - BS_RADIOBUTTON = 4 - BS_RIGHT = 512 - BS_RIGHTBUTTON = 32 - BS_TEXT = 0 - BS_TOP = 0X400 - BS_USERBUTTON = 8 - BS_VCENTER = 0XC00 - BS_FLAT = 0X8000 -) - -// Button state constants -const ( - BST_CHECKED = 1 - BST_INDETERMINATE = 2 - BST_UNCHECKED = 0 - BST_FOCUS = 8 - BST_PUSHED = 4 -) - -// Predefined brushes constants -const ( - COLOR_3DDKSHADOW = 21 - COLOR_3DFACE = 15 - COLOR_3DHILIGHT = 20 - COLOR_3DHIGHLIGHT = 20 - COLOR_3DLIGHT = 22 - COLOR_BTNHILIGHT = 20 - COLOR_3DSHADOW = 16 - COLOR_ACTIVEBORDER = 10 - COLOR_ACTIVECAPTION = 2 - COLOR_APPWORKSPACE = 12 - COLOR_BACKGROUND = 1 - COLOR_DESKTOP = 1 - COLOR_BTNFACE = 15 - COLOR_BTNHIGHLIGHT = 20 - COLOR_BTNSHADOW = 16 - COLOR_BTNTEXT = 18 - COLOR_CAPTIONTEXT = 9 - COLOR_GRAYTEXT = 17 - COLOR_HIGHLIGHT = 13 - COLOR_HIGHLIGHTTEXT = 14 - COLOR_INACTIVEBORDER = 11 - COLOR_INACTIVECAPTION = 3 - COLOR_INACTIVECAPTIONTEXT = 19 - COLOR_INFOBK = 24 - COLOR_INFOTEXT = 23 - COLOR_MENU = 4 - COLOR_MENUTEXT = 7 - COLOR_SCROLLBAR = 0 - COLOR_WINDOW = 5 - COLOR_WINDOWFRAME = 6 - COLOR_WINDOWTEXT = 8 - COLOR_HOTLIGHT = 26 - COLOR_GRADIENTACTIVECAPTION = 27 - COLOR_GRADIENTINACTIVECAPTION = 28 -) - -// Button message constants -const ( - BM_CLICK = 245 - BM_GETCHECK = 240 - BM_GETIMAGE = 246 - BM_GETSTATE = 242 - BM_SETCHECK = 241 - BM_SETIMAGE = 247 - BM_SETSTATE = 243 - BM_SETSTYLE = 244 -) - -// Button notifications -const ( - BN_CLICKED = 0 - BN_PAINT = 1 - BN_HILITE = 2 - BN_PUSHED = BN_HILITE - BN_UNHILITE = 3 - BN_UNPUSHED = BN_UNHILITE - BN_DISABLE = 4 - BN_DOUBLECLICKED = 5 - BN_DBLCLK = BN_DOUBLECLICKED - BN_SETFOCUS = 6 - BN_KILLFOCUS = 7 -) - -// GetWindowLong and GetWindowLongPtr constants -const ( - GWL_EXSTYLE = -20 - GWL_STYLE = -16 - GWL_WNDPROC = -4 - GWLP_WNDPROC = -4 - GWL_HINSTANCE = -6 - GWLP_HINSTANCE = -6 - GWL_HWNDPARENT = -8 - GWLP_HWNDPARENT = -8 - GWL_ID = -12 - GWLP_ID = -12 - GWL_USERDATA = -21 - GWLP_USERDATA = -21 -) - -// Window style constants -const ( - WS_OVERLAPPED = 0X00000000 - WS_POPUP = 0X80000000 - WS_CHILD = 0X40000000 - WS_MINIMIZE = 0X20000000 - WS_VISIBLE = 0X10000000 - WS_DISABLED = 0X08000000 - WS_CLIPSIBLINGS = 0X04000000 - WS_CLIPCHILDREN = 0X02000000 - WS_MAXIMIZE = 0X01000000 - WS_CAPTION = 0X00C00000 - WS_BORDER = 0X00800000 - WS_DLGFRAME = 0X00400000 - WS_VSCROLL = 0X00200000 - WS_HSCROLL = 0X00100000 - WS_SYSMENU = 0X00080000 - WS_THICKFRAME = 0X00040000 - WS_GROUP = 0X00020000 - WS_TABSTOP = 0X00010000 - WS_MINIMIZEBOX = 0X00020000 - WS_MAXIMIZEBOX = 0X00010000 - WS_TILED = 0X00000000 - WS_ICONIC = 0X20000000 - WS_SIZEBOX = 0X00040000 - WS_OVERLAPPEDWINDOW = 0X00000000 | 0X00C00000 | 0X00080000 | 0X00040000 | 0X00020000 | 0X00010000 - WS_POPUPWINDOW = 0X80000000 | 0X00800000 | 0X00080000 - WS_CHILDWINDOW = 0X40000000 -) - -// Extended window style constants -const ( - WS_EX_DLGMODALFRAME = 0X00000001 - WS_EX_NOPARENTNOTIFY = 0X00000004 - WS_EX_TOPMOST = 0X00000008 - WS_EX_ACCEPTFILES = 0X00000010 - WS_EX_TRANSPARENT = 0X00000020 - WS_EX_MDICHILD = 0X00000040 - WS_EX_TOOLWINDOW = 0X00000080 - WS_EX_WINDOWEDGE = 0X00000100 - WS_EX_CLIENTEDGE = 0X00000200 - WS_EX_CONTEXTHELP = 0X00000400 - WS_EX_RIGHT = 0X00001000 - WS_EX_LEFT = 0X00000000 - WS_EX_RTLREADING = 0X00002000 - WS_EX_LTRREADING = 0X00000000 - WS_EX_LEFTSCROLLBAR = 0X00004000 - WS_EX_RIGHTSCROLLBAR = 0X00000000 - WS_EX_CONTROLPARENT = 0X00010000 - WS_EX_STATICEDGE = 0X00020000 - WS_EX_APPWINDOW = 0X00040000 - WS_EX_OVERLAPPEDWINDOW = 0X00000100 | 0X00000200 - WS_EX_PALETTEWINDOW = 0X00000100 | 0X00000080 | 0X00000008 - WS_EX_LAYERED = 0X00080000 - WS_EX_NOINHERITLAYOUT = 0X00100000 - WS_EX_LAYOUTRTL = 0X00400000 - WS_EX_NOACTIVATE = 0X08000000 -) - -// Window message constants -const ( - WM_APP = 32768 - WM_ACTIVATE = 6 - WM_ACTIVATEAPP = 28 - WM_AFXFIRST = 864 - WM_AFXLAST = 895 - WM_ASKCBFORMATNAME = 780 - WM_CANCELJOURNAL = 75 - WM_CANCELMODE = 31 - WM_CAPTURECHANGED = 533 - WM_CHANGECBCHAIN = 781 - WM_CHAR = 258 - WM_CHARTOITEM = 47 - WM_CHILDACTIVATE = 34 - WM_CLEAR = 771 - WM_CLOSE = 16 - WM_COMMAND = 273 - WM_COMMNOTIFY = 68 /* OBSOLETE */ - WM_COMPACTING = 65 - WM_COMPAREITEM = 57 - WM_CONTEXTMENU = 123 - WM_COPY = 769 - WM_COPYDATA = 74 - WM_CREATE = 1 - WM_CTLCOLORBTN = 309 - WM_CTLCOLORDLG = 310 - WM_CTLCOLOREDIT = 307 - WM_CTLCOLORLISTBOX = 308 - WM_CTLCOLORMSGBOX = 306 - WM_CTLCOLORSCROLLBAR = 311 - WM_CTLCOLORSTATIC = 312 - WM_CUT = 768 - WM_DEADCHAR = 259 - WM_DELETEITEM = 45 - WM_DESTROY = 2 - WM_DESTROYCLIPBOARD = 775 - WM_DEVICECHANGE = 537 - WM_DEVMODECHANGE = 27 - WM_DISPLAYCHANGE = 126 - WM_DRAWCLIPBOARD = 776 - WM_DRAWITEM = 43 - WM_DROPFILES = 563 - WM_ENABLE = 10 - WM_ENDSESSION = 22 - WM_ENTERIDLE = 289 - WM_ENTERMENULOOP = 529 - WM_ENTERSIZEMOVE = 561 - WM_ERASEBKGND = 20 - WM_EXITMENULOOP = 530 - WM_EXITSIZEMOVE = 562 - WM_FONTCHANGE = 29 - WM_GETDLGCODE = 135 - WM_GETFONT = 49 - WM_GETHOTKEY = 51 - WM_GETICON = 127 - WM_GETMINMAXINFO = 36 - WM_GETTEXT = 13 - WM_GETTEXTLENGTH = 14 - WM_HANDHELDFIRST = 856 - WM_HANDHELDLAST = 863 - WM_HELP = 83 - WM_HOTKEY = 786 - WM_HSCROLL = 276 - WM_HSCROLLCLIPBOARD = 782 - WM_ICONERASEBKGND = 39 - WM_INITDIALOG = 272 - WM_INITMENU = 278 - WM_INITMENUPOPUP = 279 - WM_INPUT = 0X00FF - WM_INPUTLANGCHANGE = 81 - WM_INPUTLANGCHANGEREQUEST = 80 - WM_KEYDOWN = 256 - WM_KEYUP = 257 - WM_KILLFOCUS = 8 - WM_MDIACTIVATE = 546 - WM_MDICASCADE = 551 - WM_MDICREATE = 544 - WM_MDIDESTROY = 545 - WM_MDIGETACTIVE = 553 - WM_MDIICONARRANGE = 552 - WM_MDIMAXIMIZE = 549 - WM_MDINEXT = 548 - WM_MDIREFRESHMENU = 564 - WM_MDIRESTORE = 547 - WM_MDISETMENU = 560 - WM_MDITILE = 550 - WM_MEASUREITEM = 44 - WM_GETOBJECT = 0X003D - WM_CHANGEUISTATE = 0X0127 - WM_UPDATEUISTATE = 0X0128 - WM_QUERYUISTATE = 0X0129 - WM_UNINITMENUPOPUP = 0X0125 - WM_MENURBUTTONUP = 290 - WM_MENUCOMMAND = 0X0126 - WM_MENUGETOBJECT = 0X0124 - WM_MENUDRAG = 0X0123 - WM_APPCOMMAND = 0X0319 - WM_MENUCHAR = 288 - WM_MENUSELECT = 287 - WM_MOVE = 3 - WM_MOVING = 534 - WM_NCACTIVATE = 134 - WM_NCCALCSIZE = 131 - WM_NCCREATE = 129 - WM_NCDESTROY = 130 - WM_NCHITTEST = 132 - WM_NCLBUTTONDBLCLK = 163 - WM_NCLBUTTONDOWN = 161 - WM_NCLBUTTONUP = 162 - WM_NCMBUTTONDBLCLK = 169 - WM_NCMBUTTONDOWN = 167 - WM_NCMBUTTONUP = 168 - WM_NCXBUTTONDOWN = 171 - WM_NCXBUTTONUP = 172 - WM_NCXBUTTONDBLCLK = 173 - WM_NCMOUSEHOVER = 0X02A0 - WM_NCMOUSELEAVE = 0X02A2 - WM_NCMOUSEMOVE = 160 - WM_NCPAINT = 133 - WM_NCRBUTTONDBLCLK = 166 - WM_NCRBUTTONDOWN = 164 - WM_NCRBUTTONUP = 165 - WM_NEXTDLGCTL = 40 - WM_NEXTMENU = 531 - WM_NOTIFY = 78 - WM_NOTIFYFORMAT = 85 - WM_NULL = 0 - WM_PAINT = 15 - WM_PAINTCLIPBOARD = 777 - WM_PAINTICON = 38 - WM_PALETTECHANGED = 785 - WM_PALETTEISCHANGING = 784 - WM_PARENTNOTIFY = 528 - WM_PASTE = 770 - WM_PENWINFIRST = 896 - WM_PENWINLAST = 911 - WM_POWER = 72 - WM_POWERBROADCAST = 536 - WM_PRINT = 791 - WM_PRINTCLIENT = 792 - WM_QUERYDRAGICON = 55 - WM_QUERYENDSESSION = 17 - WM_QUERYNEWPALETTE = 783 - WM_QUERYOPEN = 19 - WM_QUEUESYNC = 35 - WM_QUIT = 18 - WM_RENDERALLFORMATS = 774 - WM_RENDERFORMAT = 773 - WM_SETCURSOR = 32 - WM_SETFOCUS = 7 - WM_SETFONT = 48 - WM_SETHOTKEY = 50 - WM_SETICON = 128 - WM_SETREDRAW = 11 - WM_SETTEXT = 12 - WM_SETTINGCHANGE = 26 - WM_SHOWWINDOW = 24 - WM_SIZE = 5 - WM_SIZECLIPBOARD = 779 - WM_SIZING = 532 - WM_SPOOLERSTATUS = 42 - WM_STYLECHANGED = 125 - WM_STYLECHANGING = 124 - WM_SYSCHAR = 262 - WM_SYSCOLORCHANGE = 21 - WM_SYSCOMMAND = 274 - WM_SYSDEADCHAR = 263 - WM_SYSKEYDOWN = 260 - WM_SYSKEYUP = 261 - WM_TCARD = 82 - WM_THEMECHANGED = 794 - WM_TIMECHANGE = 30 - WM_TIMER = 275 - WM_UNDO = 772 - WM_USER = 1024 - WM_USERCHANGED = 84 - WM_VKEYTOITEM = 46 - WM_VSCROLL = 277 - WM_VSCROLLCLIPBOARD = 778 - WM_WINDOWPOSCHANGED = 71 - WM_WINDOWPOSCHANGING = 70 - WM_WININICHANGE = 26 - WM_KEYFIRST = 256 - WM_KEYLAST = 264 - WM_SYNCPAINT = 136 - WM_MOUSEACTIVATE = 33 - WM_MOUSEMOVE = 512 - WM_LBUTTONDOWN = 513 - WM_LBUTTONUP = 514 - WM_LBUTTONDBLCLK = 515 - WM_RBUTTONDOWN = 516 - WM_RBUTTONUP = 517 - WM_RBUTTONDBLCLK = 518 - WM_MBUTTONDOWN = 519 - WM_MBUTTONUP = 520 - WM_MBUTTONDBLCLK = 521 - WM_MOUSEWHEEL = 522 - WM_XBUTTONDOWN = 523 - WM_XBUTTONUP = 524 - WM_XBUTTONDBLCLK = 525 - WM_MOUSEHWHEEL = 526 - WM_MOUSEFIRST = 512 - WM_MOUSELAST = 526 - WM_MOUSEHOVER = 0X2A1 - WM_MOUSELEAVE = 0X2A3 - WM_CLIPBOARDUPDATE = 0x031D -) - -// WM_ACTIVATE -const ( - WA_INACTIVE = 0 - WA_ACTIVE = 1 - WA_CLICKACTIVE = 2 -) - -const LF_FACESIZE = 32 - -// Font weight constants -const ( - FW_DONTCARE = 0 - FW_THIN = 100 - FW_EXTRALIGHT = 200 - FW_ULTRALIGHT = FW_EXTRALIGHT - FW_LIGHT = 300 - FW_NORMAL = 400 - FW_REGULAR = 400 - FW_MEDIUM = 500 - FW_SEMIBOLD = 600 - FW_DEMIBOLD = FW_SEMIBOLD - FW_BOLD = 700 - FW_EXTRABOLD = 800 - FW_ULTRABOLD = FW_EXTRABOLD - FW_HEAVY = 900 - FW_BLACK = FW_HEAVY -) - -// Charset constants -const ( - ANSI_CHARSET = 0 - DEFAULT_CHARSET = 1 - SYMBOL_CHARSET = 2 - SHIFTJIS_CHARSET = 128 - HANGEUL_CHARSET = 129 - HANGUL_CHARSET = 129 - GB2312_CHARSET = 134 - CHINESEBIG5_CHARSET = 136 - GREEK_CHARSET = 161 - TURKISH_CHARSET = 162 - HEBREW_CHARSET = 177 - ARABIC_CHARSET = 178 - BALTIC_CHARSET = 186 - RUSSIAN_CHARSET = 204 - THAI_CHARSET = 222 - EASTEUROPE_CHARSET = 238 - OEM_CHARSET = 255 - JOHAB_CHARSET = 130 - VIETNAMESE_CHARSET = 163 - MAC_CHARSET = 77 -) - -// Font output precision constants -const ( - OUT_DEFAULT_PRECIS = 0 - OUT_STRING_PRECIS = 1 - OUT_CHARACTER_PRECIS = 2 - OUT_STROKE_PRECIS = 3 - OUT_TT_PRECIS = 4 - OUT_DEVICE_PRECIS = 5 - OUT_RASTER_PRECIS = 6 - OUT_TT_ONLY_PRECIS = 7 - OUT_OUTLINE_PRECIS = 8 - OUT_PS_ONLY_PRECIS = 10 -) - -// Font clipping precision constants -const ( - CLIP_DEFAULT_PRECIS = 0 - CLIP_CHARACTER_PRECIS = 1 - CLIP_STROKE_PRECIS = 2 - CLIP_MASK = 15 - CLIP_LH_ANGLES = 16 - CLIP_TT_ALWAYS = 32 - CLIP_EMBEDDED = 128 -) - -// Font output quality constants -const ( - DEFAULT_QUALITY = 0 - DRAFT_QUALITY = 1 - PROOF_QUALITY = 2 - NONANTIALIASED_QUALITY = 3 - ANTIALIASED_QUALITY = 4 - CLEARTYPE_QUALITY = 5 -) - -// Font pitch constants -const ( - DEFAULT_PITCH = 0 - FIXED_PITCH = 1 - VARIABLE_PITCH = 2 -) - -// Font family constants -const ( - FF_DECORATIVE = 80 - FF_DONTCARE = 0 - FF_MODERN = 48 - FF_ROMAN = 16 - FF_SCRIPT = 64 - FF_SWISS = 32 -) - -// DeviceCapabilities capabilities -const ( - DC_FIELDS = 1 - DC_PAPERS = 2 - DC_PAPERSIZE = 3 - DC_MINEXTENT = 4 - DC_MAXEXTENT = 5 - DC_BINS = 6 - DC_DUPLEX = 7 - DC_SIZE = 8 - DC_EXTRA = 9 - DC_VERSION = 10 - DC_DRIVER = 11 - DC_BINNAMES = 12 - DC_ENUMRESOLUTIONS = 13 - DC_FILEDEPENDENCIES = 14 - DC_TRUETYPE = 15 - DC_PAPERNAMES = 16 - DC_ORIENTATION = 17 - DC_COPIES = 18 - DC_BINADJUST = 19 - DC_EMF_COMPLIANT = 20 - DC_DATATYPE_PRODUCED = 21 - DC_COLLATE = 22 - DC_MANUFACTURER = 23 - DC_MODEL = 24 - DC_PERSONALITY = 25 - DC_PRINTRATE = 26 - DC_PRINTRATEUNIT = 27 - DC_PRINTERMEM = 28 - DC_MEDIAREADY = 29 - DC_STAPLE = 30 - DC_PRINTRATEPPM = 31 - DC_COLORDEVICE = 32 - DC_NUP = 33 - DC_MEDIATYPENAMES = 34 - DC_MEDIATYPES = 35 -) - -// GetDeviceCaps index constants -const ( - DRIVERVERSION = 0 - TECHNOLOGY = 2 - HORZSIZE = 4 - VERTSIZE = 6 - HORZRES = 8 - VERTRES = 10 - LOGPIXELSX = 88 - LOGPIXELSY = 90 - BITSPIXEL = 12 - PLANES = 14 - NUMBRUSHES = 16 - NUMPENS = 18 - NUMFONTS = 22 - NUMCOLORS = 24 - NUMMARKERS = 20 - ASPECTX = 40 - ASPECTY = 42 - ASPECTXY = 44 - PDEVICESIZE = 26 - CLIPCAPS = 36 - SIZEPALETTE = 104 - NUMRESERVED = 106 - COLORRES = 108 - PHYSICALWIDTH = 110 - PHYSICALHEIGHT = 111 - PHYSICALOFFSETX = 112 - PHYSICALOFFSETY = 113 - SCALINGFACTORX = 114 - SCALINGFACTORY = 115 - VREFRESH = 116 - DESKTOPHORZRES = 118 - DESKTOPVERTRES = 117 - BLTALIGNMENT = 119 - SHADEBLENDCAPS = 120 - COLORMGMTCAPS = 121 - RASTERCAPS = 38 - CURVECAPS = 28 - LINECAPS = 30 - POLYGONALCAPS = 32 - TEXTCAPS = 34 -) - -// GetDeviceCaps TECHNOLOGY constants -const ( - DT_PLOTTER = 0 - DT_RASDISPLAY = 1 - DT_RASPRINTER = 2 - DT_RASCAMERA = 3 - DT_CHARSTREAM = 4 - DT_METAFILE = 5 - DT_DISPFILE = 6 -) - -// GetDeviceCaps SHADEBLENDCAPS constants -const ( - SB_NONE = 0x00 - SB_CONST_ALPHA = 0x01 - SB_PIXEL_ALPHA = 0x02 - SB_PREMULT_ALPHA = 0x04 - SB_GRAD_RECT = 0x10 - SB_GRAD_TRI = 0x20 -) - -// GetDeviceCaps COLORMGMTCAPS constants -const ( - CM_NONE = 0x00 - CM_DEVICE_ICM = 0x01 - CM_GAMMA_RAMP = 0x02 - CM_CMYK_COLOR = 0x04 -) - -// GetDeviceCaps RASTERCAPS constants -const ( - RC_BANDING = 2 - RC_BITBLT = 1 - RC_BITMAP64 = 8 - RC_DI_BITMAP = 128 - RC_DIBTODEV = 512 - RC_FLOODFILL = 4096 - RC_GDI20_OUTPUT = 16 - RC_PALETTE = 256 - RC_SCALING = 4 - RC_STRETCHBLT = 2048 - RC_STRETCHDIB = 8192 - RC_DEVBITS = 0x8000 - RC_OP_DX_OUTPUT = 0x4000 -) - -// GetDeviceCaps CURVECAPS constants -const ( - CC_NONE = 0 - CC_CIRCLES = 1 - CC_PIE = 2 - CC_CHORD = 4 - CC_ELLIPSES = 8 - CC_WIDE = 16 - CC_STYLED = 32 - CC_WIDESTYLED = 64 - CC_INTERIORS = 128 - CC_ROUNDRECT = 256 -) - -// GetDeviceCaps LINECAPS constants -const ( - LC_NONE = 0 - LC_POLYLINE = 2 - LC_MARKER = 4 - LC_POLYMARKER = 8 - LC_WIDE = 16 - LC_STYLED = 32 - LC_WIDESTYLED = 64 - LC_INTERIORS = 128 -) - -// GetDeviceCaps POLYGONALCAPS constants -const ( - PC_NONE = 0 - PC_POLYGON = 1 - PC_POLYPOLYGON = 256 - PC_PATHS = 512 - PC_RECTANGLE = 2 - PC_WINDPOLYGON = 4 - PC_SCANLINE = 8 - PC_TRAPEZOID = 4 - PC_WIDE = 16 - PC_STYLED = 32 - PC_WIDESTYLED = 64 - PC_INTERIORS = 128 -) - -// GetDeviceCaps TEXTCAPS constants -const ( - TC_OP_CHARACTER = 1 - TC_OP_STROKE = 2 - TC_CP_STROKE = 4 - TC_CR_90 = 8 - TC_CR_ANY = 16 - TC_SF_X_YINDEP = 32 - TC_SA_DOUBLE = 64 - TC_SA_INTEGER = 128 - TC_SA_CONTIN = 256 - TC_EA_DOUBLE = 512 - TC_IA_ABLE = 1024 - TC_UA_ABLE = 2048 - TC_SO_ABLE = 4096 - TC_RA_ABLE = 8192 - TC_VA_ABLE = 16384 - TC_RESERVED = 32768 - TC_SCROLLBLT = 65536 -) - -// Static control styles -const ( - SS_BITMAP = 14 - SS_BLACKFRAME = 7 - SS_BLACKRECT = 4 - SS_CENTER = 1 - SS_CENTERIMAGE = 512 - SS_EDITCONTROL = 0x2000 - SS_ENHMETAFILE = 15 - SS_ETCHEDFRAME = 18 - SS_ETCHEDHORZ = 16 - SS_ETCHEDVERT = 17 - SS_GRAYFRAME = 8 - SS_GRAYRECT = 5 - SS_ICON = 3 - SS_LEFT = 0 - SS_LEFTNOWORDWRAP = 0xc - SS_NOPREFIX = 128 - SS_NOTIFY = 256 - SS_OWNERDRAW = 0xd - SS_REALSIZECONTROL = 0x040 - SS_REALSIZEIMAGE = 0x800 - SS_RIGHT = 2 - SS_RIGHTJUST = 0x400 - SS_SIMPLE = 11 - SS_SUNKEN = 4096 - SS_WHITEFRAME = 9 - SS_WHITERECT = 6 - SS_USERITEM = 10 - SS_TYPEMASK = 0x0000001F - SS_ENDELLIPSIS = 0x00004000 - SS_PATHELLIPSIS = 0x00008000 - SS_WORDELLIPSIS = 0x0000C000 - SS_ELLIPSISMASK = 0x0000C000 -) - -// Edit styles -const ( - ES_LEFT = 0x0000 - ES_CENTER = 0x0001 - ES_RIGHT = 0x0002 - ES_MULTILINE = 0x0004 - ES_UPPERCASE = 0x0008 - ES_LOWERCASE = 0x0010 - ES_PASSWORD = 0x0020 - ES_AUTOVSCROLL = 0x0040 - ES_AUTOHSCROLL = 0x0080 - ES_NOHIDESEL = 0x0100 - ES_OEMCONVERT = 0x0400 - ES_READONLY = 0x0800 - ES_WANTRETURN = 0x1000 - ES_NUMBER = 0x2000 -) - -// Edit notifications -const ( - EN_SETFOCUS = 0x0100 - EN_KILLFOCUS = 0x0200 - EN_CHANGE = 0x0300 - EN_UPDATE = 0x0400 - EN_ERRSPACE = 0x0500 - EN_MAXTEXT = 0x0501 - EN_HSCROLL = 0x0601 - EN_VSCROLL = 0x0602 - EN_ALIGN_LTR_EC = 0x0700 - EN_ALIGN_RTL_EC = 0x0701 -) - -// Edit messages -const ( - EM_GETSEL = 0x00B0 - EM_SETSEL = 0x00B1 - EM_GETRECT = 0x00B2 - EM_SETRECT = 0x00B3 - EM_SETRECTNP = 0x00B4 - EM_SCROLL = 0x00B5 - EM_LINESCROLL = 0x00B6 - EM_SCROLLCARET = 0x00B7 - EM_GETMODIFY = 0x00B8 - EM_SETMODIFY = 0x00B9 - EM_GETLINECOUNT = 0x00BA - EM_LINEINDEX = 0x00BB - EM_SETHANDLE = 0x00BC - EM_GETHANDLE = 0x00BD - EM_GETTHUMB = 0x00BE - EM_LINELENGTH = 0x00C1 - EM_REPLACESEL = 0x00C2 - EM_GETLINE = 0x00C4 - EM_LIMITTEXT = 0x00C5 - EM_CANUNDO = 0x00C6 - EM_UNDO = 0x00C7 - EM_FMTLINES = 0x00C8 - EM_LINEFROMCHAR = 0x00C9 - EM_SETTABSTOPS = 0x00CB - EM_SETPASSWORDCHAR = 0x00CC - EM_EMPTYUNDOBUFFER = 0x00CD - EM_GETFIRSTVISIBLELINE = 0x00CE - EM_SETREADONLY = 0x00CF - EM_SETWORDBREAKPROC = 0x00D0 - EM_GETWORDBREAKPROC = 0x00D1 - EM_GETPASSWORDCHAR = 0x00D2 - EM_SETMARGINS = 0x00D3 - EM_GETMARGINS = 0x00D4 - EM_SETLIMITTEXT = EM_LIMITTEXT - EM_GETLIMITTEXT = 0x00D5 - EM_POSFROMCHAR = 0x00D6 - EM_CHARFROMPOS = 0x00D7 - EM_SETIMESTATUS = 0x00D8 - EM_GETIMESTATUS = 0x00D9 - EM_SETCUEBANNER = 0x1501 - EM_GETCUEBANNER = 0x1502 -) - -const ( - CCM_FIRST = 0x2000 - CCM_LAST = CCM_FIRST + 0x200 - CCM_SETBKCOLOR = 8193 - CCM_SETCOLORSCHEME = 8194 - CCM_GETCOLORSCHEME = 8195 - CCM_GETDROPTARGET = 8196 - CCM_SETUNICODEFORMAT = 8197 - CCM_GETUNICODEFORMAT = 8198 - CCM_SETVERSION = 0x2007 - CCM_GETVERSION = 0x2008 - CCM_SETNOTIFYWINDOW = 0x2009 - CCM_SETWINDOWTHEME = 0x200b - CCM_DPISCALE = 0x200c -) - -// Common controls styles -const ( - CCS_TOP = 1 - CCS_NOMOVEY = 2 - CCS_BOTTOM = 3 - CCS_NORESIZE = 4 - CCS_NOPARENTALIGN = 8 - CCS_ADJUSTABLE = 32 - CCS_NODIVIDER = 64 - CCS_VERT = 128 - CCS_LEFT = 129 - CCS_NOMOVEX = 130 - CCS_RIGHT = 131 -) - -// ProgressBar messages -const ( - PROGRESS_CLASS = "msctls_progress32" - PBM_SETPOS = WM_USER + 2 - PBM_DELTAPOS = WM_USER + 3 - PBM_SETSTEP = WM_USER + 4 - PBM_STEPIT = WM_USER + 5 - PBM_SETRANGE32 = 1030 - PBM_GETRANGE = 1031 - PBM_GETPOS = 1032 - PBM_SETBARCOLOR = 1033 - PBM_SETBKCOLOR = CCM_SETBKCOLOR - PBS_SMOOTH = 1 - PBS_VERTICAL = 4 -) - -// GetOpenFileName and GetSaveFileName extended flags -const ( - OFN_EX_NOPLACESBAR = 0x00000001 -) - -// GetOpenFileName and GetSaveFileName flags -const ( - OFN_ALLOWMULTISELECT = 0x00000200 - OFN_CREATEPROMPT = 0x00002000 - OFN_DONTADDTORECENT = 0x02000000 - OFN_ENABLEHOOK = 0x00000020 - OFN_ENABLEINCLUDENOTIFY = 0x00400000 - OFN_ENABLESIZING = 0x00800000 - OFN_ENABLETEMPLATE = 0x00000040 - OFN_ENABLETEMPLATEHANDLE = 0x00000080 - OFN_EXPLORER = 0x00080000 - OFN_EXTENSIONDIFFERENT = 0x00000400 - OFN_FILEMUSTEXIST = 0x00001000 - OFN_FORCESHOWHIDDEN = 0x10000000 - OFN_HIDEREADONLY = 0x00000004 - OFN_LONGNAMES = 0x00200000 - OFN_NOCHANGEDIR = 0x00000008 - OFN_NODEREFERENCELINKS = 0x00100000 - OFN_NOLONGNAMES = 0x00040000 - OFN_NONETWORKBUTTON = 0x00020000 - OFN_NOREADONLYRETURN = 0x00008000 - OFN_NOTESTFILECREATE = 0x00010000 - OFN_NOVALIDATE = 0x00000100 - OFN_OVERWRITEPROMPT = 0x00000002 - OFN_PATHMUSTEXIST = 0x00000800 - OFN_READONLY = 0x00000001 - OFN_SHAREAWARE = 0x00004000 - OFN_SHOWHELP = 0x00000010 -) - -//SHBrowseForFolder flags -const ( - BIF_RETURNONLYFSDIRS = 0x00000001 - BIF_DONTGOBELOWDOMAIN = 0x00000002 - BIF_STATUSTEXT = 0x00000004 - BIF_RETURNFSANCESTORS = 0x00000008 - BIF_EDITBOX = 0x00000010 - BIF_VALIDATE = 0x00000020 - BIF_NEWDIALOGSTYLE = 0x00000040 - BIF_BROWSEINCLUDEURLS = 0x00000080 - BIF_USENEWUI = BIF_EDITBOX | BIF_NEWDIALOGSTYLE - BIF_UAHINT = 0x00000100 - BIF_NONEWFOLDERBUTTON = 0x00000200 - BIF_NOTRANSLATETARGETS = 0x00000400 - BIF_BROWSEFORCOMPUTER = 0x00001000 - BIF_BROWSEFORPRINTER = 0x00002000 - BIF_BROWSEINCLUDEFILES = 0x00004000 - BIF_SHAREABLE = 0x00008000 - BIF_BROWSEFILEJUNCTIONS = 0x00010000 -) - -//MessageBox flags -const ( - MB_OK = 0x00000000 - MB_OKCANCEL = 0x00000001 - MB_ABORTRETRYIGNORE = 0x00000002 - MB_YESNOCANCEL = 0x00000003 - MB_YESNO = 0x00000004 - MB_RETRYCANCEL = 0x00000005 - MB_CANCELTRYCONTINUE = 0x00000006 - MB_ICONHAND = 0x00000010 - MB_ICONQUESTION = 0x00000020 - MB_ICONEXCLAMATION = 0x00000030 - MB_ICONASTERISK = 0x00000040 - MB_USERICON = 0x00000080 - MB_ICONWARNING = MB_ICONEXCLAMATION - MB_ICONERROR = MB_ICONHAND - MB_ICONINFORMATION = MB_ICONASTERISK - MB_ICONSTOP = MB_ICONHAND - MB_DEFBUTTON1 = 0x00000000 - MB_DEFBUTTON2 = 0x00000100 - MB_DEFBUTTON3 = 0x00000200 - MB_DEFBUTTON4 = 0x00000300 -) - -//COM -const ( - E_INVALIDARG = 0x80070057 - E_OUTOFMEMORY = 0x8007000E - E_UNEXPECTED = 0x8000FFFF -) - -const ( - S_OK = 0 - S_FALSE = 0x0001 - RPC_E_CHANGED_MODE = 0x80010106 -) - -// GetSystemMetrics constants -const ( - SM_CXSCREEN = 0 - SM_CYSCREEN = 1 - SM_CXVSCROLL = 2 - SM_CYHSCROLL = 3 - SM_CYCAPTION = 4 - SM_CXBORDER = 5 - SM_CYBORDER = 6 - SM_CXDLGFRAME = 7 - SM_CYDLGFRAME = 8 - SM_CYVTHUMB = 9 - SM_CXHTHUMB = 10 - SM_CXICON = 11 - SM_CYICON = 12 - SM_CXCURSOR = 13 - SM_CYCURSOR = 14 - SM_CYMENU = 15 - SM_CXFULLSCREEN = 16 - SM_CYFULLSCREEN = 17 - SM_CYKANJIWINDOW = 18 - SM_MOUSEPRESENT = 19 - SM_CYVSCROLL = 20 - SM_CXHSCROLL = 21 - SM_DEBUG = 22 - SM_SWAPBUTTON = 23 - SM_RESERVED1 = 24 - SM_RESERVED2 = 25 - SM_RESERVED3 = 26 - SM_RESERVED4 = 27 - SM_CXMIN = 28 - SM_CYMIN = 29 - SM_CXSIZE = 30 - SM_CYSIZE = 31 - SM_CXFRAME = 32 - SM_CYFRAME = 33 - SM_CXMINTRACK = 34 - SM_CYMINTRACK = 35 - SM_CXDOUBLECLK = 36 - SM_CYDOUBLECLK = 37 - SM_CXICONSPACING = 38 - SM_CYICONSPACING = 39 - SM_MENUDROPALIGNMENT = 40 - SM_PENWINDOWS = 41 - SM_DBCSENABLED = 42 - SM_CMOUSEBUTTONS = 43 - SM_CXFIXEDFRAME = SM_CXDLGFRAME - SM_CYFIXEDFRAME = SM_CYDLGFRAME - SM_CXSIZEFRAME = SM_CXFRAME - SM_CYSIZEFRAME = SM_CYFRAME - SM_SECURE = 44 - SM_CXEDGE = 45 - SM_CYEDGE = 46 - SM_CXMINSPACING = 47 - SM_CYMINSPACING = 48 - SM_CXSMICON = 49 - SM_CYSMICON = 50 - SM_CYSMCAPTION = 51 - SM_CXSMSIZE = 52 - SM_CYSMSIZE = 53 - SM_CXMENUSIZE = 54 - SM_CYMENUSIZE = 55 - SM_ARRANGE = 56 - SM_CXMINIMIZED = 57 - SM_CYMINIMIZED = 58 - SM_CXMAXTRACK = 59 - SM_CYMAXTRACK = 60 - SM_CXMAXIMIZED = 61 - SM_CYMAXIMIZED = 62 - SM_NETWORK = 63 - SM_CLEANBOOT = 67 - SM_CXDRAG = 68 - SM_CYDRAG = 69 - SM_SHOWSOUNDS = 70 - SM_CXMENUCHECK = 71 - SM_CYMENUCHECK = 72 - SM_SLOWMACHINE = 73 - SM_MIDEASTENABLED = 74 - SM_MOUSEWHEELPRESENT = 75 - SM_XVIRTUALSCREEN = 76 - SM_YVIRTUALSCREEN = 77 - SM_CXVIRTUALSCREEN = 78 - SM_CYVIRTUALSCREEN = 79 - SM_CMONITORS = 80 - SM_SAMEDISPLAYFORMAT = 81 - SM_IMMENABLED = 82 - SM_CXFOCUSBORDER = 83 - SM_CYFOCUSBORDER = 84 - SM_TABLETPC = 86 - SM_MEDIACENTER = 87 - SM_STARTER = 88 - SM_SERVERR2 = 89 - SM_CMETRICS = 91 - SM_REMOTESESSION = 0x1000 - SM_SHUTTINGDOWN = 0x2000 - SM_REMOTECONTROL = 0x2001 - SM_CARETBLINKINGENABLED = 0x2002 -) - -const ( - CLSCTX_INPROC_SERVER = 1 - CLSCTX_INPROC_HANDLER = 2 - CLSCTX_LOCAL_SERVER = 4 - CLSCTX_INPROC_SERVER16 = 8 - CLSCTX_REMOTE_SERVER = 16 - CLSCTX_ALL = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER | CLSCTX_LOCAL_SERVER - CLSCTX_INPROC = CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER - CLSCTX_SERVER = CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER -) - -const ( - COINIT_APARTMENTTHREADED = 0x2 - COINIT_MULTITHREADED = 0x0 - COINIT_DISABLE_OLE1DDE = 0x4 - COINIT_SPEED_OVER_MEMORY = 0x8 -) - -const ( - DISPATCH_METHOD = 1 - DISPATCH_PROPERTYGET = 2 - DISPATCH_PROPERTYPUT = 4 - DISPATCH_PROPERTYPUTREF = 8 -) - -const ( - CC_FASTCALL = iota - CC_CDECL - CC_MSCPASCAL - CC_PASCAL = CC_MSCPASCAL - CC_MACPASCAL - CC_STDCALL - CC_FPFASTCALL - CC_SYSCALL - CC_MPWCDECL - CC_MPWPASCAL - CC_MAX = CC_MPWPASCAL -) - -const ( - VT_EMPTY = 0x0 - VT_NULL = 0x1 - VT_I2 = 0x2 - VT_I4 = 0x3 - VT_R4 = 0x4 - VT_R8 = 0x5 - VT_CY = 0x6 - VT_DATE = 0x7 - VT_BSTR = 0x8 - VT_DISPATCH = 0x9 - VT_ERROR = 0xa - VT_BOOL = 0xb - VT_VARIANT = 0xc - VT_UNKNOWN = 0xd - VT_DECIMAL = 0xe - VT_I1 = 0x10 - VT_UI1 = 0x11 - VT_UI2 = 0x12 - VT_UI4 = 0x13 - VT_I8 = 0x14 - VT_UI8 = 0x15 - VT_INT = 0x16 - VT_UINT = 0x17 - VT_VOID = 0x18 - VT_HRESULT = 0x19 - VT_PTR = 0x1a - VT_SAFEARRAY = 0x1b - VT_CARRAY = 0x1c - VT_USERDEFINED = 0x1d - VT_LPSTR = 0x1e - VT_LPWSTR = 0x1f - VT_RECORD = 0x24 - VT_INT_PTR = 0x25 - VT_UINT_PTR = 0x26 - VT_FILETIME = 0x40 - VT_BLOB = 0x41 - VT_STREAM = 0x42 - VT_STORAGE = 0x43 - VT_STREAMED_OBJECT = 0x44 - VT_STORED_OBJECT = 0x45 - VT_BLOB_OBJECT = 0x46 - VT_CF = 0x47 - VT_CLSID = 0x48 - VT_BSTR_BLOB = 0xfff - VT_VECTOR = 0x1000 - VT_ARRAY = 0x2000 - VT_BYREF = 0x4000 - VT_RESERVED = 0x8000 - VT_ILLEGAL = 0xffff - VT_ILLEGALMASKED = 0xfff - VT_TYPEMASK = 0xfff -) - -const ( - DISPID_UNKNOWN = -1 - DISPID_VALUE = 0 - DISPID_PROPERTYPUT = -3 - DISPID_NEWENUM = -4 - DISPID_EVALUATE = -5 - DISPID_CONSTRUCTOR = -6 - DISPID_DESTRUCTOR = -7 - DISPID_COLLECT = -8 -) - -const ( - MONITOR_DEFAULTTONULL = 0x00000000 - MONITOR_DEFAULTTOPRIMARY = 0x00000001 - MONITOR_DEFAULTTONEAREST = 0x00000002 - - MONITORINFOF_PRIMARY = 0x00000001 -) - -const ( - CCHDEVICENAME = 32 - CCHFORMNAME = 32 -) - -const ( - IDOK = 1 - IDCANCEL = 2 - IDABORT = 3 - IDRETRY = 4 - IDIGNORE = 5 - IDYES = 6 - IDNO = 7 - IDCLOSE = 8 - IDHELP = 9 - IDTRYAGAIN = 10 - IDCONTINUE = 11 - IDTIMEOUT = 32000 -) - -// Generic WM_NOTIFY notification codes -const ( - NM_FIRST = 0 - NM_OUTOFMEMORY = NM_FIRST - 1 - NM_CLICK = NM_FIRST - 2 - NM_DBLCLK = NM_FIRST - 3 - NM_RETURN = NM_FIRST - 4 - NM_RCLICK = NM_FIRST - 5 - NM_RDBLCLK = NM_FIRST - 6 - NM_SETFOCUS = NM_FIRST - 7 - NM_KILLFOCUS = NM_FIRST - 8 - NM_CUSTOMDRAW = NM_FIRST - 12 - NM_HOVER = NM_FIRST - 13 - NM_NCHITTEST = NM_FIRST - 14 - NM_KEYDOWN = NM_FIRST - 15 - NM_RELEASEDCAPTURE = NM_FIRST - 16 - NM_SETCURSOR = NM_FIRST - 17 - NM_CHAR = NM_FIRST - 18 - NM_TOOLTIPSCREATED = NM_FIRST - 19 - NM_LAST = NM_FIRST - 99 -) - -// ListView messages -const ( - LVM_FIRST = 0x1000 - LVM_GETITEMCOUNT = LVM_FIRST + 4 - LVM_SETIMAGELIST = LVM_FIRST + 3 - LVM_GETIMAGELIST = LVM_FIRST + 2 - LVM_GETITEM = LVM_FIRST + 75 - LVM_SETITEM = LVM_FIRST + 76 - LVM_INSERTITEM = LVM_FIRST + 77 - LVM_DELETEITEM = LVM_FIRST + 8 - LVM_DELETEALLITEMS = LVM_FIRST + 9 - LVM_GETCALLBACKMASK = LVM_FIRST + 10 - LVM_SETCALLBACKMASK = LVM_FIRST + 11 - LVM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT - LVM_GETNEXTITEM = LVM_FIRST + 12 - LVM_FINDITEM = LVM_FIRST + 83 - LVM_GETITEMRECT = LVM_FIRST + 14 - LVM_GETSTRINGWIDTH = LVM_FIRST + 87 - LVM_HITTEST = LVM_FIRST + 18 - LVM_ENSUREVISIBLE = LVM_FIRST + 19 - LVM_SCROLL = LVM_FIRST + 20 - LVM_REDRAWITEMS = LVM_FIRST + 21 - LVM_ARRANGE = LVM_FIRST + 22 - LVM_EDITLABEL = LVM_FIRST + 118 - LVM_GETEDITCONTROL = LVM_FIRST + 24 - LVM_GETCOLUMN = LVM_FIRST + 95 - LVM_SETCOLUMN = LVM_FIRST + 96 - LVM_INSERTCOLUMN = LVM_FIRST + 97 - LVM_DELETECOLUMN = LVM_FIRST + 28 - LVM_GETCOLUMNWIDTH = LVM_FIRST + 29 - LVM_SETCOLUMNWIDTH = LVM_FIRST + 30 - LVM_GETHEADER = LVM_FIRST + 31 - LVM_CREATEDRAGIMAGE = LVM_FIRST + 33 - LVM_GETVIEWRECT = LVM_FIRST + 34 - LVM_GETTEXTCOLOR = LVM_FIRST + 35 - LVM_SETTEXTCOLOR = LVM_FIRST + 36 - LVM_GETTEXTBKCOLOR = LVM_FIRST + 37 - LVM_SETTEXTBKCOLOR = LVM_FIRST + 38 - LVM_GETTOPINDEX = LVM_FIRST + 39 - LVM_GETCOUNTPERPAGE = LVM_FIRST + 40 - LVM_GETORIGIN = LVM_FIRST + 41 - LVM_UPDATE = LVM_FIRST + 42 - LVM_SETITEMSTATE = LVM_FIRST + 43 - LVM_GETITEMSTATE = LVM_FIRST + 44 - LVM_GETITEMTEXT = LVM_FIRST + 115 - LVM_SETITEMTEXT = LVM_FIRST + 116 - LVM_SETITEMCOUNT = LVM_FIRST + 47 - LVM_SORTITEMS = LVM_FIRST + 48 - LVM_SETITEMPOSITION32 = LVM_FIRST + 49 - LVM_GETSELECTEDCOUNT = LVM_FIRST + 50 - LVM_GETITEMSPACING = LVM_FIRST + 51 - LVM_GETISEARCHSTRING = LVM_FIRST + 117 - LVM_SETICONSPACING = LVM_FIRST + 53 - LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54 - LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55 - LVM_GETSUBITEMRECT = LVM_FIRST + 56 - LVM_SUBITEMHITTEST = LVM_FIRST + 57 - LVM_SETCOLUMNORDERARRAY = LVM_FIRST + 58 - LVM_GETCOLUMNORDERARRAY = LVM_FIRST + 59 - LVM_SETHOTITEM = LVM_FIRST + 60 - LVM_GETHOTITEM = LVM_FIRST + 61 - LVM_SETHOTCURSOR = LVM_FIRST + 62 - LVM_GETHOTCURSOR = LVM_FIRST + 63 - LVM_APPROXIMATEVIEWRECT = LVM_FIRST + 64 - LVM_SETWORKAREAS = LVM_FIRST + 65 - LVM_GETWORKAREAS = LVM_FIRST + 70 - LVM_GETNUMBEROFWORKAREAS = LVM_FIRST + 73 - LVM_GETSELECTIONMARK = LVM_FIRST + 66 - LVM_SETSELECTIONMARK = LVM_FIRST + 67 - LVM_SETHOVERTIME = LVM_FIRST + 71 - LVM_GETHOVERTIME = LVM_FIRST + 72 - LVM_SETTOOLTIPS = LVM_FIRST + 74 - LVM_GETTOOLTIPS = LVM_FIRST + 78 - LVM_SORTITEMSEX = LVM_FIRST + 81 - LVM_SETBKIMAGE = LVM_FIRST + 138 - LVM_GETBKIMAGE = LVM_FIRST + 139 - LVM_SETSELECTEDCOLUMN = LVM_FIRST + 140 - LVM_SETVIEW = LVM_FIRST + 142 - LVM_GETVIEW = LVM_FIRST + 143 - LVM_INSERTGROUP = LVM_FIRST + 145 - LVM_SETGROUPINFO = LVM_FIRST + 147 - LVM_GETGROUPINFO = LVM_FIRST + 149 - LVM_REMOVEGROUP = LVM_FIRST + 150 - LVM_MOVEGROUP = LVM_FIRST + 151 - LVM_GETGROUPCOUNT = LVM_FIRST + 152 - LVM_GETGROUPINFOBYINDEX = LVM_FIRST + 153 - LVM_MOVEITEMTOGROUP = LVM_FIRST + 154 - LVM_GETGROUPRECT = LVM_FIRST + 98 - LVM_SETGROUPMETRICS = LVM_FIRST + 155 - LVM_GETGROUPMETRICS = LVM_FIRST + 156 - LVM_ENABLEGROUPVIEW = LVM_FIRST + 157 - LVM_SORTGROUPS = LVM_FIRST + 158 - LVM_INSERTGROUPSORTED = LVM_FIRST + 159 - LVM_REMOVEALLGROUPS = LVM_FIRST + 160 - LVM_HASGROUP = LVM_FIRST + 161 - LVM_GETGROUPSTATE = LVM_FIRST + 92 - LVM_GETFOCUSEDGROUP = LVM_FIRST + 93 - LVM_SETTILEVIEWINFO = LVM_FIRST + 162 - LVM_GETTILEVIEWINFO = LVM_FIRST + 163 - LVM_SETTILEINFO = LVM_FIRST + 164 - LVM_GETTILEINFO = LVM_FIRST + 165 - LVM_SETINSERTMARK = LVM_FIRST + 166 - LVM_GETINSERTMARK = LVM_FIRST + 167 - LVM_INSERTMARKHITTEST = LVM_FIRST + 168 - LVM_GETINSERTMARKRECT = LVM_FIRST + 169 - LVM_SETINSERTMARKCOLOR = LVM_FIRST + 170 - LVM_GETINSERTMARKCOLOR = LVM_FIRST + 171 - LVM_SETINFOTIP = LVM_FIRST + 173 - LVM_GETSELECTEDCOLUMN = LVM_FIRST + 174 - LVM_ISGROUPVIEWENABLED = LVM_FIRST + 175 - LVM_GETOUTLINECOLOR = LVM_FIRST + 176 - LVM_SETOUTLINECOLOR = LVM_FIRST + 177 - LVM_CANCELEDITLABEL = LVM_FIRST + 179 - LVM_MAPINDEXTOID = LVM_FIRST + 180 - LVM_MAPIDTOINDEX = LVM_FIRST + 181 - LVM_ISITEMVISIBLE = LVM_FIRST + 182 - LVM_GETNEXTITEMINDEX = LVM_FIRST + 211 -) - -// ListView notifications -const ( - LVN_FIRST = -100 - - LVN_ITEMCHANGING = LVN_FIRST - 0 - LVN_ITEMCHANGED = LVN_FIRST - 1 - LVN_INSERTITEM = LVN_FIRST - 2 - LVN_DELETEITEM = LVN_FIRST - 3 - LVN_DELETEALLITEMS = LVN_FIRST - 4 - LVN_BEGINLABELEDITA = LVN_FIRST - 5 - LVN_BEGINLABELEDITW = LVN_FIRST - 75 - LVN_ENDLABELEDITA = LVN_FIRST - 6 - LVN_ENDLABELEDITW = LVN_FIRST - 76 - LVN_COLUMNCLICK = LVN_FIRST - 8 - LVN_BEGINDRAG = LVN_FIRST - 9 - LVN_BEGINRDRAG = LVN_FIRST - 11 - LVN_ODCACHEHINT = LVN_FIRST - 13 - LVN_ODFINDITEMA = LVN_FIRST - 52 - LVN_ODFINDITEMW = LVN_FIRST - 79 - LVN_ITEMACTIVATE = LVN_FIRST - 14 - LVN_ODSTATECHANGED = LVN_FIRST - 15 - LVN_HOTTRACK = LVN_FIRST - 21 - LVN_GETDISPINFO = LVN_FIRST - 77 - LVN_SETDISPINFO = LVN_FIRST - 78 - LVN_KEYDOWN = LVN_FIRST - 55 - LVN_MARQUEEBEGIN = LVN_FIRST - 56 - LVN_GETINFOTIP = LVN_FIRST - 58 - LVN_INCREMENTALSEARCH = LVN_FIRST - 63 - LVN_BEGINSCROLL = LVN_FIRST - 80 - LVN_ENDSCROLL = LVN_FIRST - 81 -) - -// ListView LVNI constants -const ( - LVNI_ALL = 0 - LVNI_FOCUSED = 1 - LVNI_SELECTED = 2 - LVNI_CUT = 4 - LVNI_DROPHILITED = 8 - LVNI_ABOVE = 256 - LVNI_BELOW = 512 - LVNI_TOLEFT = 1024 - LVNI_TORIGHT = 2048 -) - -// ListView styles -const ( - LVS_ICON = 0x0000 - LVS_REPORT = 0x0001 - LVS_SMALLICON = 0x0002 - LVS_LIST = 0x0003 - LVS_TYPEMASK = 0x0003 - LVS_SINGLESEL = 0x0004 - LVS_SHOWSELALWAYS = 0x0008 - LVS_SORTASCENDING = 0x0010 - LVS_SORTDESCENDING = 0x0020 - LVS_SHAREIMAGELISTS = 0x0040 - LVS_NOLABELWRAP = 0x0080 - LVS_AUTOARRANGE = 0x0100 - LVS_EDITLABELS = 0x0200 - LVS_OWNERDATA = 0x1000 - LVS_NOSCROLL = 0x2000 - LVS_TYPESTYLEMASK = 0xfc00 - LVS_ALIGNTOP = 0x0000 - LVS_ALIGNLEFT = 0x0800 - LVS_ALIGNMASK = 0x0c00 - LVS_OWNERDRAWFIXED = 0x0400 - LVS_NOCOLUMNHEADER = 0x4000 - LVS_NOSORTHEADER = 0x8000 -) - -// ListView extended styles -const ( - LVS_EX_GRIDLINES = 0x00000001 - LVS_EX_SUBITEMIMAGES = 0x00000002 - LVS_EX_CHECKBOXES = 0x00000004 - LVS_EX_TRACKSELECT = 0x00000008 - LVS_EX_HEADERDRAGDROP = 0x00000010 - LVS_EX_FULLROWSELECT = 0x00000020 - LVS_EX_ONECLICKACTIVATE = 0x00000040 - LVS_EX_TWOCLICKACTIVATE = 0x00000080 - LVS_EX_FLATSB = 0x00000100 - LVS_EX_REGIONAL = 0x00000200 - LVS_EX_INFOTIP = 0x00000400 - LVS_EX_UNDERLINEHOT = 0x00000800 - LVS_EX_UNDERLINECOLD = 0x00001000 - LVS_EX_MULTIWORKAREAS = 0x00002000 - LVS_EX_LABELTIP = 0x00004000 - LVS_EX_BORDERSELECT = 0x00008000 - LVS_EX_DOUBLEBUFFER = 0x00010000 - LVS_EX_HIDELABELS = 0x00020000 - LVS_EX_SINGLEROW = 0x00040000 - LVS_EX_SNAPTOGRID = 0x00080000 - LVS_EX_SIMPLESELECT = 0x00100000 -) - -// ListView column flags -const ( - LVCF_FMT = 0x0001 - LVCF_WIDTH = 0x0002 - LVCF_TEXT = 0x0004 - LVCF_SUBITEM = 0x0008 - LVCF_IMAGE = 0x0010 - LVCF_ORDER = 0x0020 -) - -// ListView column format constants -const ( - LVCFMT_LEFT = 0x0000 - LVCFMT_RIGHT = 0x0001 - LVCFMT_CENTER = 0x0002 - LVCFMT_JUSTIFYMASK = 0x0003 - LVCFMT_IMAGE = 0x0800 - LVCFMT_BITMAP_ON_RIGHT = 0x1000 - LVCFMT_COL_HAS_IMAGES = 0x8000 -) - -// ListView item flags -const ( - LVIF_TEXT = 0x00000001 - LVIF_IMAGE = 0x00000002 - LVIF_PARAM = 0x00000004 - LVIF_STATE = 0x00000008 - LVIF_INDENT = 0x00000010 - LVIF_NORECOMPUTE = 0x00000800 - LVIF_GROUPID = 0x00000100 - LVIF_COLUMNS = 0x00000200 -) - -// ListView item states -const ( - LVIS_FOCUSED = 1 - LVIS_SELECTED = 2 - LVIS_CUT = 4 - LVIS_DROPHILITED = 8 - LVIS_OVERLAYMASK = 0xF00 - LVIS_STATEIMAGEMASK = 0xF000 -) - -// ListView hit test constants -const ( - LVHT_NOWHERE = 0x00000001 - LVHT_ONITEMICON = 0x00000002 - LVHT_ONITEMLABEL = 0x00000004 - LVHT_ONITEMSTATEICON = 0x00000008 - LVHT_ONITEM = LVHT_ONITEMICON | LVHT_ONITEMLABEL | LVHT_ONITEMSTATEICON - - LVHT_ABOVE = 0x00000008 - LVHT_BELOW = 0x00000010 - LVHT_TORIGHT = 0x00000020 - LVHT_TOLEFT = 0x00000040 -) - -// ListView image list types -const ( - LVSIL_NORMAL = 0 - LVSIL_SMALL = 1 - LVSIL_STATE = 2 - LVSIL_GROUPHEADER = 3 -) - -// InitCommonControlsEx flags -const ( - ICC_LISTVIEW_CLASSES = 1 - ICC_TREEVIEW_CLASSES = 2 - ICC_BAR_CLASSES = 4 - ICC_TAB_CLASSES = 8 - ICC_UPDOWN_CLASS = 16 - ICC_PROGRESS_CLASS = 32 - ICC_HOTKEY_CLASS = 64 - ICC_ANIMATE_CLASS = 128 - ICC_WIN95_CLASSES = 255 - ICC_DATE_CLASSES = 256 - ICC_USEREX_CLASSES = 512 - ICC_COOL_CLASSES = 1024 - ICC_INTERNET_CLASSES = 2048 - ICC_PAGESCROLLER_CLASS = 4096 - ICC_NATIVEFNTCTL_CLASS = 8192 - INFOTIPSIZE = 1024 - ICC_STANDARD_CLASSES = 0x00004000 - ICC_LINK_CLASS = 0x00008000 -) - -// Dialog Codes -const ( - DLGC_WANTARROWS = 0x0001 - DLGC_WANTTAB = 0x0002 - DLGC_WANTALLKEYS = 0x0004 - DLGC_WANTMESSAGE = 0x0004 - DLGC_HASSETSEL = 0x0008 - DLGC_DEFPUSHBUTTON = 0x0010 - DLGC_UNDEFPUSHBUTTON = 0x0020 - DLGC_RADIOBUTTON = 0x0040 - DLGC_WANTCHARS = 0x0080 - DLGC_STATIC = 0x0100 - DLGC_BUTTON = 0x2000 -) - -// Get/SetWindowWord/Long offsets for use with WC_DIALOG windows -const ( - DWL_MSGRESULT = 0 - DWL_DLGPROC = 4 - DWL_USER = 8 -) - -// PeekMessage wRemoveMsg value -const ( - PM_NOREMOVE = 0x000 - PM_REMOVE = 0x001 - PM_NOYIELD = 0x002 -) - -// ImageList flags -const ( - ILC_MASK = 0x00000001 - ILC_COLOR = 0x00000000 - ILC_COLORDDB = 0x000000FE - ILC_COLOR4 = 0x00000004 - ILC_COLOR8 = 0x00000008 - ILC_COLOR16 = 0x00000010 - ILC_COLOR24 = 0x00000018 - ILC_COLOR32 = 0x00000020 - ILC_PALETTE = 0x00000800 - ILC_MIRROR = 0x00002000 - ILC_PERITEMMIRROR = 0x00008000 - ILC_ORIGINALSIZE = 0x00010000 - ILC_HIGHQUALITYSCALE = 0x00020000 -) - -// Keystroke Message Flags -const ( - KF_EXTENDED = 0x0100 - KF_DLGMODE = 0x0800 - KF_MENUMODE = 0x1000 - KF_ALTDOWN = 0x2000 - KF_REPEAT = 0x4000 - KF_UP = 0x8000 -) - -// Virtual-Key Codes -const ( - VK_LBUTTON = 0x01 - VK_RBUTTON = 0x02 - VK_CANCEL = 0x03 - VK_MBUTTON = 0x04 - VK_XBUTTON1 = 0x05 - VK_XBUTTON2 = 0x06 - VK_BACK = 0x08 - VK_TAB = 0x09 - VK_CLEAR = 0x0C - VK_RETURN = 0x0D - VK_SHIFT = 0x10 - VK_CONTROL = 0x11 - VK_MENU = 0x12 - VK_PAUSE = 0x13 - VK_CAPITAL = 0x14 - VK_KANA = 0x15 - VK_HANGEUL = 0x15 - VK_HANGUL = 0x15 - VK_JUNJA = 0x17 - VK_FINAL = 0x18 - VK_HANJA = 0x19 - VK_KANJI = 0x19 - VK_ESCAPE = 0x1B - VK_CONVERT = 0x1C - VK_NONCONVERT = 0x1D - VK_ACCEPT = 0x1E - VK_MODECHANGE = 0x1F - VK_SPACE = 0x20 - VK_PRIOR = 0x21 - VK_NEXT = 0x22 - VK_END = 0x23 - VK_HOME = 0x24 - VK_LEFT = 0x25 - VK_UP = 0x26 - VK_RIGHT = 0x27 - VK_DOWN = 0x28 - VK_SELECT = 0x29 - VK_PRINT = 0x2A - VK_EXECUTE = 0x2B - VK_SNAPSHOT = 0x2C - VK_INSERT = 0x2D - VK_DELETE = 0x2E - VK_HELP = 0x2F - VK_LWIN = 0x5B - VK_RWIN = 0x5C - VK_APPS = 0x5D - VK_SLEEP = 0x5F - VK_NUMPAD0 = 0x60 - VK_NUMPAD1 = 0x61 - VK_NUMPAD2 = 0x62 - VK_NUMPAD3 = 0x63 - VK_NUMPAD4 = 0x64 - VK_NUMPAD5 = 0x65 - VK_NUMPAD6 = 0x66 - VK_NUMPAD7 = 0x67 - VK_NUMPAD8 = 0x68 - VK_NUMPAD9 = 0x69 - VK_MULTIPLY = 0x6A - VK_ADD = 0x6B - VK_SEPARATOR = 0x6C - VK_SUBTRACT = 0x6D - VK_DECIMAL = 0x6E - VK_DIVIDE = 0x6F - VK_F1 = 0x70 - VK_F2 = 0x71 - VK_F3 = 0x72 - VK_F4 = 0x73 - VK_F5 = 0x74 - VK_F6 = 0x75 - VK_F7 = 0x76 - VK_F8 = 0x77 - VK_F9 = 0x78 - VK_F10 = 0x79 - VK_F11 = 0x7A - VK_F12 = 0x7B - VK_F13 = 0x7C - VK_F14 = 0x7D - VK_F15 = 0x7E - VK_F16 = 0x7F - VK_F17 = 0x80 - VK_F18 = 0x81 - VK_F19 = 0x82 - VK_F20 = 0x83 - VK_F21 = 0x84 - VK_F22 = 0x85 - VK_F23 = 0x86 - VK_F24 = 0x87 - VK_NUMLOCK = 0x90 - VK_SCROLL = 0x91 - VK_OEM_NEC_EQUAL = 0x92 - VK_OEM_FJ_JISHO = 0x92 - VK_OEM_FJ_MASSHOU = 0x93 - VK_OEM_FJ_TOUROKU = 0x94 - VK_OEM_FJ_LOYA = 0x95 - VK_OEM_FJ_ROYA = 0x96 - VK_LSHIFT = 0xA0 - VK_RSHIFT = 0xA1 - VK_LCONTROL = 0xA2 - VK_RCONTROL = 0xA3 - VK_LMENU = 0xA4 - VK_RMENU = 0xA5 - VK_BROWSER_BACK = 0xA6 - VK_BROWSER_FORWARD = 0xA7 - VK_BROWSER_REFRESH = 0xA8 - VK_BROWSER_STOP = 0xA9 - VK_BROWSER_SEARCH = 0xAA - VK_BROWSER_FAVORITES = 0xAB - VK_BROWSER_HOME = 0xAC - VK_VOLUME_MUTE = 0xAD - VK_VOLUME_DOWN = 0xAE - VK_VOLUME_UP = 0xAF - VK_MEDIA_NEXT_TRACK = 0xB0 - VK_MEDIA_PREV_TRACK = 0xB1 - VK_MEDIA_STOP = 0xB2 - VK_MEDIA_PLAY_PAUSE = 0xB3 - VK_LAUNCH_MAIL = 0xB4 - VK_LAUNCH_MEDIA_SELECT = 0xB5 - VK_LAUNCH_APP1 = 0xB6 - VK_LAUNCH_APP2 = 0xB7 - VK_OEM_1 = 0xBA - VK_OEM_PLUS = 0xBB - VK_OEM_COMMA = 0xBC - VK_OEM_MINUS = 0xBD - VK_OEM_PERIOD = 0xBE - VK_OEM_2 = 0xBF - VK_OEM_3 = 0xC0 - VK_OEM_4 = 0xDB - VK_OEM_5 = 0xDC - VK_OEM_6 = 0xDD - VK_OEM_7 = 0xDE - VK_OEM_8 = 0xDF - VK_OEM_AX = 0xE1 - VK_OEM_102 = 0xE2 - VK_ICO_HELP = 0xE3 - VK_ICO_00 = 0xE4 - VK_PROCESSKEY = 0xE5 - VK_ICO_CLEAR = 0xE6 - VK_PACKET = 0xE7 - VK_OEM_RESET = 0xE9 - VK_OEM_JUMP = 0xEA - VK_OEM_PA1 = 0xEB - VK_OEM_PA2 = 0xEC - VK_OEM_PA3 = 0xED - VK_OEM_WSCTRL = 0xEE - VK_OEM_CUSEL = 0xEF - VK_OEM_ATTN = 0xF0 - VK_OEM_FINISH = 0xF1 - VK_OEM_COPY = 0xF2 - VK_OEM_AUTO = 0xF3 - VK_OEM_ENLW = 0xF4 - VK_OEM_BACKTAB = 0xF5 - VK_ATTN = 0xF6 - VK_CRSEL = 0xF7 - VK_EXSEL = 0xF8 - VK_EREOF = 0xF9 - VK_PLAY = 0xFA - VK_ZOOM = 0xFB - VK_NONAME = 0xFC - VK_PA1 = 0xFD - VK_OEM_CLEAR = 0xFE -) - -// Registry Value Types -const ( - REG_NONE = 0 - REG_SZ = 1 - REG_EXPAND_SZ = 2 - REG_BINARY = 3 - REG_DWORD = 4 - REG_DWORD_LITTLE_ENDIAN = 4 - REG_DWORD_BIG_ENDIAN = 5 - REG_LINK = 6 - REG_MULTI_SZ = 7 - REG_RESOURCE_LIST = 8 - REG_FULL_RESOURCE_DESCRIPTOR = 9 - REG_RESOURCE_REQUIREMENTS_LIST = 10 - REG_QWORD = 11 - REG_QWORD_LITTLE_ENDIAN = 11 -) - -// Tooltip styles -const ( - TTS_ALWAYSTIP = 0x01 - TTS_NOPREFIX = 0x02 - TTS_NOANIMATE = 0x10 - TTS_NOFADE = 0x20 - TTS_BALLOON = 0x40 - TTS_CLOSE = 0x80 - TTS_USEVISUALSTYLE = 0x100 -) - -// Tooltip messages -const ( - TTM_ACTIVATE = (WM_USER + 1) - TTM_SETDELAYTIME = (WM_USER + 3) - TTM_ADDTOOL = (WM_USER + 50) - TTM_DELTOOL = (WM_USER + 51) - TTM_NEWTOOLRECT = (WM_USER + 52) - TTM_RELAYEVENT = (WM_USER + 7) - TTM_GETTOOLINFO = (WM_USER + 53) - TTM_SETTOOLINFO = (WM_USER + 54) - TTM_HITTEST = (WM_USER + 55) - TTM_GETTEXT = (WM_USER + 56) - TTM_UPDATETIPTEXT = (WM_USER + 57) - TTM_GETTOOLCOUNT = (WM_USER + 13) - TTM_ENUMTOOLS = (WM_USER + 58) - TTM_GETCURRENTTOOL = (WM_USER + 59) - TTM_WINDOWFROMPOINT = (WM_USER + 16) - TTM_TRACKACTIVATE = (WM_USER + 17) - TTM_TRACKPOSITION = (WM_USER + 18) - TTM_SETTIPBKCOLOR = (WM_USER + 19) - TTM_SETTIPTEXTCOLOR = (WM_USER + 20) - TTM_GETDELAYTIME = (WM_USER + 21) - TTM_GETTIPBKCOLOR = (WM_USER + 22) - TTM_GETTIPTEXTCOLOR = (WM_USER + 23) - TTM_SETMAXTIPWIDTH = (WM_USER + 24) - TTM_GETMAXTIPWIDTH = (WM_USER + 25) - TTM_SETMARGIN = (WM_USER + 26) - TTM_GETMARGIN = (WM_USER + 27) - TTM_POP = (WM_USER + 28) - TTM_UPDATE = (WM_USER + 29) - TTM_GETBUBBLESIZE = (WM_USER + 30) - TTM_ADJUSTRECT = (WM_USER + 31) - TTM_SETTITLE = (WM_USER + 33) - TTM_POPUP = (WM_USER + 34) - TTM_GETTITLE = (WM_USER + 35) -) - -// Tooltip icons -const ( - TTI_NONE = 0 - TTI_INFO = 1 - TTI_WARNING = 2 - TTI_ERROR = 3 - TTI_INFO_LARGE = 4 - TTI_WARNING_LARGE = 5 - TTI_ERROR_LARGE = 6 -) - -// Tooltip notifications -const ( - TTN_FIRST = -520 - TTN_LAST = -549 - TTN_GETDISPINFO = (TTN_FIRST - 10) - TTN_SHOW = (TTN_FIRST - 1) - TTN_POP = (TTN_FIRST - 2) - TTN_LINKCLICK = (TTN_FIRST - 3) - TTN_NEEDTEXT = TTN_GETDISPINFO -) - -const ( - TTF_IDISHWND = 0x0001 - TTF_CENTERTIP = 0x0002 - TTF_RTLREADING = 0x0004 - TTF_SUBCLASS = 0x0010 - TTF_TRACK = 0x0020 - TTF_ABSOLUTE = 0x0080 - TTF_TRANSPARENT = 0x0100 - TTF_PARSELINKS = 0x1000 - TTF_DI_SETITEM = 0x8000 -) - -const ( - SWP_NOSIZE = 0x0001 - SWP_NOMOVE = 0x0002 - SWP_NOZORDER = 0x0004 - SWP_NOREDRAW = 0x0008 - SWP_NOACTIVATE = 0x0010 - SWP_FRAMECHANGED = 0x0020 - SWP_SHOWWINDOW = 0x0040 - SWP_HIDEWINDOW = 0x0080 - SWP_NOCOPYBITS = 0x0100 - SWP_NOOWNERZORDER = 0x0200 - SWP_NOSENDCHANGING = 0x0400 - SWP_DRAWFRAME = SWP_FRAMECHANGED - SWP_NOREPOSITION = SWP_NOOWNERZORDER - SWP_DEFERERASE = 0x2000 - SWP_ASYNCWINDOWPOS = 0x4000 -) - -// Predefined window handles -const ( - HWND_BROADCAST = HWND(0xFFFF) - HWND_BOTTOM = HWND(1) - HWND_NOTOPMOST = ^HWND(1) // -2 - HWND_TOP = HWND(0) - HWND_TOPMOST = ^HWND(0) // -1 - HWND_DESKTOP = HWND(0) - HWND_MESSAGE = ^HWND(2) // -3 -) - -// Pen types -const ( - PS_COSMETIC = 0x00000000 - PS_GEOMETRIC = 0x00010000 - PS_TYPE_MASK = 0x000F0000 -) - -// Pen styles -const ( - PS_SOLID = 0 - PS_DASH = 1 - PS_DOT = 2 - PS_DASHDOT = 3 - PS_DASHDOTDOT = 4 - PS_NULL = 5 - PS_INSIDEFRAME = 6 - PS_USERSTYLE = 7 - PS_ALTERNATE = 8 - PS_STYLE_MASK = 0x0000000F -) - -// Pen cap types -const ( - PS_ENDCAP_ROUND = 0x00000000 - PS_ENDCAP_SQUARE = 0x00000100 - PS_ENDCAP_FLAT = 0x00000200 - PS_ENDCAP_MASK = 0x00000F00 -) - -// Pen join types -const ( - PS_JOIN_ROUND = 0x00000000 - PS_JOIN_BEVEL = 0x00001000 - PS_JOIN_MITER = 0x00002000 - PS_JOIN_MASK = 0x0000F000 -) - -// Hatch styles -const ( - HS_HORIZONTAL = 0 - HS_VERTICAL = 1 - HS_FDIAGONAL = 2 - HS_BDIAGONAL = 3 - HS_CROSS = 4 - HS_DIAGCROSS = 5 -) - -// Stock Logical Objects -const ( - WHITE_BRUSH = 0 - LTGRAY_BRUSH = 1 - GRAY_BRUSH = 2 - DKGRAY_BRUSH = 3 - BLACK_BRUSH = 4 - NULL_BRUSH = 5 - HOLLOW_BRUSH = NULL_BRUSH - WHITE_PEN = 6 - BLACK_PEN = 7 - NULL_PEN = 8 - OEM_FIXED_FONT = 10 - ANSI_FIXED_FONT = 11 - ANSI_VAR_FONT = 12 - SYSTEM_FONT = 13 - DEVICE_DEFAULT_FONT = 14 - DEFAULT_PALETTE = 15 - SYSTEM_FIXED_FONT = 16 - DEFAULT_GUI_FONT = 17 - DC_BRUSH = 18 - DC_PEN = 19 -) - -// Brush styles -const ( - BS_SOLID = 0 - BS_NULL = 1 - BS_HOLLOW = BS_NULL - BS_HATCHED = 2 - BS_PATTERN = 3 - BS_INDEXED = 4 - BS_DIBPATTERN = 5 - BS_DIBPATTERNPT = 6 - BS_PATTERN8X8 = 7 - BS_DIBPATTERN8X8 = 8 - BS_MONOPATTERN = 9 -) - -// TRACKMOUSEEVENT flags -const ( - TME_HOVER = 0x00000001 - TME_LEAVE = 0x00000002 - TME_NONCLIENT = 0x00000010 - TME_QUERY = 0x40000000 - TME_CANCEL = 0x80000000 - - HOVER_DEFAULT = 0xFFFFFFFF -) - -// WM_NCHITTEST and MOUSEHOOKSTRUCT Mouse Position Codes -const ( - HTERROR = (-2) - HTTRANSPARENT = (-1) - HTNOWHERE = 0 - HTCLIENT = 1 - HTCAPTION = 2 - HTSYSMENU = 3 - HTGROWBOX = 4 - HTSIZE = HTGROWBOX - HTMENU = 5 - HTHSCROLL = 6 - HTVSCROLL = 7 - HTMINBUTTON = 8 - HTMAXBUTTON = 9 - HTLEFT = 10 - HTRIGHT = 11 - HTTOP = 12 - HTTOPLEFT = 13 - HTTOPRIGHT = 14 - HTBOTTOM = 15 - HTBOTTOMLEFT = 16 - HTBOTTOMRIGHT = 17 - HTBORDER = 18 - HTREDUCE = HTMINBUTTON - HTZOOM = HTMAXBUTTON - HTSIZEFIRST = HTLEFT - HTSIZELAST = HTBOTTOMRIGHT - HTOBJECT = 19 - HTCLOSE = 20 - HTHELP = 21 -) - -// DrawText[Ex] format flags -const ( - DT_TOP = 0x00000000 - DT_LEFT = 0x00000000 - DT_CENTER = 0x00000001 - DT_RIGHT = 0x00000002 - DT_VCENTER = 0x00000004 - DT_BOTTOM = 0x00000008 - DT_WORDBREAK = 0x00000010 - DT_SINGLELINE = 0x00000020 - DT_EXPANDTABS = 0x00000040 - DT_TABSTOP = 0x00000080 - DT_NOCLIP = 0x00000100 - DT_EXTERNALLEADING = 0x00000200 - DT_CALCRECT = 0x00000400 - DT_NOPREFIX = 0x00000800 - DT_INTERNAL = 0x00001000 - DT_EDITCONTROL = 0x00002000 - DT_PATH_ELLIPSIS = 0x00004000 - DT_END_ELLIPSIS = 0x00008000 - DT_MODIFYSTRING = 0x00010000 - DT_RTLREADING = 0x00020000 - DT_WORD_ELLIPSIS = 0x00040000 - DT_NOFULLWIDTHCHARBREAK = 0x00080000 - DT_HIDEPREFIX = 0x00100000 - DT_PREFIXONLY = 0x00200000 -) - -const CLR_INVALID = 0xFFFFFFFF - -// Background Modes -const ( - TRANSPARENT = 1 - OPAQUE = 2 - BKMODE_LAST = 2 -) - -// Global Memory Flags -const ( - GMEM_FIXED = 0x0000 - GMEM_MOVEABLE = 0x0002 - GMEM_NOCOMPACT = 0x0010 - GMEM_NODISCARD = 0x0020 - GMEM_ZEROINIT = 0x0040 - GMEM_MODIFY = 0x0080 - GMEM_DISCARDABLE = 0x0100 - GMEM_NOT_BANKED = 0x1000 - GMEM_SHARE = 0x2000 - GMEM_DDESHARE = 0x2000 - GMEM_NOTIFY = 0x4000 - GMEM_LOWER = GMEM_NOT_BANKED - GMEM_VALID_FLAGS = 0x7F72 - GMEM_INVALID_HANDLE = 0x8000 - GHND = (GMEM_MOVEABLE | GMEM_ZEROINIT) - GPTR = (GMEM_FIXED | GMEM_ZEROINIT) -) - -// Ternary raster operations -const ( - SRCCOPY = 0x00CC0020 - SRCPAINT = 0x00EE0086 - SRCAND = 0x008800C6 - SRCINVERT = 0x00660046 - SRCERASE = 0x00440328 - NOTSRCCOPY = 0x00330008 - NOTSRCERASE = 0x001100A6 - MERGECOPY = 0x00C000CA - MERGEPAINT = 0x00BB0226 - PATCOPY = 0x00F00021 - PATPAINT = 0x00FB0A09 - PATINVERT = 0x005A0049 - DSTINVERT = 0x00550009 - BLACKNESS = 0x00000042 - WHITENESS = 0x00FF0062 - NOMIRRORBITMAP = 0x80000000 - CAPTUREBLT = 0x40000000 -) - -// Clipboard formats -const ( - CF_TEXT = 1 - CF_BITMAP = 2 - CF_METAFILEPICT = 3 - CF_SYLK = 4 - CF_DIF = 5 - CF_TIFF = 6 - CF_OEMTEXT = 7 - CF_DIB = 8 - CF_PALETTE = 9 - CF_PENDATA = 10 - CF_RIFF = 11 - CF_WAVE = 12 - CF_UNICODETEXT = 13 - CF_ENHMETAFILE = 14 - CF_HDROP = 15 - CF_LOCALE = 16 - CF_DIBV5 = 17 - CF_MAX = 18 - CF_OWNERDISPLAY = 0x0080 - CF_DSPTEXT = 0x0081 - CF_DSPBITMAP = 0x0082 - CF_DSPMETAFILEPICT = 0x0083 - CF_DSPENHMETAFILE = 0x008E - CF_PRIVATEFIRST = 0x0200 - CF_PRIVATELAST = 0x02FF - CF_GDIOBJFIRST = 0x0300 - CF_GDIOBJLAST = 0x03FF -) - -// Bitmap compression formats -const ( - BI_RGB = 0 - BI_RLE8 = 1 - BI_RLE4 = 2 - BI_BITFIELDS = 3 - BI_JPEG = 4 - BI_PNG = 5 -) - -// SetDIBitsToDevice fuColorUse -const ( - DIB_PAL_COLORS = 1 - DIB_RGB_COLORS = 0 -) - -const ( - STANDARD_RIGHTS_REQUIRED = 0x000F -) - -// MapVirtualKey maptypes -const ( - MAPVK_VK_TO_CHAR = 2 - MAPVK_VK_TO_VSC = 0 - MAPVK_VSC_TO_VK = 1 - MAPVK_VSC_TO_VK_EX = 3 -) - -// ReadEventLog Flags -const ( - EVENTLOG_SEEK_READ = 0x0002 - EVENTLOG_SEQUENTIAL_READ = 0x0001 - EVENTLOG_FORWARDS_READ = 0x0004 - EVENTLOG_BACKWARDS_READ = 0x0008 -) - -// CreateToolhelp32Snapshot flags -const ( - TH32CS_SNAPHEAPLIST = 0x00000001 - TH32CS_SNAPPROCESS = 0x00000002 - TH32CS_SNAPTHREAD = 0x00000004 - TH32CS_SNAPMODULE = 0x00000008 - TH32CS_SNAPMODULE32 = 0x00000010 - TH32CS_INHERIT = 0x80000000 - TH32CS_SNAPALL = TH32CS_SNAPHEAPLIST | TH32CS_SNAPMODULE | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD -) - -const ( - MAX_MODULE_NAME32 = 255 - MAX_PATH = 260 -) - -const ( - FOREGROUND_BLUE = 0x0001 - FOREGROUND_GREEN = 0x0002 - FOREGROUND_RED = 0x0004 - FOREGROUND_INTENSITY = 0x0008 - BACKGROUND_BLUE = 0x0010 - BACKGROUND_GREEN = 0x0020 - BACKGROUND_RED = 0x0040 - BACKGROUND_INTENSITY = 0x0080 - COMMON_LVB_LEADING_BYTE = 0x0100 - COMMON_LVB_TRAILING_BYTE = 0x0200 - COMMON_LVB_GRID_HORIZONTAL = 0x0400 - COMMON_LVB_GRID_LVERTICAL = 0x0800 - COMMON_LVB_GRID_RVERTICAL = 0x1000 - COMMON_LVB_REVERSE_VIDEO = 0x4000 - COMMON_LVB_UNDERSCORE = 0x8000 -) - -// Flags used by the DWM_BLURBEHIND structure to indicate -// which of its members contain valid information. -const ( - DWM_BB_ENABLE = 0x00000001 // A value for the fEnable member has been specified. - DWM_BB_BLURREGION = 0x00000002 // A value for the hRgnBlur member has been specified. - DWM_BB_TRANSITIONONMAXIMIZED = 0x00000004 // A value for the fTransitionOnMaximized member has been specified. -) - -// Flags used by the DwmEnableComposition function -// to change the state of Desktop Window Manager (DWM) composition. -const ( - DWM_EC_DISABLECOMPOSITION = 0 // Disable composition - DWM_EC_ENABLECOMPOSITION = 1 // Enable composition -) - -// enum-lite implementation for the following constant structure -type DWM_SHOWCONTACT int32 - -const ( - DWMSC_DOWN = 0x00000001 - DWMSC_UP = 0x00000002 - DWMSC_DRAG = 0x00000004 - DWMSC_HOLD = 0x00000008 - DWMSC_PENBARREL = 0x00000010 - DWMSC_NONE = 0x00000000 - DWMSC_ALL = 0xFFFFFFFF -) - -// enum-lite implementation for the following constant structure -type DWM_SOURCE_FRAME_SAMPLING int32 - -// TODO: need to verify this construction -// Flags used by the DwmSetPresentParameters function -// to specify the frame sampling type -const ( - DWM_SOURCE_FRAME_SAMPLING_POINT = iota + 1 - DWM_SOURCE_FRAME_SAMPLING_COVERAGE - DWM_SOURCE_FRAME_SAMPLING_LAST -) - -// Flags used by the DWM_THUMBNAIL_PROPERTIES structure to -// indicate which of its members contain valid information. -const ( - DWM_TNP_RECTDESTINATION = 0x00000001 // A value for the rcDestination member has been specified - DWM_TNP_RECTSOURCE = 0x00000002 // A value for the rcSource member has been specified - DWM_TNP_OPACITY = 0x00000004 // A value for the opacity member has been specified - DWM_TNP_VISIBLE = 0x00000008 // A value for the fVisible member has been specified - DWM_TNP_SOURCECLIENTAREAONLY = 0x00000010 // A value for the fSourceClientAreaOnly member has been specified -) - -// enum-lite implementation for the following constant structure -type DWMFLIP3DWINDOWPOLICY int32 - -// TODO: need to verify this construction -// Flags used by the DwmSetWindowAttribute function -// to specify the Flip3D window policy -const ( - DWMFLIP3D_DEFAULT = iota + 1 - DWMFLIP3D_EXCLUDEBELOW - DWMFLIP3D_EXCLUDEABOVE - DWMFLIP3D_LAST -) - -// enum-lite implementation for the following constant structure -type DWMNCRENDERINGPOLICY int32 - -// TODO: need to verify this construction -// Flags used by the DwmSetWindowAttribute function -// to specify the non-client area rendering policy -const ( - DWMNCRP_USEWINDOWSTYLE = iota + 1 - DWMNCRP_DISABLED - DWMNCRP_ENABLED - DWMNCRP_LAST -) - -// enum-lite implementation for the following constant structure -type DWMTRANSITION_OWNEDWINDOW_TARGET int32 - -const ( - DWMTRANSITION_OWNEDWINDOW_NULL = -1 - DWMTRANSITION_OWNEDWINDOW_REPOSITION = 0 -) - -// enum-lite implementation for the following constant structure -type DWMWINDOWATTRIBUTE int32 - -// TODO: need to verify this construction -// Flags used by the DwmGetWindowAttribute and DwmSetWindowAttribute functions -// to specify window attributes for non-client rendering -const ( - DWMWA_NCRENDERING_ENABLED = iota + 1 - DWMWA_NCRENDERING_POLICY - DWMWA_TRANSITIONS_FORCEDISABLED - DWMWA_ALLOW_NCPAINT - DWMWA_CAPTION_BUTTON_BOUNDS - DWMWA_NONCLIENT_RTL_LAYOUT - DWMWA_FORCE_ICONIC_REPRESENTATION - DWMWA_FLIP3D_POLICY - DWMWA_EXTENDED_FRAME_BOUNDS - DWMWA_HAS_ICONIC_BITMAP - DWMWA_DISALLOW_PEEK - DWMWA_EXCLUDED_FROM_PEEK - DWMWA_CLOAK - DWMWA_CLOAKED - DWMWA_FREEZE_REPRESENTATION - DWMWA_LAST -) - -// enum-lite implementation for the following constant structure -type GESTURE_TYPE int32 - -// TODO: use iota? -// Identifies the gesture type -const ( - GT_PEN_TAP = 0 - GT_PEN_DOUBLETAP = 1 - GT_PEN_RIGHTTAP = 2 - GT_PEN_PRESSANDHOLD = 3 - GT_PEN_PRESSANDHOLDABORT = 4 - GT_TOUCH_TAP = 5 - GT_TOUCH_DOUBLETAP = 6 - GT_TOUCH_RIGHTTAP = 7 - GT_TOUCH_PRESSANDHOLD = 8 - GT_TOUCH_PRESSANDHOLDABORT = 9 - GT_TOUCH_PRESSANDTAP = 10 -) - -// Icons -const ( - ICON_SMALL = 0 - ICON_BIG = 1 - ICON_SMALL2 = 2 -) - -const ( - SIZE_RESTORED = 0 - SIZE_MINIMIZED = 1 - SIZE_MAXIMIZED = 2 - SIZE_MAXSHOW = 3 - SIZE_MAXHIDE = 4 -) - -// XButton values -const ( - XBUTTON1 = 1 - XBUTTON2 = 2 -) - -// Devmode -const ( - DM_SPECVERSION = 0x0401 - - DM_ORIENTATION = 0x00000001 - DM_PAPERSIZE = 0x00000002 - DM_PAPERLENGTH = 0x00000004 - DM_PAPERWIDTH = 0x00000008 - DM_SCALE = 0x00000010 - DM_POSITION = 0x00000020 - DM_NUP = 0x00000040 - DM_DISPLAYORIENTATION = 0x00000080 - DM_COPIES = 0x00000100 - DM_DEFAULTSOURCE = 0x00000200 - DM_PRINTQUALITY = 0x00000400 - DM_COLOR = 0x00000800 - DM_DUPLEX = 0x00001000 - DM_YRESOLUTION = 0x00002000 - DM_TTOPTION = 0x00004000 - DM_COLLATE = 0x00008000 - DM_FORMNAME = 0x00010000 - DM_LOGPIXELS = 0x00020000 - DM_BITSPERPEL = 0x00040000 - DM_PELSWIDTH = 0x00080000 - DM_PELSHEIGHT = 0x00100000 - DM_DISPLAYFLAGS = 0x00200000 - DM_DISPLAYFREQUENCY = 0x00400000 - DM_ICMMETHOD = 0x00800000 - DM_ICMINTENT = 0x01000000 - DM_MEDIATYPE = 0x02000000 - DM_DITHERTYPE = 0x04000000 - DM_PANNINGWIDTH = 0x08000000 - DM_PANNINGHEIGHT = 0x10000000 - DM_DISPLAYFIXEDOUTPUT = 0x20000000 -) - -// ChangeDisplaySettings -const ( - CDS_UPDATEREGISTRY = 0x00000001 - CDS_TEST = 0x00000002 - CDS_FULLSCREEN = 0x00000004 - CDS_GLOBAL = 0x00000008 - CDS_SET_PRIMARY = 0x00000010 - CDS_VIDEOPARAMETERS = 0x00000020 - CDS_RESET = 0x40000000 - CDS_NORESET = 0x10000000 - - DISP_CHANGE_SUCCESSFUL = 0 - DISP_CHANGE_RESTART = 1 - DISP_CHANGE_FAILED = -1 - DISP_CHANGE_BADMODE = -2 - DISP_CHANGE_NOTUPDATED = -3 - DISP_CHANGE_BADFLAGS = -4 - DISP_CHANGE_BADPARAM = -5 - DISP_CHANGE_BADDUALVIEW = -6 -) - -const ( - ENUM_CURRENT_SETTINGS = 0xFFFFFFFF - ENUM_REGISTRY_SETTINGS = 0xFFFFFFFE -) - -// PIXELFORMATDESCRIPTOR -const ( - PFD_TYPE_RGBA = 0 - PFD_TYPE_COLORINDEX = 1 - - PFD_MAIN_PLANE = 0 - PFD_OVERLAY_PLANE = 1 - PFD_UNDERLAY_PLANE = -1 - - PFD_DOUBLEBUFFER = 0x00000001 - PFD_STEREO = 0x00000002 - PFD_DRAW_TO_WINDOW = 0x00000004 - PFD_DRAW_TO_BITMAP = 0x00000008 - PFD_SUPPORT_GDI = 0x00000010 - PFD_SUPPORT_OPENGL = 0x00000020 - PFD_GENERIC_FORMAT = 0x00000040 - PFD_NEED_PALETTE = 0x00000080 - PFD_NEED_SYSTEM_PALETTE = 0x00000100 - PFD_SWAP_EXCHANGE = 0x00000200 - PFD_SWAP_COPY = 0x00000400 - PFD_SWAP_LAYER_BUFFERS = 0x00000800 - PFD_GENERIC_ACCELERATED = 0x00001000 - PFD_SUPPORT_DIRECTDRAW = 0x00002000 - PFD_DIRECT3D_ACCELERATED = 0x00004000 - PFD_SUPPORT_COMPOSITION = 0x00008000 - - PFD_DEPTH_DONTCARE = 0x20000000 - PFD_DOUBLEBUFFER_DONTCARE = 0x40000000 - PFD_STEREO_DONTCARE = 0x80000000 -) - -const ( - INPUT_MOUSE = 0 - INPUT_KEYBOARD = 1 - INPUT_HARDWARE = 2 -) - -const ( - MOUSEEVENTF_ABSOLUTE = 0x8000 - MOUSEEVENTF_HWHEEL = 0x01000 - MOUSEEVENTF_MOVE = 0x0001 - MOUSEEVENTF_MOVE_NOCOALESCE = 0x2000 - MOUSEEVENTF_LEFTDOWN = 0x0002 - MOUSEEVENTF_LEFTUP = 0x0004 - MOUSEEVENTF_RIGHTDOWN = 0x0008 - MOUSEEVENTF_RIGHTUP = 0x0010 - MOUSEEVENTF_MIDDLEDOWN = 0x0020 - MOUSEEVENTF_MIDDLEUP = 0x0040 - MOUSEEVENTF_VIRTUALDESK = 0x4000 - MOUSEEVENTF_WHEEL = 0x0800 - MOUSEEVENTF_XDOWN = 0x0080 - MOUSEEVENTF_XUP = 0x0100 -) - -// Windows Hooks (WH_*) -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms644990(v=vs.85).aspx -const ( - WH_CALLWNDPROC = 4 - WH_CALLWNDPROCRET = 12 - WH_CBT = 5 - WH_DEBUG = 9 - WH_FOREGROUNDIDLE = 11 - WH_GETMESSAGE = 3 - WH_JOURNALPLAYBACK = 1 - WH_JOURNALRECORD = 0 - WH_KEYBOARD = 2 - WH_KEYBOARD_LL = 13 - WH_MOUSE = 7 - WH_MOUSE_LL = 14 - WH_MSGFILTER = -1 - WH_SHELL = 10 - WH_SYSMSGFILTER = 6 -) - -const ( - MEM_COMMIT = 0x00001000 - MEM_RESERVE = 0x00002000 - MEM_RESET = 0x00080000 - MEM_RESET_UNDO = 0x1000000 - - MEM_LARGE_PAGES = 0x20000000 - MEM_PHYSICAL = 0x00400000 - MEM_TOP_DOWN = 0x00100000 - - MEM_DECOMMIT = 0x4000 - MEM_RELEASE = 0x8000 -) - -const ( - PROCESS_CREATE_PROCESS = 0x0080 - PROCESS_CREATE_THREAD = 0x0002 - PROCESS_DUP_HANDLE = 0x0040 - PROCESS_QUERY_INFORMATION = 0x0400 - PROCESS_QUERY_LIMITED_INFORMATION = 0x1000 - PROCESS_SET_INFORMATION = 0x0200 - PROCESS_SET_QUOTA = 0x0100 - PROCESS_SUSPEND_RESUME = 0x0800 - PROCESS_TERMINATE = 0x0001 - PROCESS_VM_OPERATION = 0x0008 - PROCESS_VM_READ = 0x0010 - PROCESS_VM_WRITE = 0x0020 - SYNCHRONIZE = 0x00100000 -) - -const ( - PAGE_EXECUTE = 0x10 - PAGE_EXECUTE_READ = 0x20 - PAGE_EXECUTE_READWRITE = 0x40 - PAGE_EXECUTE_WRITECOPY = 0x80 - PAGE_NOACCESS = 0x01 - PAGE_READWRITE = 0x04 - PAGE_WRITECOPY = 0x08 - PAGE_TARGETS_INVALID = 0x40000000 - PAGE_TARGETS_NO_UPDATE = 0x40000000 -) - -// SendMessageTimeout Flags -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms644952(v=vs.85).aspx -const ( - SMTO_ABORTIFHUNG = 0x0002 - SMTO_BLOCK = 0x0001 - SMTO_NORMAL = 0x0000 - SMTO_NOTIMEOUTIFNOTHUNG = 0x0008 - SMTO_ERRORONEXIT = 0x0020 -) - -// RedrawWindow Flags -const ( - RDW_ERASE = 4 - RDW_ALLCHILDREN = 0x80 - RDW_ERASENOW = 0x200 - RDW_FRAME = 0x400 - RDW_INTERNALPAINT = 2 - RDW_INVALIDATE = 1 - RDW_NOCHILDREN = 0x40 - RDW_NOERASE = 0x20 - RDW_NOFRAME = 0x800 - RDW_NOINTERNALPAINT = 0x10 - RDW_UPDATENOW = 0x100 - RDW_VALIDATE = 8 -) diff --git a/vendor/github.com/AllenDang/w32/create_process.go b/vendor/github.com/AllenDang/w32/create_process.go deleted file mode 100644 index 9caf9ff..0000000 --- a/vendor/github.com/AllenDang/w32/create_process.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "syscall" - "unsafe" -) - -var ( - kernel32 = syscall.NewLazyDLL("kernel32.dll") - - procCreateProcessW = kernel32.NewProc("CreateProcessW") - procTerminateProcess = kernel32.NewProc("TerminateProcess") - procGetExitCodeProcess = kernel32.NewProc("GetExitCodeProcess") - procWaitForSingleObject = kernel32.NewProc("WaitForSingleObject") -) - -// WINBASEAPI WINBOOL WINAPI -// CreateProcessW ( -// LPCWSTR lpApplicationName, -// LPWSTR lpCommandLine, -// LPSECURITY_ATTRIBUTES lpProcessAttributes, -// LPSECURITY_ATTRIBUTES lpThreadAttributes -// WINBOOL bInheritHandles -// DWORD dwCreationFlags -// LPVOID lpEnvironment -// LPCWSTR lpCurrentDirectory -// LPSTARTUPINFOW lpStartupInfo -// LPPROCESS_INFORMATION lpProcessInformation -//); -func CreateProcessW( - lpApplicationName, lpCommandLine string, - lpProcessAttributes, lpThreadAttributes *SECURITY_ATTRIBUTES, - bInheritHandles BOOL, - dwCreationFlags uint32, - lpEnvironment unsafe.Pointer, - lpCurrentDirectory string, - lpStartupInfo *STARTUPINFOW, - lpProcessInformation *PROCESS_INFORMATION, -) (e error) { - - var lpAN, lpCL, lpCD *uint16 - if len(lpApplicationName) > 0 { - lpAN, e = syscall.UTF16PtrFromString(lpApplicationName) - if e != nil { - return - } - } - if len(lpCommandLine) > 0 { - lpCL, e = syscall.UTF16PtrFromString(lpCommandLine) - if e != nil { - return - } - } - if len(lpCurrentDirectory) > 0 { - lpCD, e = syscall.UTF16PtrFromString(lpCurrentDirectory) - if e != nil { - return - } - } - - ret, _, lastErr := procCreateProcessW.Call( - uintptr(unsafe.Pointer(lpAN)), - uintptr(unsafe.Pointer(lpCL)), - uintptr(unsafe.Pointer(lpProcessAttributes)), - uintptr(unsafe.Pointer(lpProcessInformation)), - uintptr(bInheritHandles), - uintptr(dwCreationFlags), - uintptr(lpEnvironment), - uintptr(unsafe.Pointer(lpCD)), - uintptr(unsafe.Pointer(lpStartupInfo)), - uintptr(unsafe.Pointer(lpProcessInformation)), - ) - - if ret == 0 { - e = lastErr - } - - return -} - -func CreateProcessQuick(cmd string) (pi PROCESS_INFORMATION, e error) { - si := &STARTUPINFOW{} - e = CreateProcessW( - "", - cmd, - nil, - nil, - 0, - 0, - unsafe.Pointer(nil), - "", - si, - &pi, - ) - return -} - -func TerminateProcess(hProcess HANDLE, exitCode uint32) (e error) { - ret, _, lastErr := procTerminateProcess.Call( - uintptr(hProcess), - uintptr(exitCode), - ) - - if ret == 0 { - e = lastErr - } - - return -} - -func GetExitCodeProcess(hProcess HANDLE) (code uintptr, e error) { - ret, _, lastErr := procGetExitCodeProcess.Call( - uintptr(hProcess), - uintptr(unsafe.Pointer(&code)), - ) - - if ret == 0 { - e = lastErr - } - - return -} - -// DWORD WINAPI WaitForSingleObject( -// _In_ HANDLE hHandle, -// _In_ DWORD dwMilliseconds -// ); - -func WaitForSingleObject(hHandle HANDLE, msecs uint32) (ok bool, e error) { - - ret, _, lastErr := procWaitForSingleObject.Call( - uintptr(hHandle), - uintptr(msecs), - ) - - if ret == WAIT_OBJECT_0 { - ok = true - return - } - - // don't set e for timeouts, or it will be ERROR_SUCCESS which is - // confusing - if ret != WAIT_TIMEOUT { - e = lastErr - } - return - -} diff --git a/vendor/github.com/AllenDang/w32/create_process_constants.go b/vendor/github.com/AllenDang/w32/create_process_constants.go deleted file mode 100644 index c37d7e5..0000000 --- a/vendor/github.com/AllenDang/w32/create_process_constants.go +++ /dev/null @@ -1,9 +0,0 @@ -package w32 - -const ( - WAIT_ABANDONED = 0x00000080 - WAIT_OBJECT_0 = 0x00000000 - WAIT_TIMEOUT = 0x00000102 - WAIT_FAILED = 0xFFFFFFFF - INFINITE = 0xFFFFFFFF -) diff --git a/vendor/github.com/AllenDang/w32/create_process_test.go b/vendor/github.com/AllenDang/w32/create_process_test.go deleted file mode 100644 index 7e64b1d..0000000 --- a/vendor/github.com/AllenDang/w32/create_process_test.go +++ /dev/null @@ -1,47 +0,0 @@ -package w32 - -import ( - "testing" -) - -var testProcess = "notepad.exe" -var wantCode = uint32(42) - -func TestCreateProcess(t *testing.T) { - - pi, err := CreateProcessQuick(testProcess) - if err != nil { - t.Errorf("[!!] Failed to create %s: %s", testProcess, err) - } else { - t.Logf("[OK] Created process %s with handle 0x%x, PID %d", testProcess, pi.Process, pi.ProcessId) - } - - err = TerminateProcess(pi.Process, wantCode) - if err != nil { - t.Errorf("[!!]Failed to terminate %s: %s", testProcess, err) - } else { - t.Logf("[OK] Called TerminateProcess on PID %d", pi.ProcessId) - } - - err = WaitForSingleObject(pi.Process, 1000) // 1000ms - if err != nil { - t.Errorf("[!!] failed in WaitForSingleObject: %s", err) - } else { - t.Logf("[OK] WaitForSingleObject returned...") - } - - // make sure we see the magic exit code we asked for - code, err := GetExitCodeProcess(pi.Process) - if err != nil { - t.Errorf("[!!] Failed to get exit code for PID %d: %s", pi.ProcessId, err) - } else { - t.Logf("[OK] PID %d Exited with code %d", pi.ProcessId, code) - } - if code != 42 { - t.Errorf("[!!] Unexpected exit code for PID %d - want %d, got %d", pi.ProcessId, wantCode, code) - } - - CloseHandle(pi.Process) - CloseHandle(pi.Thread) - -} diff --git a/vendor/github.com/AllenDang/w32/create_process_typedef.go b/vendor/github.com/AllenDang/w32/create_process_typedef.go deleted file mode 100644 index df05972..0000000 --- a/vendor/github.com/AllenDang/w32/create_process_typedef.go +++ /dev/null @@ -1,68 +0,0 @@ -package w32 - -// typedef struct _PROCESS_INFORMATION { -// HANDLE hProcess; -// HANDLE hThread; -// DWORD dwProcessId; -// DWORD dwThreadId; -// } PROCESS_INFORMATION, *PPROCESS_INFORMATION, *LPPROCESS_INFORMATION; - -type PROCESS_INFORMATION struct { - Process HANDLE - Thread HANDLE - ProcessId uint32 - ThreadId uint32 -} - -// typedef struct _STARTUPINFOW { -// DWORD cb; -// LPWSTR lpReserved; -// LPWSTR lpDesktop; -// LPWSTR lpTitle; -// DWORD dwX; -// DWORD dwY; -// DWORD dwXSize; -// DWORD dwYSize; -// DWORD dwXCountChars; -// DWORD dwYCountChars; -// DWORD dwFillAttribute; -// DWORD dwFlags; -// WORD wShowWindow; -// WORD cbReserved2; -// LPBYTE lpReserved2; -// HANDLE hStdInput; -// HANDLE hStdOutput; -// HANDLE hStdError; -// } STARTUPINFOW, *LPSTARTUPINFOW; - -type STARTUPINFOW struct { - cb uint32 - _ *uint16 - Desktop *uint16 - Title *uint16 - X uint32 - Y uint32 - XSize uint32 - YSize uint32 - XCountChars uint32 - YCountChars uint32 - FillAttribute uint32 - Flags uint32 - ShowWindow uint16 - _ uint16 - _ *uint8 - StdInput HANDLE - StdOutput HANDLE - StdError HANDLE -} - -// combase!_SECURITY_ATTRIBUTES -// +0x000 nLength : Uint4B -// +0x008 lpSecurityDescriptor : Ptr64 Void -// +0x010 bInheritHandle : Int4B - -type SECURITY_ATTRIBUTES struct { - Length uint32 - SecurityDescriptor uintptr - InheritHandle BOOL -} diff --git a/vendor/github.com/AllenDang/w32/dwmapi.go b/vendor/github.com/AllenDang/w32/dwmapi.go deleted file mode 100644 index eb656d1..0000000 --- a/vendor/github.com/AllenDang/w32/dwmapi.go +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "fmt" - "syscall" - "unsafe" -) - -// DEFINED IN THE DWM API BUT NOT IMPLEMENTED BY MS: -// DwmAttachMilContent -// DwmDetachMilContent -// DwmEnableComposition -// DwmGetGraphicsStreamClient -// DwmGetGraphicsStreamTransformHint - -var ( - moddwmapi = syscall.NewLazyDLL("dwmapi.dll") - - procDwmDefWindowProc = moddwmapi.NewProc("DwmDefWindowProc") - procDwmEnableBlurBehindWindow = moddwmapi.NewProc("DwmEnableBlurBehindWindow") - procDwmEnableMMCSS = moddwmapi.NewProc("DwmEnableMMCSS") - procDwmExtendFrameIntoClientArea = moddwmapi.NewProc("DwmExtendFrameIntoClientArea") - procDwmFlush = moddwmapi.NewProc("DwmFlush") - procDwmGetColorizationColor = moddwmapi.NewProc("DwmGetColorizationColor") - procDwmGetCompositionTimingInfo = moddwmapi.NewProc("DwmGetCompositionTimingInfo") - procDwmGetTransportAttributes = moddwmapi.NewProc("DwmGetTransportAttributes") - procDwmGetWindowAttribute = moddwmapi.NewProc("DwmGetWindowAttribute") - procDwmInvalidateIconicBitmaps = moddwmapi.NewProc("DwmInvalidateIconicBitmaps") - procDwmIsCompositionEnabled = moddwmapi.NewProc("DwmIsCompositionEnabled") - procDwmModifyPreviousDxFrameDuration = moddwmapi.NewProc("DwmModifyPreviousDxFrameDuration") - procDwmQueryThumbnailSourceSize = moddwmapi.NewProc("DwmQueryThumbnailSourceSize") - procDwmRegisterThumbnail = moddwmapi.NewProc("DwmRegisterThumbnail") - procDwmRenderGesture = moddwmapi.NewProc("DwmRenderGesture") - procDwmSetDxFrameDuration = moddwmapi.NewProc("DwmSetDxFrameDuration") - procDwmSetIconicLivePreviewBitmap = moddwmapi.NewProc("DwmSetIconicLivePreviewBitmap") - procDwmSetIconicThumbnail = moddwmapi.NewProc("DwmSetIconicThumbnail") - procDwmSetPresentParameters = moddwmapi.NewProc("DwmSetPresentParameters") - procDwmSetWindowAttribute = moddwmapi.NewProc("DwmSetWindowAttribute") - procDwmShowContact = moddwmapi.NewProc("DwmShowContact") - procDwmTetherContact = moddwmapi.NewProc("DwmTetherContact") - procDwmTransitionOwnedWindow = moddwmapi.NewProc("DwmTransitionOwnedWindow") - procDwmUnregisterThumbnail = moddwmapi.NewProc("DwmUnregisterThumbnail") - procDwmUpdateThumbnailProperties = moddwmapi.NewProc("DwmUpdateThumbnailProperties") -) - -func DwmDefWindowProc(hWnd HWND, msg uint, wParam, lParam uintptr) (bool, uint) { - var result uint - ret, _, _ := procDwmDefWindowProc.Call( - uintptr(hWnd), - uintptr(msg), - wParam, - lParam, - uintptr(unsafe.Pointer(&result))) - return ret != 0, result -} - -func DwmEnableBlurBehindWindow(hWnd HWND, pBlurBehind *DWM_BLURBEHIND) HRESULT { - ret, _, _ := procDwmEnableBlurBehindWindow.Call( - uintptr(hWnd), - uintptr(unsafe.Pointer(pBlurBehind))) - return HRESULT(ret) -} - -func DwmEnableMMCSS(fEnableMMCSS bool) HRESULT { - ret, _, _ := procDwmEnableMMCSS.Call( - uintptr(BoolToBOOL(fEnableMMCSS))) - return HRESULT(ret) -} - -func DwmExtendFrameIntoClientArea(hWnd HWND, pMarInset *MARGINS) HRESULT { - ret, _, _ := procDwmExtendFrameIntoClientArea.Call( - uintptr(hWnd), - uintptr(unsafe.Pointer(pMarInset))) - return HRESULT(ret) -} - -func DwmFlush() HRESULT { - ret, _, _ := procDwmFlush.Call() - return HRESULT(ret) -} - -func DwmGetColorizationColor(pcrColorization *uint32, pfOpaqueBlend *BOOL) HRESULT { - ret, _, _ := procDwmGetColorizationColor.Call( - uintptr(unsafe.Pointer(pcrColorization)), - uintptr(unsafe.Pointer(pfOpaqueBlend))) - return HRESULT(ret) -} - -func DwmGetCompositionTimingInfo(hWnd HWND, pTimingInfo *DWM_TIMING_INFO) HRESULT { - ret, _, _ := procDwmGetCompositionTimingInfo.Call( - uintptr(hWnd), - uintptr(unsafe.Pointer(pTimingInfo))) - return HRESULT(ret) -} - -func DwmGetTransportAttributes(pfIsRemoting *BOOL, pfIsConnected *BOOL, pDwGeneration *uint32) HRESULT { - ret, _, _ := procDwmGetTransportAttributes.Call( - uintptr(unsafe.Pointer(pfIsRemoting)), - uintptr(unsafe.Pointer(pfIsConnected)), - uintptr(unsafe.Pointer(pDwGeneration))) - return HRESULT(ret) -} - -// TODO: verify handling of variable arguments -func DwmGetWindowAttribute(hWnd HWND, dwAttribute uint32) (pAttribute interface{}, result HRESULT) { - var pvAttribute, pvAttrSize uintptr - switch dwAttribute { - case DWMWA_NCRENDERING_ENABLED: - v := new(BOOL) - pAttribute = v - pvAttribute = uintptr(unsafe.Pointer(v)) - pvAttrSize = unsafe.Sizeof(*v) - case DWMWA_CAPTION_BUTTON_BOUNDS, DWMWA_EXTENDED_FRAME_BOUNDS: - v := new(RECT) - pAttribute = v - pvAttribute = uintptr(unsafe.Pointer(v)) - pvAttrSize = unsafe.Sizeof(*v) - case DWMWA_CLOAKED: - panic(fmt.Sprintf("DwmGetWindowAttribute(%d) is not currently supported.", dwAttribute)) - default: - panic(fmt.Sprintf("DwmGetWindowAttribute(%d) is not valid.", dwAttribute)) - } - - ret, _, _ := procDwmGetWindowAttribute.Call( - uintptr(hWnd), - uintptr(dwAttribute), - pvAttribute, - pvAttrSize) - result = HRESULT(ret) - return -} - -func DwmInvalidateIconicBitmaps(hWnd HWND) HRESULT { - ret, _, _ := procDwmInvalidateIconicBitmaps.Call( - uintptr(hWnd)) - return HRESULT(ret) -} - -func DwmIsCompositionEnabled(pfEnabled *BOOL) HRESULT { - ret, _, _ := procDwmIsCompositionEnabled.Call( - uintptr(unsafe.Pointer(pfEnabled))) - return HRESULT(ret) -} - -func DwmModifyPreviousDxFrameDuration(hWnd HWND, cRefreshes int, fRelative bool) HRESULT { - ret, _, _ := procDwmModifyPreviousDxFrameDuration.Call( - uintptr(hWnd), - uintptr(cRefreshes), - uintptr(BoolToBOOL(fRelative))) - return HRESULT(ret) -} - -func DwmQueryThumbnailSourceSize(hThumbnail HTHUMBNAIL, pSize *SIZE) HRESULT { - ret, _, _ := procDwmQueryThumbnailSourceSize.Call( - uintptr(hThumbnail), - uintptr(unsafe.Pointer(pSize))) - return HRESULT(ret) -} - -func DwmRegisterThumbnail(hWndDestination HWND, hWndSource HWND, phThumbnailId *HTHUMBNAIL) HRESULT { - ret, _, _ := procDwmRegisterThumbnail.Call( - uintptr(hWndDestination), - uintptr(hWndSource), - uintptr(unsafe.Pointer(phThumbnailId))) - return HRESULT(ret) -} - -func DwmRenderGesture(gt GESTURE_TYPE, cContacts uint, pdwPointerID *uint32, pPoints *POINT) { - procDwmRenderGesture.Call( - uintptr(gt), - uintptr(cContacts), - uintptr(unsafe.Pointer(pdwPointerID)), - uintptr(unsafe.Pointer(pPoints))) - return -} - -func DwmSetDxFrameDuration(hWnd HWND, cRefreshes int) HRESULT { - ret, _, _ := procDwmSetDxFrameDuration.Call( - uintptr(hWnd), - uintptr(cRefreshes)) - return HRESULT(ret) -} - -func DwmSetIconicLivePreviewBitmap(hWnd HWND, hbmp HBITMAP, pptClient *POINT, dwSITFlags uint32) HRESULT { - ret, _, _ := procDwmSetIconicLivePreviewBitmap.Call( - uintptr(hWnd), - uintptr(hbmp), - uintptr(unsafe.Pointer(pptClient)), - uintptr(dwSITFlags)) - return HRESULT(ret) -} - -func DwmSetIconicThumbnail(hWnd HWND, hbmp HBITMAP, dwSITFlags uint32) HRESULT { - ret, _, _ := procDwmSetIconicThumbnail.Call( - uintptr(hWnd), - uintptr(hbmp), - uintptr(dwSITFlags)) - return HRESULT(ret) -} - -func DwmSetPresentParameters(hWnd HWND, pPresentParams *DWM_PRESENT_PARAMETERS) HRESULT { - ret, _, _ := procDwmSetPresentParameters.Call( - uintptr(hWnd), - uintptr(unsafe.Pointer(pPresentParams))) - return HRESULT(ret) -} - -func DwmSetWindowAttribute(hWnd HWND, dwAttribute uint32, pvAttribute LPCVOID, cbAttribute uint32) HRESULT { - ret, _, _ := procDwmSetWindowAttribute.Call( - uintptr(hWnd), - uintptr(dwAttribute), - uintptr(pvAttribute), - uintptr(cbAttribute)) - return HRESULT(ret) -} - -func DwmShowContact(dwPointerID uint32, eShowContact DWM_SHOWCONTACT) { - procDwmShowContact.Call( - uintptr(dwPointerID), - uintptr(eShowContact)) - return -} - -func DwmTetherContact(dwPointerID uint32, fEnable bool, ptTether POINT) { - procDwmTetherContact.Call( - uintptr(dwPointerID), - uintptr(BoolToBOOL(fEnable)), - uintptr(unsafe.Pointer(&ptTether))) - return -} - -func DwmTransitionOwnedWindow(hWnd HWND, target DWMTRANSITION_OWNEDWINDOW_TARGET) { - procDwmTransitionOwnedWindow.Call( - uintptr(hWnd), - uintptr(target)) - return -} - -func DwmUnregisterThumbnail(hThumbnailId HTHUMBNAIL) HRESULT { - ret, _, _ := procDwmUnregisterThumbnail.Call( - uintptr(hThumbnailId)) - return HRESULT(ret) -} - -func DwmUpdateThumbnailProperties(hThumbnailId HTHUMBNAIL, ptnProperties *DWM_THUMBNAIL_PROPERTIES) HRESULT { - ret, _, _ := procDwmUpdateThumbnailProperties.Call( - uintptr(hThumbnailId), - uintptr(unsafe.Pointer(ptnProperties))) - return HRESULT(ret) -} diff --git a/vendor/github.com/AllenDang/w32/fork.go b/vendor/github.com/AllenDang/w32/fork.go deleted file mode 100644 index b5543b9..0000000 --- a/vendor/github.com/AllenDang/w32/fork.go +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -// #include <stdlib.h> -//import ( -// "C" -//) - -// Based on C code found here https://gist.github.com/juntalis/4366916 -// Original code license: -/* - * fork.c - * Experimental fork() on Windows. Requires NT 6 subsystem or - * newer. - * - * Copyright (c) 2012 William Pitcock <nenolod@dereferenced.org> - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * This software is provided 'as is' and without any warranty, express or - * implied. In no event shall the authors be liable for any damages arising - * from the use of this software. - */ - -import ( - "fmt" - "syscall" - "unsafe" -) - -var ( - ntdll = syscall.NewLazyDLL("ntdll.dll") - - procRtlCloneUserProcess = ntdll.NewProc("RtlCloneUserProcess") - procAllocConsole = modkernel32.NewProc("AllocConsole") - procOpenProcess = modkernel32.NewProc("OpenProcess") - procOpenThread = modkernel32.NewProc("OpenThread") - procResumeThread = modkernel32.NewProc("ResumeThread") -) - -func OpenProcess(desiredAccess int, inheritHandle bool, processId uintptr) (h HANDLE, e error) { - inherit := uintptr(0) - if inheritHandle { - inherit = 1 - } - - ret, _, lastErr := procOpenProcess.Call( - uintptr(desiredAccess), - inherit, - uintptr(processId), - ) - - if ret == 0 { - e = lastErr - } - - h = HANDLE(ret) - return -} - -func OpenThread(desiredAccess int, inheritHandle bool, threadId uintptr) (h HANDLE, e error) { - inherit := uintptr(0) - if inheritHandle { - inherit = 1 - } - - ret, _, lastErr := procOpenThread.Call( - uintptr(desiredAccess), - inherit, - uintptr(threadId), - ) - - if ret == 0 { - e = lastErr - } - - h = HANDLE(ret) - return -} - -// DWORD WINAPI ResumeThread( -// _In_ HANDLE hThread -// ); -func ResumeThread(ht HANDLE) (e error) { - - ret, _, lastErr := procResumeThread.Call( - uintptr(ht), - ) - if ret == ^uintptr(0) { // -1 - e = lastErr - } - return -} - -// BOOL WINAPI AllocConsole(void); -func AllocConsole() (e error) { - ret, _, lastErr := procAllocConsole.Call() - if ret != ERROR_SUCCESS { - e = lastErr - } - return -} - -// NTSYSAPI -// NTSTATUS -// NTAPI RtlCloneUserProcess ( -// _In_ ULONG ProcessFlags, -// _In_opt_ PSECURITY_DESCRIPTOR ProcessSecurityDescriptor, -// _In_opt_ PSECURITY_DESCRIPTOR ThreadSecurityDescriptor, -// _In_opt_ HANDLE DebugPort, -// _Out_ PRTL_USER_PROCESS_INFORMATION ProcessInformation -// ) - -func RtlCloneUserProcess( - ProcessFlags uint32, - ProcessSecurityDescriptor, ThreadSecurityDescriptor *SECURITY_DESCRIPTOR, // in advapi32_typedef.go - DebugPort HANDLE, - ProcessInformation *RTL_USER_PROCESS_INFORMATION, -) (status uintptr) { - - status, _, _ = procRtlCloneUserProcess.Call( - uintptr(ProcessFlags), - uintptr(unsafe.Pointer(ProcessSecurityDescriptor)), - uintptr(unsafe.Pointer(ThreadSecurityDescriptor)), - uintptr(DebugPort), - uintptr(unsafe.Pointer(ProcessInformation)), - ) - - return -} - -// Fork creates a clone of the current process using the undocumented -// RtlCloneUserProcess call in ntdll, similar to unix fork(). The -// return value in the parent is the child PID. In the child it is 0. -func Fork() (pid uintptr, e error) { - - pi := &RTL_USER_PROCESS_INFORMATION{} - - ret := RtlCloneUserProcess( - RTL_CLONE_PROCESS_FLAGS_CREATE_SUSPENDED|RTL_CLONE_PROCESS_FLAGS_INHERIT_HANDLES, - nil, - nil, - HANDLE(0), - pi, - ) - - switch ret { - case RTL_CLONE_PARENT: - pid = pi.ClientId.UniqueProcess - ht, err := OpenThread(THREAD_ALL_ACCESS, false, pi.ClientId.UniqueThread) - if err != nil { - e = fmt.Errorf("OpenThread: %s", err) - } - err = ResumeThread(ht) - if err != nil { - e = fmt.Errorf("ResumeThread: %s", err) - } - CloseHandle(ht) - case RTL_CLONE_CHILD: - pid = 0 - err := AllocConsole() - if err != nil { - e = fmt.Errorf("AllocConsole: %s", err) - } - default: - e = fmt.Errorf("0x%x", ret) - } - return -} diff --git a/vendor/github.com/AllenDang/w32/fork_constants.go b/vendor/github.com/AllenDang/w32/fork_constants.go deleted file mode 100644 index 3e9b217..0000000 --- a/vendor/github.com/AllenDang/w32/fork_constants.go +++ /dev/null @@ -1,26 +0,0 @@ -package w32 - -const ( - RTL_CLONE_PROCESS_FLAGS_CREATE_SUSPENDED = 0x00000001 - RTL_CLONE_PROCESS_FLAGS_INHERIT_HANDLES = 0x00000002 - RTL_CLONE_PROCESS_FLAGS_NO_SYNCHRONIZE = 0x00000004 - - RTL_CLONE_PARENT = 0 - RTL_CLONE_CHILD = 297 - - THREAD_TERMINATE = 0x0001 - THREAD_SUSPEND_RESUME = 0x0002 - THREAD_GET_CONTEXT = 0x0008 - THREAD_SET_CONTEXT = 0x0010 - THREAD_SET_INFORMATION = 0x0020 - THREAD_QUERY_INFORMATION = 0x0040 - THREAD_SET_THREAD_TOKEN = 0x0080 - THREAD_IMPERSONATE = 0x0100 - THREAD_DIRECT_IMPERSONATION = 0x0200 - THREAD_SET_LIMITED_INFORMATION = 0x0400 - THREAD_QUERY_LIMITED_INFORMATION = 0x0800 - THREAD_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xffff - - PROCESS_SET_SESSIONID = 0x0004 - PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xffff -) diff --git a/vendor/github.com/AllenDang/w32/fork_test.go b/vendor/github.com/AllenDang/w32/fork_test.go deleted file mode 100644 index 47b52ba..0000000 --- a/vendor/github.com/AllenDang/w32/fork_test.go +++ /dev/null @@ -1,50 +0,0 @@ -package w32 - -import ( - "fmt" - "io/ioutil" - "os" - "path" - "strconv" - "testing" - "time" -) - -var forkFn = path.Join(os.TempDir(), "forktest.pid") - -func TestFork(t *testing.T) { - - ppid := os.Getpid() - t.Logf("[OK] I am PID %d", ppid) - pid, err := Fork() - if err != nil { - t.Fatalf("[!!] Failed to fork. PID: %d: %s", pid, err) - } - - if pid == 0 { - // We can't log anything here because our stdout doesn't point - // to the same console as our parent. - // - // This process won't show up in Task Manager, and os.Getpid() won't - // work, I guess because we haven't told CSRSS we exist. - f, _ := os.Create(forkFn) - f.WriteString(fmt.Sprintf("%d", ppid)) - f.Close() - } else { - t.Logf("[OK] Forked child with PID %d", pid) - t.Logf("[OK] Sleeping, then trying to read checkfile.") - time.Sleep(2 * time.Second) - raw, err := ioutil.ReadFile(forkFn) - if err != nil { - t.Fatalf("[!!] Failed to read PID checkfile: %s", err) - } - if string(raw) == strconv.Itoa(ppid) { - t.Logf("[OK] Found PID checkfile - PID matches!") - } else { - t.Errorf("[!] Child reported PID %q vs %q!", string(raw), strconv.Itoa(ppid)) - } - os.Remove(forkFn) - - } - -} diff --git a/vendor/github.com/AllenDang/w32/fork_typedef.go b/vendor/github.com/AllenDang/w32/fork_typedef.go deleted file mode 100644 index fcb9049..0000000 --- a/vendor/github.com/AllenDang/w32/fork_typedef.go +++ /dev/null @@ -1,89 +0,0 @@ -package w32 - -// combase!_SECTION_IMAGE_INFORMATION -// +0x000 TransferAddress : Ptr64 Void -// +0x008 ZeroBits : Uint4B -// +0x010 MaximumStackSize : Uint8B -// +0x018 CommittedStackSize : Uint8B -// +0x020 SubSystemType : Uint4B -// +0x024 SubSystemMinorVersion : Uint2B -// +0x026 SubSystemMajorVersion : Uint2B -// +0x024 SubSystemVersion : Uint4B -// +0x028 MajorOperatingSystemVersion : Uint2B -// +0x02a MinorOperatingSystemVersion : Uint2B -// +0x028 OperatingSystemVersion : Uint4B -// +0x02c ImageCharacteristics : Uint2B -// +0x02e DllCharacteristics : Uint2B -// +0x030 Machine : Uint2B -// +0x032 ImageContainsCode : UChar -// +0x033 ImageFlags : UChar -// +0x033 ComPlusNativeReady : Pos 0, 1 Bit -// +0x033 ComPlusILOnly : Pos 1, 1 Bit -// +0x033 ImageDynamicallyRelocated : Pos 2, 1 Bit -// +0x033 ImageMappedFlat : Pos 3, 1 Bit -// +0x033 BaseBelow4gb : Pos 4, 1 Bit -// +0x033 ComPlusPrefer32bit : Pos 5, 1 Bit -// +0x033 Reserved : Pos 6, 2 Bits -// +0x034 LoaderFlags : Uint4B -// +0x038 ImageFileSize : Uint4B -// +0x03c CheckSum : Uint4B -type SECTION_IMAGE_INFORMATION struct { - TransferAddress uintptr - ZeroBits uint32 - MaximumStackSize uint64 - CommittedStackSize uint64 - SubSystemType uint32 - SubSystemMinorVersion uint16 - SubSystemMajorVersion uint16 - SubSystemVersion uint32 - MajorOperatingSystemVersion uint16 - MinorOperatingSystemVersion uint16 - OperatingSystemVersion uint32 - ImageCharacteristics uint16 - DllCharacteristics uint16 - Machine uint16 - ImageContainsCode uint8 - ImageFlags uint8 - ComPlusFlags uint8 - LoaderFlags uint32 - ImageFileSize uint32 - CheckSum uint32 -} - -func (si *SECTION_IMAGE_INFORMATION) ComPlusNativeReady() bool { - return (si.ComPlusFlags & (1 << 0)) == 1 -} - -func (si *SECTION_IMAGE_INFORMATION) ComPlusILOnly() bool { - return (si.ComPlusFlags & (1 << 1)) == 1 -} - -func (si *SECTION_IMAGE_INFORMATION) ImageDynamicallyRelocated() bool { - return (si.ComPlusFlags & (1 << 2)) == 1 -} - -func (si *SECTION_IMAGE_INFORMATION) ImageMappedFlat() bool { - return (si.ComPlusFlags & (1 << 3)) == 1 -} - -func (si *SECTION_IMAGE_INFORMATION) BaseBelow4gb() bool { - return (si.ComPlusFlags & (1 << 4)) == 1 -} - -func (si *SECTION_IMAGE_INFORMATION) ComPlusPrefer32bit() bool { - return (si.ComPlusFlags & (1 << 5)) == 1 -} - -// combase!_RTL_USER_PROCESS_INFORMATION -// +0x000 Length : Uint4B -// +0x008 Process : Ptr64 Void -// +0x010 Thread : Ptr64 Void -// +0x018 ClientId : _CLIENT_ID -// +0x028 ImageInformation : _SECTION_IMAGE_INFORMATION -type RTL_USER_PROCESS_INFORMATION struct { - Length uint32 - Process HANDLE - Thread HANDLE - ClientId CLIENT_ID - ImageInformation SECTION_IMAGE_INFORMATION -} diff --git a/vendor/github.com/AllenDang/w32/gdi32.go b/vendor/github.com/AllenDang/w32/gdi32.go deleted file mode 100644 index 39a81d6..0000000 --- a/vendor/github.com/AllenDang/w32/gdi32.go +++ /dev/null @@ -1,543 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "syscall" - "unsafe" -) - -var ( - modgdi32 = syscall.NewLazyDLL("gdi32.dll") - - procGetDeviceCaps = modgdi32.NewProc("GetDeviceCaps") - procGetCurrentObject = modgdi32.NewProc("GetCurrentObject") - procDeleteObject = modgdi32.NewProc("DeleteObject") - procCreateFontIndirect = modgdi32.NewProc("CreateFontIndirectW") - procAbortDoc = modgdi32.NewProc("AbortDoc") - procBitBlt = modgdi32.NewProc("BitBlt") - procPatBlt = modgdi32.NewProc("PatBlt") - procCloseEnhMetaFile = modgdi32.NewProc("CloseEnhMetaFile") - procCopyEnhMetaFile = modgdi32.NewProc("CopyEnhMetaFileW") - procCreateBrushIndirect = modgdi32.NewProc("CreateBrushIndirect") - procCreateCompatibleDC = modgdi32.NewProc("CreateCompatibleDC") - procCreateDC = modgdi32.NewProc("CreateDCW") - procCreateCompatibleBitmap = modgdi32.NewProc("CreateCompatibleBitmap") - procCreateDIBSection = modgdi32.NewProc("CreateDIBSection") - procCreateEnhMetaFile = modgdi32.NewProc("CreateEnhMetaFileW") - procCreateIC = modgdi32.NewProc("CreateICW") - procDeleteDC = modgdi32.NewProc("DeleteDC") - procDeleteEnhMetaFile = modgdi32.NewProc("DeleteEnhMetaFile") - procEllipse = modgdi32.NewProc("Ellipse") - procEndDoc = modgdi32.NewProc("EndDoc") - procEndPage = modgdi32.NewProc("EndPage") - procExtCreatePen = modgdi32.NewProc("ExtCreatePen") - procGetEnhMetaFile = modgdi32.NewProc("GetEnhMetaFileW") - procGetEnhMetaFileHeader = modgdi32.NewProc("GetEnhMetaFileHeader") - procGetObject = modgdi32.NewProc("GetObjectW") - procGetStockObject = modgdi32.NewProc("GetStockObject") - procGetTextExtentExPoint = modgdi32.NewProc("GetTextExtentExPointW") - procGetTextExtentPoint32 = modgdi32.NewProc("GetTextExtentPoint32W") - procGetTextMetrics = modgdi32.NewProc("GetTextMetricsW") - procLineTo = modgdi32.NewProc("LineTo") - procMoveToEx = modgdi32.NewProc("MoveToEx") - procPlayEnhMetaFile = modgdi32.NewProc("PlayEnhMetaFile") - procRectangle = modgdi32.NewProc("Rectangle") - procResetDC = modgdi32.NewProc("ResetDCW") - procSelectObject = modgdi32.NewProc("SelectObject") - procSetBkMode = modgdi32.NewProc("SetBkMode") - procSetBrushOrgEx = modgdi32.NewProc("SetBrushOrgEx") - procSetStretchBltMode = modgdi32.NewProc("SetStretchBltMode") - procSetTextColor = modgdi32.NewProc("SetTextColor") - procSetBkColor = modgdi32.NewProc("SetBkColor") - procStartDoc = modgdi32.NewProc("StartDocW") - procStartPage = modgdi32.NewProc("StartPage") - procStretchBlt = modgdi32.NewProc("StretchBlt") - procSetDIBitsToDevice = modgdi32.NewProc("SetDIBitsToDevice") - procChoosePixelFormat = modgdi32.NewProc("ChoosePixelFormat") - procDescribePixelFormat = modgdi32.NewProc("DescribePixelFormat") - procGetEnhMetaFilePixelFormat = modgdi32.NewProc("GetEnhMetaFilePixelFormat") - procGetPixelFormat = modgdi32.NewProc("GetPixelFormat") - procSetPixelFormat = modgdi32.NewProc("SetPixelFormat") - procSwapBuffers = modgdi32.NewProc("SwapBuffers") -) - -func GetDeviceCaps(hdc HDC, index int) int { - ret, _, _ := procGetDeviceCaps.Call( - uintptr(hdc), - uintptr(index)) - - return int(ret) -} - -func GetCurrentObject(hdc HDC, uObjectType uint32) HGDIOBJ { - ret, _, _ := procGetCurrentObject.Call( - uintptr(hdc), - uintptr(uObjectType)) - - return HGDIOBJ(ret) -} - -func DeleteObject(hObject HGDIOBJ) bool { - ret, _, _ := procDeleteObject.Call( - uintptr(hObject)) - - return ret != 0 -} - -func CreateFontIndirect(logFont *LOGFONT) HFONT { - ret, _, _ := procCreateFontIndirect.Call( - uintptr(unsafe.Pointer(logFont))) - - return HFONT(ret) -} - -func AbortDoc(hdc HDC) int { - ret, _, _ := procAbortDoc.Call( - uintptr(hdc)) - - return int(ret) -} - -func BitBlt(hdcDest HDC, nXDest, nYDest, nWidth, nHeight int, hdcSrc HDC, nXSrc, nYSrc int, dwRop uint) { - ret, _, _ := procBitBlt.Call( - uintptr(hdcDest), - uintptr(nXDest), - uintptr(nYDest), - uintptr(nWidth), - uintptr(nHeight), - uintptr(hdcSrc), - uintptr(nXSrc), - uintptr(nYSrc), - uintptr(dwRop)) - - if ret == 0 { - panic("BitBlt failed") - } -} - -func PatBlt(hdc HDC, nXLeft, nYLeft, nWidth, nHeight int, dwRop uint) { - ret, _, _ := procPatBlt.Call( - uintptr(hdc), - uintptr(nXLeft), - uintptr(nYLeft), - uintptr(nWidth), - uintptr(nHeight), - uintptr(dwRop)) - - if ret == 0 { - panic("PatBlt failed") - } -} - -func CloseEnhMetaFile(hdc HDC) HENHMETAFILE { - ret, _, _ := procCloseEnhMetaFile.Call( - uintptr(hdc)) - - return HENHMETAFILE(ret) -} - -func CopyEnhMetaFile(hemfSrc HENHMETAFILE, lpszFile *uint16) HENHMETAFILE { - ret, _, _ := procCopyEnhMetaFile.Call( - uintptr(hemfSrc), - uintptr(unsafe.Pointer(lpszFile))) - - return HENHMETAFILE(ret) -} - -func CreateBrushIndirect(lplb *LOGBRUSH) HBRUSH { - ret, _, _ := procCreateBrushIndirect.Call( - uintptr(unsafe.Pointer(lplb))) - - return HBRUSH(ret) -} - -func CreateCompatibleDC(hdc HDC) HDC { - ret, _, _ := procCreateCompatibleDC.Call( - uintptr(hdc)) - - if ret == 0 { - panic("Create compatible DC failed") - } - - return HDC(ret) -} - -func CreateDC(lpszDriver, lpszDevice, lpszOutput *uint16, lpInitData *DEVMODE) HDC { - ret, _, _ := procCreateDC.Call( - uintptr(unsafe.Pointer(lpszDriver)), - uintptr(unsafe.Pointer(lpszDevice)), - uintptr(unsafe.Pointer(lpszOutput)), - uintptr(unsafe.Pointer(lpInitData))) - - return HDC(ret) -} - -func CreateCompatibleBitmap(hdc HDC, width, height uint) HBITMAP { - ret, _, _ := procCreateCompatibleBitmap.Call( - uintptr(hdc), - uintptr(width), - uintptr(height)) - - return HBITMAP(ret) -} - -func CreateDIBSection(hdc HDC, pbmi *BITMAPINFO, iUsage uint, ppvBits *unsafe.Pointer, hSection HANDLE, dwOffset uint) HBITMAP { - ret, _, _ := procCreateDIBSection.Call( - uintptr(hdc), - uintptr(unsafe.Pointer(pbmi)), - uintptr(iUsage), - uintptr(unsafe.Pointer(ppvBits)), - uintptr(hSection), - uintptr(dwOffset)) - - return HBITMAP(ret) -} - -func CreateEnhMetaFile(hdcRef HDC, lpFilename *uint16, lpRect *RECT, lpDescription *uint16) HDC { - ret, _, _ := procCreateEnhMetaFile.Call( - uintptr(hdcRef), - uintptr(unsafe.Pointer(lpFilename)), - uintptr(unsafe.Pointer(lpRect)), - uintptr(unsafe.Pointer(lpDescription))) - - return HDC(ret) -} - -func CreateIC(lpszDriver, lpszDevice, lpszOutput *uint16, lpdvmInit *DEVMODE) HDC { - ret, _, _ := procCreateIC.Call( - uintptr(unsafe.Pointer(lpszDriver)), - uintptr(unsafe.Pointer(lpszDevice)), - uintptr(unsafe.Pointer(lpszOutput)), - uintptr(unsafe.Pointer(lpdvmInit))) - - return HDC(ret) -} - -func DeleteDC(hdc HDC) bool { - ret, _, _ := procDeleteDC.Call( - uintptr(hdc)) - - return ret != 0 -} - -func DeleteEnhMetaFile(hemf HENHMETAFILE) bool { - ret, _, _ := procDeleteEnhMetaFile.Call( - uintptr(hemf)) - - return ret != 0 -} - -func Ellipse(hdc HDC, nLeftRect, nTopRect, nRightRect, nBottomRect int) bool { - ret, _, _ := procEllipse.Call( - uintptr(hdc), - uintptr(nLeftRect), - uintptr(nTopRect), - uintptr(nRightRect), - uintptr(nBottomRect)) - - return ret != 0 -} - -func EndDoc(hdc HDC) int { - ret, _, _ := procEndDoc.Call( - uintptr(hdc)) - - return int(ret) -} - -func EndPage(hdc HDC) int { - ret, _, _ := procEndPage.Call( - uintptr(hdc)) - - return int(ret) -} - -func ExtCreatePen(dwPenStyle, dwWidth uint, lplb *LOGBRUSH, dwStyleCount uint, lpStyle *uint) HPEN { - ret, _, _ := procExtCreatePen.Call( - uintptr(dwPenStyle), - uintptr(dwWidth), - uintptr(unsafe.Pointer(lplb)), - uintptr(dwStyleCount), - uintptr(unsafe.Pointer(lpStyle))) - - return HPEN(ret) -} - -func GetEnhMetaFile(lpszMetaFile *uint16) HENHMETAFILE { - ret, _, _ := procGetEnhMetaFile.Call( - uintptr(unsafe.Pointer(lpszMetaFile))) - - return HENHMETAFILE(ret) -} - -func GetEnhMetaFileHeader(hemf HENHMETAFILE, cbBuffer uint, lpemh *ENHMETAHEADER) uint { - ret, _, _ := procGetEnhMetaFileHeader.Call( - uintptr(hemf), - uintptr(cbBuffer), - uintptr(unsafe.Pointer(lpemh))) - - return uint(ret) -} - -func GetObject(hgdiobj HGDIOBJ, cbBuffer uintptr, lpvObject unsafe.Pointer) int { - ret, _, _ := procGetObject.Call( - uintptr(hgdiobj), - uintptr(cbBuffer), - uintptr(lpvObject)) - - return int(ret) -} - -func GetStockObject(fnObject int) HGDIOBJ { - ret, _, _ := procGetStockObject.Call( - uintptr(fnObject)) - - return HGDIOBJ(ret) -} - -func GetTextExtentExPoint(hdc HDC, lpszStr *uint16, cchString, nMaxExtent int, lpnFit, alpDx *int, lpSize *SIZE) bool { - ret, _, _ := procGetTextExtentExPoint.Call( - uintptr(hdc), - uintptr(unsafe.Pointer(lpszStr)), - uintptr(cchString), - uintptr(nMaxExtent), - uintptr(unsafe.Pointer(lpnFit)), - uintptr(unsafe.Pointer(alpDx)), - uintptr(unsafe.Pointer(lpSize))) - - return ret != 0 -} - -func GetTextExtentPoint32(hdc HDC, lpString *uint16, c int, lpSize *SIZE) bool { - ret, _, _ := procGetTextExtentPoint32.Call( - uintptr(hdc), - uintptr(unsafe.Pointer(lpString)), - uintptr(c), - uintptr(unsafe.Pointer(lpSize))) - - return ret != 0 -} - -func GetTextMetrics(hdc HDC, lptm *TEXTMETRIC) bool { - ret, _, _ := procGetTextMetrics.Call( - uintptr(hdc), - uintptr(unsafe.Pointer(lptm))) - - return ret != 0 -} - -func LineTo(hdc HDC, nXEnd, nYEnd int) bool { - ret, _, _ := procLineTo.Call( - uintptr(hdc), - uintptr(nXEnd), - uintptr(nYEnd)) - - return ret != 0 -} - -func MoveToEx(hdc HDC, x, y int, lpPoint *POINT) bool { - ret, _, _ := procMoveToEx.Call( - uintptr(hdc), - uintptr(x), - uintptr(y), - uintptr(unsafe.Pointer(lpPoint))) - - return ret != 0 -} - -func PlayEnhMetaFile(hdc HDC, hemf HENHMETAFILE, lpRect *RECT) bool { - ret, _, _ := procPlayEnhMetaFile.Call( - uintptr(hdc), - uintptr(hemf), - uintptr(unsafe.Pointer(lpRect))) - - return ret != 0 -} - -func Rectangle(hdc HDC, nLeftRect, nTopRect, nRightRect, nBottomRect int) bool { - ret, _, _ := procRectangle.Call( - uintptr(hdc), - uintptr(nLeftRect), - uintptr(nTopRect), - uintptr(nRightRect), - uintptr(nBottomRect)) - - return ret != 0 -} - -func ResetDC(hdc HDC, lpInitData *DEVMODE) HDC { - ret, _, _ := procResetDC.Call( - uintptr(hdc), - uintptr(unsafe.Pointer(lpInitData))) - - return HDC(ret) -} - -func SelectObject(hdc HDC, hgdiobj HGDIOBJ) HGDIOBJ { - ret, _, _ := procSelectObject.Call( - uintptr(hdc), - uintptr(hgdiobj)) - - if ret == 0 { - panic("SelectObject failed") - } - - return HGDIOBJ(ret) -} - -func SetBkMode(hdc HDC, iBkMode int) int { - ret, _, _ := procSetBkMode.Call( - uintptr(hdc), - uintptr(iBkMode)) - - if ret == 0 { - panic("SetBkMode failed") - } - - return int(ret) -} - -func SetBrushOrgEx(hdc HDC, nXOrg, nYOrg int, lppt *POINT) bool { - ret, _, _ := procSetBrushOrgEx.Call( - uintptr(hdc), - uintptr(nXOrg), - uintptr(nYOrg), - uintptr(unsafe.Pointer(lppt))) - - return ret != 0 -} - -func SetStretchBltMode(hdc HDC, iStretchMode int) int { - ret, _, _ := procSetStretchBltMode.Call( - uintptr(hdc), - uintptr(iStretchMode)) - - return int(ret) -} - -func SetTextColor(hdc HDC, crColor COLORREF) COLORREF { - ret, _, _ := procSetTextColor.Call( - uintptr(hdc), - uintptr(crColor)) - - if ret == CLR_INVALID { - panic("SetTextColor failed") - } - - return COLORREF(ret) -} - -func SetBkColor(hdc HDC, crColor COLORREF) COLORREF { - ret, _, _ := procSetBkColor.Call( - uintptr(hdc), - uintptr(crColor)) - - if ret == CLR_INVALID { - panic("SetBkColor failed") - } - - return COLORREF(ret) -} - -func StartDoc(hdc HDC, lpdi *DOCINFO) int { - ret, _, _ := procStartDoc.Call( - uintptr(hdc), - uintptr(unsafe.Pointer(lpdi))) - - return int(ret) -} - -func StartPage(hdc HDC) int { - ret, _, _ := procStartPage.Call( - uintptr(hdc)) - - return int(ret) -} - -func StretchBlt(hdcDest HDC, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest int, hdcSrc HDC, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc int, dwRop uint) { - ret, _, _ := procStretchBlt.Call( - uintptr(hdcDest), - uintptr(nXOriginDest), - uintptr(nYOriginDest), - uintptr(nWidthDest), - uintptr(nHeightDest), - uintptr(hdcSrc), - uintptr(nXOriginSrc), - uintptr(nYOriginSrc), - uintptr(nWidthSrc), - uintptr(nHeightSrc), - uintptr(dwRop)) - - if ret == 0 { - panic("StretchBlt failed") - } -} - -func SetDIBitsToDevice(hdc HDC, xDest, yDest, dwWidth, dwHeight, xSrc, ySrc int, uStartScan, cScanLines uint, lpvBits []byte, lpbmi *BITMAPINFO, fuColorUse uint) int { - ret, _, _ := procSetDIBitsToDevice.Call( - uintptr(hdc), - uintptr(xDest), - uintptr(yDest), - uintptr(dwWidth), - uintptr(dwHeight), - uintptr(xSrc), - uintptr(ySrc), - uintptr(uStartScan), - uintptr(cScanLines), - uintptr(unsafe.Pointer(&lpvBits[0])), - uintptr(unsafe.Pointer(lpbmi)), - uintptr(fuColorUse)) - - return int(ret) -} - -func ChoosePixelFormat(hdc HDC, pfd *PIXELFORMATDESCRIPTOR) int { - ret, _, _ := procChoosePixelFormat.Call( - uintptr(hdc), - uintptr(unsafe.Pointer(pfd)), - ) - return int(ret) -} - -func DescribePixelFormat(hdc HDC, iPixelFormat int, nBytes uint, pfd *PIXELFORMATDESCRIPTOR) int { - ret, _, _ := procDescribePixelFormat.Call( - uintptr(hdc), - uintptr(iPixelFormat), - uintptr(nBytes), - uintptr(unsafe.Pointer(pfd)), - ) - return int(ret) -} - -func GetEnhMetaFilePixelFormat(hemf HENHMETAFILE, cbBuffer uint32, pfd *PIXELFORMATDESCRIPTOR) uint { - ret, _, _ := procGetEnhMetaFilePixelFormat.Call( - uintptr(hemf), - uintptr(cbBuffer), - uintptr(unsafe.Pointer(pfd)), - ) - return uint(ret) -} - -func GetPixelFormat(hdc HDC) int { - ret, _, _ := procGetPixelFormat.Call( - uintptr(hdc), - ) - return int(ret) -} - -func SetPixelFormat(hdc HDC, iPixelFormat int, pfd *PIXELFORMATDESCRIPTOR) bool { - ret, _, _ := procSetPixelFormat.Call( - uintptr(hdc), - uintptr(iPixelFormat), - uintptr(unsafe.Pointer(pfd)), - ) - return ret == TRUE -} - -func SwapBuffers(hdc HDC) bool { - ret, _, _ := procSwapBuffers.Call(uintptr(hdc)) - return ret == TRUE -} diff --git a/vendor/github.com/AllenDang/w32/gdiplus.go b/vendor/github.com/AllenDang/w32/gdiplus.go deleted file mode 100644 index f3a8fca..0000000 --- a/vendor/github.com/AllenDang/w32/gdiplus.go +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "errors" - "fmt" - "syscall" - "unsafe" -) - -const ( - Ok = 0 - GenericError = 1 - InvalidParameter = 2 - OutOfMemory = 3 - ObjectBusy = 4 - InsufficientBuffer = 5 - NotImplemented = 6 - Win32Error = 7 - WrongState = 8 - Aborted = 9 - FileNotFound = 10 - ValueOverflow = 11 - AccessDenied = 12 - UnknownImageFormat = 13 - FontFamilyNotFound = 14 - FontStyleNotFound = 15 - NotTrueTypeFont = 16 - UnsupportedGdiplusVersion = 17 - GdiplusNotInitialized = 18 - PropertyNotFound = 19 - PropertyNotSupported = 20 - ProfileNotFound = 21 -) - -func GetGpStatus(s int32) string { - switch s { - case Ok: - return "Ok" - case GenericError: - return "GenericError" - case InvalidParameter: - return "InvalidParameter" - case OutOfMemory: - return "OutOfMemory" - case ObjectBusy: - return "ObjectBusy" - case InsufficientBuffer: - return "InsufficientBuffer" - case NotImplemented: - return "NotImplemented" - case Win32Error: - return "Win32Error" - case WrongState: - return "WrongState" - case Aborted: - return "Aborted" - case FileNotFound: - return "FileNotFound" - case ValueOverflow: - return "ValueOverflow" - case AccessDenied: - return "AccessDenied" - case UnknownImageFormat: - return "UnknownImageFormat" - case FontFamilyNotFound: - return "FontFamilyNotFound" - case FontStyleNotFound: - return "FontStyleNotFound" - case NotTrueTypeFont: - return "NotTrueTypeFont" - case UnsupportedGdiplusVersion: - return "UnsupportedGdiplusVersion" - case GdiplusNotInitialized: - return "GdiplusNotInitialized" - case PropertyNotFound: - return "PropertyNotFound" - case PropertyNotSupported: - return "PropertyNotSupported" - case ProfileNotFound: - return "ProfileNotFound" - } - return "Unknown Status Value" -} - -var ( - token uintptr - - modgdiplus = syscall.NewLazyDLL("gdiplus.dll") - - procGdipCreateBitmapFromFile = modgdiplus.NewProc("GdipCreateBitmapFromFile") - procGdipCreateBitmapFromHBITMAP = modgdiplus.NewProc("GdipCreateBitmapFromHBITMAP") - procGdipCreateHBITMAPFromBitmap = modgdiplus.NewProc("GdipCreateHBITMAPFromBitmap") - procGdipCreateBitmapFromResource = modgdiplus.NewProc("GdipCreateBitmapFromResource") - procGdipCreateBitmapFromStream = modgdiplus.NewProc("GdipCreateBitmapFromStream") - procGdipDisposeImage = modgdiplus.NewProc("GdipDisposeImage") - procGdiplusShutdown = modgdiplus.NewProc("GdiplusShutdown") - procGdiplusStartup = modgdiplus.NewProc("GdiplusStartup") -) - -func GdipCreateBitmapFromFile(filename string) (*uintptr, error) { - var bitmap *uintptr - ret, _, _ := procGdipCreateBitmapFromFile.Call( - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(filename))), - uintptr(unsafe.Pointer(&bitmap))) - - if ret != Ok { - return nil, errors.New(fmt.Sprintf("GdipCreateBitmapFromFile failed with status '%s' for file '%s'", GetGpStatus(int32(ret)), filename)) - } - - return bitmap, nil -} - -func GdipCreateBitmapFromResource(instance HINSTANCE, resId *uint16) (*uintptr, error) { - var bitmap *uintptr - ret, _, _ := procGdipCreateBitmapFromResource.Call( - uintptr(instance), - uintptr(unsafe.Pointer(resId)), - uintptr(unsafe.Pointer(&bitmap))) - - if ret != Ok { - return nil, errors.New(fmt.Sprintf("GdiCreateBitmapFromResource failed with status '%s'", GetGpStatus(int32(ret)))) - } - - return bitmap, nil -} - -func GdipCreateBitmapFromStream(stream *IStream) (*uintptr, error) { - var bitmap *uintptr - ret, _, _ := procGdipCreateBitmapFromStream.Call( - uintptr(unsafe.Pointer(stream)), - uintptr(unsafe.Pointer(&bitmap))) - - if ret != Ok { - return nil, errors.New(fmt.Sprintf("GdipCreateBitmapFromStream failed with status '%s'", GetGpStatus(int32(ret)))) - } - - return bitmap, nil -} - -func GdipCreateHBITMAPFromBitmap(bitmap *uintptr, background uint32) (HBITMAP, error) { - var hbitmap HBITMAP - ret, _, _ := procGdipCreateHBITMAPFromBitmap.Call( - uintptr(unsafe.Pointer(bitmap)), - uintptr(unsafe.Pointer(&hbitmap)), - uintptr(background)) - - if ret != Ok { - return 0, errors.New(fmt.Sprintf("GdipCreateHBITMAPFromBitmap failed with status '%s'", GetGpStatus(int32(ret)))) - } - - return hbitmap, nil -} - -func GdipDisposeImage(image *uintptr) { - procGdipDisposeImage.Call(uintptr(unsafe.Pointer(image))) -} - -func GdiplusShutdown() { - procGdiplusShutdown.Call(token) -} - -func GdiplusStartup(input *GdiplusStartupInput, output *GdiplusStartupOutput) { - ret, _, _ := procGdiplusStartup.Call( - uintptr(unsafe.Pointer(&token)), - uintptr(unsafe.Pointer(input)), - uintptr(unsafe.Pointer(output))) - - if ret != Ok { - panic("GdiplusStartup failed with status " + GetGpStatus(int32(ret))) - } -} diff --git a/vendor/github.com/AllenDang/w32/idispatch.go b/vendor/github.com/AllenDang/w32/idispatch.go deleted file mode 100644 index 41634a6..0000000 --- a/vendor/github.com/AllenDang/w32/idispatch.go +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "unsafe" -) - -type pIDispatchVtbl struct { - pQueryInterface uintptr - pAddRef uintptr - pRelease uintptr - pGetTypeInfoCount uintptr - pGetTypeInfo uintptr - pGetIDsOfNames uintptr - pInvoke uintptr -} - -type IDispatch struct { - lpVtbl *pIDispatchVtbl -} - -func (this *IDispatch) QueryInterface(id *GUID) *IDispatch { - return ComQueryInterface((*IUnknown)(unsafe.Pointer(this)), id) -} - -func (this *IDispatch) AddRef() int32 { - return ComAddRef((*IUnknown)(unsafe.Pointer(this))) -} - -func (this *IDispatch) Release() int32 { - return ComRelease((*IUnknown)(unsafe.Pointer(this))) -} - -func (this *IDispatch) GetIDsOfName(names []string) []int32 { - return ComGetIDsOfName(this, names) -} - -func (this *IDispatch) Invoke(dispid int32, dispatch int16, params ...interface{}) *VARIANT { - return ComInvoke(this, dispid, dispatch, params...) -} diff --git a/vendor/github.com/AllenDang/w32/istream.go b/vendor/github.com/AllenDang/w32/istream.go deleted file mode 100644 index 2b840c3..0000000 --- a/vendor/github.com/AllenDang/w32/istream.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "unsafe" -) - -type pIStreamVtbl struct { - pQueryInterface uintptr - pAddRef uintptr - pRelease uintptr -} - -type IStream struct { - lpVtbl *pIStreamVtbl -} - -func (this *IStream) QueryInterface(id *GUID) *IDispatch { - return ComQueryInterface((*IUnknown)(unsafe.Pointer(this)), id) -} - -func (this *IStream) AddRef() int32 { - return ComAddRef((*IUnknown)(unsafe.Pointer(this))) -} - -func (this *IStream) Release() int32 { - return ComRelease((*IUnknown)(unsafe.Pointer(this))) -} diff --git a/vendor/github.com/AllenDang/w32/iunknown.go b/vendor/github.com/AllenDang/w32/iunknown.go deleted file mode 100644 index d63ff1b..0000000 --- a/vendor/github.com/AllenDang/w32/iunknown.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -type pIUnknownVtbl struct { - pQueryInterface uintptr - pAddRef uintptr - pRelease uintptr -} - -type IUnknown struct { - lpVtbl *pIUnknownVtbl -} - -func (this *IUnknown) QueryInterface(id *GUID) *IDispatch { - return ComQueryInterface(this, id) -} - -func (this *IUnknown) AddRef() int32 { - return ComAddRef(this) -} - -func (this *IUnknown) Release() int32 { - return ComRelease(this) -} diff --git a/vendor/github.com/AllenDang/w32/kernel32.go b/vendor/github.com/AllenDang/w32/kernel32.go deleted file mode 100644 index 28febbe..0000000 --- a/vendor/github.com/AllenDang/w32/kernel32.go +++ /dev/null @@ -1,388 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "syscall" - "unsafe" -) - -var ( - modkernel32 = syscall.NewLazyDLL("kernel32.dll") - - procGetModuleHandle = modkernel32.NewProc("GetModuleHandleW") - procMulDiv = modkernel32.NewProc("MulDiv") - procGetConsoleWindow = modkernel32.NewProc("GetConsoleWindow") - procGetCurrentThread = modkernel32.NewProc("GetCurrentThread") - procGetLogicalDrives = modkernel32.NewProc("GetLogicalDrives") - procGetUserDefaultLCID = modkernel32.NewProc("GetUserDefaultLCID") - procLstrlen = modkernel32.NewProc("lstrlenW") - procLstrcpy = modkernel32.NewProc("lstrcpyW") - procGlobalAlloc = modkernel32.NewProc("GlobalAlloc") - procGlobalFree = modkernel32.NewProc("GlobalFree") - procGlobalLock = modkernel32.NewProc("GlobalLock") - procGlobalUnlock = modkernel32.NewProc("GlobalUnlock") - procMoveMemory = modkernel32.NewProc("RtlMoveMemory") - procFindResource = modkernel32.NewProc("FindResourceW") - procSizeofResource = modkernel32.NewProc("SizeofResource") - procLockResource = modkernel32.NewProc("LockResource") - procLoadResource = modkernel32.NewProc("LoadResource") - procGetLastError = modkernel32.NewProc("GetLastError") - // procOpenProcess = modkernel32.NewProc("OpenProcess") - // procTerminateProcess = modkernel32.NewProc("TerminateProcess") - procCloseHandle = modkernel32.NewProc("CloseHandle") - procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot") - procModule32First = modkernel32.NewProc("Module32FirstW") - procModule32Next = modkernel32.NewProc("Module32NextW") - procGetSystemTimes = modkernel32.NewProc("GetSystemTimes") - procGetConsoleScreenBufferInfo = modkernel32.NewProc("GetConsoleScreenBufferInfo") - procSetConsoleTextAttribute = modkernel32.NewProc("SetConsoleTextAttribute") - procGetDiskFreeSpaceEx = modkernel32.NewProc("GetDiskFreeSpaceExW") - procGetProcessTimes = modkernel32.NewProc("GetProcessTimes") - procSetSystemTime = modkernel32.NewProc("SetSystemTime") - procGetSystemTime = modkernel32.NewProc("GetSystemTime") - procVirtualAllocEx = modkernel32.NewProc("VirtualAllocEx") - procVirtualFreeEx = modkernel32.NewProc("VirtualFreeEx") - procWriteProcessMemory = modkernel32.NewProc("WriteProcessMemory") - procReadProcessMemory = modkernel32.NewProc("ReadProcessMemory") - procQueryPerformanceCounter = modkernel32.NewProc("QueryPerformanceCounter") - procQueryPerformanceFrequency = modkernel32.NewProc("QueryPerformanceFrequency") -) - -func GetModuleHandle(modulename string) HINSTANCE { - var mn uintptr - if modulename == "" { - mn = 0 - } else { - mn = uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(modulename))) - } - ret, _, _ := procGetModuleHandle.Call(mn) - return HINSTANCE(ret) -} - -func MulDiv(number, numerator, denominator int) int { - ret, _, _ := procMulDiv.Call( - uintptr(number), - uintptr(numerator), - uintptr(denominator)) - - return int(ret) -} - -func GetConsoleWindow() HWND { - ret, _, _ := procGetConsoleWindow.Call() - - return HWND(ret) -} - -func GetCurrentThread() HANDLE { - ret, _, _ := procGetCurrentThread.Call() - - return HANDLE(ret) -} - -func GetLogicalDrives() uint32 { - ret, _, _ := procGetLogicalDrives.Call() - - return uint32(ret) -} - -func GetUserDefaultLCID() uint32 { - ret, _, _ := procGetUserDefaultLCID.Call() - - return uint32(ret) -} - -func Lstrlen(lpString *uint16) int { - ret, _, _ := procLstrlen.Call(uintptr(unsafe.Pointer(lpString))) - - return int(ret) -} - -func Lstrcpy(buf []uint16, lpString *uint16) { - procLstrcpy.Call( - uintptr(unsafe.Pointer(&buf[0])), - uintptr(unsafe.Pointer(lpString))) -} - -func GlobalAlloc(uFlags uint, dwBytes uint32) HGLOBAL { - ret, _, _ := procGlobalAlloc.Call( - uintptr(uFlags), - uintptr(dwBytes)) - - if ret == 0 { - panic("GlobalAlloc failed") - } - - return HGLOBAL(ret) -} - -func GlobalFree(hMem HGLOBAL) { - ret, _, _ := procGlobalFree.Call(uintptr(hMem)) - - if ret != 0 { - panic("GlobalFree failed") - } -} - -func GlobalLock(hMem HGLOBAL) unsafe.Pointer { - ret, _, _ := procGlobalLock.Call(uintptr(hMem)) - - if ret == 0 { - panic("GlobalLock failed") - } - - return unsafe.Pointer(ret) -} - -func GlobalUnlock(hMem HGLOBAL) bool { - ret, _, _ := procGlobalUnlock.Call(uintptr(hMem)) - - return ret != 0 -} - -func MoveMemory(destination, source unsafe.Pointer, length uint32) { - procMoveMemory.Call( - uintptr(unsafe.Pointer(destination)), - uintptr(source), - uintptr(length)) -} - -func FindResource(hModule HMODULE, lpName, lpType *uint16) (HRSRC, error) { - ret, _, _ := procFindResource.Call( - uintptr(hModule), - uintptr(unsafe.Pointer(lpName)), - uintptr(unsafe.Pointer(lpType))) - - if ret == 0 { - return 0, syscall.GetLastError() - } - - return HRSRC(ret), nil -} - -func SizeofResource(hModule HMODULE, hResInfo HRSRC) uint32 { - ret, _, _ := procSizeofResource.Call( - uintptr(hModule), - uintptr(hResInfo)) - - if ret == 0 { - panic("SizeofResource failed") - } - - return uint32(ret) -} - -func LockResource(hResData HGLOBAL) unsafe.Pointer { - ret, _, _ := procLockResource.Call(uintptr(hResData)) - - if ret == 0 { - panic("LockResource failed") - } - - return unsafe.Pointer(ret) -} - -func LoadResource(hModule HMODULE, hResInfo HRSRC) HGLOBAL { - ret, _, _ := procLoadResource.Call( - uintptr(hModule), - uintptr(hResInfo)) - - if ret == 0 { - panic("LoadResource failed") - } - - return HGLOBAL(ret) -} - -func GetLastError() uint32 { - ret, _, _ := procGetLastError.Call() - return uint32(ret) -} - -// func OpenProcess(desiredAccess uint32, inheritHandle bool, processId uint32) HANDLE { -// inherit := 0 -// if inheritHandle { -// inherit = 1 -// } - -// ret, _, _ := procOpenProcess.Call( -// uintptr(desiredAccess), -// uintptr(inherit), -// uintptr(processId)) -// return HANDLE(ret) -// } - -// func TerminateProcess(hProcess HANDLE, uExitCode uint) bool { -// ret, _, _ := procTerminateProcess.Call( -// uintptr(hProcess), -// uintptr(uExitCode)) -// return ret != 0 -// } - -func CloseHandle(object HANDLE) bool { - ret, _, _ := procCloseHandle.Call( - uintptr(object)) - return ret != 0 -} - -func CreateToolhelp32Snapshot(flags, processId uint32) HANDLE { - ret, _, _ := procCreateToolhelp32Snapshot.Call( - uintptr(flags), - uintptr(processId)) - - if ret <= 0 { - return HANDLE(0) - } - - return HANDLE(ret) -} - -func Module32First(snapshot HANDLE, me *MODULEENTRY32) bool { - ret, _, _ := procModule32First.Call( - uintptr(snapshot), - uintptr(unsafe.Pointer(me))) - - return ret != 0 -} - -func Module32Next(snapshot HANDLE, me *MODULEENTRY32) bool { - ret, _, _ := procModule32Next.Call( - uintptr(snapshot), - uintptr(unsafe.Pointer(me))) - - return ret != 0 -} - -func GetSystemTimes(lpIdleTime, lpKernelTime, lpUserTime *FILETIME) bool { - ret, _, _ := procGetSystemTimes.Call( - uintptr(unsafe.Pointer(lpIdleTime)), - uintptr(unsafe.Pointer(lpKernelTime)), - uintptr(unsafe.Pointer(lpUserTime))) - - return ret != 0 -} - -func GetProcessTimes(hProcess HANDLE, lpCreationTime, lpExitTime, lpKernelTime, lpUserTime *FILETIME) bool { - ret, _, _ := procGetProcessTimes.Call( - uintptr(hProcess), - uintptr(unsafe.Pointer(lpCreationTime)), - uintptr(unsafe.Pointer(lpExitTime)), - uintptr(unsafe.Pointer(lpKernelTime)), - uintptr(unsafe.Pointer(lpUserTime))) - - return ret != 0 -} - -func GetConsoleScreenBufferInfo(hConsoleOutput HANDLE) *CONSOLE_SCREEN_BUFFER_INFO { - var csbi CONSOLE_SCREEN_BUFFER_INFO - ret, _, _ := procGetConsoleScreenBufferInfo.Call( - uintptr(hConsoleOutput), - uintptr(unsafe.Pointer(&csbi))) - if ret == 0 { - return nil - } - return &csbi -} - -func SetConsoleTextAttribute(hConsoleOutput HANDLE, wAttributes uint16) bool { - ret, _, _ := procSetConsoleTextAttribute.Call( - uintptr(hConsoleOutput), - uintptr(wAttributes)) - return ret != 0 -} - -func GetDiskFreeSpaceEx(dirName string) (r bool, - freeBytesAvailable, totalNumberOfBytes, totalNumberOfFreeBytes uint64) { - ret, _, _ := procGetDiskFreeSpaceEx.Call( - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(dirName))), - uintptr(unsafe.Pointer(&freeBytesAvailable)), - uintptr(unsafe.Pointer(&totalNumberOfBytes)), - uintptr(unsafe.Pointer(&totalNumberOfFreeBytes))) - return ret != 0, - freeBytesAvailable, totalNumberOfBytes, totalNumberOfFreeBytes -} - -func GetSystemTime() *SYSTEMTIME { - var time SYSTEMTIME - procGetSystemTime.Call( - uintptr(unsafe.Pointer(&time))) - return &time -} - -func SetSystemTime(time *SYSTEMTIME) bool { - ret, _, _ := procSetSystemTime.Call( - uintptr(unsafe.Pointer(time))) - return ret != 0 -} - -func VirtualAllocEx(hProcess HANDLE, lpAddress, dwSize uintptr, flAllocationType, flProtect uint32) uintptr { - ret, _, _ := procVirtualAllocEx.Call( - uintptr(hProcess), - lpAddress, - dwSize, - uintptr(flAllocationType), - uintptr(flProtect), - ) - - return ret -} - -func VirtualFreeEx(hProcess HANDLE, lpAddress, dwSize uintptr, dwFreeType uint32) bool { - ret, _, _ := procVirtualFreeEx.Call( - uintptr(hProcess), - lpAddress, - dwSize, - uintptr(dwFreeType), - ) - - return ret != 0 -} - -func WriteProcessMemory(hProcess HANDLE, lpBaseAddress, lpBuffer, nSize uintptr) (int, bool) { - var nBytesWritten int - ret, _, _ := procWriteProcessMemory.Call( - uintptr(hProcess), - lpBaseAddress, - lpBuffer, - nSize, - uintptr(unsafe.Pointer(&nBytesWritten)), - ) - - return nBytesWritten, ret != 0 -} - -func ReadProcessMemory(hProcess HANDLE, lpBaseAddress, nSize uintptr) (lpBuffer []uint16, lpNumberOfBytesRead int, ok bool) { - - var nBytesRead int - buf := make([]uint16, nSize) - ret, _, _ := procReadProcessMemory.Call( - uintptr(hProcess), - lpBaseAddress, - uintptr(unsafe.Pointer(&buf[0])), - nSize, - uintptr(unsafe.Pointer(&nBytesRead)), - ) - - return buf, nBytesRead, ret != 0 -} - -func QueryPerformanceCounter() uint64 { - result := uint64(0) - procQueryPerformanceCounter.Call( - uintptr(unsafe.Pointer(&result)), - ) - - return result -} - -func QueryPerformanceFrequency() uint64 { - result := uint64(0) - procQueryPerformanceFrequency.Call( - uintptr(unsafe.Pointer(&result)), - ) - - return result -} diff --git a/vendor/github.com/AllenDang/w32/ole32.go b/vendor/github.com/AllenDang/w32/ole32.go deleted file mode 100644 index a7f79b5..0000000 --- a/vendor/github.com/AllenDang/w32/ole32.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "syscall" - "unsafe" -) - -var ( - modole32 = syscall.NewLazyDLL("ole32.dll") - - procCoInitializeEx = modole32.NewProc("CoInitializeEx") - procCoInitialize = modole32.NewProc("CoInitialize") - procCoUninitialize = modole32.NewProc("CoUninitialize") - procCreateStreamOnHGlobal = modole32.NewProc("CreateStreamOnHGlobal") -) - -func CoInitializeEx(coInit uintptr) HRESULT { - ret, _, _ := procCoInitializeEx.Call( - 0, - coInit) - - switch uint32(ret) { - case E_INVALIDARG: - panic("CoInitializeEx failed with E_INVALIDARG") - case E_OUTOFMEMORY: - panic("CoInitializeEx failed with E_OUTOFMEMORY") - case E_UNEXPECTED: - panic("CoInitializeEx failed with E_UNEXPECTED") - } - - return HRESULT(ret) -} - -func CoInitialize() { - procCoInitialize.Call(0) -} - -func CoUninitialize() { - procCoUninitialize.Call() -} - -func CreateStreamOnHGlobal(hGlobal HGLOBAL, fDeleteOnRelease bool) *IStream { - stream := new(IStream) - ret, _, _ := procCreateStreamOnHGlobal.Call( - uintptr(hGlobal), - uintptr(BoolToBOOL(fDeleteOnRelease)), - uintptr(unsafe.Pointer(&stream))) - - switch uint32(ret) { - case E_INVALIDARG: - panic("CreateStreamOnHGlobal failed with E_INVALIDARG") - case E_OUTOFMEMORY: - panic("CreateStreamOnHGlobal failed with E_OUTOFMEMORY") - case E_UNEXPECTED: - panic("CreateStreamOnHGlobal failed with E_UNEXPECTED") - } - - return stream -} diff --git a/vendor/github.com/AllenDang/w32/oleaut32.go b/vendor/github.com/AllenDang/w32/oleaut32.go deleted file mode 100644 index 0eeeab7..0000000 --- a/vendor/github.com/AllenDang/w32/oleaut32.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "syscall" - "unsafe" -) - -var ( - modoleaut32 = syscall.NewLazyDLL("oleaut32") - - procVariantInit = modoleaut32.NewProc("VariantInit") - procSysAllocString = modoleaut32.NewProc("SysAllocString") - procSysFreeString = modoleaut32.NewProc("SysFreeString") - procSysStringLen = modoleaut32.NewProc("SysStringLen") - procCreateDispTypeInfo = modoleaut32.NewProc("CreateDispTypeInfo") - procCreateStdDispatch = modoleaut32.NewProc("CreateStdDispatch") -) - -func VariantInit(v *VARIANT) { - hr, _, _ := procVariantInit.Call(uintptr(unsafe.Pointer(v))) - if hr != 0 { - panic("Invoke VariantInit error.") - } - return -} - -func SysAllocString(v string) (ss *int16) { - pss, _, _ := procSysAllocString.Call(uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(v)))) - ss = (*int16)(unsafe.Pointer(pss)) - return -} - -func SysFreeString(v *int16) { - hr, _, _ := procSysFreeString.Call(uintptr(unsafe.Pointer(v))) - if hr != 0 { - panic("Invoke SysFreeString error.") - } - return -} - -func SysStringLen(v *int16) uint { - l, _, _ := procSysStringLen.Call(uintptr(unsafe.Pointer(v))) - return uint(l) -} diff --git a/vendor/github.com/AllenDang/w32/opengl32.go b/vendor/github.com/AllenDang/w32/opengl32.go deleted file mode 100644 index 7363bb1..0000000 --- a/vendor/github.com/AllenDang/w32/opengl32.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "syscall" - "unsafe" -) - -var ( - modopengl32 = syscall.NewLazyDLL("opengl32.dll") - - procwglCreateContext = modopengl32.NewProc("wglCreateContext") - procwglCreateLayerContext = modopengl32.NewProc("wglCreateLayerContext") - procwglDeleteContext = modopengl32.NewProc("wglDeleteContext") - procwglGetProcAddress = modopengl32.NewProc("wglGetProcAddress") - procwglMakeCurrent = modopengl32.NewProc("wglMakeCurrent") - procwglShareLists = modopengl32.NewProc("wglShareLists") -) - -func WglCreateContext(hdc HDC) HGLRC { - ret, _, _ := procwglCreateContext.Call( - uintptr(hdc), - ) - - return HGLRC(ret) -} - -func WglCreateLayerContext(hdc HDC, iLayerPlane int) HGLRC { - ret, _, _ := procwglCreateLayerContext.Call( - uintptr(hdc), - uintptr(iLayerPlane), - ) - - return HGLRC(ret) -} - -func WglDeleteContext(hglrc HGLRC) bool { - ret, _, _ := procwglDeleteContext.Call( - uintptr(hglrc), - ) - - return ret == TRUE -} - -func WglGetProcAddress(szProc string) uintptr { - ret, _, _ := procwglGetProcAddress.Call( - uintptr(unsafe.Pointer(syscall.StringBytePtr(szProc))), - ) - - return ret -} - -func WglMakeCurrent(hdc HDC, hglrc HGLRC) bool { - ret, _, _ := procwglMakeCurrent.Call( - uintptr(hdc), - uintptr(hglrc), - ) - - return ret == TRUE -} - -func WglShareLists(hglrc1, hglrc2 HGLRC) bool { - ret, _, _ := procwglShareLists.Call( - uintptr(hglrc1), - uintptr(hglrc2), - ) - - return ret == TRUE -} diff --git a/vendor/github.com/AllenDang/w32/psapi.go b/vendor/github.com/AllenDang/w32/psapi.go deleted file mode 100644 index bd1e126..0000000 --- a/vendor/github.com/AllenDang/w32/psapi.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "syscall" - "unsafe" -) - -var ( - modpsapi = syscall.NewLazyDLL("psapi.dll") - - procEnumProcesses = modpsapi.NewProc("EnumProcesses") -) - -func EnumProcesses(processIds []uint32, cb uint32, bytesReturned *uint32) bool { - ret, _, _ := procEnumProcesses.Call( - uintptr(unsafe.Pointer(&processIds[0])), - uintptr(cb), - uintptr(unsafe.Pointer(bytesReturned))) - - return ret != 0 -} diff --git a/vendor/github.com/AllenDang/w32/shell32.go b/vendor/github.com/AllenDang/w32/shell32.go deleted file mode 100644 index 0923b8b..0000000 --- a/vendor/github.com/AllenDang/w32/shell32.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "errors" - "fmt" - "syscall" - "unsafe" -) - -var ( - modshell32 = syscall.NewLazyDLL("shell32.dll") - - procSHBrowseForFolder = modshell32.NewProc("SHBrowseForFolderW") - procSHGetPathFromIDList = modshell32.NewProc("SHGetPathFromIDListW") - procDragAcceptFiles = modshell32.NewProc("DragAcceptFiles") - procDragQueryFile = modshell32.NewProc("DragQueryFileW") - procDragQueryPoint = modshell32.NewProc("DragQueryPoint") - procDragFinish = modshell32.NewProc("DragFinish") - procShellExecute = modshell32.NewProc("ShellExecuteW") - procExtractIcon = modshell32.NewProc("ExtractIconW") -) - -func SHBrowseForFolder(bi *BROWSEINFO) uintptr { - ret, _, _ := procSHBrowseForFolder.Call(uintptr(unsafe.Pointer(bi))) - - return ret -} - -func SHGetPathFromIDList(idl uintptr) string { - buf := make([]uint16, 1024) - procSHGetPathFromIDList.Call( - idl, - uintptr(unsafe.Pointer(&buf[0]))) - - return syscall.UTF16ToString(buf) -} - -func DragAcceptFiles(hwnd HWND, accept bool) { - procDragAcceptFiles.Call( - uintptr(hwnd), - uintptr(BoolToBOOL(accept))) -} - -func DragQueryFile(hDrop HDROP, iFile uint) (fileName string, fileCount uint) { - ret, _, _ := procDragQueryFile.Call( - uintptr(hDrop), - uintptr(iFile), - 0, - 0) - - fileCount = uint(ret) - - if iFile != 0xFFFFFFFF { - buf := make([]uint16, fileCount+1) - - ret, _, _ := procDragQueryFile.Call( - uintptr(hDrop), - uintptr(iFile), - uintptr(unsafe.Pointer(&buf[0])), - uintptr(fileCount+1)) - - if ret == 0 { - panic("Invoke DragQueryFile error.") - } - - fileName = syscall.UTF16ToString(buf) - } - - return -} - -func DragQueryPoint(hDrop HDROP) (x, y int, isClientArea bool) { - var pt POINT - ret, _, _ := procDragQueryPoint.Call( - uintptr(hDrop), - uintptr(unsafe.Pointer(&pt))) - - return int(pt.X), int(pt.Y), (ret == 1) -} - -func DragFinish(hDrop HDROP) { - procDragFinish.Call(uintptr(hDrop)) -} - -func ShellExecute(hwnd HWND, lpOperation, lpFile, lpParameters, lpDirectory string, nShowCmd int) error { - var op, param, directory uintptr - if len(lpOperation) != 0 { - op = uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpOperation))) - } - if len(lpParameters) != 0 { - param = uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpParameters))) - } - if len(lpDirectory) != 0 { - directory = uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpDirectory))) - } - - ret, _, _ := procShellExecute.Call( - uintptr(hwnd), - op, - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpFile))), - param, - directory, - uintptr(nShowCmd)) - - errorMsg := "" - if ret != 0 && ret <= 32 { - switch int(ret) { - case ERROR_FILE_NOT_FOUND: - errorMsg = "The specified file was not found." - case ERROR_PATH_NOT_FOUND: - errorMsg = "The specified path was not found." - case ERROR_BAD_FORMAT: - errorMsg = "The .exe file is invalid (non-Win32 .exe or error in .exe image)." - case SE_ERR_ACCESSDENIED: - errorMsg = "The operating system denied access to the specified file." - case SE_ERR_ASSOCINCOMPLETE: - errorMsg = "The file name association is incomplete or invalid." - case SE_ERR_DDEBUSY: - errorMsg = "The DDE transaction could not be completed because other DDE transactions were being processed." - case SE_ERR_DDEFAIL: - errorMsg = "The DDE transaction failed." - case SE_ERR_DDETIMEOUT: - errorMsg = "The DDE transaction could not be completed because the request timed out." - case SE_ERR_DLLNOTFOUND: - errorMsg = "The specified DLL was not found." - case SE_ERR_NOASSOC: - errorMsg = "There is no application associated with the given file name extension. This error will also be returned if you attempt to print a file that is not printable." - case SE_ERR_OOM: - errorMsg = "There was not enough memory to complete the operation." - case SE_ERR_SHARE: - errorMsg = "A sharing violation occurred." - default: - errorMsg = fmt.Sprintf("Unknown error occurred with error code %v", ret) - } - } else { - return nil - } - - return errors.New(errorMsg) -} - -func ExtractIcon(lpszExeFileName string, nIconIndex int) HICON { - ret, _, _ := procExtractIcon.Call( - 0, - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(lpszExeFileName))), - uintptr(nIconIndex)) - - return HICON(ret) -} diff --git a/vendor/github.com/AllenDang/w32/typedef.go b/vendor/github.com/AllenDang/w32/typedef.go deleted file mode 100644 index 118f76c..0000000 --- a/vendor/github.com/AllenDang/w32/typedef.go +++ /dev/null @@ -1,891 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "unsafe" -) - -// From MSDN: Windows Data Types -// http://msdn.microsoft.com/en-us/library/s3f49ktz.aspx -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751.aspx -// ATOM WORD -// BOOL int32 -// BOOLEAN byte -// BYTE byte -// CCHAR int8 -// CHAR int8 -// COLORREF DWORD -// DWORD uint32 -// DWORDLONG ULONGLONG -// DWORD_PTR ULONG_PTR -// DWORD32 uint32 -// DWORD64 uint64 -// FLOAT float32 -// HACCEL HANDLE -// HALF_PTR struct{} // ??? -// HANDLE PVOID -// HBITMAP HANDLE -// HBRUSH HANDLE -// HCOLORSPACE HANDLE -// HCONV HANDLE -// HCONVLIST HANDLE -// HCURSOR HANDLE -// HDC HANDLE -// HDDEDATA HANDLE -// HDESK HANDLE -// HDROP HANDLE -// HDWP HANDLE -// HENHMETAFILE HANDLE -// HFILE HANDLE -// HFONT HANDLE -// HGDIOBJ HANDLE -// HGLOBAL HANDLE -// HHOOK HANDLE -// HICON HANDLE -// HINSTANCE HANDLE -// HKEY HANDLE -// HKL HANDLE -// HLOCAL HANDLE -// HMENU HANDLE -// HMETAFILE HANDLE -// HMODULE HANDLE -// HPALETTE HANDLE -// HPEN HANDLE -// HRESULT int32 -// HRGN HANDLE -// HSZ HANDLE -// HWINSTA HANDLE -// HWND HANDLE -// INT int32 -// INT_PTR uintptr -// INT8 int8 -// INT16 int16 -// INT32 int32 -// INT64 int64 -// LANGID WORD -// LCID DWORD -// LCTYPE DWORD -// LGRPID DWORD -// LONG int32 -// LONGLONG int64 -// LONG_PTR uintptr -// LONG32 int32 -// LONG64 int64 -// LPARAM LONG_PTR -// LPBOOL *BOOL -// LPBYTE *BYTE -// LPCOLORREF *COLORREF -// LPCSTR *int8 -// LPCTSTR LPCWSTR -// LPCVOID unsafe.Pointer -// LPCWSTR *WCHAR -// LPDWORD *DWORD -// LPHANDLE *HANDLE -// LPINT *INT -// LPLONG *LONG -// LPSTR *CHAR -// LPTSTR LPWSTR -// LPVOID unsafe.Pointer -// LPWORD *WORD -// LPWSTR *WCHAR -// LRESULT LONG_PTR -// PBOOL *BOOL -// PBOOLEAN *BOOLEAN -// PBYTE *BYTE -// PCHAR *CHAR -// PCSTR *CHAR -// PCTSTR PCWSTR -// PCWSTR *WCHAR -// PDWORD *DWORD -// PDWORDLONG *DWORDLONG -// PDWORD_PTR *DWORD_PTR -// PDWORD32 *DWORD32 -// PDWORD64 *DWORD64 -// PFLOAT *FLOAT -// PHALF_PTR *HALF_PTR -// PHANDLE *HANDLE -// PHKEY *HKEY -// PINT_PTR *INT_PTR -// PINT8 *INT8 -// PINT16 *INT16 -// PINT32 *INT32 -// PINT64 *INT64 -// PLCID *LCID -// PLONG *LONG -// PLONGLONG *LONGLONG -// PLONG_PTR *LONG_PTR -// PLONG32 *LONG32 -// PLONG64 *LONG64 -// POINTER_32 struct{} // ??? -// POINTER_64 struct{} // ??? -// POINTER_SIGNED uintptr -// POINTER_UNSIGNED uintptr -// PSHORT *SHORT -// PSIZE_T *SIZE_T -// PSSIZE_T *SSIZE_T -// PSTR *CHAR -// PTBYTE *TBYTE -// PTCHAR *TCHAR -// PTSTR PWSTR -// PUCHAR *UCHAR -// PUHALF_PTR *UHALF_PTR -// PUINT *UINT -// PUINT_PTR *UINT_PTR -// PUINT8 *UINT8 -// PUINT16 *UINT16 -// PUINT32 *UINT32 -// PUINT64 *UINT64 -// PULONG *ULONG -// PULONGLONG *ULONGLONG -// PULONG_PTR *ULONG_PTR -// PULONG32 *ULONG32 -// PULONG64 *ULONG64 -// PUSHORT *USHORT -// PVOID unsafe.Pointer -// PWCHAR *WCHAR -// PWORD *WORD -// PWSTR *WCHAR -// QWORD uint64 -// SC_HANDLE HANDLE -// SC_LOCK LPVOID -// SERVICE_STATUS_HANDLE HANDLE -// SHORT int16 -// SIZE_T ULONG_PTR -// SSIZE_T LONG_PTR -// TBYTE WCHAR -// TCHAR WCHAR -// UCHAR uint8 -// UHALF_PTR struct{} // ??? -// UINT uint32 -// UINT_PTR uintptr -// UINT8 uint8 -// UINT16 uint16 -// UINT32 uint32 -// UINT64 uint64 -// ULONG uint32 -// ULONGLONG uint64 -// ULONG_PTR uintptr -// ULONG32 uint32 -// ULONG64 uint64 -// USHORT uint16 -// USN LONGLONG -// WCHAR uint16 -// WORD uint16 -// WPARAM UINT_PTR -type ( - ATOM uint16 - BOOL int32 - COLORREF uint32 - DWM_FRAME_COUNT uint64 - DWORD uint32 - HACCEL HANDLE - HANDLE uintptr - HBITMAP HANDLE - HBRUSH HANDLE - HCURSOR HANDLE - HDC HANDLE - HDROP HANDLE - HDWP HANDLE - HENHMETAFILE HANDLE - HFONT HANDLE - HGDIOBJ HANDLE - HGLOBAL HANDLE - HGLRC HANDLE - HHOOK HANDLE - HICON HANDLE - HIMAGELIST HANDLE - HINSTANCE HANDLE - HKEY HANDLE - HKL HANDLE - HMENU HANDLE - HMODULE HANDLE - HMONITOR HANDLE - HPEN HANDLE - HRESULT int32 - HRGN HANDLE - HRSRC HANDLE - HTHUMBNAIL HANDLE - HWND HANDLE - LPARAM uintptr - LPCVOID unsafe.Pointer - LRESULT uintptr - PVOID unsafe.Pointer - QPC_TIME uint64 - ULONG_PTR uintptr - WPARAM uintptr - TRACEHANDLE uintptr -) - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd162805.aspx -type POINT struct { - X, Y int32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd162897.aspx -type RECT struct { - Left, Top, Right, Bottom int32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms633577.aspx -type WNDCLASSEX struct { - Size uint32 - Style uint32 - WndProc uintptr - ClsExtra int32 - WndExtra int32 - Instance HINSTANCE - Icon HICON - Cursor HCURSOR - Background HBRUSH - MenuName *uint16 - ClassName *uint16 - IconSm HICON -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms644958.aspx -type MSG struct { - Hwnd HWND - Message uint32 - WParam uintptr - LParam uintptr - Time uint32 - Pt POINT -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd145037.aspx -type LOGFONT struct { - Height int32 - Width int32 - Escapement int32 - Orientation int32 - Weight int32 - Italic byte - Underline byte - StrikeOut byte - CharSet byte - OutPrecision byte - ClipPrecision byte - Quality byte - PitchAndFamily byte - FaceName [LF_FACESIZE]uint16 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms646839.aspx -type OPENFILENAME struct { - StructSize uint32 - Owner HWND - Instance HINSTANCE - Filter *uint16 - CustomFilter *uint16 - MaxCustomFilter uint32 - FilterIndex uint32 - File *uint16 - MaxFile uint32 - FileTitle *uint16 - MaxFileTitle uint32 - InitialDir *uint16 - Title *uint16 - Flags uint32 - FileOffset uint16 - FileExtension uint16 - DefExt *uint16 - CustData uintptr - FnHook uintptr - TemplateName *uint16 - PvReserved unsafe.Pointer - DwReserved uint32 - FlagsEx uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/bb773205.aspx -type BROWSEINFO struct { - Owner HWND - Root *uint16 - DisplayName *uint16 - Title *uint16 - Flags uint32 - CallbackFunc uintptr - LParam uintptr - Image int32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa373931.aspx -type GUID struct { - Data1 uint32 - Data2 uint16 - Data3 uint16 - Data4 [8]byte -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms221627.aspx -type VARIANT struct { - VT uint16 // 2 - WReserved1 uint16 // 4 - WReserved2 uint16 // 6 - WReserved3 uint16 // 8 - Val int64 // 16 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms221416.aspx -type DISPPARAMS struct { - Rgvarg uintptr - RgdispidNamedArgs uintptr - CArgs uint32 - CNamedArgs uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms221133.aspx -type EXCEPINFO struct { - WCode uint16 - WReserved uint16 - BstrSource *uint16 - BstrDescription *uint16 - BstrHelpFile *uint16 - DwHelpContext uint32 - PvReserved uintptr - PfnDeferredFillIn uintptr - Scode int32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd145035.aspx -type LOGBRUSH struct { - LbStyle uint32 - LbColor COLORREF - LbHatch uintptr -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd183565.aspx -type DEVMODE struct { - DmDeviceName [CCHDEVICENAME]uint16 - DmSpecVersion uint16 - DmDriverVersion uint16 - DmSize uint16 - DmDriverExtra uint16 - DmFields uint32 - DmOrientation int16 - DmPaperSize int16 - DmPaperLength int16 - DmPaperWidth int16 - DmScale int16 - DmCopies int16 - DmDefaultSource int16 - DmPrintQuality int16 - DmColor int16 - DmDuplex int16 - DmYResolution int16 - DmTTOption int16 - DmCollate int16 - DmFormName [CCHFORMNAME]uint16 - DmLogPixels uint16 - DmBitsPerPel uint32 - DmPelsWidth uint32 - DmPelsHeight uint32 - DmDisplayFlags uint32 - DmDisplayFrequency uint32 - DmICMMethod uint32 - DmICMIntent uint32 - DmMediaType uint32 - DmDitherType uint32 - DmReserved1 uint32 - DmReserved2 uint32 - DmPanningWidth uint32 - DmPanningHeight uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd183376.aspx -type BITMAPINFOHEADER struct { - BiSize uint32 - BiWidth int32 - BiHeight int32 - BiPlanes uint16 - BiBitCount uint16 - BiCompression uint32 - BiSizeImage uint32 - BiXPelsPerMeter int32 - BiYPelsPerMeter int32 - BiClrUsed uint32 - BiClrImportant uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd162938.aspx -type RGBQUAD struct { - RgbBlue byte - RgbGreen byte - RgbRed byte - RgbReserved byte -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd183375.aspx -type BITMAPINFO struct { - BmiHeader BITMAPINFOHEADER - BmiColors *RGBQUAD -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd183371.aspx -type BITMAP struct { - BmType int32 - BmWidth int32 - BmHeight int32 - BmWidthBytes int32 - BmPlanes uint16 - BmBitsPixel uint16 - BmBits unsafe.Pointer -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd183567.aspx -type DIBSECTION struct { - DsBm BITMAP - DsBmih BITMAPINFOHEADER - DsBitfields [3]uint32 - DshSection HANDLE - DsOffset uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd162607.aspx -type ENHMETAHEADER struct { - IType uint32 - NSize uint32 - RclBounds RECT - RclFrame RECT - DSignature uint32 - NVersion uint32 - NBytes uint32 - NRecords uint32 - NHandles uint16 - SReserved uint16 - NDescription uint32 - OffDescription uint32 - NPalEntries uint32 - SzlDevice SIZE - SzlMillimeters SIZE - CbPixelFormat uint32 - OffPixelFormat uint32 - BOpenGL uint32 - SzlMicrometers SIZE -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd145106.aspx -type SIZE struct { - CX, CY int32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd145132.aspx -type TEXTMETRIC struct { - TmHeight int32 - TmAscent int32 - TmDescent int32 - TmInternalLeading int32 - TmExternalLeading int32 - TmAveCharWidth int32 - TmMaxCharWidth int32 - TmWeight int32 - TmOverhang int32 - TmDigitizedAspectX int32 - TmDigitizedAspectY int32 - TmFirstChar uint16 - TmLastChar uint16 - TmDefaultChar uint16 - TmBreakChar uint16 - TmItalic byte - TmUnderlined byte - TmStruckOut byte - TmPitchAndFamily byte - TmCharSet byte -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd183574.aspx -type DOCINFO struct { - CbSize int32 - LpszDocName *uint16 - LpszOutput *uint16 - LpszDatatype *uint16 - FwType uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/bb775514.aspx -type NMHDR struct { - HwndFrom HWND - IdFrom uintptr - Code uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/bb774743.aspx -type LVCOLUMN struct { - Mask uint32 - Fmt int32 - Cx int32 - PszText *uint16 - CchTextMax int32 - ISubItem int32 - IImage int32 - IOrder int32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/bb774760.aspx -type LVITEM struct { - Mask uint32 - IItem int32 - ISubItem int32 - State uint32 - StateMask uint32 - PszText *uint16 - CchTextMax int32 - IImage int32 - LParam uintptr - IIndent int32 - IGroupId int32 - CColumns uint32 - PuColumns uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/bb774754.aspx -type LVHITTESTINFO struct { - Pt POINT - Flags uint32 - IItem int32 - ISubItem int32 - IGroup int32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/bb774771.aspx -type NMITEMACTIVATE struct { - Hdr NMHDR - IItem int32 - ISubItem int32 - UNewState uint32 - UOldState uint32 - UChanged uint32 - PtAction POINT - LParam uintptr - UKeyFlags uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/bb774773.aspx -type NMLISTVIEW struct { - Hdr NMHDR - IItem int32 - ISubItem int32 - UNewState uint32 - UOldState uint32 - UChanged uint32 - PtAction POINT - LParam uintptr -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/bb774780.aspx -type NMLVDISPINFO struct { - Hdr NMHDR - Item LVITEM -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/bb775507.aspx -type INITCOMMONCONTROLSEX struct { - DwSize uint32 - DwICC uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/bb760256.aspx -type TOOLINFO struct { - CbSize uint32 - UFlags uint32 - Hwnd HWND - UId uintptr - Rect RECT - Hinst HINSTANCE - LpszText *uint16 - LParam uintptr - LpReserved unsafe.Pointer -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms645604.aspx -type TRACKMOUSEEVENT struct { - CbSize uint32 - DwFlags uint32 - HwndTrack HWND - DwHoverTime uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms534067.aspx -type GdiplusStartupInput struct { - GdiplusVersion uint32 - DebugEventCallback uintptr - SuppressBackgroundThread BOOL - SuppressExternalCodecs BOOL -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms534068.aspx -type GdiplusStartupOutput struct { - NotificationHook uintptr - NotificationUnhook uintptr -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd162768.aspx -type PAINTSTRUCT struct { - Hdc HDC - FErase BOOL - RcPaint RECT - FRestore BOOL - FIncUpdate BOOL - RgbReserved [32]byte -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms684225.aspx -type MODULEENTRY32 struct { - Size uint32 - ModuleID uint32 - ProcessID uint32 - GlblcntUsage uint32 - ProccntUsage uint32 - ModBaseAddr *uint8 - ModBaseSize uint32 - HModule HMODULE - SzModule [MAX_MODULE_NAME32 + 1]uint16 - SzExePath [MAX_PATH]uint16 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms724284.aspx -type FILETIME struct { - DwLowDateTime uint32 - DwHighDateTime uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms682119.aspx -type COORD struct { - X, Y int16 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms686311.aspx -type SMALL_RECT struct { - Left, Top, Right, Bottom int16 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms682093.aspx -type CONSOLE_SCREEN_BUFFER_INFO struct { - DwSize COORD - DwCursorPosition COORD - WAttributes uint16 - SrWindow SMALL_RECT - DwMaximumWindowSize COORD -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/bb773244.aspx -type MARGINS struct { - CxLeftWidth, CxRightWidth, CyTopHeight, CyBottomHeight int32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa969500.aspx -type DWM_BLURBEHIND struct { - DwFlags uint32 - fEnable BOOL - hRgnBlur HRGN - fTransitionOnMaximized BOOL -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa969501.aspx -type DWM_PRESENT_PARAMETERS struct { - cbSize uint32 - fQueue BOOL - cRefreshStart DWM_FRAME_COUNT - cBuffer uint32 - fUseSourceRate BOOL - rateSource UNSIGNED_RATIO - cRefreshesPerFrame uint32 - eSampling DWM_SOURCE_FRAME_SAMPLING -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa969502.aspx -type DWM_THUMBNAIL_PROPERTIES struct { - dwFlags uint32 - rcDestination RECT - rcSource RECT - opacity byte - fVisible BOOL - fSourceClientAreaOnly BOOL -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa969503.aspx -type DWM_TIMING_INFO struct { - cbSize uint32 - rateRefresh UNSIGNED_RATIO - qpcRefreshPeriod QPC_TIME - rateCompose UNSIGNED_RATIO - qpcVBlank QPC_TIME - cRefresh DWM_FRAME_COUNT - cDXRefresh uint32 - qpcCompose QPC_TIME - cFrame DWM_FRAME_COUNT - cDXPresent uint32 - cRefreshFrame DWM_FRAME_COUNT - cFrameSubmitted DWM_FRAME_COUNT - cDXPresentSubmitted uint32 - cFrameConfirmed DWM_FRAME_COUNT - cDXPresentConfirmed uint32 - cRefreshConfirmed DWM_FRAME_COUNT - cDXRefreshConfirmed uint32 - cFramesLate DWM_FRAME_COUNT - cFramesOutstanding uint32 - cFrameDisplayed DWM_FRAME_COUNT - qpcFrameDisplayed QPC_TIME - cRefreshFrameDisplayed DWM_FRAME_COUNT - cFrameComplete DWM_FRAME_COUNT - qpcFrameComplete QPC_TIME - cFramePending DWM_FRAME_COUNT - qpcFramePending QPC_TIME - cFramesDisplayed DWM_FRAME_COUNT - cFramesComplete DWM_FRAME_COUNT - cFramesPending DWM_FRAME_COUNT - cFramesAvailable DWM_FRAME_COUNT - cFramesDropped DWM_FRAME_COUNT - cFramesMissed DWM_FRAME_COUNT - cRefreshNextDisplayed DWM_FRAME_COUNT - cRefreshNextPresented DWM_FRAME_COUNT - cRefreshesDisplayed DWM_FRAME_COUNT - cRefreshesPresented DWM_FRAME_COUNT - cRefreshStarted DWM_FRAME_COUNT - cPixelsReceived uint64 - cPixelsDrawn uint64 - cBuffersEmpty DWM_FRAME_COUNT -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd389402.aspx -type MilMatrix3x2D struct { - S_11, S_12, S_21, S_22 float64 - DX, DY float64 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/aa969505.aspx -type UNSIGNED_RATIO struct { - uiNumerator uint32 - uiDenominator uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms632603.aspx -type CREATESTRUCT struct { - CreateParams uintptr - Instance HINSTANCE - Menu HMENU - Parent HWND - Cy, Cx int32 - Y, X int32 - Style int32 - Name *uint16 - Class *uint16 - dwExStyle uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd145065.aspx -type MONITORINFO struct { - CbSize uint32 - RcMonitor RECT - RcWork RECT - DwFlags uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd145066.aspx -type MONITORINFOEX struct { - MONITORINFO - SzDevice [CCHDEVICENAME]uint16 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/dd368826.aspx -type PIXELFORMATDESCRIPTOR struct { - Size uint16 - Version uint16 - DwFlags uint32 - IPixelType byte - ColorBits byte - RedBits, RedShift byte - GreenBits, GreenShift byte - BlueBits, BlueShift byte - AlphaBits, AlphaShift byte - AccumBits byte - AccumRedBits byte - AccumGreenBits byte - AccumBlueBits byte - AccumAlphaBits byte - DepthBits, StencilBits byte - AuxBuffers byte - ILayerType byte - Reserved byte - DwLayerMask uint32 - DwVisibleMask uint32 - DwDamageMask uint32 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms646270(v=vs.85).aspx -type INPUT struct { - Type uint32 - Mi MOUSEINPUT - Ki KEYBDINPUT - Hi HARDWAREINPUT -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms646273(v=vs.85).aspx -type MOUSEINPUT struct { - Dx int32 - Dy int32 - MouseData uint32 - DwFlags uint32 - Time uint32 - DwExtraInfo uintptr -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms646271(v=vs.85).aspx -type KEYBDINPUT struct { - WVk uint16 - WScan uint16 - DwFlags uint32 - Time uint32 - DwExtraInfo uintptr -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms646269(v=vs.85).aspx -type HARDWAREINPUT struct { - UMsg uint32 - WParamL uint16 - WParamH uint16 -} - -type KbdInput struct { - typ uint32 - ki KEYBDINPUT -} - -type MouseInput struct { - typ uint32 - mi MOUSEINPUT -} - -type HardwareInput struct { - typ uint32 - hi HARDWAREINPUT -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms724950(v=vs.85).aspx -type SYSTEMTIME struct { - Year uint16 - Month uint16 - DayOfWeek uint16 - Day uint16 - Hour uint16 - Minute uint16 - Second uint16 - Milliseconds uint16 -} - -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms644967(v=vs.85).aspx -type KBDLLHOOKSTRUCT struct { - VkCode DWORD - ScanCode DWORD - Flags DWORD - Time DWORD - DwExtraInfo ULONG_PTR -} - -type HOOKPROC func(int, WPARAM, LPARAM) LRESULT - -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms633498(v=vs.85).aspx -type WNDENUMPROC func(HWND, LPARAM) LRESULT diff --git a/vendor/github.com/AllenDang/w32/user32.go b/vendor/github.com/AllenDang/w32/user32.go deleted file mode 100644 index 8286e89..0000000 --- a/vendor/github.com/AllenDang/w32/user32.go +++ /dev/null @@ -1,1046 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "fmt" - "syscall" - "unsafe" -) - -var ( - moduser32 = syscall.NewLazyDLL("user32.dll") - - procRegisterClassEx = moduser32.NewProc("RegisterClassExW") - procLoadIcon = moduser32.NewProc("LoadIconW") - procLoadCursor = moduser32.NewProc("LoadCursorW") - procShowWindow = moduser32.NewProc("ShowWindow") - procUpdateWindow = moduser32.NewProc("UpdateWindow") - procCreateWindowEx = moduser32.NewProc("CreateWindowExW") - procAdjustWindowRect = moduser32.NewProc("AdjustWindowRect") - procAdjustWindowRectEx = moduser32.NewProc("AdjustWindowRectEx") - procDestroyWindow = moduser32.NewProc("DestroyWindow") - procDefWindowProc = moduser32.NewProc("DefWindowProcW") - procDefDlgProc = moduser32.NewProc("DefDlgProcW") - procPostQuitMessage = moduser32.NewProc("PostQuitMessage") - procGetMessage = moduser32.NewProc("GetMessageW") - procTranslateMessage = moduser32.NewProc("TranslateMessage") - procDispatchMessage = moduser32.NewProc("DispatchMessageW") - procSendMessage = moduser32.NewProc("SendMessageW") - procSendMessageTimeout = moduser32.NewProc("SendMessageTimeout") - procPostMessage = moduser32.NewProc("PostMessageW") - procWaitMessage = moduser32.NewProc("WaitMessage") - procSetWindowText = moduser32.NewProc("SetWindowTextW") - procGetWindowTextLength = moduser32.NewProc("GetWindowTextLengthW") - procGetWindowText = moduser32.NewProc("GetWindowTextW") - procGetWindowRect = moduser32.NewProc("GetWindowRect") - procMoveWindow = moduser32.NewProc("MoveWindow") - procScreenToClient = moduser32.NewProc("ScreenToClient") - procCallWindowProc = moduser32.NewProc("CallWindowProcW") - procSetWindowLong = moduser32.NewProc("SetWindowLongW") - procSetWindowLongPtr = moduser32.NewProc("SetWindowLongW") - procGetWindowLong = moduser32.NewProc("GetWindowLongW") - procGetWindowLongPtr = moduser32.NewProc("GetWindowLongW") - procEnableWindow = moduser32.NewProc("EnableWindow") - procIsWindowEnabled = moduser32.NewProc("IsWindowEnabled") - procIsWindowVisible = moduser32.NewProc("IsWindowVisible") - procSetFocus = moduser32.NewProc("SetFocus") - procInvalidateRect = moduser32.NewProc("InvalidateRect") - procGetClientRect = moduser32.NewProc("GetClientRect") - procGetDC = moduser32.NewProc("GetDC") - procReleaseDC = moduser32.NewProc("ReleaseDC") - procSetCapture = moduser32.NewProc("SetCapture") - procReleaseCapture = moduser32.NewProc("ReleaseCapture") - procGetWindowThreadProcessId = moduser32.NewProc("GetWindowThreadProcessId") - procMessageBox = moduser32.NewProc("MessageBoxW") - procGetSystemMetrics = moduser32.NewProc("GetSystemMetrics") - procCopyRect = moduser32.NewProc("CopyRect") - procEqualRect = moduser32.NewProc("EqualRect") - procInflateRect = moduser32.NewProc("InflateRect") - procIntersectRect = moduser32.NewProc("IntersectRect") - procIsRectEmpty = moduser32.NewProc("IsRectEmpty") - procOffsetRect = moduser32.NewProc("OffsetRect") - procPtInRect = moduser32.NewProc("PtInRect") - procSetRect = moduser32.NewProc("SetRect") - procSetRectEmpty = moduser32.NewProc("SetRectEmpty") - procSubtractRect = moduser32.NewProc("SubtractRect") - procUnionRect = moduser32.NewProc("UnionRect") - procCreateDialogParam = moduser32.NewProc("CreateDialogParamW") - procDialogBoxParam = moduser32.NewProc("DialogBoxParamW") - procGetDlgItem = moduser32.NewProc("GetDlgItem") - procDrawIcon = moduser32.NewProc("DrawIcon") - procClientToScreen = moduser32.NewProc("ClientToScreen") - procIsDialogMessage = moduser32.NewProc("IsDialogMessageW") - procIsWindow = moduser32.NewProc("IsWindow") - procEndDialog = moduser32.NewProc("EndDialog") - procPeekMessage = moduser32.NewProc("PeekMessageW") - procTranslateAccelerator = moduser32.NewProc("TranslateAcceleratorW") - procSetWindowPos = moduser32.NewProc("SetWindowPos") - procFillRect = moduser32.NewProc("FillRect") - procDrawText = moduser32.NewProc("DrawTextW") - procAddClipboardFormatListener = moduser32.NewProc("AddClipboardFormatListener") - procRemoveClipboardFormatListener = moduser32.NewProc("RemoveClipboardFormatListener") - procOpenClipboard = moduser32.NewProc("OpenClipboard") - procCloseClipboard = moduser32.NewProc("CloseClipboard") - procEnumClipboardFormats = moduser32.NewProc("EnumClipboardFormats") - procGetClipboardData = moduser32.NewProc("GetClipboardData") - procSetClipboardData = moduser32.NewProc("SetClipboardData") - procEmptyClipboard = moduser32.NewProc("EmptyClipboard") - procGetClipboardFormatName = moduser32.NewProc("GetClipboardFormatNameW") - procIsClipboardFormatAvailable = moduser32.NewProc("IsClipboardFormatAvailable") - procBeginPaint = moduser32.NewProc("BeginPaint") - procEndPaint = moduser32.NewProc("EndPaint") - procGetKeyboardState = moduser32.NewProc("GetKeyboardState") - procMapVirtualKey = moduser32.NewProc("MapVirtualKeyExW") - procGetAsyncKeyState = moduser32.NewProc("GetAsyncKeyState") - procToAscii = moduser32.NewProc("ToAscii") - procSwapMouseButton = moduser32.NewProc("SwapMouseButton") - procGetCursorPos = moduser32.NewProc("GetCursorPos") - procSetCursorPos = moduser32.NewProc("SetCursorPos") - procSetCursor = moduser32.NewProc("SetCursor") - procCreateIcon = moduser32.NewProc("CreateIcon") - procDestroyIcon = moduser32.NewProc("DestroyIcon") - procMonitorFromPoint = moduser32.NewProc("MonitorFromPoint") - procMonitorFromRect = moduser32.NewProc("MonitorFromRect") - procMonitorFromWindow = moduser32.NewProc("MonitorFromWindow") - procGetMonitorInfo = moduser32.NewProc("GetMonitorInfoW") - procEnumDisplayMonitors = moduser32.NewProc("EnumDisplayMonitors") - procEnumDisplaySettingsEx = moduser32.NewProc("EnumDisplaySettingsExW") - procChangeDisplaySettingsEx = moduser32.NewProc("ChangeDisplaySettingsExW") - procSendInput = moduser32.NewProc("SendInput") - procSetWindowsHookEx = moduser32.NewProc("SetWindowsHookExW") - procUnhookWindowsHookEx = moduser32.NewProc("UnhookWindowsHookEx") - procCallNextHookEx = moduser32.NewProc("CallNextHookEx") - procSetForegroundWindow = moduser32.NewProc("SetForegroundWindow") - procFindWindowW = moduser32.NewProc("FindWindowW") - procFindWindowExW = moduser32.NewProc("FindWindowExW") - procGetClassName = moduser32.NewProc("GetClassNameW") - procEnumChildWindows = moduser32.NewProc("EnumChildWindows") - procSetTimer = moduser32.NewProc("SetTimer") - procKillTimer = moduser32.NewProc("KillTimer") - procRedrawWindow = moduser32.NewProc("RedrawWindow") -) - -func RegisterClassEx(wndClassEx *WNDCLASSEX) ATOM { - ret, _, _ := procRegisterClassEx.Call(uintptr(unsafe.Pointer(wndClassEx))) - return ATOM(ret) -} - -func LoadIcon(instance HINSTANCE, iconName *uint16) HICON { - ret, _, _ := procLoadIcon.Call( - uintptr(instance), - uintptr(unsafe.Pointer(iconName))) - - return HICON(ret) - -} - -func LoadCursor(instance HINSTANCE, cursorName *uint16) HCURSOR { - ret, _, _ := procLoadCursor.Call( - uintptr(instance), - uintptr(unsafe.Pointer(cursorName))) - - return HCURSOR(ret) - -} - -func GetClassNameW(hwnd HWND) string { - buf := make([]uint16, 255) - procGetClassName.Call( - uintptr(hwnd), - uintptr(unsafe.Pointer(&buf[0])), - uintptr(255)) - - return syscall.UTF16ToString(buf) -} - -func SetForegroundWindow(hwnd HWND) bool { - ret, _, _ := procSetForegroundWindow.Call( - uintptr(hwnd)) - - return ret != 0 -} - -func ShowWindow(hwnd HWND, cmdshow int) bool { - ret, _, _ := procShowWindow.Call( - uintptr(hwnd), - uintptr(cmdshow)) - - return ret != 0 - -} - -func UpdateWindow(hwnd HWND) bool { - ret, _, _ := procUpdateWindow.Call( - uintptr(hwnd)) - return ret != 0 -} - -func CreateWindowEx(exStyle uint, className, windowName *uint16, - style uint, x, y, width, height int, parent HWND, menu HMENU, - instance HINSTANCE, param unsafe.Pointer) HWND { - ret, _, _ := procCreateWindowEx.Call( - uintptr(exStyle), - uintptr(unsafe.Pointer(className)), - uintptr(unsafe.Pointer(windowName)), - uintptr(style), - uintptr(x), - uintptr(y), - uintptr(width), - uintptr(height), - uintptr(parent), - uintptr(menu), - uintptr(instance), - uintptr(param)) - - return HWND(ret) -} - -func FindWindowExW(hwndParent, hwndChildAfter HWND, className, windowName *uint16) HWND { - ret, _, _ := procFindWindowExW.Call( - uintptr(hwndParent), - uintptr(hwndChildAfter), - uintptr(unsafe.Pointer(className)), - uintptr(unsafe.Pointer(windowName))) - - return HWND(ret) -} - -func FindWindowW(className, windowName *uint16) HWND { - ret, _, _ := procFindWindowW.Call( - uintptr(unsafe.Pointer(className)), - uintptr(unsafe.Pointer(windowName))) - - return HWND(ret) -} - -func EnumChildWindows(hWndParent HWND, lpEnumFunc WNDENUMPROC, lParam LPARAM) bool { - ret, _, _ := procEnumChildWindows.Call( - uintptr(hWndParent), - uintptr(syscall.NewCallback(lpEnumFunc)), - uintptr(lParam), - ) - - return ret != 0 -} - -func AdjustWindowRectEx(rect *RECT, style uint, menu bool, exStyle uint) bool { - ret, _, _ := procAdjustWindowRectEx.Call( - uintptr(unsafe.Pointer(rect)), - uintptr(style), - uintptr(BoolToBOOL(menu)), - uintptr(exStyle)) - - return ret != 0 -} - -func AdjustWindowRect(rect *RECT, style uint, menu bool) bool { - ret, _, _ := procAdjustWindowRect.Call( - uintptr(unsafe.Pointer(rect)), - uintptr(style), - uintptr(BoolToBOOL(menu))) - - return ret != 0 -} - -func DestroyWindow(hwnd HWND) bool { - ret, _, _ := procDestroyWindow.Call( - uintptr(hwnd)) - - return ret != 0 -} - -func DefWindowProc(hwnd HWND, msg uint32, wParam, lParam uintptr) uintptr { - ret, _, _ := procDefWindowProc.Call( - uintptr(hwnd), - uintptr(msg), - wParam, - lParam) - - return ret -} - -func DefDlgProc(hwnd HWND, msg uint32, wParam, lParam uintptr) uintptr { - ret, _, _ := procDefDlgProc.Call( - uintptr(hwnd), - uintptr(msg), - wParam, - lParam) - - return ret -} - -func PostQuitMessage(exitCode int) { - procPostQuitMessage.Call( - uintptr(exitCode)) -} - -func GetMessage(msg *MSG, hwnd HWND, msgFilterMin, msgFilterMax uint32) int { - ret, _, _ := procGetMessage.Call( - uintptr(unsafe.Pointer(msg)), - uintptr(hwnd), - uintptr(msgFilterMin), - uintptr(msgFilterMax)) - - return int(ret) -} - -func TranslateMessage(msg *MSG) bool { - ret, _, _ := procTranslateMessage.Call( - uintptr(unsafe.Pointer(msg))) - - return ret != 0 - -} - -func DispatchMessage(msg *MSG) uintptr { - ret, _, _ := procDispatchMessage.Call( - uintptr(unsafe.Pointer(msg))) - - return ret - -} - -func SendMessage(hwnd HWND, msg uint32, wParam, lParam uintptr) uintptr { - ret, _, _ := procSendMessage.Call( - uintptr(hwnd), - uintptr(msg), - wParam, - lParam) - - return ret -} - -func SendMessageTimeout(hwnd HWND, msg uint32, wParam, lParam uintptr, fuFlags, uTimeout uint32) uintptr { - ret, _, _ := procSendMessageTimeout.Call( - uintptr(hwnd), - uintptr(msg), - wParam, - lParam, - uintptr(fuFlags), - uintptr(uTimeout)) - - return ret -} - -func PostMessage(hwnd HWND, msg uint32, wParam, lParam uintptr) bool { - ret, _, _ := procPostMessage.Call( - uintptr(hwnd), - uintptr(msg), - wParam, - lParam) - - return ret != 0 -} - -func WaitMessage() bool { - ret, _, _ := procWaitMessage.Call() - return ret != 0 -} - -func SetWindowText(hwnd HWND, text string) { - procSetWindowText.Call( - uintptr(hwnd), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(text)))) -} - -func GetWindowTextLength(hwnd HWND) int { - ret, _, _ := procGetWindowTextLength.Call( - uintptr(hwnd)) - - return int(ret) -} - -func GetWindowText(hwnd HWND) string { - textLen := GetWindowTextLength(hwnd) + 1 - - buf := make([]uint16, textLen) - procGetWindowText.Call( - uintptr(hwnd), - uintptr(unsafe.Pointer(&buf[0])), - uintptr(textLen)) - - return syscall.UTF16ToString(buf) -} - -func GetWindowRect(hwnd HWND) *RECT { - var rect RECT - procGetWindowRect.Call( - uintptr(hwnd), - uintptr(unsafe.Pointer(&rect))) - - return &rect -} - -func MoveWindow(hwnd HWND, x, y, width, height int, repaint bool) bool { - ret, _, _ := procMoveWindow.Call( - uintptr(hwnd), - uintptr(x), - uintptr(y), - uintptr(width), - uintptr(height), - uintptr(BoolToBOOL(repaint))) - - return ret != 0 - -} - -func ScreenToClient(hwnd HWND, x, y int) (X, Y int, ok bool) { - pt := POINT{X: int32(x), Y: int32(y)} - ret, _, _ := procScreenToClient.Call( - uintptr(hwnd), - uintptr(unsafe.Pointer(&pt))) - - return int(pt.X), int(pt.Y), ret != 0 -} - -func CallWindowProc(preWndProc uintptr, hwnd HWND, msg uint32, wParam, lParam uintptr) uintptr { - ret, _, _ := procCallWindowProc.Call( - preWndProc, - uintptr(hwnd), - uintptr(msg), - wParam, - lParam) - - return ret -} - -func SetWindowLong(hwnd HWND, index int, value uint32) uint32 { - ret, _, _ := procSetWindowLong.Call( - uintptr(hwnd), - uintptr(index), - uintptr(value)) - - return uint32(ret) -} - -func SetWindowLongPtr(hwnd HWND, index int, value uintptr) uintptr { - ret, _, _ := procSetWindowLongPtr.Call( - uintptr(hwnd), - uintptr(index), - value) - - return ret -} - -func GetWindowLong(hwnd HWND, index int) int32 { - ret, _, _ := procGetWindowLong.Call( - uintptr(hwnd), - uintptr(index)) - - return int32(ret) -} - -func GetWindowLongPtr(hwnd HWND, index int) uintptr { - ret, _, _ := procGetWindowLongPtr.Call( - uintptr(hwnd), - uintptr(index)) - - return ret -} - -func EnableWindow(hwnd HWND, b bool) bool { - ret, _, _ := procEnableWindow.Call( - uintptr(hwnd), - uintptr(BoolToBOOL(b))) - return ret != 0 -} - -func IsWindowEnabled(hwnd HWND) bool { - ret, _, _ := procIsWindowEnabled.Call( - uintptr(hwnd)) - - return ret != 0 -} - -func IsWindowVisible(hwnd HWND) bool { - ret, _, _ := procIsWindowVisible.Call( - uintptr(hwnd)) - - return ret != 0 -} - -func SetFocus(hwnd HWND) HWND { - ret, _, _ := procSetFocus.Call( - uintptr(hwnd)) - - return HWND(ret) -} - -func InvalidateRect(hwnd HWND, rect *RECT, erase bool) bool { - ret, _, _ := procInvalidateRect.Call( - uintptr(hwnd), - uintptr(unsafe.Pointer(rect)), - uintptr(BoolToBOOL(erase))) - - return ret != 0 -} - -func GetClientRect(hwnd HWND) *RECT { - var rect RECT - ret, _, _ := procGetClientRect.Call( - uintptr(hwnd), - uintptr(unsafe.Pointer(&rect))) - - if ret == 0 { - panic(fmt.Sprintf("GetClientRect(%d) failed", hwnd)) - } - - return &rect -} - -func GetDC(hwnd HWND) HDC { - ret, _, _ := procGetDC.Call( - uintptr(hwnd)) - - return HDC(ret) -} - -func ReleaseDC(hwnd HWND, hDC HDC) bool { - ret, _, _ := procReleaseDC.Call( - uintptr(hwnd), - uintptr(hDC)) - - return ret != 0 -} - -func SetCapture(hwnd HWND) HWND { - ret, _, _ := procSetCapture.Call( - uintptr(hwnd)) - - return HWND(ret) -} - -func ReleaseCapture() bool { - ret, _, _ := procReleaseCapture.Call() - - return ret != 0 -} - -func GetWindowThreadProcessId(hwnd HWND) (HANDLE, int) { - var processId int - ret, _, _ := procGetWindowThreadProcessId.Call( - uintptr(hwnd), - uintptr(unsafe.Pointer(&processId))) - - return HANDLE(ret), processId -} - -func MessageBox(hwnd HWND, title, caption string, flags uint) int { - ret, _, _ := procMessageBox.Call( - uintptr(hwnd), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(title))), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(caption))), - uintptr(flags)) - - return int(ret) -} - -func GetSystemMetrics(index int) int { - ret, _, _ := procGetSystemMetrics.Call( - uintptr(index)) - - return int(ret) -} - -func CopyRect(dst, src *RECT) bool { - ret, _, _ := procCopyRect.Call( - uintptr(unsafe.Pointer(dst)), - uintptr(unsafe.Pointer(src))) - - return ret != 0 -} - -func EqualRect(rect1, rect2 *RECT) bool { - ret, _, _ := procEqualRect.Call( - uintptr(unsafe.Pointer(rect1)), - uintptr(unsafe.Pointer(rect2))) - - return ret != 0 -} - -func InflateRect(rect *RECT, dx, dy int) bool { - ret, _, _ := procInflateRect.Call( - uintptr(unsafe.Pointer(rect)), - uintptr(dx), - uintptr(dy)) - - return ret != 0 -} - -func IntersectRect(dst, src1, src2 *RECT) bool { - ret, _, _ := procIntersectRect.Call( - uintptr(unsafe.Pointer(dst)), - uintptr(unsafe.Pointer(src1)), - uintptr(unsafe.Pointer(src2))) - - return ret != 0 -} - -func IsRectEmpty(rect *RECT) bool { - ret, _, _ := procIsRectEmpty.Call( - uintptr(unsafe.Pointer(rect))) - - return ret != 0 -} - -func OffsetRect(rect *RECT, dx, dy int) bool { - ret, _, _ := procOffsetRect.Call( - uintptr(unsafe.Pointer(rect)), - uintptr(dx), - uintptr(dy)) - - return ret != 0 -} - -func PtInRect(rect *RECT, x, y int) bool { - pt := POINT{X: int32(x), Y: int32(y)} - ret, _, _ := procPtInRect.Call( - uintptr(unsafe.Pointer(rect)), - uintptr(unsafe.Pointer(&pt))) - - return ret != 0 -} - -func SetRect(rect *RECT, left, top, right, bottom int) bool { - ret, _, _ := procSetRect.Call( - uintptr(unsafe.Pointer(rect)), - uintptr(left), - uintptr(top), - uintptr(right), - uintptr(bottom)) - - return ret != 0 -} - -func SetRectEmpty(rect *RECT) bool { - ret, _, _ := procSetRectEmpty.Call( - uintptr(unsafe.Pointer(rect))) - - return ret != 0 -} - -func SubtractRect(dst, src1, src2 *RECT) bool { - ret, _, _ := procSubtractRect.Call( - uintptr(unsafe.Pointer(dst)), - uintptr(unsafe.Pointer(src1)), - uintptr(unsafe.Pointer(src2))) - - return ret != 0 -} - -func UnionRect(dst, src1, src2 *RECT) bool { - ret, _, _ := procUnionRect.Call( - uintptr(unsafe.Pointer(dst)), - uintptr(unsafe.Pointer(src1)), - uintptr(unsafe.Pointer(src2))) - - return ret != 0 -} - -func CreateDialog(hInstance HINSTANCE, lpTemplate *uint16, hWndParent HWND, lpDialogProc uintptr) HWND { - ret, _, _ := procCreateDialogParam.Call( - uintptr(hInstance), - uintptr(unsafe.Pointer(lpTemplate)), - uintptr(hWndParent), - lpDialogProc, - 0) - - return HWND(ret) -} - -func DialogBox(hInstance HINSTANCE, lpTemplateName *uint16, hWndParent HWND, lpDialogProc uintptr) int { - ret, _, _ := procDialogBoxParam.Call( - uintptr(hInstance), - uintptr(unsafe.Pointer(lpTemplateName)), - uintptr(hWndParent), - lpDialogProc, - 0) - - return int(ret) -} - -func GetDlgItem(hDlg HWND, nIDDlgItem int) HWND { - ret, _, _ := procGetDlgItem.Call( - uintptr(unsafe.Pointer(hDlg)), - uintptr(nIDDlgItem)) - - return HWND(ret) -} - -func DrawIcon(hDC HDC, x, y int, hIcon HICON) bool { - ret, _, _ := procDrawIcon.Call( - uintptr(unsafe.Pointer(hDC)), - uintptr(x), - uintptr(y), - uintptr(unsafe.Pointer(hIcon))) - - return ret != 0 -} - -func ClientToScreen(hwnd HWND, x, y int) (int, int) { - pt := POINT{X: int32(x), Y: int32(y)} - - procClientToScreen.Call( - uintptr(hwnd), - uintptr(unsafe.Pointer(&pt))) - - return int(pt.X), int(pt.Y) -} - -func IsDialogMessage(hwnd HWND, msg *MSG) bool { - ret, _, _ := procIsDialogMessage.Call( - uintptr(hwnd), - uintptr(unsafe.Pointer(msg))) - - return ret != 0 -} - -func IsWindow(hwnd HWND) bool { - ret, _, _ := procIsWindow.Call( - uintptr(hwnd)) - - return ret != 0 -} - -func EndDialog(hwnd HWND, nResult uintptr) bool { - ret, _, _ := procEndDialog.Call( - uintptr(hwnd), - nResult) - - return ret != 0 -} - -func PeekMessage(lpMsg *MSG, hwnd HWND, wMsgFilterMin, wMsgFilterMax, wRemoveMsg uint32) bool { - ret, _, _ := procPeekMessage.Call( - uintptr(unsafe.Pointer(lpMsg)), - uintptr(hwnd), - uintptr(wMsgFilterMin), - uintptr(wMsgFilterMax), - uintptr(wRemoveMsg)) - - return ret != 0 -} - -func TranslateAccelerator(hwnd HWND, hAccTable HACCEL, lpMsg *MSG) bool { - ret, _, _ := procTranslateAccelerator.Call( - uintptr(hwnd), - uintptr(hAccTable), - uintptr(unsafe.Pointer(lpMsg))) - - return ret != 0 -} - -func SetWindowPos(hwnd, hWndInsertAfter HWND, x, y, cx, cy int, uFlags uint) bool { - ret, _, _ := procSetWindowPos.Call( - uintptr(hwnd), - uintptr(hWndInsertAfter), - uintptr(x), - uintptr(y), - uintptr(cx), - uintptr(cy), - uintptr(uFlags)) - - return ret != 0 -} - -func FillRect(hDC HDC, lprc *RECT, hbr HBRUSH) bool { - ret, _, _ := procFillRect.Call( - uintptr(hDC), - uintptr(unsafe.Pointer(lprc)), - uintptr(hbr)) - - return ret != 0 -} - -func DrawText(hDC HDC, text string, uCount int, lpRect *RECT, uFormat uint) int { - ret, _, _ := procDrawText.Call( - uintptr(hDC), - uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(text))), - uintptr(uCount), - uintptr(unsafe.Pointer(lpRect)), - uintptr(uFormat)) - - return int(ret) -} - -func AddClipboardFormatListener(hwnd HWND) bool { - ret, _, _ := procAddClipboardFormatListener.Call( - uintptr(hwnd)) - return ret != 0 -} - -func RemoveClipboardFormatListener(hwnd HWND) bool { - ret, _, _ := procRemoveClipboardFormatListener.Call( - uintptr(hwnd)) - return ret != 0 -} - -func OpenClipboard(hWndNewOwner HWND) bool { - ret, _, _ := procOpenClipboard.Call( - uintptr(hWndNewOwner)) - return ret != 0 -} - -func CloseClipboard() bool { - ret, _, _ := procCloseClipboard.Call() - return ret != 0 -} - -func EnumClipboardFormats(format uint) uint { - ret, _, _ := procEnumClipboardFormats.Call( - uintptr(format)) - return uint(ret) -} - -func GetClipboardData(uFormat uint) HANDLE { - ret, _, _ := procGetClipboardData.Call( - uintptr(uFormat)) - return HANDLE(ret) -} - -func SetClipboardData(uFormat uint, hMem HANDLE) HANDLE { - ret, _, _ := procSetClipboardData.Call( - uintptr(uFormat), - uintptr(hMem)) - return HANDLE(ret) -} - -func EmptyClipboard() bool { - ret, _, _ := procEmptyClipboard.Call() - return ret != 0 -} - -func GetClipboardFormatName(format uint) (string, bool) { - cchMaxCount := 255 - buf := make([]uint16, cchMaxCount) - ret, _, _ := procGetClipboardFormatName.Call( - uintptr(format), - uintptr(unsafe.Pointer(&buf[0])), - uintptr(cchMaxCount)) - - if ret > 0 { - return syscall.UTF16ToString(buf), true - } - - return "Requested format does not exist or is predefined", false -} - -func IsClipboardFormatAvailable(format uint) bool { - ret, _, _ := procIsClipboardFormatAvailable.Call(uintptr(format)) - return ret != 0 -} - -func BeginPaint(hwnd HWND, paint *PAINTSTRUCT) HDC { - ret, _, _ := procBeginPaint.Call( - uintptr(hwnd), - uintptr(unsafe.Pointer(paint))) - return HDC(ret) -} - -func EndPaint(hwnd HWND, paint *PAINTSTRUCT) { - procEndPaint.Call( - uintptr(hwnd), - uintptr(unsafe.Pointer(paint))) -} - -func GetKeyboardState(lpKeyState *[]byte) bool { - ret, _, _ := procGetKeyboardState.Call( - uintptr(unsafe.Pointer(&(*lpKeyState)[0]))) - return ret != 0 -} - -func MapVirtualKeyEx(uCode, uMapType uint, dwhkl HKL) uint { - ret, _, _ := procMapVirtualKey.Call( - uintptr(uCode), - uintptr(uMapType), - uintptr(dwhkl)) - return uint(ret) -} - -func GetAsyncKeyState(vKey int) uint16 { - ret, _, _ := procGetAsyncKeyState.Call(uintptr(vKey)) - return uint16(ret) -} - -func ToAscii(uVirtKey, uScanCode uint, lpKeyState *byte, lpChar *uint16, uFlags uint) int { - ret, _, _ := procToAscii.Call( - uintptr(uVirtKey), - uintptr(uScanCode), - uintptr(unsafe.Pointer(lpKeyState)), - uintptr(unsafe.Pointer(lpChar)), - uintptr(uFlags)) - return int(ret) -} - -func SwapMouseButton(fSwap bool) bool { - ret, _, _ := procSwapMouseButton.Call( - uintptr(BoolToBOOL(fSwap))) - return ret != 0 -} - -func GetCursorPos() (x, y int, ok bool) { - pt := POINT{} - ret, _, _ := procGetCursorPos.Call(uintptr(unsafe.Pointer(&pt))) - return int(pt.X), int(pt.Y), ret != 0 -} - -func SetCursorPos(x, y int) bool { - ret, _, _ := procSetCursorPos.Call( - uintptr(x), - uintptr(y), - ) - return ret != 0 -} - -func SetCursor(cursor HCURSOR) HCURSOR { - ret, _, _ := procSetCursor.Call( - uintptr(cursor), - ) - return HCURSOR(ret) -} - -func CreateIcon(instance HINSTANCE, nWidth, nHeight int, cPlanes, cBitsPerPixel byte, ANDbits, XORbits *byte) HICON { - ret, _, _ := procCreateIcon.Call( - uintptr(instance), - uintptr(nWidth), - uintptr(nHeight), - uintptr(cPlanes), - uintptr(cBitsPerPixel), - uintptr(unsafe.Pointer(ANDbits)), - uintptr(unsafe.Pointer(XORbits)), - ) - return HICON(ret) -} - -func DestroyIcon(icon HICON) bool { - ret, _, _ := procDestroyIcon.Call( - uintptr(icon), - ) - return ret != 0 -} - -func MonitorFromPoint(x, y int, dwFlags uint32) HMONITOR { - ret, _, _ := procMonitorFromPoint.Call( - uintptr(x), - uintptr(y), - uintptr(dwFlags), - ) - return HMONITOR(ret) -} - -func MonitorFromRect(rc *RECT, dwFlags uint32) HMONITOR { - ret, _, _ := procMonitorFromRect.Call( - uintptr(unsafe.Pointer(rc)), - uintptr(dwFlags), - ) - return HMONITOR(ret) -} - -func MonitorFromWindow(hwnd HWND, dwFlags uint32) HMONITOR { - ret, _, _ := procMonitorFromWindow.Call( - uintptr(hwnd), - uintptr(dwFlags), - ) - return HMONITOR(ret) -} - -func GetMonitorInfo(hMonitor HMONITOR, lmpi *MONITORINFO) bool { - ret, _, _ := procGetMonitorInfo.Call( - uintptr(hMonitor), - uintptr(unsafe.Pointer(lmpi)), - ) - return ret != 0 -} - -func EnumDisplayMonitors(hdc HDC, clip *RECT, fnEnum, dwData uintptr) bool { - ret, _, _ := procEnumDisplayMonitors.Call( - uintptr(hdc), - uintptr(unsafe.Pointer(clip)), - fnEnum, - dwData, - ) - return ret != 0 -} - -func EnumDisplaySettingsEx(szDeviceName *uint16, iModeNum uint32, devMode *DEVMODE, dwFlags uint32) bool { - ret, _, _ := procEnumDisplaySettingsEx.Call( - uintptr(unsafe.Pointer(szDeviceName)), - uintptr(iModeNum), - uintptr(unsafe.Pointer(devMode)), - uintptr(dwFlags), - ) - return ret != 0 -} - -func ChangeDisplaySettingsEx(szDeviceName *uint16, devMode *DEVMODE, hwnd HWND, dwFlags uint32, lParam uintptr) int32 { - ret, _, _ := procChangeDisplaySettingsEx.Call( - uintptr(unsafe.Pointer(szDeviceName)), - uintptr(unsafe.Pointer(devMode)), - uintptr(hwnd), - uintptr(dwFlags), - lParam, - ) - return int32(ret) -} - -func SetWindowsHookEx(idHook int, lpfn HOOKPROC, hMod HINSTANCE, dwThreadId DWORD) HHOOK { - ret, _, _ := procSetWindowsHookEx.Call( - uintptr(idHook), - uintptr(syscall.NewCallback(lpfn)), - uintptr(hMod), - uintptr(dwThreadId), - ) - return HHOOK(ret) -} - -func UnhookWindowsHookEx(hhk HHOOK) bool { - ret, _, _ := procUnhookWindowsHookEx.Call( - uintptr(hhk), - ) - return ret != 0 -} - -func CallNextHookEx(hhk HHOOK, nCode int, wParam WPARAM, lParam LPARAM) LRESULT { - ret, _, _ := procCallNextHookEx.Call( - uintptr(hhk), - uintptr(nCode), - uintptr(wParam), - uintptr(lParam), - ) - return LRESULT(ret) -} - -func SetTimer(hwnd HWND, nIDEvent uint32, uElapse uint32, lpTimerProc uintptr) uintptr { - ret, _, _ := procSetTimer.Call( - uintptr(hwnd), - uintptr(nIDEvent), - uintptr(uElapse), - lpTimerProc, - ) - return ret -} - -func KillTimer(hwnd HWND, nIDEvent uint32) bool { - ret, _, _ := procKillTimer.Call( - uintptr(hwnd), - uintptr(nIDEvent), - ) - return ret != 0 -} - -// it will panic when the function fails -func RedrawWindow(hWnd HWND, lpRect *RECT, hrgnUpdate HRGN, flag uint32) { - ret, _, _ := procRedrawWindow.Call( - uintptr(hWnd), - uintptr(unsafe.Pointer(lpRect)), - uintptr(hrgnUpdate), - uintptr(flag), - ) - if ret!=0{ - panic("RedrawWindow fail") - } - return -}
\ No newline at end of file diff --git a/vendor/github.com/AllenDang/w32/utils.go b/vendor/github.com/AllenDang/w32/utils.go deleted file mode 100644 index 4fb5b6c..0000000 --- a/vendor/github.com/AllenDang/w32/utils.go +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -import ( - "syscall" - "unicode/utf16" - "unsafe" -) - -func MakeIntResource(id uint16) *uint16 { - return (*uint16)(unsafe.Pointer(uintptr(id))) -} - -func LOWORD(dw uint32) uint16 { - return uint16(dw) -} - -func HIWORD(dw uint32) uint16 { - return uint16(dw >> 16 & 0xffff) -} - -func BoolToBOOL(value bool) BOOL { - if value { - return 1 - } - - return 0 -} - -func UTF16PtrToString(cstr *uint16) string { - if cstr != nil { - us := make([]uint16, 0, 256) - for p := uintptr(unsafe.Pointer(cstr)); ; p += 2 { - u := *(*uint16)(unsafe.Pointer(p)) - if u == 0 { - return string(utf16.Decode(us)) - } - us = append(us, u) - } - } - - return "" -} - -func ComAddRef(unknown *IUnknown) int32 { - ret, _, _ := syscall.Syscall(unknown.lpVtbl.pAddRef, 1, - uintptr(unsafe.Pointer(unknown)), - 0, - 0) - return int32(ret) -} - -func ComRelease(unknown *IUnknown) int32 { - ret, _, _ := syscall.Syscall(unknown.lpVtbl.pRelease, 1, - uintptr(unsafe.Pointer(unknown)), - 0, - 0) - return int32(ret) -} - -func ComQueryInterface(unknown *IUnknown, id *GUID) *IDispatch { - var disp *IDispatch - hr, _, _ := syscall.Syscall(unknown.lpVtbl.pQueryInterface, 3, - uintptr(unsafe.Pointer(unknown)), - uintptr(unsafe.Pointer(id)), - uintptr(unsafe.Pointer(&disp))) - if hr != 0 { - panic("Invoke QieryInterface error.") - } - return disp -} - -func ComGetIDsOfName(disp *IDispatch, names []string) []int32 { - wnames := make([]*uint16, len(names)) - dispid := make([]int32, len(names)) - for i := 0; i < len(names); i++ { - wnames[i] = syscall.StringToUTF16Ptr(names[i]) - } - hr, _, _ := syscall.Syscall6(disp.lpVtbl.pGetIDsOfNames, 6, - uintptr(unsafe.Pointer(disp)), - uintptr(unsafe.Pointer(IID_NULL)), - uintptr(unsafe.Pointer(&wnames[0])), - uintptr(len(names)), - uintptr(GetUserDefaultLCID()), - uintptr(unsafe.Pointer(&dispid[0]))) - if hr != 0 { - panic("Invoke GetIDsOfName error.") - } - return dispid -} - -func ComInvoke(disp *IDispatch, dispid int32, dispatch int16, params ...interface{}) (result *VARIANT) { - var dispparams DISPPARAMS - - if dispatch&DISPATCH_PROPERTYPUT != 0 { - dispnames := [1]int32{DISPID_PROPERTYPUT} - dispparams.RgdispidNamedArgs = uintptr(unsafe.Pointer(&dispnames[0])) - dispparams.CNamedArgs = 1 - } - var vargs []VARIANT - if len(params) > 0 { - vargs = make([]VARIANT, len(params)) - for i, v := range params { - //n := len(params)-i-1 - n := len(params) - i - 1 - VariantInit(&vargs[n]) - switch v.(type) { - case bool: - if v.(bool) { - vargs[n] = VARIANT{VT_BOOL, 0, 0, 0, 0xffff} - } else { - vargs[n] = VARIANT{VT_BOOL, 0, 0, 0, 0} - } - case *bool: - vargs[n] = VARIANT{VT_BOOL | VT_BYREF, 0, 0, 0, int64(uintptr(unsafe.Pointer(v.(*bool))))} - case byte: - vargs[n] = VARIANT{VT_I1, 0, 0, 0, int64(v.(byte))} - case *byte: - vargs[n] = VARIANT{VT_I1 | VT_BYREF, 0, 0, 0, int64(uintptr(unsafe.Pointer(v.(*byte))))} - case int16: - vargs[n] = VARIANT{VT_I2, 0, 0, 0, int64(v.(int16))} - case *int16: - vargs[n] = VARIANT{VT_I2 | VT_BYREF, 0, 0, 0, int64(uintptr(unsafe.Pointer(v.(*int16))))} - case uint16: - vargs[n] = VARIANT{VT_UI2, 0, 0, 0, int64(v.(int16))} - case *uint16: - vargs[n] = VARIANT{VT_UI2 | VT_BYREF, 0, 0, 0, int64(uintptr(unsafe.Pointer(v.(*uint16))))} - case int, int32: - vargs[n] = VARIANT{VT_UI4, 0, 0, 0, int64(v.(int))} - case *int, *int32: - vargs[n] = VARIANT{VT_I4 | VT_BYREF, 0, 0, 0, int64(uintptr(unsafe.Pointer(v.(*int))))} - case uint, uint32: - vargs[n] = VARIANT{VT_UI4, 0, 0, 0, int64(v.(uint))} - case *uint, *uint32: - vargs[n] = VARIANT{VT_UI4 | VT_BYREF, 0, 0, 0, int64(uintptr(unsafe.Pointer(v.(*uint))))} - case int64: - vargs[n] = VARIANT{VT_I8, 0, 0, 0, v.(int64)} - case *int64: - vargs[n] = VARIANT{VT_I8 | VT_BYREF, 0, 0, 0, int64(uintptr(unsafe.Pointer(v.(*int64))))} - case uint64: - vargs[n] = VARIANT{VT_UI8, 0, 0, 0, int64(v.(uint64))} - case *uint64: - vargs[n] = VARIANT{VT_UI8 | VT_BYREF, 0, 0, 0, int64(uintptr(unsafe.Pointer(v.(*uint64))))} - case float32: - vargs[n] = VARIANT{VT_R4, 0, 0, 0, int64(v.(float32))} - case *float32: - vargs[n] = VARIANT{VT_R4 | VT_BYREF, 0, 0, 0, int64(uintptr(unsafe.Pointer(v.(*float32))))} - case float64: - vargs[n] = VARIANT{VT_R8, 0, 0, 0, int64(v.(float64))} - case *float64: - vargs[n] = VARIANT{VT_R8 | VT_BYREF, 0, 0, 0, int64(uintptr(unsafe.Pointer(v.(*float64))))} - case string: - vargs[n] = VARIANT{VT_BSTR, 0, 0, 0, int64(uintptr(unsafe.Pointer(SysAllocString(v.(string)))))} - case *string: - vargs[n] = VARIANT{VT_BSTR | VT_BYREF, 0, 0, 0, int64(uintptr(unsafe.Pointer(v.(*string))))} - case *IDispatch: - vargs[n] = VARIANT{VT_DISPATCH, 0, 0, 0, int64(uintptr(unsafe.Pointer(v.(*IDispatch))))} - case **IDispatch: - vargs[n] = VARIANT{VT_DISPATCH | VT_BYREF, 0, 0, 0, int64(uintptr(unsafe.Pointer(v.(**IDispatch))))} - case nil: - vargs[n] = VARIANT{VT_NULL, 0, 0, 0, 0} - case *VARIANT: - vargs[n] = VARIANT{VT_VARIANT | VT_BYREF, 0, 0, 0, int64(uintptr(unsafe.Pointer(v.(*VARIANT))))} - default: - panic("unknown type") - } - } - dispparams.Rgvarg = uintptr(unsafe.Pointer(&vargs[0])) - dispparams.CArgs = uint32(len(params)) - } - - var ret VARIANT - var excepInfo EXCEPINFO - VariantInit(&ret) - hr, _, _ := syscall.Syscall9(disp.lpVtbl.pInvoke, 8, - uintptr(unsafe.Pointer(disp)), - uintptr(dispid), - uintptr(unsafe.Pointer(IID_NULL)), - uintptr(GetUserDefaultLCID()), - uintptr(dispatch), - uintptr(unsafe.Pointer(&dispparams)), - uintptr(unsafe.Pointer(&ret)), - uintptr(unsafe.Pointer(&excepInfo)), - 0) - if hr != 0 { - if excepInfo.BstrDescription != nil { - bs := UTF16PtrToString(excepInfo.BstrDescription) - panic(bs) - } - } - for _, varg := range vargs { - if varg.VT == VT_BSTR && varg.Val != 0 { - SysFreeString(((*int16)(unsafe.Pointer(uintptr(varg.Val))))) - } - } - result = &ret - return -} diff --git a/vendor/github.com/AllenDang/w32/vars.go b/vendor/github.com/AllenDang/w32/vars.go deleted file mode 100644 index 2dab2e3..0000000 --- a/vendor/github.com/AllenDang/w32/vars.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2010-2012 The W32 Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package w32 - -var ( - IID_NULL = &GUID{0x00000000, 0x0000, 0x0000, [8]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}} - IID_IUnknown = &GUID{0x00000000, 0x0000, 0x0000, [8]byte{0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}} - IID_IDispatch = &GUID{0x00020400, 0x0000, 0x0000, [8]byte{0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46}} - IID_IConnectionPointContainer = &GUID{0xB196B284, 0xBAB4, 0x101A, [8]byte{0xB6, 0x9C, 0x00, 0xAA, 0x00, 0x34, 0x1D, 0x07}} - IID_IConnectionPoint = &GUID{0xB196B286, 0xBAB4, 0x101A, [8]byte{0xB6, 0x9C, 0x00, 0xAA, 0x00, 0x34, 0x1D, 0x07}} -) diff --git a/vendor/github.com/ProtonMail/go-autostart/LICENSE b/vendor/github.com/ProtonMail/go-autostart/LICENSE deleted file mode 100644 index f9e1447..0000000 --- a/vendor/github.com/ProtonMail/go-autostart/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 ProtonMail - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/ProtonMail/go-autostart/README.md b/vendor/github.com/ProtonMail/go-autostart/README.md deleted file mode 100644 index 580862f..0000000 --- a/vendor/github.com/ProtonMail/go-autostart/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# go-autostart - -[![GoDoc](https://godoc.org/github.com/ProtonMail/go-autostart?status.svg)](https://godoc.org/github.com/ProtonMail/go-autostart) - -A Go library to run a command after login. - -## Usage - -```go -package main - -import ( - "log" - "github.com/ProtonMail/go-autostart" -) - -func main() { - app := &autostart.App{ - Name: "test", - DisplayName: "Just a Test App", - Exec: []string{"bash", "-c", "echo autostart >> ~/autostart.txt"}, - } - - if app.IsEnabled() { - log.Println("App is already enabled, removing it...") - - if err := app.Disable(); err != nil { - log.Fatal(err) - } - } else { - log.Println("Enabling app...") - - if err := app.Enable(); err != nil { - log.Fatal(err) - } - } - - log.Println("Done!") -} -``` - -## Behavior - -* On Linux and BSD, it creates a `.desktop` file in `$XDG_CONFIG_HOME/autostart` - (i.e. `$HOME/.config/autostart`). See http://askubuntu.com/questions/48321/how-do-i-start-applications-automatically-on-login -* On macOS, it creates a `launchd` job. See http://blog.gordn.org/2015/03/implementing-run-on-login-for-your-node.html -* On Windows, it creates a link to the program in `%USERPROFILE%\Start Menu\Programs\Startup` - -## License - -MIT diff --git a/vendor/github.com/ProtonMail/go-autostart/autostart.go b/vendor/github.com/ProtonMail/go-autostart/autostart.go deleted file mode 100644 index 7b7d6de..0000000 --- a/vendor/github.com/ProtonMail/go-autostart/autostart.go +++ /dev/null @@ -1,13 +0,0 @@ -package autostart - -// An application that will be started when the user logs in. -type App struct { - // Unique identifier for the app. - Name string - // The command to execute, followed by its arguments. - Exec []string - // The app name. - DisplayName string - // The app icon. - Icon string -} diff --git a/vendor/github.com/ProtonMail/go-autostart/autostart_darwin.go b/vendor/github.com/ProtonMail/go-autostart/autostart_darwin.go deleted file mode 100644 index b2e0518..0000000 --- a/vendor/github.com/ProtonMail/go-autostart/autostart_darwin.go +++ /dev/null @@ -1,66 +0,0 @@ -package autostart - -import ( - "os" - "path/filepath" - "text/template" -) - -const jobTemplate = `<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> - <dict> - <key>Label</key> - <string>{{.Name}}</string> - <key>ProgramArguments</key> - <array> - {{range .Exec -}} - <string>{{.}}</string> - {{end}} - </array> - <key>RunAtLoad</key> - <true/> - </dict> -</plist>` - -var launchDir string - -func init() { - launchDir = filepath.Join(os.Getenv("HOME"), "Library", "LaunchAgents") -} - -func (a *App) path() string { - return filepath.Join(launchDir, a.Name+".plist") -} - -// IsEnabled Check is app enabled startup. -func (a *App) IsEnabled() bool { - _, err := os.Stat(a.path()) - return err == nil -} - -// Enable this app on startup. -func (a *App) Enable() error { - t := template.Must(template.New("job").Parse(jobTemplate)) - - if err := os.MkdirAll(launchDir, 0777); err != nil { - return err - } - f, err := os.Create(a.path()) - if err != nil { - return err - } - defer f.Close() - - if err := t.Execute(f, a); err != nil { - return err - } - - return nil -} - -// Disable this app on startup. -func (a *App) Disable() error { - - return os.Remove(a.path()) -} diff --git a/vendor/github.com/ProtonMail/go-autostart/autostart_windows.c b/vendor/github.com/ProtonMail/go-autostart/autostart_windows.c deleted file mode 100644 index a61618c..0000000 --- a/vendor/github.com/ProtonMail/go-autostart/autostart_windows.c +++ /dev/null @@ -1,51 +0,0 @@ -#include <windows.h> -#include <stdlib.h> -#include <stdint.h> -#include <stdio.h> -#include <string.h> -#include <objbase.h> -#include <shlobj.h> - -uint64_t CreateShortcut(char *shortcutA, char *path, char *args) { - IShellLink* pISL; - IPersistFile* pIPF; - HRESULT hr; - - CoInitializeEx(NULL, COINIT_MULTITHREADED); - - // Shortcut filename: convert ANSI to unicode - WORD shortcutW[MAX_PATH]; - int nChar = MultiByteToWideChar(CP_ACP, 0, shortcutA, -1, shortcutW, MAX_PATH); - - hr = CoCreateInstance(&CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, &IID_IShellLink, (LPVOID*)&pISL); - if (!SUCCEEDED(hr)) { - return hr+0x01000000; - } - - // See https://msdn.microsoft.com/en-us/library/windows/desktop/bb774950(v=vs.85).aspx - hr = pISL->lpVtbl->SetPath(pISL, path); - if (!SUCCEEDED(hr)) { - return hr+0x02000000; - } - - hr = pISL->lpVtbl->SetArguments(pISL, args); - if (!SUCCEEDED(hr)) { - return hr+0x03000000; - } - - // Save the shortcut - hr = pISL->lpVtbl->QueryInterface(pISL, &IID_IPersistFile, (void**)&pIPF); - if (!SUCCEEDED(hr)) { - return hr+0x04000000; - } - - hr = pIPF->lpVtbl->Save(pIPF, shortcutW, FALSE); - if (!SUCCEEDED(hr)) { - return hr+0x05000000; - } - - pIPF->lpVtbl->Release(pIPF); - pISL->lpVtbl->Release(pISL); - - return 0x0; -} diff --git a/vendor/github.com/ProtonMail/go-autostart/autostart_windows.go b/vendor/github.com/ProtonMail/go-autostart/autostart_windows.go deleted file mode 100644 index 3c14609..0000000 --- a/vendor/github.com/ProtonMail/go-autostart/autostart_windows.go +++ /dev/null @@ -1,52 +0,0 @@ -package autostart - -// #cgo LDFLAGS: -lole32 -luuid -/* -#define WIN32_LEAN_AND_MEAN -#include <stdint.h> -#include <windows.h> - -uint64_t CreateShortcut(char *shortcutA, char *path, char *args); -*/ -import "C" - -import ( - "errors" - "fmt" - "os" - "path/filepath" - "strings" -) - -var startupDir string - -func init() { - startupDir = filepath.Join(os.Getenv("USERPROFILE"), "AppData", "Roaming", "Microsoft", "Windows", "Start Menu", "Programs", "Startup") -} - -func (a *App) path() string { - return filepath.Join(startupDir, a.Name+".lnk") -} - -func (a *App) IsEnabled() bool { - _, err := os.Stat(a.path()) - return err == nil -} - -func (a *App) Enable() error { - path := a.Exec[0] - args := strings.Join(a.Exec[1:], " ") - - if err := os.MkdirAll(startupDir, 0777); err != nil { - return err - } - res := C.CreateShortcut(C.CString(a.path()), C.CString(path), C.CString(args)) - if res != 0 { - return errors.New(fmt.Sprintf("autostart: cannot create shortcut '%s' error code: 0x%.8x", a.path(), res)) - } - return nil -} - -func (a *App) Disable() error { - return os.Remove(a.path()) -} diff --git a/vendor/github.com/ProtonMail/go-autostart/autostart_xdg.go b/vendor/github.com/ProtonMail/go-autostart/autostart_xdg.go deleted file mode 100644 index 39306a5..0000000 --- a/vendor/github.com/ProtonMail/go-autostart/autostart_xdg.go +++ /dev/null @@ -1,69 +0,0 @@ -// +build !windows,!darwin - -package autostart - -import ( - "os" - "path/filepath" - "text/template" -) - -const desktopTemplate = `[Desktop Entry] -Type=Application -Name={{.DisplayName}} -Exec={{.Exec}} -{{- if .Icon}} -Icon={{.Icon}}{{end}} -X-GNOME-Autostart-enabled=true -` - -var autostartDir string - -func init() { - if os.Getenv("XDG_CONFIG_HOME") != "" { - autostartDir = os.Getenv("XDG_CONFIG_HOME") - } else { - autostartDir = filepath.Join(os.Getenv("HOME"), ".config") - } - autostartDir = filepath.Join(autostartDir, "autostart") -} - -func (a *App) path() string { - return filepath.Join(autostartDir, a.Name+".desktop") -} - -// Check if the app is enabled on startup. -func (a *App) IsEnabled() bool { - _, err := os.Stat(a.path()) - return err == nil -} - -type app struct { - *App -} - -// Override App.Exec to return a string. -func (a *app) Exec() string { - return quote(a.App.Exec) -} - -// Enable this app on startup. -func (a *App) Enable() error { - t := template.Must(template.New("desktop").Parse(desktopTemplate)) - - if err := os.MkdirAll(autostartDir, 0777); err != nil { - return err - } - f, err := os.Create(a.path()) - if err != nil { - return err - } - defer f.Close() - - return t.Execute(f, &app{a}) -} - -// Disable this app on startup. -func (a *App) Disable() error { - return os.Remove(a.path()) -} diff --git a/vendor/github.com/ProtonMail/go-autostart/quote.go b/vendor/github.com/ProtonMail/go-autostart/quote.go deleted file mode 100644 index b906eed..0000000 --- a/vendor/github.com/ProtonMail/go-autostart/quote.go +++ /dev/null @@ -1,16 +0,0 @@ -// +build !darwin - -package autostart - -import ( - "strconv" - "strings" -) - -func quote(args []string) string { - for i, v := range args { - args[i] = strconv.Quote(v) - } - - return strings.Join(args, " ") -} diff --git a/vendor/github.com/apparentlymart/go-openvpn-mgmt/demux/demuxer.go b/vendor/github.com/apparentlymart/go-openvpn-mgmt/demux/demuxer.go deleted file mode 100644 index c57964e..0000000 --- a/vendor/github.com/apparentlymart/go-openvpn-mgmt/demux/demuxer.go +++ /dev/null @@ -1,63 +0,0 @@ -package demux - -import ( - "bufio" - "io" -) - -var readErrSynthEvent = []byte("FATAL:Error reading from OpenVPN") - -// Demultiplex reads from the given io.Reader, assumed to be the client -// end of an OpenVPN Management Protocol connection, and splits it into -// distinct messages from OpenVPN. -// -// It then writes the raw message buffers into either replyCh or eventCh -// depending on whether each message is a reply to a client command or -// an asynchronous event notification. -// -// The buffers written to replyCh are entire raw message lines (without the -// trailing newlines), while the buffers written to eventCh are the raw -// event strings with the prototcol's leading '>' indicator omitted. -// -// The caller should usually provide buffered channels of sufficient buffer -// depth so that the reply channel will not be starved by slow event -// processing. -// -// Once the io.Reader signals EOF, eventCh will be closed, then replyCh -// will be closed, and then this function will return. -// -// As a special case, if a non-EOF error occurs while reading from the -// io.Reader then a synthetic "FATAL" event will be written to eventCh -// before the two buffers are closed and the function returns. This -// synthetic message will have the error message "Error reading from OpenVPN". -func Demultiplex(r io.Reader, replyCh, eventCh chan<- []byte) { - scanner := bufio.NewScanner(r) - for scanner.Scan() { - buf := scanner.Bytes() - - if len(buf) < 1 { - // Should never happen but we'll be robust and ignore this, - // rather than crashing below. - continue - } - - // Asynchronous messages always start with > to differentiate - // them from replies. - if buf[0] == '>' { - // Trim off the > when we post the message, since it's - // redundant after we've demuxed. - eventCh <- buf[1:] - } else { - replyCh <- buf - } - } - - if err := scanner.Err(); err != nil { - // Generate a synthetic FATAL event so that the caller can - // see that the connection was not gracefully closed. - eventCh <- readErrSynthEvent - } - - close(eventCh) - close(replyCh) -} diff --git a/vendor/github.com/apparentlymart/go-openvpn-mgmt/demux/demuxer_test.go b/vendor/github.com/apparentlymart/go-openvpn-mgmt/demux/demuxer_test.go deleted file mode 100644 index 45edac6..0000000 --- a/vendor/github.com/apparentlymart/go-openvpn-mgmt/demux/demuxer_test.go +++ /dev/null @@ -1,218 +0,0 @@ -package demux - -import ( - "bytes" - "fmt" - "io" - "reflect" - "testing" -) - -func TestDemultiplex(t *testing.T) { - type TestCase struct { - Input []string - ExpectedReplies []string - ExpectedEvents []string - } - - testCases := []TestCase{ - { - Input: []string{}, - ExpectedReplies: []string{}, - ExpectedEvents: []string{}, - }, - { - Input: []string{ - "SUCCESS: foo bar baz", - }, - ExpectedReplies: []string{ - "SUCCESS: foo bar baz", - }, - ExpectedEvents: []string{}, - }, - { - Input: []string{ - ">STATE:1234,ASSIGN_IP,,10.0.0.1,", - }, - ExpectedReplies: []string{}, - ExpectedEvents: []string{ - "STATE:1234,ASSIGN_IP,,10.0.0.1,", - }, - }, - { - Input: []string{ - ">STATE:1234,ASSIGN_IP,,10.0.0.1,", - ">STATE:5678,ASSIGN_IP,,10.0.0.1,", - ">STATE:9012,ASSIGN_IP,,10.0.0.1,", - }, - ExpectedReplies: []string{}, - ExpectedEvents: []string{ - "STATE:1234,ASSIGN_IP,,10.0.0.1,", - "STATE:5678,ASSIGN_IP,,10.0.0.1,", - "STATE:9012,ASSIGN_IP,,10.0.0.1,", - }, - }, - { - Input: []string{ - ">STATE:1234,ASSIGN_IP,,10.0.0.1,", - "SUCCESS: foo bar baz", - ">STATE:5678,ASSIGN_IP,,10.0.0.1,", - }, - ExpectedReplies: []string{ - "SUCCESS: foo bar baz", - }, - ExpectedEvents: []string{ - "STATE:1234,ASSIGN_IP,,10.0.0.1,", - "STATE:5678,ASSIGN_IP,,10.0.0.1,", - }, - }, - { - Input: []string{ - "SUCCESS: foo bar baz", - ">STATE:1234,ASSIGN_IP,,10.0.0.1,", - "SUCCESS: baz bar foo", - }, - ExpectedReplies: []string{ - "SUCCESS: foo bar baz", - "SUCCESS: baz bar foo", - }, - ExpectedEvents: []string{ - "STATE:1234,ASSIGN_IP,,10.0.0.1,", - }, - }, - } - - for i, testCase := range testCases { - r := mockReader(testCase.Input) - gotReplies, gotEvents := captureMsgs(r) - - if !reflect.DeepEqual(gotReplies, testCase.ExpectedReplies) { - t.Errorf( - "test %d returned incorrect replies\ngot %#v\nwant %#v", - i, gotReplies, testCase.ExpectedReplies, - ) - } - - if !reflect.DeepEqual(gotEvents, testCase.ExpectedEvents) { - t.Errorf( - "test %d returned incorrect events\ngot %#v\nwant %#v", - i, gotEvents, testCase.ExpectedEvents, - ) - } - } -} - -func TestDemultiplex_error(t *testing.T) { - r := &alwaysErroringReader{} - - gotReplies, gotEvents := captureMsgs(r) - - expectedReplies := []string{} - expectedEvents := []string{ - "FATAL:Error reading from OpenVPN", - } - - if !reflect.DeepEqual(gotReplies, expectedReplies) { - t.Errorf( - "incorrect replies\ngot %#v\nwant %#v", - gotReplies, expectedReplies, - ) - } - - if !reflect.DeepEqual(gotEvents, expectedEvents) { - t.Errorf( - "incorrect events\ngot %#v\nwant %#v", - gotEvents, expectedEvents, - ) - } -} - -func mockReader(msgs []string) io.Reader { - var buf []byte - for _, msg := range msgs { - buf = append(buf, []byte(msg)...) - buf = append(buf, '\n') - } - return bytes.NewReader(buf) -} - -func captureMsgs(r io.Reader) (replies, events []string) { - replyCh := make(chan []byte) - eventCh := make(chan []byte) - - replies = make([]string, 0) - events = make([]string, 0) - - go Demultiplex(r, replyCh, eventCh) - - for replyCh != nil || eventCh != nil { - select { - - case msg, ok := <-replyCh: - if ok { - replies = append(replies, string(msg)) - } else { - replyCh = nil - } - - case msg, ok := <-eventCh: - if ok { - events = append(events, string(msg)) - } else { - eventCh = nil - } - - } - - } - - return replies, events -} - -type alwaysErroringReader struct{} - -func (r *alwaysErroringReader) Read(buf []byte) (int, error) { - return 0, fmt.Errorf("mock error") -} - -// Somewhat-contrived example of blocking for a reply while concurrently -// processing asynchronous events. -func ExampleDemultiplex() { - // In a real caller we would have a net.IPConn as our reader, - // but we'll use a bytes reader here as a test. - r := bytes.NewReader([]byte( - // A reply to a hypothetical command interspersed between - // two asynchronous events. - ">HOLD:Waiting for hold release\nSUCCESS: foo\n>FATAL:baz\n", - )) - - // No strong need for buffering on this channel because usually - // a message sender will immediately block waiting for the - // associated response message. - replyCh := make(chan []byte) - - // Make sure the event channel buffer is deep enough that slow event - // processing won't significantly delay synchronous replies. If you - // process events quickly, or if you aren't sending any commands - // concurrently with acting on events, then this is not so important. - eventCh := make(chan []byte, 10) - - // Start demultiplexing the message stream in the background. - // This goroutine will exit once the reader signals EOF. - go Demultiplex(r, replyCh, eventCh) - - // Some coroutine has sent a hypothetical message to OpenVPN, - // and it can directly block until the associated reply arrives. - // The events will be concurrently handled by our event loop - // below while we wait for the reply to show up. - go func() { - replyMsgBuf := <-replyCh - fmt.Printf("Command reply: %s\n", string(replyMsgBuf)) - }() - - // Main event loop deals with the async events as they arrive, - // independently of any commands that are pending. - for msgBuf := range eventCh { - fmt.Printf("Event: %s\n", string(msgBuf)) - } -} diff --git a/vendor/github.com/apparentlymart/go-openvpn-mgmt/demux/doc.go b/vendor/github.com/apparentlymart/go-openvpn-mgmt/demux/doc.go deleted file mode 100644 index 263a267..0000000 --- a/vendor/github.com/apparentlymart/go-openvpn-mgmt/demux/doc.go +++ /dev/null @@ -1,12 +0,0 @@ -// Package demux implements low-level demultiplexing of the stream of -// messages sent from OpenVPN on the management channel. -// -// OpenVPN's protocol includes two different kinds of message from the OpenVPN -// process: replies to commands sent by the management client, and asynchronous -// event notifications. -// -// This package's purpose is to split these messages into two separate streams, -// so that functions executing command/response sequences can just block -// on the reply channel while an event loop elsewhere deals with any async -// events that might show up. -package demux diff --git a/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/client.go b/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/client.go deleted file mode 100644 index 7768004..0000000 --- a/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/client.go +++ /dev/null @@ -1,303 +0,0 @@ -package openvpn - -import ( - "bytes" - "fmt" - "io" - "net" - "strconv" - "time" - - "github.com/apparentlymart/go-openvpn-mgmt/demux" -) - -var newline = []byte{'\n'} -var successPrefix = []byte("SUCCESS: ") -var errorPrefix = []byte("ERROR: ") -var endMessage = []byte("END") - -type MgmtClient struct { - wr io.Writer - replies <-chan []byte -} - -// NewClient creates a new MgmtClient that communicates via the given -// io.ReadWriter and emits events on the given channel. -// -// eventCh should be a buffered channel with a sufficient buffer depth -// such that it cannot be filled under the expected event volume. Event -// volume depends on which events are enabled and how they are configured; -// some of the event-enabling functions have further discussion how frequently -// events are likely to be emitted, but the caller should also factor in -// how long its own event *processing* will take, since slow event -// processing will create back-pressure that could cause this buffer to -// fill faster. -// -// It probably goes without saying given the previous paragraph, but the -// caller *must* constantly read events from eventCh to avoid its buffer -// becoming full. Events and replies are received on the same channel -// from OpenVPN, so if writing to eventCh blocks then this will also block -// responses from the client's various command methods. -// -// eventCh will be closed to signal the closing of the client connection, -// whether due to graceful shutdown or to an error. In the case of error, -// a FatalEvent will be emitted on the channel as the last event before it -// is closed. Connection errors may also concurrently surface as error -// responses from the client's various command methods, should an error -// occur while we await a reply. -func NewClient(conn io.ReadWriter, eventCh chan<- Event) *MgmtClient { - replyCh := make(chan []byte) - rawEventCh := make(chan []byte) // not buffered because eventCh should be - - go demux.Demultiplex(conn, replyCh, rawEventCh) - - // Get raw events and upgrade them into proper event types before - // passing them on to the caller's event channel. - go func() { - for raw := range rawEventCh { - eventCh <- upgradeEvent(raw) - } - close(eventCh) - }() - - return &MgmtClient{ - // replyCh acts as the reader for our ReadWriter, so we only - // need to retain the io.Writer for it, so we can send commands. - wr: conn, - replies: replyCh, - } -} - -// Dial is a convenience wrapper around NewClient that handles the common -// case of opening an TCP/IP socket to an OpenVPN management port and creating -// a client for it. -// -// See the NewClient docs for discussion about the requirements for eventCh. -// -// OpenVPN will create a suitable management port if launched with the -// following command line option: -// -// --management <ipaddr> <port> -// -// Address may an IPv4 address, an IPv6 address, or a hostname that resolves -// to either of these, followed by a colon and then a port number. -// -// When running on Unix systems it's possible to instead connect to a Unix -// domain socket. To do this, pass an absolute path to the socket as -// the target address, having run OpenVPN with the following options: -// -// --management /path/to/socket unix -// -func Dial(addr string, eventCh chan<- Event) (*MgmtClient, error) { - proto := "tcp" - if len(addr) > 0 && addr[0] == '/' { - proto = "unix" - } - conn, err := net.Dial(proto, addr) - if err != nil { - return nil, err - } - - return NewClient(conn, eventCh), nil -} - -// HoldRelease instructs OpenVPN to release any management hold preventing -// it from proceeding, but to retain the state of the hold flag such that -// the daemon will hold again if it needs to reconnect for any reason. -// -// OpenVPN can be instructed to activate a management hold on startup by -// running it with the following option: -// -// --management-hold -// -// Instructing OpenVPN to hold gives your client a chance to connect and -// do any necessary configuration before a connection proceeds, thus avoiding -// the problem of missed events. -// -// When OpenVPN begins holding, or when a new management client connects while -// a hold is already in effect, a HoldEvent will be emitted on the event -// channel. -func (c *MgmtClient) HoldRelease() error { - _, err := c.simpleCommand("hold release") - return err -} - -// SetStateEvents either enables or disables asynchronous events for changes -// in the OpenVPN connection state. -// -// When enabled, a StateEvent will be emitted from the event channel each -// time the connection state changes. See StateEvent for more information -// on the event structure. -func (c *MgmtClient) SetStateEvents(on bool) error { - var err error - if on { - _, err = c.simpleCommand("state on") - } else { - _, err = c.simpleCommand("state off") - } - return err -} - -// SetEchoEvents either enables or disables asynchronous events for "echo" -// commands sent from a remote server to our managed OpenVPN client. -// -// When enabled, an EchoEvent will be emitted from the event channel each -// time the server sends an echo command. See EchoEvent for more information. -func (c *MgmtClient) SetEchoEvents(on bool) error { - var err error - if on { - _, err = c.simpleCommand("echo on") - } else { - _, err = c.simpleCommand("echo off") - } - return err -} - -// SetByteCountEvents either enables or disables ongoing asynchronous events -// for information on OpenVPN bandwidth usage. -// -// When enabled, a ByteCountEvent will be emitted at given time interval, -// (which may only be whole seconds) describing how many bytes have been -// transferred in each direction See ByteCountEvent for more information. -// -// Set the time interval to zero in order to disable byte count events. -func (c *MgmtClient) SetByteCountEvents(interval time.Duration) error { - msg := fmt.Sprintf("bytecount %d", int(interval.Seconds())) - _, err := c.simpleCommand(msg) - return err -} - -// SendSignal sends a signal to the OpenVPN process via the management -// channel. In effect this causes the OpenVPN process to send a signal to -// itself on our behalf. -// -// OpenVPN accepts a subset of the usual UNIX signal names, including -// "SIGHUP", "SIGTERM", "SIGUSR1" and "SIGUSR2". See the OpenVPN manual -// page for the meaning of each. -// -// Behavior is undefined if the given signal name is not entirely uppercase -// letters. In particular, including newlines in the string is likely to -// cause very unpredictable behavior. -func (c *MgmtClient) SendSignal(name string) error { - msg := fmt.Sprintf("signal %q", name) - _, err := c.simpleCommand(msg) - return err -} - -// LatestState retrieves the most recent StateEvent from the server. This -// can either be used to poll the state or it can be used to determine the -// initial state after calling SetStateEvents(true) but before the first -// state event is delivered. -func (c *MgmtClient) LatestState() (*StateEvent, error) { - err := c.sendCommand([]byte("state")) - if err != nil { - return nil, err - } - - payload, err := c.readCommandResponsePayload() - if err != nil { - return nil, err - } - - if len(payload) != 1 { - return nil, fmt.Errorf("Malformed OpenVPN 'state' response") - } - - return &StateEvent{ - body: payload[0], - }, nil -} - -// Pid retrieves the process id of the connected OpenVPN process. -func (c *MgmtClient) Pid() (int, error) { - raw, err := c.simpleCommand("pid") - if err != nil { - return 0, err - } - - if !bytes.HasPrefix(raw, []byte("pid=")) { - return 0, fmt.Errorf("malformed response from OpenVPN") - } - - pid, err := strconv.Atoi(string(raw[4:])) - if err != nil { - return 0, fmt.Errorf("error parsing pid from OpenVPN: %s", err) - } - - return pid, nil -} - -func (c *MgmtClient) sendCommand(cmd []byte) error { - _, err := c.wr.Write(cmd) - if err != nil { - return err - } - _, err = c.wr.Write(newline) - return err -} - -// sendCommandPayload can be called after sendCommand for -// commands that expect a multi-line input payload. -// -// The buffer given in 'payload' *must* end with a newline, -// or else the protocol will be broken. -func (c *MgmtClient) sendCommandPayload(payload []byte) error { - _, err := c.wr.Write(payload) - if err != nil { - return err - } - _, err = c.wr.Write(endMessage) - if err != nil { - return err - } - _, err = c.wr.Write(newline) - return err -} - -func (c *MgmtClient) readCommandResult() ([]byte, error) { - reply, ok := <-c.replies - if !ok { - return nil, fmt.Errorf("connection closed while awaiting result") - } - - if bytes.HasPrefix(reply, successPrefix) { - result := reply[len(successPrefix):] - return result, nil - } - - if bytes.HasPrefix(reply, errorPrefix) { - message := reply[len(errorPrefix):] - return nil, ErrorFromServer(message) - } - - return nil, fmt.Errorf("malformed result message") -} - -func (c *MgmtClient) readCommandResponsePayload() ([][]byte, error) { - lines := make([][]byte, 0, 10) - - for { - line, ok := <-c.replies - if !ok { - // We'll give the caller whatever we got before the connection - // closed, in case it's useful for debugging. - return lines, fmt.Errorf("connection closed before END recieved") - } - - if bytes.Equal(line, endMessage) { - break - } - - lines = append(lines, line) - } - - return lines, nil -} - -func (c *MgmtClient) simpleCommand(cmd string) ([]byte, error) { - err := c.sendCommand([]byte(cmd)) - if err != nil { - return nil, err - } - return c.readCommandResult() -} diff --git a/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/error.go b/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/error.go deleted file mode 100644 index 554e2ef..0000000 --- a/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/error.go +++ /dev/null @@ -1,11 +0,0 @@ -package openvpn - -type ErrorFromServer []byte - -func (err ErrorFromServer) Error() string { - return string(err) -} - -func (err ErrorFromServer) String() string { - return string(err) -} diff --git a/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/event.go b/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/event.go deleted file mode 100644 index 66625f3..0000000 --- a/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/event.go +++ /dev/null @@ -1,299 +0,0 @@ -package openvpn - -import ( - "bytes" - "fmt" - "strconv" -) - -var eventSep = []byte(":") -var fieldSep = []byte(",") -var byteCountEventKW = []byte("BYTECOUNT") -var byteCountCliEventKW = []byte("BYTECOUNT_CLI") -var clientEventKW = []byte("CLIENT") -var echoEventKW = []byte("ECHO") -var fatalEventKW = []byte("FATAL") -var holdEventKW = []byte("HOLD") -var infoEventKW = []byte("INFO") -var logEventKW = []byte("LOG") -var needOkEventKW = []byte("NEED-OK") -var needStrEventKW = []byte("NEED-STR") -var passwordEventKW = []byte("PASSWORD") -var stateEventKW = []byte("STATE") - -type Event interface { - String() string -} - -// UnknownEvent represents an event of a type that this package doesn't -// know about. -// -// Future versions of this library may learn about new event types, so a -// caller should exercise caution when making use of events of this type -// to access unsupported behavior. Backward-compatibility is *not* -// guaranteed for events of this type. -type UnknownEvent struct { - keyword []byte - body []byte -} - -func (e *UnknownEvent) Type() string { - return string(e.keyword) -} - -func (e *UnknownEvent) Body() string { - return string(e.body) -} - -func (e *UnknownEvent) String() string { - return fmt.Sprintf("%s: %s", e.keyword, e.body) -} - -// MalformedEvent represents a message from the OpenVPN process that is -// presented as an event but does not comply with the expected event syntax. -// -// Events of this type should never be seen but robust callers will accept -// and ignore them, possibly generating some kind of debugging message. -// -// One reason for potentially seeing events of this type is when the target -// program is actually not an OpenVPN process at all, but in fact this client -// has been connected to a different sort of server by mistake. -type MalformedEvent struct { - raw []byte -} - -func (e *MalformedEvent) String() string { - return fmt.Sprintf("Malformed Event %q", e.raw) -} - -// HoldEvent is a notification that the OpenVPN process is in a management -// hold and will not continue connecting until the hold is released, e.g. -// by calling client.HoldRelease() -type HoldEvent struct { - body []byte -} - -func (e *HoldEvent) String() string { - return string(e.body) -} - -// StateEvent is a notification of a change of connection state. It can be -// used, for example, to detect if the OpenVPN connection has been interrupted -// and the OpenVPN process is attempting to reconnect. -type StateEvent struct { - body []byte - - // bodyParts is populated only on first request, giving us the - // separate comma-separated elements of the message. Not all - // fields are populated for all states. - bodyParts [][]byte -} - -func (e *StateEvent) RawTimestamp() string { - parts := e.parts() - return string(parts[0]) -} - -func (e *StateEvent) NewState() string { - parts := e.parts() - return string(parts[1]) -} - -func (e *StateEvent) Description() string { - parts := e.parts() - return string(parts[2]) -} - -// LocalTunnelAddr returns the IP address of the local interface within -// the tunnel, as a string that can be parsed using net.ParseIP. -// -// This field is only populated for events whose NewState returns -// either ASSIGN_IP or CONNECTED. -func (e *StateEvent) LocalTunnelAddr() string { - parts := e.parts() - return string(parts[3]) -} - -// RemoteAddr returns the non-tunnel IP address of the remote -// system that has connected to the local OpenVPN process. -// -// This field is only populated for events whose NewState returns -// CONNECTED. -func (e *StateEvent) RemoteAddr() string { - parts := e.parts() - return string(parts[4]) -} - -func (e *StateEvent) String() string { - newState := e.NewState() - switch newState { - case "ASSIGN_IP": - return fmt.Sprintf("%s: %s", newState, e.LocalTunnelAddr()) - case "CONNECTED": - return fmt.Sprintf("%s: %s", newState, e.RemoteAddr()) - default: - desc := e.Description() - if desc != "" { - return fmt.Sprintf("%s: %s", newState, desc) - } else { - return newState - } - } -} - -func (e *StateEvent) parts() [][]byte { - if e.bodyParts == nil { - // State messages currently have only five segments, but - // we'll ask for 5 so any additional fields that might show - // up in newer versions will gather in an element we're - // not actually using. - e.bodyParts = bytes.SplitN(e.body, fieldSep, 6) - - // Prevent crash if the server has sent us a malformed - // status message. This should never actually happen if - // the server is behaving itself. - if len(e.bodyParts) < 5 { - expanded := make([][]byte, 5) - copy(expanded, e.bodyParts) - e.bodyParts = expanded - } - } - return e.bodyParts -} - -// EchoEvent is emitted by an OpenVPN process running in client mode when -// an "echo" command is pushed to it by the server it has connected to. -// -// The format of the echo message is free-form, since this message type is -// intended to pass application-specific data from the server-side config -// into whatever client is consuming the management prototcol. -// -// This event is emitted only if the management client has turned on events -// of this type using client.SetEchoEvents(true) -type EchoEvent struct { - body []byte -} - -func (e *EchoEvent) RawTimestamp() string { - sepIndex := bytes.Index(e.body, fieldSep) - if sepIndex == -1 { - return "" - } - return string(e.body[:sepIndex]) -} - -func (e *EchoEvent) Message() string { - sepIndex := bytes.Index(e.body, fieldSep) - if sepIndex == -1 { - return "" - } - return string(e.body[sepIndex+1:]) -} - -func (e *EchoEvent) String() string { - return fmt.Sprintf("ECHO: %s", e.Message()) -} - -// ByteCountEvent represents a periodic snapshot of data transfer in bytes -// on a VPN connection. -// -// For OpenVPN *servers*, events are emitted for each client and the method -// ClientId identifies thet client. -// -// For other OpenVPN modes, events are emitted only once per interval for the -// single connection managed by the target process, and ClientId returns -// the empty string. -type ByteCountEvent struct { - hasClient bool - body []byte - - // populated on first call to parts() - bodyParts [][]byte -} - -func (e *ByteCountEvent) ClientId() string { - if !e.hasClient { - return "" - } - - return string(e.parts()[0]) -} - -func (e *ByteCountEvent) BytesIn() int { - index := 0 - if e.hasClient { - index = 1 - } - str := string(e.parts()[index]) - val, _ := strconv.Atoi(str) - // Ignore error, since this should never happen if OpenVPN is - // behaving itself. - return val -} - -func (e *ByteCountEvent) BytesOut() int { - index := 1 - if e.hasClient { - index = 2 - } - str := string(e.parts()[index]) - val, _ := strconv.Atoi(str) - // Ignore error, since this should never happen if OpenVPN is - // behaving itself. - return val -} - -func (e *ByteCountEvent) String() string { - if e.hasClient { - return fmt.Sprintf("Client %s: %d in, %d out", e.ClientId(), e.BytesIn(), e.BytesOut()) - } else { - return fmt.Sprintf("%d in, %d out", e.BytesIn(), e.BytesOut()) - } -} - -func (e *ByteCountEvent) parts() [][]byte { - if e.bodyParts == nil { - e.bodyParts = bytes.SplitN(e.body, fieldSep, 4) - - wantCount := 2 - if e.hasClient { - wantCount = 3 - } - - // Prevent crash if the server has sent us a malformed - // message. This should never actually happen if the - // server is behaving itself. - if len(e.bodyParts) < wantCount { - expanded := make([][]byte, wantCount) - copy(expanded, e.bodyParts) - e.bodyParts = expanded - } - } - return e.bodyParts -} - -func upgradeEvent(raw []byte) Event { - splitIdx := bytes.Index(raw, eventSep) - if splitIdx == -1 { - // Should never happen, but we'll handle it robustly if it does. - return &MalformedEvent{raw} - } - - keyword := raw[:splitIdx] - body := raw[splitIdx+1:] - - switch { - case bytes.Equal(keyword, stateEventKW): - return &StateEvent{body: body} - case bytes.Equal(keyword, holdEventKW): - return &HoldEvent{body} - case bytes.Equal(keyword, echoEventKW): - return &EchoEvent{body} - case bytes.Equal(keyword, byteCountEventKW): - return &ByteCountEvent{hasClient: false, body: body} - case bytes.Equal(keyword, byteCountCliEventKW): - return &ByteCountEvent{hasClient: true, body: body} - default: - return &UnknownEvent{keyword, body} - } -} diff --git a/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/event_test.go b/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/event_test.go deleted file mode 100644 index 81a02e1..0000000 --- a/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/event_test.go +++ /dev/null @@ -1,346 +0,0 @@ -package openvpn - -import ( - "fmt" - "testing" -) - -// A key requirement of our event parsing is that it must never cause a -// panic, even if the OpenVPN process sends us malformed garbage. -// -// Therefore most of the tests in here are testing various tortured error -// cases, which are all expected to produce an event object, though the -// contents of that event object will be nonsensical if the OpenVPN server -// sends something nonsensical. - -func TestMalformedEvent(t *testing.T) { - testCases := [][]byte{ - []byte(""), - []byte("HTTP/1.1 200 OK"), - []byte(" "), - []byte("\x00"), - } - - for i, testCase := range testCases { - event := upgradeEvent(testCase) - - var malformed *MalformedEvent - var ok bool - if malformed, ok = event.(*MalformedEvent); !ok { - t.Errorf("test %d got %T; want %T", i, event, malformed) - continue - } - - wantString := fmt.Sprintf("Malformed Event %q", testCase) - if gotString := malformed.String(); gotString != wantString { - t.Errorf("test %d String returned %q; want %q", i, gotString, wantString) - } - } -} - -func TestUnknownEvent(t *testing.T) { - type TestCase struct { - Input []byte - WantType string - WantBody string - } - testCases := []TestCase{ - { - Input: []byte("DUMMY:baz"), - WantType: "DUMMY", - WantBody: "baz", - }, - { - Input: []byte("DUMMY:"), - WantType: "DUMMY", - WantBody: "", - }, - { - Input: []byte("DUMMY:abc,123,456"), - WantType: "DUMMY", - WantBody: "abc,123,456", - }, - } - - for i, testCase := range testCases { - event := upgradeEvent(testCase.Input) - - var unk *UnknownEvent - var ok bool - if unk, ok = event.(*UnknownEvent); !ok { - t.Errorf("test %d got %T; want %T", i, event, unk) - continue - } - - if got, want := unk.Type(), testCase.WantType; got != want { - t.Errorf("test %d Type returned %q; want %q", i, got, want) - } - if got, want := unk.Body(), testCase.WantBody; got != want { - t.Errorf("test %d Body returned %q; want %q", i, got, want) - } - } -} - -func TestHoldEvent(t *testing.T) { - testCases := [][]byte{ - []byte("HOLD:"), - []byte("HOLD:waiting for hold release"), - } - - for i, testCase := range testCases { - event := upgradeEvent(testCase) - - var hold *HoldEvent - var ok bool - if hold, ok = event.(*HoldEvent); !ok { - t.Errorf("test %d got %T; want %T", i, event, hold) - continue - } - } -} - -func TestEchoEvent(t *testing.T) { - type TestCase struct { - Input []byte - WantTimestamp string - WantMessage string - } - testCases := []TestCase{ - { - Input: []byte("ECHO:123,foo"), - WantTimestamp: "123", - WantMessage: "foo", - }, - { - Input: []byte("ECHO:123,"), - WantTimestamp: "123", - WantMessage: "", - }, - { - Input: []byte("ECHO:,foo"), - WantTimestamp: "", - WantMessage: "foo", - }, - { - Input: []byte("ECHO:,"), - WantTimestamp: "", - WantMessage: "", - }, - { - Input: []byte("ECHO:"), - WantTimestamp: "", - WantMessage: "", - }, - } - - for i, testCase := range testCases { - event := upgradeEvent(testCase.Input) - - var echo *EchoEvent - var ok bool - if echo, ok = event.(*EchoEvent); !ok { - t.Errorf("test %d got %T; want %T", i, event, echo) - continue - } - - if got, want := echo.RawTimestamp(), testCase.WantTimestamp; got != want { - t.Errorf("test %d RawTimestamp returned %q; want %q", i, got, want) - } - if got, want := echo.Message(), testCase.WantMessage; got != want { - t.Errorf("test %d Message returned %q; want %q", i, got, want) - } - } -} - -func TestStateEvent(t *testing.T) { - type TestCase struct { - Input []byte - WantTimestamp string - WantState string - WantDesc string - WantLocalAddr string - WantRemoteAddr string - } - testCases := []TestCase{ - { - Input: []byte("STATE:"), - WantTimestamp: "", - WantState: "", - WantDesc: "", - WantLocalAddr: "", - WantRemoteAddr: "", - }, - { - Input: []byte("STATE:,"), - WantTimestamp: "", - WantState: "", - WantDesc: "", - WantLocalAddr: "", - WantRemoteAddr: "", - }, - { - Input: []byte("STATE:,,,,"), - WantTimestamp: "", - WantState: "", - WantDesc: "", - WantLocalAddr: "", - WantRemoteAddr: "", - }, - { - Input: []byte("STATE:123,CONNECTED,good,172.16.0.1,192.168.4.1"), - WantTimestamp: "123", - WantState: "CONNECTED", - WantDesc: "good", - WantLocalAddr: "172.16.0.1", - WantRemoteAddr: "192.168.4.1", - }, - { - Input: []byte("STATE:123,RECONNECTING,SIGHUP,,"), - WantTimestamp: "123", - WantState: "RECONNECTING", - WantDesc: "SIGHUP", - WantLocalAddr: "", - WantRemoteAddr: "", - }, - { - Input: []byte("STATE:123,RECONNECTING,SIGHUP,,,extra"), - WantTimestamp: "123", - WantState: "RECONNECTING", - WantDesc: "SIGHUP", - WantLocalAddr: "", - WantRemoteAddr: "", - }, - } - - for i, testCase := range testCases { - event := upgradeEvent(testCase.Input) - - var st *StateEvent - var ok bool - if st, ok = event.(*StateEvent); !ok { - t.Errorf("test %d got %T; want %T", i, event, st) - continue - } - - if got, want := st.RawTimestamp(), testCase.WantTimestamp; got != want { - t.Errorf("test %d RawTimestamp returned %q; want %q", i, got, want) - } - if got, want := st.NewState(), testCase.WantState; got != want { - t.Errorf("test %d NewState returned %q; want %q", i, got, want) - } - if got, want := st.Description(), testCase.WantDesc; got != want { - t.Errorf("test %d Description returned %q; want %q", i, got, want) - } - if got, want := st.LocalTunnelAddr(), testCase.WantLocalAddr; got != want { - t.Errorf("test %d LocalTunnelAddr returned %q; want %q", i, got, want) - } - if got, want := st.RemoteAddr(), testCase.WantRemoteAddr; got != want { - t.Errorf("test %d RemoteAddr returned %q; want %q", i, got, want) - } - } -} - -func TestByteCountEvent(t *testing.T) { - type TestCase struct { - Input []byte - WantClientId string - WantBytesIn int - WantBytesOut int - } - testCases := []TestCase{ - { - Input: []byte("BYTECOUNT:"), - WantClientId: "", - WantBytesIn: 0, - WantBytesOut: 0, - }, - { - Input: []byte("BYTECOUNT:123,456"), - WantClientId: "", - WantBytesIn: 123, - WantBytesOut: 456, - }, - { - Input: []byte("BYTECOUNT:,"), - WantClientId: "", - WantBytesIn: 0, - WantBytesOut: 0, - }, - { - Input: []byte("BYTECOUNT:5,"), - WantClientId: "", - WantBytesIn: 5, - WantBytesOut: 0, - }, - { - Input: []byte("BYTECOUNT:,6"), - WantClientId: "", - WantBytesIn: 0, - WantBytesOut: 6, - }, - { - Input: []byte("BYTECOUNT:6"), - WantClientId: "", - WantBytesIn: 6, - WantBytesOut: 0, - }, - { - Input: []byte("BYTECOUNT:wrong,bad"), - WantClientId: "", - WantBytesIn: 0, - WantBytesOut: 0, - }, - { - Input: []byte("BYTECOUNT:1,2,3"), - WantClientId: "", - WantBytesIn: 1, - WantBytesOut: 2, - }, - { - // Intentionally malformed BYTECOUNT event sent as BYTECOUNT_CLI - Input: []byte("BYTECOUNT_CLI:123,456"), - WantClientId: "123", - WantBytesIn: 456, - WantBytesOut: 0, - }, - { - Input: []byte("BYTECOUNT_CLI:"), - WantClientId: "", - WantBytesIn: 0, - WantBytesOut: 0, - }, - { - Input: []byte("BYTECOUNT_CLI:abc123,123,456"), - WantClientId: "abc123", - WantBytesIn: 123, - WantBytesOut: 456, - }, - { - Input: []byte("BYTECOUNT_CLI:abc123,123"), - WantClientId: "abc123", - WantBytesIn: 123, - WantBytesOut: 0, - }, - } - - for i, testCase := range testCases { - event := upgradeEvent(testCase.Input) - - var bc *ByteCountEvent - var ok bool - if bc, ok = event.(*ByteCountEvent); !ok { - t.Errorf("test %d got %T; want %T", i, event, bc) - continue - } - - if got, want := bc.ClientId(), testCase.WantClientId; got != want { - t.Errorf("test %d ClientId returned %q; want %q", i, got, want) - } - if got, want := bc.BytesIn(), testCase.WantBytesIn; got != want { - t.Errorf("test %d BytesIn returned %d; want %d", i, got, want) - } - if got, want := bc.BytesOut(), testCase.WantBytesOut; got != want { - t.Errorf("test %d BytesOut returned %d; want %d", i, got, want) - } - } -} diff --git a/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/server.go b/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/server.go deleted file mode 100644 index d7defd4..0000000 --- a/vendor/github.com/apparentlymart/go-openvpn-mgmt/openvpn/server.go +++ /dev/null @@ -1,172 +0,0 @@ -package openvpn - -import ( - "net" - "time" -) - -// MgmtListener accepts incoming connections from OpenVPN. -// -// The primary way to instantiate this type is via the function Listen. -// See its documentation for more information. -type MgmtListener struct { - l net.Listener -} - -// NewMgmtListener constructs a MgmtListener from an already-established -// net.Listener. In most cases it will be more convenient to use -// the function Listen. -func NewMgmtListener(l net.Listener) *MgmtListener { - return &MgmtListener{l} -} - -// Listen opens a listen port and awaits incoming connections from OpenVPN -// processes. -// -// OpenVPN will behave in this manner when launched with the following options: -// -// --management ipaddr port --management-client -// -// Note that in this case the terminology is slightly confusing, since from -// the standpoint of TCP/IP it is OpenVPN that is the client and our program -// that is the server, but once the connection is established the channel -// is indistinguishable from the situation where OpenVPN exposed a management -// *server* and we connected to it. Thus we still refer to our program as -// the "client" and OpenVPN as the "server" once the connection is established. -// -// When running on Unix systems it's possible to instead listen on a Unix -// domain socket. To do this, pass an absolute path to the socket as -// the listen address, and then run OpenVPN with the following options: -// -// --management /path/to/socket unix --management-client -// -func Listen(laddr string) (*MgmtListener, error) { - proto := "tcp" - if len(laddr) > 0 && laddr[0] == '/' { - proto = "unix" - } - listener, err := net.Listen(proto, laddr) - if err != nil { - return nil, err - } - - return NewMgmtListener(listener), nil -} - -// Accept waits for and returns the next connection. -func (l *MgmtListener) Accept() (*IncomingConn, error) { - conn, err := l.l.Accept() - if err != nil { - return nil, err - } - - return &IncomingConn{conn}, nil -} - -// Close closes the listener. Any blocked Accept operations -// will be blocked and each will return an error. -func (l *MgmtListener) Close() error { - return l.l.Close() -} - -// Addr returns the listener's network address. -func (l *MgmtListener) Addr() net.Addr { - return l.l.Addr() -} - -// Serve will await new connections and call the given handler -// for each. -// -// Serve does not return unless the listen port is closed; a non-nil -// error is always returned. -func (l *MgmtListener) Serve(handler IncomingConnHandler) error { - defer l.Close() - - var tempDelay time.Duration - - for { - incoming, err := l.Accept() - if err != nil { - if ne, ok := err.(net.Error); ok && ne.Temporary() { - if tempDelay == 0 { - tempDelay = 5 * time.Millisecond - } else { - tempDelay *= 2 - } - if max := 1 * time.Second; tempDelay > max { - tempDelay = max - } - - // Wait a while before we try again. - time.Sleep(tempDelay) - continue - } else { - // Listen socket is permanently closed or errored, - // so it's time for us to exit. - return err - } - } - - // always reset our retry delay once we successfully read - tempDelay = 0 - - go handler.ServeOpenVPNMgmt(*incoming) - } -} - -type IncomingConn struct { - conn net.Conn -} - -// Open initiates communication with the connected OpenVPN process, -// and establishes the channel on which events will be delivered. -// -// See the documentation for NewClient for discussion about the requirements -// for eventCh. -func (ic IncomingConn) Open(eventCh chan<- Event) *MgmtClient { - return NewClient(ic.conn, eventCh) -} - -// Close abruptly closes the socket connected to the OpenVPN process. -// -// This is a rather abrasive way to close the channel, intended for rejecting -// unwanted incoming clients that may or may not speak the OpenVPN protocol. -// -// Once communication is accepted and established, it is generally better -// to close the connection gracefully using commands on the client returned -// from Open. -func (ic IncomingConn) Close() error { - return ic.conn.Close() -} - -type IncomingConnHandler interface { - ServeOpenVPNMgmt(IncomingConn) -} - -// IncomingConnHandlerFunc is an adapter to allow the use of ordinary -// functions as connection handlers. -// -// Given a function with the appropriate signature, IncomingConnHandlerFunc(f) -// is an IncomingConnHandler that calls f. -type IncomingConnHandlerFunc func(IncomingConn) - -func (f IncomingConnHandlerFunc) ServeOpenVPNMgmt(i IncomingConn) { - f(i) -} - -// ListenAndServe creates a MgmtListener for the given listen address -// and then calls AcceptAndServe on it. -// -// This is just a convenience wrapper. See the AcceptAndServe method for -// more details. Just as with AcceptAndServe, this function does not return -// except on error; in addition to the error cases handled by AcceptAndServe, -// this function may also fail if the listen socket cannot be established -// in the first place. -func ListenAndServe(laddr string, handler IncomingConnHandler) error { - listener, err := Listen(laddr) - if err != nil { - return err - } - - return listener.Serve(handler) -} diff --git a/vendor/github.com/getlantern/context/LICENSE b/vendor/github.com/getlantern/context/LICENSE deleted file mode 100644 index 5dc6c26..0000000 --- a/vendor/github.com/getlantern/context/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2016 Brave New Software Project, Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/getlantern/context/README.md b/vendor/github.com/getlantern/context/README.md deleted file mode 100644 index 978c9e0..0000000 --- a/vendor/github.com/getlantern/context/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# context [![Travis CI Status](https://travis-ci.org/getlantern/context.svg?branch=master)](https://travis-ci.org/getlantern/context) [![Coverage Status](https://coveralls.io/repos/getlantern/context/badge.png?branch=master)](https://coveralls.io/r/getlantern/context) - -Provides goroutine-based context state inspired by https://github.com/tylerb/gls -and https://github.com/jtolds/gls. It uses the same basic hack as tylerb's -library, but adds a stack abstraction that allows nested contexts similar to -jtolds' library, but using `Enter()` and `Exit()` instead of callback functions. diff --git a/vendor/github.com/getlantern/context/context.go b/vendor/github.com/getlantern/context/context.go deleted file mode 100644 index c77f129..0000000 --- a/vendor/github.com/getlantern/context/context.go +++ /dev/null @@ -1,309 +0,0 @@ -// Package context provides a mechanism for transparently tracking contextual -// state associated to the current goroutine and even across goroutines. -package context - -import ( - "sync" -) - -// Manager provides the ability to create and access Contexts. -type Manager interface { - // Enter enters a new level on the current Context stack, creating a new Context - // if necessary. - Enter() Context - - // Go starts the given function on a new goroutine but sharing the context of - // the current goroutine (if it has one). - Go(func()) - - // PutGlobal puts the given key->value pair into the global context. - PutGlobal(key string, value interface{}) - - // PutGlobalDynamic puts a key->value pair into the global context where the - // value is generated by a function that gets evaluated at every Read. If the - // value is a map[string]interface{}, we will unpack the map and set each - // contained key->value pair independently. - PutGlobalDynamic(key string, valueFN func() interface{}) - - // AsMap returns a map containing all values from the supplied obj if it is a - // Contextual, plus any addition values from along the stack, plus globals if so - // specified. - AsMap(obj interface{}, includeGlobals bool) Map -} - -type manager struct { - contexts map[uint64]*context - mxContexts sync.RWMutex - global Map - mxGlobal sync.RWMutex -} - -// NewManager creates a new Manager -func NewManager() Manager { - return &manager{ - contexts: make(map[uint64]*context), - global: make(Map), - } -} - -// Contextual is an interface for anything that maintains its own context. -type Contextual interface { - // Fill fills the given Map with all of this Contextual's context - Fill(m Map) -} - -// Map is a map of key->value pairs. -type Map map[string]interface{} - -// Fill implements the method from the Contextual interface. -func (_m Map) Fill(m Map) { - for key, value := range _m { - m[key] = value - } -} - -// Context is a context containing key->value pairs -type Context interface { - // Enter enters a new level on this Context stack. - Enter() Context - - // Go starts the given function on a new goroutine. - Go(fn func()) - - // Exit exits the current level on this Context stack. - Exit() - - // Put puts a key->value pair into the current level of the context stack. - Put(key string, value interface{}) Context - - // PutIfAbsent puts the given key->value pair into the current level of the - // context stack if and only if that key is defined nowhere within the context - // stack (including parent contexts). - PutIfAbsent(key string, value interface{}) Context - - // PutDynamic puts a key->value pair into the current level of the context - // stack where the value is generated by a function that gets evaluated at - // every Read. If the value is a map[string]interface{}, we will unpack the - // map and set each contained key->value pair independently. - PutDynamic(key string, valueFN func() interface{}) Context - - // Fill fills the given map with data from this Context - Fill(m Map) - - // AsMap returns a map containing all values from the supplied obj if it is a - // Contextual, plus any addition values from along the stack, plus globals if - // so specified. - AsMap(obj interface{}, includeGlobals bool) Map -} - -type context struct { - cm *manager - id uint64 - parent *context - branchedFrom *context - data Map - mx sync.RWMutex -} - -type dynval struct { - fn func() interface{} -} - -func (cm *manager) Enter() Context { - return cm.enter(curGoroutineID()) -} - -func (cm *manager) enter(id uint64) *context { - cm.mxContexts.Lock() - parentOrNil := cm.contexts[id] - c := cm.makeContext(id, parentOrNil, nil) - cm.contexts[id] = c - cm.mxContexts.Unlock() - return c -} - -func (cm *manager) exit(id uint64, parent *context) { - cm.mxContexts.Lock() - if parent == nil { - delete(cm.contexts, id) - } else { - cm.contexts[id] = parent - } - cm.mxContexts.Unlock() -} - -func (cm *manager) branch(id uint64, from *context) { - next := cm.makeContext(id, nil, from) - cm.mxContexts.Lock() - cm.contexts[id] = next - cm.mxContexts.Unlock() -} - -func (cm *manager) merge(id uint64) { - cm.mxContexts.Lock() - delete(cm.contexts, id) - cm.mxContexts.Unlock() -} - -func (c *context) Enter() Context { - c.mx.RLock() - id := c.id - c.mx.RUnlock() - return c.cm.enter(id) -} - -func (c *context) Go(fn func()) { - go func() { - id := curGoroutineID() - c.cm.branch(id, c) - fn() - c.cm.merge(id) - }() -} - -func (cm *manager) Go(fn func()) { - c := cm.currentContext() - if c != nil { - c.Go(fn) - } else { - go fn() - } -} - -func (cm *manager) makeContext(id uint64, parent *context, branchedFrom *context) *context { - return &context{ - cm: cm, - id: id, - parent: parent, - branchedFrom: branchedFrom, - data: make(Map), - } -} - -func (c *context) Exit() { - c.mx.RLock() - id := c.id - parent := c.parent - c.mx.RUnlock() - c.cm.exit(id, parent) -} - -func (c *context) Put(key string, value interface{}) Context { - c.mx.Lock() - c.data[key] = value - c.mx.Unlock() - return c -} - -func (c *context) PutIfAbsent(key string, value interface{}) Context { - for ctx := c; ctx != nil; { - ctx.mx.RLock() - _, exists := ctx.data[key] - next := ctx.parent - if next == nil { - next = ctx.branchedFrom - } - ctx.mx.RUnlock() - if exists { - return c - } - ctx = next - } - - // Value not set, set it - return c.Put(key, value) -} - -func (c *context) PutDynamic(key string, valueFN func() interface{}) Context { - value := &dynval{valueFN} - c.mx.Lock() - c.data[key] = value - c.mx.Unlock() - return c -} - -func (cm *manager) PutGlobal(key string, value interface{}) { - cm.mxGlobal.Lock() - cm.global[key] = value - cm.mxGlobal.Unlock() -} - -func (cm *manager) PutGlobalDynamic(key string, valueFN func() interface{}) { - value := &dynval{valueFN} - cm.mxGlobal.Lock() - cm.global[key] = value - cm.mxGlobal.Unlock() -} - -func (c *context) Fill(m Map) { - for ctx := c; ctx != nil; { - ctx.mx.RLock() - fill(m, ctx.data) - next := ctx.parent - if next == nil { - next = ctx.branchedFrom - } - ctx.mx.RUnlock() - ctx = next - } -} - -func (cm *manager) AsMap(obj interface{}, includeGlobals bool) Map { - return cm.currentContext().asMap(cm, obj, includeGlobals) -} - -func (c *context) AsMap(obj interface{}, includeGlobals bool) Map { - return c.asMap(c.cm, obj, includeGlobals) -} - -func (c *context) asMap(cm *manager, obj interface{}, includeGlobals bool) Map { - result := make(Map, 0) - cl, ok := obj.(Contextual) - if ok { - cl.Fill(result) - } - if c != nil { - c.Fill(result) - } - if includeGlobals { - cm.mxGlobal.RLock() - fill(result, cm.global) - cm.mxGlobal.RUnlock() - } - return result -} - -func fill(m Map, from Map) { - if m != nil { - doFill := func(key string, _value interface{}) { - switch value := _value.(type) { - case map[string]interface{}: - for k, v := range value { - m[k] = v - } - default: - m[key] = value - } - } - - for key, value := range from { - _, alreadyRead := m[key] - if !alreadyRead { - switch v := value.(type) { - case *dynval: - doFill(key, v.fn()) - default: - doFill(key, v) - } - } - } - } -} - -func (cm *manager) currentContext() *context { - id := curGoroutineID() - cm.mxContexts.RLock() - c := cm.contexts[id] - cm.mxContexts.RUnlock() - return c -} diff --git a/vendor/github.com/getlantern/context/context_test.go b/vendor/github.com/getlantern/context/context_test.go deleted file mode 100644 index 9fb86f3..0000000 --- a/vendor/github.com/getlantern/context/context_test.go +++ /dev/null @@ -1,160 +0,0 @@ -package context - -import ( - "sync" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestStack(t *testing.T) { - cm := NewManager() - _cm := cm.(*manager) - // Put globals first - cm.PutGlobal("a", -1) // This will get overriden in specific contexts - cm.PutGlobal("ga", "i") - cm.PutGlobalDynamic("gb", func() interface{} { return "ii" }) - cm.PutGlobalDynamic("gm", func() interface{} { return map[string]interface{}{"gm3": "iii", "gm4": "iv"} }) - - // Use a Map as a Contextual - var contextual = Map{ - "a": 0, // This will override whatever is in specific contexts - "contextual": "special", - } - - c := cm.Enter() - c.Put("a", 1) - penultimate := cm.Enter(). - Put("b", 2) - c = cm.Enter(). - PutDynamic("c", func() interface{} { return 4 }). - PutIfAbsent("d", 5). - PutIfAbsent("a", 11) - - // Put something in the penultimate context and make sure it doesn't override - // what's set in the ultimate context - penultimate.Put("c", 3) - - var assertMutex sync.Mutex - doAssertContents := func(expected Map, actual Map, scope string) { - assertMutex.Lock() - assert.Equal(t, expected, actual, scope) - assertMutex.Unlock() - } - - assertContents := func(expected Map) { - doAssertContents(expected, cm.AsMap(nil, false), "AsMapwith(nil, false)") - expected["ga"] = "i" - expected["gb"] = "ii" - expected["gm3"] = "iii" - expected["gm4"] = "iv" - _, exists := expected["a"] - if !exists { - expected["a"] = -1 - } - doAssertContents(expected, cm.AsMap(nil, true), "AsMap(nil, true)") - expected["a"] = 0 - expected["contextual"] = "special" - doAssertContents(expected, cm.AsMap(contextual, true), "AsMapWith(contextual, true)") - delete(expected, "ga") - delete(expected, "gb") - delete(expected, "gm3") - delete(expected, "gm4") - doAssertContents(expected, cm.AsMap(contextual, false), "AsMapWith(contextual, false)") - } - - assertContents(Map{ - "a": 1, - "b": 2, - "c": 4, - "d": 5, - }) - - var wg sync.WaitGroup - wg.Add(1) - cm.Go(func() { - defer cm.Enter().Put("e", 6).Exit() - assertContents(Map{ - "a": 1, - "b": 2, - "c": 4, - "d": 5, - "e": 6, - }) - wg.Done() - }) - wg.Wait() - - wg.Add(1) - cm.Go(func() { - // This goroutine doesn't Exit. Still, we shouldn't leak anything. - wg.Done() - }) - wg.Wait() - - assertContents(Map{ - "a": 1, - "b": 2, - "c": 4, - "d": 5, - }) - - c.Exit() - c = _cm.currentContext() - assert.NotNil(t, c) - assertContents(Map{ - "a": 1, - "b": 2, - "c": 3, - }) - - c.Exit() - c = _cm.currentContext() - assert.NotNil(t, c) - assertContents(Map{ - "a": 1, - }) - - // Last exit - c.Exit() - assert.Nil(t, _cm.currentContext()) - assertContents(Map{}) - - // Exit again, just for good measure - c.Exit() - assert.Nil(t, _cm.currentContext()) - assertContents(Map{}) - - // Spawn a goroutine with no existing contexts - wg.Add(1) - cm.Go(func() { - defer cm.Enter().Put("f", 7).Exit() - assertContents(Map{ - "f": 7, - }) - wg.Done() - }) - wg.Wait() - - _cm.mxContexts.Lock() - assert.Empty(t, _cm.contexts, "No contexts should be left") - _cm.mxContexts.Unlock() -} - -func BenchmarkPut(b *testing.B) { - cm := NewManager() - c := cm.Enter() - b.ResetTimer() - for i := 0; i < b.N; i++ { - c.Put("key", "value") - } -} - -func BenchmarkAsMap(b *testing.B) { - cm := NewManager() - cm.Enter().Put("a", 1).Put("b", 2) - b.ResetTimer() - for i := 0; i < b.N; i++ { - cm.AsMap(nil, true) - } -} diff --git a/vendor/github.com/getlantern/context/gotrack.go b/vendor/github.com/getlantern/context/gotrack.go deleted file mode 100644 index 7f92346..0000000 --- a/vendor/github.com/getlantern/context/gotrack.go +++ /dev/null @@ -1,130 +0,0 @@ -package context - -import ( - "bytes" - "errors" - "fmt" - "runtime" - "strconv" - "sync" -) - -// Sourced https://github.com/bradfitz/http2/blob/dc0c5c000ec33e263612939744d51a3b68b9cece/gotrack.go -var goroutineSpace = []byte("goroutine ") -var littleBuf = sync.Pool{ - New: func() interface{} { - buf := make([]byte, 64) - return &buf - }, -} - -func curGoroutineID() uint64 { - bp := littleBuf.Get().(*[]byte) - defer littleBuf.Put(bp) - b := *bp - b = b[:runtime.Stack(b, false)] - // Parse the 4707 out of "goroutine 4707 [" - b = bytes.TrimPrefix(b, goroutineSpace) - i := bytes.IndexByte(b, ' ') - if i < 0 { - panic(fmt.Sprintf("No space found in %q", b)) - } - b = b[:i] - n, err := parseUintBytes(b, 10, 64) - if err != nil { - panic(fmt.Sprintf("Failed to parse goroutine ID out of %q: %v", b, err)) - } - return n -} - -// parseUintBytes is like strconv.ParseUint, but using a []byte. -func parseUintBytes(s []byte, base int, bitSize int) (n uint64, err error) { - var cutoff, maxVal uint64 - - if bitSize == 0 { - bitSize = int(strconv.IntSize) - } - - s0 := s - switch { - case len(s) < 1: - err = strconv.ErrSyntax - return n, &strconv.NumError{Func: "ParseUint", Num: string(s0), Err: err} - - case 2 <= base && base <= 36: - // valid base; nothing to do - - case base == 0: - // Look for octal, hex prefix. - switch { - case s[0] == '0' && len(s) > 1 && (s[1] == 'x' || s[1] == 'X'): - base = 16 - s = s[2:] - if len(s) < 1 { - err = strconv.ErrSyntax - return n, &strconv.NumError{Func: "ParseUint", Num: string(s0), Err: err} - } - case s[0] == '0': - base = 8 - default: - base = 10 - } - - default: - err = errors.New("invalid base " + strconv.Itoa(base)) - return n, &strconv.NumError{Func: "ParseUint", Num: string(s0), Err: err} - } - - n = 0 - cutoff = cutoff64(base) - maxVal = 1<<uint(bitSize) - 1 - - for i := 0; i < len(s); i++ { - var v byte - d := s[i] - switch { - case '0' <= d && d <= '9': - v = d - '0' - case 'a' <= d && d <= 'z': - v = d - 'a' + 10 - case 'A' <= d && d <= 'Z': - v = d - 'A' + 10 - default: - n = 0 - err = strconv.ErrSyntax - return n, &strconv.NumError{Func: "ParseUint", Num: string(s0), Err: err} - } - if int(v) >= base { - n = 0 - err = strconv.ErrSyntax - return n, &strconv.NumError{Func: "ParseUint", Num: string(s0), Err: err} - } - - if n >= cutoff { - // n*base overflows - n = 1<<64 - 1 - err = strconv.ErrRange - return n, &strconv.NumError{Func: "ParseUint", Num: string(s0), Err: err} - } - n *= uint64(base) - - n1 := n + uint64(v) - if n1 < n || n1 > maxVal { - // n+v overflows - n = 1<<64 - 1 - err = strconv.ErrRange - return n, &strconv.NumError{Func: "ParseUint", Num: string(s0), Err: err} - } - n = n1 - } - - return n, nil -} - -// Return the first number n such that n*base >= 1<<64. -func cutoff64(base int) uint64 { - if base < 2 { - return 0 - } - return (1<<64-1)/uint64(base) + 1 -} diff --git a/vendor/github.com/getlantern/errors/errors.go b/vendor/github.com/getlantern/errors/errors.go deleted file mode 100644 index 8b2b84f..0000000 --- a/vendor/github.com/getlantern/errors/errors.go +++ /dev/null @@ -1,566 +0,0 @@ -/* -Package errors defines error types used across Lantern project. - - n, err := Foo() - if err != nil { - return n, errors.New("Unable to do Foo: %v", err) - } - -or - - n, err := Foo() - return n, errors.Wrap(err) - -New() method will create a new error with err as its cause. Wrap will wrap err, -returning nil if err is nil. If err is an error from Go's standard library, -errors will extract details from that error, at least the Go type name and the -return value of err.Error(). - -One can record the operation on which the error occurred using Op(): - - return n, errors.New("Unable to do Foo: %v", err).Op("FooDooer") - -One can also record additional data: - - return n, errors. - New("Unable to do Foo: %v", err). - Op("FooDooer"). - With("mydata", "myvalue"). - With("moredata", 5) - -When used with github.com/getlantern/ops, Error captures its current context -and propagates that data for use in calling layers. - -When used with github.com/getlantern/golog, Error provides stacktraces: - - Hello World - at github.com/getlantern/errors.TestNewWithCause (errors_test.go:999) - at testing.tRunner (testing.go:999) - at runtime.goexit (asm_amd999.s:999) - Caused by: World - at github.com/getlantern/errors.buildCause (errors_test.go:999) - at github.com/getlantern/errors.TestNewWithCause (errors_test.go:999) - at testing.tRunner (testing.go:999) - at runtime.goexit (asm_amd999.s:999) - Caused by: orld - Caused by: ld - at github.com/getlantern/errors.buildSubSubCause (errors_test.go:999) - at github.com/getlantern/errors.buildSubCause (errors_test.go:999) - at github.com/getlantern/errors.buildCause (errors_test.go:999) - at github.com/getlantern/errors.TestNewWithCause (errors_test.go:999) - at testing.tRunner (testing.go:999) - at runtime.goexit (asm_amd999.s:999) - Caused by: d - -It's the caller's responsibility to avoid race conditions accessing the same -error instance from multiple goroutines. -*/ -package errors - -import ( - "bufio" - "bytes" - "crypto/tls" - "crypto/x509" - "encoding/hex" - "encoding/json" - "fmt" - "io" - "net" - "net/http" - "net/textproto" - "net/url" - "os" - "os/exec" - "reflect" - "runtime" - "strconv" - "strings" - "syscall" - "time" - "unicode" - - "github.com/getlantern/context" - "github.com/getlantern/hidden" - "github.com/getlantern/ops" - "github.com/go-stack/stack" -) - -// Error wraps system and application defined errors in unified structure for -// reporting and logging. It's not meant to be created directly. User New(), -// Wrap() and Report() instead. -type Error interface { - error - context.Contextual - - // ErrorClean returns a non-parameterized version of the error whenever - // possible. For example, if the error text is: - // - // unable to dial www.google.com caused by: i/o timeout - // - // ErrorClean might return: - // - // unable to dial %v caused by: %v - // - // This can be useful when performing analytics on the error. - ErrorClean() string - - // MultiLinePrinter implements the interface golog.MultiLine - MultiLinePrinter() func(buf *bytes.Buffer) bool - - // Op attaches a hint of the operation triggers this Error. Many error types - // returned by net and os package have Op pre-filled. - Op(op string) Error - - // With attaches arbitrary field to the error. keys will be normalized as - // underscore_divided_words, so all characters except letters and numbers will - // be replaced with underscores, and all letters will be lowercased. - With(key string, value interface{}) Error - - // RootCause returns the bottom-most cause of this Error. If the Error - // resulted from wrapping a plain error, the wrapped error will be returned as - // the cause. - RootCause() error -} - -type structured struct { - id uint64 - hiddenID string - data context.Map - context context.Map - wrapped error - cause Error - callStack stack.CallStack -} - -// New creates an Error with supplied description and format arguments to the -// description. If any of the arguments is an error, we use that as the cause. -func New(desc string, args ...interface{}) Error { - return NewOffset(1, desc, args...) -} - -// NewOffset is like New but offsets the stack by the given offset. This is -// useful for utilities like golog that may create errors on behalf of others. -func NewOffset(offset int, desc string, args ...interface{}) Error { - var cause error - for _, arg := range args { - err, isError := arg.(error) - if isError { - cause = err - break - } - } - e := buildError(desc, fmt.Sprintf(desc, args...), nil, Wrap(cause)) - e.attachStack(2 + offset) - return e -} - -// Wrap creates an Error based on the information in an error instance. It -// returns nil if the error passed in is nil, so we can simply call -// errors.Wrap(s.l.Close()) regardless there's an error or not. If the error is -// already wrapped, it is returned as is. -func Wrap(err error) Error { - return wrapSkipFrames(err, 1) -} - -// Fill implements the method from the context.Contextual interface. -func (e *structured) Fill(m context.Map) { - if e != nil { - if e.cause != nil { - // Include data from cause, which supercedes context - e.cause.Fill(m) - } - // Include the context, which supercedes the cause - for key, value := range e.context { - m[key] = value - } - // Now include the error's data, which supercedes everything - for key, value := range e.data { - m[key] = value - } - } -} - -func (e *structured) Op(op string) Error { - e.data["error_op"] = op - return e -} - -func (e *structured) With(key string, value interface{}) Error { - parts := strings.FieldsFunc(key, func(c rune) bool { - return !unicode.IsLetter(c) && !unicode.IsNumber(c) - }) - k := strings.ToLower(strings.Join(parts, "_")) - if k == "error" || k == "error_op" { - // Never overwrite these - return e - } - switch actual := value.(type) { - case string, int, bool, time.Time: - e.data[k] = actual - default: - e.data[k] = fmt.Sprint(actual) - } - return e -} - -func (e *structured) RootCause() error { - if e.cause == nil { - if e.wrapped != nil { - return e.wrapped - } - return e - } - return e.cause.RootCause() -} - -func (e *structured) ErrorClean() string { - return e.data["error"].(string) -} - -// Error satisfies the error interface -func (e *structured) Error() string { - return e.data["error_text"].(string) + e.hiddenID -} - -func (e *structured) MultiLinePrinter() func(buf *bytes.Buffer) bool { - first := true - indent := false - err := e - stackPosition := 0 - switchedCause := false - return func(buf *bytes.Buffer) bool { - if indent { - buf.WriteString(" ") - } - if first { - buf.WriteString(e.Error()) - first = false - indent = true - return true - } - if switchedCause { - fmt.Fprintf(buf, "Caused by: %v", err) - if err.callStack != nil && len(err.callStack) > 0 { - switchedCause = false - indent = true - return true - } - if err.cause == nil { - return false - } - err = err.cause.(*structured) - return true - } - if stackPosition < len(err.callStack) { - buf.WriteString("at ") - call := err.callStack[stackPosition] - fmt.Fprintf(buf, "%+n (%s:%d)", call, call, call) - stackPosition++ - } - if stackPosition >= len(err.callStack) { - switch cause := err.cause.(type) { - case *structured: - err = cause - indent = false - stackPosition = 0 - switchedCause = true - default: - return false - } - } - return err != nil - } -} - -func wrapSkipFrames(err error, skip int) Error { - if err == nil { - return nil - } - - // Look for *structureds - if e, ok := err.(*structured); ok { - return e - } - - var cause Error - // Look for hidden *structureds - hiddenIDs, err2 := hidden.Extract(err.Error()) - if err2 == nil && len(hiddenIDs) > 0 { - // Take the first hidden ID as our cause - cause = get(hiddenIDs[0]) - } - - // Create a new *structured - return buildError("", "", err, cause) -} - -func (e *structured) attachStack(skip int) { - call := stack.Caller(skip) - e.callStack = stack.Trace().TrimBelow(call) - e.data["error_location"] = fmt.Sprintf("%+n (%s:%d)", call, call, call) -} - -func buildError(desc string, fullText string, wrapped error, cause Error) *structured { - e := &structured{ - data: make(context.Map), - // We capture the current context to allow it to propagate to higher layers. - context: ops.AsMap(nil, false), - wrapped: wrapped, - cause: cause, - } - e.save() - - errorType := "errors.Error" - if wrapped != nil { - op, goType, wrappedDesc, extra := parseError(wrapped) - if desc == "" { - desc = wrappedDesc - } - e.Op(op) - errorType = goType - if extra != nil { - for key, value := range extra { - e.data[key] = value - } - } - } - - cleanedDesc := hidden.Clean(desc) - e.data["error"] = cleanedDesc - if fullText != "" { - e.data["error_text"] = hidden.Clean(fullText) - } else { - e.data["error_text"] = cleanedDesc - } - e.data["error_type"] = errorType - - return e -} - -func parseError(err error) (op string, goType string, desc string, extra map[string]string) { - extra = make(map[string]string) - - // interfaces - if _, ok := err.(net.Error); ok { - if opError, ok := err.(*net.OpError); ok { - op = opError.Op - if opError.Source != nil { - extra["remote_addr"] = opError.Source.String() - } - if opError.Addr != nil { - extra["local_addr"] = opError.Addr.String() - } - extra["network"] = opError.Net - err = opError.Err - } - switch actual := err.(type) { - case *net.AddrError: - goType = "net.AddrError" - desc = actual.Err - extra["addr"] = actual.Addr - case *net.DNSError: - goType = "net.DNSError" - desc = actual.Err - extra["domain"] = actual.Name - if actual.Server != "" { - extra["dns_server"] = actual.Server - } - case *net.InvalidAddrError: - goType = "net.InvalidAddrError" - desc = actual.Error() - case *net.ParseError: - goType = "net.ParseError" - desc = "invalid " + actual.Type - extra["text_to_parse"] = actual.Text - case net.UnknownNetworkError: - goType = "net.UnknownNetworkError" - desc = "unknown network" - case syscall.Errno: - goType = "syscall.Errno" - desc = actual.Error() - case *url.Error: - goType = "url.Error" - desc = actual.Err.Error() - op = actual.Op - default: - goType = reflect.TypeOf(err).String() - desc = err.Error() - } - return - } - if _, ok := err.(runtime.Error); ok { - desc = err.Error() - switch err.(type) { - case *runtime.TypeAssertionError: - goType = "runtime.TypeAssertionError" - default: - goType = reflect.TypeOf(err).String() - } - return - } - - // structs - switch actual := err.(type) { - case *http.ProtocolError: - desc = actual.ErrorString - if name, ok := httpProtocolErrors[err]; ok { - goType = name - } else { - goType = "http.ProtocolError" - } - case url.EscapeError, *url.EscapeError: - goType = "url.EscapeError" - desc = "invalid URL escape" - case url.InvalidHostError, *url.InvalidHostError: - goType = "url.InvalidHostError" - desc = "invalid character in host name" - case *textproto.Error: - goType = "textproto.Error" - desc = actual.Error() - case textproto.ProtocolError, *textproto.ProtocolError: - goType = "textproto.ProtocolError" - desc = actual.Error() - - case tls.RecordHeaderError: - goType = "tls.RecordHeaderError" - desc = actual.Msg - extra["header"] = hex.EncodeToString(actual.RecordHeader[:]) - case x509.CertificateInvalidError: - goType = "x509.CertificateInvalidError" - desc = actual.Error() - case x509.ConstraintViolationError: - goType = "x509.ConstraintViolationError" - desc = actual.Error() - case x509.HostnameError: - goType = "x509.HostnameError" - desc = actual.Error() - extra["host"] = actual.Host - case x509.InsecureAlgorithmError: - goType = "x509.InsecureAlgorithmError" - desc = actual.Error() - case x509.SystemRootsError: - goType = "x509.SystemRootsError" - desc = actual.Error() - case x509.UnhandledCriticalExtension: - goType = "x509.UnhandledCriticalExtension" - desc = actual.Error() - case x509.UnknownAuthorityError: - goType = "x509.UnknownAuthorityError" - desc = actual.Error() - case hex.InvalidByteError: - goType = "hex.InvalidByteError" - desc = "invalid byte" - case *json.InvalidUTF8Error: - goType = "json.InvalidUTF8Error" - desc = "invalid UTF-8 in string" - case *json.InvalidUnmarshalError: - goType = "json.InvalidUnmarshalError" - desc = actual.Error() - case *json.MarshalerError: - goType = "json.MarshalerError" - desc = actual.Error() - case *json.SyntaxError: - goType = "json.SyntaxError" - desc = actual.Error() - case *json.UnmarshalFieldError: - goType = "json.UnmarshalFieldError" - desc = actual.Error() - case *json.UnmarshalTypeError: - goType = "json.UnmarshalTypeError" - desc = actual.Error() - case *json.UnsupportedTypeError: - goType = "json.UnsupportedTypeError" - desc = actual.Error() - case *json.UnsupportedValueError: - goType = "json.UnsupportedValueError" - desc = actual.Error() - - case *os.LinkError: - goType = "os.LinkError" - desc = actual.Error() - case *os.PathError: - goType = "os.PathError" - op = actual.Op - desc = actual.Err.Error() - case *os.SyscallError: - goType = "os.SyscallError" - op = actual.Syscall - desc = actual.Err.Error() - case *exec.Error: - goType = "exec.Error" - desc = actual.Err.Error() - case *exec.ExitError: - goType = "exec.ExitError" - desc = actual.Error() - // TODO: limit the length - extra["stderr"] = string(actual.Stderr) - case *strconv.NumError: - goType = "strconv.NumError" - desc = actual.Err.Error() - extra["function"] = actual.Func - case *time.ParseError: - goType = "time.ParseError" - desc = actual.Message - default: - desc = err.Error() - if t, ok := miscErrors[err]; ok { - goType = t - return - } - goType = reflect.TypeOf(err).String() - } - return -} - -var httpProtocolErrors = map[error]string{ - http.ErrHeaderTooLong: "http.ErrHeaderTooLong", - http.ErrShortBody: "http.ErrShortBody", - http.ErrNotSupported: "http.ErrNotSupported", - http.ErrUnexpectedTrailer: "http.ErrUnexpectedTrailer", - http.ErrMissingContentLength: "http.ErrMissingContentLength", - http.ErrNotMultipart: "http.ErrNotMultipart", - http.ErrMissingBoundary: "http.ErrMissingBoundary", -} - -var miscErrors = map[error]string{ - bufio.ErrInvalidUnreadByte: "bufio.ErrInvalidUnreadByte", - bufio.ErrInvalidUnreadRune: "bufio.ErrInvalidUnreadRune", - bufio.ErrBufferFull: "bufio.ErrBufferFull", - bufio.ErrNegativeCount: "bufio.ErrNegativeCount", - bufio.ErrTooLong: "bufio.ErrTooLong", - bufio.ErrNegativeAdvance: "bufio.ErrNegativeAdvance", - bufio.ErrAdvanceTooFar: "bufio.ErrAdvanceTooFar", - bufio.ErrFinalToken: "bufio.ErrFinalToken", - - http.ErrWriteAfterFlush: "http.ErrWriteAfterFlush", - http.ErrBodyNotAllowed: "http.ErrBodyNotAllowed", - http.ErrHijacked: "http.ErrHijacked", - http.ErrContentLength: "http.ErrContentLength", - http.ErrBodyReadAfterClose: "http.ErrBodyReadAfterClose", - http.ErrHandlerTimeout: "http.ErrHandlerTimeout", - http.ErrLineTooLong: "http.ErrLineTooLong", - http.ErrMissingFile: "http.ErrMissingFile", - http.ErrNoCookie: "http.ErrNoCookie", - http.ErrNoLocation: "http.ErrNoLocation", - http.ErrSkipAltProtocol: "http.ErrSkipAltProtocol", - - io.EOF: "io.EOF", - io.ErrClosedPipe: "io.ErrClosedPipe", - io.ErrNoProgress: "io.ErrNoProgress", - io.ErrShortBuffer: "io.ErrShortBuffer", - io.ErrShortWrite: "io.ErrShortWrite", - io.ErrUnexpectedEOF: "io.ErrUnexpectedEOF", - - os.ErrInvalid: "os.ErrInvalid", - os.ErrPermission: "os.ErrPermission", - os.ErrExist: "os.ErrExist", - os.ErrNotExist: "os.ErrNotExist", - - exec.ErrNotFound: "exec.ErrNotFound", - - x509.ErrUnsupportedAlgorithm: "x509.ErrUnsupportedAlgorithm", - x509.IncorrectPasswordError: "x509.IncorrectPasswordError", - - hex.ErrLength: "hex.ErrLength", -} diff --git a/vendor/github.com/getlantern/errors/errors_test.go b/vendor/github.com/getlantern/errors/errors_test.go deleted file mode 100644 index 7c4887a..0000000 --- a/vendor/github.com/getlantern/errors/errors_test.go +++ /dev/null @@ -1,142 +0,0 @@ -package errors - -import ( - "bytes" - "fmt" - "regexp" - "testing" - - "github.com/getlantern/context" - "github.com/getlantern/hidden" - "github.com/getlantern/ops" - "github.com/stretchr/testify/assert" -) - -var ( - replaceNumbers = regexp.MustCompile("[0-9]+") -) - -func TestFull(t *testing.T) { - var firstErr Error - - // Iterate past the size of the hidden buffer - for i := 0; i < len(hiddenErrors)*2; i++ { - op := ops.Begin("op1").Set("ca", 100).Set("cd", 100) - e := New("Hello %v", "There").Op("My Op").With("DaTa_1", 1) - op.End() - if firstErr == nil { - firstErr = e - } - assert.Equal(t, "Hello There", e.Error()[:11]) - op = ops.Begin("op2").Set("ca", 200).Set("cb", 200).Set("cc", 200) - e3 := Wrap(fmt.Errorf("I'm wrapping your text: %v", e)).Op("outer op").With("dATA+1", i).With("cb", 300) - op.End() - assert.Equal(t, e, e3.(*structured).cause, "Wrapping a regular error should have extracted the contained *Error") - m := make(context.Map) - e3.Fill(m) - assert.Equal(t, i, m["data_1"], "Error's data should dominate all") - assert.Equal(t, 200, m["ca"], "Error's context should dominate cause") - assert.Equal(t, 300, m["cb"], "Error's data should dominate its context") - assert.Equal(t, 200, m["cc"], "Error's context should come through") - assert.Equal(t, 100, m["cd"], "Cause's context should come through") - assert.Equal(t, "My Op", e.(*structured).data["error_op"], "Op should be available from cause") - - for _, call := range e3.(*structured).callStack { - t.Logf("at %v", call) - } - } - - e3 := Wrap(fmt.Errorf("I'm wrapping your text: %v", firstErr)).With("a", 2) - assert.Nil(t, e3.(*structured).cause, "Wrapping an *Error that's no longer buffered should have yielded no cause") -} - -func TestNewWithCause(t *testing.T) { - cause := buildCause() - outer := New("Hello %v", cause) - assert.Equal(t, "Hello World", hidden.Clean(outer.Error())) - assert.Equal(t, "Hello %v", outer.(*structured).ErrorClean()) - assert.Equal(t, - "github.com/getlantern/errors.TestNewWithCause (errors_test.go:999)", - replaceNumbers.ReplaceAllString(outer.(*structured).data["error_location"].(string), "999")) - assert.Equal(t, cause, outer.(*structured).cause) - - // Make sure that stacktrace prints out okay - buf := &bytes.Buffer{} - print := outer.MultiLinePrinter() - for { - more := print(buf) - buf.WriteByte('\n') - if !more { - break - } - } - expected := `Hello World - at github.com/getlantern/errors.TestNewWithCause (errors_test.go:999) - at testing.tRunner (testing.go:999) - at runtime.goexit (asm_amd999.s:999) -Caused by: World - at github.com/getlantern/errors.buildCause (errors_test.go:999) - at github.com/getlantern/errors.TestNewWithCause (errors_test.go:999) - at testing.tRunner (testing.go:999) - at runtime.goexit (asm_amd999.s:999) -Caused by: orld -Caused by: ld - at github.com/getlantern/errors.buildSubSubCause (errors_test.go:999) - at github.com/getlantern/errors.buildSubCause (errors_test.go:999) - at github.com/getlantern/errors.buildCause (errors_test.go:999) - at github.com/getlantern/errors.TestNewWithCause (errors_test.go:999) - at testing.tRunner (testing.go:999) - at runtime.goexit (asm_amd999.s:999) -Caused by: d -` - - assert.Equal(t, expected, replaceNumbers.ReplaceAllString(hidden.Clean(buf.String()), "999")) - assert.Equal(t, buildSubSubSubCause(), outer.RootCause()) -} - -func buildCause() Error { - return New("W%v", buildSubCause()) -} - -func buildSubCause() error { - return fmt.Errorf("or%v", buildSubSubCause()) -} - -func buildSubSubCause() error { - return New("l%v", buildSubSubSubCause()) -} - -func buildSubSubSubCause() error { - return fmt.Errorf("d") -} - -func TestWrapNil(t *testing.T) { - assert.Nil(t, doWrapNil()) -} - -func doWrapNil() error { - return Wrap(nil) -} - -func TestHiddenWithCause(t *testing.T) { - e1 := fmt.Errorf("I failed %v", "dude") - e2 := New("I wrap: %v", e1) - e3 := fmt.Errorf("Hiding %v", e2) - // clear hidden buffer - hiddenErrors = make([]*structured, 100) - e4 := Wrap(e3) - e5 := New("I'm really outer: %v", e4) - - buf := &bytes.Buffer{} - print := e5.MultiLinePrinter() - for { - more := print(buf) - buf.WriteByte('\n') - if !more { - break - } - } - fmt.Println(buf.String()) - // We're not asserting the output because we're just making sure that printing - // doesn't panic. If we get to this point without panicking, we're happy. -} diff --git a/vendor/github.com/getlantern/errors/hide.go b/vendor/github.com/getlantern/errors/hide.go deleted file mode 100644 index f10d863..0000000 --- a/vendor/github.com/getlantern/errors/hide.go +++ /dev/null @@ -1,50 +0,0 @@ -package errors - -import ( - "encoding/binary" - "sync" - - "github.com/getlantern/hidden" -) - -var ( - hiddenErrors = make([]*structured, 100) - nextID = uint64(0) - hiddenMutex sync.RWMutex -) - -// This trick saves the error to a ring buffer and embeds a non-printing -// hiddenID in the error's description, so that if the errors is later wrapped -// by a standard error using something like -// fmt.Errorf("An error occurred: %v", thisError), we can subsequently extract -// the error simply using the hiddenID in the string. -func (e *structured) save() { - hiddenMutex.Lock() - b := make([]byte, 8) - binary.BigEndian.PutUint64(b, nextID) - e.id = nextID - e.hiddenID = hidden.ToString(b) - hiddenErrors[idxForID(nextID)] = e - nextID++ - hiddenMutex.Unlock() -} - -func get(hiddenID []byte) Error { - if len(hiddenID) != 8 { - return nil - } - id := binary.BigEndian.Uint64(hiddenID) - hiddenMutex.RLock() - err := hiddenErrors[idxForID(id)] - hiddenMutex.RUnlock() - if err != nil && err.id == id { - // Found it! - return err - } - // buffer has rolled over - return nil -} - -func idxForID(id uint64) int { - return int(id % uint64(len(hiddenErrors))) -} diff --git a/vendor/github.com/getlantern/golog/LICENSE b/vendor/github.com/getlantern/golog/LICENSE deleted file mode 100644 index 3ee0162..0000000 --- a/vendor/github.com/getlantern/golog/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2014 Brave New Software Project, Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/getlantern/golog/README.md b/vendor/github.com/getlantern/golog/README.md deleted file mode 100644 index 88fe677..0000000 --- a/vendor/github.com/getlantern/golog/README.md +++ /dev/null @@ -1,6 +0,0 @@ -golog [![Travis CI Status](https://travis-ci.org/getlantern/golog.svg?branch=master)](https://travis-ci.org/getlantern/golog) [![Coverage Status](https://coveralls.io/repos/getlantern/golog/badge.png)](https://coveralls.io/r/getlantern/golog) [![GoDoc](https://godoc.org/github.com/getlantern/golog?status.png)](http://godoc.org/github.com/getlantern/golog) -========== -Provides logging used in many getlantern components. - -[GoDoc](https://godoc.org/github.com/getlantern/golog) - diff --git a/vendor/github.com/getlantern/golog/golog.go b/vendor/github.com/getlantern/golog/golog.go deleted file mode 100644 index 143e904..0000000 --- a/vendor/github.com/getlantern/golog/golog.go +++ /dev/null @@ -1,458 +0,0 @@ -// Package golog implements logging functions that log errors to stderr and -// debug messages to stdout. Trace logging is also supported. -// Trace logs go to stdout as well, but they are only written if the program -// is run with environment variable "TRACE=true". -// A stack dump will be printed after the message if "PRINT_STACK=true". -package golog - -import ( - "bufio" - "bytes" - "fmt" - "io" - "io/ioutil" - "log" - "os" - "path/filepath" - "runtime" - "sort" - "strconv" - "strings" - "sync" - "sync/atomic" - - "github.com/getlantern/errors" - "github.com/getlantern/hidden" - "github.com/getlantern/ops" - "github.com/oxtoacart/bpool" -) - -const ( - // ERROR is an error Severity - ERROR = 500 - - // FATAL is an error Severity - FATAL = 600 -) - -var ( - outs atomic.Value - reporters []ErrorReporter - reportersMutex sync.RWMutex - - bufferPool = bpool.NewBufferPool(200) - - onFatal atomic.Value -) - -// Severity is a level of error (higher values are more severe) -type Severity int - -func (s Severity) String() string { - switch s { - case ERROR: - return "ERROR" - case FATAL: - return "FATAL" - default: - return "UNKNOWN" - } -} - -func init() { - DefaultOnFatal() - ResetOutputs() -} - -func SetOutputs(errorOut io.Writer, debugOut io.Writer) { - outs.Store(&outputs{ - ErrorOut: errorOut, - DebugOut: debugOut, - }) -} - -func ResetOutputs() { - SetOutputs(os.Stderr, os.Stdout) -} - -func GetOutputs() *outputs { - return outs.Load().(*outputs) -} - -// RegisterReporter registers the given ErrorReporter. All logged Errors are -// sent to this reporter. -func RegisterReporter(reporter ErrorReporter) { - reportersMutex.Lock() - reporters = append(reporters, reporter) - reportersMutex.Unlock() -} - -// OnFatal configures golog to call the given function on any FATAL error. By -// default, golog calls os.Exit(1) on any FATAL error. -func OnFatal(fn func(err error)) { - onFatal.Store(fn) -} - -// DefaultOnFatal enables the default behavior for OnFatal -func DefaultOnFatal() { - onFatal.Store(func(err error) { - os.Exit(1) - }) -} - -type outputs struct { - ErrorOut io.Writer - DebugOut io.Writer -} - -// MultiLine is an interface for arguments that support multi-line output. -type MultiLine interface { - // MultiLinePrinter returns a function that can be used to print the - // multi-line output. The returned function writes one line to the buffer and - // returns true if there are more lines to write. This function does not need - // to take care of trailing carriage returns, golog handles that - // automatically. - MultiLinePrinter() func(buf *bytes.Buffer) bool -} - -// ErrorReporter is a function to which the logger will report errors. -// It the given error and corresponding message along with associated ops -// context. This should return quickly as it executes on the critical code -// path. The recommended approach is to buffer as much as possible and discard -// new reports if the buffer becomes saturated. -type ErrorReporter func(err error, linePrefix string, severity Severity, ctx map[string]interface{}) - -type Logger interface { - // Debug logs to stdout - Debug(arg interface{}) - // Debugf logs to stdout - Debugf(message string, args ...interface{}) - - // Error logs to stderr - Error(arg interface{}) error - // Errorf logs to stderr. It returns the first argument that's an error, or - // a new error built using fmt.Errorf if none of the arguments are errors. - Errorf(message string, args ...interface{}) error - - // Fatal logs to stderr and then exits with status 1 - Fatal(arg interface{}) - // Fatalf logs to stderr and then exits with status 1 - Fatalf(message string, args ...interface{}) - - // Trace logs to stderr only if TRACE=true - Trace(arg interface{}) - // Tracef logs to stderr only if TRACE=true - Tracef(message string, args ...interface{}) - - // TraceOut provides access to an io.Writer to which trace information can - // be streamed. If running with environment variable "TRACE=true", TraceOut - // will point to os.Stderr, otherwise it will point to a ioutil.Discared. - // Each line of trace information will be prefixed with this Logger's - // prefix. - TraceOut() io.Writer - - // IsTraceEnabled() indicates whether or not tracing is enabled for this - // logger. - IsTraceEnabled() bool - - // AsStdLogger returns an standard logger - AsStdLogger() *log.Logger -} - -func LoggerFor(prefix string) Logger { - l := &logger{ - prefix: prefix + ": ", - pc: make([]uintptr, 10), - } - - trace := os.Getenv("TRACE") - l.traceOn, _ = strconv.ParseBool(trace) - if !l.traceOn { - prefixes := strings.Split(trace, ",") - for _, p := range prefixes { - if prefix == strings.Trim(p, " ") { - l.traceOn = true - break - } - } - } - if l.traceOn { - l.traceOut = l.newTraceWriter() - } else { - l.traceOut = ioutil.Discard - } - - printStack := os.Getenv("PRINT_STACK") - l.printStack, _ = strconv.ParseBool(printStack) - - return l -} - -type logger struct { - prefix string - traceOn bool - traceOut io.Writer - printStack bool - outs atomic.Value - pc []uintptr - funcForPc *runtime.Func -} - -// attaches the file and line number corresponding to -// the log message -func (l *logger) linePrefix(skipFrames int) string { - runtime.Callers(skipFrames, l.pc) - funcForPc := runtime.FuncForPC(l.pc[0]) - file, line := funcForPc.FileLine(l.pc[0] - 1) - return fmt.Sprintf("%s%s:%d ", l.prefix, filepath.Base(file), line) -} - -func (l *logger) print(out io.Writer, skipFrames int, severity string, arg interface{}) string { - buf := bufferPool.Get() - defer bufferPool.Put(buf) - - linePrefix := l.linePrefix(skipFrames) - writeHeader := func() { - buf.WriteString(severity) - buf.WriteString(" ") - buf.WriteString(linePrefix) - } - if arg != nil { - ml, isMultiline := arg.(MultiLine) - if !isMultiline { - writeHeader() - fmt.Fprintf(buf, "%v", arg) - printContext(buf, arg) - buf.WriteByte('\n') - } else { - mlp := ml.MultiLinePrinter() - first := true - for { - writeHeader() - more := mlp(buf) - if first { - printContext(buf, arg) - first = false - } - buf.WriteByte('\n') - if !more { - break - } - } - } - } - b := []byte(hidden.Clean(buf.String())) - _, err := out.Write(b) - if err != nil { - errorOnLogging(err) - } - if l.printStack { - l.doPrintStack() - } - - return linePrefix -} - -func (l *logger) printf(out io.Writer, skipFrames int, severity string, err error, message string, args ...interface{}) string { - buf := bufferPool.Get() - defer bufferPool.Put(buf) - - linePrefix := l.linePrefix(skipFrames) - buf.WriteString(severity) - buf.WriteString(" ") - buf.WriteString(linePrefix) - fmt.Fprintf(buf, message, args...) - printContext(buf, err) - buf.WriteByte('\n') - b := []byte(hidden.Clean(buf.String())) - _, err2 := out.Write(b) - if err2 != nil { - errorOnLogging(err) - } - if l.printStack { - l.doPrintStack() - } - return linePrefix -} - -func (l *logger) Debug(arg interface{}) { - l.print(GetOutputs().DebugOut, 4, "DEBUG", arg) -} - -func (l *logger) Debugf(message string, args ...interface{}) { - l.printf(GetOutputs().DebugOut, 4, "DEBUG", nil, message, args...) -} - -func (l *logger) Error(arg interface{}) error { - return l.errorSkipFrames(arg, 1, ERROR) -} - -func (l *logger) Errorf(message string, args ...interface{}) error { - return l.errorSkipFrames(errors.NewOffset(1, message, args...), 1, ERROR) -} - -func (l *logger) Fatal(arg interface{}) { - fatal(l.errorSkipFrames(arg, 1, FATAL)) -} - -func (l *logger) Fatalf(message string, args ...interface{}) { - fatal(l.errorSkipFrames(errors.NewOffset(1, message, args...), 1, FATAL)) -} - -func fatal(err error) { - fn := onFatal.Load().(func(err error)) - fn(err) -} - -func (l *logger) errorSkipFrames(arg interface{}, skipFrames int, severity Severity) error { - var err error - switch e := arg.(type) { - case error: - err = e - default: - err = fmt.Errorf("%v", e) - } - linePrefix := l.print(GetOutputs().ErrorOut, skipFrames+4, severity.String(), err) - return report(err, linePrefix, severity) -} - -func (l *logger) Trace(arg interface{}) { - if l.traceOn { - l.print(GetOutputs().DebugOut, 4, "TRACE", arg) - } -} - -func (l *logger) Tracef(message string, args ...interface{}) { - if l.traceOn { - l.printf(GetOutputs().DebugOut, 4, "TRACE", nil, message, args...) - } -} - -func (l *logger) TraceOut() io.Writer { - return l.traceOut -} - -func (l *logger) IsTraceEnabled() bool { - return l.traceOn -} - -func (l *logger) newTraceWriter() io.Writer { - pr, pw := io.Pipe() - br := bufio.NewReader(pr) - - if !l.traceOn { - return pw - } - go func() { - defer func() { - if err := pr.Close(); err != nil { - errorOnLogging(err) - } - }() - defer func() { - if err := pw.Close(); err != nil { - errorOnLogging(err) - } - }() - - for { - line, err := br.ReadString('\n') - if err == nil { - // Log the line (minus the trailing newline) - l.print(GetOutputs().DebugOut, 6, "TRACE", line[:len(line)-1]) - } else { - l.printf(GetOutputs().DebugOut, 6, "TRACE", nil, "TraceWriter closed due to unexpected error: %v", err) - return - } - } - }() - - return pw -} - -type errorWriter struct { - l *logger -} - -// Write implements method of io.Writer, due to different call depth, -// it will not log correct file and line prefix -func (w *errorWriter) Write(p []byte) (n int, err error) { - s := string(p) - if s[len(s)-1] == '\n' { - s = s[:len(s)-1] - } - w.l.print(GetOutputs().ErrorOut, 6, "ERROR", s) - return len(p), nil -} - -func (l *logger) AsStdLogger() *log.Logger { - return log.New(&errorWriter{l}, "", 0) -} - -func (l *logger) doPrintStack() { - var b []byte - buf := bytes.NewBuffer(b) - for _, pc := range l.pc { - funcForPc := runtime.FuncForPC(pc) - if funcForPc == nil { - break - } - name := funcForPc.Name() - if strings.HasPrefix(name, "runtime.") { - break - } - file, line := funcForPc.FileLine(pc) - fmt.Fprintf(buf, "\t%s\t%s: %d\n", name, file, line) - } - if _, err := buf.WriteTo(os.Stderr); err != nil { - errorOnLogging(err) - } -} - -func errorOnLogging(err error) { - fmt.Fprintf(os.Stderr, "Unable to log: %v\n", err) -} - -func printContext(buf *bytes.Buffer, err interface{}) { - // Note - we don't include globals when printing in order to avoid polluting the text log - values := ops.AsMap(err, false) - if len(values) == 0 { - return - } - buf.WriteString(" [") - var keys []string - for key := range values { - keys = append(keys, key) - } - sort.Strings(keys) - for i, key := range keys { - value := values[key] - if i > 0 { - buf.WriteString(" ") - } - buf.WriteString(key) - buf.WriteString("=") - fmt.Fprintf(buf, "%v", value) - } - buf.WriteByte(']') -} - -func report(err error, linePrefix string, severity Severity) error { - var reportersCopy []ErrorReporter - reportersMutex.RLock() - if len(reporters) > 0 { - reportersCopy = make([]ErrorReporter, len(reporters)) - copy(reportersCopy, reporters) - } - reportersMutex.RUnlock() - - if len(reportersCopy) > 0 { - ctx := ops.AsMap(err, true) - ctx["severity"] = severity.String() - for _, reporter := range reportersCopy { - // We include globals when reporting - reporter(err, linePrefix, severity, ctx) - } - } - return err -} diff --git a/vendor/github.com/getlantern/golog/golog_test.go b/vendor/github.com/getlantern/golog/golog_test.go deleted file mode 100644 index bce36e8..0000000 --- a/vendor/github.com/getlantern/golog/golog_test.go +++ /dev/null @@ -1,224 +0,0 @@ -package golog - -import ( - "bytes" - "io" - "io/ioutil" - "os" - "regexp" - "strings" - "sync" - "testing" - "time" - - "github.com/getlantern/errors" - "github.com/getlantern/ops" - - "github.com/stretchr/testify/assert" -) - -var ( - expectedLog = "SEVERITY myprefix: golog_test.go:999 Hello world\nSEVERITY myprefix: golog_test.go:999 Hello true [cvarA=a cvarB=b op=name root_op=name]\n" - expectedErrorLog = `ERROR myprefix: golog_test.go:999 Hello world [cvarC=c cvarD=d error=Hello %v error_location=github.com/getlantern/golog.TestError (golog_test.go:999) error_text=Hello world error_type=errors.Error op=name root_op=name] -ERROR myprefix: golog_test.go:999 at github.com/getlantern/golog.TestError (golog_test.go:999) -ERROR myprefix: golog_test.go:999 at testing.tRunner (testing.go:999) -ERROR myprefix: golog_test.go:999 at runtime.goexit (asm_amd999.s:999) -ERROR myprefix: golog_test.go:999 Caused by: world -ERROR myprefix: golog_test.go:999 at github.com/getlantern/golog.errorReturner (golog_test.go:999) -ERROR myprefix: golog_test.go:999 at github.com/getlantern/golog.TestError (golog_test.go:999) -ERROR myprefix: golog_test.go:999 at testing.tRunner (testing.go:999) -ERROR myprefix: golog_test.go:999 at runtime.goexit (asm_amd999.s:999) -ERROR myprefix: golog_test.go:999 Hello true [cvarA=a cvarB=b cvarC=c error=%v %v error_location=github.com/getlantern/golog.TestError (golog_test.go:999) error_text=Hello true error_type=errors.Error op=name999 root_op=name999] -ERROR myprefix: golog_test.go:999 at github.com/getlantern/golog.TestError (golog_test.go:999) -ERROR myprefix: golog_test.go:999 at testing.tRunner (testing.go:999) -ERROR myprefix: golog_test.go:999 at runtime.goexit (asm_amd999.s:999) -ERROR myprefix: golog_test.go:999 Caused by: Hello -ERROR myprefix: golog_test.go:999 at github.com/getlantern/golog.TestError (golog_test.go:999) -ERROR myprefix: golog_test.go:999 at testing.tRunner (testing.go:999) -ERROR myprefix: golog_test.go:999 at runtime.goexit (asm_amd999.s:999) -` - expectedTraceLog = "TRACE myprefix: golog_test.go:999 Hello world\nTRACE myprefix: golog_test.go:999 Hello true\nTRACE myprefix: golog_test.go:999 Gravy\nTRACE myprefix: golog_test.go:999 TraceWriter closed due to unexpected error: EOF\n" - expectedStdLog = expectedLog -) - -var ( - replaceNumbers = regexp.MustCompile("[0-9]+") -) - -func init() { - ops.SetGlobal("global", "shouldn't show up") -} - -func expected(severity string, log string) string { - return strings.Replace(log, "SEVERITY", severity, -1) -} - -func normalized(log string) string { - return replaceNumbers.ReplaceAllString(log, "999") -} - -func TestReport(t *testing.T) { - SetOutputs(ioutil.Discard, ioutil.Discard) - OnFatal(func(err error) { - // ignore (prevents test from exiting) - }) - - errors := 0 - fatals := 0 - RegisterReporter(func(err error, linePrefix string, severity Severity, ctx map[string]interface{}) { - switch severity { - case ERROR: - errors++ - case FATAL: - fatals++ - } - }) - l := LoggerFor("reporting") - l.Error("Some error") - l.Fatal("Fatal error") - assert.Equal(t, 1, errors) - assert.Equal(t, 1, fatals) -} - -func TestDebug(t *testing.T) { - out := newBuffer() - SetOutputs(ioutil.Discard, out) - l := LoggerFor("myprefix") - l.Debug("Hello world") - defer ops.Begin("name").Set("cvarA", "a").Set("cvarB", "b").End() - l.Debugf("Hello %v", true) - assert.Equal(t, expected("DEBUG", expectedLog), out.String()) -} - -func TestError(t *testing.T) { - out := newBuffer() - SetOutputs(out, ioutil.Discard) - l := LoggerFor("myprefix") - ctx := ops.Begin("name").Set("cvarC", "c") - err := errorReturner() - err1 := errors.New("Hello %v", err) - err2 := errors.New("Hello") - ctx.End() - l.Error(err1) - defer ops.Begin("name2").Set("cvarA", "a").Set("cvarB", "b").End() - l.Errorf("%v %v", err2, true) - t.Log(out.String()) - assert.Equal(t, expectedErrorLog, out.String()) -} - -func errorReturner() error { - defer ops.Begin("name").Set("cvarD", "d").End() - return errors.New("world") -} - -func TestTraceEnabled(t *testing.T) { - originalTrace := os.Getenv("TRACE") - err := os.Setenv("TRACE", "true") - if err != nil { - t.Fatalf("Unable to set trace to true") - } - defer func() { - if err := os.Setenv("TRACE", originalTrace); err != nil { - t.Fatalf("Unable to set TRACE environment variable: %v", err) - } - }() - - out := newBuffer() - SetOutputs(ioutil.Discard, out) - l := LoggerFor("myprefix") - l.Trace("Hello world") - l.Tracef("Hello %v", true) - tw := l.TraceOut() - if _, err := tw.Write([]byte("Gravy\n")); err != nil { - t.Fatalf("Unable to write: %v", err) - } - if err := tw.(io.Closer).Close(); err != nil { - t.Fatalf("Unable to close: %v", err) - } - - // Give trace writer a moment to catch up - time.Sleep(50 * time.Millisecond) - assert.Regexp(t, expected("TRACE", expectedTraceLog), out.String()) -} - -func TestTraceDisabled(t *testing.T) { - originalTrace := os.Getenv("TRACE") - err := os.Setenv("TRACE", "false") - if err != nil { - t.Fatalf("Unable to set trace to false") - } - defer func() { - if err := os.Setenv("TRACE", originalTrace); err != nil { - t.Fatalf("Unable to set TRACE environment variable: %v", err) - } - }() - - out := newBuffer() - SetOutputs(ioutil.Discard, out) - l := LoggerFor("myprefix") - l.Trace("Hello world") - l.Tracef("Hello %v", true) - if _, err := l.TraceOut().Write([]byte("Gravy\n")); err != nil { - t.Fatalf("Unable to write: %v", err) - } - - // Give trace writer a moment to catch up - time.Sleep(50 * time.Millisecond) - - assert.Equal(t, "", out.String(), "Nothing should have been logged") -} - -func TestAsStdLogger(t *testing.T) { - out := newBuffer() - SetOutputs(out, ioutil.Discard) - l := LoggerFor("myprefix") - stdlog := l.AsStdLogger() - stdlog.Print("Hello world") - defer ops.Begin("name").Set("cvarA", "a").Set("cvarB", "b").End() - stdlog.Printf("Hello %v", true) - assert.Equal(t, expected("ERROR", expectedStdLog), out.String()) -} - -// TODO: TraceWriter appears to have been broken since we added line numbers -// func TestTraceWriter(t *testing.T) { -// originalTrace := os.Getenv("TRACE") -// err := os.Setenv("TRACE", "true") -// if err != nil { -// t.Fatalf("Unable to set trace to true") -// } -// defer func() { -// if err := os.Setenv("TRACE", originalTrace); err != nil { -// t.Fatalf("Unable to set TRACE environment variable: %v", err) -// } -// }() -// -// out := newBuffer() -// SetOutputs(ioutil.Discard, out) -// l := LoggerFor("myprefix") -// trace := l.TraceOut() -// trace.Write([]byte("Hello world\n")) -// defer ops.Begin().Set("cvarA", "a").Set("cvarB", "b").End() -// trace.Write([]byte("Hello true\n")) -// assert.Equal(t, expected("TRACE", expectedStdLog), out.String()) -// } - -func newBuffer() *synchronizedbuffer { - return &synchronizedbuffer{orig: &bytes.Buffer{}} -} - -type synchronizedbuffer struct { - orig *bytes.Buffer - mutex sync.RWMutex -} - -func (buf *synchronizedbuffer) Write(p []byte) (int, error) { - buf.mutex.Lock() - defer buf.mutex.Unlock() - return buf.orig.Write(p) -} - -func (buf *synchronizedbuffer) String() string { - buf.mutex.RLock() - defer buf.mutex.RUnlock() - return normalized(buf.orig.String()) -} diff --git a/vendor/github.com/getlantern/hex/hex.go b/vendor/github.com/getlantern/hex/hex.go deleted file mode 100644 index d1270e9..0000000 --- a/vendor/github.com/getlantern/hex/hex.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package hex implements hexadecimal encoding and decoding. It's taken almost -// verbatim from golang/encoding/hex, however it allows using a different set -// of encoding characters than the standard 0-F. -package hex - -import ( - "errors" - "fmt" -) - -// DefaultEncoding behaves just like golang/encoding/hex. -var DefaultEncoding = NewEncoding("0123456789abcdef") - -// An Encoding that uses a specific table of encoding characters. -type Encoding struct { - hextable string -} - -// NewEncoding constructs an Encoding using the given hextable. -func NewEncoding(hextable string) *Encoding { - return &Encoding{hextable} -} - -// EncodedLen returns the length of an encoding of n source bytes. -func EncodedLen(n int) int { return n * 2 } - -// Encode encodes src into EncodedLen(len(src)) -// bytes of dst. As a convenience, it returns the number -// of bytes written to dst, but this value is always EncodedLen(len(src)). -// Encode implements hexadecimal encoding. -func (e *Encoding) Encode(dst, src []byte) int { - for i, v := range src { - dst[i*2] = e.hextable[v>>4] - dst[i*2+1] = e.hextable[v&0x0f] - } - - return len(src) * 2 -} - -// ErrLength results from decoding an odd length slice. -var ErrLength = errors.New("encoding/hex: odd length hex string") - -// InvalidByteError values describe errors resulting from an invalid byte in a hex string. -type InvalidByteError byte - -func (e InvalidByteError) Error() string { - return fmt.Sprintf("encoding/hex: invalid byte: %#U", rune(e)) -} - -func DecodedLen(x int) int { return x / 2 } - -// Decode decodes src into DecodedLen(len(src)) bytes, returning the actual -// number of bytes written to dst. -// -// If Decode encounters invalid input, it returns an error describing the failure. -func (e *Encoding) Decode(dst, src []byte) (int, error) { - if len(src)%2 == 1 { - return 0, ErrLength - } - - for i := 0; i < len(src)/2; i++ { - a, ok := e.fromHexChar(src[i*2]) - if !ok { - return 0, InvalidByteError(src[i*2]) - } - b, ok := e.fromHexChar(src[i*2+1]) - if !ok { - return 0, InvalidByteError(src[i*2+1]) - } - dst[i] = (a << 4) | b - } - - return len(src) / 2, nil -} - -// fromHexChar converts a hex character into its value and a success flag. -func (e *Encoding) fromHexChar(c byte) (byte, bool) { - for i, ch := range []byte(e.hextable) { - if ch == c { - return byte(i), true - } - } - - return 0, false -} - -// EncodeToString returns the hexadecimal encoding of src. -func (e *Encoding) EncodeToString(src []byte) string { - dst := make([]byte, EncodedLen(len(src))) - e.Encode(dst, src) - return string(dst) -} - -// DecodeString returns the bytes represented by the hexadecimal string s. -func (e *Encoding) DecodeString(s string) ([]byte, error) { - src := []byte(s) - dst := make([]byte, DecodedLen(len(src))) - _, err := e.Decode(dst, src) - if err != nil { - return nil, err - } - return dst, nil -} diff --git a/vendor/github.com/getlantern/hidden/hidden.go b/vendor/github.com/getlantern/hidden/hidden.go deleted file mode 100644 index 0c52b08..0000000 --- a/vendor/github.com/getlantern/hidden/hidden.go +++ /dev/null @@ -1,66 +0,0 @@ -// Package hidden provides the ability to "hide" binary data in a string using -// a hex encoding with non-printing characters. Hidden data is demarcated with -// a leading and trailing NUL character. -package hidden - -import ( - "bytes" - "fmt" - "regexp" - - "github.com/getlantern/hex" -) - -// 16 non-printing characters -const hextable = "\x01\x02\x03\x04\x05\x06\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17" - -var ( - hexencoding = hex.NewEncoding(hextable) - - re *regexp.Regexp -) - -func init() { - var err error - re, err = regexp.Compile(fmt.Sprintf("\x00[%v]+\x00", hextable)) - if err != nil { - panic(err) - } -} - -// ToString encodes the given data as a hidden string, including leadnig and -// trailing NULs. -func ToString(data []byte) string { - buf := bytes.NewBuffer(make([]byte, 0, 2+hex.EncodedLen(len(data)))) - // Leading NUL - buf.WriteByte(0) - buf.WriteString(hexencoding.EncodeToString(data)) - // Trailing NUL - buf.WriteByte(0) - return buf.String() -} - -// FromString extracts the hidden data from a string, which is expected to -// contain leading and trailing NULs. -func FromString(str string) ([]byte, error) { - return hexencoding.DecodeString(str[1 : len(str)-1]) -} - -// Extract extracts all hidden data from an arbitrary string. -func Extract(str string) ([][]byte, error) { - m := re.FindAllString(str, -1) - result := make([][]byte, 0, len(m)) - for _, s := range m { - b, err := FromString(s) - if err != nil { - return nil, err - } - result = append(result, b) - } - return result, nil -} - -// Clean removes any hidden data from an arbitrary string. -func Clean(str string) string { - return re.ReplaceAllString(str, "") -} diff --git a/vendor/github.com/getlantern/hidden/hidden_test.go b/vendor/github.com/getlantern/hidden/hidden_test.go deleted file mode 100644 index 420ce64..0000000 --- a/vendor/github.com/getlantern/hidden/hidden_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package hidden - -import ( - "encoding/binary" - "fmt" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestRoundTrip(t *testing.T) { - str := "H" - encoded := ToString([]byte(str)) - rt, err := FromString(encoded) - if assert.NoError(t, err) { - assert.Equal(t, str, string(rt)) - } -} - -func TestExtract(t *testing.T) { - a := []byte("Here is my string") - b := make([]byte, 8) - binary.BigEndian.PutUint64(b, 56) - str := fmt.Sprintf("hidden%s data%s is fun", ToString(a), ToString(b)) - t.Log(str) - out, err := Extract(str) - if assert.NoError(t, err) { - if assert.Len(t, out, 2) { - assert.Equal(t, out, [][]byte{a, b}) - } - } - assert.Equal(t, "hidden data is fun", Clean(str)) -} diff --git a/vendor/github.com/getlantern/ops/ops.go b/vendor/github.com/getlantern/ops/ops.go deleted file mode 100644 index 136302d..0000000 --- a/vendor/github.com/getlantern/ops/ops.go +++ /dev/null @@ -1,154 +0,0 @@ -// Package ops provides a facility for tracking the processing of operations, -// including contextual metadata about the operation and their final success or -// failure. An op is assumed to have succeeded if by the time of calling Exit() -// no errors have been reported. The final status can be reported to a metrics -// facility. -package ops - -import ( - "sync" - "sync/atomic" - - "github.com/getlantern/context" -) - -var ( - cm = context.NewManager() - reporters []Reporter - reportersMutex sync.RWMutex -) - -// Reporter is a function that reports the success or failure of an Op. If -// failure is nil, the Op can be considered successful. -type Reporter func(failure error, ctx map[string]interface{}) - -// Op represents an operation that's being performed. It mimics the API of -// context.Context. -type Op interface { - // Begin marks the beginning of an Op under this Op. - Begin(name string) Op - - // Go starts the given function on a new goroutine. - Go(fn func()) - - // End marks the end of this op, at which point the Op will report its success - // or failure to all registered Reporters. - End() - - // Cancel cancels this op so that even if End() is called later, it will not - // report its success or failure. - Cancel() - - // Set puts a key->value pair into the current Op's context. - Set(key string, value interface{}) Op - - // SetDynamic puts a key->value pair into the current Op's context, where the - // value is generated by a function that gets evaluated at every Read. - SetDynamic(key string, valueFN func() interface{}) Op - - // FailIf marks this Op as failed if the given err is not nil. If FailIf is - // called multiple times, the latest error will be reported as the failure. - // Returns the original error for convenient chaining. - FailIf(err error) error -} - -type op struct { - ctx context.Context - canceled bool - failure atomic.Value -} - -// RegisterReporter registers the given reporter. -func RegisterReporter(reporter Reporter) { - reportersMutex.Lock() - reporters = append(reporters, reporter) - reportersMutex.Unlock() -} - -// Begin marks the beginning of a new Op. -func Begin(name string) Op { - return &op{ctx: cm.Enter().Put("op", name).PutIfAbsent("root_op", name)} -} - -func (o *op) Begin(name string) Op { - return &op{ctx: o.ctx.Enter().Put("op", name).PutIfAbsent("root_op", name)} -} - -func (o *op) Go(fn func()) { - o.ctx.Go(fn) -} - -// Go mimics the method from context.Manager. -func Go(fn func()) { - cm.Go(fn) -} - -func (o *op) Cancel() { - o.canceled = true -} - -func (o *op) End() { - if o.canceled { - return - } - - var reportersCopy []Reporter - reportersMutex.RLock() - if len(reporters) > 0 { - reportersCopy = make([]Reporter, len(reporters)) - copy(reportersCopy, reporters) - } - reportersMutex.RUnlock() - - if len(reportersCopy) > 0 { - var failure error - _failure := o.failure.Load() - ctx := o.ctx.AsMap(_failure, true) - if _failure != nil { - failure = _failure.(error) - _, errorSet := ctx["error"] - if !errorSet { - ctx["error"] = failure.Error() - } - } - for _, reporter := range reportersCopy { - reporter(failure, ctx) - } - } - - o.ctx.Exit() -} - -func (o *op) Set(key string, value interface{}) Op { - o.ctx.Put(key, value) - return o -} - -// SetGlobal puts a key->value pair into the global context, which is inherited -// by all Ops. -func SetGlobal(key string, value interface{}) { - cm.PutGlobal(key, value) -} - -func (o *op) SetDynamic(key string, valueFN func() interface{}) Op { - o.ctx.PutDynamic(key, valueFN) - return o -} - -// SetGlobalDynamic is like SetGlobal but uses a function to derive the value -// at read time. -func SetGlobalDynamic(key string, valueFN func() interface{}) { - cm.PutGlobalDynamic(key, valueFN) -} - -// AsMap mimics the method from context.Manager. -func AsMap(obj interface{}, includeGlobals bool) context.Map { - return cm.AsMap(obj, includeGlobals) -} - -func (o *op) FailIf(err error) error { - if err != nil { - o.failure.Store(err) - } - return err -} diff --git a/vendor/github.com/getlantern/ops/ops_test.go b/vendor/github.com/getlantern/ops/ops_test.go deleted file mode 100644 index 1c16e73..0000000 --- a/vendor/github.com/getlantern/ops/ops_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package ops_test - -import ( - "sync" - "testing" - - "github.com/getlantern/errors" - "github.com/getlantern/ops" - "github.com/stretchr/testify/assert" -) - -func TestSuccess(t *testing.T) { - var reportedFailure error - var reportedCtx map[string]interface{} - report := func(failure error, ctx map[string]interface{}) { - reportedFailure = failure - reportedCtx = ctx - } - - ops.RegisterReporter(report) - ops.SetGlobal("g", "g1") - op := ops.Begin("test_success").Set("a", 1).SetDynamic("b", func() interface{} { return 2 }) - defer op.End() - innerOp := op.Begin("inside") - innerOp.FailIf(nil) - innerOp.End() - - assert.Nil(t, reportedFailure) - expectedCtx := map[string]interface{}{ - "op": "inside", - "root_op": "test_success", - "g": "g1", - "a": 1, - "b": 2, - } - assert.Equal(t, expectedCtx, reportedCtx) -} - -func TestFailure(t *testing.T) { - doTestFailure(t, false) -} - -func TestCancel(t *testing.T) { - doTestFailure(t, true) -} - -func doTestFailure(t *testing.T, cancel bool) { - var reportedFailure error - var reportedCtx map[string]interface{} - report := func(failure error, ctx map[string]interface{}) { - reportedFailure = failure - reportedCtx = ctx - } - - ops.RegisterReporter(report) - op := ops.Begin("test_failure") - var wg sync.WaitGroup - wg.Add(1) - op.Go(func() { - op.FailIf(errors.New("I failed").With("errorcontext", 5)) - wg.Done() - }) - wg.Wait() - if cancel { - op.Cancel() - } - op.End() - - if cancel { - assert.Nil(t, reportedFailure) - assert.Nil(t, reportedCtx) - } else { - assert.Contains(t, reportedFailure.Error(), "I failed") - assert.Equal(t, 5, reportedCtx["errorcontext"]) - } -} diff --git a/vendor/github.com/getlantern/systray/.gitignore b/vendor/github.com/getlantern/systray/.gitignore deleted file mode 100644 index ae7e06b..0000000 --- a/vendor/github.com/getlantern/systray/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -example/example -*~ -*.swp -*.exe -Release -Debug -*.sdf -dll/systray_unsigned.dll -out.txt -.vs -on_exit*.txt diff --git a/vendor/github.com/getlantern/systray/LICENSE b/vendor/github.com/getlantern/systray/LICENSE deleted file mode 100644 index 3ee0162..0000000 --- a/vendor/github.com/getlantern/systray/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2014 Brave New Software Project, Inc. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/getlantern/systray/README.md b/vendor/github.com/getlantern/systray/README.md deleted file mode 100644 index 626c132..0000000 --- a/vendor/github.com/getlantern/systray/README.md +++ /dev/null @@ -1,50 +0,0 @@ -Package systray is a cross platfrom Go library to place an icon and menu in the notification area. -Tested on Windows 8, Mac OSX, Ubuntu 14.10 and Debian 7.6. - -## Usage -```go -func main() { - // Should be called at the very beginning of main(). - systray.Run(onReady, onExit) -} - -func onReady() { - systray.SetIcon(icon.Data) - systray.SetTitle("Awesome App") - systray.SetTooltip("Pretty awesome超级棒") - mQuit := systray.AddMenuItem("Quit", "Quit the whole app") - - // Sets the icon of a menu item. Only available on Mac. - mQuit.SetIcon(icon.Data) -} - -func onExit() { - // clean up here -} -``` -Menu item can be checked and / or disabled. Methods except `Run()` can be invoked from any goroutine. See demo code under `example` folder. - -## Platform specific concerns - -### Linux - -```sh -sudo apt-get install libgtk-3-dev libappindicator3-dev -``` -Checked menu item not implemented on Linux yet. - -## Try - -Under `example` folder. -Place tray icon under `icon`, and use `make_icon.bat` or `make_icon.sh`, whichever suit for your os, to convert the icon to byte array. -Your icon should be .ico file under Windows, whereas .ico, .jpg and .png is supported on other platform. - -```sh -go get -go run main.go -``` - -## Credits - -- https://github.com/xilp/systray -- https://github.com/cratonica/trayhost diff --git a/vendor/github.com/getlantern/systray/systray.go b/vendor/github.com/getlantern/systray/systray.go deleted file mode 100644 index d433173..0000000 --- a/vendor/github.com/getlantern/systray/systray.go +++ /dev/null @@ -1,181 +0,0 @@ -/* -Package systray is a cross platfrom Go library to place an icon and menu in the -notification area. -Supports Windows, Mac OSX and Linux currently. -Methods can be called from any goroutine except Run(), which should be called -at the very beginning of main() to lock at main thread. -*/ -package systray - -import ( - "runtime" - "sync" - "sync/atomic" - - "github.com/getlantern/golog" -) - -var ( - hasStarted = int64(0) - hasQuit = int64(0) -) - -// MenuItem is used to keep track each menu item of systray -// Don't create it directly, use the one systray.AddMenuItem() returned -type MenuItem struct { - // ClickedCh is the channel which will be notified when the menu item is clicked - ClickedCh chan struct{} - - // id uniquely identify a menu item, not supposed to be modified - id int32 - // title is the text shown on menu item - title string - // tooltip is the text shown when pointing to menu item - tooltip string - // disabled menu item is grayed out and has no effect when clicked - disabled bool - // checked menu item has a tick before the title - checked bool -} - -var ( - log = golog.LoggerFor("systray") - - systrayReady func() - systrayExit func() - menuItems = make(map[int32]*MenuItem) - menuItemsLock sync.RWMutex - - currentID = int32(-1) -) - -// Run initializes GUI and starts the event loop, then invokes the onReady -// callback. -// It blocks until systray.Quit() is called. -// Should be called at the very beginning of main() to lock at main thread. -func Run(onReady func(), onExit func()) { - runtime.LockOSThread() - atomic.StoreInt64(&hasStarted, 1) - - if onReady == nil { - systrayReady = func() {} - } else { - // Run onReady on separate goroutine to avoid blocking event loop - readyCh := make(chan interface{}) - go func() { - <-readyCh - onReady() - }() - systrayReady = func() { - close(readyCh) - } - } - - // unlike onReady, onExit runs in the event loop to make sure it has time to - // finish before the process terminates - if onExit == nil { - onExit = func() {} - } - systrayExit = onExit - - nativeLoop() -} - -// Quit the systray -func Quit() { - if atomic.LoadInt64(&hasStarted) == 1 && atomic.CompareAndSwapInt64(&hasQuit, 0, 1) { - quit() - } -} - -// AddMenuItem adds menu item with designated title and tooltip, returning a channel -// that notifies whenever that menu item is clicked. -// -// It can be safely invoked from different goroutines. -func AddMenuItem(title string, tooltip string) *MenuItem { - id := atomic.AddInt32(¤tID, 1) - item := &MenuItem{nil, id, title, tooltip, false, false} - item.ClickedCh = make(chan struct{}) - item.update() - return item -} - -// AddSeparator adds a separator bar to the menu -func AddSeparator() { - addSeparator(atomic.AddInt32(¤tID, 1)) -} - -// SetTitle set the text to display on a menu item -func (item *MenuItem) SetTitle(title string) { - item.title = title - item.update() -} - -// SetTooltip set the tooltip to show when mouse hover -func (item *MenuItem) SetTooltip(tooltip string) { - item.tooltip = tooltip - item.update() -} - -// Disabled checkes if the menu item is disabled -func (item *MenuItem) Disabled() bool { - return item.disabled -} - -// Enable a menu item regardless if it's previously enabled or not -func (item *MenuItem) Enable() { - item.disabled = false - item.update() -} - -// Disable a menu item regardless if it's previously disabled or not -func (item *MenuItem) Disable() { - item.disabled = true - item.update() -} - -// Hide hides a menu item -func (item *MenuItem) Hide() { - hideMenuItem(item) -} - -// Show shows a previously hidden menu item -func (item *MenuItem) Show() { - showMenuItem(item) -} - -// Checked returns if the menu item has a check mark -func (item *MenuItem) Checked() bool { - return item.checked -} - -// Check a menu item regardless if it's previously checked or not -func (item *MenuItem) Check() { - item.checked = true - item.update() -} - -// Uncheck a menu item regardless if it's previously unchecked or not -func (item *MenuItem) Uncheck() { - item.checked = false - item.update() -} - -// update propogates changes on a menu item to systray -func (item *MenuItem) update() { - menuItemsLock.Lock() - defer menuItemsLock.Unlock() - menuItems[item.id] = item - addOrUpdateMenuItem(item) -} - -func systrayMenuItemSelected(id int32) { - menuItemsLock.RLock() - item := menuItems[id] - menuItemsLock.RUnlock() - select { - case item.ClickedCh <- struct{}{}: - // in case no one waiting for the channel - default: - } -} diff --git a/vendor/github.com/getlantern/systray/systray.h b/vendor/github.com/getlantern/systray/systray.h deleted file mode 100644 index 36bcf98..0000000 --- a/vendor/github.com/getlantern/systray/systray.h +++ /dev/null @@ -1,14 +0,0 @@ -extern void systray_ready(); -extern void systray_on_exit(); -extern void systray_menu_item_selected(int menu_id); -int nativeLoop(void); - -void setIcon(const char* iconBytes, int length); -void setMenuItemIcon(const char* iconBytes, int length, int menuId); -void setTitle(char* title); -void setTooltip(char* tooltip); -void add_or_update_menu_item(int menuId, char* title, char* tooltip, short disabled, short checked); -void add_separator(int menuId); -void hide_menu_item(int menuId); -void show_menu_item(int menuId); -void quit(); diff --git a/vendor/github.com/getlantern/systray/systray_darwin.m b/vendor/github.com/getlantern/systray/systray_darwin.m deleted file mode 100644 index 91cc0de..0000000 --- a/vendor/github.com/getlantern/systray/systray_darwin.m +++ /dev/null @@ -1,249 +0,0 @@ -#import <Cocoa/Cocoa.h> -#include "systray.h" - -#ifndef NSControlStateValueOff - #define NSControlStateValueOff NSOffState -#endif - -#ifndef NSControlStateValueOn - #define NSControlStateValueOn NSOnState -#endif - -@interface MenuItem : NSObject -{ - @public - NSNumber* menuId; - NSString* title; - NSString* tooltip; - short disabled; - short checked; -} --(id) initWithId: (int)theMenuId - withTitle: (const char*)theTitle - withTooltip: (const char*)theTooltip - withDisabled: (short)theDisabled - withChecked: (short)theChecked; - @end - @implementation MenuItem - -(id) initWithId: (int)theMenuId - withTitle: (const char*)theTitle - withTooltip: (const char*)theTooltip - withDisabled: (short)theDisabled - withChecked: (short)theChecked -{ - menuId = [NSNumber numberWithInt:theMenuId]; - title = [[NSString alloc] initWithCString:theTitle - encoding:NSUTF8StringEncoding]; - tooltip = [[NSString alloc] initWithCString:theTooltip - encoding:NSUTF8StringEncoding]; - disabled = theDisabled; - checked = theChecked; - return self; -} -@end - -@interface AppDelegate: NSObject <NSApplicationDelegate> - - (void) add_or_update_menu_item:(MenuItem*) item; - - (IBAction)menuHandler:(id)sender; - @property (assign) IBOutlet NSWindow *window; - @end - - @implementation AppDelegate -{ - NSStatusItem *statusItem; - NSMenu *menu; - NSCondition* cond; -} - -@synthesize window = _window; - -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification -{ - self->statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength]; - self->menu = [[NSMenu alloc] init]; - [self->menu setAutoenablesItems: FALSE]; - [self->statusItem setMenu:self->menu]; - systray_ready(); -} - -- (void)applicationWillTerminate:(NSNotification *)aNotification -{ - systray_on_exit(); -} - -- (void)setIcon:(NSImage *)image { - statusItem.button.image = image; - [self updateTitleButtonStyle]; -} - -- (void)setTitle:(NSString *)title { - statusItem.button.title = title; - [self updateTitleButtonStyle]; -} - --(void)updateTitleButtonStyle { - if (statusItem.button.image != nil) { - if ([statusItem.button.title length] == 0) { - statusItem.button.imagePosition = NSImageOnly; - } else { - statusItem.button.imagePosition = NSImageLeft; - } - } else { - statusItem.button.imagePosition = NSNoImage; - } -} - - -- (void)setTooltip:(NSString *)tooltip { - statusItem.button.toolTip = tooltip; -} - -- (IBAction)menuHandler:(id)sender -{ - NSNumber* menuId = [sender representedObject]; - systray_menu_item_selected(menuId.intValue); -} - -- (void) add_or_update_menu_item:(MenuItem*) item -{ - NSMenuItem* menuItem; - int existedMenuIndex = [menu indexOfItemWithRepresentedObject: item->menuId]; - if (existedMenuIndex == -1) { - menuItem = [menu addItemWithTitle:item->title action:@selector(menuHandler:) keyEquivalent:@""]; - [menuItem setTarget:self]; - [menuItem setRepresentedObject: item->menuId]; - - } - else { - menuItem = [menu itemAtIndex: existedMenuIndex]; - [menuItem setTitle:item->title]; - } - [menuItem setToolTip:item->tooltip]; - if (item->disabled == 1) { - menuItem.enabled = FALSE; - } else { - menuItem.enabled = TRUE; - } - if (item->checked == 1) { - menuItem.state = NSControlStateValueOn; - } else { - menuItem.state = NSControlStateValueOff; - } -} - -- (void) add_separator:(NSNumber*) menuId -{ - [menu addItem: [NSMenuItem separatorItem]]; -} - -- (void) hide_menu_item:(NSNumber*) menuId -{ - NSMenuItem* menuItem; - int existedMenuIndex = [menu indexOfItemWithRepresentedObject: menuId]; - if (existedMenuIndex == -1) { - return; - } - menuItem = [menu itemAtIndex: existedMenuIndex]; - [menuItem setHidden:TRUE]; -} - -- (void)setMenuItemIcon:(NSArray*)imageAndMenuId { - NSImage* image = [imageAndMenuId objectAtIndex:0]; - NSNumber* menuId = [imageAndMenuId objectAtIndex:1]; - - NSMenuItem* menuItem; - int existedMenuIndex = [menu indexOfItemWithRepresentedObject: menuId]; - if (existedMenuIndex == -1) { - return; - } - menuItem = [menu itemAtIndex: existedMenuIndex]; - menuItem.image = image; -} - -- (void) show_menu_item:(NSNumber*) menuId -{ - NSMenuItem* menuItem; - int existedMenuIndex = [menu indexOfItemWithRepresentedObject: menuId]; - if (existedMenuIndex == -1) { - return; - } - menuItem = [menu itemAtIndex: existedMenuIndex]; - [menuItem setHidden:FALSE]; -} - -- (void) quit -{ - [NSApp terminate:self]; -} - -@end - -int nativeLoop(void) { - AppDelegate *delegate = [[AppDelegate alloc] init]; - [[NSApplication sharedApplication] setDelegate:delegate]; - [NSApp run]; - return EXIT_SUCCESS; -} - -void runInMainThread(SEL method, id object) { - [(AppDelegate*)[NSApp delegate] - performSelectorOnMainThread:method - withObject:object - waitUntilDone: YES]; -} - -void setIcon(const char* iconBytes, int length) { - NSData* buffer = [NSData dataWithBytes: iconBytes length:length]; - NSImage *image = [[NSImage alloc] initWithData:buffer]; - [image setSize:NSMakeSize(18, 18)]; - runInMainThread(@selector(setIcon:), (id)image); -} - -void setMenuItemIcon(const char* iconBytes, int length, int menuId) { - NSData* buffer = [NSData dataWithBytes: iconBytes length:length]; - NSImage *image = [[NSImage alloc] initWithData:buffer]; - [image setSize:NSMakeSize(18, 18)]; - - NSNumber *mId = [NSNumber numberWithInt:menuId]; - runInMainThread(@selector(setMenuItemIcon:), @[image, (id)mId]); -} - -void setTitle(char* ctitle) { - NSString* title = [[NSString alloc] initWithCString:ctitle - encoding:NSUTF8StringEncoding]; - free(ctitle); - runInMainThread(@selector(setTitle:), (id)title); -} - -void setTooltip(char* ctooltip) { - NSString* tooltip = [[NSString alloc] initWithCString:ctooltip - encoding:NSUTF8StringEncoding]; - free(ctooltip); - runInMainThread(@selector(setTooltip:), (id)tooltip); -} - -void add_or_update_menu_item(int menuId, char* title, char* tooltip, short disabled, short checked) { - MenuItem* item = [[MenuItem alloc] initWithId: menuId withTitle: title withTooltip: tooltip withDisabled: disabled withChecked: checked]; - free(title); - free(tooltip); - runInMainThread(@selector(add_or_update_menu_item:), (id)item); -} - -void add_separator(int menuId) { - NSNumber *mId = [NSNumber numberWithInt:menuId]; - runInMainThread(@selector(add_separator:), (id)mId); -} - -void hide_menu_item(int menuId) { - NSNumber *mId = [NSNumber numberWithInt:menuId]; - runInMainThread(@selector(hide_menu_item:), (id)mId); -} - -void show_menu_item(int menuId) { - NSNumber *mId = [NSNumber numberWithInt:menuId]; - runInMainThread(@selector(show_menu_item:), (id)mId); -} - -void quit() { - runInMainThread(@selector(quit), nil); -} diff --git a/vendor/github.com/getlantern/systray/systray_linux.c b/vendor/github.com/getlantern/systray/systray_linux.c deleted file mode 100644 index 72cd614..0000000 --- a/vendor/github.com/getlantern/systray/systray_linux.c +++ /dev/null @@ -1,217 +0,0 @@ -#include <stdlib.h> -#include <string.h> -#include <errno.h> -#include <limits.h> -#include <libappindicator/app-indicator.h> -#include "systray.h" - -static AppIndicator *global_app_indicator; -static GtkWidget *global_tray_menu = NULL; -static GList *global_menu_items = NULL; -static char temp_file_name[PATH_MAX] = ""; - -typedef struct { - GtkWidget *menu_item; - int menu_id; -} MenuItemNode; - -typedef struct { - int menu_id; - char* title; - char* tooltip; - short disabled; - short checked; -} MenuItemInfo; - -int nativeLoop(void) { - gtk_init(0, NULL); - global_app_indicator = app_indicator_new("systray", "", - APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - app_indicator_set_status(global_app_indicator, APP_INDICATOR_STATUS_ACTIVE); - global_tray_menu = gtk_menu_new(); - app_indicator_set_menu(global_app_indicator, GTK_MENU(global_tray_menu)); - systray_ready(); - gtk_main(); - systray_on_exit(); - return 0; -} - -void _unlink_temp_file() { - if (strlen(temp_file_name) != 0) { - int ret = unlink(temp_file_name); - if (ret == -1) { - printf("failed to remove temp icon file %s: %s\n", temp_file_name, strerror(errno)); - } - temp_file_name[0] = '\0'; - } -} - -// runs in main thread, should always return FALSE to prevent gtk to execute it again -gboolean do_set_icon(gpointer data) { - _unlink_temp_file(); - char *tmpdir = getenv("TMPDIR"); - if (NULL == tmpdir) { - tmpdir = "/tmp"; - } - strncpy(temp_file_name, tmpdir, PATH_MAX-1); - strncat(temp_file_name, "/systray_XXXXXX", PATH_MAX-1); - temp_file_name[PATH_MAX-1] = '\0'; - - GBytes* bytes = (GBytes*)data; - int fd = mkstemp(temp_file_name); - if (fd == -1) { - printf("failed to create temp icon file %s: %s\n", temp_file_name, strerror(errno)); - return FALSE; - } - gsize size = 0; - gconstpointer icon_data = g_bytes_get_data(bytes, &size); - ssize_t written = write(fd, icon_data, size); - close(fd); - if(written != size) { - printf("failed to write temp icon file %s: %s\n", temp_file_name, strerror(errno)); - return FALSE; - } - app_indicator_set_icon_full(global_app_indicator, temp_file_name, ""); - app_indicator_set_attention_icon_full(global_app_indicator, temp_file_name, ""); - g_bytes_unref(bytes); - return FALSE; -} - -void _systray_menu_item_selected(int *id) { - systray_menu_item_selected(*id); -} - -// runs in main thread, should always return FALSE to prevent gtk to execute it again -gboolean do_add_or_update_menu_item(gpointer data) { - MenuItemInfo *mii = (MenuItemInfo*)data; - GList* it; - for(it = global_menu_items; it != NULL; it = it->next) { - MenuItemNode* item = (MenuItemNode*)(it->data); - if(item->menu_id == mii->menu_id){ - gtk_menu_item_set_label(GTK_MENU_ITEM(item->menu_item), mii->title); - break; - } - } - - // menu id doesn't exist, add new item - if(it == NULL) { - GtkWidget *menu_item = gtk_menu_item_new_with_label(mii->title); - int *id = malloc(sizeof(int)); - *id = mii->menu_id; - g_signal_connect_swapped(G_OBJECT(menu_item), "activate", G_CALLBACK(_systray_menu_item_selected), id); - gtk_menu_shell_append(GTK_MENU_SHELL(global_tray_menu), menu_item); - - MenuItemNode* new_item = malloc(sizeof(MenuItemNode)); - new_item->menu_id = mii->menu_id; - new_item->menu_item = menu_item; - GList* new_node = malloc(sizeof(GList)); - new_node->data = new_item; - new_node->next = global_menu_items; - if(global_menu_items != NULL) { - global_menu_items->prev = new_node; - } - global_menu_items = new_node; - it = new_node; - } - GtkWidget * menu_item = GTK_WIDGET(((MenuItemNode*)(it->data))->menu_item); - gtk_widget_set_sensitive(menu_item, mii->disabled == 1 ? FALSE : TRUE); - gtk_widget_show(menu_item); - - free(mii->title); - free(mii->tooltip); - free(mii); - return FALSE; -} - -gboolean do_add_separator(gpointer data) { - GtkWidget *separator = gtk_separator_menu_item_new(); - gtk_menu_shell_append(GTK_MENU_SHELL(global_tray_menu), separator); - gtk_widget_show(separator); - return FALSE; -} - -// runs in main thread, should always return FALSE to prevent gtk to execute it again -gboolean do_hide_menu_item(gpointer data) { - MenuItemInfo *mii = (MenuItemInfo*)data; - GList* it; - for(it = global_menu_items; it != NULL; it = it->next) { - MenuItemNode* item = (MenuItemNode*)(it->data); - if(item->menu_id == mii->menu_id){ - gtk_widget_hide(GTK_WIDGET(item->menu_item)); - break; - } - } - return FALSE; -} - -// runs in main thread, should always return FALSE to prevent gtk to execute it again -gboolean do_show_menu_item(gpointer data) { - MenuItemInfo *mii = (MenuItemInfo*)data; - GList* it; - for(it = global_menu_items; it != NULL; it = it->next) { - MenuItemNode* item = (MenuItemNode*)(it->data); - if(item->menu_id == mii->menu_id){ - gtk_widget_show(GTK_WIDGET(item->menu_item)); - break; - } - } - return FALSE; -} - -// runs in main thread, should always return FALSE to prevent gtk to execute it again -gboolean do_quit(gpointer data) { - _unlink_temp_file(); - // app indicator doesn't provide a way to remove it, hide it as a workaround - app_indicator_set_status(global_app_indicator, APP_INDICATOR_STATUS_PASSIVE); - gtk_main_quit(); - return FALSE; -} - -void setIcon(const char* iconBytes, int length) { - GBytes* bytes = g_bytes_new_static(iconBytes, length); - g_idle_add(do_set_icon, bytes); -} - -void setTitle(char* ctitle) { - app_indicator_set_label(global_app_indicator, ctitle, ""); - free(ctitle); -} - -void setTooltip(char* ctooltip) { - free(ctooltip); -} - -void setMenuItemIcon(const char* iconBytes, int length, int menuId) { -} - -void add_or_update_menu_item(int menu_id, char* title, char* tooltip, short disabled, short checked) { - MenuItemInfo *mii = malloc(sizeof(MenuItemInfo)); - mii->menu_id = menu_id; - mii->title = title; - mii->tooltip = tooltip; - mii->disabled = disabled; - mii->checked = checked; - g_idle_add(do_add_or_update_menu_item, mii); -} - -void add_separator(int menu_id) { - MenuItemInfo *mii = malloc(sizeof(MenuItemInfo)); - mii->menu_id = menu_id; - g_idle_add(do_add_separator, mii); -} - -void hide_menu_item(int menu_id) { - MenuItemInfo *mii = malloc(sizeof(MenuItemInfo)); - mii->menu_id = menu_id; - g_idle_add(do_hide_menu_item, mii); -} - -void show_menu_item(int menu_id) { - MenuItemInfo *mii = malloc(sizeof(MenuItemInfo)); - mii->menu_id = menu_id; - g_idle_add(do_show_menu_item, mii); -} - -void quit() { - g_idle_add(do_quit, NULL); -} diff --git a/vendor/github.com/getlantern/systray/systray_nonwindows.go b/vendor/github.com/getlantern/systray/systray_nonwindows.go deleted file mode 100644 index 4868b55..0000000 --- a/vendor/github.com/getlantern/systray/systray_nonwindows.go +++ /dev/null @@ -1,99 +0,0 @@ -// +build !windows - -package systray - -/* -#cgo linux pkg-config: gtk+-3.0 appindicator3-0.1 -#cgo darwin CFLAGS: -DDARWIN -x objective-c -fobjc-arc -#cgo darwin LDFLAGS: -framework Cocoa - -#include "systray.h" -*/ -import "C" - -import ( - "unsafe" -) - -func nativeLoop() { - C.nativeLoop() -} - -func quit() { - C.quit() -} - -// SetIcon sets the systray icon. -// iconBytes should be the content of .ico for windows and .ico/.jpg/.png -// for other platforms. -func SetIcon(iconBytes []byte) { - cstr := (*C.char)(unsafe.Pointer(&iconBytes[0])) - C.setIcon(cstr, (C.int)(len(iconBytes))) -} - -// SetTitle sets the systray title, only available on Mac. -func SetTitle(title string) { - C.setTitle(C.CString(title)) -} - -// SetTooltip sets the systray tooltip to display on mouse hover of the tray icon, -// only available on Mac and Windows. -func SetTooltip(tooltip string) { - C.setTooltip(C.CString(tooltip)) -} - -func addOrUpdateMenuItem(item *MenuItem) { - var disabled C.short - if item.disabled { - disabled = 1 - } - var checked C.short - if item.checked { - checked = 1 - } - C.add_or_update_menu_item( - C.int(item.id), - C.CString(item.title), - C.CString(item.tooltip), - disabled, - checked, - ) -} - -// SetIcon sets the icon of a menu item. Only available on Mac. -// iconBytes should be the content of .ico/.jpg/.png -func (item *MenuItem) SetIcon(iconBytes []byte) { - cstr := (*C.char)(unsafe.Pointer(&iconBytes[0])) - C.setMenuItemIcon(cstr, (C.int)(len(iconBytes)), C.int(item.id)) -} - -func addSeparator(id int32) { - C.add_separator(C.int(id)) -} - -func hideMenuItem(item *MenuItem) { - C.hide_menu_item( - C.int(item.id), - ) -} - -func showMenuItem(item *MenuItem) { - C.show_menu_item( - C.int(item.id), - ) -} - -//export systray_ready -func systray_ready() { - systrayReady() -} - -//export systray_on_exit -func systray_on_exit() { - systrayExit() -} - -//export systray_menu_item_selected -func systray_menu_item_selected(cID C.int) { - systrayMenuItemSelected(int32(cID)) -} diff --git a/vendor/github.com/getlantern/systray/systray_windows.go b/vendor/github.com/getlantern/systray/systray_windows.go deleted file mode 100644 index ae9c838..0000000 --- a/vendor/github.com/getlantern/systray/systray_windows.go +++ /dev/null @@ -1,721 +0,0 @@ -// +build windows - -package systray - -import ( - "crypto/md5" - "encoding/hex" - "io/ioutil" - "os" - "path/filepath" - "sort" - "syscall" - "unsafe" - - "golang.org/x/sys/windows" -) - -// Helpful sources: https://github.com/golang/exp/blob/master/shiny/driver/internal/win32 - -var ( - k32 = windows.NewLazySystemDLL("Kernel32.dll") - s32 = windows.NewLazySystemDLL("Shell32.dll") - u32 = windows.NewLazySystemDLL("User32.dll") - pGetModuleHandle = k32.NewProc("GetModuleHandleW") - pShellNotifyIcon = s32.NewProc("Shell_NotifyIconW") - pCreatePopupMenu = u32.NewProc("CreatePopupMenu") - pCreateWindowEx = u32.NewProc("CreateWindowExW") - pDefWindowProc = u32.NewProc("DefWindowProcW") - pDeleteMenu = u32.NewProc("DeleteMenu") - pDestroyWindow = u32.NewProc("DestroyWindow") - pDispatchMessage = u32.NewProc("DispatchMessageW") - pGetCursorPos = u32.NewProc("GetCursorPos") - pGetMenuItemID = u32.NewProc("GetMenuItemID") - pGetMessage = u32.NewProc("GetMessageW") - pInsertMenuItem = u32.NewProc("InsertMenuItemW") - pLoadIcon = u32.NewProc("LoadIconW") - pLoadImage = u32.NewProc("LoadImageW") - pLoadCursor = u32.NewProc("LoadCursorW") - pPostMessage = u32.NewProc("PostMessageW") - pPostQuitMessage = u32.NewProc("PostQuitMessage") - pRegisterClass = u32.NewProc("RegisterClassExW") - pRegisterWindowMessage = u32.NewProc("RegisterWindowMessageW") - pSetForegroundWindow = u32.NewProc("SetForegroundWindow") - pSetMenuInfo = u32.NewProc("SetMenuInfo") - pSetMenuItemInfo = u32.NewProc("SetMenuItemInfoW") - pShowWindow = u32.NewProc("ShowWindow") - pTrackPopupMenu = u32.NewProc("TrackPopupMenu") - pTranslateMessage = u32.NewProc("TranslateMessage") - pUnregisterClass = u32.NewProc("UnregisterClassW") - pUpdateWindow = u32.NewProc("UpdateWindow") -) - -// Contains window class information. -// It is used with the RegisterClassEx and GetClassInfoEx functions. -// https://msdn.microsoft.com/en-us/library/ms633577.aspx -type wndClassEx struct { - Size, Style uint32 - WndProc uintptr - ClsExtra, WndExtra int32 - Instance, Icon, Cursor, Background windows.Handle - MenuName, ClassName *uint16 - IconSm windows.Handle -} - -// Registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function. -// https://msdn.microsoft.com/en-us/library/ms633587.aspx -func (w *wndClassEx) register() error { - w.Size = uint32(unsafe.Sizeof(*w)) - res, _, err := pRegisterClass.Call(uintptr(unsafe.Pointer(w))) - if res == 0 { - return err - } - return nil -} - -// Unregisters a window class, freeing the memory required for the class. -// https://msdn.microsoft.com/en-us/library/ms644899.aspx -func (w *wndClassEx) unregister() error { - res, _, err := pUnregisterClass.Call( - uintptr(unsafe.Pointer(w.ClassName)), - uintptr(w.Instance), - ) - if res == 0 { - return err - } - return nil -} - -// Contains information that the system needs to display notifications in the notification area. -// Used by Shell_NotifyIcon. -// https://msdn.microsoft.com/en-us/library/windows/desktop/bb773352(v=vs.85).aspx -// https://msdn.microsoft.com/en-us/library/windows/desktop/bb762159 -type notifyIconData struct { - Size uint32 - Wnd windows.Handle - ID, Flags, CallbackMessage uint32 - Icon windows.Handle - Tip [128]uint16 - State, StateMask uint32 - Info [256]uint16 - Timeout, Version uint32 - InfoTitle [64]uint16 - InfoFlags uint32 - GuidItem windows.GUID - BalloonIcon windows.Handle -} - -func (nid *notifyIconData) add() error { - const NIM_ADD = 0x00000000 - res, _, err := pShellNotifyIcon.Call( - uintptr(NIM_ADD), - uintptr(unsafe.Pointer(nid)), - ) - if res == 0 { - return err - } - return nil -} - -func (nid *notifyIconData) modify() error { - const NIM_MODIFY = 0x00000001 - res, _, err := pShellNotifyIcon.Call( - uintptr(NIM_MODIFY), - uintptr(unsafe.Pointer(nid)), - ) - if res == 0 { - return err - } - return nil -} - -func (nid *notifyIconData) delete() error { - const NIM_DELETE = 0x00000002 - res, _, err := pShellNotifyIcon.Call( - uintptr(NIM_DELETE), - uintptr(unsafe.Pointer(nid)), - ) - if res == 0 { - return err - } - return nil -} - -// Contains information about a menu item. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms647578(v=vs.85).aspx -type menuItemInfo struct { - Size, Mask, Type, State uint32 - ID uint32 - SubMenu, Checked, Unchecked windows.Handle - ItemData uintptr - TypeData *uint16 - Cch uint32 - Item windows.Handle -} - -// The POINT structure defines the x- and y- coordinates of a point. -// https://msdn.microsoft.com/en-us/library/windows/desktop/dd162805(v=vs.85).aspx -type point struct { - X, Y int32 -} - -// Contains information about loaded resources -type winTray struct { - instance, - icon, - cursor, - window, - menu windows.Handle - - loadedImages map[string]windows.Handle - nid *notifyIconData - wcex *wndClassEx - - wmSystrayMessage, - wmTaskbarCreated uint32 - - visibleItems []uint32 -} - -// Loads an image from file and shows it in tray. -// LoadImage: https://msdn.microsoft.com/en-us/library/windows/desktop/ms648045(v=vs.85).aspx -// Shell_NotifyIcon: https://msdn.microsoft.com/en-us/library/windows/desktop/bb762159(v=vs.85).aspx -func (t *winTray) setIcon(src string) error { - const IMAGE_ICON = 1 // Loads an icon - const LR_LOADFROMFILE = 0x00000010 // Loads the stand-alone image from the file - const NIF_ICON = 0x00000002 - - // Save and reuse handles of loaded images - h, ok := t.loadedImages[src] - if !ok { - srcPtr, err := windows.UTF16PtrFromString(src) - if err != nil { - return err - } - res, _, err := pLoadImage.Call( - 0, - uintptr(unsafe.Pointer(srcPtr)), - IMAGE_ICON, - 64, - 64, - LR_LOADFROMFILE, - ) - if res == 0 { - return err - } - h = windows.Handle(res) - t.loadedImages[src] = h - } - - t.nid.Icon = h - t.nid.Flags |= NIF_ICON - t.nid.Size = uint32(unsafe.Sizeof(*t.nid)) - - return t.nid.modify() -} - -// Sets tooltip on icon. -// Shell_NotifyIcon: https://msdn.microsoft.com/en-us/library/windows/desktop/bb762159(v=vs.85).aspx -func (t *winTray) setTooltip(src string) error { - const NIF_TIP = 0x00000004 - b, err := windows.UTF16FromString(src) - if err != nil { - return err - } - copy(t.nid.Tip[:], b[:]) - t.nid.Flags |= NIF_TIP - t.nid.Size = uint32(unsafe.Sizeof(*t.nid)) - - return t.nid.modify() -} - -var wt winTray - -// WindowProc callback function that processes messages sent to a window. -// https://msdn.microsoft.com/en-us/library/windows/desktop/ms633573(v=vs.85).aspx -func (t *winTray) wndProc(hWnd windows.Handle, message uint32, wParam, lParam uintptr) (lResult uintptr) { - const ( - WM_COMMAND = 0x0111 - WM_DESTROY = 0x0002 - WM_ENDSESSION = 0x16 - WM_RBUTTONUP = 0x0205 - WM_LBUTTONUP = 0x0202 - ) - switch message { - case WM_COMMAND: - menuId := int32(wParam) - if menuId != -1 { - systrayMenuItemSelected(menuId) - } - case WM_DESTROY: - // same as WM_ENDSESSION, but throws 0 exit code after all - defer pPostQuitMessage.Call(uintptr(int32(0))) - fallthrough - case WM_ENDSESSION: - if t.nid != nil { - t.nid.delete() - } - systrayExit() - case t.wmSystrayMessage: - switch lParam { - case WM_RBUTTONUP, WM_LBUTTONUP: - t.showMenu() - } - case t.wmTaskbarCreated: // on explorer.exe restarts - t.nid.add() - default: - // Calls the default window procedure to provide default processing for any window messages that an application does not process. - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms633572(v=vs.85).aspx - lResult, _, _ = pDefWindowProc.Call( - uintptr(hWnd), - uintptr(message), - uintptr(wParam), - uintptr(lParam), - ) - } - return -} - -func (t *winTray) initInstance() error { - const IDI_APPLICATION = 32512 - const IDC_ARROW = 32512 // Standard arrow - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms633548(v=vs.85).aspx - const SW_HIDE = 0 - const CW_USEDEFAULT = 0x80000000 - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms632600(v=vs.85).aspx - const ( - WS_CAPTION = 0x00C00000 - WS_MAXIMIZEBOX = 0x00010000 - WS_MINIMIZEBOX = 0x00020000 - WS_OVERLAPPED = 0x00000000 - WS_SYSMENU = 0x00080000 - WS_THICKFRAME = 0x00040000 - - WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX - ) - // https://msdn.microsoft.com/en-us/library/windows/desktop/ff729176 - const ( - CS_HREDRAW = 0x0002 - CS_VREDRAW = 0x0001 - ) - const NIF_MESSAGE = 0x00000001 - - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms644931(v=vs.85).aspx - const WM_USER = 0x0400 - - const ( - className = "SystrayClass" - windowName = "" - ) - - t.wmSystrayMessage = WM_USER + 1 - - taskbarEventNamePtr, _ := windows.UTF16PtrFromString("TaskbarCreated") - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms644947 - res, _, err := pRegisterWindowMessage.Call( - uintptr(unsafe.Pointer(taskbarEventNamePtr)), - ) - t.wmTaskbarCreated = uint32(res) - - t.loadedImages = make(map[string]windows.Handle) - - instanceHandle, _, err := pGetModuleHandle.Call(0) - if instanceHandle == 0 { - return err - } - t.instance = windows.Handle(instanceHandle) - - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms648072(v=vs.85).aspx - iconHandle, _, err := pLoadIcon.Call(0, uintptr(IDI_APPLICATION)) - if iconHandle == 0 { - return err - } - t.icon = windows.Handle(iconHandle) - - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms648391(v=vs.85).aspx - cursorHandle, _, err := pLoadCursor.Call(0, uintptr(IDC_ARROW)) - if cursorHandle == 0 { - return err - } - t.cursor = windows.Handle(cursorHandle) - - classNamePtr, err := windows.UTF16PtrFromString(className) - if err != nil { - return err - } - - windowNamePtr, err := windows.UTF16PtrFromString(windowName) - if err != nil { - return err - } - - t.wcex = &wndClassEx{ - Style: CS_HREDRAW | CS_VREDRAW, - WndProc: windows.NewCallback(t.wndProc), - Instance: t.instance, - Icon: t.icon, - Cursor: t.cursor, - Background: windows.Handle(6), // (COLOR_WINDOW + 1) - ClassName: classNamePtr, - IconSm: t.icon, - } - if err := t.wcex.register(); err != nil { - return err - } - - windowHandle, _, err := pCreateWindowEx.Call( - uintptr(0), - uintptr(unsafe.Pointer(classNamePtr)), - uintptr(unsafe.Pointer(windowNamePtr)), - uintptr(WS_OVERLAPPEDWINDOW), - uintptr(CW_USEDEFAULT), - uintptr(CW_USEDEFAULT), - uintptr(CW_USEDEFAULT), - uintptr(CW_USEDEFAULT), - uintptr(0), - uintptr(0), - uintptr(t.instance), - uintptr(0), - ) - if windowHandle == 0 { - return err - } - t.window = windows.Handle(windowHandle) - - pShowWindow.Call( - uintptr(t.window), - uintptr(SW_HIDE), - ) - - pUpdateWindow.Call( - uintptr(t.window), - ) - - t.nid = ¬ifyIconData{ - Wnd: windows.Handle(t.window), - ID: 100, - Flags: NIF_MESSAGE, - CallbackMessage: t.wmSystrayMessage, - } - t.nid.Size = uint32(unsafe.Sizeof(*t.nid)) - - return t.nid.add() -} - -func (t *winTray) createMenu() error { - const MIM_APPLYTOSUBMENUS = 0x80000000 // Settings apply to the menu and all of its submenus - - menuHandle, _, err := pCreatePopupMenu.Call() - if menuHandle == 0 { - return err - } - t.menu = windows.Handle(menuHandle) - - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms647575(v=vs.85).aspx - mi := struct { - Size, Mask, Style, Max uint32 - Background windows.Handle - ContextHelpID uint32 - MenuData uintptr - }{ - Mask: MIM_APPLYTOSUBMENUS, - } - mi.Size = uint32(unsafe.Sizeof(mi)) - - res, _, err := pSetMenuInfo.Call( - uintptr(t.menu), - uintptr(unsafe.Pointer(&mi)), - ) - if res == 0 { - return err - } - return nil -} - -func (t *winTray) addOrUpdateMenuItem(menuId int32, title string, disabled, checked bool) error { - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms647578(v=vs.85).aspx - const ( - MIIM_FTYPE = 0x00000100 - MIIM_STRING = 0x00000040 - MIIM_ID = 0x00000002 - MIIM_STATE = 0x00000001 - ) - const MFT_STRING = 0x00000000 - const ( - MFS_CHECKED = 0x00000008 - MFS_DISABLED = 0x00000003 - ) - titlePtr, err := windows.UTF16PtrFromString(title) - if err != nil { - return err - } - - mi := menuItemInfo{ - Mask: MIIM_FTYPE | MIIM_STRING | MIIM_ID | MIIM_STATE, - Type: MFT_STRING, - ID: uint32(menuId), - TypeData: titlePtr, - Cch: uint32(len(title)), - } - if disabled { - mi.State |= MFS_DISABLED - } - if checked { - mi.State |= MFS_CHECKED - } - mi.Size = uint32(unsafe.Sizeof(mi)) - - // We set the menu item info based on the menuID - res, _, err := pSetMenuItemInfo.Call( - uintptr(t.menu), - uintptr(menuId), - 0, - uintptr(unsafe.Pointer(&mi)), - ) - - if res == 0 { - t.addToVisibleItems(menuId) - position := t.getVisibleItemIndex(menuId) - res, _, err = pInsertMenuItem.Call( - uintptr(t.menu), - uintptr(position), - 1, - uintptr(unsafe.Pointer(&mi)), - ) - if res == 0 { - t.delFromVisibleItems(menuId) - return err - } - } - - return nil -} - -func (t *winTray) addSeparatorMenuItem(menuId int32) error { - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms647578(v=vs.85).aspx - const ( - MIIM_FTYPE = 0x00000100 - MIIM_ID = 0x00000002 - MIIM_STATE = 0x00000001 - ) - const MFT_SEPARATOR = 0x00000800 - - mi := menuItemInfo{ - Mask: MIIM_FTYPE | MIIM_ID | MIIM_STATE, - Type: MFT_SEPARATOR, - ID: uint32(menuId), - } - - mi.Size = uint32(unsafe.Sizeof(mi)) - - t.addToVisibleItems(menuId) - position := t.getVisibleItemIndex(menuId) - - res, _, err := pInsertMenuItem.Call( - uintptr(t.menu), - uintptr(position), - 1, - uintptr(unsafe.Pointer(&mi)), - ) - if res == 0 { - return err - } - - return nil -} - -func (t *winTray) hideMenuItem(menuId int32) error { - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms647629(v=vs.85).aspx - const MF_BYCOMMAND = 0x00000000 - const ERROR_SUCCESS syscall.Errno = 0 - - res, _, err := pDeleteMenu.Call( - uintptr(t.menu), - uintptr(uint32(menuId)), - MF_BYCOMMAND, - ) - if res == 0 && err.(syscall.Errno) != ERROR_SUCCESS { - return err - } - t.delFromVisibleItems(menuId) - - return nil -} - -func (t *winTray) showMenu() error { - const ( - TPM_BOTTOMALIGN = 0x0020 - TPM_LEFTALIGN = 0x0000 - ) - p := point{} - res, _, err := pGetCursorPos.Call(uintptr(unsafe.Pointer(&p))) - if res == 0 { - return err - } - pSetForegroundWindow.Call(uintptr(t.window)) - - res, _, err = pTrackPopupMenu.Call( - uintptr(t.menu), - TPM_BOTTOMALIGN|TPM_LEFTALIGN, - uintptr(p.X), - uintptr(p.Y), - 0, - uintptr(t.window), - 0, - ) - if res == 0 { - return err - } - - return nil -} - -func (t *winTray) delFromVisibleItems(val int32) { - for i, itemval := range t.visibleItems { - if uint32(val) == itemval { - t.visibleItems = append(t.visibleItems[:i], t.visibleItems[i+1:]...) - break - } - } -} - -func (t *winTray) addToVisibleItems(val int32) { - newvisible := append(t.visibleItems, uint32(val)) - sort.Slice(newvisible, func(i, j int) bool { return newvisible[i] < newvisible[j] }) - t.visibleItems = newvisible -} - -func (t *winTray) getVisibleItemIndex(val int32) int { - for i, itemval := range t.visibleItems { - if uint32(val) == itemval { - return i - } - } - return -1 -} - -func nativeLoop() { - if err := wt.initInstance(); err != nil { - log.Errorf("Unable to init instance: %v", err) - return - } - - if err := wt.createMenu(); err != nil { - log.Errorf("Unable to create menu: %v", err) - return - } - - defer func() { - pDestroyWindow.Call(uintptr(wt.window)) - wt.wcex.unregister() - }() - - go systrayReady() - - // Main message pump. - m := &struct { - WindowHandle windows.Handle - Message uint32 - Wparam uintptr - Lparam uintptr - Time uint32 - Pt point - }{} - for { - ret, _, err := pGetMessage.Call(uintptr(unsafe.Pointer(m)), 0, 0, 0) - - // If the function retrieves a message other than WM_QUIT, the return value is nonzero. - // If the function retrieves the WM_QUIT message, the return value is zero. - // If there is an error, the return value is -1 - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms644936(v=vs.85).aspx - switch int32(ret) { - case -1: - log.Errorf("Error at message loop: %v", err) - return - case 0: - return - default: - pTranslateMessage.Call(uintptr(unsafe.Pointer(m))) - pDispatchMessage.Call(uintptr(unsafe.Pointer(m))) - } - } -} - -func quit() { - const WM_CLOSE = 0x0010 - - pPostMessage.Call( - uintptr(wt.window), - WM_CLOSE, - 0, - 0, - ) -} - -// SetIcon sets the systray icon. -// iconBytes should be the content of .ico for windows and .ico/.jpg/.png -// for other platforms. -func SetIcon(iconBytes []byte) { - bh := md5.Sum(iconBytes) - dataHash := hex.EncodeToString(bh[:]) - iconFilePath := filepath.Join(os.TempDir(), "systray_temp_icon_"+dataHash) - - if _, err := os.Stat(iconFilePath); os.IsNotExist(err) { - if err := ioutil.WriteFile(iconFilePath, iconBytes, 0644); err != nil { - log.Errorf("Unable to write icon data to temp file: %v", err) - return - } - } - - if err := wt.setIcon(iconFilePath); err != nil { - log.Errorf("Unable to set icon: %v", err) - return - } -} - -// SetTitle sets the systray title, only available on Mac. -func SetTitle(title string) { - // do nothing -} - -// SetIcon sets the icon of a menu item. Only available on Mac. -func (item *MenuItem) SetIcon(iconBytes []byte) { - // do nothing -} - -// SetTooltip sets the systray tooltip to display on mouse hover of the tray icon, -// only available on Mac and Windows. -func SetTooltip(tooltip string) { - if err := wt.setTooltip(tooltip); err != nil { - log.Errorf("Unable to set tooltip: %v", err) - return - } -} - -func addOrUpdateMenuItem(item *MenuItem) { - err := wt.addOrUpdateMenuItem(item.id, item.title, item.disabled, item.checked) - if err != nil { - log.Errorf("Unable to addOrUpdateMenuItem: %v", err) - return - } -} - -func addSeparator(id int32) { - err := wt.addSeparatorMenuItem(id) - if err != nil { - log.Errorf("Unable to addSeparator: %v", err) - return - } -} - -func hideMenuItem(item *MenuItem) { - err := wt.hideMenuItem(item.id) - if err != nil { - log.Errorf("Unable to hideMenuItem: %v", err) - return - } -} - -func showMenuItem(item *MenuItem) { - addOrUpdateMenuItem(item) -} diff --git a/vendor/github.com/getlantern/systray/systray_windows_test.go b/vendor/github.com/getlantern/systray/systray_windows_test.go deleted file mode 100644 index 7cb6c75..0000000 --- a/vendor/github.com/getlantern/systray/systray_windows_test.go +++ /dev/null @@ -1,132 +0,0 @@ -// +build windows - -package systray - -import ( - "io/ioutil" - "runtime" - "sync/atomic" - "testing" - "time" - "unsafe" - - "golang.org/x/sys/windows" -) - -const iconFilePath = "example/icon/iconwin.ico" - -func TestBaseWindowsTray(t *testing.T) { - systrayReady = func() {} - systrayExit = func() {} - - runtime.LockOSThread() - - if err := wt.initInstance(); err != nil { - t.Fatalf("initInstance failed: %s", err) - } - - if err := wt.createMenu(); err != nil { - t.Fatalf("createMenu failed: %s", err) - } - - defer func() { - pDestroyWindow.Call(uintptr(wt.window)) - wt.wcex.unregister() - }() - - if err := wt.setIcon(iconFilePath); err != nil { - t.Errorf("SetIcon failed: %s", err) - } - - if err := wt.setTooltip("Cyrillic tooltip тест:)"); err != nil { - t.Errorf("SetIcon failed: %s", err) - } - - var id int32 = 0 - err := wt.addOrUpdateMenuItem(atomic.AddInt32(&id, 1), "Simple enabled", false, false) - if err != nil { - t.Errorf("mergeMenuItem failed: %s", err) - } - err = wt.addOrUpdateMenuItem(atomic.AddInt32(&id, 1), "Simple disabled", true, false) - if err != nil { - t.Errorf("mergeMenuItem failed: %s", err) - } - err = wt.addSeparatorMenuItem(atomic.AddInt32(&id, 1)) - if err != nil { - t.Errorf("addSeparatorMenuItem failed: %s", err) - } - err = wt.addOrUpdateMenuItem(atomic.AddInt32(&id, 1), "Simple checked enabled", false, true) - if err != nil { - t.Errorf("mergeMenuItem failed: %s", err) - } - err = wt.addOrUpdateMenuItem(atomic.AddInt32(&id, 1), "Simple checked disabled", true, true) - if err != nil { - t.Errorf("mergeMenuItem failed: %s", err) - } - - err = wt.hideMenuItem(1) - if err != nil { - t.Errorf("hideMenuItem failed: %s", err) - } - - err = wt.hideMenuItem(100) - if err == nil { - t.Error("hideMenuItem failed: must return error on invalid item id") - } - - err = wt.addOrUpdateMenuItem(2, "Simple disabled update", true, false) - if err != nil { - t.Errorf("mergeMenuItem failed: %s", err) - } - - time.AfterFunc(1*time.Second, quit) - - m := struct { - WindowHandle windows.Handle - Message uint32 - Wparam uintptr - Lparam uintptr - Time uint32 - Pt point - }{} - for { - ret, _, err := pGetMessage.Call(uintptr(unsafe.Pointer(&m)), 0, 0, 0) - res := int32(ret) - if res == -1 { - t.Errorf("win32 GetMessage failed: %v", err) - return - } else if res == 0 { - break - } - pTranslateMessage.Call(uintptr(unsafe.Pointer(&m))) - pDispatchMessage.Call(uintptr(unsafe.Pointer(&m))) - } -} - -func TestWindowsRun(t *testing.T) { - onReady := func() { - b, err := ioutil.ReadFile(iconFilePath) - if err != nil { - t.Fatalf("Can't load icon file: %v", err) - } - SetIcon(b) - SetTitle("Test title с кириллицей") - - bSomeBtn := AddMenuItem("Йа кнопко", "") - bSomeBtn.Check() - AddSeparator() - bQuit := AddMenuItem("Quit", "Quit the whole app") - go func() { - <-bQuit.ClickedCh - t.Log("Quit reqested") - Quit() - }() - time.AfterFunc(1*time.Second, Quit) - } - - onExit := func() { - t.Log("Exit success") - } - - Run(onReady, onExit) -} diff --git a/vendor/github.com/go-stack/stack/LICENSE.md b/vendor/github.com/go-stack/stack/LICENSE.md deleted file mode 100644 index 2abf98e..0000000 --- a/vendor/github.com/go-stack/stack/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Chris Hines - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/go-stack/stack/README.md b/vendor/github.com/go-stack/stack/README.md deleted file mode 100644 index f11cccc..0000000 --- a/vendor/github.com/go-stack/stack/README.md +++ /dev/null @@ -1,38 +0,0 @@ -[![GoDoc](https://godoc.org/github.com/go-stack/stack?status.svg)](https://godoc.org/github.com/go-stack/stack) -[![Go Report Card](https://goreportcard.com/badge/go-stack/stack)](https://goreportcard.com/report/go-stack/stack) -[![TravisCI](https://travis-ci.org/go-stack/stack.svg?branch=master)](https://travis-ci.org/go-stack/stack) -[![Coverage Status](https://coveralls.io/repos/github/go-stack/stack/badge.svg?branch=master)](https://coveralls.io/github/go-stack/stack?branch=master) - -# stack - -Package stack implements utilities to capture, manipulate, and format call -stacks. It provides a simpler API than package runtime. - -The implementation takes care of the minutia and special cases of interpreting -the program counter (pc) values returned by runtime.Callers. - -## Versioning - -Package stack publishes releases via [semver](http://semver.org/) compatible Git -tags prefixed with a single 'v'. The master branch always contains the latest -release. The develop branch contains unreleased commits. - -## Formatting - -Package stack's types implement fmt.Formatter, which provides a simple and -flexible way to declaratively configure formatting when used with logging or -error tracking packages. - -```go -func DoTheThing() { - c := stack.Caller(0) - log.Print(c) // "source.go:10" - log.Printf("%+v", c) // "pkg/path/source.go:10" - log.Printf("%n", c) // "DoTheThing" - - s := stack.Trace().TrimRuntime() - log.Print(s) // "[source.go:15 caller.go:42 main.go:14]" -} -``` - -See the docs for all of the supported formatting options. diff --git a/vendor/github.com/go-stack/stack/format_test.go b/vendor/github.com/go-stack/stack/format_test.go deleted file mode 100644 index 013ad67..0000000 --- a/vendor/github.com/go-stack/stack/format_test.go +++ /dev/null @@ -1,21 +0,0 @@ -// +build go1.2 - -package stack_test - -import ( - "fmt" - - "github.com/go-stack/stack" -) - -func Example_callFormat() { - logCaller("%+s") - logCaller("%v %[1]n()") - // Output: - // github.com/go-stack/stack/format_test.go - // format_test.go:13 Example_callFormat() -} - -func logCaller(format string) { - fmt.Printf(format+"\n", stack.Caller(1)) -} diff --git a/vendor/github.com/go-stack/stack/go.mod b/vendor/github.com/go-stack/stack/go.mod deleted file mode 100644 index 96a53a1..0000000 --- a/vendor/github.com/go-stack/stack/go.mod +++ /dev/null @@ -1 +0,0 @@ -module github.com/go-stack/stack diff --git a/vendor/github.com/go-stack/stack/stack-go19_test.go b/vendor/github.com/go-stack/stack/stack-go19_test.go deleted file mode 100644 index d7aeea2..0000000 --- a/vendor/github.com/go-stack/stack/stack-go19_test.go +++ /dev/null @@ -1,67 +0,0 @@ -// +build go1.9 - -package stack_test - -import ( - "runtime" - "testing" - - "github.com/go-stack/stack" -) - -func TestCallerInlinedPanic(t *testing.T) { - t.Parallel() - - var line int - - defer func() { - if recover() != nil { - var pcs [32]uintptr - n := runtime.Callers(1, pcs[:]) - frames := runtime.CallersFrames(pcs[:n]) - // count frames to runtime.sigpanic - panicIdx := 0 - for { - f, more := frames.Next() - if f.Function == "runtime.sigpanic" { - break - } - panicIdx++ - if !more { - t.Fatal("no runtime.sigpanic entry on the stack") - } - } - - c := stack.Caller(panicIdx) - if got, want := c.Frame().Function, "runtime.sigpanic"; got != want { - t.Errorf("sigpanic frame: got name == %v, want name == %v", got, want) - } - - c1 := stack.Caller(panicIdx + 1) - if got, want := c1.Frame().Function, "github.com/go-stack/stack_test.inlinablePanic"; got != want { - t.Errorf("TestCallerInlinedPanic frame: got name == %v, want name == %v", got, want) - } - if got, want := c1.Frame().Line, line; got != want { - t.Errorf("TestCallerInlinedPanic frame: got line == %v, want line == %v", got, want) - } - } - }() - - doPanic(t, &line) - t.Fatal("failed to panic") -} - -func doPanic(t *testing.T, panicLine *int) { - _, _, line, ok := runtime.Caller(0) - *panicLine = line + 11 // adjust to match line of panic below - if !ok { - t.Fatal("runtime.Caller(0) failed") - } - inlinablePanic() -} - -func inlinablePanic() { - // Initiate a sigpanic. - var x *uintptr - _ = *x -} diff --git a/vendor/github.com/go-stack/stack/stack.go b/vendor/github.com/go-stack/stack/stack.go deleted file mode 100644 index ac3b93b..0000000 --- a/vendor/github.com/go-stack/stack/stack.go +++ /dev/null @@ -1,400 +0,0 @@ -// +build go1.7 - -// Package stack implements utilities to capture, manipulate, and format call -// stacks. It provides a simpler API than package runtime. -// -// The implementation takes care of the minutia and special cases of -// interpreting the program counter (pc) values returned by runtime.Callers. -// -// Package stack's types implement fmt.Formatter, which provides a simple and -// flexible way to declaratively configure formatting when used with logging -// or error tracking packages. -package stack - -import ( - "bytes" - "errors" - "fmt" - "io" - "runtime" - "strconv" - "strings" -) - -// Call records a single function invocation from a goroutine stack. -type Call struct { - frame runtime.Frame -} - -// Caller returns a Call from the stack of the current goroutine. The argument -// skip is the number of stack frames to ascend, with 0 identifying the -// calling function. -func Caller(skip int) Call { - // As of Go 1.9 we need room for up to three PC entries. - // - // 0. An entry for the stack frame prior to the target to check for - // special handling needed if that prior entry is runtime.sigpanic. - // 1. A possible second entry to hold metadata about skipped inlined - // functions. If inline functions were not skipped the target frame - // PC will be here. - // 2. A third entry for the target frame PC when the second entry - // is used for skipped inline functions. - var pcs [3]uintptr - n := runtime.Callers(skip+1, pcs[:]) - frames := runtime.CallersFrames(pcs[:n]) - frame, _ := frames.Next() - frame, _ = frames.Next() - - return Call{ - frame: frame, - } -} - -// String implements fmt.Stinger. It is equivalent to fmt.Sprintf("%v", c). -func (c Call) String() string { - return fmt.Sprint(c) -} - -// MarshalText implements encoding.TextMarshaler. It formats the Call the same -// as fmt.Sprintf("%v", c). -func (c Call) MarshalText() ([]byte, error) { - if c.frame == (runtime.Frame{}) { - return nil, ErrNoFunc - } - - buf := bytes.Buffer{} - fmt.Fprint(&buf, c) - return buf.Bytes(), nil -} - -// ErrNoFunc means that the Call has a nil *runtime.Func. The most likely -// cause is a Call with the zero value. -var ErrNoFunc = errors.New("no call stack information") - -// Format implements fmt.Formatter with support for the following verbs. -// -// %s source file -// %d line number -// %n function name -// %k last segment of the package path -// %v equivalent to %s:%d -// -// It accepts the '+' and '#' flags for most of the verbs as follows. -// -// %+s path of source file relative to the compile time GOPATH, -// or the module path joined to the path of source file relative -// to module root -// %#s full path of source file -// %+n import path qualified function name -// %+k full package path -// %+v equivalent to %+s:%d -// %#v equivalent to %#s:%d -func (c Call) Format(s fmt.State, verb rune) { - if c.frame == (runtime.Frame{}) { - fmt.Fprintf(s, "%%!%c(NOFUNC)", verb) - return - } - - switch verb { - case 's', 'v': - file := c.frame.File - switch { - case s.Flag('#'): - // done - case s.Flag('+'): - file = pkgFilePath(&c.frame) - default: - const sep = "/" - if i := strings.LastIndex(file, sep); i != -1 { - file = file[i+len(sep):] - } - } - io.WriteString(s, file) - if verb == 'v' { - buf := [7]byte{':'} - s.Write(strconv.AppendInt(buf[:1], int64(c.frame.Line), 10)) - } - - case 'd': - buf := [6]byte{} - s.Write(strconv.AppendInt(buf[:0], int64(c.frame.Line), 10)) - - case 'k': - name := c.frame.Function - const pathSep = "/" - start, end := 0, len(name) - if i := strings.LastIndex(name, pathSep); i != -1 { - start = i + len(pathSep) - } - const pkgSep = "." - if i := strings.Index(name[start:], pkgSep); i != -1 { - end = start + i - } - if s.Flag('+') { - start = 0 - } - io.WriteString(s, name[start:end]) - - case 'n': - name := c.frame.Function - if !s.Flag('+') { - const pathSep = "/" - if i := strings.LastIndex(name, pathSep); i != -1 { - name = name[i+len(pathSep):] - } - const pkgSep = "." - if i := strings.Index(name, pkgSep); i != -1 { - name = name[i+len(pkgSep):] - } - } - io.WriteString(s, name) - } -} - -// Frame returns the call frame infomation for the Call. -func (c Call) Frame() runtime.Frame { - return c.frame -} - -// PC returns the program counter for this call frame; multiple frames may -// have the same PC value. -// -// Deprecated: Use Call.Frame instead. -func (c Call) PC() uintptr { - return c.frame.PC -} - -// CallStack records a sequence of function invocations from a goroutine -// stack. -type CallStack []Call - -// String implements fmt.Stinger. It is equivalent to fmt.Sprintf("%v", cs). -func (cs CallStack) String() string { - return fmt.Sprint(cs) -} - -var ( - openBracketBytes = []byte("[") - closeBracketBytes = []byte("]") - spaceBytes = []byte(" ") -) - -// MarshalText implements encoding.TextMarshaler. It formats the CallStack the -// same as fmt.Sprintf("%v", cs). -func (cs CallStack) MarshalText() ([]byte, error) { - buf := bytes.Buffer{} - buf.Write(openBracketBytes) - for i, pc := range cs { - if i > 0 { - buf.Write(spaceBytes) - } - fmt.Fprint(&buf, pc) - } - buf.Write(closeBracketBytes) - return buf.Bytes(), nil -} - -// Format implements fmt.Formatter by printing the CallStack as square brackets -// ([, ]) surrounding a space separated list of Calls each formatted with the -// supplied verb and options. -func (cs CallStack) Format(s fmt.State, verb rune) { - s.Write(openBracketBytes) - for i, pc := range cs { - if i > 0 { - s.Write(spaceBytes) - } - pc.Format(s, verb) - } - s.Write(closeBracketBytes) -} - -// Trace returns a CallStack for the current goroutine with element 0 -// identifying the calling function. -func Trace() CallStack { - var pcs [512]uintptr - n := runtime.Callers(1, pcs[:]) - - frames := runtime.CallersFrames(pcs[:n]) - cs := make(CallStack, 0, n) - - // Skip extra frame retrieved just to make sure the runtime.sigpanic - // special case is handled. - frame, more := frames.Next() - - for more { - frame, more = frames.Next() - cs = append(cs, Call{frame: frame}) - } - - return cs -} - -// TrimBelow returns a slice of the CallStack with all entries below c -// removed. -func (cs CallStack) TrimBelow(c Call) CallStack { - for len(cs) > 0 && cs[0] != c { - cs = cs[1:] - } - return cs -} - -// TrimAbove returns a slice of the CallStack with all entries above c -// removed. -func (cs CallStack) TrimAbove(c Call) CallStack { - for len(cs) > 0 && cs[len(cs)-1] != c { - cs = cs[:len(cs)-1] - } - return cs -} - -// pkgIndex returns the index that results in file[index:] being the path of -// file relative to the compile time GOPATH, and file[:index] being the -// $GOPATH/src/ portion of file. funcName must be the name of a function in -// file as returned by runtime.Func.Name. -func pkgIndex(file, funcName string) int { - // As of Go 1.6.2 there is no direct way to know the compile time GOPATH - // at runtime, but we can infer the number of path segments in the GOPATH. - // We note that runtime.Func.Name() returns the function name qualified by - // the import path, which does not include the GOPATH. Thus we can trim - // segments from the beginning of the file path until the number of path - // separators remaining is one more than the number of path separators in - // the function name. For example, given: - // - // GOPATH /home/user - // file /home/user/src/pkg/sub/file.go - // fn.Name() pkg/sub.Type.Method - // - // We want to produce: - // - // file[:idx] == /home/user/src/ - // file[idx:] == pkg/sub/file.go - // - // From this we can easily see that fn.Name() has one less path separator - // than our desired result for file[idx:]. We count separators from the - // end of the file path until it finds two more than in the function name - // and then move one character forward to preserve the initial path - // segment without a leading separator. - const sep = "/" - i := len(file) - for n := strings.Count(funcName, sep) + 2; n > 0; n-- { - i = strings.LastIndex(file[:i], sep) - if i == -1 { - i = -len(sep) - break - } - } - // get back to 0 or trim the leading separator - return i + len(sep) -} - -// pkgFilePath returns the frame's filepath relative to the compile-time GOPATH, -// or its module path joined to its path relative to the module root. -// -// As of Go 1.11 there is no direct way to know the compile time GOPATH or -// module paths at runtime, but we can piece together the desired information -// from available information. We note that runtime.Frame.Function contains the -// function name qualified by the package path, which includes the module path -// but not the GOPATH. We can extract the package path from that and append the -// last segments of the file path to arrive at the desired package qualified -// file path. For example, given: -// -// GOPATH /home/user -// import path pkg/sub -// frame.File /home/user/src/pkg/sub/file.go -// frame.Function pkg/sub.Type.Method -// Desired return pkg/sub/file.go -// -// It appears that we simply need to trim ".Type.Method" from frame.Function and -// append "/" + path.Base(file). -// -// But there are other wrinkles. Although it is idiomatic to do so, the internal -// name of a package is not required to match the last segment of its import -// path. In addition, the introduction of modules in Go 1.11 allows working -// without a GOPATH. So we also must make these work right: -// -// GOPATH /home/user -// import path pkg/go-sub -// package name sub -// frame.File /home/user/src/pkg/go-sub/file.go -// frame.Function pkg/sub.Type.Method -// Desired return pkg/go-sub/file.go -// -// Module path pkg/v2 -// import path pkg/v2/go-sub -// package name sub -// frame.File /home/user/cloned-pkg/go-sub/file.go -// frame.Function pkg/v2/sub.Type.Method -// Desired return pkg/v2/go-sub/file.go -// -// We can handle all of these situations by using the package path extracted -// from frame.Function up to, but not including, the last segment as the prefix -// and the last two segments of frame.File as the suffix of the returned path. -// This preserves the existing behavior when working in a GOPATH without modules -// and a semantically equivalent behavior when used in module aware project. -func pkgFilePath(frame *runtime.Frame) string { - pre := pkgPrefix(frame.Function) - post := pathSuffix(frame.File) - if pre == "" { - return post - } - return pre + "/" + post -} - -// pkgPrefix returns the import path of the function's package with the final -// segment removed. -func pkgPrefix(funcName string) string { - const pathSep = "/" - end := strings.LastIndex(funcName, pathSep) - if end == -1 { - return "" - } - return funcName[:end] -} - -// pathSuffix returns the last two segments of path. -func pathSuffix(path string) string { - const pathSep = "/" - lastSep := strings.LastIndex(path, pathSep) - if lastSep == -1 { - return path - } - return path[strings.LastIndex(path[:lastSep], pathSep)+1:] -} - -var runtimePath string - -func init() { - var pcs [3]uintptr - runtime.Callers(0, pcs[:]) - frames := runtime.CallersFrames(pcs[:]) - frame, _ := frames.Next() - file := frame.File - - idx := pkgIndex(frame.File, frame.Function) - - runtimePath = file[:idx] - if runtime.GOOS == "windows" { - runtimePath = strings.ToLower(runtimePath) - } -} - -func inGoroot(c Call) bool { - file := c.frame.File - if len(file) == 0 || file[0] == '?' { - return true - } - if runtime.GOOS == "windows" { - file = strings.ToLower(file) - } - return strings.HasPrefix(file, runtimePath) || strings.HasSuffix(file, "/_testmain.go") -} - -// TrimRuntime returns a slice of the CallStack with the topmost entries from -// the go runtime removed. It considers any calls originating from unknown -// files, files under GOROOT, or _testmain.go as part of the runtime. -func (cs CallStack) TrimRuntime() CallStack { - for len(cs) > 0 && inGoroot(cs[len(cs)-1]) { - cs = cs[:len(cs)-1] - } - return cs -} diff --git a/vendor/github.com/go-stack/stack/stack_test.go b/vendor/github.com/go-stack/stack/stack_test.go deleted file mode 100644 index 44f3a7d..0000000 --- a/vendor/github.com/go-stack/stack/stack_test.go +++ /dev/null @@ -1,582 +0,0 @@ -package stack_test - -import ( - "fmt" - "io/ioutil" - "path" - "path/filepath" - "reflect" - "runtime" - "strings" - "testing" - - "github.com/go-stack/stack" -) - -func TestCaller(t *testing.T) { - t.Parallel() - - c := stack.Caller(0) - _, file, line, ok := runtime.Caller(0) - line-- - if !ok { - t.Fatal("runtime.Caller(0) failed") - } - - if got, want := c.Frame().File, file; got != want { - t.Errorf("got file == %v, want file == %v", got, want) - } - - if got, want := c.Frame().Line, line; got != want { - t.Errorf("got line == %v, want line == %v", got, want) - } -} - -func f3(f1 func() stack.Call) stack.Call { - return f2(f1) -} - -func f2(f1 func() stack.Call) stack.Call { - return f1() -} - -func TestCallerMidstackInlined(t *testing.T) { - t.Parallel() - - _, _, line, ok := runtime.Caller(0) - line -= 10 // adjust to return f1() line inside f2() - if !ok { - t.Fatal("runtime.Caller(0) failed") - } - - c := f3(func() stack.Call { - return stack.Caller(2) - }) - - if got, want := c.Frame().Line, line; got != want { - t.Errorf("got line == %v, want line == %v", got, want) - } - if got, want := c.Frame().Function, "github.com/go-stack/stack_test.f3"; got != want { - t.Errorf("got func name == %v, want func name == %v", got, want) - } -} - -func TestCallerPanic(t *testing.T) { - t.Parallel() - - var ( - line int - ok bool - ) - - defer func() { - if recover() != nil { - var pcs [32]uintptr - n := runtime.Callers(1, pcs[:]) - frames := runtime.CallersFrames(pcs[:n]) - // count frames to runtime.sigpanic - panicIdx := 0 - for { - f, more := frames.Next() - if f.Function == "runtime.sigpanic" { - break - } - panicIdx++ - if !more { - t.Fatal("no runtime.sigpanic entry on the stack") - } - } - c := stack.Caller(panicIdx) - if got, want := c.Frame().Function, "runtime.sigpanic"; got != want { - t.Errorf("sigpanic frame: got name == %v, want name == %v", got, want) - } - c1 := stack.Caller(panicIdx + 1) - if got, want := c1.Frame().Function, "github.com/go-stack/stack_test.TestCallerPanic"; got != want { - t.Errorf("TestCallerPanic frame: got name == %v, want name == %v", got, want) - } - if got, want := c1.Frame().Line, line; got != want { - t.Errorf("TestCallerPanic frame: got line == %v, want line == %v", got, want) - } - } - }() - - _, _, line, ok = runtime.Caller(0) - line += 7 // adjust to match line of panic below - if !ok { - t.Fatal("runtime.Caller(0) failed") - } - // Initiate a sigpanic. - var x *uintptr - _ = *x -} - -type tholder struct { - trace func() stack.CallStack -} - -func (th *tholder) traceLabyrinth() stack.CallStack { - for { - return th.trace() - } -} - -func TestTrace(t *testing.T) { - t.Parallel() - - _, _, line, ok := runtime.Caller(0) - if !ok { - t.Fatal("runtime.Caller(0) failed") - } - - fh := tholder{ - trace: func() stack.CallStack { - cs := stack.Trace() - return cs - }, - } - - cs := fh.traceLabyrinth() - - lines := []int{line + 7, line - 7, line + 12} - - for i, line := range lines { - if got, want := cs[i].Frame().Line, line; got != want { - t.Errorf("got line[%d] == %v, want line[%d] == %v", i, got, i, want) - } - } -} - -// Test stack handling originating from a sigpanic. -func TestTracePanic(t *testing.T) { - t.Parallel() - - var ( - line int - ok bool - ) - - defer func() { - if recover() != nil { - trace := stack.Trace() - - // find runtime.sigpanic - panicIdx := -1 - for i, c := range trace { - if c.Frame().Function == "runtime.sigpanic" { - panicIdx = i - break - } - } - if panicIdx == -1 { - t.Fatal("no runtime.sigpanic entry on the stack") - } - if got, want := trace[panicIdx].Frame().Function, "runtime.sigpanic"; got != want { - t.Errorf("sigpanic frame: got name == %v, want name == %v", got, want) - } - if got, want := trace[panicIdx+1].Frame().Function, "github.com/go-stack/stack_test.TestTracePanic"; got != want { - t.Errorf("TestTracePanic frame: got name == %v, want name == %v", got, want) - } - if got, want := trace[panicIdx+1].Frame().Line, line; got != want { - t.Errorf("TestTracePanic frame: got line == %v, want line == %v", got, want) - } - } - }() - - _, _, line, ok = runtime.Caller(0) - line += 7 // adjust to match line of panic below - if !ok { - t.Fatal("runtime.Caller(0) failed") - } - // Initiate a sigpanic. - var x *uintptr - _ = *x -} - -const importPath = "github.com/go-stack/stack" - -type testType struct{} - -func (tt testType) testMethod() (c stack.Call, file string, line int, ok bool) { - c = stack.Caller(0) - _, file, line, ok = runtime.Caller(0) - line-- - return -} - -func TestCallFormat(t *testing.T) { - t.Parallel() - - c := stack.Caller(0) - _, file, line, ok := runtime.Caller(0) - line-- - if !ok { - t.Fatal("runtime.Caller(0) failed") - } - relFile := path.Join(importPath, filepath.Base(file)) - - c2, file2, line2, ok2 := testType{}.testMethod() - if !ok2 { - t.Fatal("runtime.Caller(0) failed") - } - relFile2 := path.Join(importPath, filepath.Base(file2)) - - data := []struct { - c stack.Call - desc string - fmt string - out string - }{ - {stack.Call{}, "error", "%s", "%!s(NOFUNC)"}, - - {c, "func", "%s", path.Base(file)}, - {c, "func", "%+s", relFile}, - {c, "func", "%#s", file}, - {c, "func", "%d", fmt.Sprint(line)}, - {c, "func", "%n", "TestCallFormat"}, - {c, "func", "%+n", "github.com/go-stack/stack_test.TestCallFormat"}, - {c, "func", "%k", "stack_test"}, - {c, "func", "%+k", "github.com/go-stack/stack_test"}, - {c, "func", "%v", fmt.Sprint(path.Base(file), ":", line)}, - {c, "func", "%+v", fmt.Sprint(relFile, ":", line)}, - {c, "func", "%#v", fmt.Sprint(file, ":", line)}, - - {c2, "meth", "%s", path.Base(file2)}, - {c2, "meth", "%+s", relFile2}, - {c2, "meth", "%#s", file2}, - {c2, "meth", "%d", fmt.Sprint(line2)}, - {c2, "meth", "%n", "testType.testMethod"}, - {c2, "meth", "%+n", "github.com/go-stack/stack_test.testType.testMethod"}, - {c2, "meth", "%k", "stack_test"}, - {c2, "meth", "%+k", "github.com/go-stack/stack_test"}, - {c2, "meth", "%v", fmt.Sprint(path.Base(file2), ":", line2)}, - {c2, "meth", "%+v", fmt.Sprint(relFile2, ":", line2)}, - {c2, "meth", "%#v", fmt.Sprint(file2, ":", line2)}, - } - - for _, d := range data { - got := fmt.Sprintf(d.fmt, d.c) - if got != d.out { - t.Errorf("fmt.Sprintf(%q, Call(%s)) = %s, want %s", d.fmt, d.desc, got, d.out) - } - } -} - -func TestCallString(t *testing.T) { - t.Parallel() - - c := stack.Caller(0) - _, file, line, ok := runtime.Caller(0) - line-- - if !ok { - t.Fatal("runtime.Caller(0) failed") - } - - c2, file2, line2, ok2 := testType{}.testMethod() - if !ok2 { - t.Fatal("runtime.Caller(0) failed") - } - - data := []struct { - c stack.Call - desc string - out string - }{ - {stack.Call{}, "error", "%!v(NOFUNC)"}, - {c, "func", fmt.Sprint(path.Base(file), ":", line)}, - {c2, "meth", fmt.Sprint(path.Base(file2), ":", line2)}, - } - - for _, d := range data { - got := d.c.String() - if got != d.out { - t.Errorf("got %s, want %s", got, d.out) - } - } -} - -func TestCallMarshalText(t *testing.T) { - t.Parallel() - - c := stack.Caller(0) - _, file, line, ok := runtime.Caller(0) - line-- - if !ok { - t.Fatal("runtime.Caller(0) failed") - } - - c2, file2, line2, ok2 := testType{}.testMethod() - if !ok2 { - t.Fatal("runtime.Caller(0) failed") - } - - data := []struct { - c stack.Call - desc string - out []byte - err error - }{ - {stack.Call{}, "error", nil, stack.ErrNoFunc}, - {c, "func", []byte(fmt.Sprint(path.Base(file), ":", line)), nil}, - {c2, "meth", []byte(fmt.Sprint(path.Base(file2), ":", line2)), nil}, - } - - for _, d := range data { - text, err := d.c.MarshalText() - if got, want := err, d.err; got != want { - t.Errorf("%s: got err %v, want err %v", d.desc, got, want) - } - if got, want := text, d.out; !reflect.DeepEqual(got, want) { - t.Errorf("%s: got %s, want %s", d.desc, got, want) - } - } -} - -func TestCallStackString(t *testing.T) { - cs, line0 := getTrace(t) - _, file, line1, ok := runtime.Caller(0) - line1-- - if !ok { - t.Fatal("runtime.Caller(0) failed") - } - file = path.Base(file) - if got, want := cs.String(), fmt.Sprintf("[%s:%d %s:%d]", file, line0, file, line1); got != want { - t.Errorf("\n got %v\nwant %v", got, want) - } -} - -func TestCallStackMarshalText(t *testing.T) { - cs, line0 := getTrace(t) - _, file, line1, ok := runtime.Caller(0) - line1-- - if !ok { - t.Fatal("runtime.Caller(0) failed") - } - file = path.Base(file) - text, _ := cs.MarshalText() - if got, want := text, []byte(fmt.Sprintf("[%s:%d %s:%d]", file, line0, file, line1)); !reflect.DeepEqual(got, want) { - t.Errorf("\n got %v\nwant %v", got, want) - } -} - -func getTrace(t *testing.T) (stack.CallStack, int) { - cs := stack.Trace().TrimRuntime() - _, _, line, ok := runtime.Caller(0) - line-- - if !ok { - t.Fatal("runtime.Caller(0) failed") - } - return cs, line -} - -func TestTrimAbove(t *testing.T) { - trace := trimAbove() - if got, want := len(trace), 2; got != want { - t.Fatalf("got len(trace) == %v, want %v, trace: %n", got, want, trace) - } - if got, want := fmt.Sprintf("%n", trace[1]), "TestTrimAbove"; got != want { - t.Errorf("got %q, want %q", got, want) - } -} - -func trimAbove() stack.CallStack { - call := stack.Caller(1) - trace := stack.Trace() - return trace.TrimAbove(call) -} - -func TestTrimBelow(t *testing.T) { - trace := trimBelow() - if got, want := fmt.Sprintf("%n", trace[0]), "TestTrimBelow"; got != want { - t.Errorf("got %q, want %q", got, want) - } -} - -func trimBelow() stack.CallStack { - call := stack.Caller(1) - trace := stack.Trace() - return trace.TrimBelow(call) -} - -func TestTrimRuntime(t *testing.T) { - trace := stack.Trace().TrimRuntime() - if got, want := len(trace), 1; got != want { - t.Errorf("got len(trace) == %v, want %v, goroot: %q, trace: %#v", got, want, runtime.GOROOT(), trace) - } -} - -func BenchmarkCallVFmt(b *testing.B) { - c := stack.Caller(0) - b.ResetTimer() - for i := 0; i < b.N; i++ { - fmt.Fprint(ioutil.Discard, c) - } -} - -func BenchmarkCallPlusVFmt(b *testing.B) { - c := stack.Caller(0) - b.ResetTimer() - for i := 0; i < b.N; i++ { - fmt.Fprintf(ioutil.Discard, "%+v", c) - } -} - -func BenchmarkCallSharpVFmt(b *testing.B) { - c := stack.Caller(0) - b.ResetTimer() - for i := 0; i < b.N; i++ { - fmt.Fprintf(ioutil.Discard, "%#v", c) - } -} - -func BenchmarkCallSFmt(b *testing.B) { - c := stack.Caller(0) - b.ResetTimer() - for i := 0; i < b.N; i++ { - fmt.Fprintf(ioutil.Discard, "%s", c) - } -} - -func BenchmarkCallPlusSFmt(b *testing.B) { - c := stack.Caller(0) - b.ResetTimer() - for i := 0; i < b.N; i++ { - fmt.Fprintf(ioutil.Discard, "%+s", c) - } -} - -func BenchmarkCallSharpSFmt(b *testing.B) { - c := stack.Caller(0) - b.ResetTimer() - for i := 0; i < b.N; i++ { - fmt.Fprintf(ioutil.Discard, "%#s", c) - } -} - -func BenchmarkCallDFmt(b *testing.B) { - c := stack.Caller(0) - b.ResetTimer() - for i := 0; i < b.N; i++ { - fmt.Fprintf(ioutil.Discard, "%d", c) - } -} - -func BenchmarkCallNFmt(b *testing.B) { - c := stack.Caller(0) - b.ResetTimer() - for i := 0; i < b.N; i++ { - fmt.Fprintf(ioutil.Discard, "%n", c) - } -} - -func BenchmarkCallPlusNFmt(b *testing.B) { - c := stack.Caller(0) - b.ResetTimer() - for i := 0; i < b.N; i++ { - fmt.Fprintf(ioutil.Discard, "%+n", c) - } -} - -func BenchmarkCaller(b *testing.B) { - for i := 0; i < b.N; i++ { - stack.Caller(0) - } -} - -func BenchmarkTrace(b *testing.B) { - for i := 0; i < b.N; i++ { - stack.Trace() - } -} - -func deepStack(depth int, b *testing.B) stack.CallStack { - if depth > 0 { - return deepStack(depth-1, b) - } - b.StartTimer() - s := stack.Trace() - return s -} - -func BenchmarkTrace10(b *testing.B) { - for i := 0; i < b.N; i++ { - b.StopTimer() - deepStack(10, b) - } -} - -func BenchmarkTrace50(b *testing.B) { - b.StopTimer() - for i := 0; i < b.N; i++ { - deepStack(50, b) - } -} - -func BenchmarkTrace100(b *testing.B) { - b.StopTimer() - for i := 0; i < b.N; i++ { - deepStack(100, b) - } -} - -//////////////// -// Benchmark functions followed by formatting -//////////////// - -func BenchmarkCallerAndVFmt(b *testing.B) { - for i := 0; i < b.N; i++ { - fmt.Fprint(ioutil.Discard, stack.Caller(0)) - } -} - -func BenchmarkTraceAndVFmt(b *testing.B) { - for i := 0; i < b.N; i++ { - fmt.Fprint(ioutil.Discard, stack.Trace()) - } -} - -func BenchmarkTrace10AndVFmt(b *testing.B) { - for i := 0; i < b.N; i++ { - b.StopTimer() - fmt.Fprint(ioutil.Discard, deepStack(10, b)) - } -} - -//////////////// -// Baseline against package runtime. -//////////////// - -func BenchmarkRuntimeCaller(b *testing.B) { - for i := 0; i < b.N; i++ { - runtime.Caller(0) - } -} - -func BenchmarkRuntimeCallerAndFmt(b *testing.B) { - for i := 0; i < b.N; i++ { - _, file, line, _ := runtime.Caller(0) - const sep = "/" - if i := strings.LastIndex(file, sep); i != -1 { - file = file[i+len(sep):] - } - fmt.Fprint(ioutil.Discard, file, ":", line) - } -} - -func BenchmarkFuncForPC(b *testing.B) { - pc, _, _, _ := runtime.Caller(0) - pc-- - b.ResetTimer() - for i := 0; i < b.N; i++ { - runtime.FuncForPC(pc) - } -} - -func BenchmarkFuncFileLine(b *testing.B) { - pc, _, _, _ := runtime.Caller(0) - pc-- - fn := runtime.FuncForPC(pc) - b.ResetTimer() - for i := 0; i < b.N; i++ { - fn.FileLine(pc) - } -} diff --git a/vendor/github.com/gotk3/gotk3/LICENSE b/vendor/github.com/gotk3/gotk3/LICENSE deleted file mode 100644 index c58347d..0000000 --- a/vendor/github.com/gotk3/gotk3/LICENSE +++ /dev/null @@ -1,14 +0,0 @@ -Copyright (c) 2013-2014 Conformal Systems LLC.
-Copyright (c) 2015-2018 gotk3 contributors
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
diff --git a/vendor/github.com/gotk3/gotk3/cairo/antialias.go b/vendor/github.com/gotk3/gotk3/cairo/antialias.go deleted file mode 100644 index e740df0..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/antialias.go +++ /dev/null @@ -1,27 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" -import ( - "unsafe" -) - -// Antialias is a representation of Cairo's cairo_antialias_t. -type Antialias int - -const ( - ANTIALIAS_DEFAULT Antialias = C.CAIRO_ANTIALIAS_DEFAULT - ANTIALIAS_NONE Antialias = C.CAIRO_ANTIALIAS_NONE - ANTIALIAS_GRAY Antialias = C.CAIRO_ANTIALIAS_GRAY - ANTIALIAS_SUBPIXEL Antialias = C.CAIRO_ANTIALIAS_SUBPIXEL - // ANTIALIAS_FAST Antialias = C.CAIRO_ANTIALIAS_FAST (since 1.12) - // ANTIALIAS_GOOD Antialias = C.CAIRO_ANTIALIAS_GOOD (since 1.12) - // ANTIALIAS_BEST Antialias = C.CAIRO_ANTIALIAS_BEST (since 1.12) -) - -func marshalAntialias(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return Antialias(c), nil -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/cairo.go b/vendor/github.com/gotk3/gotk3/cairo/cairo.go deleted file mode 100644 index ba014bd..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/cairo.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// Package cairo implements Go bindings for Cairo. Supports version 1.10 and -// later. -package cairo - -// #cgo pkg-config: cairo cairo-gobject gobject-2.0 -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - // Enums - {glib.Type(C.cairo_gobject_antialias_get_type()), marshalAntialias}, - {glib.Type(C.cairo_gobject_content_get_type()), marshalContent}, - {glib.Type(C.cairo_gobject_fill_rule_get_type()), marshalFillRule}, - {glib.Type(C.cairo_gobject_line_cap_get_type()), marshalLineCap}, - {glib.Type(C.cairo_gobject_line_join_get_type()), marshalLineJoin}, - {glib.Type(C.cairo_gobject_operator_get_type()), marshalOperator}, - {glib.Type(C.cairo_gobject_status_get_type()), marshalStatus}, - {glib.Type(C.cairo_gobject_surface_type_get_type()), marshalSurfaceType}, - - // Boxed - {glib.Type(C.cairo_gobject_context_get_type()), marshalContext}, - {glib.Type(C.cairo_gobject_surface_get_type()), marshalSurface}, - } - glib.RegisterGValueMarshalers(tm) -} - -// Constants - -// Content is a representation of Cairo's cairo_content_t. -type Content int - -const ( - CONTENT_COLOR Content = C.CAIRO_CONTENT_COLOR - CONTENT_ALPHA Content = C.CAIRO_CONTENT_ALPHA - CONTENT_COLOR_ALPHA Content = C.CAIRO_CONTENT_COLOR_ALPHA -) - -func marshalContent(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return Content(c), nil -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/canvas.go b/vendor/github.com/gotk3/gotk3/cairo/canvas.go deleted file mode 100644 index 254e405..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/canvas.go +++ /dev/null @@ -1,418 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" - -import ( - "reflect" - "runtime" - "unsafe" -) - -// Context is a representation of Cairo's cairo_t. -type Context struct { - context *C.cairo_t -} - -// native returns a pointer to the underlying cairo_t. -func (v *Context) native() *C.cairo_t { - if v == nil { - return nil - } - return v.context -} - -func (v *Context) GetCContext() *C.cairo_t { - return v.native() -} - -// Native returns a pointer to the underlying cairo_t. -func (v *Context) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalContext(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - context := (*C.cairo_t)(unsafe.Pointer(c)) - return wrapContext(context), nil -} - -func wrapContext(context *C.cairo_t) *Context { - return &Context{context} -} - -func WrapContext(p uintptr) *Context { - context := (*C.cairo_t)(unsafe.Pointer(p)) - return wrapContext(context) -} - -// Closes the context. The context must not be used afterwards. -func (v *Context) Close() { - v.destroy() -} - -// Create is a wrapper around cairo_create(). -func Create(target *Surface) *Context { - c := C.cairo_create(target.native()) - ctx := wrapContext(c) - runtime.SetFinalizer(ctx, (*Context).destroy) - return ctx -} - -// reference is a wrapper around cairo_reference(). -func (v *Context) reference() { - v.context = C.cairo_reference(v.native()) -} - -// destroy is a wrapper around cairo_destroy(). -func (v *Context) destroy() { - if v.context != nil { - C.cairo_destroy(v.native()) - v.context = nil - } -} - -// Status is a wrapper around cairo_status(). -func (v *Context) Status() Status { - c := C.cairo_status(v.native()) - return Status(c) -} - -// Save is a wrapper around cairo_save(). -func (v *Context) Save() { - C.cairo_save(v.native()) -} - -// Restore is a wrapper around cairo_restore(). -func (v *Context) Restore() { - C.cairo_restore(v.native()) -} - -// GetTarget is a wrapper around cairo_get_target(). -func (v *Context) GetTarget() *Surface { - c := C.cairo_get_target(v.native()) - s := wrapSurface(c) - s.reference() - runtime.SetFinalizer(s, (*Surface).destroy) - return s -} - -// PushGroup is a wrapper around cairo_push_group(). -func (v *Context) PushGroup() { - C.cairo_push_group(v.native()) -} - -// PushGroupWithContent is a wrapper around cairo_push_group_with_content(). -func (v *Context) PushGroupWithContent(content Content) { - C.cairo_push_group_with_content(v.native(), C.cairo_content_t(content)) -} - -// TODO(jrick) PopGroup (depends on Pattern) - -// PopGroupToSource is a wrapper around cairo_pop_group_to_source(). -func (v *Context) PopGroupToSource() { - C.cairo_pop_group_to_source(v.native()) -} - -// GetGroupTarget is a wrapper around cairo_get_group_target(). -func (v *Context) GetGroupTarget() *Surface { - c := C.cairo_get_group_target(v.native()) - s := wrapSurface(c) - s.reference() - runtime.SetFinalizer(s, (*Surface).destroy) - return s -} - -// SetSource is a wrapper around cairo_set_source(). -func (v *Context) SetSource(p *Pattern) { - C.cairo_set_source(v.native(), p.native()) -} - -// SetSourceRGB is a wrapper around cairo_set_source_rgb(). -func (v *Context) SetSourceRGB(red, green, blue float64) { - C.cairo_set_source_rgb(v.native(), C.double(red), C.double(green), - C.double(blue)) -} - -// SetSourceRGBA is a wrapper around cairo_set_source_rgba(). -func (v *Context) SetSourceRGBA(red, green, blue, alpha float64) { - C.cairo_set_source_rgba(v.native(), C.double(red), C.double(green), - C.double(blue), C.double(alpha)) -} - -// TODO(jrick) SetSource (depends on Pattern) - -// SetSourceSurface is a wrapper around cairo_set_source_surface(). -func (v *Context) SetSourceSurface(surface *Surface, x, y float64) { - C.cairo_set_source_surface(v.native(), surface.native(), C.double(x), - C.double(y)) -} - -// TODO(jrick) GetSource (depends on Pattern) - -// SetAntialias is a wrapper around cairo_set_antialias(). -func (v *Context) SetAntialias(antialias Antialias) { - C.cairo_set_antialias(v.native(), C.cairo_antialias_t(antialias)) -} - -// GetAntialias is a wrapper around cairo_get_antialias(). -func (v *Context) GetAntialias() Antialias { - c := C.cairo_get_antialias(v.native()) - return Antialias(c) -} - -// SetDash is a wrapper around cairo_set_dash(). -func (v *Context) SetDash(dashes []float64, offset float64) { - header := (*reflect.SliceHeader)(unsafe.Pointer(&dashes)) - cdashes := (*C.double)(unsafe.Pointer(header.Data)) - C.cairo_set_dash(v.native(), cdashes, C.int(header.Len), - C.double(offset)) -} - -// GetDashCount is a wrapper around cairo_get_dash_count(). -func (v *Context) GetDashCount() int { - c := C.cairo_get_dash_count(v.native()) - return int(c) -} - -// GetDash is a wrapper around cairo_get_dash(). -func (v *Context) GetDash() (dashes []float64, offset float64) { - dashCount := v.GetDashCount() - cdashes := (*C.double)(C.calloc(8, C.size_t(dashCount))) - var coffset C.double - C.cairo_get_dash(v.native(), cdashes, &coffset) - header := (*reflect.SliceHeader)((unsafe.Pointer(&dashes))) - header.Data = uintptr(unsafe.Pointer(cdashes)) - header.Len = dashCount - header.Cap = dashCount - return dashes, float64(coffset) -} - -// SetFillRule is a wrapper around cairo_set_fill_rule(). -func (v *Context) SetFillRule(fillRule FillRule) { - C.cairo_set_fill_rule(v.native(), C.cairo_fill_rule_t(fillRule)) -} - -// GetFillRule is a wrapper around cairo_get_fill_rule(). -func (v *Context) GetFillRule() FillRule { - c := C.cairo_get_fill_rule(v.native()) - return FillRule(c) -} - -// SetLineCap is a wrapper around cairo_set_line_cap(). -func (v *Context) SetLineCap(lineCap LineCap) { - C.cairo_set_line_cap(v.native(), C.cairo_line_cap_t(lineCap)) -} - -// GetLineCap is a wrapper around cairo_get_line_cap(). -func (v *Context) GetLineCap() LineCap { - c := C.cairo_get_line_cap(v.native()) - return LineCap(c) -} - -// SetLineJoin is a wrapper around cairo_set_line_join(). -func (v *Context) SetLineJoin(lineJoin LineJoin) { - C.cairo_set_line_join(v.native(), C.cairo_line_join_t(lineJoin)) -} - -// GetLineJoin is a wrapper around cairo_get_line_join(). -func (v *Context) GetLineJoin() LineJoin { - c := C.cairo_get_line_join(v.native()) - return LineJoin(c) -} - -// SetLineWidth is a wrapper around cairo_set_line_width(). -func (v *Context) SetLineWidth(width float64) { - C.cairo_set_line_width(v.native(), C.double(width)) -} - -// GetLineWidth is a wrapper cairo_get_line_width(). -func (v *Context) GetLineWidth() float64 { - c := C.cairo_get_line_width(v.native()) - return float64(c) -} - -// SetMiterLimit is a wrapper around cairo_set_miter_limit(). -func (v *Context) SetMiterLimit(limit float64) { - C.cairo_set_miter_limit(v.native(), C.double(limit)) -} - -// GetMiterLimit is a wrapper around cairo_get_miter_limit(). -func (v *Context) GetMiterLimit() float64 { - c := C.cairo_get_miter_limit(v.native()) - return float64(c) -} - -// SetOperator is a wrapper around cairo_set_operator(). -func (v *Context) SetOperator(op Operator) { - C.cairo_set_operator(v.native(), C.cairo_operator_t(op)) -} - -// GetOperator is a wrapper around cairo_get_operator(). -func (v *Context) GetOperator() Operator { - c := C.cairo_get_operator(v.native()) - return Operator(c) -} - -// SetTolerance is a wrapper around cairo_set_tolerance(). -func (v *Context) SetTolerance(tolerance float64) { - C.cairo_set_tolerance(v.native(), C.double(tolerance)) -} - -// GetTolerance is a wrapper around cairo_get_tolerance(). -func (v *Context) GetTolerance() float64 { - c := C.cairo_get_tolerance(v.native()) - return float64(c) -} - -// Clip is a wrapper around cairo_clip(). -func (v *Context) Clip() { - C.cairo_clip(v.native()) -} - -// ClipPreserve is a wrapper around cairo_clip_preserve(). -func (v *Context) ClipPreserve() { - C.cairo_clip_preserve(v.native()) -} - -// ClipExtents is a wrapper around cairo_clip_extents(). -func (v *Context) ClipExtents() (x1, y1, x2, y2 float64) { - var cx1, cy1, cx2, cy2 C.double - C.cairo_clip_extents(v.native(), &cx1, &cy1, &cx2, &cy2) - return float64(cx1), float64(cy1), float64(cx2), float64(cy2) -} - -// InClip is a wrapper around cairo_in_clip(). -func (v *Context) InClip(x, y float64) bool { - c := C.cairo_in_clip(v.native(), C.double(x), C.double(y)) - return gobool(c) -} - -// ResetClip is a wrapper around cairo_reset_clip(). -func (v *Context) ResetClip() { - C.cairo_reset_clip(v.native()) -} - -// Rectangle is a wrapper around cairo_rectangle(). -func (v *Context) Rectangle(x, y, w, h float64) { - C.cairo_rectangle(v.native(), C.double(x), C.double(y), C.double(w), C.double(h)) -} - -// Arc is a wrapper around cairo_arc(). -func (v *Context) Arc(xc, yc, radius, angle1, angle2 float64) { - C.cairo_arc(v.native(), C.double(xc), C.double(yc), C.double(radius), C.double(angle1), C.double(angle2)) -} - -// ArcNegative is a wrapper around cairo_arc_negative(). -func (v *Context) ArcNegative(xc, yc, radius, angle1, angle2 float64) { - C.cairo_arc_negative(v.native(), C.double(xc), C.double(yc), C.double(radius), C.double(angle1), C.double(angle2)) -} - -// LineTo is a wrapper around cairo_line_to(). -func (v *Context) LineTo(x, y float64) { - C.cairo_line_to(v.native(), C.double(x), C.double(y)) -} - -// CurveTo is a wrapper around cairo_curve_to(). -func (v *Context) CurveTo(x1, y1, x2, y2, x3, y3 float64) { - C.cairo_curve_to(v.native(), C.double(x1), C.double(y1), C.double(x2), C.double(y2), C.double(x3), C.double(y3)) -} - -// MoveTo is a wrapper around cairo_move_to(). -func (v *Context) MoveTo(x, y float64) { - C.cairo_move_to(v.native(), C.double(x), C.double(y)) -} - -// TODO(jrick) CopyRectangleList (depends on RectangleList) - -// Fill is a wrapper around cairo_fill(). -func (v *Context) Fill() { - C.cairo_fill(v.native()) -} - -// ClosePath is a wrapper around cairo_close_path(). -func (v *Context) ClosePath() { - C.cairo_close_path(v.native()) -} - -// NewPath is a wrapper around cairo_new_path(). -func (v *Context) NewPath() { - C.cairo_new_path(v.native()) -} - -// GetCurrentPoint is a wrapper around cairo_get_current_point(). -func (v *Context) GetCurrentPoint() (x, y float64) { - C.cairo_get_current_point(v.native(), (*C.double)(&x), (*C.double)(&y)) - return -} - -// FillPreserve is a wrapper around cairo_fill_preserve(). -func (v *Context) FillPreserve() { - C.cairo_fill_preserve(v.native()) -} - -// FillExtents is a wrapper around cairo_fill_extents(). -func (v *Context) FillExtents() (x1, y1, x2, y2 float64) { - var cx1, cy1, cx2, cy2 C.double - C.cairo_fill_extents(v.native(), &cx1, &cy1, &cx2, &cy2) - return float64(cx1), float64(cy1), float64(cx2), float64(cy2) -} - -// InFill is a wrapper around cairo_in_fill(). -func (v *Context) InFill(x, y float64) bool { - c := C.cairo_in_fill(v.native(), C.double(x), C.double(y)) - return gobool(c) -} - -// TODO(jrick) Mask (depends on Pattern) - -// MaskSurface is a wrapper around cairo_mask_surface(). -func (v *Context) MaskSurface(surface *Surface, surfaceX, surfaceY float64) { - C.cairo_mask_surface(v.native(), surface.native(), C.double(surfaceX), - C.double(surfaceY)) -} - -// Paint is a wrapper around cairo_paint(). -func (v *Context) Paint() { - C.cairo_paint(v.native()) -} - -// PaintWithAlpha is a wrapper around cairo_paint_with_alpha(). -func (v *Context) PaintWithAlpha(alpha float64) { - C.cairo_paint_with_alpha(v.native(), C.double(alpha)) -} - -// Stroke is a wrapper around cairo_stroke(). -func (v *Context) Stroke() { - C.cairo_stroke(v.native()) -} - -// StrokePreserve is a wrapper around cairo_stroke_preserve(). -func (v *Context) StrokePreserve() { - C.cairo_stroke_preserve(v.native()) -} - -// StrokeExtents is a wrapper around cairo_stroke_extents(). -func (v *Context) StrokeExtents() (x1, y1, x2, y2 float64) { - var cx1, cy1, cx2, cy2 C.double - C.cairo_stroke_extents(v.native(), &cx1, &cy1, &cx2, &cy2) - return float64(cx1), float64(cy1), float64(cx2), float64(cy2) -} - -// InStroke is a wrapper around cairo_in_stroke(). -func (v *Context) InStroke(x, y float64) bool { - c := C.cairo_in_stroke(v.native(), C.double(x), C.double(y)) - return gobool(c) -} - -// CopyPage is a wrapper around cairo_copy_page(). -func (v *Context) CopyPage() { - C.cairo_copy_page(v.native()) -} - -// ShowPage is a wrapper around cairo_show_page(). -func (v *Context) ShowPage() { - C.cairo_show_page(v.native()) -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/errors.go b/vendor/github.com/gotk3/gotk3/cairo/errors.go deleted file mode 100644 index 1e48a8a..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/errors.go +++ /dev/null @@ -1,7 +0,0 @@ -package cairo - -type ErrorStatus Status - -func (e ErrorStatus) Error() string { - return StatusToString(Status(e)) -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/fillrule.go b/vendor/github.com/gotk3/gotk3/cairo/fillrule.go deleted file mode 100644 index c0e3ba4..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/fillrule.go +++ /dev/null @@ -1,22 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" -import ( - "unsafe" -) - -// FillRule is a representation of Cairo's cairo_fill_rule_t. -type FillRule int - -const ( - FILL_RULE_WINDING FillRule = C.CAIRO_FILL_RULE_WINDING - FILL_RULE_EVEN_ODD FillRule = C.CAIRO_FILL_RULE_EVEN_ODD -) - -func marshalFillRule(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return FillRule(c), nil -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/format.go b/vendor/github.com/gotk3/gotk3/cairo/format.go deleted file mode 100644 index 595f715..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/format.go +++ /dev/null @@ -1,27 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" -import ( - "unsafe" -) - -// Format is a representation of Cairo's cairo_format_t. -type Format int - -const ( - FORMAT_INVALID Format = C.CAIRO_FORMAT_INVALID - FORMAT_ARGB32 Format = C.CAIRO_FORMAT_ARGB32 - FORMAT_RGB24 Format = C.CAIRO_FORMAT_RGB24 - FORMAT_A8 Format = C.CAIRO_FORMAT_A8 - FORMAT_A1 Format = C.CAIRO_FORMAT_A1 - FORMAT_RGB16_565 Format = C.CAIRO_FORMAT_RGB16_565 - FORMAT_RGB30 Format = C.CAIRO_FORMAT_RGB30 -) - -func marshalFormat(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return Format(c), nil -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/linecap.go b/vendor/github.com/gotk3/gotk3/cairo/linecap.go deleted file mode 100644 index 553465a..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/linecap.go +++ /dev/null @@ -1,23 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" -import ( - "unsafe" -) - -// LineCap is a representation of Cairo's cairo_line_cap_t. -type LineCap int - -const ( - LINE_CAP_BUTT LineCap = C.CAIRO_LINE_CAP_BUTT - LINE_CAP_ROUND LineCap = C.CAIRO_LINE_CAP_ROUND - LINE_CAP_SQUARE LineCap = C.CAIRO_LINE_CAP_SQUARE -) - -func marshalLineCap(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return LineCap(c), nil -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/linejoin.go b/vendor/github.com/gotk3/gotk3/cairo/linejoin.go deleted file mode 100644 index 3a05920..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/linejoin.go +++ /dev/null @@ -1,23 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" -import ( - "unsafe" -) - -// LineJoin is a representation of Cairo's cairo_line_join_t. -type LineJoin int - -const ( - LINE_JOIN_MITER LineJoin = C.CAIRO_LINE_JOIN_MITER - LINE_JOIN_ROUND LineJoin = C.CAIRO_LINE_JOIN_ROUND - LINE_JOIN_BEVEL LineJoin = C.CAIRO_LINE_JOIN_BEVEL -) - -func marshalLineJoin(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return LineJoin(c), nil -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/matrix.go b/vendor/github.com/gotk3/gotk3/cairo/matrix.go deleted file mode 100644 index a934df6..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/matrix.go +++ /dev/null @@ -1,98 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" - -import ( - "unsafe" -) - -// Matrix struct -type Matrix struct { - Xx, Yx float64 - Xy, Yy float64 - X0, Y0 float64 -} - -// NewMatrix creates a new identiy matrix -func NewMatrix(xx, yx, xy, yy, x0, y0 float64) *Matrix { - return &Matrix{ - Xx: xx, - Yx: yx, - Xy: xy, - Yy: yy, - X0: x0, - Y0: y0, - } -} - -// Native returns native c pointer to a matrix -func (m *Matrix) native() *C.cairo_matrix_t { - return (*C.cairo_matrix_t)(unsafe.Pointer(m)) -} - -// Native returns native c pointer to a matrix -func (m *Matrix) Native() uintptr { - return uintptr(unsafe.Pointer(m.native())) -} - -// InitIdentity initializes this matrix to identity matrix -func (m *Matrix) InitIdentity() { - C.cairo_matrix_init_identity(m.native()) -} - -// InitTranslate initializes a matrix with the given translation -func (m *Matrix) InitTranslate(tx, ty float64) { - C.cairo_matrix_init_translate(m.native(), C.double(tx), C.double(ty)) -} - -// InitScale initializes a matrix with the give scale -func (m *Matrix) InitScale(sx, sy float64) { - C.cairo_matrix_init_scale(m.native(), C.double(sx), C.double(sy)) -} - -// InitRotate initializes a matrix with the given rotation -func (m *Matrix) InitRotate(radians float64) { - C.cairo_matrix_init_rotate(m.native(), C.double(radians)) -} - -// Translate translates a matrix by the given amount -func (m *Matrix) Translate(tx, ty float64) { - C.cairo_matrix_translate(m.native(), C.double(tx), C.double(ty)) -} - -// Scale scales the matrix by the given amounts -func (m *Matrix) Scale(sx, sy float64) { - C.cairo_matrix_scale(m.native(), C.double(sx), C.double(sy)) -} - -// Rotate rotates the matrix by the given amount -func (m *Matrix) Rotate(radians float64) { - C.cairo_matrix_rotate(m.native(), C.double(radians)) -} - -// Invert inverts the matrix -func (m *Matrix) Invert() { - C.cairo_matrix_invert(m.native()) -} - -// Multiply multiplies the matrix by another matrix -func (m *Matrix) Multiply(a, b Matrix) { - C.cairo_matrix_multiply(m.native(), a.native(), b.native()) -} - -// TransformDistance ... -func (m *Matrix) TransformDistance(dx, dy float64) (float64, float64) { - C.cairo_matrix_transform_distance(m.native(), - (*C.double)(unsafe.Pointer(&dx)), (*C.double)(unsafe.Pointer(&dy))) - return dx, dy -} - -// TransformPoint ... -func (m *Matrix) TransformPoint(x, y float64) (float64, float64) { - C.cairo_matrix_transform_point(m.native(), - (*C.double)(unsafe.Pointer(&x)), (*C.double)(unsafe.Pointer(&y))) - return x, y -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/mimetype.go b/vendor/github.com/gotk3/gotk3/cairo/mimetype.go deleted file mode 100644 index 406273e..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/mimetype.go +++ /dev/null @@ -1,13 +0,0 @@ -package cairo - -// MimeType is a representation of Cairo's CAIRO_MIME_TYPE_* -// preprocessor constants. -type MimeType string - -const ( - MIME_TYPE_JP2 MimeType = "image/jp2" - MIME_TYPE_JPEG MimeType = "image/jpeg" - MIME_TYPE_PNG MimeType = "image/png" - MIME_TYPE_URI MimeType = "image/x-uri" - MIME_TYPE_UNIQUE_ID MimeType = "application/x-cairo.uuid" -) diff --git a/vendor/github.com/gotk3/gotk3/cairo/operator.go b/vendor/github.com/gotk3/gotk3/cairo/operator.go deleted file mode 100644 index b71cbf4..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/operator.go +++ /dev/null @@ -1,49 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" -import ( - "unsafe" -) - -// Operator is a representation of Cairo's cairo_operator_t. -type Operator int - -const ( - OPERATOR_CLEAR Operator = C.CAIRO_OPERATOR_CLEAR - OPERATOR_SOURCE Operator = C.CAIRO_OPERATOR_SOURCE - OPERATOR_OVER Operator = C.CAIRO_OPERATOR_OVER - OPERATOR_IN Operator = C.CAIRO_OPERATOR_IN - OPERATOR_OUT Operator = C.CAIRO_OPERATOR_OUT - OPERATOR_ATOP Operator = C.CAIRO_OPERATOR_ATOP - OPERATOR_DEST Operator = C.CAIRO_OPERATOR_DEST - OPERATOR_DEST_OVER Operator = C.CAIRO_OPERATOR_DEST_OVER - OPERATOR_DEST_IN Operator = C.CAIRO_OPERATOR_DEST_IN - OPERATOR_DEST_OUT Operator = C.CAIRO_OPERATOR_DEST_OUT - OPERATOR_DEST_ATOP Operator = C.CAIRO_OPERATOR_DEST_ATOP - OPERATOR_XOR Operator = C.CAIRO_OPERATOR_XOR - OPERATOR_ADD Operator = C.CAIRO_OPERATOR_ADD - OPERATOR_SATURATE Operator = C.CAIRO_OPERATOR_SATURATE - OPERATOR_MULTIPLY Operator = C.CAIRO_OPERATOR_MULTIPLY - OPERATOR_SCREEN Operator = C.CAIRO_OPERATOR_SCREEN - OPERATOR_OVERLAY Operator = C.CAIRO_OPERATOR_OVERLAY - OPERATOR_DARKEN Operator = C.CAIRO_OPERATOR_DARKEN - OPERATOR_LIGHTEN Operator = C.CAIRO_OPERATOR_LIGHTEN - OPERATOR_COLOR_DODGE Operator = C.CAIRO_OPERATOR_COLOR_DODGE - OPERATOR_COLOR_BURN Operator = C.CAIRO_OPERATOR_COLOR_BURN - OPERATOR_HARD_LIGHT Operator = C.CAIRO_OPERATOR_HARD_LIGHT - OPERATOR_SOFT_LIGHT Operator = C.CAIRO_OPERATOR_SOFT_LIGHT - OPERATOR_DIFFERENCE Operator = C.CAIRO_OPERATOR_DIFFERENCE - OPERATOR_EXCLUSION Operator = C.CAIRO_OPERATOR_EXCLUSION - OPERATOR_HSL_HUE Operator = C.CAIRO_OPERATOR_HSL_HUE - OPERATOR_HSL_SATURATION Operator = C.CAIRO_OPERATOR_HSL_SATURATION - OPERATOR_HSL_COLOR Operator = C.CAIRO_OPERATOR_HSL_COLOR - OPERATOR_HSL_LUMINOSITY Operator = C.CAIRO_OPERATOR_HSL_LUMINOSITY -) - -func marshalOperator(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return Operator(c), nil -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/pattern.go b/vendor/github.com/gotk3/gotk3/cairo/pattern.go deleted file mode 100644 index 229567c..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/pattern.go +++ /dev/null @@ -1,112 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" - -import ( - "runtime" - "unsafe" -) - -//--------------------------------------------[ cairo_pattern_t == Pattern ]-- - -// Pattern is a representation of Cairo's cairo_pattern_t. -type Pattern struct { - pattern *C.cairo_pattern_t -} - -// NewPatternFromRGB is a wrapper around cairo_pattern_create_rgb(). -func NewPatternFromRGB(red, green, blue float64) (*Pattern, error) { - c := C.cairo_pattern_create_rgb(C.double(red), C.double(green), C.double(blue)) - return newPatternFromNative(c) -} - -// NewPatternFromRGBA is a wrapper around cairo_pattern_create_rgba(). -func NewPatternFromRGBA(red, green, blue, alpha float64) (*Pattern, error) { - c := C.cairo_pattern_create_rgba(C.double(red), C.double(green), C.double(blue), C.double(alpha)) - return newPatternFromNative(c) -} - -// NewPatternForSurface is a wrapper around cairo_pattern_create_for_surface(). -func NewPatternForSurface(s *Surface) (*Pattern, error) { - c := C.cairo_pattern_create_for_surface(s.native()) - return newPatternFromNative(c) -} - -// NewPatternLinear is a wrapper around cairo_pattern_create_linear(). -func NewPatternLinear(x0, y0, x1, y1 float64) (*Pattern, error) { - c := C.cairo_pattern_create_linear(C.double(x0), C.double(y0), C.double(x1), C.double(y1)) - return newPatternFromNative(c) -} - -// NewPatternRadial is a wrapper around cairo_pattern_create_radial(). -func NewPatternRadial(x0, y0, r0, x1, y1, r1 float64) (*Pattern, error) { - c := C.cairo_pattern_create_radial(C.double(x0), C.double(y0), C.double(r0), - C.double(x1), C.double(y1), C.double(r1)) - return newPatternFromNative(c) -} - -func newPatternFromNative(patternNative *C.cairo_pattern_t) (*Pattern, error) { - ptr := wrapPattern(patternNative) - e := ptr.Status().ToError() - if e != nil { - return nil, e - } - runtime.SetFinalizer(ptr, (*Pattern).destroy) - return ptr, nil -} - -// native returns a pointer to the underlying cairo_pattern_t. -func (v *Pattern) native() *C.cairo_pattern_t { - if v == nil { - return nil - } - return v.pattern -} - -// Native returns a pointer to the underlying cairo_pattern_t. -func (v *Pattern) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalPattern(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - pattern := (*C.cairo_pattern_t)(unsafe.Pointer(c)) - return wrapPattern(pattern), nil -} - -func wrapPattern(pattern *C.cairo_pattern_t) *Pattern { - return &Pattern{pattern} -} - -// reference is a wrapper around cairo_pattern_reference(). -func (v *Pattern) reference() { - v.pattern = C.cairo_pattern_reference(v.native()) -} - -// destroy is a wrapper around cairo_pattern_destroy(). -func (v *Pattern) destroy() { - C.cairo_pattern_destroy(v.native()) -} - -// Status is a wrapper around cairo_pattern_status(). -func (v *Pattern) Status() Status { - c := C.cairo_pattern_status(v.native()) - return Status(c) -} - -// AddColorStopRGB is a wrapper around cairo_pattern_add_color_stop_rgb(). -func (v *Pattern) AddColorStopRGB(offset, red, green, blue float64) error { - C.cairo_pattern_add_color_stop_rgb(v.native(), C.double(offset), - C.double(red), C.double(green), C.double(blue)) - return v.Status().ToError() -} - -// AddColorStopRGBA is a wrapper around cairo_pattern_add_color_stop_rgba(). -func (v *Pattern) AddColorStopRGBA(offset, red, green, blue, alpha float64) error { - C.cairo_pattern_add_color_stop_rgba(v.native(), C.double(offset), - C.double(red), C.double(green), C.double(blue), C.double(alpha)) - return v.Status().ToError() -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/status.go b/vendor/github.com/gotk3/gotk3/cairo/status.go deleted file mode 100644 index 64b00c3..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/status.go +++ /dev/null @@ -1,124 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" -import ( - "errors" - "strings" - "unsafe" -) - -// Status is a representation of Cairo's cairo_status_t. -type Status int - -const ( - STATUS_SUCCESS Status = C.CAIRO_STATUS_SUCCESS - STATUS_NO_MEMORY Status = C.CAIRO_STATUS_NO_MEMORY - STATUS_INVALID_RESTORE Status = C.CAIRO_STATUS_INVALID_RESTORE - STATUS_INVALID_POP_GROUP Status = C.CAIRO_STATUS_INVALID_POP_GROUP - STATUS_NO_CURRENT_POINT Status = C.CAIRO_STATUS_NO_CURRENT_POINT - STATUS_INVALID_MATRIX Status = C.CAIRO_STATUS_INVALID_MATRIX - STATUS_INVALID_STATUS Status = C.CAIRO_STATUS_INVALID_STATUS - STATUS_NULL_POINTER Status = C.CAIRO_STATUS_NULL_POINTER - STATUS_INVALID_STRING Status = C.CAIRO_STATUS_INVALID_STRING - STATUS_INVALID_PATH_DATA Status = C.CAIRO_STATUS_INVALID_PATH_DATA - STATUS_READ_ERROR Status = C.CAIRO_STATUS_READ_ERROR - STATUS_WRITE_ERROR Status = C.CAIRO_STATUS_WRITE_ERROR - STATUS_SURFACE_FINISHED Status = C.CAIRO_STATUS_SURFACE_FINISHED - STATUS_SURFACE_TYPE_MISMATCH Status = C.CAIRO_STATUS_SURFACE_TYPE_MISMATCH - STATUS_PATTERN_TYPE_MISMATCH Status = C.CAIRO_STATUS_PATTERN_TYPE_MISMATCH - STATUS_INVALID_CONTENT Status = C.CAIRO_STATUS_INVALID_CONTENT - STATUS_INVALID_FORMAT Status = C.CAIRO_STATUS_INVALID_FORMAT - STATUS_INVALID_VISUAL Status = C.CAIRO_STATUS_INVALID_VISUAL - STATUS_FILE_NOT_FOUND Status = C.CAIRO_STATUS_FILE_NOT_FOUND - STATUS_INVALID_DASH Status = C.CAIRO_STATUS_INVALID_DASH - STATUS_INVALID_DSC_COMMENT Status = C.CAIRO_STATUS_INVALID_DSC_COMMENT - STATUS_INVALID_INDEX Status = C.CAIRO_STATUS_INVALID_INDEX - STATUS_CLIP_NOT_REPRESENTABLE Status = C.CAIRO_STATUS_CLIP_NOT_REPRESENTABLE - STATUS_TEMP_FILE_ERROR Status = C.CAIRO_STATUS_TEMP_FILE_ERROR - STATUS_INVALID_STRIDE Status = C.CAIRO_STATUS_INVALID_STRIDE - STATUS_FONT_TYPE_MISMATCH Status = C.CAIRO_STATUS_FONT_TYPE_MISMATCH - STATUS_USER_FONT_IMMUTABLE Status = C.CAIRO_STATUS_USER_FONT_IMMUTABLE - STATUS_USER_FONT_ERROR Status = C.CAIRO_STATUS_USER_FONT_ERROR - STATUS_NEGATIVE_COUNT Status = C.CAIRO_STATUS_NEGATIVE_COUNT - STATUS_INVALID_CLUSTERS Status = C.CAIRO_STATUS_INVALID_CLUSTERS - STATUS_INVALID_SLANT Status = C.CAIRO_STATUS_INVALID_SLANT - STATUS_INVALID_WEIGHT Status = C.CAIRO_STATUS_INVALID_WEIGHT - STATUS_INVALID_SIZE Status = C.CAIRO_STATUS_INVALID_SIZE - STATUS_USER_FONT_NOT_IMPLEMENTED Status = C.CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED - STATUS_DEVICE_TYPE_MISMATCH Status = C.CAIRO_STATUS_DEVICE_TYPE_MISMATCH - STATUS_DEVICE_ERROR Status = C.CAIRO_STATUS_DEVICE_ERROR - // STATUS_INVALID_MESH_CONSTRUCTION Status = C.CAIRO_STATUS_INVALID_MESH_CONSTRUCTION (since 1.12) - // STATUS_DEVICE_FINISHED Status = C.CAIRO_STATUS_DEVICE_FINISHED (since 1.12) -) - -var key_Status = map[Status]string{ - - STATUS_SUCCESS: "CAIRO_STATUS_SUCCESS", - STATUS_NO_MEMORY: "CAIRO_STATUS_NO_MEMORY", - STATUS_INVALID_RESTORE: "CAIRO_STATUS_INVALID_RESTORE", - STATUS_INVALID_POP_GROUP: "CAIRO_STATUS_INVALID_POP_GROUP", - STATUS_NO_CURRENT_POINT: "CAIRO_STATUS_NO_CURRENT_POINT", - STATUS_INVALID_MATRIX: "CAIRO_STATUS_INVALID_MATRIX", - STATUS_INVALID_STATUS: "CAIRO_STATUS_INVALID_STATUS", - STATUS_NULL_POINTER: "CAIRO_STATUS_NULL_POINTER", - STATUS_INVALID_STRING: "CAIRO_STATUS_INVALID_STRING", - STATUS_INVALID_PATH_DATA: "CAIRO_STATUS_INVALID_PATH_DATA", - STATUS_READ_ERROR: "CAIRO_STATUS_READ_ERROR", - STATUS_WRITE_ERROR: "CAIRO_STATUS_WRITE_ERROR", - STATUS_SURFACE_FINISHED: "CAIRO_STATUS_SURFACE_FINISHED", - STATUS_SURFACE_TYPE_MISMATCH: "CAIRO_STATUS_SURFACE_TYPE_MISMATCH", - STATUS_PATTERN_TYPE_MISMATCH: "CAIRO_STATUS_PATTERN_TYPE_MISMATCH", - STATUS_INVALID_CONTENT: "CAIRO_STATUS_INVALID_CONTENT", - STATUS_INVALID_FORMAT: "CAIRO_STATUS_INVALID_FORMAT", - STATUS_INVALID_VISUAL: "CAIRO_STATUS_INVALID_VISUAL", - STATUS_FILE_NOT_FOUND: "CAIRO_STATUS_FILE_NOT_FOUND", - STATUS_INVALID_DASH: "CAIRO_STATUS_INVALID_DASH", - STATUS_INVALID_DSC_COMMENT: "CAIRO_STATUS_INVALID_DSC_COMMENT", - STATUS_INVALID_INDEX: "CAIRO_STATUS_INVALID_INDEX", - STATUS_CLIP_NOT_REPRESENTABLE: "CAIRO_STATUS_CLIP_NOT_REPRESENTABLE", - STATUS_TEMP_FILE_ERROR: "CAIRO_STATUS_TEMP_FILE_ERROR", - STATUS_INVALID_STRIDE: "CAIRO_STATUS_INVALID_STRIDE", - STATUS_FONT_TYPE_MISMATCH: "CAIRO_STATUS_FONT_TYPE_MISMATCH", - STATUS_USER_FONT_IMMUTABLE: "CAIRO_STATUS_USER_FONT_IMMUTABLE", - STATUS_USER_FONT_ERROR: "CAIRO_STATUS_USER_FONT_ERROR", - STATUS_NEGATIVE_COUNT: "CAIRO_STATUS_NEGATIVE_COUNT", - STATUS_INVALID_CLUSTERS: "CAIRO_STATUS_INVALID_CLUSTERS", - STATUS_INVALID_SLANT: "CAIRO_STATUS_INVALID_SLANT", - STATUS_INVALID_WEIGHT: "CAIRO_STATUS_INVALID_WEIGHT", - STATUS_INVALID_SIZE: "CAIRO_STATUS_INVALID_SIZE", - STATUS_USER_FONT_NOT_IMPLEMENTED: "CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED", - STATUS_DEVICE_TYPE_MISMATCH: "CAIRO_STATUS_DEVICE_TYPE_MISMATCH", - STATUS_DEVICE_ERROR: "CAIRO_STATUS_DEVICE_ERROR", -} - -func StatusToString(status Status) string { - s, ok := key_Status[status] - if !ok { - s = "CAIRO_STATUS_UNDEFINED" - } - return s -} - -func marshalStatus(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return Status(c), nil -} - -// String returns a readable status messsage usable in texts. -func (s Status) String() string { - str := StatusToString(s) - str = strings.Replace(str, "CAIRO_STATUS_", "", 1) - str = strings.Replace(str, "_", " ", 0) - return strings.ToLower(str) -} - -// ToError returns the error for the status. Returns nil if success. -func (s Status) ToError() error { - if s == STATUS_SUCCESS { - return nil - } - return errors.New(s.String()) -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/surface.go b/vendor/github.com/gotk3/gotk3/cairo/surface.go deleted file mode 100644 index c9bd55a..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/surface.go +++ /dev/null @@ -1,275 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -// #include <cairo-pdf.h> -import "C" - -import ( - "runtime" - "unsafe" -) - -// TODO(jrick) SetUserData (depends on UserDataKey and DestroyFunc) - -// TODO(jrick) GetUserData (depends on UserDataKey) - -/* - * cairo_surface_t - */ - -// Surface is a representation of Cairo's cairo_surface_t. -type Surface struct { - surface *C.cairo_surface_t -} - -func NewSurfaceFromPNG(fileName string) (*Surface, error) { - - cstr := C.CString(fileName) - defer C.free(unsafe.Pointer(cstr)) - - surfaceNative := C.cairo_image_surface_create_from_png(cstr) - - status := Status(C.cairo_surface_status(surfaceNative)) - if status != STATUS_SUCCESS { - return nil, ErrorStatus(status) - } - - return &Surface{surfaceNative}, nil -} - -// CreateImageSurface is a wrapper around cairo_image_surface_create(). -func CreateImageSurface(format Format, width, height int) *Surface { - c := C.cairo_image_surface_create(C.cairo_format_t(format), - C.int(width), C.int(height)) - s := wrapSurface(c) - runtime.SetFinalizer(s, (*Surface).destroy) - return s -} - -/// Create a new PDF surface. -func CreatePDFSurface(fileName string, width float64, height float64) (*Surface, error) { - cstr := C.CString(fileName) - defer C.free(unsafe.Pointer(cstr)) - - surfaceNative := C.cairo_pdf_surface_create(cstr, C.double(width), C.double(height)) - - status := Status(C.cairo_surface_status(surfaceNative)) - if status != STATUS_SUCCESS { - return nil, ErrorStatus(status) - } - - s := wrapSurface(surfaceNative) - - runtime.SetFinalizer(s, (*Surface).destroy) - - return s, nil -} - -// native returns a pointer to the underlying cairo_surface_t. -func (v *Surface) native() *C.cairo_surface_t { - if v == nil { - return nil - } - return v.surface -} - -// Native returns a pointer to the underlying cairo_surface_t. -func (v *Surface) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalSurface(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - return WrapSurface(uintptr(c)), nil -} - -func wrapSurface(surface *C.cairo_surface_t) *Surface { - return &Surface{surface} -} - -// NewSurface creates a gotk3 cairo Surface from a pointer to a -// C cairo_surface_t. This is primarily designed for use with other -// gotk3 packages and should be avoided by applications. -func NewSurface(s uintptr, needsRef bool) *Surface { - surface := WrapSurface(s) - if needsRef { - surface.reference() - } - runtime.SetFinalizer(surface, (*Surface).destroy) - return surface -} - -func WrapSurface(s uintptr) *Surface { - ptr := (*C.cairo_surface_t)(unsafe.Pointer(s)) - return wrapSurface(ptr) -} - -// Closes the surface. The surface must not be used afterwards. -func (v *Surface) Close() { - v.destroy() -} - -// CreateSimilar is a wrapper around cairo_surface_create_similar(). -func (v *Surface) CreateSimilar(content Content, width, height int) *Surface { - c := C.cairo_surface_create_similar(v.native(), - C.cairo_content_t(content), C.int(width), C.int(height)) - s := wrapSurface(c) - runtime.SetFinalizer(s, (*Surface).destroy) - return s -} - -// TODO cairo_surface_create_similar_image (since 1.12) - -// CreateForRectangle is a wrapper around cairo_surface_create_for_rectangle(). -func (v *Surface) CreateForRectangle(x, y, width, height float64) *Surface { - c := C.cairo_surface_create_for_rectangle(v.native(), C.double(x), - C.double(y), C.double(width), C.double(height)) - s := wrapSurface(c) - runtime.SetFinalizer(s, (*Surface).destroy) - return s -} - -// reference is a wrapper around cairo_surface_reference(). -func (v *Surface) reference() { - v.surface = C.cairo_surface_reference(v.native()) -} - -// destroy is a wrapper around cairo_surface_destroy(). -func (v *Surface) destroy() { - if v.surface != nil { - C.cairo_surface_destroy(v.native()) - v.surface = nil - } -} - -// Status is a wrapper around cairo_surface_status(). -func (v *Surface) Status() Status { - c := C.cairo_surface_status(v.native()) - return Status(c) -} - -// Flush is a wrapper around cairo_surface_flush(). -func (v *Surface) Flush() { - C.cairo_surface_flush(v.native()) -} - -// TODO(jrick) GetDevice (requires Device bindings) - -// TODO(jrick) GetFontOptions (require FontOptions bindings) - -// TODO(jrick) GetContent (requires Content bindings) - -// MarkDirty is a wrapper around cairo_surface_mark_dirty(). -func (v *Surface) MarkDirty() { - C.cairo_surface_mark_dirty(v.native()) -} - -// MarkDirtyRectangle is a wrapper around cairo_surface_mark_dirty_rectangle(). -func (v *Surface) MarkDirtyRectangle(x, y, width, height int) { - C.cairo_surface_mark_dirty_rectangle(v.native(), C.int(x), C.int(y), - C.int(width), C.int(height)) -} - -// SetDeviceOffset is a wrapper around cairo_surface_set_device_offset(). -func (v *Surface) SetDeviceOffset(x, y float64) { - C.cairo_surface_set_device_offset(v.native(), C.double(x), C.double(y)) -} - -// GetDeviceOffset is a wrapper around cairo_surface_get_device_offset(). -func (v *Surface) GetDeviceOffset() (x, y float64) { - var xOffset, yOffset C.double - C.cairo_surface_get_device_offset(v.native(), &xOffset, &yOffset) - return float64(xOffset), float64(yOffset) -} - -// SetFallbackResolution is a wrapper around -// cairo_surface_set_fallback_resolution(). -func (v *Surface) SetFallbackResolution(xPPI, yPPI float64) { - C.cairo_surface_set_fallback_resolution(v.native(), C.double(xPPI), - C.double(yPPI)) -} - -// GetFallbackResolution is a wrapper around -// cairo_surface_get_fallback_resolution(). -func (v *Surface) GetFallbackResolution() (xPPI, yPPI float64) { - var x, y C.double - C.cairo_surface_get_fallback_resolution(v.native(), &x, &y) - return float64(x), float64(y) -} - -// GetType is a wrapper around cairo_surface_get_type(). -func (v *Surface) GetType() SurfaceType { - c := C.cairo_surface_get_type(v.native()) - return SurfaceType(c) -} - -// TODO(jrick) SetUserData (depends on UserDataKey and DestroyFunc) - -// TODO(jrick) GetUserData (depends on UserDataKey) - -// CopyPage is a wrapper around cairo_surface_copy_page(). -func (v *Surface) CopyPage() { - C.cairo_surface_copy_page(v.native()) -} - -// ShowPage is a wrapper around cairo_surface_show_page(). -func (v *Surface) ShowPage() { - C.cairo_surface_show_page(v.native()) -} - -// HasShowTextGlyphs is a wrapper around cairo_surface_has_show_text_glyphs(). -func (v *Surface) HasShowTextGlyphs() bool { - c := C.cairo_surface_has_show_text_glyphs(v.native()) - return gobool(c) -} - -// TODO(jrick) SetMimeData (depends on DestroyFunc) - -// GetMimeData is a wrapper around cairo_surface_get_mime_data(). The -// returned mimetype data is returned as a Go byte slice. -func (v *Surface) GetMimeData(mimeType MimeType) []byte { - cstr := C.CString(string(mimeType)) - defer C.free(unsafe.Pointer(cstr)) - var data *C.uchar - var length C.ulong - C.cairo_surface_get_mime_data(v.native(), cstr, &data, &length) - return C.GoBytes(unsafe.Pointer(data), C.int(length)) -} - -// WriteToPNG is a wrapper around cairo_surface_write_png(). It writes the Cairo -// surface to the given file in PNG format. -func (v *Surface) WriteToPNG(fileName string) error { - cstr := C.CString(fileName) - defer C.free(unsafe.Pointer(cstr)) - - status := Status(C.cairo_surface_write_to_png(v.surface, cstr)) - - if status != STATUS_SUCCESS { - return ErrorStatus(status) - } - - return nil -} - -// TODO(jrick) SupportsMimeType (since 1.12) - -// TODO(jrick) MapToImage (since 1.12) - -// TODO(jrick) UnmapImage (since 1.12) - -// GetHeight is a wrapper around cairo_image_surface_get_height(). -func (v *Surface) GetHeight() int { - return int(C.cairo_image_surface_get_height(v.surface)) -} - -// GetWidth is a wrapper around cairo_image_surface_get_width(). -func (v *Surface) GetWidth() int { - return int(C.cairo_image_surface_get_width(v.surface)) -} - -// GetData is a wrapper around cairo_image_surface_get_data(). -func (v *Surface) GetData() unsafe.Pointer { - return unsafe.Pointer(C.cairo_image_surface_get_data(v.surface)) -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/surfacetype.go b/vendor/github.com/gotk3/gotk3/cairo/surfacetype.go deleted file mode 100644 index a1421eb..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/surfacetype.go +++ /dev/null @@ -1,45 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" -import ( - "unsafe" -) - -// SurfaceType is a representation of Cairo's cairo_surface_type_t. -type SurfaceType int - -const ( - SURFACE_TYPE_IMAGE SurfaceType = C.CAIRO_SURFACE_TYPE_IMAGE - SURFACE_TYPE_PDF SurfaceType = C.CAIRO_SURFACE_TYPE_PDF - SURFACE_TYPE_PS SurfaceType = C.CAIRO_SURFACE_TYPE_PS - SURFACE_TYPE_XLIB SurfaceType = C.CAIRO_SURFACE_TYPE_XLIB - SURFACE_TYPE_XCB SurfaceType = C.CAIRO_SURFACE_TYPE_XCB - SURFACE_TYPE_GLITZ SurfaceType = C.CAIRO_SURFACE_TYPE_GLITZ - SURFACE_TYPE_QUARTZ SurfaceType = C.CAIRO_SURFACE_TYPE_QUARTZ - SURFACE_TYPE_WIN32 SurfaceType = C.CAIRO_SURFACE_TYPE_WIN32 - SURFACE_TYPE_BEOS SurfaceType = C.CAIRO_SURFACE_TYPE_BEOS - SURFACE_TYPE_DIRECTFB SurfaceType = C.CAIRO_SURFACE_TYPE_DIRECTFB - SURFACE_TYPE_SVG SurfaceType = C.CAIRO_SURFACE_TYPE_SVG - SURFACE_TYPE_OS2 SurfaceType = C.CAIRO_SURFACE_TYPE_OS2 - SURFACE_TYPE_WIN32_PRINTING SurfaceType = C.CAIRO_SURFACE_TYPE_WIN32_PRINTING - SURFACE_TYPE_QUARTZ_IMAGE SurfaceType = C.CAIRO_SURFACE_TYPE_QUARTZ_IMAGE - SURFACE_TYPE_SCRIPT SurfaceType = C.CAIRO_SURFACE_TYPE_SCRIPT - SURFACE_TYPE_QT SurfaceType = C.CAIRO_SURFACE_TYPE_QT - SURFACE_TYPE_RECORDING SurfaceType = C.CAIRO_SURFACE_TYPE_RECORDING - SURFACE_TYPE_VG SurfaceType = C.CAIRO_SURFACE_TYPE_VG - SURFACE_TYPE_GL SurfaceType = C.CAIRO_SURFACE_TYPE_GL - SURFACE_TYPE_DRM SurfaceType = C.CAIRO_SURFACE_TYPE_DRM - SURFACE_TYPE_TEE SurfaceType = C.CAIRO_SURFACE_TYPE_TEE - SURFACE_TYPE_XML SurfaceType = C.CAIRO_SURFACE_TYPE_XML - SURFACE_TYPE_SKIA SurfaceType = C.CAIRO_SURFACE_TYPE_SKIA - SURFACE_TYPE_SUBSURFACE SurfaceType = C.CAIRO_SURFACE_TYPE_SUBSURFACE - // SURFACE_TYPE_COGL SurfaceType = C.CAIRO_SURFACE_TYPE_COGL (since 1.12) -) - -func marshalSurfaceType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return SurfaceType(c), nil -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/text.go b/vendor/github.com/gotk3/gotk3/cairo/text.go deleted file mode 100644 index ab0e201..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/text.go +++ /dev/null @@ -1,125 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" - -import ( - "unsafe" -) - -// FontSlant is a representation of Cairo's cairo_font_slant_t -type FontSlant int - -const ( - FONT_SLANT_NORMAL FontSlant = C.CAIRO_FONT_SLANT_NORMAL - FONT_SLANT_ITALIC FontSlant = C.CAIRO_FONT_SLANT_ITALIC - FONT_SLANT_OBLIQUE FontSlant = C.CAIRO_FONT_SLANT_OBLIQUE -) - -// FontWeight is a representation of Cairo's cairo_font_weight_t -type FontWeight int - -const ( - FONT_WEIGHT_NORMAL FontWeight = C.CAIRO_FONT_WEIGHT_NORMAL - FONT_WEIGHT_BOLD FontWeight = C.CAIRO_FONT_WEIGHT_BOLD -) - -func (v *Context) SelectFontFace(family string, slant FontSlant, weight FontWeight) { - cstr := C.CString(family) - defer C.free(unsafe.Pointer(cstr)) - C.cairo_select_font_face(v.native(), (*C.char)(cstr), C.cairo_font_slant_t(slant), C.cairo_font_weight_t(weight)) -} - -func (v *Context) SetFontSize(size float64) { - C.cairo_set_font_size(v.native(), C.double(size)) -} - -// TODO: cairo_set_font_matrix - -// TODO: cairo_get_font_matrix - -// TODO: cairo_set_font_options - -// TODO: cairo_get_font_options - -// TODO: cairo_set_font_face - -// TODO: cairo_get_font_face - -// TODO: cairo_set_scaled_font - -// TODO: cairo_get_scaled_font - -func (v *Context) ShowText(utf8 string) { - cstr := C.CString(utf8) - defer C.free(unsafe.Pointer(cstr)) - C.cairo_show_text(v.native(), (*C.char)(cstr)) -} - -// TODO: cairo_show_glyphs - -// TODO: cairo_show_text_glyphs - -type FontExtents struct { - Ascent float64 - Descent float64 - Height float64 - MaxXAdvance float64 - MaxYAdvance float64 -} - -func (v *Context) FontExtents() FontExtents { - var extents C.cairo_font_extents_t - C.cairo_font_extents(v.native(), &extents) - return FontExtents{ - Ascent: float64(extents.ascent), - Descent: float64(extents.descent), - Height: float64(extents.height), - MaxXAdvance: float64(extents.max_x_advance), - MaxYAdvance: float64(extents.max_y_advance), - } -} - -type TextExtents struct { - XBearing float64 - YBearing float64 - Width float64 - Height float64 - XAdvance float64 - YAdvance float64 -} - -func (v *Context) TextExtents(utf8 string) TextExtents { - cstr := C.CString(utf8) - defer C.free(unsafe.Pointer(cstr)) - var extents C.cairo_text_extents_t - C.cairo_text_extents(v.native(), (*C.char)(cstr), &extents) - return TextExtents{ - XBearing: float64(extents.x_bearing), - YBearing: float64(extents.y_bearing), - Width: float64(extents.width), - Height: float64(extents.height), - XAdvance: float64(extents.x_advance), - YAdvance: float64(extents.y_advance), - } -} - -// TODO: cairo_glyph_extents - -// TODO: cairo_toy_font_face_create - -// TODO: cairo_toy_font_face_get_family - -// TODO: cairo_toy_font_face_get_slant - -// TODO: cairo_toy_font_face_get_weight - -// TODO: cairo_glyph_allocate - -// TODO: cairo_glyph_free - -// TODO: cairo_text_cluster_allocate - -// TODO: cairo_text_cluster_free diff --git a/vendor/github.com/gotk3/gotk3/cairo/translations.go b/vendor/github.com/gotk3/gotk3/cairo/translations.go deleted file mode 100644 index bfe5ad8..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/translations.go +++ /dev/null @@ -1,78 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" - -// Translate is a wrapper around cairo_translate. -func (v *Context) Translate(tx, ty float64) { - C.cairo_translate(v.native(), C.double(tx), C.double(ty)) -} - -// Scale is a wrapper around cairo_scale. -func (v *Context) Scale(sx, sy float64) { - C.cairo_scale(v.native(), C.double(sx), C.double(sy)) -} - -// Rotate is a wrapper around cairo_rotate. -func (v *Context) Rotate(angle float64) { - C.cairo_rotate(v.native(), C.double(angle)) -} - -// Transform is a wrapper around cairo_transform. -func (v *Context) Transform(matrix *Matrix) { - C.cairo_transform(v.native(), matrix.native()) -} - -// SetMatrix is a wrapper around cairo_set_matrix. -func (v *Context) SetMatrix(matrix *Matrix) { - C.cairo_set_matrix(v.native(), matrix.native()) -} - -// GetMatrix is a wrapper around cairo_get_matrix. -func (v *Context) GetMatrix() *Matrix { - var matrix C.cairo_matrix_t - C.cairo_get_matrix(v.native(), &matrix) - return &Matrix{ - Xx: float64(matrix.xx), - Yx: float64(matrix.yx), - Xy: float64(matrix.xy), - Yy: float64(matrix.yy), - X0: float64(matrix.x0), - Y0: float64(matrix.y0), - } -} - -// IdentityMatrix is a wrapper around cairo_identity_matrix(). -// -// Resets the current transformation matrix (CTM) by setting it equal to the -// identity matrix. That is, the user-space and device-space axes will be -// aligned and one user-space unit will transform to one device-space unit. -func (v *Context) IdentityMatrix() { - C.cairo_identity_matrix(v.native()) -} - -// UserToDevice is a wrapper around cairo_user_to_device. -func (v *Context) UserToDevice(x, y float64) (float64, float64) { - C.cairo_user_to_device(v.native(), (*C.double)(&x), (*C.double)(&y)) - return x, y -} - -// UserToDeviceDistance is a wrapper around cairo_user_to_device_distance. -func (v *Context) UserToDeviceDistance(dx, dy float64) (float64, float64) { - C.cairo_user_to_device_distance(v.native(), (*C.double)(&dx), (*C.double)(&dy)) - return dx, dy -} - -// DeviceToUser is a wrapper around cairo_device_to_user. -func (v *Context) DeviceToUser(x, y float64) (float64, float64) { - C.cairo_device_to_user(v.native(), (*C.double)(&x), (*C.double)(&y)) - return x, y -} - -// DeviceToUserDistance is a wrapper around cairo_device_to_user_distance. -func (v *Context) DeviceToUserDistance(x, y float64) (float64, float64) { - C.cairo_device_to_user_distance(v.native(), (*C.double)(&x), (*C.double)(&y)) - return x, y -} diff --git a/vendor/github.com/gotk3/gotk3/cairo/util.go b/vendor/github.com/gotk3/gotk3/cairo/util.go deleted file mode 100644 index 39adda7..0000000 --- a/vendor/github.com/gotk3/gotk3/cairo/util.go +++ /dev/null @@ -1,20 +0,0 @@ -package cairo - -// #include <stdlib.h> -// #include <cairo.h> -// #include <cairo-gobject.h> -import "C" - -func cairobool(b bool) C.cairo_bool_t { - if b { - return C.cairo_bool_t(1) - } - return C.cairo_bool_t(0) -} - -func gobool(b C.cairo_bool_t) bool { - if b != 0 { - return true - } - return false -} diff --git a/vendor/github.com/gotk3/gotk3/gdk/gdk.go b/vendor/github.com/gotk3/gotk3/gdk/gdk.go deleted file mode 100644 index 8cef92b..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/gdk.go +++ /dev/null @@ -1,1864 +0,0 @@ -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// Go bindings for GDK 3. Supports version 3.6 and later. -package gdk - -// #cgo pkg-config: gdk-3.0 glib-2.0 gobject-2.0 -// #include <gdk/gdk.h> -// #include "gdk.go.h" -import "C" -import ( - "errors" - "reflect" - "runtime" - "strconv" - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - // Enums - {glib.Type(C.gdk_drag_action_get_type()), marshalDragAction}, - {glib.Type(C.gdk_colorspace_get_type()), marshalColorspace}, - {glib.Type(C.gdk_event_type_get_type()), marshalEventType}, - {glib.Type(C.gdk_interp_type_get_type()), marshalInterpType}, - {glib.Type(C.gdk_modifier_type_get_type()), marshalModifierType}, - {glib.Type(C.gdk_pixbuf_alpha_mode_get_type()), marshalPixbufAlphaMode}, - {glib.Type(C.gdk_event_mask_get_type()), marshalEventMask}, - - // Objects/Interfaces - {glib.Type(C.gdk_device_get_type()), marshalDevice}, - {glib.Type(C.gdk_cursor_get_type()), marshalCursor}, - {glib.Type(C.gdk_device_manager_get_type()), marshalDeviceManager}, - {glib.Type(C.gdk_display_get_type()), marshalDisplay}, - {glib.Type(C.gdk_drag_context_get_type()), marshalDragContext}, - {glib.Type(C.gdk_pixbuf_get_type()), marshalPixbuf}, - {glib.Type(C.gdk_rgba_get_type()), marshalRGBA}, - {glib.Type(C.gdk_screen_get_type()), marshalScreen}, - {glib.Type(C.gdk_visual_get_type()), marshalVisual}, - {glib.Type(C.gdk_window_get_type()), marshalWindow}, - - // Boxed - {glib.Type(C.gdk_event_get_type()), marshalEvent}, - } - glib.RegisterGValueMarshalers(tm) -} - -/* - * Type conversions - */ - -func gbool(b bool) C.gboolean { - if b { - return C.gboolean(1) - } - return C.gboolean(0) -} -func gobool(b C.gboolean) bool { - if b != 0 { - return true - } - return false -} - -/* - * Unexported vars - */ - -var nilPtrErr = errors.New("cgo returned unexpected nil pointer") - -/* - * Constants - */ - -// DragAction is a representation of GDK's GdkDragAction. -type DragAction int - -const ( - ACTION_DEFAULT DragAction = C.GDK_ACTION_DEFAULT - ACTION_COPY DragAction = C.GDK_ACTION_COPY - ACTION_MOVE DragAction = C.GDK_ACTION_MOVE - ACTION_LINK DragAction = C.GDK_ACTION_LINK - ACTION_PRIVATE DragAction = C.GDK_ACTION_PRIVATE - ACTION_ASK DragAction = C.GDK_ACTION_ASK -) - -func marshalDragAction(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return DragAction(c), nil -} - -// Colorspace is a representation of GDK's GdkColorspace. -type Colorspace int - -const ( - COLORSPACE_RGB Colorspace = C.GDK_COLORSPACE_RGB -) - -func marshalColorspace(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return Colorspace(c), nil -} - -// InterpType is a representation of GDK's GdkInterpType. -type InterpType int - -const ( - INTERP_NEAREST InterpType = C.GDK_INTERP_NEAREST - INTERP_TILES InterpType = C.GDK_INTERP_TILES - INTERP_BILINEAR InterpType = C.GDK_INTERP_BILINEAR - INTERP_HYPER InterpType = C.GDK_INTERP_HYPER -) - -// PixbufRotation is a representation of GDK's GdkPixbufRotation. -type PixbufRotation int - -const ( - PIXBUF_ROTATE_NONE PixbufRotation = C.GDK_PIXBUF_ROTATE_NONE - PIXBUF_ROTATE_COUNTERCLOCKWISE PixbufRotation = C.GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE - PIXBUF_ROTATE_UPSIDEDOWN PixbufRotation = C.GDK_PIXBUF_ROTATE_UPSIDEDOWN - PIXBUF_ROTATE_CLOCKWISE PixbufRotation = C.GDK_PIXBUF_ROTATE_CLOCKWISE -) - -func marshalInterpType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return InterpType(c), nil -} - -// ModifierType is a representation of GDK's GdkModifierType. -type ModifierType uint - -const ( - GDK_SHIFT_MASK ModifierType = C.GDK_SHIFT_MASK - GDK_LOCK_MASK = C.GDK_LOCK_MASK - GDK_CONTROL_MASK = C.GDK_CONTROL_MASK - GDK_MOD1_MASK = C.GDK_MOD1_MASK - GDK_MOD2_MASK = C.GDK_MOD2_MASK - GDK_MOD3_MASK = C.GDK_MOD3_MASK - GDK_MOD4_MASK = C.GDK_MOD4_MASK - GDK_MOD5_MASK = C.GDK_MOD5_MASK - GDK_BUTTON1_MASK = C.GDK_BUTTON1_MASK - GDK_BUTTON2_MASK = C.GDK_BUTTON2_MASK - GDK_BUTTON3_MASK = C.GDK_BUTTON3_MASK - GDK_BUTTON4_MASK = C.GDK_BUTTON4_MASK - GDK_BUTTON5_MASK = C.GDK_BUTTON5_MASK - GDK_SUPER_MASK = C.GDK_SUPER_MASK - GDK_HYPER_MASK = C.GDK_HYPER_MASK - GDK_META_MASK = C.GDK_META_MASK - GDK_RELEASE_MASK = C.GDK_RELEASE_MASK - GDK_MODIFIER_MASK = C.GDK_MODIFIER_MASK -) - -func marshalModifierType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return ModifierType(c), nil -} - -// PixbufAlphaMode is a representation of GDK's GdkPixbufAlphaMode. -type PixbufAlphaMode int - -const ( - GDK_PIXBUF_ALPHA_BILEVEL PixbufAlphaMode = C.GDK_PIXBUF_ALPHA_BILEVEL - GDK_PIXBUF_ALPHA_FULL PixbufAlphaMode = C.GDK_PIXBUF_ALPHA_FULL -) - -func marshalPixbufAlphaMode(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return PixbufAlphaMode(c), nil -} - -// Selections -const ( - SELECTION_PRIMARY Atom = 1 - SELECTION_SECONDARY Atom = 2 - SELECTION_CLIPBOARD Atom = 69 - TARGET_BITMAP Atom = 5 - TARGET_COLORMAP Atom = 7 - TARGET_DRAWABLE Atom = 17 - TARGET_PIXMAP Atom = 20 - TARGET_STRING Atom = 31 - SELECTION_TYPE_ATOM Atom = 4 - SELECTION_TYPE_BITMAP Atom = 5 - SELECTION_TYPE_COLORMAP Atom = 7 - SELECTION_TYPE_DRAWABLE Atom = 17 - SELECTION_TYPE_INTEGER Atom = 19 - SELECTION_TYPE_PIXMAP Atom = 20 - SELECTION_TYPE_WINDOW Atom = 33 - SELECTION_TYPE_STRING Atom = 31 -) - -// added by terrak -// EventMask is a representation of GDK's GdkEventMask. -type EventMask int - -const ( - EXPOSURE_MASK EventMask = C.GDK_EXPOSURE_MASK - POINTER_MOTION_MASK EventMask = C.GDK_POINTER_MOTION_MASK - POINTER_MOTION_HINT_MASK EventMask = C.GDK_POINTER_MOTION_HINT_MASK - BUTTON_MOTION_MASK EventMask = C.GDK_BUTTON_MOTION_MASK - BUTTON1_MOTION_MASK EventMask = C.GDK_BUTTON1_MOTION_MASK - BUTTON2_MOTION_MASK EventMask = C.GDK_BUTTON2_MOTION_MASK - BUTTON3_MOTION_MASK EventMask = C.GDK_BUTTON3_MOTION_MASK - BUTTON_PRESS_MASK EventMask = C.GDK_BUTTON_PRESS_MASK - BUTTON_RELEASE_MASK EventMask = C.GDK_BUTTON_RELEASE_MASK - KEY_PRESS_MASK EventMask = C.GDK_KEY_PRESS_MASK - KEY_RELEASE_MASK EventMask = C.GDK_KEY_RELEASE_MASK - ENTER_NOTIFY_MASK EventMask = C.GDK_ENTER_NOTIFY_MASK - LEAVE_NOTIFY_MASK EventMask = C.GDK_LEAVE_NOTIFY_MASK - FOCUS_CHANGE_MASK EventMask = C.GDK_FOCUS_CHANGE_MASK - STRUCTURE_MASK EventMask = C.GDK_STRUCTURE_MASK - PROPERTY_CHANGE_MASK EventMask = C.GDK_PROPERTY_CHANGE_MASK - VISIBILITY_NOTIFY_MASK EventMask = C.GDK_VISIBILITY_NOTIFY_MASK - PROXIMITY_IN_MASK EventMask = C.GDK_PROXIMITY_IN_MASK - PROXIMITY_OUT_MASK EventMask = C.GDK_PROXIMITY_OUT_MASK - SUBSTRUCTURE_MASK EventMask = C.GDK_SUBSTRUCTURE_MASK - SCROLL_MASK EventMask = C.GDK_SCROLL_MASK - TOUCH_MASK EventMask = C.GDK_TOUCH_MASK - SMOOTH_SCROLL_MASK EventMask = C.GDK_SMOOTH_SCROLL_MASK - ALL_EVENTS_MASK EventMask = C.GDK_ALL_EVENTS_MASK -) - -func marshalEventMask(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return EventMask(c), nil -} - -// added by lazyshot -// ScrollDirection is a representation of GDK's GdkScrollDirection - -type ScrollDirection int - -const ( - SCROLL_UP ScrollDirection = C.GDK_SCROLL_UP - SCROLL_DOWN ScrollDirection = C.GDK_SCROLL_DOWN - SCROLL_LEFT ScrollDirection = C.GDK_SCROLL_LEFT - SCROLL_RIGHT ScrollDirection = C.GDK_SCROLL_RIGHT - SCROLL_SMOOTH ScrollDirection = C.GDK_SCROLL_SMOOTH -) - -// WindowState is a representation of GDK's GdkWindowState -type WindowState int - -const ( - WINDOW_STATE_WITHDRAWN WindowState = C.GDK_WINDOW_STATE_WITHDRAWN - WINDOW_STATE_ICONIFIED WindowState = C.GDK_WINDOW_STATE_ICONIFIED - WINDOW_STATE_MAXIMIZED WindowState = C.GDK_WINDOW_STATE_MAXIMIZED - WINDOW_STATE_STICKY WindowState = C.GDK_WINDOW_STATE_STICKY - WINDOW_STATE_FULLSCREEN WindowState = C.GDK_WINDOW_STATE_FULLSCREEN - WINDOW_STATE_ABOVE WindowState = C.GDK_WINDOW_STATE_ABOVE - WINDOW_STATE_BELOW WindowState = C.GDK_WINDOW_STATE_BELOW - WINDOW_STATE_FOCUSED WindowState = C.GDK_WINDOW_STATE_FOCUSED - WINDOW_STATE_TILED WindowState = C.GDK_WINDOW_STATE_TILED -) - -// WindowTypeHint is a representation of GDK's GdkWindowTypeHint -type WindowTypeHint int - -const ( - WINDOW_TYPE_HINT_NORMAL WindowTypeHint = C.GDK_WINDOW_TYPE_HINT_NORMAL - WINDOW_TYPE_HINT_DIALOG WindowTypeHint = C.GDK_WINDOW_TYPE_HINT_DIALOG - WINDOW_TYPE_HINT_MENU WindowTypeHint = C.GDK_WINDOW_TYPE_HINT_MENU - WINDOW_TYPE_HINT_TOOLBAR WindowTypeHint = C.GDK_WINDOW_TYPE_HINT_TOOLBAR - WINDOW_TYPE_HINT_SPLASHSCREEN WindowTypeHint = C.GDK_WINDOW_TYPE_HINT_SPLASHSCREEN - WINDOW_TYPE_HINT_UTILITY WindowTypeHint = C.GDK_WINDOW_TYPE_HINT_UTILITY - WINDOW_TYPE_HINT_DOCK WindowTypeHint = C.GDK_WINDOW_TYPE_HINT_DOCK - WINDOW_TYPE_HINT_DESKTOP WindowTypeHint = C.GDK_WINDOW_TYPE_HINT_DESKTOP - WINDOW_TYPE_HINT_DROPDOWN_MENU WindowTypeHint = C.GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU - WINDOW_TYPE_HINT_POPUP_MENU WindowTypeHint = C.GDK_WINDOW_TYPE_HINT_POPUP_MENU - WINDOW_TYPE_HINT_TOOLTIP WindowTypeHint = C.GDK_WINDOW_TYPE_HINT_TOOLTIP - WINDOW_TYPE_HINT_NOTIFICATION WindowTypeHint = C.GDK_WINDOW_TYPE_HINT_NOTIFICATION - WINDOW_TYPE_HINT_COMBO WindowTypeHint = C.GDK_WINDOW_TYPE_HINT_COMBO - WINDOW_TYPE_HINT_DND WindowTypeHint = C.GDK_WINDOW_TYPE_HINT_DND -) - -// CURRENT_TIME is a representation of GDK_CURRENT_TIME - -const CURRENT_TIME = C.GDK_CURRENT_TIME - -// GrabStatus is a representation of GdkGrabStatus - -type GrabStatus int - -const ( - GRAB_SUCCESS GrabStatus = C.GDK_GRAB_SUCCESS - GRAB_ALREADY_GRABBED GrabStatus = C.GDK_GRAB_ALREADY_GRABBED - GRAB_INVALID_TIME GrabStatus = C.GDK_GRAB_INVALID_TIME - GRAB_FROZEN GrabStatus = C.GDK_GRAB_FROZEN - // Only exists since 3.16 - // GRAB_FAILED GrabStatus = C.GDK_GRAB_FAILED - GRAB_FAILED GrabStatus = 5 -) - -// GrabOwnership is a representation of GdkGrabOwnership - -type GrabOwnership int - -const ( - OWNERSHIP_NONE GrabOwnership = C.GDK_OWNERSHIP_NONE - OWNERSHIP_WINDOW GrabOwnership = C.GDK_OWNERSHIP_WINDOW - OWNERSHIP_APPLICATION GrabOwnership = C.GDK_OWNERSHIP_APPLICATION -) - -// DeviceType is a representation of GdkDeviceType - -type DeviceType int - -const ( - DEVICE_TYPE_MASTER DeviceType = C.GDK_DEVICE_TYPE_MASTER - DEVICE_TYPE_SLAVE DeviceType = C.GDK_DEVICE_TYPE_SLAVE - DEVICE_TYPE_FLOATING DeviceType = C.GDK_DEVICE_TYPE_FLOATING -) - -// EventPropagation constants - -const ( - GDK_EVENT_PROPAGATE bool = C.GDK_EVENT_PROPAGATE != 0 - GDK_EVENT_STOP bool = C.GDK_EVENT_STOP != 0 -) - -/* - * GdkAtom - */ - -// Atom is a representation of GDK's GdkAtom. -type Atom uintptr - -// native returns the underlying GdkAtom. -func (v Atom) native() C.GdkAtom { - return C.toGdkAtom(unsafe.Pointer(uintptr(v))) -} - -func (v Atom) Name() string { - c := C.gdk_atom_name(v.native()) - defer C.g_free(C.gpointer(c)) - return C.GoString((*C.char)(c)) -} - -// GdkAtomIntern is a wrapper around gdk_atom_intern -func GdkAtomIntern(atomName string, onlyIfExists bool) Atom { - cstr := C.CString(atomName) - defer C.free(unsafe.Pointer(cstr)) - c := C.gdk_atom_intern((*C.gchar)(cstr), gbool(onlyIfExists)) - return Atom(uintptr(unsafe.Pointer(c))) -} - -/* - * GdkDevice - */ - -// Device is a representation of GDK's GdkDevice. -type Device struct { - *glib.Object -} - -// native returns a pointer to the underlying GdkDevice. -func (v *Device) native() *C.GdkDevice { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGdkDevice(p) -} - -// Native returns a pointer to the underlying GdkDevice. -func (v *Device) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalDevice(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - return &Device{obj}, nil -} - -/* - * GdkCursor - */ - -// Cursor is a representation of GdkCursor. -type Cursor struct { - *glib.Object -} - -// CursorNewFromName is a wrapper around gdk_cursor_new_from_name(). -func CursorNewFromName(display *Display, name string) (*Cursor, error) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - c := C.gdk_cursor_new_from_name(display.native(), (*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - - return &Cursor{glib.Take(unsafe.Pointer(c))}, nil -} - -// native returns a pointer to the underlying GdkCursor. -func (v *Cursor) native() *C.GdkCursor { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGdkCursor(p) -} - -// Native returns a pointer to the underlying GdkCursor. -func (v *Cursor) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalCursor(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - return &Cursor{obj}, nil -} - -/* - * GdkDeviceManager - */ - -// DeviceManager is a representation of GDK's GdkDeviceManager. -type DeviceManager struct { - *glib.Object -} - -// native returns a pointer to the underlying GdkDeviceManager. -func (v *DeviceManager) native() *C.GdkDeviceManager { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGdkDeviceManager(p) -} - -// Native returns a pointer to the underlying GdkDeviceManager. -func (v *DeviceManager) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalDeviceManager(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - return &DeviceManager{obj}, nil -} - -// GetDisplay() is a wrapper around gdk_device_manager_get_display(). -func (v *DeviceManager) GetDisplay() (*Display, error) { - c := C.gdk_device_manager_get_display(v.native()) - if c == nil { - return nil, nilPtrErr - } - - return &Display{glib.Take(unsafe.Pointer(c))}, nil -} - -/* - * GdkDisplay - */ - -// Display is a representation of GDK's GdkDisplay. -type Display struct { - *glib.Object -} - -// native returns a pointer to the underlying GdkDisplay. -func (v *Display) native() *C.GdkDisplay { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGdkDisplay(p) -} - -// Native returns a pointer to the underlying GdkDisplay. -func (v *Display) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalDisplay(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - return &Display{obj}, nil -} - -func toDisplay(s *C.GdkDisplay) (*Display, error) { - if s == nil { - return nil, nilPtrErr - } - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(s))} - return &Display{obj}, nil -} - -// DisplayOpen() is a wrapper around gdk_display_open(). -func DisplayOpen(displayName string) (*Display, error) { - cstr := C.CString(displayName) - defer C.free(unsafe.Pointer(cstr)) - c := C.gdk_display_open((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - - return &Display{glib.Take(unsafe.Pointer(c))}, nil -} - -// DisplayGetDefault() is a wrapper around gdk_display_get_default(). -func DisplayGetDefault() (*Display, error) { - c := C.gdk_display_get_default() - if c == nil { - return nil, nilPtrErr - } - - return &Display{glib.Take(unsafe.Pointer(c))}, nil -} - -// GetName() is a wrapper around gdk_display_get_name(). -func (v *Display) GetName() (string, error) { - c := C.gdk_display_get_name(v.native()) - if c == nil { - return "", nilPtrErr - } - return C.GoString((*C.char)(c)), nil -} - -// GetDefaultScreen() is a wrapper around gdk_display_get_default_screen(). -func (v *Display) GetDefaultScreen() (*Screen, error) { - c := C.gdk_display_get_default_screen(v.native()) - if c == nil { - return nil, nilPtrErr - } - - return &Screen{glib.Take(unsafe.Pointer(c))}, nil -} - -// DeviceIsGrabbed() is a wrapper around gdk_display_device_is_grabbed(). -func (v *Display) DeviceIsGrabbed(device *Device) bool { - c := C.gdk_display_device_is_grabbed(v.native(), device.native()) - return gobool(c) -} - -// Beep() is a wrapper around gdk_display_beep(). -func (v *Display) Beep() { - C.gdk_display_beep(v.native()) -} - -// Sync() is a wrapper around gdk_display_sync(). -func (v *Display) Sync() { - C.gdk_display_sync(v.native()) -} - -// Flush() is a wrapper around gdk_display_flush(). -func (v *Display) Flush() { - C.gdk_display_flush(v.native()) -} - -// Close() is a wrapper around gdk_display_close(). -func (v *Display) Close() { - C.gdk_display_close(v.native()) -} - -// IsClosed() is a wrapper around gdk_display_is_closed(). -func (v *Display) IsClosed() bool { - c := C.gdk_display_is_closed(v.native()) - return gobool(c) -} - -// GetEvent() is a wrapper around gdk_display_get_event(). -func (v *Display) GetEvent() (*Event, error) { - c := C.gdk_display_get_event(v.native()) - if c == nil { - return nil, nilPtrErr - } - - //The finalizer is not on the glib.Object but on the event. - e := &Event{c} - runtime.SetFinalizer(e, (*Event).free) - return e, nil -} - -// PeekEvent() is a wrapper around gdk_display_peek_event(). -func (v *Display) PeekEvent() (*Event, error) { - c := C.gdk_display_peek_event(v.native()) - if c == nil { - return nil, nilPtrErr - } - - //The finalizer is not on the glib.Object but on the event. - e := &Event{c} - runtime.SetFinalizer(e, (*Event).free) - return e, nil -} - -// PutEvent() is a wrapper around gdk_display_put_event(). -func (v *Display) PutEvent(event *Event) { - C.gdk_display_put_event(v.native(), event.native()) -} - -// HasPending() is a wrapper around gdk_display_has_pending(). -func (v *Display) HasPending() bool { - c := C.gdk_display_has_pending(v.native()) - return gobool(c) -} - -// SetDoubleClickTime() is a wrapper around gdk_display_set_double_click_time(). -func (v *Display) SetDoubleClickTime(msec uint) { - C.gdk_display_set_double_click_time(v.native(), C.guint(msec)) -} - -// SetDoubleClickDistance() is a wrapper around gdk_display_set_double_click_distance(). -func (v *Display) SetDoubleClickDistance(distance uint) { - C.gdk_display_set_double_click_distance(v.native(), C.guint(distance)) -} - -// SupportsColorCursor() is a wrapper around gdk_display_supports_cursor_color(). -func (v *Display) SupportsColorCursor() bool { - c := C.gdk_display_supports_cursor_color(v.native()) - return gobool(c) -} - -// SupportsCursorAlpha() is a wrapper around gdk_display_supports_cursor_alpha(). -func (v *Display) SupportsCursorAlpha() bool { - c := C.gdk_display_supports_cursor_alpha(v.native()) - return gobool(c) -} - -// GetDefaultCursorSize() is a wrapper around gdk_display_get_default_cursor_size(). -func (v *Display) GetDefaultCursorSize() uint { - c := C.gdk_display_get_default_cursor_size(v.native()) - return uint(c) -} - -// GetMaximalCursorSize() is a wrapper around gdk_display_get_maximal_cursor_size(). -func (v *Display) GetMaximalCursorSize() (width, height uint) { - var w, h C.guint - C.gdk_display_get_maximal_cursor_size(v.native(), &w, &h) - return uint(w), uint(h) -} - -// GetDefaultGroup() is a wrapper around gdk_display_get_default_group(). -func (v *Display) GetDefaultGroup() (*Window, error) { - c := C.gdk_display_get_default_group(v.native()) - if c == nil { - return nil, nilPtrErr - } - - return &Window{glib.Take(unsafe.Pointer(c))}, nil -} - -// SupportsSelectionNotification() is a wrapper around -// gdk_display_supports_selection_notification(). -func (v *Display) SupportsSelectionNotification() bool { - c := C.gdk_display_supports_selection_notification(v.native()) - return gobool(c) -} - -// RequestSelectionNotification() is a wrapper around -// gdk_display_request_selection_notification(). -func (v *Display) RequestSelectionNotification(selection Atom) bool { - c := C.gdk_display_request_selection_notification(v.native(), - selection.native()) - return gobool(c) -} - -// SupportsClipboardPersistence() is a wrapper around -// gdk_display_supports_clipboard_persistence(). -func (v *Display) SupportsClipboardPersistence() bool { - c := C.gdk_display_supports_clipboard_persistence(v.native()) - return gobool(c) -} - -// TODO(jrick) -func (v *Display) StoreClipboard(clipboardWindow *Window, time uint32, targets ...Atom) { - panic("Not implemented") -} - -// SupportsShapes() is a wrapper around gdk_display_supports_shapes(). -func (v *Display) SupportsShapes() bool { - c := C.gdk_display_supports_shapes(v.native()) - return gobool(c) -} - -// SupportsInputShapes() is a wrapper around gdk_display_supports_input_shapes(). -func (v *Display) SupportsInputShapes() bool { - c := C.gdk_display_supports_input_shapes(v.native()) - return gobool(c) -} - -// TODO(jrick) glib.AppLaunchContext GdkAppLaunchContext -func (v *Display) GetAppLaunchContext() { - panic("Not implemented") -} - -// NotifyStartupComplete() is a wrapper around gdk_display_notify_startup_complete(). -func (v *Display) NotifyStartupComplete(startupID string) { - cstr := C.CString(startupID) - defer C.free(unsafe.Pointer(cstr)) - C.gdk_display_notify_startup_complete(v.native(), (*C.gchar)(cstr)) -} - -// EventType is a representation of GDK's GdkEventType. -// Do not confuse these event types with the signals that GTK+ widgets emit -type EventType int - -func marshalEventType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return EventType(c), nil -} - -const ( - EVENT_NOTHING EventType = C.GDK_NOTHING - EVENT_DELETE EventType = C.GDK_DELETE - EVENT_DESTROY EventType = C.GDK_DESTROY - EVENT_EXPOSE EventType = C.GDK_EXPOSE - EVENT_MOTION_NOTIFY EventType = C.GDK_MOTION_NOTIFY - EVENT_BUTTON_PRESS EventType = C.GDK_BUTTON_PRESS - EVENT_2BUTTON_PRESS EventType = C.GDK_2BUTTON_PRESS - EVENT_DOUBLE_BUTTON_PRESS EventType = C.GDK_DOUBLE_BUTTON_PRESS - EVENT_3BUTTON_PRESS EventType = C.GDK_3BUTTON_PRESS - EVENT_TRIPLE_BUTTON_PRESS EventType = C.GDK_TRIPLE_BUTTON_PRESS - EVENT_BUTTON_RELEASE EventType = C.GDK_BUTTON_RELEASE - EVENT_KEY_PRESS EventType = C.GDK_KEY_PRESS - EVENT_KEY_RELEASE EventType = C.GDK_KEY_RELEASE - EVENT_LEAVE_NOTIFY EventType = C.GDK_ENTER_NOTIFY - EVENT_FOCUS_CHANGE EventType = C.GDK_FOCUS_CHANGE - EVENT_CONFIGURE EventType = C.GDK_CONFIGURE - EVENT_MAP EventType = C.GDK_MAP - EVENT_UNMAP EventType = C.GDK_UNMAP - EVENT_PROPERTY_NOTIFY EventType = C.GDK_PROPERTY_NOTIFY - EVENT_SELECTION_CLEAR EventType = C.GDK_SELECTION_CLEAR - EVENT_SELECTION_REQUEST EventType = C.GDK_SELECTION_REQUEST - EVENT_SELECTION_NOTIFY EventType = C.GDK_SELECTION_NOTIFY - EVENT_PROXIMITY_IN EventType = C.GDK_PROXIMITY_IN - EVENT_PROXIMITY_OUT EventType = C.GDK_PROXIMITY_OUT - EVENT_DRAG_ENTER EventType = C.GDK_DRAG_ENTER - EVENT_DRAG_LEAVE EventType = C.GDK_DRAG_LEAVE - EVENT_DRAG_MOTION EventType = C.GDK_DRAG_MOTION - EVENT_DRAG_STATUS EventType = C.GDK_DRAG_STATUS - EVENT_DROP_START EventType = C.GDK_DROP_START - EVENT_DROP_FINISHED EventType = C.GDK_DROP_FINISHED - EVENT_CLIENT_EVENT EventType = C.GDK_CLIENT_EVENT - EVENT_VISIBILITY_NOTIFY EventType = C.GDK_VISIBILITY_NOTIFY - EVENT_SCROLL EventType = C.GDK_SCROLL - EVENT_WINDOW_STATE EventType = C.GDK_WINDOW_STATE - EVENT_SETTING EventType = C.GDK_SETTING - EVENT_OWNER_CHANGE EventType = C.GDK_OWNER_CHANGE - EVENT_GRAB_BROKEN EventType = C.GDK_GRAB_BROKEN - EVENT_DAMAGE EventType = C.GDK_DAMAGE - EVENT_TOUCH_BEGIN EventType = C.GDK_TOUCH_BEGIN - EVENT_TOUCH_UPDATE EventType = C.GDK_TOUCH_UPDATE - EVENT_TOUCH_END EventType = C.GDK_TOUCH_END - EVENT_TOUCH_CANCEL EventType = C.GDK_TOUCH_CANCEL - EVENT_LAST EventType = C.GDK_EVENT_LAST -) - -/* - * GDK Keyval - */ - -// KeyvalFromName() is a wrapper around gdk_keyval_from_name(). -func KeyvalFromName(keyvalName string) uint { - str := (*C.gchar)(C.CString(keyvalName)) - defer C.free(unsafe.Pointer(str)) - return uint(C.gdk_keyval_from_name(str)) -} - -func KeyvalConvertCase(v uint) (lower, upper uint) { - var l, u C.guint - l = 0 - u = 0 - C.gdk_keyval_convert_case(C.guint(v), &l, &u) - return uint(l), uint(u) -} - -func KeyvalIsLower(v uint) bool { - return gobool(C.gdk_keyval_is_lower(C.guint(v))) -} - -func KeyvalIsUpper(v uint) bool { - return gobool(C.gdk_keyval_is_upper(C.guint(v))) -} - -func KeyvalToLower(v uint) uint { - return uint(C.gdk_keyval_to_lower(C.guint(v))) -} - -func KeyvalToUpper(v uint) uint { - return uint(C.gdk_keyval_to_upper(C.guint(v))) -} - -func KeyvalToUnicode(v uint) rune { - return rune(C.gdk_keyval_to_unicode(C.guint(v))) -} - -func UnicodeToKeyval(v rune) uint { - return uint(C.gdk_unicode_to_keyval(C.guint32(v))) -} - -/* - * GdkDragContext - */ - -// DragContext is a representation of GDK's GdkDragContext. -type DragContext struct { - *glib.Object -} - -// native returns a pointer to the underlying GdkDragContext. -func (v *DragContext) native() *C.GdkDragContext { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGdkDragContext(p) -} - -// Native returns a pointer to the underlying GdkDragContext. -func (v *DragContext) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalDragContext(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - return &DragContext{obj}, nil -} - -func (v *DragContext) ListTargets() *glib.List { - c := C.gdk_drag_context_list_targets(v.native()) - return glib.WrapList(uintptr(unsafe.Pointer(c))) -} - -/* - * GdkEvent - */ - -// Event is a representation of GDK's GdkEvent. -type Event struct { - GdkEvent *C.GdkEvent -} - -// native returns a pointer to the underlying GdkEvent. -func (v *Event) native() *C.GdkEvent { - if v == nil { - return nil - } - return v.GdkEvent -} - -// Native returns a pointer to the underlying GdkEvent. -func (v *Event) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalEvent(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - return &Event{(*C.GdkEvent)(unsafe.Pointer(c))}, nil -} - -func (v *Event) free() { - C.gdk_event_free(v.native()) -} - -/* - * GdkEventButton - */ - -// EventButton is a representation of GDK's GdkEventButton. -type EventButton struct { - *Event -} - -func EventButtonNew() *EventButton { - ee := (*C.GdkEvent)(unsafe.Pointer(&C.GdkEventButton{})) - ev := Event{ee} - return &EventButton{&ev} -} - -// EventButtonNewFromEvent returns an EventButton from an Event. -// -// Using widget.Connect() for a key related signal such as -// "button-press-event" results in a *Event being passed as -// the callback's second argument. The argument is actually a -// *EventButton. EventButtonNewFromEvent provides a means of creating -// an EventKey from the Event. -func EventButtonNewFromEvent(event *Event) *EventButton { - ee := (*C.GdkEvent)(unsafe.Pointer(event.native())) - ev := Event{ee} - return &EventButton{&ev} -} - -// Native returns a pointer to the underlying GdkEventButton. -func (v *EventButton) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *EventButton) native() *C.GdkEventButton { - return (*C.GdkEventButton)(unsafe.Pointer(v.Event.native())) -} - -func (v *EventButton) X() float64 { - c := v.native().x - return float64(c) -} - -func (v *EventButton) Y() float64 { - c := v.native().y - return float64(c) -} - -// XRoot returns the x coordinate of the pointer relative to the root of the screen. -func (v *EventButton) XRoot() float64 { - c := v.native().x_root - return float64(c) -} - -// YRoot returns the y coordinate of the pointer relative to the root of the screen. -func (v *EventButton) YRoot() float64 { - c := v.native().y_root - return float64(c) -} - -func (v *EventButton) Button() uint { - c := v.native().button - return uint(c) -} - -func (v *EventButton) State() uint { - c := v.native().state - return uint(c) -} - -// Time returns the time of the event in milliseconds. -func (v *EventButton) Time() uint32 { - c := v.native().time - return uint32(c) -} - -func (v *EventButton) Type() EventType { - c := v.native()._type - return EventType(c) -} - -func (v *EventButton) MotionVal() (float64, float64) { - x := v.native().x - y := v.native().y - return float64(x), float64(y) -} - -func (v *EventButton) MotionValRoot() (float64, float64) { - x := v.native().x_root - y := v.native().y_root - return float64(x), float64(y) -} - -func (v *EventButton) ButtonVal() uint { - c := v.native().button - return uint(c) -} - -/* - * GdkEventKey - */ - -// EventKey is a representation of GDK's GdkEventKey. -type EventKey struct { - *Event -} - -func EventKeyNew() *EventKey { - ee := (*C.GdkEvent)(unsafe.Pointer(&C.GdkEventKey{})) - ev := Event{ee} - return &EventKey{&ev} -} - -// EventKeyNewFromEvent returns an EventKey from an Event. -// -// Using widget.Connect() for a key related signal such as -// "key-press-event" results in a *Event being passed as -// the callback's second argument. The argument is actually a -// *EventKey. EventKeyNewFromEvent provides a means of creating -// an EventKey from the Event. -func EventKeyNewFromEvent(event *Event) *EventKey { - ee := (*C.GdkEvent)(unsafe.Pointer(event.native())) - ev := Event{ee} - return &EventKey{&ev} -} - -// Native returns a pointer to the underlying GdkEventKey. -func (v *EventKey) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *EventKey) native() *C.GdkEventKey { - return (*C.GdkEventKey)(unsafe.Pointer(v.Event.native())) -} - -func (v *EventKey) KeyVal() uint { - c := v.native().keyval - return uint(c) -} - -func (v *EventKey) Type() EventType { - c := v.native()._type - return EventType(c) -} - -func (v *EventKey) State() uint { - c := v.native().state - return uint(c) -} - -/* - * GdkEventMotion - */ - -type EventMotion struct { - *Event -} - -func EventMotionNew() *EventMotion { - ee := (*C.GdkEvent)(unsafe.Pointer(&C.GdkEventMotion{})) - ev := Event{ee} - return &EventMotion{&ev} -} - -// EventMotionNewFromEvent returns an EventMotion from an Event. -// -// Using widget.Connect() for a key related signal such as -// "button-press-event" results in a *Event being passed as -// the callback's second argument. The argument is actually a -// *EventMotion. EventMotionNewFromEvent provides a means of creating -// an EventKey from the Event. -func EventMotionNewFromEvent(event *Event) *EventMotion { - ee := (*C.GdkEvent)(unsafe.Pointer(event.native())) - ev := Event{ee} - return &EventMotion{&ev} -} - -// Native returns a pointer to the underlying GdkEventMotion. -func (v *EventMotion) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *EventMotion) native() *C.GdkEventMotion { - return (*C.GdkEventMotion)(unsafe.Pointer(v.Event.native())) -} - -func (v *EventMotion) MotionVal() (float64, float64) { - x := v.native().x - y := v.native().y - return float64(x), float64(y) -} - -func (v *EventMotion) MotionValRoot() (float64, float64) { - x := v.native().x_root - y := v.native().y_root - return float64(x), float64(y) -} - -// Time returns the time of the event in milliseconds. -func (v *EventMotion) Time() uint32 { - c := v.native().time - return uint32(c) -} - -func (v *EventMotion) Type() EventType { - c := v.native()._type - return EventType(c) -} - -// A bit-mask representing the state of the modifier keys (e.g. Control, Shift -// and Alt) and the pointer buttons. See gdk.ModifierType constants. -func (v *EventMotion) State() ModifierType { - c := v.native().state - return ModifierType(c) -} - -/* - * GdkEventScroll - */ - -// EventScroll is a representation of GDK's GdkEventScroll. -type EventScroll struct { - *Event -} - -func EventScrollNew() *EventScroll { - ee := (*C.GdkEvent)(unsafe.Pointer(&C.GdkEventScroll{})) - ev := Event{ee} - return &EventScroll{&ev} -} - -// EventScrollNewFromEvent returns an EventScroll from an Event. -// -// Using widget.Connect() for a key related signal such as -// "button-press-event" results in a *Event being passed as -// the callback's second argument. The argument is actually a -// *EventScroll. EventScrollNewFromEvent provides a means of creating -// an EventKey from the Event. -func EventScrollNewFromEvent(event *Event) *EventScroll { - ee := (*C.GdkEvent)(unsafe.Pointer(event.native())) - ev := Event{ee} - return &EventScroll{&ev} -} - -// Native returns a pointer to the underlying GdkEventScroll. -func (v *EventScroll) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *EventScroll) native() *C.GdkEventScroll { - return (*C.GdkEventScroll)(unsafe.Pointer(v.Event.native())) -} - -func (v *EventScroll) DeltaX() float64 { - return float64(v.native().delta_x) -} - -func (v *EventScroll) DeltaY() float64 { - return float64(v.native().delta_y) -} - -func (v *EventScroll) X() float64 { - return float64(v.native().x) -} - -func (v *EventScroll) Y() float64 { - return float64(v.native().y) -} - -func (v *EventScroll) Type() EventType { - c := v.native()._type - return EventType(c) -} - -func (v *EventScroll) Direction() ScrollDirection { - c := v.native().direction - return ScrollDirection(c) -} - -/* - * GdkEventWindowState - */ - -// EventWindowState is a representation of GDK's GdkEventWindowState. -type EventWindowState struct { - *Event -} - -func EventWindowStateNew() *EventWindowState { - ee := (*C.GdkEvent)(unsafe.Pointer(&C.GdkEventWindowState{})) - ev := Event{ee} - return &EventWindowState{&ev} -} - -// EventWindowStateNewFromEvent returns an EventWindowState from an Event. -// -// Using widget.Connect() for the -// "window-state-event" signal results in a *Event being passed as -// the callback's second argument. The argument is actually a -// *EventWindowState. EventWindowStateNewFromEvent provides a means of creating -// an EventWindowState from the Event. -func EventWindowStateNewFromEvent(event *Event) *EventWindowState { - ee := (*C.GdkEvent)(unsafe.Pointer(event.native())) - ev := Event{ee} - return &EventWindowState{&ev} -} - -// Native returns a pointer to the underlying GdkEventWindowState. -func (v *EventWindowState) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *EventWindowState) native() *C.GdkEventWindowState { - return (*C.GdkEventWindowState)(unsafe.Pointer(v.Event.native())) -} - -func (v *EventWindowState) Type() EventType { - c := v.native()._type - return EventType(c) -} - -func (v *EventWindowState) ChangedMask() WindowState { - c := v.native().changed_mask - return WindowState(c) -} - -func (v *EventWindowState) NewWindowState() WindowState { - c := v.native().new_window_state - return WindowState(c) -} - -/* - * GdkGravity - */ -type GdkGravity int - -const ( - GDK_GRAVITY_NORTH_WEST = C.GDK_GRAVITY_NORTH_WEST - GDK_GRAVITY_NORTH = C.GDK_GRAVITY_NORTH - GDK_GRAVITY_NORTH_EAST = C.GDK_GRAVITY_NORTH_EAST - GDK_GRAVITY_WEST = C.GDK_GRAVITY_WEST - GDK_GRAVITY_CENTER = C.GDK_GRAVITY_CENTER - GDK_GRAVITY_EAST = C.GDK_GRAVITY_EAST - GDK_GRAVITY_SOUTH_WEST = C.GDK_GRAVITY_SOUTH_WEST - GDK_GRAVITY_SOUTH = C.GDK_GRAVITY_SOUTH - GDK_GRAVITY_SOUTH_EAST = C.GDK_GRAVITY_SOUTH_EAST - GDK_GRAVITY_STATIC = C.GDK_GRAVITY_STATIC -) - -/* - * GdkPixbuf - */ - -// Pixbuf is a representation of GDK's GdkPixbuf. -type Pixbuf struct { - *glib.Object -} - -// native returns a pointer to the underlying GdkPixbuf. -func (v *Pixbuf) native() *C.GdkPixbuf { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGdkPixbuf(p) -} - -// Native returns a pointer to the underlying GdkPixbuf. -func (v *Pixbuf) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *Pixbuf) NativePrivate() *C.GdkPixbuf { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGdkPixbuf(p) -} - -func marshalPixbuf(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - return &Pixbuf{obj}, nil -} - -// GetColorspace is a wrapper around gdk_pixbuf_get_colorspace(). -func (v *Pixbuf) GetColorspace() Colorspace { - c := C.gdk_pixbuf_get_colorspace(v.native()) - return Colorspace(c) -} - -// GetNChannels is a wrapper around gdk_pixbuf_get_n_channels(). -func (v *Pixbuf) GetNChannels() int { - c := C.gdk_pixbuf_get_n_channels(v.native()) - return int(c) -} - -// GetHasAlpha is a wrapper around gdk_pixbuf_get_has_alpha(). -func (v *Pixbuf) GetHasAlpha() bool { - c := C.gdk_pixbuf_get_has_alpha(v.native()) - return gobool(c) -} - -// GetBitsPerSample is a wrapper around gdk_pixbuf_get_bits_per_sample(). -func (v *Pixbuf) GetBitsPerSample() int { - c := C.gdk_pixbuf_get_bits_per_sample(v.native()) - return int(c) -} - -// GetPixels is a wrapper around gdk_pixbuf_get_pixels_with_length(). -// A Go slice is used to represent the underlying Pixbuf data array, one -// byte per channel. -func (v *Pixbuf) GetPixels() (channels []byte) { - var length C.guint - c := C.gdk_pixbuf_get_pixels_with_length(v.native(), &length) - sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&channels)) - sliceHeader.Data = uintptr(unsafe.Pointer(c)) - sliceHeader.Len = int(length) - sliceHeader.Cap = int(length) - - // To make sure the slice doesn't outlive the Pixbuf, add a reference - v.Ref() - runtime.SetFinalizer(&channels, func(_ *[]byte) { - v.Unref() - }) - return -} - -// GetWidth is a wrapper around gdk_pixbuf_get_width(). -func (v *Pixbuf) GetWidth() int { - c := C.gdk_pixbuf_get_width(v.native()) - return int(c) -} - -// GetHeight is a wrapper around gdk_pixbuf_get_height(). -func (v *Pixbuf) GetHeight() int { - c := C.gdk_pixbuf_get_height(v.native()) - return int(c) -} - -// GetRowstride is a wrapper around gdk_pixbuf_get_rowstride(). -func (v *Pixbuf) GetRowstride() int { - c := C.gdk_pixbuf_get_rowstride(v.native()) - return int(c) -} - -// GetByteLength is a wrapper around gdk_pixbuf_get_byte_length(). -func (v *Pixbuf) GetByteLength() int { - c := C.gdk_pixbuf_get_byte_length(v.native()) - return int(c) -} - -// GetOption is a wrapper around gdk_pixbuf_get_option(). ok is true if -// the key has an associated value. -func (v *Pixbuf) GetOption(key string) (value string, ok bool) { - cstr := C.CString(key) - defer C.free(unsafe.Pointer(cstr)) - c := C.gdk_pixbuf_get_option(v.native(), (*C.gchar)(cstr)) - if c == nil { - return "", false - } - return C.GoString((*C.char)(c)), true -} - -// PixbufNew is a wrapper around gdk_pixbuf_new(). -func PixbufNew(colorspace Colorspace, hasAlpha bool, bitsPerSample, width, height int) (*Pixbuf, error) { - c := C.gdk_pixbuf_new(C.GdkColorspace(colorspace), gbool(hasAlpha), - C.int(bitsPerSample), C.int(width), C.int(height)) - if c == nil { - return nil, nilPtrErr - } - - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - p := &Pixbuf{obj} - //obj.Ref() - runtime.SetFinalizer(p, func(_ interface{}) { obj.Unref() }) - return p, nil -} - -// PixbufCopy is a wrapper around gdk_pixbuf_copy(). -func PixbufCopy(v *Pixbuf) (*Pixbuf, error) { - c := C.gdk_pixbuf_copy(v.native()) - if c == nil { - return nil, nilPtrErr - } - - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - p := &Pixbuf{obj} - //obj.Ref() - runtime.SetFinalizer(p, func(_ interface{}) { obj.Unref() }) - return p, nil -} - -// PixbufNewFromFile is a wrapper around gdk_pixbuf_new_from_file(). -func PixbufNewFromFile(filename string) (*Pixbuf, error) { - cstr := C.CString(filename) - defer C.free(unsafe.Pointer(cstr)) - - var err *C.GError - c := C.gdk_pixbuf_new_from_file((*C.char)(cstr), &err) - if c == nil { - defer C.g_error_free(err) - return nil, errors.New(C.GoString((*C.char)(err.message))) - } - - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - p := &Pixbuf{obj} - //obj.Ref() - runtime.SetFinalizer(p, func(_ interface{}) { obj.Unref() }) - return p, nil -} - -// PixbufNewFromFileAtSize is a wrapper around gdk_pixbuf_new_from_file_at_size(). -func PixbufNewFromFileAtSize(filename string, width, height int) (*Pixbuf, error) { - cstr := C.CString(filename) - defer C.free(unsafe.Pointer(cstr)) - - var err *C.GError = nil - c := C.gdk_pixbuf_new_from_file_at_size(cstr, C.int(width), C.int(height), &err) - if err != nil { - defer C.g_error_free(err) - return nil, errors.New(C.GoString((*C.char)(err.message))) - } - - if c == nil { - return nil, nilPtrErr - } - - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - p := &Pixbuf{obj} - //obj.Ref() - runtime.SetFinalizer(p, func(_ interface{}) { obj.Unref() }) - return p, nil -} - -// PixbufNewFromFileAtScale is a wrapper around gdk_pixbuf_new_from_file_at_scale(). -func PixbufNewFromFileAtScale(filename string, width, height int, preserveAspectRatio bool) (*Pixbuf, error) { - cstr := C.CString(filename) - defer C.free(unsafe.Pointer(cstr)) - - var err *C.GError = nil - c := C.gdk_pixbuf_new_from_file_at_scale(cstr, C.int(width), C.int(height), - gbool(preserveAspectRatio), &err) - if err != nil { - defer C.g_error_free(err) - return nil, errors.New(C.GoString((*C.char)(err.message))) - } - - if c == nil { - return nil, nilPtrErr - } - - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - p := &Pixbuf{obj} - //obj.Ref() - runtime.SetFinalizer(p, func(_ interface{}) { obj.Unref() }) - return p, nil -} - -// ScaleSimple is a wrapper around gdk_pixbuf_scale_simple(). -func (v *Pixbuf) ScaleSimple(destWidth, destHeight int, interpType InterpType) (*Pixbuf, error) { - c := C.gdk_pixbuf_scale_simple(v.native(), C.int(destWidth), - C.int(destHeight), C.GdkInterpType(interpType)) - if c == nil { - return nil, nilPtrErr - } - - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - p := &Pixbuf{obj} - //obj.Ref() - runtime.SetFinalizer(p, func(_ interface{}) { obj.Unref() }) - return p, nil -} - -// RotateSimple is a wrapper around gdk_pixbuf_rotate_simple(). -func (v *Pixbuf) RotateSimple(angle PixbufRotation) (*Pixbuf, error) { - c := C.gdk_pixbuf_rotate_simple(v.native(), C.GdkPixbufRotation(angle)) - if c == nil { - return nil, nilPtrErr - } - - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - p := &Pixbuf{obj} - //obj.Ref() - runtime.SetFinalizer(p, func(_ interface{}) { obj.Unref() }) - return p, nil -} - -// ApplyEmbeddedOrientation is a wrapper around gdk_pixbuf_apply_embedded_orientation(). -func (v *Pixbuf) ApplyEmbeddedOrientation() (*Pixbuf, error) { - c := C.gdk_pixbuf_apply_embedded_orientation(v.native()) - if c == nil { - return nil, nilPtrErr - } - - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - p := &Pixbuf{obj} - //obj.Ref() - runtime.SetFinalizer(p, func(_ interface{}) { obj.Unref() }) - return p, nil -} - -// Flip is a wrapper around gdk_pixbuf_flip(). -func (v *Pixbuf) Flip(horizontal bool) (*Pixbuf, error) { - c := C.gdk_pixbuf_flip(v.native(), gbool(horizontal)) - if c == nil { - return nil, nilPtrErr - } - - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - p := &Pixbuf{obj} - //obj.Ref() - runtime.SetFinalizer(p, func(_ interface{}) { obj.Unref() }) - return p, nil -} - -// SaveJPEG is a wrapper around gdk_pixbuf_save(). -// Quality is a number between 0...100 -func (v *Pixbuf) SaveJPEG(path string, quality int) error { - cpath := C.CString(path) - cquality := C.CString(strconv.Itoa(quality)) - defer C.free(unsafe.Pointer(cpath)) - defer C.free(unsafe.Pointer(cquality)) - - var err *C.GError - c := C._gdk_pixbuf_save_jpeg(v.native(), cpath, &err, cquality) - if !gobool(c) { - defer C.g_error_free(err) - return errors.New(C.GoString((*C.char)(err.message))) - } - - return nil -} - -// SavePNG is a wrapper around gdk_pixbuf_save(). -// Compression is a number between 0...9 -func (v *Pixbuf) SavePNG(path string, compression int) error { - cpath := C.CString(path) - ccompression := C.CString(strconv.Itoa(compression)) - defer C.free(unsafe.Pointer(cpath)) - defer C.free(unsafe.Pointer(ccompression)) - - var err *C.GError - c := C._gdk_pixbuf_save_png(v.native(), cpath, &err, ccompression) - if !gobool(c) { - defer C.g_error_free(err) - return errors.New(C.GoString((*C.char)(err.message))) - } - return nil -} - -// PixbufGetFileInfo is a wrapper around gdk_pixbuf_get_file_info(). -// TODO: need to wrap the returned format to GdkPixbufFormat. -func PixbufGetFileInfo(filename string) (format interface{}, width, height int) { - cstr := C.CString(filename) - defer C.free(unsafe.Pointer(cstr)) - var cw, ch C.gint - format = C.gdk_pixbuf_get_file_info((*C.gchar)(cstr), &cw, &ch) - // TODO: need to wrap the returned format to GdkPixbufFormat. - return format, int(cw), int(ch) -} - -/* - * GdkPixbufLoader - */ - -// PixbufLoader is a representation of GDK's GdkPixbufLoader. -// Users of PixbufLoader are expected to call Close() when they are finished. -type PixbufLoader struct { - *glib.Object -} - -// native() returns a pointer to the underlying GdkPixbufLoader. -func (v *PixbufLoader) native() *C.GdkPixbufLoader { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGdkPixbufLoader(p) -} - -// PixbufLoaderNew() is a wrapper around gdk_pixbuf_loader_new(). -func PixbufLoaderNew() (*PixbufLoader, error) { - c := C.gdk_pixbuf_loader_new() - if c == nil { - return nil, nilPtrErr - } - - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - p := &PixbufLoader{obj} - obj.Ref() - runtime.SetFinalizer(p, func(_ interface{}) { obj.Unref() }) - return p, nil -} - -// PixbufLoaderNewWithType() is a wrapper around gdk_pixbuf_loader_new_with_type(). -func PixbufLoaderNewWithType(t string) (*PixbufLoader, error) { - var err *C.GError - - cstr := C.CString(t) - defer C.free(unsafe.Pointer(cstr)) - - c := C.gdk_pixbuf_loader_new_with_type((*C.char)(cstr), &err) - if err != nil { - defer C.g_error_free(err) - return nil, errors.New(C.GoString((*C.char)(err.message))) - } - - if c == nil { - return nil, nilPtrErr - } - - return &PixbufLoader{glib.Take(unsafe.Pointer(c))}, nil -} - -// Write() is a wrapper around gdk_pixbuf_loader_write(). The -// function signature differs from the C equivalent to satisify the -// io.Writer interface. -func (v *PixbufLoader) Write(data []byte) (int, error) { - // n is set to 0 on error, and set to len(data) otherwise. - // This is a tiny hacky to satisfy io.Writer and io.WriteCloser, - // which would allow access to all io and ioutil goodies, - // and play along nice with go environment. - - if len(data) == 0 { - return 0, nil - } - - var err *C.GError - c := C.gdk_pixbuf_loader_write(v.native(), - (*C.guchar)(unsafe.Pointer(&data[0])), C.gsize(len(data)), - &err) - - if !gobool(c) { - defer C.g_error_free(err) - return 0, errors.New(C.GoString((*C.char)(err.message))) - } - - return len(data), nil -} - -func (v *PixbufLoader) WriteAndReturnPixbuf(data []byte) (*Pixbuf, error) { - - if len(data) == 0 { - return nil, errors.New("no data") - } - - var err *C.GError - c := C.gdk_pixbuf_loader_write(v.native(), (*C.guchar)(unsafe.Pointer(&data[0])), C.gsize(len(data)), &err) - - if !gobool(c) { - defer C.g_error_free(err) - return nil, errors.New(C.GoString((*C.char)(err.message))) - } - - v.Close() - - c2 := C.gdk_pixbuf_loader_get_pixbuf(v.native()) - if c2 == nil { - return nil, nilPtrErr - } - - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c2))} - p := &Pixbuf{obj} - //obj.Ref() // Don't call Ref here, gdk_pixbuf_loader_get_pixbuf already did that for us. - runtime.SetFinalizer(p, func(_ interface{}) { obj.Unref() }) - - return p, nil -} - -// Close is a wrapper around gdk_pixbuf_loader_close(). An error is -// returned instead of a bool like the native C function to support the -// io.Closer interface. -func (v *PixbufLoader) Close() error { - var err *C.GError - - if ok := gobool(C.gdk_pixbuf_loader_close(v.native(), &err)); !ok { - defer C.g_error_free(err) - return errors.New(C.GoString((*C.char)(err.message))) - } - return nil -} - -// SetSize is a wrapper around gdk_pixbuf_loader_set_size(). -func (v *PixbufLoader) SetSize(width, height int) { - C.gdk_pixbuf_loader_set_size(v.native(), C.int(width), C.int(height)) -} - -// GetPixbuf is a wrapper around gdk_pixbuf_loader_get_pixbuf(). -func (v *PixbufLoader) GetPixbuf() (*Pixbuf, error) { - c := C.gdk_pixbuf_loader_get_pixbuf(v.native()) - if c == nil { - return nil, nilPtrErr - } - - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - p := &Pixbuf{obj} - //obj.Ref() // Don't call Ref here, gdk_pixbuf_loader_get_pixbuf already did that for us. - runtime.SetFinalizer(p, func(_ interface{}) { obj.Unref() }) - return p, nil -} - -type RGBA struct { - rgba *C.GdkRGBA -} - -func marshalRGBA(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - return WrapRGBA(unsafe.Pointer(c)), nil -} - -func WrapRGBA(p unsafe.Pointer) *RGBA { - return wrapRGBA((*C.GdkRGBA)(p)) -} - -func wrapRGBA(obj *C.GdkRGBA) *RGBA { - return &RGBA{obj} -} - -func NewRGBA(values ...float64) *RGBA { - cval := C.GdkRGBA{} - c := &RGBA{&cval} - if len(values) > 0 { - c.rgba.red = C.gdouble(values[0]) - } - if len(values) > 1 { - c.rgba.green = C.gdouble(values[1]) - } - if len(values) > 2 { - c.rgba.blue = C.gdouble(values[2]) - } - if len(values) > 3 { - c.rgba.alpha = C.gdouble(values[3]) - } - return c -} - -func (c *RGBA) Floats() []float64 { - return []float64{float64(c.rgba.red), float64(c.rgba.green), float64(c.rgba.blue), float64(c.rgba.alpha)} -} - -// SetColors sets all colors values in the RGBA. -func (c *RGBA) SetColors(r, g, b, a float64) { - c.rgba.red = C.gdouble(r) - c.rgba.green = C.gdouble(g) - c.rgba.blue = C.gdouble(b) - c.rgba.alpha = C.gdouble(a) -} - -func (v *RGBA) Native() uintptr { - return uintptr(unsafe.Pointer(v.rgba)) -} - -// Parse is a representation of gdk_rgba_parse(). -func (v *RGBA) Parse(spec string) bool { - cstr := (*C.gchar)(C.CString(spec)) - defer C.free(unsafe.Pointer(cstr)) - - return gobool(C.gdk_rgba_parse(v.rgba, cstr)) -} - -// String is a representation of gdk_rgba_to_string(). -func (v *RGBA) String() string { - return C.GoString((*C.char)(C.gdk_rgba_to_string(v.rgba))) -} - -// GdkRGBA * gdk_rgba_copy () -// void gdk_rgba_free () -// gboolean gdk_rgba_equal () -// guint gdk_rgba_hash () - -// PixbufGetType is a wrapper around gdk_pixbuf_get_type(). -func PixbufGetType() glib.Type { - return glib.Type(C.gdk_pixbuf_get_type()) -} - -/* - * GdkRectangle - */ - -// Rectangle is a representation of GDK's GdkRectangle type. -type Rectangle struct { - GdkRectangle C.GdkRectangle -} - -func WrapRectangle(p uintptr) *Rectangle { - return wrapRectangle((*C.GdkRectangle)(unsafe.Pointer(p))) -} - -func wrapRectangle(obj *C.GdkRectangle) *Rectangle { - if obj == nil { - return nil - } - return &Rectangle{*obj} -} - -// Native() returns a pointer to the underlying GdkRectangle. -func (r *Rectangle) native() *C.GdkRectangle { - return &r.GdkRectangle -} - -// GetX returns x field of the underlying GdkRectangle. -func (r *Rectangle) GetX() int { - return int(r.native().x) -} - -// GetY returns y field of the underlying GdkRectangle. -func (r *Rectangle) GetY() int { - return int(r.native().y) -} - -// GetWidth returns width field of the underlying GdkRectangle. -func (r *Rectangle) GetWidth() int { - return int(r.native().width) -} - -// GetHeight returns height field of the underlying GdkRectangle. -func (r *Rectangle) GetHeight() int { - return int(r.native().height) -} - -/* - * GdkVisual - */ - -// Visual is a representation of GDK's GdkVisual. -type Visual struct { - *glib.Object -} - -func (v *Visual) native() *C.GdkVisual { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGdkVisual(p) -} - -func (v *Visual) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalVisual(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - return &Visual{obj}, nil -} - -/* - * GdkWindow - */ - -// Window is a representation of GDK's GdkWindow. -type Window struct { - *glib.Object -} - -// SetCursor is a wrapper around gdk_window_set_cursor(). -func (v *Window) SetCursor(cursor *Cursor) { - C.gdk_window_set_cursor(v.native(), cursor.native()) -} - -// native returns a pointer to the underlying GdkWindow. -func (v *Window) native() *C.GdkWindow { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGdkWindow(p) -} - -// Native returns a pointer to the underlying GdkWindow. -func (v *Window) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalWindow(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - return &Window{obj}, nil -} - -func toWindow(s *C.GdkWindow) (*Window, error) { - if s == nil { - return nil, nilPtrErr - } - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(s))} - return &Window{obj}, nil -} diff --git a/vendor/github.com/gotk3/gotk3/gdk/gdk.go.h b/vendor/github.com/gotk3/gotk3/gdk/gdk.go.h deleted file mode 100644 index 940dac7..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/gdk.go.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> - * - * This file originated from: http://opensource.conformal.com/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <stdlib.h> - -// Type Casting -static GdkAtom -toGdkAtom(void *p) -{ - return ((GdkAtom)p); -} - -static GdkDevice * -toGdkDevice(void *p) -{ - return (GDK_DEVICE(p)); -} - -static GdkCursor * -toGdkCursor(void *p) -{ - return (GDK_CURSOR(p)); -} - -static GdkDeviceManager * -toGdkDeviceManager(void *p) -{ - return (GDK_DEVICE_MANAGER(p)); -} - -static GdkDisplay * -toGdkDisplay(void *p) -{ - return (GDK_DISPLAY(p)); -} - -static GdkDragContext * -toGdkDragContext(void *p) -{ - return (GDK_DRAG_CONTEXT(p)); -} - -static GdkPixbuf * -toGdkPixbuf(void *p) -{ - return (GDK_PIXBUF(p)); -} - -static gboolean -_gdk_pixbuf_save_png(GdkPixbuf *pixbuf, -const char *filename, GError ** err, const char *compression) -{ - return gdk_pixbuf_save(pixbuf, filename, "png", err, "compression", compression, NULL); -} - -static gboolean -_gdk_pixbuf_save_jpeg(GdkPixbuf *pixbuf, -const char *filename, GError ** err, const char *quality) -{ - return gdk_pixbuf_save(pixbuf, filename, "jpeg", err, "quality", quality, NULL); -} - -static GdkPixbufLoader * -toGdkPixbufLoader(void *p) -{ - return (GDK_PIXBUF_LOADER(p)); -} - -static GdkScreen * -toGdkScreen(void *p) -{ - return (GDK_SCREEN(p)); -} - -static GdkVisual * -toGdkVisual(void *p) -{ - return (GDK_VISUAL(p)); -} - -static GdkWindow * -toGdkWindow(void *p) -{ - return (GDK_WINDOW(p)); -} - -static inline gchar** next_gcharptr(gchar** s) { return (s+1); } diff --git a/vendor/github.com/gotk3/gotk3/gdk/gdk_deprecated_since_3_16.go b/vendor/github.com/gotk3/gotk3/gdk/gdk_deprecated_since_3_16.go deleted file mode 100644 index b2dd330..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/gdk_deprecated_since_3_16.go +++ /dev/null @@ -1,12 +0,0 @@ -//+build gtk_3_6 gtk_3_8 gtk_3_10 gtk_3_12 gtk_3_14 - -package gdk - -// #include <gdk/gdk.h> -import "C" - -// SupportsComposite() is a wrapper around gdk_display_supports_composite(). -func (v *Display) SupportsComposite() bool { - c := C.gdk_display_supports_composite(v.native()) - return gobool(c) -} diff --git a/vendor/github.com/gotk3/gotk3/gdk/gdk_deprecated_since_3_20.go b/vendor/github.com/gotk3/gotk3/gdk/gdk_deprecated_since_3_20.go deleted file mode 100644 index 66f444a..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/gdk_deprecated_since_3_20.go +++ /dev/null @@ -1,79 +0,0 @@ -//+build gtk_3_6 gtk_3_8 gtk_3_10 gtk_3_12 gtk_3_14 gtk_3_16 gtk_3_18 - -package gdk - -// #include <gdk/gdk.h> -import "C" -import ( - "runtime" - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -// 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) -} - -// GetClientPointer() is a wrapper around gdk_device_manager_get_client_pointer(). -func (v *DeviceManager) GetClientPointer() (*Device, error) { - c := C.gdk_device_manager_get_client_pointer(v.native()) - if c == nil { - return nil, nilPtrErr - } - - return &Device{glib.Take(unsafe.Pointer(c))}, nil -} - -// ListDevices() is a wrapper around gdk_device_manager_list_devices(). -func (v *DeviceManager) ListDevices(tp DeviceType) *glib.List { - clist := C.gdk_device_manager_list_devices(v.native(), C.GdkDeviceType(tp)) - if clist == nil { - return nil - } - - //TODO: WrapList should set the finalizer - glist := glib.WrapList(uintptr(unsafe.Pointer(clist))) - glist.DataWrapper(func(ptr unsafe.Pointer) interface{} { - return &Device{&glib.Object{glib.ToGObject(ptr)}} - }) - runtime.SetFinalizer(glist, func(glist *glib.List) { - glist.Free() - }) - return glist -} - -// Ungrab() is a wrapper around gdk_device_ungrab(). -func (v *Device) Ungrab(time uint32) { - C.gdk_device_ungrab(v.native(), C.guint32(time)) -} - -// GetDeviceManager() is a wrapper around gdk_display_get_device_manager(). -func (v *Display) GetDeviceManager() (*DeviceManager, error) { - c := C.gdk_display_get_device_manager(v.native()) - if c == nil { - return nil, nilPtrErr - } - - return &DeviceManager{glib.Take(unsafe.Pointer(c))}, nil -} - -// GetScreen() is a wrapper around gdk_display_get_screen(). -func (v *Display) GetScreen(screenNum int) (*Screen, error) { - c := C.gdk_display_get_screen(v.native(), C.gint(screenNum)) - if c == nil { - return nil, nilPtrErr - } - - return &Screen{glib.Take(unsafe.Pointer(c))}, nil -} diff --git a/vendor/github.com/gotk3/gotk3/gdk/gdk_deprecated_since_3_22.go b/vendor/github.com/gotk3/gotk3/gdk/gdk_deprecated_since_3_22.go deleted file mode 100644 index ce2b4e3..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/gdk_deprecated_since_3_22.go +++ /dev/null @@ -1,83 +0,0 @@ -//+build gtk_3_6 gtk_3_8 gtk_3_10 gtk_3_12 gtk_3_14 gtk_3_16 gtk_3_18 gtk_3_20 - -package gdk - -// #include <gdk/gdk.h> -import "C" - -// GetActiveWindow is a wrapper around gdk_screen_get_active_window(). -func (v *Screen) GetActiveWindow() (*Window, error) { - return toWindow(C.gdk_screen_get_active_window(v.native())) -} - -// GetHeight is a wrapper around gdk_screen_get_height(). -func (v *Screen) GetHeight() int { - c := C.gdk_screen_get_height(v.native()) - return int(c) -} - -// GetHeightMM is a wrapper around gdk_screen_get_height_mm(). -func (v *Screen) GetHeightMM() int { - return int(C.gdk_screen_get_height_mm(v.native())) -} - -// GetMonitorAtPoint is a wrapper around gdk_screen_get_monitor_at_point(). -func (v *Screen) GetMonitorAtPoint(x, y int) int { - return int(C.gdk_screen_get_monitor_at_point(v.native(), C.gint(x), C.gint(y))) -} - -// GetMonitorAtWindow is a wrapper around gdk_screen_get_monitor_at_window(). -func (v *Screen) GetMonitorAtWindow(w *Window) int { - return int(C.gdk_screen_get_monitor_at_window(v.native(), w.native())) -} - -// GetMonitorHeightMM is a wrapper around gdk_screen_get_monitor_height_mm(). -func (v *Screen) GetMonitorHeightMM(m int) int { - return int(C.gdk_screen_get_monitor_height_mm(v.native(), C.gint(m))) -} - -// GetMonitorPlugName is a wrapper around gdk_screen_get_monitor_plug_name(). -func (v *Screen) GetMonitorPlugName(m int) (string, error) { - return toString(C.gdk_screen_get_monitor_plug_name(v.native(), C.gint(m))) -} - -// GetMonitorScaleFactor is a wrapper around gdk_screen_get_monitor_scale_factor(). -func (v *Screen) GetMonitorScaleFactor(m int) int { - return int(C.gdk_screen_get_monitor_scale_factor(v.native(), C.gint(m))) -} - -// GetMonitorWidthMM is a wrapper around gdk_screen_get_monitor_width_mm(). -func (v *Screen) GetMonitorWidthMM(m int) int { - return int(C.gdk_screen_get_monitor_width_mm(v.native(), C.gint(m))) -} - -// GetNMonitors is a wrapper around gdk_screen_get_n_monitors(). -func (v *Screen) GetNMonitors() int { - return int(C.gdk_screen_get_n_monitors(v.native())) -} - -// GetNumber is a wrapper around gdk_screen_get_number(). -func (v *Screen) GetNumber() int { - return int(C.gdk_screen_get_number(v.native())) -} - -// GetPrimaryMonitor is a wrapper around gdk_screen_get_primary_monitor(). -func (v *Screen) GetPrimaryMonitor() int { - return int(C.gdk_screen_get_primary_monitor(v.native())) -} - -// GetWidth is a wrapper around gdk_screen_get_width(). -func (v *Screen) GetWidth() int { - c := C.gdk_screen_get_width(v.native()) - return int(c) -} - -// GetWidthMM is a wrapper around gdk_screen_get_width_mm(). -func (v *Screen) GetWidthMM() int { - return int(C.gdk_screen_get_width_mm(v.native())) -} - -// MakeDisplayName is a wrapper around gdk_screen_make_display_name(). -func (v *Screen) MakeDisplayName() (string, error) { - return toString(C.gdk_screen_make_display_name(v.native())) -} diff --git a/vendor/github.com/gotk3/gotk3/gdk/gdk_deprecated_since_3_8.go b/vendor/github.com/gotk3/gotk3/gdk/gdk_deprecated_since_3_8.go deleted file mode 100644 index 441afaf..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/gdk_deprecated_since_3_8.go +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// This file includes wrappers for symbols deprecated beginning with GTK 3.10, -// and should only be included in a build targeted intended to target GTK -// 3.8 or earlier. To target an earlier build build, use the build tag -// gtk_MAJOR_MINOR. For example, to target GTK 3.8, run -// 'go build -tags gtk_3_8'. -// +build gtk_3_6 gtk_3_8 - -package gdk - -// #include <gdk/gdk.h> -import "C" - -// GetNScreens is a wrapper around gdk_display_get_n_screens(). -func (v *Display) GetNScreens() int { - c := C.gdk_display_get_n_screens(v.native()) - return int(c) -} diff --git a/vendor/github.com/gotk3/gotk3/gdk/gdk_pixbuf_format.go b/vendor/github.com/gotk3/gotk3/gdk/gdk_pixbuf_format.go deleted file mode 100644 index 3bcb9b5..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/gdk_pixbuf_format.go +++ /dev/null @@ -1,89 +0,0 @@ -package gdk - -// #include <gdk/gdk.h> -// #include "gdk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -type PixbufFormat struct { - format *C.GdkPixbufFormat -} - -// native returns a pointer to the underlying GdkPixbuf. -func (v *PixbufFormat) native() *C.GdkPixbufFormat { - if v == nil { - return nil - } - - return v.format -} - -// Native returns a pointer to the underlying GdkPixbuf. -func (v *PixbufFormat) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (f *PixbufFormat) GetName() (string, error) { - c := C.gdk_pixbuf_format_get_name(f.native()) - return C.GoString((*C.char)(c)), nil -} - -func (f *PixbufFormat) GetDescription() (string, error) { - c := C.gdk_pixbuf_format_get_description(f.native()) - return C.GoString((*C.char)(c)), nil -} - -func (f *PixbufFormat) GetLicense() (string, error) { - c := C.gdk_pixbuf_format_get_license(f.native()) - return C.GoString((*C.char)(c)), nil -} - -// GetMimeTypes is a wrapper around gdk_pixbuf_format_get_mime_types(). -func (f *PixbufFormat) GetMimeTypes() []string { - var types []string - c := C.gdk_pixbuf_format_get_mime_types(f.native()) - if c == nil { - return nil - } - for *c != nil { - types = append(types, C.GoString((*C.char)(*c))) - c = C.next_gcharptr(c) - } - return types -} - -// GetExtensions is a wrapper around gdk_pixbuf_format_get_extensions(). -func (f *PixbufFormat) GetExtensions() []string { - var extensions []string - c := C.gdk_pixbuf_format_get_extensions(f.native()) - if c == nil { - return nil - } - for *c != nil { - extensions = append(extensions, C.GoString((*C.char)(*c))) - c = C.next_gcharptr(c) - } - return extensions -} - -func PixbufGetFormats() []*PixbufFormat { - l := (*C.struct__GSList)(C.gdk_pixbuf_get_formats()) - formats := glib.WrapSList(uintptr(unsafe.Pointer(l))) - if formats == nil { - return nil // no error. A nil list is considered to be empty. - } - - // "The structures themselves are owned by GdkPixbuf". Free the list only. - defer formats.Free() - - ret := make([]*PixbufFormat, 0, formats.Length()) - formats.Foreach(func(ptr unsafe.Pointer) { - ret = append(ret, &PixbufFormat{(*C.GdkPixbufFormat)(ptr)}) - }) - - return ret -} diff --git a/vendor/github.com/gotk3/gotk3/gdk/gdk_since_3_22.go b/vendor/github.com/gotk3/gotk3/gdk/gdk_since_3_22.go deleted file mode 100644 index 871eda0..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/gdk_since_3_22.go +++ /dev/null @@ -1,95 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12,!gtk_3_14,!gtk_3_16,!gtk_3_18,!gtk_3_20 -// Supports building with gtk 3.22+ - -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -package gdk - -// #include <gdk/gdk.h> -// #include "gdk_since_3_22.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -/* - * GdkDisplay - */ - -// GetNMonitors is a wrapper around gdk_display_get_n_monitors(). -func (v *Display) GetNMonitors() int { - c := C.gdk_display_get_n_monitors(v.native()) - return int(c) -} - -// GetPrimaryMonitor is a wrapper around gdk_display_get_primary_monitor(). -func (v *Display) GetPrimaryMonitor() (*Monitor, error) { - c := C.gdk_display_get_primary_monitor(v.native()) - if c == nil { - return nil, nilPtrErr - } - - return &Monitor{glib.Take(unsafe.Pointer(c))}, nil -} - -/* - * GdkMonitor - */ - -// Monitor is a representation of GDK's GdkMonitor. -type Monitor struct { - *glib.Object -} - -// native returns a pointer to the underlying GdkMonitor. -func (v *Monitor) native() *C.GdkMonitor { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGdkMonitor(p) -} - -// Native returns a pointer to the underlying GdkMonitor. -func (v *Monitor) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalMonitor(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - return &Monitor{obj}, nil -} - -func toMonitor(s *C.GdkMonitor) (*Monitor, error) { - if s == nil { - return nil, nilPtrErr - } - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(s))} - return &Monitor{obj}, nil -} - -// GetGeometry is a wrapper around gdk_monitor_get_geometry(). -func (v *Monitor) GetGeometry() *Rectangle { - var rect C.GdkRectangle - - C.gdk_monitor_get_geometry(v.native(), &rect) - - return WrapRectangle(uintptr(unsafe.Pointer(&rect))) -} diff --git a/vendor/github.com/gotk3/gotk3/gdk/gdk_since_3_22.go.h b/vendor/github.com/gotk3/gotk3/gdk/gdk_since_3_22.go.h deleted file mode 100644 index 478c1a1..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/gdk_since_3_22.go.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> - * - * This file originated from: http://opensource.conformal.com/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -//#include <stdlib.h> - -// Type Casting -static GdkMonitor * -toGdkMonitor(void *p) -{ - return (GDK_MONITOR(p)); -} diff --git a/vendor/github.com/gotk3/gotk3/gdk/keys.go b/vendor/github.com/gotk3/gotk3/gdk/keys.go deleted file mode 100644 index bd4536e..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/keys.go +++ /dev/null @@ -1,2278 +0,0 @@ -package gdk - -// #include <gdk/gdk.h> -// #include "gdk.go.h" -import "C" - -const ( - KEY_VoidSymbol = uint(C.GDK_KEY_VoidSymbol) - KEY_BackSpace = uint(C.GDK_KEY_BackSpace) - KEY_Tab = uint(C.GDK_KEY_Tab) - KEY_Linefeed = uint(C.GDK_KEY_Linefeed) - KEY_Clear = uint(C.GDK_KEY_Clear) - KEY_Return = uint(C.GDK_KEY_Return) - KEY_Pause = uint(C.GDK_KEY_Pause) - KEY_Scroll_Lock = uint(C.GDK_KEY_Scroll_Lock) - KEY_Sys_Req = uint(C.GDK_KEY_Sys_Req) - KEY_Escape = uint(C.GDK_KEY_Escape) - KEY_Delete = uint(C.GDK_KEY_Delete) - KEY_Multi_key = uint(C.GDK_KEY_Multi_key) - KEY_Codeinput = uint(C.GDK_KEY_Codeinput) - KEY_SingleCandidate = uint(C.GDK_KEY_SingleCandidate) - KEY_MultipleCandidate = uint(C.GDK_KEY_MultipleCandidate) - KEY_PreviousCandidate = uint(C.GDK_KEY_PreviousCandidate) - KEY_Kanji = uint(C.GDK_KEY_Kanji) - KEY_Muhenkan = uint(C.GDK_KEY_Muhenkan) - KEY_Henkan_Mode = uint(C.GDK_KEY_Henkan_Mode) - KEY_Henkan = uint(C.GDK_KEY_Henkan) - KEY_Romaji = uint(C.GDK_KEY_Romaji) - KEY_Hiragana = uint(C.GDK_KEY_Hiragana) - KEY_Katakana = uint(C.GDK_KEY_Katakana) - KEY_Hiragana_Katakana = uint(C.GDK_KEY_Hiragana_Katakana) - KEY_Zenkaku = uint(C.GDK_KEY_Zenkaku) - KEY_Hankaku = uint(C.GDK_KEY_Hankaku) - KEY_Zenkaku_Hankaku = uint(C.GDK_KEY_Zenkaku_Hankaku) - KEY_Touroku = uint(C.GDK_KEY_Touroku) - KEY_Massyo = uint(C.GDK_KEY_Massyo) - KEY_Kana_Lock = uint(C.GDK_KEY_Kana_Lock) - KEY_Kana_Shift = uint(C.GDK_KEY_Kana_Shift) - KEY_Eisu_Shift = uint(C.GDK_KEY_Eisu_Shift) - KEY_Eisu_toggle = uint(C.GDK_KEY_Eisu_toggle) - KEY_Kanji_Bangou = uint(C.GDK_KEY_Kanji_Bangou) - KEY_Zen_Koho = uint(C.GDK_KEY_Zen_Koho) - KEY_Mae_Koho = uint(C.GDK_KEY_Mae_Koho) - KEY_Home = uint(C.GDK_KEY_Home) - KEY_Left = uint(C.GDK_KEY_Left) - KEY_Up = uint(C.GDK_KEY_Up) - KEY_Right = uint(C.GDK_KEY_Right) - KEY_Down = uint(C.GDK_KEY_Down) - KEY_Prior = uint(C.GDK_KEY_Prior) - KEY_Page_Up = uint(C.GDK_KEY_Page_Up) - KEY_Next = uint(C.GDK_KEY_Next) - KEY_Page_Down = uint(C.GDK_KEY_Page_Down) - KEY_End = uint(C.GDK_KEY_End) - KEY_Begin = uint(C.GDK_KEY_Begin) - KEY_Select = uint(C.GDK_KEY_Select) - KEY_Print = uint(C.GDK_KEY_Print) - KEY_Execute = uint(C.GDK_KEY_Execute) - KEY_Insert = uint(C.GDK_KEY_Insert) - KEY_Undo = uint(C.GDK_KEY_Undo) - KEY_Redo = uint(C.GDK_KEY_Redo) - KEY_Menu = uint(C.GDK_KEY_Menu) - KEY_Find = uint(C.GDK_KEY_Find) - KEY_Cancel = uint(C.GDK_KEY_Cancel) - KEY_Help = uint(C.GDK_KEY_Help) - KEY_Break = uint(C.GDK_KEY_Break) - KEY_Mode_switch = uint(C.GDK_KEY_Mode_switch) - KEY_script_switch = uint(C.GDK_KEY_script_switch) - KEY_Num_Lock = uint(C.GDK_KEY_Num_Lock) - KEY_KP_Space = uint(C.GDK_KEY_KP_Space) - KEY_KP_Tab = uint(C.GDK_KEY_KP_Tab) - KEY_KP_Enter = uint(C.GDK_KEY_KP_Enter) - KEY_KP_F1 = uint(C.GDK_KEY_KP_F1) - KEY_KP_F2 = uint(C.GDK_KEY_KP_F2) - KEY_KP_F3 = uint(C.GDK_KEY_KP_F3) - KEY_KP_F4 = uint(C.GDK_KEY_KP_F4) - KEY_KP_Home = uint(C.GDK_KEY_KP_Home) - KEY_KP_Left = uint(C.GDK_KEY_KP_Left) - KEY_KP_Up = uint(C.GDK_KEY_KP_Up) - KEY_KP_Right = uint(C.GDK_KEY_KP_Right) - KEY_KP_Down = uint(C.GDK_KEY_KP_Down) - KEY_KP_Prior = uint(C.GDK_KEY_KP_Prior) - KEY_KP_Page_Up = uint(C.GDK_KEY_KP_Page_Up) - KEY_KP_Next = uint(C.GDK_KEY_KP_Next) - KEY_KP_Page_Down = uint(C.GDK_KEY_KP_Page_Down) - KEY_KP_End = uint(C.GDK_KEY_KP_End) - KEY_KP_Begin = uint(C.GDK_KEY_KP_Begin) - KEY_KP_Insert = uint(C.GDK_KEY_KP_Insert) - KEY_KP_Delete = uint(C.GDK_KEY_KP_Delete) - KEY_KP_Equal = uint(C.GDK_KEY_KP_Equal) - KEY_KP_Multiply = uint(C.GDK_KEY_KP_Multiply) - KEY_KP_Add = uint(C.GDK_KEY_KP_Add) - KEY_KP_Separator = uint(C.GDK_KEY_KP_Separator) - KEY_KP_Subtract = uint(C.GDK_KEY_KP_Subtract) - KEY_KP_Decimal = uint(C.GDK_KEY_KP_Decimal) - KEY_KP_Divide = uint(C.GDK_KEY_KP_Divide) - KEY_KP_0 = uint(C.GDK_KEY_KP_0) - KEY_KP_1 = uint(C.GDK_KEY_KP_1) - KEY_KP_2 = uint(C.GDK_KEY_KP_2) - KEY_KP_3 = uint(C.GDK_KEY_KP_3) - KEY_KP_4 = uint(C.GDK_KEY_KP_4) - KEY_KP_5 = uint(C.GDK_KEY_KP_5) - KEY_KP_6 = uint(C.GDK_KEY_KP_6) - KEY_KP_7 = uint(C.GDK_KEY_KP_7) - KEY_KP_8 = uint(C.GDK_KEY_KP_8) - KEY_KP_9 = uint(C.GDK_KEY_KP_9) - KEY_F1 = uint(C.GDK_KEY_F1) - KEY_F2 = uint(C.GDK_KEY_F2) - KEY_F3 = uint(C.GDK_KEY_F3) - KEY_F4 = uint(C.GDK_KEY_F4) - KEY_F5 = uint(C.GDK_KEY_F5) - KEY_F6 = uint(C.GDK_KEY_F6) - KEY_F7 = uint(C.GDK_KEY_F7) - KEY_F8 = uint(C.GDK_KEY_F8) - KEY_F9 = uint(C.GDK_KEY_F9) - KEY_F10 = uint(C.GDK_KEY_F10) - KEY_F11 = uint(C.GDK_KEY_F11) - KEY_L1 = uint(C.GDK_KEY_L1) - KEY_F12 = uint(C.GDK_KEY_F12) - KEY_L2 = uint(C.GDK_KEY_L2) - KEY_F13 = uint(C.GDK_KEY_F13) - KEY_L3 = uint(C.GDK_KEY_L3) - KEY_F14 = uint(C.GDK_KEY_F14) - KEY_L4 = uint(C.GDK_KEY_L4) - KEY_F15 = uint(C.GDK_KEY_F15) - KEY_L5 = uint(C.GDK_KEY_L5) - KEY_F16 = uint(C.GDK_KEY_F16) - KEY_L6 = uint(C.GDK_KEY_L6) - KEY_F17 = uint(C.GDK_KEY_F17) - KEY_L7 = uint(C.GDK_KEY_L7) - KEY_F18 = uint(C.GDK_KEY_F18) - KEY_L8 = uint(C.GDK_KEY_L8) - KEY_F19 = uint(C.GDK_KEY_F19) - KEY_L9 = uint(C.GDK_KEY_L9) - KEY_F20 = uint(C.GDK_KEY_F20) - KEY_L10 = uint(C.GDK_KEY_L10) - KEY_F21 = uint(C.GDK_KEY_F21) - KEY_R1 = uint(C.GDK_KEY_R1) - KEY_F22 = uint(C.GDK_KEY_F22) - KEY_R2 = uint(C.GDK_KEY_R2) - KEY_F23 = uint(C.GDK_KEY_F23) - KEY_R3 = uint(C.GDK_KEY_R3) - KEY_F24 = uint(C.GDK_KEY_F24) - KEY_R4 = uint(C.GDK_KEY_R4) - KEY_F25 = uint(C.GDK_KEY_F25) - KEY_R5 = uint(C.GDK_KEY_R5) - KEY_F26 = uint(C.GDK_KEY_F26) - KEY_R6 = uint(C.GDK_KEY_R6) - KEY_F27 = uint(C.GDK_KEY_F27) - KEY_R7 = uint(C.GDK_KEY_R7) - KEY_F28 = uint(C.GDK_KEY_F28) - KEY_R8 = uint(C.GDK_KEY_R8) - KEY_F29 = uint(C.GDK_KEY_F29) - KEY_R9 = uint(C.GDK_KEY_R9) - KEY_F30 = uint(C.GDK_KEY_F30) - KEY_R10 = uint(C.GDK_KEY_R10) - KEY_F31 = uint(C.GDK_KEY_F31) - KEY_R11 = uint(C.GDK_KEY_R11) - KEY_F32 = uint(C.GDK_KEY_F32) - KEY_R12 = uint(C.GDK_KEY_R12) - KEY_F33 = uint(C.GDK_KEY_F33) - KEY_R13 = uint(C.GDK_KEY_R13) - KEY_F34 = uint(C.GDK_KEY_F34) - KEY_R14 = uint(C.GDK_KEY_R14) - KEY_F35 = uint(C.GDK_KEY_F35) - KEY_R15 = uint(C.GDK_KEY_R15) - KEY_Shift_L = uint(C.GDK_KEY_Shift_L) - KEY_Shift_R = uint(C.GDK_KEY_Shift_R) - KEY_Control_L = uint(C.GDK_KEY_Control_L) - KEY_Control_R = uint(C.GDK_KEY_Control_R) - KEY_Caps_Lock = uint(C.GDK_KEY_Caps_Lock) - KEY_Shift_Lock = uint(C.GDK_KEY_Shift_Lock) - KEY_Meta_L = uint(C.GDK_KEY_Meta_L) - KEY_Meta_R = uint(C.GDK_KEY_Meta_R) - KEY_Alt_L = uint(C.GDK_KEY_Alt_L) - KEY_Alt_R = uint(C.GDK_KEY_Alt_R) - KEY_Super_L = uint(C.GDK_KEY_Super_L) - KEY_Super_R = uint(C.GDK_KEY_Super_R) - KEY_Hyper_L = uint(C.GDK_KEY_Hyper_L) - KEY_Hyper_R = uint(C.GDK_KEY_Hyper_R) - KEY_ISO_Lock = uint(C.GDK_KEY_ISO_Lock) - KEY_ISO_Level2_Latch = uint(C.GDK_KEY_ISO_Level2_Latch) - KEY_ISO_Level3_Shift = uint(C.GDK_KEY_ISO_Level3_Shift) - KEY_ISO_Level3_Latch = uint(C.GDK_KEY_ISO_Level3_Latch) - KEY_ISO_Level3_Lock = uint(C.GDK_KEY_ISO_Level3_Lock) - KEY_ISO_Level5_Shift = uint(C.GDK_KEY_ISO_Level5_Shift) - KEY_ISO_Level5_Latch = uint(C.GDK_KEY_ISO_Level5_Latch) - KEY_ISO_Level5_Lock = uint(C.GDK_KEY_ISO_Level5_Lock) - KEY_ISO_Group_Shift = uint(C.GDK_KEY_ISO_Group_Shift) - KEY_ISO_Group_Latch = uint(C.GDK_KEY_ISO_Group_Latch) - KEY_ISO_Group_Lock = uint(C.GDK_KEY_ISO_Group_Lock) - KEY_ISO_Next_Group = uint(C.GDK_KEY_ISO_Next_Group) - KEY_ISO_Next_Group_Lock = uint(C.GDK_KEY_ISO_Next_Group_Lock) - KEY_ISO_Prev_Group = uint(C.GDK_KEY_ISO_Prev_Group) - KEY_ISO_Prev_Group_Lock = uint(C.GDK_KEY_ISO_Prev_Group_Lock) - KEY_ISO_First_Group = uint(C.GDK_KEY_ISO_First_Group) - KEY_ISO_First_Group_Lock = uint(C.GDK_KEY_ISO_First_Group_Lock) - KEY_ISO_Last_Group = uint(C.GDK_KEY_ISO_Last_Group) - KEY_ISO_Last_Group_Lock = uint(C.GDK_KEY_ISO_Last_Group_Lock) - KEY_ISO_Left_Tab = uint(C.GDK_KEY_ISO_Left_Tab) - KEY_ISO_Move_Line_Up = uint(C.GDK_KEY_ISO_Move_Line_Up) - KEY_ISO_Move_Line_Down = uint(C.GDK_KEY_ISO_Move_Line_Down) - KEY_ISO_Partial_Line_Up = uint(C.GDK_KEY_ISO_Partial_Line_Up) - KEY_ISO_Partial_Line_Down = uint(C.GDK_KEY_ISO_Partial_Line_Down) - KEY_ISO_Partial_Space_Left = uint(C.GDK_KEY_ISO_Partial_Space_Left) - KEY_ISO_Partial_Space_Right = uint(C.GDK_KEY_ISO_Partial_Space_Right) - KEY_ISO_Set_Margin_Left = uint(C.GDK_KEY_ISO_Set_Margin_Left) - KEY_ISO_Set_Margin_Right = uint(C.GDK_KEY_ISO_Set_Margin_Right) - KEY_ISO_Release_Margin_Left = uint(C.GDK_KEY_ISO_Release_Margin_Left) - KEY_ISO_Release_Margin_Right = uint(C.GDK_KEY_ISO_Release_Margin_Right) - KEY_ISO_Release_Both_Margins = uint(C.GDK_KEY_ISO_Release_Both_Margins) - KEY_ISO_Fast_Cursor_Left = uint(C.GDK_KEY_ISO_Fast_Cursor_Left) - KEY_ISO_Fast_Cursor_Right = uint(C.GDK_KEY_ISO_Fast_Cursor_Right) - KEY_ISO_Fast_Cursor_Up = uint(C.GDK_KEY_ISO_Fast_Cursor_Up) - KEY_ISO_Fast_Cursor_Down = uint(C.GDK_KEY_ISO_Fast_Cursor_Down) - KEY_ISO_Continuous_Underline = uint(C.GDK_KEY_ISO_Continuous_Underline) - KEY_ISO_Discontinuous_Underline = uint(C.GDK_KEY_ISO_Discontinuous_Underline) - KEY_ISO_Emphasize = uint(C.GDK_KEY_ISO_Emphasize) - KEY_ISO_Center_Object = uint(C.GDK_KEY_ISO_Center_Object) - KEY_ISO_Enter = uint(C.GDK_KEY_ISO_Enter) - KEY_dead_grave = uint(C.GDK_KEY_dead_grave) - KEY_dead_acute = uint(C.GDK_KEY_dead_acute) - KEY_dead_circumflex = uint(C.GDK_KEY_dead_circumflex) - KEY_dead_tilde = uint(C.GDK_KEY_dead_tilde) - KEY_dead_perispomeni = uint(C.GDK_KEY_dead_perispomeni) - KEY_dead_macron = uint(C.GDK_KEY_dead_macron) - KEY_dead_breve = uint(C.GDK_KEY_dead_breve) - KEY_dead_abovedot = uint(C.GDK_KEY_dead_abovedot) - KEY_dead_diaeresis = uint(C.GDK_KEY_dead_diaeresis) - KEY_dead_abovering = uint(C.GDK_KEY_dead_abovering) - KEY_dead_doubleacute = uint(C.GDK_KEY_dead_doubleacute) - KEY_dead_caron = uint(C.GDK_KEY_dead_caron) - KEY_dead_cedilla = uint(C.GDK_KEY_dead_cedilla) - KEY_dead_ogonek = uint(C.GDK_KEY_dead_ogonek) - KEY_dead_iota = uint(C.GDK_KEY_dead_iota) - KEY_dead_voiced_sound = uint(C.GDK_KEY_dead_voiced_sound) - KEY_dead_semivoiced_sound = uint(C.GDK_KEY_dead_semivoiced_sound) - KEY_dead_belowdot = uint(C.GDK_KEY_dead_belowdot) - KEY_dead_hook = uint(C.GDK_KEY_dead_hook) - KEY_dead_horn = uint(C.GDK_KEY_dead_horn) - KEY_dead_stroke = uint(C.GDK_KEY_dead_stroke) - KEY_dead_abovecomma = uint(C.GDK_KEY_dead_abovecomma) - KEY_dead_psili = uint(C.GDK_KEY_dead_psili) - KEY_dead_abovereversedcomma = uint(C.GDK_KEY_dead_abovereversedcomma) - KEY_dead_dasia = uint(C.GDK_KEY_dead_dasia) - KEY_dead_doublegrave = uint(C.GDK_KEY_dead_doublegrave) - KEY_dead_belowring = uint(C.GDK_KEY_dead_belowring) - KEY_dead_belowmacron = uint(C.GDK_KEY_dead_belowmacron) - KEY_dead_belowcircumflex = uint(C.GDK_KEY_dead_belowcircumflex) - KEY_dead_belowtilde = uint(C.GDK_KEY_dead_belowtilde) - KEY_dead_belowbreve = uint(C.GDK_KEY_dead_belowbreve) - KEY_dead_belowdiaeresis = uint(C.GDK_KEY_dead_belowdiaeresis) - KEY_dead_invertedbreve = uint(C.GDK_KEY_dead_invertedbreve) - KEY_dead_belowcomma = uint(C.GDK_KEY_dead_belowcomma) - KEY_dead_currency = uint(C.GDK_KEY_dead_currency) - KEY_dead_a = uint(C.GDK_KEY_dead_a) - KEY_dead_A = uint(C.GDK_KEY_dead_A) - KEY_dead_e = uint(C.GDK_KEY_dead_e) - KEY_dead_E = uint(C.GDK_KEY_dead_E) - KEY_dead_i = uint(C.GDK_KEY_dead_i) - KEY_dead_I = uint(C.GDK_KEY_dead_I) - KEY_dead_o = uint(C.GDK_KEY_dead_o) - KEY_dead_O = uint(C.GDK_KEY_dead_O) - KEY_dead_u = uint(C.GDK_KEY_dead_u) - KEY_dead_U = uint(C.GDK_KEY_dead_U) - KEY_dead_small_schwa = uint(C.GDK_KEY_dead_small_schwa) - KEY_dead_capital_schwa = uint(C.GDK_KEY_dead_capital_schwa) - KEY_dead_greek = uint(C.GDK_KEY_dead_greek) - KEY_First_Virtual_Screen = uint(C.GDK_KEY_First_Virtual_Screen) - KEY_Prev_Virtual_Screen = uint(C.GDK_KEY_Prev_Virtual_Screen) - KEY_Next_Virtual_Screen = uint(C.GDK_KEY_Next_Virtual_Screen) - KEY_Last_Virtual_Screen = uint(C.GDK_KEY_Last_Virtual_Screen) - KEY_Terminate_Server = uint(C.GDK_KEY_Terminate_Server) - KEY_AccessX_Enable = uint(C.GDK_KEY_AccessX_Enable) - KEY_AccessX_Feedback_Enable = uint(C.GDK_KEY_AccessX_Feedback_Enable) - KEY_RepeatKeys_Enable = uint(C.GDK_KEY_RepeatKeys_Enable) - KEY_SlowKeys_Enable = uint(C.GDK_KEY_SlowKeys_Enable) - KEY_BounceKeys_Enable = uint(C.GDK_KEY_BounceKeys_Enable) - KEY_StickyKeys_Enable = uint(C.GDK_KEY_StickyKeys_Enable) - KEY_MouseKeys_Enable = uint(C.GDK_KEY_MouseKeys_Enable) - KEY_MouseKeys_Accel_Enable = uint(C.GDK_KEY_MouseKeys_Accel_Enable) - KEY_Overlay1_Enable = uint(C.GDK_KEY_Overlay1_Enable) - KEY_Overlay2_Enable = uint(C.GDK_KEY_Overlay2_Enable) - KEY_AudibleBell_Enable = uint(C.GDK_KEY_AudibleBell_Enable) - KEY_Pointer_Left = uint(C.GDK_KEY_Pointer_Left) - KEY_Pointer_Right = uint(C.GDK_KEY_Pointer_Right) - KEY_Pointer_Up = uint(C.GDK_KEY_Pointer_Up) - KEY_Pointer_Down = uint(C.GDK_KEY_Pointer_Down) - KEY_Pointer_UpLeft = uint(C.GDK_KEY_Pointer_UpLeft) - KEY_Pointer_UpRight = uint(C.GDK_KEY_Pointer_UpRight) - KEY_Pointer_DownLeft = uint(C.GDK_KEY_Pointer_DownLeft) - KEY_Pointer_DownRight = uint(C.GDK_KEY_Pointer_DownRight) - KEY_Pointer_Button_Dflt = uint(C.GDK_KEY_Pointer_Button_Dflt) - KEY_Pointer_Button1 = uint(C.GDK_KEY_Pointer_Button1) - KEY_Pointer_Button2 = uint(C.GDK_KEY_Pointer_Button2) - KEY_Pointer_Button3 = uint(C.GDK_KEY_Pointer_Button3) - KEY_Pointer_Button4 = uint(C.GDK_KEY_Pointer_Button4) - KEY_Pointer_Button5 = uint(C.GDK_KEY_Pointer_Button5) - KEY_Pointer_DblClick_Dflt = uint(C.GDK_KEY_Pointer_DblClick_Dflt) - KEY_Pointer_DblClick1 = uint(C.GDK_KEY_Pointer_DblClick1) - KEY_Pointer_DblClick2 = uint(C.GDK_KEY_Pointer_DblClick2) - KEY_Pointer_DblClick3 = uint(C.GDK_KEY_Pointer_DblClick3) - KEY_Pointer_DblClick4 = uint(C.GDK_KEY_Pointer_DblClick4) - KEY_Pointer_DblClick5 = uint(C.GDK_KEY_Pointer_DblClick5) - KEY_Pointer_Drag_Dflt = uint(C.GDK_KEY_Pointer_Drag_Dflt) - KEY_Pointer_Drag1 = uint(C.GDK_KEY_Pointer_Drag1) - KEY_Pointer_Drag2 = uint(C.GDK_KEY_Pointer_Drag2) - KEY_Pointer_Drag3 = uint(C.GDK_KEY_Pointer_Drag3) - KEY_Pointer_Drag4 = uint(C.GDK_KEY_Pointer_Drag4) - KEY_Pointer_Drag5 = uint(C.GDK_KEY_Pointer_Drag5) - KEY_Pointer_EnableKeys = uint(C.GDK_KEY_Pointer_EnableKeys) - KEY_Pointer_Accelerate = uint(C.GDK_KEY_Pointer_Accelerate) - KEY_Pointer_DfltBtnNext = uint(C.GDK_KEY_Pointer_DfltBtnNext) - KEY_Pointer_DfltBtnPrev = uint(C.GDK_KEY_Pointer_DfltBtnPrev) - KEY_ch = uint(C.GDK_KEY_ch) - KEY_Ch = uint(C.GDK_KEY_Ch) - KEY_CH = uint(C.GDK_KEY_CH) - KEY_c_h = uint(C.GDK_KEY_c_h) - KEY_C_h = uint(C.GDK_KEY_C_h) - KEY_C_H = uint(C.GDK_KEY_C_H) - KEY_3270_Duplicate = uint(C.GDK_KEY_3270_Duplicate) - KEY_3270_FieldMark = uint(C.GDK_KEY_3270_FieldMark) - KEY_3270_Right2 = uint(C.GDK_KEY_3270_Right2) - KEY_3270_Left2 = uint(C.GDK_KEY_3270_Left2) - KEY_3270_BackTab = uint(C.GDK_KEY_3270_BackTab) - KEY_3270_EraseEOF = uint(C.GDK_KEY_3270_EraseEOF) - KEY_3270_EraseInput = uint(C.GDK_KEY_3270_EraseInput) - KEY_3270_Reset = uint(C.GDK_KEY_3270_Reset) - KEY_3270_Quit = uint(C.GDK_KEY_3270_Quit) - KEY_3270_PA1 = uint(C.GDK_KEY_3270_PA1) - KEY_3270_PA2 = uint(C.GDK_KEY_3270_PA2) - KEY_3270_PA3 = uint(C.GDK_KEY_3270_PA3) - KEY_3270_Test = uint(C.GDK_KEY_3270_Test) - KEY_3270_Attn = uint(C.GDK_KEY_3270_Attn) - KEY_3270_CursorBlink = uint(C.GDK_KEY_3270_CursorBlink) - KEY_3270_AltCursor = uint(C.GDK_KEY_3270_AltCursor) - KEY_3270_KeyClick = uint(C.GDK_KEY_3270_KeyClick) - KEY_3270_Jump = uint(C.GDK_KEY_3270_Jump) - KEY_3270_Ident = uint(C.GDK_KEY_3270_Ident) - KEY_3270_Rule = uint(C.GDK_KEY_3270_Rule) - KEY_3270_Copy = uint(C.GDK_KEY_3270_Copy) - KEY_3270_Play = uint(C.GDK_KEY_3270_Play) - KEY_3270_Setup = uint(C.GDK_KEY_3270_Setup) - KEY_3270_Record = uint(C.GDK_KEY_3270_Record) - KEY_3270_ChangeScreen = uint(C.GDK_KEY_3270_ChangeScreen) - KEY_3270_DeleteWord = uint(C.GDK_KEY_3270_DeleteWord) - KEY_3270_ExSelect = uint(C.GDK_KEY_3270_ExSelect) - KEY_3270_CursorSelect = uint(C.GDK_KEY_3270_CursorSelect) - KEY_3270_PrintScreen = uint(C.GDK_KEY_3270_PrintScreen) - KEY_3270_Enter = uint(C.GDK_KEY_3270_Enter) - KEY_space = uint(C.GDK_KEY_space) - KEY_exclam = uint(C.GDK_KEY_exclam) - KEY_quotedbl = uint(C.GDK_KEY_quotedbl) - KEY_numbersign = uint(C.GDK_KEY_numbersign) - KEY_dollar = uint(C.GDK_KEY_dollar) - KEY_percent = uint(C.GDK_KEY_percent) - KEY_ampersand = uint(C.GDK_KEY_ampersand) - KEY_apostrophe = uint(C.GDK_KEY_apostrophe) - KEY_quoteright = uint(C.GDK_KEY_quoteright) - KEY_parenleft = uint(C.GDK_KEY_parenleft) - KEY_parenright = uint(C.GDK_KEY_parenright) - KEY_asterisk = uint(C.GDK_KEY_asterisk) - KEY_plus = uint(C.GDK_KEY_plus) - KEY_comma = uint(C.GDK_KEY_comma) - KEY_minus = uint(C.GDK_KEY_minus) - KEY_period = uint(C.GDK_KEY_period) - KEY_slash = uint(C.GDK_KEY_slash) - KEY_0 = uint(C.GDK_KEY_0) - KEY_1 = uint(C.GDK_KEY_1) - KEY_2 = uint(C.GDK_KEY_2) - KEY_3 = uint(C.GDK_KEY_3) - KEY_4 = uint(C.GDK_KEY_4) - KEY_5 = uint(C.GDK_KEY_5) - KEY_6 = uint(C.GDK_KEY_6) - KEY_7 = uint(C.GDK_KEY_7) - KEY_8 = uint(C.GDK_KEY_8) - KEY_9 = uint(C.GDK_KEY_9) - KEY_colon = uint(C.GDK_KEY_colon) - KEY_semicolon = uint(C.GDK_KEY_semicolon) - KEY_less = uint(C.GDK_KEY_less) - KEY_equal = uint(C.GDK_KEY_equal) - KEY_greater = uint(C.GDK_KEY_greater) - KEY_question = uint(C.GDK_KEY_question) - KEY_at = uint(C.GDK_KEY_at) - KEY_A = uint(C.GDK_KEY_A) - KEY_B = uint(C.GDK_KEY_B) - KEY_C = uint(C.GDK_KEY_C) - KEY_D = uint(C.GDK_KEY_D) - KEY_E = uint(C.GDK_KEY_E) - KEY_F = uint(C.GDK_KEY_F) - KEY_G = uint(C.GDK_KEY_G) - KEY_H = uint(C.GDK_KEY_H) - KEY_I = uint(C.GDK_KEY_I) - KEY_J = uint(C.GDK_KEY_J) - KEY_K = uint(C.GDK_KEY_K) - KEY_L = uint(C.GDK_KEY_L) - KEY_M = uint(C.GDK_KEY_M) - KEY_N = uint(C.GDK_KEY_N) - KEY_O = uint(C.GDK_KEY_O) - KEY_P = uint(C.GDK_KEY_P) - KEY_Q = uint(C.GDK_KEY_Q) - KEY_R = uint(C.GDK_KEY_R) - KEY_S = uint(C.GDK_KEY_S) - KEY_T = uint(C.GDK_KEY_T) - KEY_U = uint(C.GDK_KEY_U) - KEY_V = uint(C.GDK_KEY_V) - KEY_W = uint(C.GDK_KEY_W) - KEY_X = uint(C.GDK_KEY_X) - KEY_Y = uint(C.GDK_KEY_Y) - KEY_Z = uint(C.GDK_KEY_Z) - KEY_bracketleft = uint(C.GDK_KEY_bracketleft) - KEY_backslash = uint(C.GDK_KEY_backslash) - KEY_bracketright = uint(C.GDK_KEY_bracketright) - KEY_asciicircum = uint(C.GDK_KEY_asciicircum) - KEY_underscore = uint(C.GDK_KEY_underscore) - KEY_grave = uint(C.GDK_KEY_grave) - KEY_quoteleft = uint(C.GDK_KEY_quoteleft) - KEY_a = uint(C.GDK_KEY_a) - KEY_b = uint(C.GDK_KEY_b) - KEY_c = uint(C.GDK_KEY_c) - KEY_d = uint(C.GDK_KEY_d) - KEY_e = uint(C.GDK_KEY_e) - KEY_f = uint(C.GDK_KEY_f) - KEY_g = uint(C.GDK_KEY_g) - KEY_h = uint(C.GDK_KEY_h) - KEY_i = uint(C.GDK_KEY_i) - KEY_j = uint(C.GDK_KEY_j) - KEY_k = uint(C.GDK_KEY_k) - KEY_l = uint(C.GDK_KEY_l) - KEY_m = uint(C.GDK_KEY_m) - KEY_n = uint(C.GDK_KEY_n) - KEY_o = uint(C.GDK_KEY_o) - KEY_p = uint(C.GDK_KEY_p) - KEY_q = uint(C.GDK_KEY_q) - KEY_r = uint(C.GDK_KEY_r) - KEY_s = uint(C.GDK_KEY_s) - KEY_t = uint(C.GDK_KEY_t) - KEY_u = uint(C.GDK_KEY_u) - KEY_v = uint(C.GDK_KEY_v) - KEY_w = uint(C.GDK_KEY_w) - KEY_x = uint(C.GDK_KEY_x) - KEY_y = uint(C.GDK_KEY_y) - KEY_z = uint(C.GDK_KEY_z) - KEY_braceleft = uint(C.GDK_KEY_braceleft) - KEY_bar = uint(C.GDK_KEY_bar) - KEY_braceright = uint(C.GDK_KEY_braceright) - KEY_asciitilde = uint(C.GDK_KEY_asciitilde) - KEY_nobreakspace = uint(C.GDK_KEY_nobreakspace) - KEY_exclamdown = uint(C.GDK_KEY_exclamdown) - KEY_cent = uint(C.GDK_KEY_cent) - KEY_sterling = uint(C.GDK_KEY_sterling) - KEY_currency = uint(C.GDK_KEY_currency) - KEY_yen = uint(C.GDK_KEY_yen) - KEY_brokenbar = uint(C.GDK_KEY_brokenbar) - KEY_section = uint(C.GDK_KEY_section) - KEY_diaeresis = uint(C.GDK_KEY_diaeresis) - KEY_copyright = uint(C.GDK_KEY_copyright) - KEY_ordfeminine = uint(C.GDK_KEY_ordfeminine) - KEY_guillemotleft = uint(C.GDK_KEY_guillemotleft) - KEY_notsign = uint(C.GDK_KEY_notsign) - KEY_hyphen = uint(C.GDK_KEY_hyphen) - KEY_registered = uint(C.GDK_KEY_registered) - KEY_macron = uint(C.GDK_KEY_macron) - KEY_degree = uint(C.GDK_KEY_degree) - KEY_plusminus = uint(C.GDK_KEY_plusminus) - KEY_twosuperior = uint(C.GDK_KEY_twosuperior) - KEY_threesuperior = uint(C.GDK_KEY_threesuperior) - KEY_acute = uint(C.GDK_KEY_acute) - KEY_mu = uint(C.GDK_KEY_mu) - KEY_paragraph = uint(C.GDK_KEY_paragraph) - KEY_periodcentered = uint(C.GDK_KEY_periodcentered) - KEY_cedilla = uint(C.GDK_KEY_cedilla) - KEY_onesuperior = uint(C.GDK_KEY_onesuperior) - KEY_masculine = uint(C.GDK_KEY_masculine) - KEY_guillemotright = uint(C.GDK_KEY_guillemotright) - KEY_onequarter = uint(C.GDK_KEY_onequarter) - KEY_onehalf = uint(C.GDK_KEY_onehalf) - KEY_threequarters = uint(C.GDK_KEY_threequarters) - KEY_questiondown = uint(C.GDK_KEY_questiondown) - KEY_Agrave = uint(C.GDK_KEY_Agrave) - KEY_Aacute = uint(C.GDK_KEY_Aacute) - KEY_Acircumflex = uint(C.GDK_KEY_Acircumflex) - KEY_Atilde = uint(C.GDK_KEY_Atilde) - KEY_Adiaeresis = uint(C.GDK_KEY_Adiaeresis) - KEY_Aring = uint(C.GDK_KEY_Aring) - KEY_AE = uint(C.GDK_KEY_AE) - KEY_Ccedilla = uint(C.GDK_KEY_Ccedilla) - KEY_Egrave = uint(C.GDK_KEY_Egrave) - KEY_Eacute = uint(C.GDK_KEY_Eacute) - KEY_Ecircumflex = uint(C.GDK_KEY_Ecircumflex) - KEY_Ediaeresis = uint(C.GDK_KEY_Ediaeresis) - KEY_Igrave = uint(C.GDK_KEY_Igrave) - KEY_Iacute = uint(C.GDK_KEY_Iacute) - KEY_Icircumflex = uint(C.GDK_KEY_Icircumflex) - KEY_Idiaeresis = uint(C.GDK_KEY_Idiaeresis) - KEY_ETH = uint(C.GDK_KEY_ETH) - KEY_Eth = uint(C.GDK_KEY_Eth) - KEY_Ntilde = uint(C.GDK_KEY_Ntilde) - KEY_Ograve = uint(C.GDK_KEY_Ograve) - KEY_Oacute = uint(C.GDK_KEY_Oacute) - KEY_Ocircumflex = uint(C.GDK_KEY_Ocircumflex) - KEY_Otilde = uint(C.GDK_KEY_Otilde) - KEY_Odiaeresis = uint(C.GDK_KEY_Odiaeresis) - KEY_multiply = uint(C.GDK_KEY_multiply) - KEY_Oslash = uint(C.GDK_KEY_Oslash) - KEY_Ooblique = uint(C.GDK_KEY_Ooblique) - KEY_Ugrave = uint(C.GDK_KEY_Ugrave) - KEY_Uacute = uint(C.GDK_KEY_Uacute) - KEY_Ucircumflex = uint(C.GDK_KEY_Ucircumflex) - KEY_Udiaeresis = uint(C.GDK_KEY_Udiaeresis) - KEY_Yacute = uint(C.GDK_KEY_Yacute) - KEY_THORN = uint(C.GDK_KEY_THORN) - KEY_Thorn = uint(C.GDK_KEY_Thorn) - KEY_ssharp = uint(C.GDK_KEY_ssharp) - KEY_agrave = uint(C.GDK_KEY_agrave) - KEY_aacute = uint(C.GDK_KEY_aacute) - KEY_acircumflex = uint(C.GDK_KEY_acircumflex) - KEY_atilde = uint(C.GDK_KEY_atilde) - KEY_adiaeresis = uint(C.GDK_KEY_adiaeresis) - KEY_aring = uint(C.GDK_KEY_aring) - KEY_ae = uint(C.GDK_KEY_ae) - KEY_ccedilla = uint(C.GDK_KEY_ccedilla) - KEY_egrave = uint(C.GDK_KEY_egrave) - KEY_eacute = uint(C.GDK_KEY_eacute) - KEY_ecircumflex = uint(C.GDK_KEY_ecircumflex) - KEY_ediaeresis = uint(C.GDK_KEY_ediaeresis) - KEY_igrave = uint(C.GDK_KEY_igrave) - KEY_iacute = uint(C.GDK_KEY_iacute) - KEY_icircumflex = uint(C.GDK_KEY_icircumflex) - KEY_idiaeresis = uint(C.GDK_KEY_idiaeresis) - KEY_eth = uint(C.GDK_KEY_eth) - KEY_ntilde = uint(C.GDK_KEY_ntilde) - KEY_ograve = uint(C.GDK_KEY_ograve) - KEY_oacute = uint(C.GDK_KEY_oacute) - KEY_ocircumflex = uint(C.GDK_KEY_ocircumflex) - KEY_otilde = uint(C.GDK_KEY_otilde) - KEY_odiaeresis = uint(C.GDK_KEY_odiaeresis) - KEY_division = uint(C.GDK_KEY_division) - KEY_oslash = uint(C.GDK_KEY_oslash) - KEY_ooblique = uint(C.GDK_KEY_ooblique) - KEY_ugrave = uint(C.GDK_KEY_ugrave) - KEY_uacute = uint(C.GDK_KEY_uacute) - KEY_ucircumflex = uint(C.GDK_KEY_ucircumflex) - KEY_udiaeresis = uint(C.GDK_KEY_udiaeresis) - KEY_yacute = uint(C.GDK_KEY_yacute) - KEY_thorn = uint(C.GDK_KEY_thorn) - KEY_ydiaeresis = uint(C.GDK_KEY_ydiaeresis) - KEY_Aogonek = uint(C.GDK_KEY_Aogonek) - KEY_breve = uint(C.GDK_KEY_breve) - KEY_Lstroke = uint(C.GDK_KEY_Lstroke) - KEY_Lcaron = uint(C.GDK_KEY_Lcaron) - KEY_Sacute = uint(C.GDK_KEY_Sacute) - KEY_Scaron = uint(C.GDK_KEY_Scaron) - KEY_Scedilla = uint(C.GDK_KEY_Scedilla) - KEY_Tcaron = uint(C.GDK_KEY_Tcaron) - KEY_Zacute = uint(C.GDK_KEY_Zacute) - KEY_Zcaron = uint(C.GDK_KEY_Zcaron) - KEY_Zabovedot = uint(C.GDK_KEY_Zabovedot) - KEY_aogonek = uint(C.GDK_KEY_aogonek) - KEY_ogonek = uint(C.GDK_KEY_ogonek) - KEY_lstroke = uint(C.GDK_KEY_lstroke) - KEY_lcaron = uint(C.GDK_KEY_lcaron) - KEY_sacute = uint(C.GDK_KEY_sacute) - KEY_caron = uint(C.GDK_KEY_caron) - KEY_scaron = uint(C.GDK_KEY_scaron) - KEY_scedilla = uint(C.GDK_KEY_scedilla) - KEY_tcaron = uint(C.GDK_KEY_tcaron) - KEY_zacute = uint(C.GDK_KEY_zacute) - KEY_doubleacute = uint(C.GDK_KEY_doubleacute) - KEY_zcaron = uint(C.GDK_KEY_zcaron) - KEY_zabovedot = uint(C.GDK_KEY_zabovedot) - KEY_Racute = uint(C.GDK_KEY_Racute) - KEY_Abreve = uint(C.GDK_KEY_Abreve) - KEY_Lacute = uint(C.GDK_KEY_Lacute) - KEY_Cacute = uint(C.GDK_KEY_Cacute) - KEY_Ccaron = uint(C.GDK_KEY_Ccaron) - KEY_Eogonek = uint(C.GDK_KEY_Eogonek) - KEY_Ecaron = uint(C.GDK_KEY_Ecaron) - KEY_Dcaron = uint(C.GDK_KEY_Dcaron) - KEY_Dstroke = uint(C.GDK_KEY_Dstroke) - KEY_Nacute = uint(C.GDK_KEY_Nacute) - KEY_Ncaron = uint(C.GDK_KEY_Ncaron) - KEY_Odoubleacute = uint(C.GDK_KEY_Odoubleacute) - KEY_Rcaron = uint(C.GDK_KEY_Rcaron) - KEY_Uring = uint(C.GDK_KEY_Uring) - KEY_Udoubleacute = uint(C.GDK_KEY_Udoubleacute) - KEY_Tcedilla = uint(C.GDK_KEY_Tcedilla) - KEY_racute = uint(C.GDK_KEY_racute) - KEY_abreve = uint(C.GDK_KEY_abreve) - KEY_lacute = uint(C.GDK_KEY_lacute) - KEY_cacute = uint(C.GDK_KEY_cacute) - KEY_ccaron = uint(C.GDK_KEY_ccaron) - KEY_eogonek = uint(C.GDK_KEY_eogonek) - KEY_ecaron = uint(C.GDK_KEY_ecaron) - KEY_dcaron = uint(C.GDK_KEY_dcaron) - KEY_dstroke = uint(C.GDK_KEY_dstroke) - KEY_nacute = uint(C.GDK_KEY_nacute) - KEY_ncaron = uint(C.GDK_KEY_ncaron) - KEY_odoubleacute = uint(C.GDK_KEY_odoubleacute) - KEY_rcaron = uint(C.GDK_KEY_rcaron) - KEY_uring = uint(C.GDK_KEY_uring) - KEY_udoubleacute = uint(C.GDK_KEY_udoubleacute) - KEY_tcedilla = uint(C.GDK_KEY_tcedilla) - KEY_abovedot = uint(C.GDK_KEY_abovedot) - KEY_Hstroke = uint(C.GDK_KEY_Hstroke) - KEY_Hcircumflex = uint(C.GDK_KEY_Hcircumflex) - KEY_Iabovedot = uint(C.GDK_KEY_Iabovedot) - KEY_Gbreve = uint(C.GDK_KEY_Gbreve) - KEY_Jcircumflex = uint(C.GDK_KEY_Jcircumflex) - KEY_hstroke = uint(C.GDK_KEY_hstroke) - KEY_hcircumflex = uint(C.GDK_KEY_hcircumflex) - KEY_idotless = uint(C.GDK_KEY_idotless) - KEY_gbreve = uint(C.GDK_KEY_gbreve) - KEY_jcircumflex = uint(C.GDK_KEY_jcircumflex) - KEY_Cabovedot = uint(C.GDK_KEY_Cabovedot) - KEY_Ccircumflex = uint(C.GDK_KEY_Ccircumflex) - KEY_Gabovedot = uint(C.GDK_KEY_Gabovedot) - KEY_Gcircumflex = uint(C.GDK_KEY_Gcircumflex) - KEY_Ubreve = uint(C.GDK_KEY_Ubreve) - KEY_Scircumflex = uint(C.GDK_KEY_Scircumflex) - KEY_cabovedot = uint(C.GDK_KEY_cabovedot) - KEY_ccircumflex = uint(C.GDK_KEY_ccircumflex) - KEY_gabovedot = uint(C.GDK_KEY_gabovedot) - KEY_gcircumflex = uint(C.GDK_KEY_gcircumflex) - KEY_ubreve = uint(C.GDK_KEY_ubreve) - KEY_scircumflex = uint(C.GDK_KEY_scircumflex) - KEY_kra = uint(C.GDK_KEY_kra) - KEY_kappa = uint(C.GDK_KEY_kappa) - KEY_Rcedilla = uint(C.GDK_KEY_Rcedilla) - KEY_Itilde = uint(C.GDK_KEY_Itilde) - KEY_Lcedilla = uint(C.GDK_KEY_Lcedilla) - KEY_Emacron = uint(C.GDK_KEY_Emacron) - KEY_Gcedilla = uint(C.GDK_KEY_Gcedilla) - KEY_Tslash = uint(C.GDK_KEY_Tslash) - KEY_rcedilla = uint(C.GDK_KEY_rcedilla) - KEY_itilde = uint(C.GDK_KEY_itilde) - KEY_lcedilla = uint(C.GDK_KEY_lcedilla) - KEY_emacron = uint(C.GDK_KEY_emacron) - KEY_gcedilla = uint(C.GDK_KEY_gcedilla) - KEY_tslash = uint(C.GDK_KEY_tslash) - KEY_ENG = uint(C.GDK_KEY_ENG) - KEY_eng = uint(C.GDK_KEY_eng) - KEY_Amacron = uint(C.GDK_KEY_Amacron) - KEY_Iogonek = uint(C.GDK_KEY_Iogonek) - KEY_Eabovedot = uint(C.GDK_KEY_Eabovedot) - KEY_Imacron = uint(C.GDK_KEY_Imacron) - KEY_Ncedilla = uint(C.GDK_KEY_Ncedilla) - KEY_Omacron = uint(C.GDK_KEY_Omacron) - KEY_Kcedilla = uint(C.GDK_KEY_Kcedilla) - KEY_Uogonek = uint(C.GDK_KEY_Uogonek) - KEY_Utilde = uint(C.GDK_KEY_Utilde) - KEY_Umacron = uint(C.GDK_KEY_Umacron) - KEY_amacron = uint(C.GDK_KEY_amacron) - KEY_iogonek = uint(C.GDK_KEY_iogonek) - KEY_eabovedot = uint(C.GDK_KEY_eabovedot) - KEY_imacron = uint(C.GDK_KEY_imacron) - KEY_ncedilla = uint(C.GDK_KEY_ncedilla) - KEY_omacron = uint(C.GDK_KEY_omacron) - KEY_kcedilla = uint(C.GDK_KEY_kcedilla) - KEY_uogonek = uint(C.GDK_KEY_uogonek) - KEY_utilde = uint(C.GDK_KEY_utilde) - KEY_umacron = uint(C.GDK_KEY_umacron) - KEY_Wcircumflex = uint(C.GDK_KEY_Wcircumflex) - KEY_wcircumflex = uint(C.GDK_KEY_wcircumflex) - KEY_Ycircumflex = uint(C.GDK_KEY_Ycircumflex) - KEY_ycircumflex = uint(C.GDK_KEY_ycircumflex) - KEY_Babovedot = uint(C.GDK_KEY_Babovedot) - KEY_babovedot = uint(C.GDK_KEY_babovedot) - KEY_Dabovedot = uint(C.GDK_KEY_Dabovedot) - KEY_dabovedot = uint(C.GDK_KEY_dabovedot) - KEY_Fabovedot = uint(C.GDK_KEY_Fabovedot) - KEY_fabovedot = uint(C.GDK_KEY_fabovedot) - KEY_Mabovedot = uint(C.GDK_KEY_Mabovedot) - KEY_mabovedot = uint(C.GDK_KEY_mabovedot) - KEY_Pabovedot = uint(C.GDK_KEY_Pabovedot) - KEY_pabovedot = uint(C.GDK_KEY_pabovedot) - KEY_Sabovedot = uint(C.GDK_KEY_Sabovedot) - KEY_sabovedot = uint(C.GDK_KEY_sabovedot) - KEY_Tabovedot = uint(C.GDK_KEY_Tabovedot) - KEY_tabovedot = uint(C.GDK_KEY_tabovedot) - KEY_Wgrave = uint(C.GDK_KEY_Wgrave) - KEY_wgrave = uint(C.GDK_KEY_wgrave) - KEY_Wacute = uint(C.GDK_KEY_Wacute) - KEY_wacute = uint(C.GDK_KEY_wacute) - KEY_Wdiaeresis = uint(C.GDK_KEY_Wdiaeresis) - KEY_wdiaeresis = uint(C.GDK_KEY_wdiaeresis) - KEY_Ygrave = uint(C.GDK_KEY_Ygrave) - KEY_ygrave = uint(C.GDK_KEY_ygrave) - KEY_OE = uint(C.GDK_KEY_OE) - KEY_oe = uint(C.GDK_KEY_oe) - KEY_Ydiaeresis = uint(C.GDK_KEY_Ydiaeresis) - KEY_overline = uint(C.GDK_KEY_overline) - KEY_kana_fullstop = uint(C.GDK_KEY_kana_fullstop) - KEY_kana_openingbracket = uint(C.GDK_KEY_kana_openingbracket) - KEY_kana_closingbracket = uint(C.GDK_KEY_kana_closingbracket) - KEY_kana_comma = uint(C.GDK_KEY_kana_comma) - KEY_kana_conjunctive = uint(C.GDK_KEY_kana_conjunctive) - KEY_kana_middledot = uint(C.GDK_KEY_kana_middledot) - KEY_kana_WO = uint(C.GDK_KEY_kana_WO) - KEY_kana_a = uint(C.GDK_KEY_kana_a) - KEY_kana_i = uint(C.GDK_KEY_kana_i) - KEY_kana_u = uint(C.GDK_KEY_kana_u) - KEY_kana_e = uint(C.GDK_KEY_kana_e) - KEY_kana_o = uint(C.GDK_KEY_kana_o) - KEY_kana_ya = uint(C.GDK_KEY_kana_ya) - KEY_kana_yu = uint(C.GDK_KEY_kana_yu) - KEY_kana_yo = uint(C.GDK_KEY_kana_yo) - KEY_kana_tsu = uint(C.GDK_KEY_kana_tsu) - KEY_kana_tu = uint(C.GDK_KEY_kana_tu) - KEY_prolongedsound = uint(C.GDK_KEY_prolongedsound) - KEY_kana_A = uint(C.GDK_KEY_kana_A) - KEY_kana_I = uint(C.GDK_KEY_kana_I) - KEY_kana_U = uint(C.GDK_KEY_kana_U) - KEY_kana_E = uint(C.GDK_KEY_kana_E) - KEY_kana_O = uint(C.GDK_KEY_kana_O) - KEY_kana_KA = uint(C.GDK_KEY_kana_KA) - KEY_kana_KI = uint(C.GDK_KEY_kana_KI) - KEY_kana_KU = uint(C.GDK_KEY_kana_KU) - KEY_kana_KE = uint(C.GDK_KEY_kana_KE) - KEY_kana_KO = uint(C.GDK_KEY_kana_KO) - KEY_kana_SA = uint(C.GDK_KEY_kana_SA) - KEY_kana_SHI = uint(C.GDK_KEY_kana_SHI) - KEY_kana_SU = uint(C.GDK_KEY_kana_SU) - KEY_kana_SE = uint(C.GDK_KEY_kana_SE) - KEY_kana_SO = uint(C.GDK_KEY_kana_SO) - KEY_kana_TA = uint(C.GDK_KEY_kana_TA) - KEY_kana_CHI = uint(C.GDK_KEY_kana_CHI) - KEY_kana_TI = uint(C.GDK_KEY_kana_TI) - KEY_kana_TSU = uint(C.GDK_KEY_kana_TSU) - KEY_kana_TU = uint(C.GDK_KEY_kana_TU) - KEY_kana_TE = uint(C.GDK_KEY_kana_TE) - KEY_kana_TO = uint(C.GDK_KEY_kana_TO) - KEY_kana_NA = uint(C.GDK_KEY_kana_NA) - KEY_kana_NI = uint(C.GDK_KEY_kana_NI) - KEY_kana_NU = uint(C.GDK_KEY_kana_NU) - KEY_kana_NE = uint(C.GDK_KEY_kana_NE) - KEY_kana_NO = uint(C.GDK_KEY_kana_NO) - KEY_kana_HA = uint(C.GDK_KEY_kana_HA) - KEY_kana_HI = uint(C.GDK_KEY_kana_HI) - KEY_kana_FU = uint(C.GDK_KEY_kana_FU) - KEY_kana_HU = uint(C.GDK_KEY_kana_HU) - KEY_kana_HE = uint(C.GDK_KEY_kana_HE) - KEY_kana_HO = uint(C.GDK_KEY_kana_HO) - KEY_kana_MA = uint(C.GDK_KEY_kana_MA) - KEY_kana_MI = uint(C.GDK_KEY_kana_MI) - KEY_kana_MU = uint(C.GDK_KEY_kana_MU) - KEY_kana_ME = uint(C.GDK_KEY_kana_ME) - KEY_kana_MO = uint(C.GDK_KEY_kana_MO) - KEY_kana_YA = uint(C.GDK_KEY_kana_YA) - KEY_kana_YU = uint(C.GDK_KEY_kana_YU) - KEY_kana_YO = uint(C.GDK_KEY_kana_YO) - KEY_kana_RA = uint(C.GDK_KEY_kana_RA) - KEY_kana_RI = uint(C.GDK_KEY_kana_RI) - KEY_kana_RU = uint(C.GDK_KEY_kana_RU) - KEY_kana_RE = uint(C.GDK_KEY_kana_RE) - KEY_kana_RO = uint(C.GDK_KEY_kana_RO) - KEY_kana_WA = uint(C.GDK_KEY_kana_WA) - KEY_kana_N = uint(C.GDK_KEY_kana_N) - KEY_voicedsound = uint(C.GDK_KEY_voicedsound) - KEY_semivoicedsound = uint(C.GDK_KEY_semivoicedsound) - KEY_kana_switch = uint(C.GDK_KEY_kana_switch) - KEY_Farsi_0 = uint(C.GDK_KEY_Farsi_0) - KEY_Farsi_1 = uint(C.GDK_KEY_Farsi_1) - KEY_Farsi_2 = uint(C.GDK_KEY_Farsi_2) - KEY_Farsi_3 = uint(C.GDK_KEY_Farsi_3) - KEY_Farsi_4 = uint(C.GDK_KEY_Farsi_4) - KEY_Farsi_5 = uint(C.GDK_KEY_Farsi_5) - KEY_Farsi_6 = uint(C.GDK_KEY_Farsi_6) - KEY_Farsi_7 = uint(C.GDK_KEY_Farsi_7) - KEY_Farsi_8 = uint(C.GDK_KEY_Farsi_8) - KEY_Farsi_9 = uint(C.GDK_KEY_Farsi_9) - KEY_Arabic_percent = uint(C.GDK_KEY_Arabic_percent) - KEY_Arabic_superscript_alef = uint(C.GDK_KEY_Arabic_superscript_alef) - KEY_Arabic_tteh = uint(C.GDK_KEY_Arabic_tteh) - KEY_Arabic_peh = uint(C.GDK_KEY_Arabic_peh) - KEY_Arabic_tcheh = uint(C.GDK_KEY_Arabic_tcheh) - KEY_Arabic_ddal = uint(C.GDK_KEY_Arabic_ddal) - KEY_Arabic_rreh = uint(C.GDK_KEY_Arabic_rreh) - KEY_Arabic_comma = uint(C.GDK_KEY_Arabic_comma) - KEY_Arabic_fullstop = uint(C.GDK_KEY_Arabic_fullstop) - KEY_Arabic_0 = uint(C.GDK_KEY_Arabic_0) - KEY_Arabic_1 = uint(C.GDK_KEY_Arabic_1) - KEY_Arabic_2 = uint(C.GDK_KEY_Arabic_2) - KEY_Arabic_3 = uint(C.GDK_KEY_Arabic_3) - KEY_Arabic_4 = uint(C.GDK_KEY_Arabic_4) - KEY_Arabic_5 = uint(C.GDK_KEY_Arabic_5) - KEY_Arabic_6 = uint(C.GDK_KEY_Arabic_6) - KEY_Arabic_7 = uint(C.GDK_KEY_Arabic_7) - KEY_Arabic_8 = uint(C.GDK_KEY_Arabic_8) - KEY_Arabic_9 = uint(C.GDK_KEY_Arabic_9) - KEY_Arabic_semicolon = uint(C.GDK_KEY_Arabic_semicolon) - KEY_Arabic_question_mark = uint(C.GDK_KEY_Arabic_question_mark) - KEY_Arabic_hamza = uint(C.GDK_KEY_Arabic_hamza) - KEY_Arabic_maddaonalef = uint(C.GDK_KEY_Arabic_maddaonalef) - KEY_Arabic_hamzaonalef = uint(C.GDK_KEY_Arabic_hamzaonalef) - KEY_Arabic_hamzaonwaw = uint(C.GDK_KEY_Arabic_hamzaonwaw) - KEY_Arabic_hamzaunderalef = uint(C.GDK_KEY_Arabic_hamzaunderalef) - KEY_Arabic_hamzaonyeh = uint(C.GDK_KEY_Arabic_hamzaonyeh) - KEY_Arabic_alef = uint(C.GDK_KEY_Arabic_alef) - KEY_Arabic_beh = uint(C.GDK_KEY_Arabic_beh) - KEY_Arabic_tehmarbuta = uint(C.GDK_KEY_Arabic_tehmarbuta) - KEY_Arabic_teh = uint(C.GDK_KEY_Arabic_teh) - KEY_Arabic_theh = uint(C.GDK_KEY_Arabic_theh) - KEY_Arabic_jeem = uint(C.GDK_KEY_Arabic_jeem) - KEY_Arabic_hah = uint(C.GDK_KEY_Arabic_hah) - KEY_Arabic_khah = uint(C.GDK_KEY_Arabic_khah) - KEY_Arabic_dal = uint(C.GDK_KEY_Arabic_dal) - KEY_Arabic_thal = uint(C.GDK_KEY_Arabic_thal) - KEY_Arabic_ra = uint(C.GDK_KEY_Arabic_ra) - KEY_Arabic_zain = uint(C.GDK_KEY_Arabic_zain) - KEY_Arabic_seen = uint(C.GDK_KEY_Arabic_seen) - KEY_Arabic_sheen = uint(C.GDK_KEY_Arabic_sheen) - KEY_Arabic_sad = uint(C.GDK_KEY_Arabic_sad) - KEY_Arabic_dad = uint(C.GDK_KEY_Arabic_dad) - KEY_Arabic_tah = uint(C.GDK_KEY_Arabic_tah) - KEY_Arabic_zah = uint(C.GDK_KEY_Arabic_zah) - KEY_Arabic_ain = uint(C.GDK_KEY_Arabic_ain) - KEY_Arabic_ghain = uint(C.GDK_KEY_Arabic_ghain) - KEY_Arabic_tatweel = uint(C.GDK_KEY_Arabic_tatweel) - KEY_Arabic_feh = uint(C.GDK_KEY_Arabic_feh) - KEY_Arabic_qaf = uint(C.GDK_KEY_Arabic_qaf) - KEY_Arabic_kaf = uint(C.GDK_KEY_Arabic_kaf) - KEY_Arabic_lam = uint(C.GDK_KEY_Arabic_lam) - KEY_Arabic_meem = uint(C.GDK_KEY_Arabic_meem) - KEY_Arabic_noon = uint(C.GDK_KEY_Arabic_noon) - KEY_Arabic_ha = uint(C.GDK_KEY_Arabic_ha) - KEY_Arabic_heh = uint(C.GDK_KEY_Arabic_heh) - KEY_Arabic_waw = uint(C.GDK_KEY_Arabic_waw) - KEY_Arabic_alefmaksura = uint(C.GDK_KEY_Arabic_alefmaksura) - KEY_Arabic_yeh = uint(C.GDK_KEY_Arabic_yeh) - KEY_Arabic_fathatan = uint(C.GDK_KEY_Arabic_fathatan) - KEY_Arabic_dammatan = uint(C.GDK_KEY_Arabic_dammatan) - KEY_Arabic_kasratan = uint(C.GDK_KEY_Arabic_kasratan) - KEY_Arabic_fatha = uint(C.GDK_KEY_Arabic_fatha) - KEY_Arabic_damma = uint(C.GDK_KEY_Arabic_damma) - KEY_Arabic_kasra = uint(C.GDK_KEY_Arabic_kasra) - KEY_Arabic_shadda = uint(C.GDK_KEY_Arabic_shadda) - KEY_Arabic_sukun = uint(C.GDK_KEY_Arabic_sukun) - KEY_Arabic_madda_above = uint(C.GDK_KEY_Arabic_madda_above) - KEY_Arabic_hamza_above = uint(C.GDK_KEY_Arabic_hamza_above) - KEY_Arabic_hamza_below = uint(C.GDK_KEY_Arabic_hamza_below) - KEY_Arabic_jeh = uint(C.GDK_KEY_Arabic_jeh) - KEY_Arabic_veh = uint(C.GDK_KEY_Arabic_veh) - KEY_Arabic_keheh = uint(C.GDK_KEY_Arabic_keheh) - KEY_Arabic_gaf = uint(C.GDK_KEY_Arabic_gaf) - KEY_Arabic_noon_ghunna = uint(C.GDK_KEY_Arabic_noon_ghunna) - KEY_Arabic_heh_doachashmee = uint(C.GDK_KEY_Arabic_heh_doachashmee) - KEY_Farsi_yeh = uint(C.GDK_KEY_Farsi_yeh) - KEY_Arabic_farsi_yeh = uint(C.GDK_KEY_Arabic_farsi_yeh) - KEY_Arabic_yeh_baree = uint(C.GDK_KEY_Arabic_yeh_baree) - KEY_Arabic_heh_goal = uint(C.GDK_KEY_Arabic_heh_goal) - KEY_Arabic_switch = uint(C.GDK_KEY_Arabic_switch) - KEY_Cyrillic_GHE_bar = uint(C.GDK_KEY_Cyrillic_GHE_bar) - KEY_Cyrillic_ghe_bar = uint(C.GDK_KEY_Cyrillic_ghe_bar) - KEY_Cyrillic_ZHE_descender = uint(C.GDK_KEY_Cyrillic_ZHE_descender) - KEY_Cyrillic_zhe_descender = uint(C.GDK_KEY_Cyrillic_zhe_descender) - KEY_Cyrillic_KA_descender = uint(C.GDK_KEY_Cyrillic_KA_descender) - KEY_Cyrillic_ka_descender = uint(C.GDK_KEY_Cyrillic_ka_descender) - KEY_Cyrillic_KA_vertstroke = uint(C.GDK_KEY_Cyrillic_KA_vertstroke) - KEY_Cyrillic_ka_vertstroke = uint(C.GDK_KEY_Cyrillic_ka_vertstroke) - KEY_Cyrillic_EN_descender = uint(C.GDK_KEY_Cyrillic_EN_descender) - KEY_Cyrillic_en_descender = uint(C.GDK_KEY_Cyrillic_en_descender) - KEY_Cyrillic_U_straight = uint(C.GDK_KEY_Cyrillic_U_straight) - KEY_Cyrillic_u_straight = uint(C.GDK_KEY_Cyrillic_u_straight) - KEY_Cyrillic_U_straight_bar = uint(C.GDK_KEY_Cyrillic_U_straight_bar) - KEY_Cyrillic_u_straight_bar = uint(C.GDK_KEY_Cyrillic_u_straight_bar) - KEY_Cyrillic_HA_descender = uint(C.GDK_KEY_Cyrillic_HA_descender) - KEY_Cyrillic_ha_descender = uint(C.GDK_KEY_Cyrillic_ha_descender) - KEY_Cyrillic_CHE_descender = uint(C.GDK_KEY_Cyrillic_CHE_descender) - KEY_Cyrillic_che_descender = uint(C.GDK_KEY_Cyrillic_che_descender) - KEY_Cyrillic_CHE_vertstroke = uint(C.GDK_KEY_Cyrillic_CHE_vertstroke) - KEY_Cyrillic_che_vertstroke = uint(C.GDK_KEY_Cyrillic_che_vertstroke) - KEY_Cyrillic_SHHA = uint(C.GDK_KEY_Cyrillic_SHHA) - KEY_Cyrillic_shha = uint(C.GDK_KEY_Cyrillic_shha) - KEY_Cyrillic_SCHWA = uint(C.GDK_KEY_Cyrillic_SCHWA) - KEY_Cyrillic_schwa = uint(C.GDK_KEY_Cyrillic_schwa) - KEY_Cyrillic_I_macron = uint(C.GDK_KEY_Cyrillic_I_macron) - KEY_Cyrillic_i_macron = uint(C.GDK_KEY_Cyrillic_i_macron) - KEY_Cyrillic_O_bar = uint(C.GDK_KEY_Cyrillic_O_bar) - KEY_Cyrillic_o_bar = uint(C.GDK_KEY_Cyrillic_o_bar) - KEY_Cyrillic_U_macron = uint(C.GDK_KEY_Cyrillic_U_macron) - KEY_Cyrillic_u_macron = uint(C.GDK_KEY_Cyrillic_u_macron) - KEY_Serbian_dje = uint(C.GDK_KEY_Serbian_dje) - KEY_Macedonia_gje = uint(C.GDK_KEY_Macedonia_gje) - KEY_Cyrillic_io = uint(C.GDK_KEY_Cyrillic_io) - KEY_Ukrainian_ie = uint(C.GDK_KEY_Ukrainian_ie) - KEY_Ukranian_je = uint(C.GDK_KEY_Ukranian_je) - KEY_Macedonia_dse = uint(C.GDK_KEY_Macedonia_dse) - KEY_Ukrainian_i = uint(C.GDK_KEY_Ukrainian_i) - KEY_Ukranian_i = uint(C.GDK_KEY_Ukranian_i) - KEY_Ukrainian_yi = uint(C.GDK_KEY_Ukrainian_yi) - KEY_Ukranian_yi = uint(C.GDK_KEY_Ukranian_yi) - KEY_Cyrillic_je = uint(C.GDK_KEY_Cyrillic_je) - KEY_Serbian_je = uint(C.GDK_KEY_Serbian_je) - KEY_Cyrillic_lje = uint(C.GDK_KEY_Cyrillic_lje) - KEY_Serbian_lje = uint(C.GDK_KEY_Serbian_lje) - KEY_Cyrillic_nje = uint(C.GDK_KEY_Cyrillic_nje) - KEY_Serbian_nje = uint(C.GDK_KEY_Serbian_nje) - KEY_Serbian_tshe = uint(C.GDK_KEY_Serbian_tshe) - KEY_Macedonia_kje = uint(C.GDK_KEY_Macedonia_kje) - KEY_Ukrainian_ghe_with_upturn = uint(C.GDK_KEY_Ukrainian_ghe_with_upturn) - KEY_Byelorussian_shortu = uint(C.GDK_KEY_Byelorussian_shortu) - KEY_Cyrillic_dzhe = uint(C.GDK_KEY_Cyrillic_dzhe) - KEY_Serbian_dze = uint(C.GDK_KEY_Serbian_dze) - KEY_numerosign = uint(C.GDK_KEY_numerosign) - KEY_Serbian_DJE = uint(C.GDK_KEY_Serbian_DJE) - KEY_Macedonia_GJE = uint(C.GDK_KEY_Macedonia_GJE) - KEY_Cyrillic_IO = uint(C.GDK_KEY_Cyrillic_IO) - KEY_Ukrainian_IE = uint(C.GDK_KEY_Ukrainian_IE) - KEY_Ukranian_JE = uint(C.GDK_KEY_Ukranian_JE) - KEY_Macedonia_DSE = uint(C.GDK_KEY_Macedonia_DSE) - KEY_Ukrainian_I = uint(C.GDK_KEY_Ukrainian_I) - KEY_Ukranian_I = uint(C.GDK_KEY_Ukranian_I) - KEY_Ukrainian_YI = uint(C.GDK_KEY_Ukrainian_YI) - KEY_Ukranian_YI = uint(C.GDK_KEY_Ukranian_YI) - KEY_Cyrillic_JE = uint(C.GDK_KEY_Cyrillic_JE) - KEY_Serbian_JE = uint(C.GDK_KEY_Serbian_JE) - KEY_Cyrillic_LJE = uint(C.GDK_KEY_Cyrillic_LJE) - KEY_Serbian_LJE = uint(C.GDK_KEY_Serbian_LJE) - KEY_Cyrillic_NJE = uint(C.GDK_KEY_Cyrillic_NJE) - KEY_Serbian_NJE = uint(C.GDK_KEY_Serbian_NJE) - KEY_Serbian_TSHE = uint(C.GDK_KEY_Serbian_TSHE) - KEY_Macedonia_KJE = uint(C.GDK_KEY_Macedonia_KJE) - KEY_Ukrainian_GHE_WITH_UPTURN = uint(C.GDK_KEY_Ukrainian_GHE_WITH_UPTURN) - KEY_Byelorussian_SHORTU = uint(C.GDK_KEY_Byelorussian_SHORTU) - KEY_Cyrillic_DZHE = uint(C.GDK_KEY_Cyrillic_DZHE) - KEY_Serbian_DZE = uint(C.GDK_KEY_Serbian_DZE) - KEY_Cyrillic_yu = uint(C.GDK_KEY_Cyrillic_yu) - KEY_Cyrillic_a = uint(C.GDK_KEY_Cyrillic_a) - KEY_Cyrillic_be = uint(C.GDK_KEY_Cyrillic_be) - KEY_Cyrillic_tse = uint(C.GDK_KEY_Cyrillic_tse) - KEY_Cyrillic_de = uint(C.GDK_KEY_Cyrillic_de) - KEY_Cyrillic_ie = uint(C.GDK_KEY_Cyrillic_ie) - KEY_Cyrillic_ef = uint(C.GDK_KEY_Cyrillic_ef) - KEY_Cyrillic_ghe = uint(C.GDK_KEY_Cyrillic_ghe) - KEY_Cyrillic_ha = uint(C.GDK_KEY_Cyrillic_ha) - KEY_Cyrillic_i = uint(C.GDK_KEY_Cyrillic_i) - KEY_Cyrillic_shorti = uint(C.GDK_KEY_Cyrillic_shorti) - KEY_Cyrillic_ka = uint(C.GDK_KEY_Cyrillic_ka) - KEY_Cyrillic_el = uint(C.GDK_KEY_Cyrillic_el) - KEY_Cyrillic_em = uint(C.GDK_KEY_Cyrillic_em) - KEY_Cyrillic_en = uint(C.GDK_KEY_Cyrillic_en) - KEY_Cyrillic_o = uint(C.GDK_KEY_Cyrillic_o) - KEY_Cyrillic_pe = uint(C.GDK_KEY_Cyrillic_pe) - KEY_Cyrillic_ya = uint(C.GDK_KEY_Cyrillic_ya) - KEY_Cyrillic_er = uint(C.GDK_KEY_Cyrillic_er) - KEY_Cyrillic_es = uint(C.GDK_KEY_Cyrillic_es) - KEY_Cyrillic_te = uint(C.GDK_KEY_Cyrillic_te) - KEY_Cyrillic_u = uint(C.GDK_KEY_Cyrillic_u) - KEY_Cyrillic_zhe = uint(C.GDK_KEY_Cyrillic_zhe) - KEY_Cyrillic_ve = uint(C.GDK_KEY_Cyrillic_ve) - KEY_Cyrillic_softsign = uint(C.GDK_KEY_Cyrillic_softsign) - KEY_Cyrillic_yeru = uint(C.GDK_KEY_Cyrillic_yeru) - KEY_Cyrillic_ze = uint(C.GDK_KEY_Cyrillic_ze) - KEY_Cyrillic_sha = uint(C.GDK_KEY_Cyrillic_sha) - KEY_Cyrillic_e = uint(C.GDK_KEY_Cyrillic_e) - KEY_Cyrillic_shcha = uint(C.GDK_KEY_Cyrillic_shcha) - KEY_Cyrillic_che = uint(C.GDK_KEY_Cyrillic_che) - KEY_Cyrillic_hardsign = uint(C.GDK_KEY_Cyrillic_hardsign) - KEY_Cyrillic_YU = uint(C.GDK_KEY_Cyrillic_YU) - KEY_Cyrillic_A = uint(C.GDK_KEY_Cyrillic_A) - KEY_Cyrillic_BE = uint(C.GDK_KEY_Cyrillic_BE) - KEY_Cyrillic_TSE = uint(C.GDK_KEY_Cyrillic_TSE) - KEY_Cyrillic_DE = uint(C.GDK_KEY_Cyrillic_DE) - KEY_Cyrillic_IE = uint(C.GDK_KEY_Cyrillic_IE) - KEY_Cyrillic_EF = uint(C.GDK_KEY_Cyrillic_EF) - KEY_Cyrillic_GHE = uint(C.GDK_KEY_Cyrillic_GHE) - KEY_Cyrillic_HA = uint(C.GDK_KEY_Cyrillic_HA) - KEY_Cyrillic_I = uint(C.GDK_KEY_Cyrillic_I) - KEY_Cyrillic_SHORTI = uint(C.GDK_KEY_Cyrillic_SHORTI) - KEY_Cyrillic_KA = uint(C.GDK_KEY_Cyrillic_KA) - KEY_Cyrillic_EL = uint(C.GDK_KEY_Cyrillic_EL) - KEY_Cyrillic_EM = uint(C.GDK_KEY_Cyrillic_EM) - KEY_Cyrillic_EN = uint(C.GDK_KEY_Cyrillic_EN) - KEY_Cyrillic_O = uint(C.GDK_KEY_Cyrillic_O) - KEY_Cyrillic_PE = uint(C.GDK_KEY_Cyrillic_PE) - KEY_Cyrillic_YA = uint(C.GDK_KEY_Cyrillic_YA) - KEY_Cyrillic_ER = uint(C.GDK_KEY_Cyrillic_ER) - KEY_Cyrillic_ES = uint(C.GDK_KEY_Cyrillic_ES) - KEY_Cyrillic_TE = uint(C.GDK_KEY_Cyrillic_TE) - KEY_Cyrillic_U = uint(C.GDK_KEY_Cyrillic_U) - KEY_Cyrillic_ZHE = uint(C.GDK_KEY_Cyrillic_ZHE) - KEY_Cyrillic_VE = uint(C.GDK_KEY_Cyrillic_VE) - KEY_Cyrillic_SOFTSIGN = uint(C.GDK_KEY_Cyrillic_SOFTSIGN) - KEY_Cyrillic_YERU = uint(C.GDK_KEY_Cyrillic_YERU) - KEY_Cyrillic_ZE = uint(C.GDK_KEY_Cyrillic_ZE) - KEY_Cyrillic_SHA = uint(C.GDK_KEY_Cyrillic_SHA) - KEY_Cyrillic_E = uint(C.GDK_KEY_Cyrillic_E) - KEY_Cyrillic_SHCHA = uint(C.GDK_KEY_Cyrillic_SHCHA) - KEY_Cyrillic_CHE = uint(C.GDK_KEY_Cyrillic_CHE) - KEY_Cyrillic_HARDSIGN = uint(C.GDK_KEY_Cyrillic_HARDSIGN) - KEY_Greek_ALPHAaccent = uint(C.GDK_KEY_Greek_ALPHAaccent) - KEY_Greek_EPSILONaccent = uint(C.GDK_KEY_Greek_EPSILONaccent) - KEY_Greek_ETAaccent = uint(C.GDK_KEY_Greek_ETAaccent) - KEY_Greek_IOTAaccent = uint(C.GDK_KEY_Greek_IOTAaccent) - KEY_Greek_IOTAdieresis = uint(C.GDK_KEY_Greek_IOTAdieresis) - KEY_Greek_IOTAdiaeresis = uint(C.GDK_KEY_Greek_IOTAdiaeresis) - KEY_Greek_OMICRONaccent = uint(C.GDK_KEY_Greek_OMICRONaccent) - KEY_Greek_UPSILONaccent = uint(C.GDK_KEY_Greek_UPSILONaccent) - KEY_Greek_UPSILONdieresis = uint(C.GDK_KEY_Greek_UPSILONdieresis) - KEY_Greek_OMEGAaccent = uint(C.GDK_KEY_Greek_OMEGAaccent) - KEY_Greek_accentdieresis = uint(C.GDK_KEY_Greek_accentdieresis) - KEY_Greek_horizbar = uint(C.GDK_KEY_Greek_horizbar) - KEY_Greek_alphaaccent = uint(C.GDK_KEY_Greek_alphaaccent) - KEY_Greek_epsilonaccent = uint(C.GDK_KEY_Greek_epsilonaccent) - KEY_Greek_etaaccent = uint(C.GDK_KEY_Greek_etaaccent) - KEY_Greek_iotaaccent = uint(C.GDK_KEY_Greek_iotaaccent) - KEY_Greek_iotadieresis = uint(C.GDK_KEY_Greek_iotadieresis) - KEY_Greek_iotaaccentdieresis = uint(C.GDK_KEY_Greek_iotaaccentdieresis) - KEY_Greek_omicronaccent = uint(C.GDK_KEY_Greek_omicronaccent) - KEY_Greek_upsilonaccent = uint(C.GDK_KEY_Greek_upsilonaccent) - KEY_Greek_upsilondieresis = uint(C.GDK_KEY_Greek_upsilondieresis) - KEY_Greek_upsilonaccentdieresis = uint(C.GDK_KEY_Greek_upsilonaccentdieresis) - KEY_Greek_omegaaccent = uint(C.GDK_KEY_Greek_omegaaccent) - KEY_Greek_ALPHA = uint(C.GDK_KEY_Greek_ALPHA) - KEY_Greek_BETA = uint(C.GDK_KEY_Greek_BETA) - KEY_Greek_GAMMA = uint(C.GDK_KEY_Greek_GAMMA) - KEY_Greek_DELTA = uint(C.GDK_KEY_Greek_DELTA) - KEY_Greek_EPSILON = uint(C.GDK_KEY_Greek_EPSILON) - KEY_Greek_ZETA = uint(C.GDK_KEY_Greek_ZETA) - KEY_Greek_ETA = uint(C.GDK_KEY_Greek_ETA) - KEY_Greek_THETA = uint(C.GDK_KEY_Greek_THETA) - KEY_Greek_IOTA = uint(C.GDK_KEY_Greek_IOTA) - KEY_Greek_KAPPA = uint(C.GDK_KEY_Greek_KAPPA) - KEY_Greek_LAMDA = uint(C.GDK_KEY_Greek_LAMDA) - KEY_Greek_LAMBDA = uint(C.GDK_KEY_Greek_LAMBDA) - KEY_Greek_MU = uint(C.GDK_KEY_Greek_MU) - KEY_Greek_NU = uint(C.GDK_KEY_Greek_NU) - KEY_Greek_XI = uint(C.GDK_KEY_Greek_XI) - KEY_Greek_OMICRON = uint(C.GDK_KEY_Greek_OMICRON) - KEY_Greek_PI = uint(C.GDK_KEY_Greek_PI) - KEY_Greek_RHO = uint(C.GDK_KEY_Greek_RHO) - KEY_Greek_SIGMA = uint(C.GDK_KEY_Greek_SIGMA) - KEY_Greek_TAU = uint(C.GDK_KEY_Greek_TAU) - KEY_Greek_UPSILON = uint(C.GDK_KEY_Greek_UPSILON) - KEY_Greek_PHI = uint(C.GDK_KEY_Greek_PHI) - KEY_Greek_CHI = uint(C.GDK_KEY_Greek_CHI) - KEY_Greek_PSI = uint(C.GDK_KEY_Greek_PSI) - KEY_Greek_OMEGA = uint(C.GDK_KEY_Greek_OMEGA) - KEY_Greek_alpha = uint(C.GDK_KEY_Greek_alpha) - KEY_Greek_beta = uint(C.GDK_KEY_Greek_beta) - KEY_Greek_gamma = uint(C.GDK_KEY_Greek_gamma) - KEY_Greek_delta = uint(C.GDK_KEY_Greek_delta) - KEY_Greek_epsilon = uint(C.GDK_KEY_Greek_epsilon) - KEY_Greek_zeta = uint(C.GDK_KEY_Greek_zeta) - KEY_Greek_eta = uint(C.GDK_KEY_Greek_eta) - KEY_Greek_theta = uint(C.GDK_KEY_Greek_theta) - KEY_Greek_iota = uint(C.GDK_KEY_Greek_iota) - KEY_Greek_kappa = uint(C.GDK_KEY_Greek_kappa) - KEY_Greek_lamda = uint(C.GDK_KEY_Greek_lamda) - KEY_Greek_lambda = uint(C.GDK_KEY_Greek_lambda) - KEY_Greek_mu = uint(C.GDK_KEY_Greek_mu) - KEY_Greek_nu = uint(C.GDK_KEY_Greek_nu) - KEY_Greek_xi = uint(C.GDK_KEY_Greek_xi) - KEY_Greek_omicron = uint(C.GDK_KEY_Greek_omicron) - KEY_Greek_pi = uint(C.GDK_KEY_Greek_pi) - KEY_Greek_rho = uint(C.GDK_KEY_Greek_rho) - KEY_Greek_sigma = uint(C.GDK_KEY_Greek_sigma) - KEY_Greek_finalsmallsigma = uint(C.GDK_KEY_Greek_finalsmallsigma) - KEY_Greek_tau = uint(C.GDK_KEY_Greek_tau) - KEY_Greek_upsilon = uint(C.GDK_KEY_Greek_upsilon) - KEY_Greek_phi = uint(C.GDK_KEY_Greek_phi) - KEY_Greek_chi = uint(C.GDK_KEY_Greek_chi) - KEY_Greek_psi = uint(C.GDK_KEY_Greek_psi) - KEY_Greek_omega = uint(C.GDK_KEY_Greek_omega) - KEY_Greek_switch = uint(C.GDK_KEY_Greek_switch) - KEY_leftradical = uint(C.GDK_KEY_leftradical) - KEY_topleftradical = uint(C.GDK_KEY_topleftradical) - KEY_horizconnector = uint(C.GDK_KEY_horizconnector) - KEY_topintegral = uint(C.GDK_KEY_topintegral) - KEY_botintegral = uint(C.GDK_KEY_botintegral) - KEY_vertconnector = uint(C.GDK_KEY_vertconnector) - KEY_topleftsqbracket = uint(C.GDK_KEY_topleftsqbracket) - KEY_botleftsqbracket = uint(C.GDK_KEY_botleftsqbracket) - KEY_toprightsqbracket = uint(C.GDK_KEY_toprightsqbracket) - KEY_botrightsqbracket = uint(C.GDK_KEY_botrightsqbracket) - KEY_topleftparens = uint(C.GDK_KEY_topleftparens) - KEY_botleftparens = uint(C.GDK_KEY_botleftparens) - KEY_toprightparens = uint(C.GDK_KEY_toprightparens) - KEY_botrightparens = uint(C.GDK_KEY_botrightparens) - KEY_leftmiddlecurlybrace = uint(C.GDK_KEY_leftmiddlecurlybrace) - KEY_rightmiddlecurlybrace = uint(C.GDK_KEY_rightmiddlecurlybrace) - KEY_topleftsummation = uint(C.GDK_KEY_topleftsummation) - KEY_botleftsummation = uint(C.GDK_KEY_botleftsummation) - KEY_topvertsummationconnector = uint(C.GDK_KEY_topvertsummationconnector) - KEY_botvertsummationconnector = uint(C.GDK_KEY_botvertsummationconnector) - KEY_toprightsummation = uint(C.GDK_KEY_toprightsummation) - KEY_botrightsummation = uint(C.GDK_KEY_botrightsummation) - KEY_rightmiddlesummation = uint(C.GDK_KEY_rightmiddlesummation) - KEY_lessthanequal = uint(C.GDK_KEY_lessthanequal) - KEY_notequal = uint(C.GDK_KEY_notequal) - KEY_greaterthanequal = uint(C.GDK_KEY_greaterthanequal) - KEY_integral = uint(C.GDK_KEY_integral) - KEY_therefore = uint(C.GDK_KEY_therefore) - KEY_variation = uint(C.GDK_KEY_variation) - KEY_infinity = uint(C.GDK_KEY_infinity) - KEY_nabla = uint(C.GDK_KEY_nabla) - KEY_approximate = uint(C.GDK_KEY_approximate) - KEY_similarequal = uint(C.GDK_KEY_similarequal) - KEY_ifonlyif = uint(C.GDK_KEY_ifonlyif) - KEY_implies = uint(C.GDK_KEY_implies) - KEY_identical = uint(C.GDK_KEY_identical) - KEY_radical = uint(C.GDK_KEY_radical) - KEY_includedin = uint(C.GDK_KEY_includedin) - KEY_includes = uint(C.GDK_KEY_includes) - KEY_intersection = uint(C.GDK_KEY_intersection) - KEY_union = uint(C.GDK_KEY_union) - KEY_logicaland = uint(C.GDK_KEY_logicaland) - KEY_logicalor = uint(C.GDK_KEY_logicalor) - KEY_partialderivative = uint(C.GDK_KEY_partialderivative) - KEY_function = uint(C.GDK_KEY_function) - KEY_leftarrow = uint(C.GDK_KEY_leftarrow) - KEY_uparrow = uint(C.GDK_KEY_uparrow) - KEY_rightarrow = uint(C.GDK_KEY_rightarrow) - KEY_downarrow = uint(C.GDK_KEY_downarrow) - KEY_blank = uint(C.GDK_KEY_blank) - KEY_soliddiamond = uint(C.GDK_KEY_soliddiamond) - KEY_checkerboard = uint(C.GDK_KEY_checkerboard) - KEY_ht = uint(C.GDK_KEY_ht) - KEY_ff = uint(C.GDK_KEY_ff) - KEY_cr = uint(C.GDK_KEY_cr) - KEY_lf = uint(C.GDK_KEY_lf) - KEY_nl = uint(C.GDK_KEY_nl) - KEY_vt = uint(C.GDK_KEY_vt) - KEY_lowrightcorner = uint(C.GDK_KEY_lowrightcorner) - KEY_uprightcorner = uint(C.GDK_KEY_uprightcorner) - KEY_upleftcorner = uint(C.GDK_KEY_upleftcorner) - KEY_lowleftcorner = uint(C.GDK_KEY_lowleftcorner) - KEY_crossinglines = uint(C.GDK_KEY_crossinglines) - KEY_horizlinescan1 = uint(C.GDK_KEY_horizlinescan1) - KEY_horizlinescan3 = uint(C.GDK_KEY_horizlinescan3) - KEY_horizlinescan5 = uint(C.GDK_KEY_horizlinescan5) - KEY_horizlinescan7 = uint(C.GDK_KEY_horizlinescan7) - KEY_horizlinescan9 = uint(C.GDK_KEY_horizlinescan9) - KEY_leftt = uint(C.GDK_KEY_leftt) - KEY_rightt = uint(C.GDK_KEY_rightt) - KEY_bott = uint(C.GDK_KEY_bott) - KEY_topt = uint(C.GDK_KEY_topt) - KEY_vertbar = uint(C.GDK_KEY_vertbar) - KEY_emspace = uint(C.GDK_KEY_emspace) - KEY_enspace = uint(C.GDK_KEY_enspace) - KEY_em3space = uint(C.GDK_KEY_em3space) - KEY_em4space = uint(C.GDK_KEY_em4space) - KEY_digitspace = uint(C.GDK_KEY_digitspace) - KEY_punctspace = uint(C.GDK_KEY_punctspace) - KEY_thinspace = uint(C.GDK_KEY_thinspace) - KEY_hairspace = uint(C.GDK_KEY_hairspace) - KEY_emdash = uint(C.GDK_KEY_emdash) - KEY_endash = uint(C.GDK_KEY_endash) - KEY_signifblank = uint(C.GDK_KEY_signifblank) - KEY_ellipsis = uint(C.GDK_KEY_ellipsis) - KEY_doubbaselinedot = uint(C.GDK_KEY_doubbaselinedot) - KEY_onethird = uint(C.GDK_KEY_onethird) - KEY_twothirds = uint(C.GDK_KEY_twothirds) - KEY_onefifth = uint(C.GDK_KEY_onefifth) - KEY_twofifths = uint(C.GDK_KEY_twofifths) - KEY_threefifths = uint(C.GDK_KEY_threefifths) - KEY_fourfifths = uint(C.GDK_KEY_fourfifths) - KEY_onesixth = uint(C.GDK_KEY_onesixth) - KEY_fivesixths = uint(C.GDK_KEY_fivesixths) - KEY_careof = uint(C.GDK_KEY_careof) - KEY_figdash = uint(C.GDK_KEY_figdash) - KEY_leftanglebracket = uint(C.GDK_KEY_leftanglebracket) - KEY_decimalpoint = uint(C.GDK_KEY_decimalpoint) - KEY_rightanglebracket = uint(C.GDK_KEY_rightanglebracket) - KEY_marker = uint(C.GDK_KEY_marker) - KEY_oneeighth = uint(C.GDK_KEY_oneeighth) - KEY_threeeighths = uint(C.GDK_KEY_threeeighths) - KEY_fiveeighths = uint(C.GDK_KEY_fiveeighths) - KEY_seveneighths = uint(C.GDK_KEY_seveneighths) - KEY_trademark = uint(C.GDK_KEY_trademark) - KEY_signaturemark = uint(C.GDK_KEY_signaturemark) - KEY_trademarkincircle = uint(C.GDK_KEY_trademarkincircle) - KEY_leftopentriangle = uint(C.GDK_KEY_leftopentriangle) - KEY_rightopentriangle = uint(C.GDK_KEY_rightopentriangle) - KEY_emopencircle = uint(C.GDK_KEY_emopencircle) - KEY_emopenrectangle = uint(C.GDK_KEY_emopenrectangle) - KEY_leftsinglequotemark = uint(C.GDK_KEY_leftsinglequotemark) - KEY_rightsinglequotemark = uint(C.GDK_KEY_rightsinglequotemark) - KEY_leftdoublequotemark = uint(C.GDK_KEY_leftdoublequotemark) - KEY_rightdoublequotemark = uint(C.GDK_KEY_rightdoublequotemark) - KEY_prescription = uint(C.GDK_KEY_prescription) - KEY_permille = uint(C.GDK_KEY_permille) - KEY_minutes = uint(C.GDK_KEY_minutes) - KEY_seconds = uint(C.GDK_KEY_seconds) - KEY_latincross = uint(C.GDK_KEY_latincross) - KEY_hexagram = uint(C.GDK_KEY_hexagram) - KEY_filledrectbullet = uint(C.GDK_KEY_filledrectbullet) - KEY_filledlefttribullet = uint(C.GDK_KEY_filledlefttribullet) - KEY_filledrighttribullet = uint(C.GDK_KEY_filledrighttribullet) - KEY_emfilledcircle = uint(C.GDK_KEY_emfilledcircle) - KEY_emfilledrect = uint(C.GDK_KEY_emfilledrect) - KEY_enopencircbullet = uint(C.GDK_KEY_enopencircbullet) - KEY_enopensquarebullet = uint(C.GDK_KEY_enopensquarebullet) - KEY_openrectbullet = uint(C.GDK_KEY_openrectbullet) - KEY_opentribulletup = uint(C.GDK_KEY_opentribulletup) - KEY_opentribulletdown = uint(C.GDK_KEY_opentribulletdown) - KEY_openstar = uint(C.GDK_KEY_openstar) - KEY_enfilledcircbullet = uint(C.GDK_KEY_enfilledcircbullet) - KEY_enfilledsqbullet = uint(C.GDK_KEY_enfilledsqbullet) - KEY_filledtribulletup = uint(C.GDK_KEY_filledtribulletup) - KEY_filledtribulletdown = uint(C.GDK_KEY_filledtribulletdown) - KEY_leftpointer = uint(C.GDK_KEY_leftpointer) - KEY_rightpointer = uint(C.GDK_KEY_rightpointer) - KEY_club = uint(C.GDK_KEY_club) - KEY_diamond = uint(C.GDK_KEY_diamond) - KEY_heart = uint(C.GDK_KEY_heart) - KEY_maltesecross = uint(C.GDK_KEY_maltesecross) - KEY_dagger = uint(C.GDK_KEY_dagger) - KEY_doubledagger = uint(C.GDK_KEY_doubledagger) - KEY_checkmark = uint(C.GDK_KEY_checkmark) - KEY_ballotcross = uint(C.GDK_KEY_ballotcross) - KEY_musicalsharp = uint(C.GDK_KEY_musicalsharp) - KEY_musicalflat = uint(C.GDK_KEY_musicalflat) - KEY_malesymbol = uint(C.GDK_KEY_malesymbol) - KEY_femalesymbol = uint(C.GDK_KEY_femalesymbol) - KEY_telephone = uint(C.GDK_KEY_telephone) - KEY_telephonerecorder = uint(C.GDK_KEY_telephonerecorder) - KEY_phonographcopyright = uint(C.GDK_KEY_phonographcopyright) - KEY_caret = uint(C.GDK_KEY_caret) - KEY_singlelowquotemark = uint(C.GDK_KEY_singlelowquotemark) - KEY_doublelowquotemark = uint(C.GDK_KEY_doublelowquotemark) - KEY_cursor = uint(C.GDK_KEY_cursor) - KEY_leftcaret = uint(C.GDK_KEY_leftcaret) - KEY_rightcaret = uint(C.GDK_KEY_rightcaret) - KEY_downcaret = uint(C.GDK_KEY_downcaret) - KEY_upcaret = uint(C.GDK_KEY_upcaret) - KEY_overbar = uint(C.GDK_KEY_overbar) - KEY_downtack = uint(C.GDK_KEY_downtack) - KEY_upshoe = uint(C.GDK_KEY_upshoe) - KEY_downstile = uint(C.GDK_KEY_downstile) - KEY_underbar = uint(C.GDK_KEY_underbar) - KEY_jot = uint(C.GDK_KEY_jot) - KEY_quad = uint(C.GDK_KEY_quad) - KEY_uptack = uint(C.GDK_KEY_uptack) - KEY_circle = uint(C.GDK_KEY_circle) - KEY_upstile = uint(C.GDK_KEY_upstile) - KEY_downshoe = uint(C.GDK_KEY_downshoe) - KEY_rightshoe = uint(C.GDK_KEY_rightshoe) - KEY_leftshoe = uint(C.GDK_KEY_leftshoe) - KEY_lefttack = uint(C.GDK_KEY_lefttack) - KEY_righttack = uint(C.GDK_KEY_righttack) - KEY_hebrew_doublelowline = uint(C.GDK_KEY_hebrew_doublelowline) - KEY_hebrew_aleph = uint(C.GDK_KEY_hebrew_aleph) - KEY_hebrew_bet = uint(C.GDK_KEY_hebrew_bet) - KEY_hebrew_beth = uint(C.GDK_KEY_hebrew_beth) - KEY_hebrew_gimel = uint(C.GDK_KEY_hebrew_gimel) - KEY_hebrew_gimmel = uint(C.GDK_KEY_hebrew_gimmel) - KEY_hebrew_dalet = uint(C.GDK_KEY_hebrew_dalet) - KEY_hebrew_daleth = uint(C.GDK_KEY_hebrew_daleth) - KEY_hebrew_he = uint(C.GDK_KEY_hebrew_he) - KEY_hebrew_waw = uint(C.GDK_KEY_hebrew_waw) - KEY_hebrew_zain = uint(C.GDK_KEY_hebrew_zain) - KEY_hebrew_zayin = uint(C.GDK_KEY_hebrew_zayin) - KEY_hebrew_chet = uint(C.GDK_KEY_hebrew_chet) - KEY_hebrew_het = uint(C.GDK_KEY_hebrew_het) - KEY_hebrew_tet = uint(C.GDK_KEY_hebrew_tet) - KEY_hebrew_teth = uint(C.GDK_KEY_hebrew_teth) - KEY_hebrew_yod = uint(C.GDK_KEY_hebrew_yod) - KEY_hebrew_finalkaph = uint(C.GDK_KEY_hebrew_finalkaph) - KEY_hebrew_kaph = uint(C.GDK_KEY_hebrew_kaph) - KEY_hebrew_lamed = uint(C.GDK_KEY_hebrew_lamed) - KEY_hebrew_finalmem = uint(C.GDK_KEY_hebrew_finalmem) - KEY_hebrew_mem = uint(C.GDK_KEY_hebrew_mem) - KEY_hebrew_finalnun = uint(C.GDK_KEY_hebrew_finalnun) - KEY_hebrew_nun = uint(C.GDK_KEY_hebrew_nun) - KEY_hebrew_samech = uint(C.GDK_KEY_hebrew_samech) - KEY_hebrew_samekh = uint(C.GDK_KEY_hebrew_samekh) - KEY_hebrew_ayin = uint(C.GDK_KEY_hebrew_ayin) - KEY_hebrew_finalpe = uint(C.GDK_KEY_hebrew_finalpe) - KEY_hebrew_pe = uint(C.GDK_KEY_hebrew_pe) - KEY_hebrew_finalzade = uint(C.GDK_KEY_hebrew_finalzade) - KEY_hebrew_finalzadi = uint(C.GDK_KEY_hebrew_finalzadi) - KEY_hebrew_zade = uint(C.GDK_KEY_hebrew_zade) - KEY_hebrew_zadi = uint(C.GDK_KEY_hebrew_zadi) - KEY_hebrew_qoph = uint(C.GDK_KEY_hebrew_qoph) - KEY_hebrew_kuf = uint(C.GDK_KEY_hebrew_kuf) - KEY_hebrew_resh = uint(C.GDK_KEY_hebrew_resh) - KEY_hebrew_shin = uint(C.GDK_KEY_hebrew_shin) - KEY_hebrew_taw = uint(C.GDK_KEY_hebrew_taw) - KEY_hebrew_taf = uint(C.GDK_KEY_hebrew_taf) - KEY_Hebrew_switch = uint(C.GDK_KEY_Hebrew_switch) - KEY_Thai_kokai = uint(C.GDK_KEY_Thai_kokai) - KEY_Thai_khokhai = uint(C.GDK_KEY_Thai_khokhai) - KEY_Thai_khokhuat = uint(C.GDK_KEY_Thai_khokhuat) - KEY_Thai_khokhwai = uint(C.GDK_KEY_Thai_khokhwai) - KEY_Thai_khokhon = uint(C.GDK_KEY_Thai_khokhon) - KEY_Thai_khorakhang = uint(C.GDK_KEY_Thai_khorakhang) - KEY_Thai_ngongu = uint(C.GDK_KEY_Thai_ngongu) - KEY_Thai_chochan = uint(C.GDK_KEY_Thai_chochan) - KEY_Thai_choching = uint(C.GDK_KEY_Thai_choching) - KEY_Thai_chochang = uint(C.GDK_KEY_Thai_chochang) - KEY_Thai_soso = uint(C.GDK_KEY_Thai_soso) - KEY_Thai_chochoe = uint(C.GDK_KEY_Thai_chochoe) - KEY_Thai_yoying = uint(C.GDK_KEY_Thai_yoying) - KEY_Thai_dochada = uint(C.GDK_KEY_Thai_dochada) - KEY_Thai_topatak = uint(C.GDK_KEY_Thai_topatak) - KEY_Thai_thothan = uint(C.GDK_KEY_Thai_thothan) - KEY_Thai_thonangmontho = uint(C.GDK_KEY_Thai_thonangmontho) - KEY_Thai_thophuthao = uint(C.GDK_KEY_Thai_thophuthao) - KEY_Thai_nonen = uint(C.GDK_KEY_Thai_nonen) - KEY_Thai_dodek = uint(C.GDK_KEY_Thai_dodek) - KEY_Thai_totao = uint(C.GDK_KEY_Thai_totao) - KEY_Thai_thothung = uint(C.GDK_KEY_Thai_thothung) - KEY_Thai_thothahan = uint(C.GDK_KEY_Thai_thothahan) - KEY_Thai_thothong = uint(C.GDK_KEY_Thai_thothong) - KEY_Thai_nonu = uint(C.GDK_KEY_Thai_nonu) - KEY_Thai_bobaimai = uint(C.GDK_KEY_Thai_bobaimai) - KEY_Thai_popla = uint(C.GDK_KEY_Thai_popla) - KEY_Thai_phophung = uint(C.GDK_KEY_Thai_phophung) - KEY_Thai_fofa = uint(C.GDK_KEY_Thai_fofa) - KEY_Thai_phophan = uint(C.GDK_KEY_Thai_phophan) - KEY_Thai_fofan = uint(C.GDK_KEY_Thai_fofan) - KEY_Thai_phosamphao = uint(C.GDK_KEY_Thai_phosamphao) - KEY_Thai_moma = uint(C.GDK_KEY_Thai_moma) - KEY_Thai_yoyak = uint(C.GDK_KEY_Thai_yoyak) - KEY_Thai_rorua = uint(C.GDK_KEY_Thai_rorua) - KEY_Thai_ru = uint(C.GDK_KEY_Thai_ru) - KEY_Thai_loling = uint(C.GDK_KEY_Thai_loling) - KEY_Thai_lu = uint(C.GDK_KEY_Thai_lu) - KEY_Thai_wowaen = uint(C.GDK_KEY_Thai_wowaen) - KEY_Thai_sosala = uint(C.GDK_KEY_Thai_sosala) - KEY_Thai_sorusi = uint(C.GDK_KEY_Thai_sorusi) - KEY_Thai_sosua = uint(C.GDK_KEY_Thai_sosua) - KEY_Thai_hohip = uint(C.GDK_KEY_Thai_hohip) - KEY_Thai_lochula = uint(C.GDK_KEY_Thai_lochula) - KEY_Thai_oang = uint(C.GDK_KEY_Thai_oang) - KEY_Thai_honokhuk = uint(C.GDK_KEY_Thai_honokhuk) - KEY_Thai_paiyannoi = uint(C.GDK_KEY_Thai_paiyannoi) - KEY_Thai_saraa = uint(C.GDK_KEY_Thai_saraa) - KEY_Thai_maihanakat = uint(C.GDK_KEY_Thai_maihanakat) - KEY_Thai_saraaa = uint(C.GDK_KEY_Thai_saraaa) - KEY_Thai_saraam = uint(C.GDK_KEY_Thai_saraam) - KEY_Thai_sarai = uint(C.GDK_KEY_Thai_sarai) - KEY_Thai_saraii = uint(C.GDK_KEY_Thai_saraii) - KEY_Thai_saraue = uint(C.GDK_KEY_Thai_saraue) - KEY_Thai_sarauee = uint(C.GDK_KEY_Thai_sarauee) - KEY_Thai_sarau = uint(C.GDK_KEY_Thai_sarau) - KEY_Thai_sarauu = uint(C.GDK_KEY_Thai_sarauu) - KEY_Thai_phinthu = uint(C.GDK_KEY_Thai_phinthu) - KEY_Thai_maihanakat_maitho = uint(C.GDK_KEY_Thai_maihanakat_maitho) - KEY_Thai_baht = uint(C.GDK_KEY_Thai_baht) - KEY_Thai_sarae = uint(C.GDK_KEY_Thai_sarae) - KEY_Thai_saraae = uint(C.GDK_KEY_Thai_saraae) - KEY_Thai_sarao = uint(C.GDK_KEY_Thai_sarao) - KEY_Thai_saraaimaimuan = uint(C.GDK_KEY_Thai_saraaimaimuan) - KEY_Thai_saraaimaimalai = uint(C.GDK_KEY_Thai_saraaimaimalai) - KEY_Thai_lakkhangyao = uint(C.GDK_KEY_Thai_lakkhangyao) - KEY_Thai_maiyamok = uint(C.GDK_KEY_Thai_maiyamok) - KEY_Thai_maitaikhu = uint(C.GDK_KEY_Thai_maitaikhu) - KEY_Thai_maiek = uint(C.GDK_KEY_Thai_maiek) - KEY_Thai_maitho = uint(C.GDK_KEY_Thai_maitho) - KEY_Thai_maitri = uint(C.GDK_KEY_Thai_maitri) - KEY_Thai_maichattawa = uint(C.GDK_KEY_Thai_maichattawa) - KEY_Thai_thanthakhat = uint(C.GDK_KEY_Thai_thanthakhat) - KEY_Thai_nikhahit = uint(C.GDK_KEY_Thai_nikhahit) - KEY_Thai_leksun = uint(C.GDK_KEY_Thai_leksun) - KEY_Thai_leknung = uint(C.GDK_KEY_Thai_leknung) - KEY_Thai_leksong = uint(C.GDK_KEY_Thai_leksong) - KEY_Thai_leksam = uint(C.GDK_KEY_Thai_leksam) - KEY_Thai_leksi = uint(C.GDK_KEY_Thai_leksi) - KEY_Thai_lekha = uint(C.GDK_KEY_Thai_lekha) - KEY_Thai_lekhok = uint(C.GDK_KEY_Thai_lekhok) - KEY_Thai_lekchet = uint(C.GDK_KEY_Thai_lekchet) - KEY_Thai_lekpaet = uint(C.GDK_KEY_Thai_lekpaet) - KEY_Thai_lekkao = uint(C.GDK_KEY_Thai_lekkao) - KEY_Hangul = uint(C.GDK_KEY_Hangul) - KEY_Hangul_Start = uint(C.GDK_KEY_Hangul_Start) - KEY_Hangul_End = uint(C.GDK_KEY_Hangul_End) - KEY_Hangul_Hanja = uint(C.GDK_KEY_Hangul_Hanja) - KEY_Hangul_Jamo = uint(C.GDK_KEY_Hangul_Jamo) - KEY_Hangul_Romaja = uint(C.GDK_KEY_Hangul_Romaja) - KEY_Hangul_Codeinput = uint(C.GDK_KEY_Hangul_Codeinput) - KEY_Hangul_Jeonja = uint(C.GDK_KEY_Hangul_Jeonja) - KEY_Hangul_Banja = uint(C.GDK_KEY_Hangul_Banja) - KEY_Hangul_PreHanja = uint(C.GDK_KEY_Hangul_PreHanja) - KEY_Hangul_PostHanja = uint(C.GDK_KEY_Hangul_PostHanja) - KEY_Hangul_SingleCandidate = uint(C.GDK_KEY_Hangul_SingleCandidate) - KEY_Hangul_MultipleCandidate = uint(C.GDK_KEY_Hangul_MultipleCandidate) - KEY_Hangul_PreviousCandidate = uint(C.GDK_KEY_Hangul_PreviousCandidate) - KEY_Hangul_Special = uint(C.GDK_KEY_Hangul_Special) - KEY_Hangul_switch = uint(C.GDK_KEY_Hangul_switch) - KEY_Hangul_Kiyeog = uint(C.GDK_KEY_Hangul_Kiyeog) - KEY_Hangul_SsangKiyeog = uint(C.GDK_KEY_Hangul_SsangKiyeog) - KEY_Hangul_KiyeogSios = uint(C.GDK_KEY_Hangul_KiyeogSios) - KEY_Hangul_Nieun = uint(C.GDK_KEY_Hangul_Nieun) - KEY_Hangul_NieunJieuj = uint(C.GDK_KEY_Hangul_NieunJieuj) - KEY_Hangul_NieunHieuh = uint(C.GDK_KEY_Hangul_NieunHieuh) - KEY_Hangul_Dikeud = uint(C.GDK_KEY_Hangul_Dikeud) - KEY_Hangul_SsangDikeud = uint(C.GDK_KEY_Hangul_SsangDikeud) - KEY_Hangul_Rieul = uint(C.GDK_KEY_Hangul_Rieul) - KEY_Hangul_RieulKiyeog = uint(C.GDK_KEY_Hangul_RieulKiyeog) - KEY_Hangul_RieulMieum = uint(C.GDK_KEY_Hangul_RieulMieum) - KEY_Hangul_RieulPieub = uint(C.GDK_KEY_Hangul_RieulPieub) - KEY_Hangul_RieulSios = uint(C.GDK_KEY_Hangul_RieulSios) - KEY_Hangul_RieulTieut = uint(C.GDK_KEY_Hangul_RieulTieut) - KEY_Hangul_RieulPhieuf = uint(C.GDK_KEY_Hangul_RieulPhieuf) - KEY_Hangul_RieulHieuh = uint(C.GDK_KEY_Hangul_RieulHieuh) - KEY_Hangul_Mieum = uint(C.GDK_KEY_Hangul_Mieum) - KEY_Hangul_Pieub = uint(C.GDK_KEY_Hangul_Pieub) - KEY_Hangul_SsangPieub = uint(C.GDK_KEY_Hangul_SsangPieub) - KEY_Hangul_PieubSios = uint(C.GDK_KEY_Hangul_PieubSios) - KEY_Hangul_Sios = uint(C.GDK_KEY_Hangul_Sios) - KEY_Hangul_SsangSios = uint(C.GDK_KEY_Hangul_SsangSios) - KEY_Hangul_Ieung = uint(C.GDK_KEY_Hangul_Ieung) - KEY_Hangul_Jieuj = uint(C.GDK_KEY_Hangul_Jieuj) - KEY_Hangul_SsangJieuj = uint(C.GDK_KEY_Hangul_SsangJieuj) - KEY_Hangul_Cieuc = uint(C.GDK_KEY_Hangul_Cieuc) - KEY_Hangul_Khieuq = uint(C.GDK_KEY_Hangul_Khieuq) - KEY_Hangul_Tieut = uint(C.GDK_KEY_Hangul_Tieut) - KEY_Hangul_Phieuf = uint(C.GDK_KEY_Hangul_Phieuf) - KEY_Hangul_Hieuh = uint(C.GDK_KEY_Hangul_Hieuh) - KEY_Hangul_A = uint(C.GDK_KEY_Hangul_A) - KEY_Hangul_AE = uint(C.GDK_KEY_Hangul_AE) - KEY_Hangul_YA = uint(C.GDK_KEY_Hangul_YA) - KEY_Hangul_YAE = uint(C.GDK_KEY_Hangul_YAE) - KEY_Hangul_EO = uint(C.GDK_KEY_Hangul_EO) - KEY_Hangul_E = uint(C.GDK_KEY_Hangul_E) - KEY_Hangul_YEO = uint(C.GDK_KEY_Hangul_YEO) - KEY_Hangul_YE = uint(C.GDK_KEY_Hangul_YE) - KEY_Hangul_O = uint(C.GDK_KEY_Hangul_O) - KEY_Hangul_WA = uint(C.GDK_KEY_Hangul_WA) - KEY_Hangul_WAE = uint(C.GDK_KEY_Hangul_WAE) - KEY_Hangul_OE = uint(C.GDK_KEY_Hangul_OE) - KEY_Hangul_YO = uint(C.GDK_KEY_Hangul_YO) - KEY_Hangul_U = uint(C.GDK_KEY_Hangul_U) - KEY_Hangul_WEO = uint(C.GDK_KEY_Hangul_WEO) - KEY_Hangul_WE = uint(C.GDK_KEY_Hangul_WE) - KEY_Hangul_WI = uint(C.GDK_KEY_Hangul_WI) - KEY_Hangul_YU = uint(C.GDK_KEY_Hangul_YU) - KEY_Hangul_EU = uint(C.GDK_KEY_Hangul_EU) - KEY_Hangul_YI = uint(C.GDK_KEY_Hangul_YI) - KEY_Hangul_I = uint(C.GDK_KEY_Hangul_I) - KEY_Hangul_J_Kiyeog = uint(C.GDK_KEY_Hangul_J_Kiyeog) - KEY_Hangul_J_SsangKiyeog = uint(C.GDK_KEY_Hangul_J_SsangKiyeog) - KEY_Hangul_J_KiyeogSios = uint(C.GDK_KEY_Hangul_J_KiyeogSios) - KEY_Hangul_J_Nieun = uint(C.GDK_KEY_Hangul_J_Nieun) - KEY_Hangul_J_NieunJieuj = uint(C.GDK_KEY_Hangul_J_NieunJieuj) - KEY_Hangul_J_NieunHieuh = uint(C.GDK_KEY_Hangul_J_NieunHieuh) - KEY_Hangul_J_Dikeud = uint(C.GDK_KEY_Hangul_J_Dikeud) - KEY_Hangul_J_Rieul = uint(C.GDK_KEY_Hangul_J_Rieul) - KEY_Hangul_J_RieulKiyeog = uint(C.GDK_KEY_Hangul_J_RieulKiyeog) - KEY_Hangul_J_RieulMieum = uint(C.GDK_KEY_Hangul_J_RieulMieum) - KEY_Hangul_J_RieulPieub = uint(C.GDK_KEY_Hangul_J_RieulPieub) - KEY_Hangul_J_RieulSios = uint(C.GDK_KEY_Hangul_J_RieulSios) - KEY_Hangul_J_RieulTieut = uint(C.GDK_KEY_Hangul_J_RieulTieut) - KEY_Hangul_J_RieulPhieuf = uint(C.GDK_KEY_Hangul_J_RieulPhieuf) - KEY_Hangul_J_RieulHieuh = uint(C.GDK_KEY_Hangul_J_RieulHieuh) - KEY_Hangul_J_Mieum = uint(C.GDK_KEY_Hangul_J_Mieum) - KEY_Hangul_J_Pieub = uint(C.GDK_KEY_Hangul_J_Pieub) - KEY_Hangul_J_PieubSios = uint(C.GDK_KEY_Hangul_J_PieubSios) - KEY_Hangul_J_Sios = uint(C.GDK_KEY_Hangul_J_Sios) - KEY_Hangul_J_SsangSios = uint(C.GDK_KEY_Hangul_J_SsangSios) - KEY_Hangul_J_Ieung = uint(C.GDK_KEY_Hangul_J_Ieung) - KEY_Hangul_J_Jieuj = uint(C.GDK_KEY_Hangul_J_Jieuj) - KEY_Hangul_J_Cieuc = uint(C.GDK_KEY_Hangul_J_Cieuc) - KEY_Hangul_J_Khieuq = uint(C.GDK_KEY_Hangul_J_Khieuq) - KEY_Hangul_J_Tieut = uint(C.GDK_KEY_Hangul_J_Tieut) - KEY_Hangul_J_Phieuf = uint(C.GDK_KEY_Hangul_J_Phieuf) - KEY_Hangul_J_Hieuh = uint(C.GDK_KEY_Hangul_J_Hieuh) - KEY_Hangul_RieulYeorinHieuh = uint(C.GDK_KEY_Hangul_RieulYeorinHieuh) - KEY_Hangul_SunkyeongeumMieum = uint(C.GDK_KEY_Hangul_SunkyeongeumMieum) - KEY_Hangul_SunkyeongeumPieub = uint(C.GDK_KEY_Hangul_SunkyeongeumPieub) - KEY_Hangul_PanSios = uint(C.GDK_KEY_Hangul_PanSios) - KEY_Hangul_KkogjiDalrinIeung = uint(C.GDK_KEY_Hangul_KkogjiDalrinIeung) - KEY_Hangul_SunkyeongeumPhieuf = uint(C.GDK_KEY_Hangul_SunkyeongeumPhieuf) - KEY_Hangul_YeorinHieuh = uint(C.GDK_KEY_Hangul_YeorinHieuh) - KEY_Hangul_AraeA = uint(C.GDK_KEY_Hangul_AraeA) - KEY_Hangul_AraeAE = uint(C.GDK_KEY_Hangul_AraeAE) - KEY_Hangul_J_PanSios = uint(C.GDK_KEY_Hangul_J_PanSios) - KEY_Hangul_J_KkogjiDalrinIeung = uint(C.GDK_KEY_Hangul_J_KkogjiDalrinIeung) - KEY_Hangul_J_YeorinHieuh = uint(C.GDK_KEY_Hangul_J_YeorinHieuh) - KEY_Korean_Won = uint(C.GDK_KEY_Korean_Won) - KEY_Armenian_ligature_ew = uint(C.GDK_KEY_Armenian_ligature_ew) - KEY_Armenian_full_stop = uint(C.GDK_KEY_Armenian_full_stop) - KEY_Armenian_verjaket = uint(C.GDK_KEY_Armenian_verjaket) - KEY_Armenian_separation_mark = uint(C.GDK_KEY_Armenian_separation_mark) - KEY_Armenian_but = uint(C.GDK_KEY_Armenian_but) - KEY_Armenian_hyphen = uint(C.GDK_KEY_Armenian_hyphen) - KEY_Armenian_yentamna = uint(C.GDK_KEY_Armenian_yentamna) - KEY_Armenian_exclam = uint(C.GDK_KEY_Armenian_exclam) - KEY_Armenian_amanak = uint(C.GDK_KEY_Armenian_amanak) - KEY_Armenian_accent = uint(C.GDK_KEY_Armenian_accent) - KEY_Armenian_shesht = uint(C.GDK_KEY_Armenian_shesht) - KEY_Armenian_question = uint(C.GDK_KEY_Armenian_question) - KEY_Armenian_paruyk = uint(C.GDK_KEY_Armenian_paruyk) - KEY_Armenian_AYB = uint(C.GDK_KEY_Armenian_AYB) - KEY_Armenian_ayb = uint(C.GDK_KEY_Armenian_ayb) - KEY_Armenian_BEN = uint(C.GDK_KEY_Armenian_BEN) - KEY_Armenian_ben = uint(C.GDK_KEY_Armenian_ben) - KEY_Armenian_GIM = uint(C.GDK_KEY_Armenian_GIM) - KEY_Armenian_gim = uint(C.GDK_KEY_Armenian_gim) - KEY_Armenian_DA = uint(C.GDK_KEY_Armenian_DA) - KEY_Armenian_da = uint(C.GDK_KEY_Armenian_da) - KEY_Armenian_YECH = uint(C.GDK_KEY_Armenian_YECH) - KEY_Armenian_yech = uint(C.GDK_KEY_Armenian_yech) - KEY_Armenian_ZA = uint(C.GDK_KEY_Armenian_ZA) - KEY_Armenian_za = uint(C.GDK_KEY_Armenian_za) - KEY_Armenian_E = uint(C.GDK_KEY_Armenian_E) - KEY_Armenian_e = uint(C.GDK_KEY_Armenian_e) - KEY_Armenian_AT = uint(C.GDK_KEY_Armenian_AT) - KEY_Armenian_at = uint(C.GDK_KEY_Armenian_at) - KEY_Armenian_TO = uint(C.GDK_KEY_Armenian_TO) - KEY_Armenian_to = uint(C.GDK_KEY_Armenian_to) - KEY_Armenian_ZHE = uint(C.GDK_KEY_Armenian_ZHE) - KEY_Armenian_zhe = uint(C.GDK_KEY_Armenian_zhe) - KEY_Armenian_INI = uint(C.GDK_KEY_Armenian_INI) - KEY_Armenian_ini = uint(C.GDK_KEY_Armenian_ini) - KEY_Armenian_LYUN = uint(C.GDK_KEY_Armenian_LYUN) - KEY_Armenian_lyun = uint(C.GDK_KEY_Armenian_lyun) - KEY_Armenian_KHE = uint(C.GDK_KEY_Armenian_KHE) - KEY_Armenian_khe = uint(C.GDK_KEY_Armenian_khe) - KEY_Armenian_TSA = uint(C.GDK_KEY_Armenian_TSA) - KEY_Armenian_tsa = uint(C.GDK_KEY_Armenian_tsa) - KEY_Armenian_KEN = uint(C.GDK_KEY_Armenian_KEN) - KEY_Armenian_ken = uint(C.GDK_KEY_Armenian_ken) - KEY_Armenian_HO = uint(C.GDK_KEY_Armenian_HO) - KEY_Armenian_ho = uint(C.GDK_KEY_Armenian_ho) - KEY_Armenian_DZA = uint(C.GDK_KEY_Armenian_DZA) - KEY_Armenian_dza = uint(C.GDK_KEY_Armenian_dza) - KEY_Armenian_GHAT = uint(C.GDK_KEY_Armenian_GHAT) - KEY_Armenian_ghat = uint(C.GDK_KEY_Armenian_ghat) - KEY_Armenian_TCHE = uint(C.GDK_KEY_Armenian_TCHE) - KEY_Armenian_tche = uint(C.GDK_KEY_Armenian_tche) - KEY_Armenian_MEN = uint(C.GDK_KEY_Armenian_MEN) - KEY_Armenian_men = uint(C.GDK_KEY_Armenian_men) - KEY_Armenian_HI = uint(C.GDK_KEY_Armenian_HI) - KEY_Armenian_hi = uint(C.GDK_KEY_Armenian_hi) - KEY_Armenian_NU = uint(C.GDK_KEY_Armenian_NU) - KEY_Armenian_nu = uint(C.GDK_KEY_Armenian_nu) - KEY_Armenian_SHA = uint(C.GDK_KEY_Armenian_SHA) - KEY_Armenian_sha = uint(C.GDK_KEY_Armenian_sha) - KEY_Armenian_VO = uint(C.GDK_KEY_Armenian_VO) - KEY_Armenian_vo = uint(C.GDK_KEY_Armenian_vo) - KEY_Armenian_CHA = uint(C.GDK_KEY_Armenian_CHA) - KEY_Armenian_cha = uint(C.GDK_KEY_Armenian_cha) - KEY_Armenian_PE = uint(C.GDK_KEY_Armenian_PE) - KEY_Armenian_pe = uint(C.GDK_KEY_Armenian_pe) - KEY_Armenian_JE = uint(C.GDK_KEY_Armenian_JE) - KEY_Armenian_je = uint(C.GDK_KEY_Armenian_je) - KEY_Armenian_RA = uint(C.GDK_KEY_Armenian_RA) - KEY_Armenian_ra = uint(C.GDK_KEY_Armenian_ra) - KEY_Armenian_SE = uint(C.GDK_KEY_Armenian_SE) - KEY_Armenian_se = uint(C.GDK_KEY_Armenian_se) - KEY_Armenian_VEV = uint(C.GDK_KEY_Armenian_VEV) - KEY_Armenian_vev = uint(C.GDK_KEY_Armenian_vev) - KEY_Armenian_TYUN = uint(C.GDK_KEY_Armenian_TYUN) - KEY_Armenian_tyun = uint(C.GDK_KEY_Armenian_tyun) - KEY_Armenian_RE = uint(C.GDK_KEY_Armenian_RE) - KEY_Armenian_re = uint(C.GDK_KEY_Armenian_re) - KEY_Armenian_TSO = uint(C.GDK_KEY_Armenian_TSO) - KEY_Armenian_tso = uint(C.GDK_KEY_Armenian_tso) - KEY_Armenian_VYUN = uint(C.GDK_KEY_Armenian_VYUN) - KEY_Armenian_vyun = uint(C.GDK_KEY_Armenian_vyun) - KEY_Armenian_PYUR = uint(C.GDK_KEY_Armenian_PYUR) - KEY_Armenian_pyur = uint(C.GDK_KEY_Armenian_pyur) - KEY_Armenian_KE = uint(C.GDK_KEY_Armenian_KE) - KEY_Armenian_ke = uint(C.GDK_KEY_Armenian_ke) - KEY_Armenian_O = uint(C.GDK_KEY_Armenian_O) - KEY_Armenian_o = uint(C.GDK_KEY_Armenian_o) - KEY_Armenian_FE = uint(C.GDK_KEY_Armenian_FE) - KEY_Armenian_fe = uint(C.GDK_KEY_Armenian_fe) - KEY_Armenian_apostrophe = uint(C.GDK_KEY_Armenian_apostrophe) - KEY_Georgian_an = uint(C.GDK_KEY_Georgian_an) - KEY_Georgian_ban = uint(C.GDK_KEY_Georgian_ban) - KEY_Georgian_gan = uint(C.GDK_KEY_Georgian_gan) - KEY_Georgian_don = uint(C.GDK_KEY_Georgian_don) - KEY_Georgian_en = uint(C.GDK_KEY_Georgian_en) - KEY_Georgian_vin = uint(C.GDK_KEY_Georgian_vin) - KEY_Georgian_zen = uint(C.GDK_KEY_Georgian_zen) - KEY_Georgian_tan = uint(C.GDK_KEY_Georgian_tan) - KEY_Georgian_in = uint(C.GDK_KEY_Georgian_in) - KEY_Georgian_kan = uint(C.GDK_KEY_Georgian_kan) - KEY_Georgian_las = uint(C.GDK_KEY_Georgian_las) - KEY_Georgian_man = uint(C.GDK_KEY_Georgian_man) - KEY_Georgian_nar = uint(C.GDK_KEY_Georgian_nar) - KEY_Georgian_on = uint(C.GDK_KEY_Georgian_on) - KEY_Georgian_par = uint(C.GDK_KEY_Georgian_par) - KEY_Georgian_zhar = uint(C.GDK_KEY_Georgian_zhar) - KEY_Georgian_rae = uint(C.GDK_KEY_Georgian_rae) - KEY_Georgian_san = uint(C.GDK_KEY_Georgian_san) - KEY_Georgian_tar = uint(C.GDK_KEY_Georgian_tar) - KEY_Georgian_un = uint(C.GDK_KEY_Georgian_un) - KEY_Georgian_phar = uint(C.GDK_KEY_Georgian_phar) - KEY_Georgian_khar = uint(C.GDK_KEY_Georgian_khar) - KEY_Georgian_ghan = uint(C.GDK_KEY_Georgian_ghan) - KEY_Georgian_qar = uint(C.GDK_KEY_Georgian_qar) - KEY_Georgian_shin = uint(C.GDK_KEY_Georgian_shin) - KEY_Georgian_chin = uint(C.GDK_KEY_Georgian_chin) - KEY_Georgian_can = uint(C.GDK_KEY_Georgian_can) - KEY_Georgian_jil = uint(C.GDK_KEY_Georgian_jil) - KEY_Georgian_cil = uint(C.GDK_KEY_Georgian_cil) - KEY_Georgian_char = uint(C.GDK_KEY_Georgian_char) - KEY_Georgian_xan = uint(C.GDK_KEY_Georgian_xan) - KEY_Georgian_jhan = uint(C.GDK_KEY_Georgian_jhan) - KEY_Georgian_hae = uint(C.GDK_KEY_Georgian_hae) - KEY_Georgian_he = uint(C.GDK_KEY_Georgian_he) - KEY_Georgian_hie = uint(C.GDK_KEY_Georgian_hie) - KEY_Georgian_we = uint(C.GDK_KEY_Georgian_we) - KEY_Georgian_har = uint(C.GDK_KEY_Georgian_har) - KEY_Georgian_hoe = uint(C.GDK_KEY_Georgian_hoe) - KEY_Georgian_fi = uint(C.GDK_KEY_Georgian_fi) - KEY_Xabovedot = uint(C.GDK_KEY_Xabovedot) - KEY_Ibreve = uint(C.GDK_KEY_Ibreve) - KEY_Zstroke = uint(C.GDK_KEY_Zstroke) - KEY_Gcaron = uint(C.GDK_KEY_Gcaron) - KEY_Ocaron = uint(C.GDK_KEY_Ocaron) - KEY_Obarred = uint(C.GDK_KEY_Obarred) - KEY_xabovedot = uint(C.GDK_KEY_xabovedot) - KEY_ibreve = uint(C.GDK_KEY_ibreve) - KEY_zstroke = uint(C.GDK_KEY_zstroke) - KEY_gcaron = uint(C.GDK_KEY_gcaron) - KEY_ocaron = uint(C.GDK_KEY_ocaron) - KEY_obarred = uint(C.GDK_KEY_obarred) - KEY_SCHWA = uint(C.GDK_KEY_SCHWA) - KEY_schwa = uint(C.GDK_KEY_schwa) - KEY_EZH = uint(C.GDK_KEY_EZH) - KEY_ezh = uint(C.GDK_KEY_ezh) - KEY_Lbelowdot = uint(C.GDK_KEY_Lbelowdot) - KEY_lbelowdot = uint(C.GDK_KEY_lbelowdot) - KEY_Abelowdot = uint(C.GDK_KEY_Abelowdot) - KEY_abelowdot = uint(C.GDK_KEY_abelowdot) - KEY_Ahook = uint(C.GDK_KEY_Ahook) - KEY_ahook = uint(C.GDK_KEY_ahook) - KEY_Acircumflexacute = uint(C.GDK_KEY_Acircumflexacute) - KEY_acircumflexacute = uint(C.GDK_KEY_acircumflexacute) - KEY_Acircumflexgrave = uint(C.GDK_KEY_Acircumflexgrave) - KEY_acircumflexgrave = uint(C.GDK_KEY_acircumflexgrave) - KEY_Acircumflexhook = uint(C.GDK_KEY_Acircumflexhook) - KEY_acircumflexhook = uint(C.GDK_KEY_acircumflexhook) - KEY_Acircumflextilde = uint(C.GDK_KEY_Acircumflextilde) - KEY_acircumflextilde = uint(C.GDK_KEY_acircumflextilde) - KEY_Acircumflexbelowdot = uint(C.GDK_KEY_Acircumflexbelowdot) - KEY_acircumflexbelowdot = uint(C.GDK_KEY_acircumflexbelowdot) - KEY_Abreveacute = uint(C.GDK_KEY_Abreveacute) - KEY_abreveacute = uint(C.GDK_KEY_abreveacute) - KEY_Abrevegrave = uint(C.GDK_KEY_Abrevegrave) - KEY_abrevegrave = uint(C.GDK_KEY_abrevegrave) - KEY_Abrevehook = uint(C.GDK_KEY_Abrevehook) - KEY_abrevehook = uint(C.GDK_KEY_abrevehook) - KEY_Abrevetilde = uint(C.GDK_KEY_Abrevetilde) - KEY_abrevetilde = uint(C.GDK_KEY_abrevetilde) - KEY_Abrevebelowdot = uint(C.GDK_KEY_Abrevebelowdot) - KEY_abrevebelowdot = uint(C.GDK_KEY_abrevebelowdot) - KEY_Ebelowdot = uint(C.GDK_KEY_Ebelowdot) - KEY_ebelowdot = uint(C.GDK_KEY_ebelowdot) - KEY_Ehook = uint(C.GDK_KEY_Ehook) - KEY_ehook = uint(C.GDK_KEY_ehook) - KEY_Etilde = uint(C.GDK_KEY_Etilde) - KEY_etilde = uint(C.GDK_KEY_etilde) - KEY_Ecircumflexacute = uint(C.GDK_KEY_Ecircumflexacute) - KEY_ecircumflexacute = uint(C.GDK_KEY_ecircumflexacute) - KEY_Ecircumflexgrave = uint(C.GDK_KEY_Ecircumflexgrave) - KEY_ecircumflexgrave = uint(C.GDK_KEY_ecircumflexgrave) - KEY_Ecircumflexhook = uint(C.GDK_KEY_Ecircumflexhook) - KEY_ecircumflexhook = uint(C.GDK_KEY_ecircumflexhook) - KEY_Ecircumflextilde = uint(C.GDK_KEY_Ecircumflextilde) - KEY_ecircumflextilde = uint(C.GDK_KEY_ecircumflextilde) - KEY_Ecircumflexbelowdot = uint(C.GDK_KEY_Ecircumflexbelowdot) - KEY_ecircumflexbelowdot = uint(C.GDK_KEY_ecircumflexbelowdot) - KEY_Ihook = uint(C.GDK_KEY_Ihook) - KEY_ihook = uint(C.GDK_KEY_ihook) - KEY_Ibelowdot = uint(C.GDK_KEY_Ibelowdot) - KEY_ibelowdot = uint(C.GDK_KEY_ibelowdot) - KEY_Obelowdot = uint(C.GDK_KEY_Obelowdot) - KEY_obelowdot = uint(C.GDK_KEY_obelowdot) - KEY_Ohook = uint(C.GDK_KEY_Ohook) - KEY_ohook = uint(C.GDK_KEY_ohook) - KEY_Ocircumflexacute = uint(C.GDK_KEY_Ocircumflexacute) - KEY_ocircumflexacute = uint(C.GDK_KEY_ocircumflexacute) - KEY_Ocircumflexgrave = uint(C.GDK_KEY_Ocircumflexgrave) - KEY_ocircumflexgrave = uint(C.GDK_KEY_ocircumflexgrave) - KEY_Ocircumflexhook = uint(C.GDK_KEY_Ocircumflexhook) - KEY_ocircumflexhook = uint(C.GDK_KEY_ocircumflexhook) - KEY_Ocircumflextilde = uint(C.GDK_KEY_Ocircumflextilde) - KEY_ocircumflextilde = uint(C.GDK_KEY_ocircumflextilde) - KEY_Ocircumflexbelowdot = uint(C.GDK_KEY_Ocircumflexbelowdot) - KEY_ocircumflexbelowdot = uint(C.GDK_KEY_ocircumflexbelowdot) - KEY_Ohornacute = uint(C.GDK_KEY_Ohornacute) - KEY_ohornacute = uint(C.GDK_KEY_ohornacute) - KEY_Ohorngrave = uint(C.GDK_KEY_Ohorngrave) - KEY_ohorngrave = uint(C.GDK_KEY_ohorngrave) - KEY_Ohornhook = uint(C.GDK_KEY_Ohornhook) - KEY_ohornhook = uint(C.GDK_KEY_ohornhook) - KEY_Ohorntilde = uint(C.GDK_KEY_Ohorntilde) - KEY_ohorntilde = uint(C.GDK_KEY_ohorntilde) - KEY_Ohornbelowdot = uint(C.GDK_KEY_Ohornbelowdot) - KEY_ohornbelowdot = uint(C.GDK_KEY_ohornbelowdot) - KEY_Ubelowdot = uint(C.GDK_KEY_Ubelowdot) - KEY_ubelowdot = uint(C.GDK_KEY_ubelowdot) - KEY_Uhook = uint(C.GDK_KEY_Uhook) - KEY_uhook = uint(C.GDK_KEY_uhook) - KEY_Uhornacute = uint(C.GDK_KEY_Uhornacute) - KEY_uhornacute = uint(C.GDK_KEY_uhornacute) - KEY_Uhorngrave = uint(C.GDK_KEY_Uhorngrave) - KEY_uhorngrave = uint(C.GDK_KEY_uhorngrave) - KEY_Uhornhook = uint(C.GDK_KEY_Uhornhook) - KEY_uhornhook = uint(C.GDK_KEY_uhornhook) - KEY_Uhorntilde = uint(C.GDK_KEY_Uhorntilde) - KEY_uhorntilde = uint(C.GDK_KEY_uhorntilde) - KEY_Uhornbelowdot = uint(C.GDK_KEY_Uhornbelowdot) - KEY_uhornbelowdot = uint(C.GDK_KEY_uhornbelowdot) - KEY_Ybelowdot = uint(C.GDK_KEY_Ybelowdot) - KEY_ybelowdot = uint(C.GDK_KEY_ybelowdot) - KEY_Yhook = uint(C.GDK_KEY_Yhook) - KEY_yhook = uint(C.GDK_KEY_yhook) - KEY_Ytilde = uint(C.GDK_KEY_Ytilde) - KEY_ytilde = uint(C.GDK_KEY_ytilde) - KEY_Ohorn = uint(C.GDK_KEY_Ohorn) - KEY_ohorn = uint(C.GDK_KEY_ohorn) - KEY_Uhorn = uint(C.GDK_KEY_Uhorn) - KEY_uhorn = uint(C.GDK_KEY_uhorn) - KEY_EcuSign = uint(C.GDK_KEY_EcuSign) - KEY_ColonSign = uint(C.GDK_KEY_ColonSign) - KEY_CruzeiroSign = uint(C.GDK_KEY_CruzeiroSign) - KEY_FFrancSign = uint(C.GDK_KEY_FFrancSign) - KEY_LiraSign = uint(C.GDK_KEY_LiraSign) - KEY_MillSign = uint(C.GDK_KEY_MillSign) - KEY_NairaSign = uint(C.GDK_KEY_NairaSign) - KEY_PesetaSign = uint(C.GDK_KEY_PesetaSign) - KEY_RupeeSign = uint(C.GDK_KEY_RupeeSign) - KEY_WonSign = uint(C.GDK_KEY_WonSign) - KEY_NewSheqelSign = uint(C.GDK_KEY_NewSheqelSign) - KEY_DongSign = uint(C.GDK_KEY_DongSign) - KEY_EuroSign = uint(C.GDK_KEY_EuroSign) - KEY_zerosuperior = uint(C.GDK_KEY_zerosuperior) - KEY_foursuperior = uint(C.GDK_KEY_foursuperior) - KEY_fivesuperior = uint(C.GDK_KEY_fivesuperior) - KEY_sixsuperior = uint(C.GDK_KEY_sixsuperior) - KEY_sevensuperior = uint(C.GDK_KEY_sevensuperior) - KEY_eightsuperior = uint(C.GDK_KEY_eightsuperior) - KEY_ninesuperior = uint(C.GDK_KEY_ninesuperior) - KEY_zerosubscript = uint(C.GDK_KEY_zerosubscript) - KEY_onesubscript = uint(C.GDK_KEY_onesubscript) - KEY_twosubscript = uint(C.GDK_KEY_twosubscript) - KEY_threesubscript = uint(C.GDK_KEY_threesubscript) - KEY_foursubscript = uint(C.GDK_KEY_foursubscript) - KEY_fivesubscript = uint(C.GDK_KEY_fivesubscript) - KEY_sixsubscript = uint(C.GDK_KEY_sixsubscript) - KEY_sevensubscript = uint(C.GDK_KEY_sevensubscript) - KEY_eightsubscript = uint(C.GDK_KEY_eightsubscript) - KEY_ninesubscript = uint(C.GDK_KEY_ninesubscript) - KEY_partdifferential = uint(C.GDK_KEY_partdifferential) - KEY_emptyset = uint(C.GDK_KEY_emptyset) - KEY_elementof = uint(C.GDK_KEY_elementof) - KEY_notelementof = uint(C.GDK_KEY_notelementof) - KEY_containsas = uint(C.GDK_KEY_containsas) - KEY_squareroot = uint(C.GDK_KEY_squareroot) - KEY_cuberoot = uint(C.GDK_KEY_cuberoot) - KEY_fourthroot = uint(C.GDK_KEY_fourthroot) - KEY_dintegral = uint(C.GDK_KEY_dintegral) - KEY_tintegral = uint(C.GDK_KEY_tintegral) - KEY_because = uint(C.GDK_KEY_because) - KEY_approxeq = uint(C.GDK_KEY_approxeq) - KEY_notapproxeq = uint(C.GDK_KEY_notapproxeq) - KEY_notidentical = uint(C.GDK_KEY_notidentical) - KEY_stricteq = uint(C.GDK_KEY_stricteq) - KEY_braille_dot_1 = uint(C.GDK_KEY_braille_dot_1) - KEY_braille_dot_2 = uint(C.GDK_KEY_braille_dot_2) - KEY_braille_dot_3 = uint(C.GDK_KEY_braille_dot_3) - KEY_braille_dot_4 = uint(C.GDK_KEY_braille_dot_4) - KEY_braille_dot_5 = uint(C.GDK_KEY_braille_dot_5) - KEY_braille_dot_6 = uint(C.GDK_KEY_braille_dot_6) - KEY_braille_dot_7 = uint(C.GDK_KEY_braille_dot_7) - KEY_braille_dot_8 = uint(C.GDK_KEY_braille_dot_8) - KEY_braille_dot_9 = uint(C.GDK_KEY_braille_dot_9) - KEY_braille_dot_10 = uint(C.GDK_KEY_braille_dot_10) - KEY_braille_blank = uint(C.GDK_KEY_braille_blank) - KEY_braille_dots_1 = uint(C.GDK_KEY_braille_dots_1) - KEY_braille_dots_2 = uint(C.GDK_KEY_braille_dots_2) - KEY_braille_dots_12 = uint(C.GDK_KEY_braille_dots_12) - KEY_braille_dots_3 = uint(C.GDK_KEY_braille_dots_3) - KEY_braille_dots_13 = uint(C.GDK_KEY_braille_dots_13) - KEY_braille_dots_23 = uint(C.GDK_KEY_braille_dots_23) - KEY_braille_dots_123 = uint(C.GDK_KEY_braille_dots_123) - KEY_braille_dots_4 = uint(C.GDK_KEY_braille_dots_4) - KEY_braille_dots_14 = uint(C.GDK_KEY_braille_dots_14) - KEY_braille_dots_24 = uint(C.GDK_KEY_braille_dots_24) - KEY_braille_dots_124 = uint(C.GDK_KEY_braille_dots_124) - KEY_braille_dots_34 = uint(C.GDK_KEY_braille_dots_34) - KEY_braille_dots_134 = uint(C.GDK_KEY_braille_dots_134) - KEY_braille_dots_234 = uint(C.GDK_KEY_braille_dots_234) - KEY_braille_dots_1234 = uint(C.GDK_KEY_braille_dots_1234) - KEY_braille_dots_5 = uint(C.GDK_KEY_braille_dots_5) - KEY_braille_dots_15 = uint(C.GDK_KEY_braille_dots_15) - KEY_braille_dots_25 = uint(C.GDK_KEY_braille_dots_25) - KEY_braille_dots_125 = uint(C.GDK_KEY_braille_dots_125) - KEY_braille_dots_35 = uint(C.GDK_KEY_braille_dots_35) - KEY_braille_dots_135 = uint(C.GDK_KEY_braille_dots_135) - KEY_braille_dots_235 = uint(C.GDK_KEY_braille_dots_235) - KEY_braille_dots_1235 = uint(C.GDK_KEY_braille_dots_1235) - KEY_braille_dots_45 = uint(C.GDK_KEY_braille_dots_45) - KEY_braille_dots_145 = uint(C.GDK_KEY_braille_dots_145) - KEY_braille_dots_245 = uint(C.GDK_KEY_braille_dots_245) - KEY_braille_dots_1245 = uint(C.GDK_KEY_braille_dots_1245) - KEY_braille_dots_345 = uint(C.GDK_KEY_braille_dots_345) - KEY_braille_dots_1345 = uint(C.GDK_KEY_braille_dots_1345) - KEY_braille_dots_2345 = uint(C.GDK_KEY_braille_dots_2345) - KEY_braille_dots_12345 = uint(C.GDK_KEY_braille_dots_12345) - KEY_braille_dots_6 = uint(C.GDK_KEY_braille_dots_6) - KEY_braille_dots_16 = uint(C.GDK_KEY_braille_dots_16) - KEY_braille_dots_26 = uint(C.GDK_KEY_braille_dots_26) - KEY_braille_dots_126 = uint(C.GDK_KEY_braille_dots_126) - KEY_braille_dots_36 = uint(C.GDK_KEY_braille_dots_36) - KEY_braille_dots_136 = uint(C.GDK_KEY_braille_dots_136) - KEY_braille_dots_236 = uint(C.GDK_KEY_braille_dots_236) - KEY_braille_dots_1236 = uint(C.GDK_KEY_braille_dots_1236) - KEY_braille_dots_46 = uint(C.GDK_KEY_braille_dots_46) - KEY_braille_dots_146 = uint(C.GDK_KEY_braille_dots_146) - KEY_braille_dots_246 = uint(C.GDK_KEY_braille_dots_246) - KEY_braille_dots_1246 = uint(C.GDK_KEY_braille_dots_1246) - KEY_braille_dots_346 = uint(C.GDK_KEY_braille_dots_346) - KEY_braille_dots_1346 = uint(C.GDK_KEY_braille_dots_1346) - KEY_braille_dots_2346 = uint(C.GDK_KEY_braille_dots_2346) - KEY_braille_dots_12346 = uint(C.GDK_KEY_braille_dots_12346) - KEY_braille_dots_56 = uint(C.GDK_KEY_braille_dots_56) - KEY_braille_dots_156 = uint(C.GDK_KEY_braille_dots_156) - KEY_braille_dots_256 = uint(C.GDK_KEY_braille_dots_256) - KEY_braille_dots_1256 = uint(C.GDK_KEY_braille_dots_1256) - KEY_braille_dots_356 = uint(C.GDK_KEY_braille_dots_356) - KEY_braille_dots_1356 = uint(C.GDK_KEY_braille_dots_1356) - KEY_braille_dots_2356 = uint(C.GDK_KEY_braille_dots_2356) - KEY_braille_dots_12356 = uint(C.GDK_KEY_braille_dots_12356) - KEY_braille_dots_456 = uint(C.GDK_KEY_braille_dots_456) - KEY_braille_dots_1456 = uint(C.GDK_KEY_braille_dots_1456) - KEY_braille_dots_2456 = uint(C.GDK_KEY_braille_dots_2456) - KEY_braille_dots_12456 = uint(C.GDK_KEY_braille_dots_12456) - KEY_braille_dots_3456 = uint(C.GDK_KEY_braille_dots_3456) - KEY_braille_dots_13456 = uint(C.GDK_KEY_braille_dots_13456) - KEY_braille_dots_23456 = uint(C.GDK_KEY_braille_dots_23456) - KEY_braille_dots_123456 = uint(C.GDK_KEY_braille_dots_123456) - KEY_braille_dots_7 = uint(C.GDK_KEY_braille_dots_7) - KEY_braille_dots_17 = uint(C.GDK_KEY_braille_dots_17) - KEY_braille_dots_27 = uint(C.GDK_KEY_braille_dots_27) - KEY_braille_dots_127 = uint(C.GDK_KEY_braille_dots_127) - KEY_braille_dots_37 = uint(C.GDK_KEY_braille_dots_37) - KEY_braille_dots_137 = uint(C.GDK_KEY_braille_dots_137) - KEY_braille_dots_237 = uint(C.GDK_KEY_braille_dots_237) - KEY_braille_dots_1237 = uint(C.GDK_KEY_braille_dots_1237) - KEY_braille_dots_47 = uint(C.GDK_KEY_braille_dots_47) - KEY_braille_dots_147 = uint(C.GDK_KEY_braille_dots_147) - KEY_braille_dots_247 = uint(C.GDK_KEY_braille_dots_247) - KEY_braille_dots_1247 = uint(C.GDK_KEY_braille_dots_1247) - KEY_braille_dots_347 = uint(C.GDK_KEY_braille_dots_347) - KEY_braille_dots_1347 = uint(C.GDK_KEY_braille_dots_1347) - KEY_braille_dots_2347 = uint(C.GDK_KEY_braille_dots_2347) - KEY_braille_dots_12347 = uint(C.GDK_KEY_braille_dots_12347) - KEY_braille_dots_57 = uint(C.GDK_KEY_braille_dots_57) - KEY_braille_dots_157 = uint(C.GDK_KEY_braille_dots_157) - KEY_braille_dots_257 = uint(C.GDK_KEY_braille_dots_257) - KEY_braille_dots_1257 = uint(C.GDK_KEY_braille_dots_1257) - KEY_braille_dots_357 = uint(C.GDK_KEY_braille_dots_357) - KEY_braille_dots_1357 = uint(C.GDK_KEY_braille_dots_1357) - KEY_braille_dots_2357 = uint(C.GDK_KEY_braille_dots_2357) - KEY_braille_dots_12357 = uint(C.GDK_KEY_braille_dots_12357) - KEY_braille_dots_457 = uint(C.GDK_KEY_braille_dots_457) - KEY_braille_dots_1457 = uint(C.GDK_KEY_braille_dots_1457) - KEY_braille_dots_2457 = uint(C.GDK_KEY_braille_dots_2457) - KEY_braille_dots_12457 = uint(C.GDK_KEY_braille_dots_12457) - KEY_braille_dots_3457 = uint(C.GDK_KEY_braille_dots_3457) - KEY_braille_dots_13457 = uint(C.GDK_KEY_braille_dots_13457) - KEY_braille_dots_23457 = uint(C.GDK_KEY_braille_dots_23457) - KEY_braille_dots_123457 = uint(C.GDK_KEY_braille_dots_123457) - KEY_braille_dots_67 = uint(C.GDK_KEY_braille_dots_67) - KEY_braille_dots_167 = uint(C.GDK_KEY_braille_dots_167) - KEY_braille_dots_267 = uint(C.GDK_KEY_braille_dots_267) - KEY_braille_dots_1267 = uint(C.GDK_KEY_braille_dots_1267) - KEY_braille_dots_367 = uint(C.GDK_KEY_braille_dots_367) - KEY_braille_dots_1367 = uint(C.GDK_KEY_braille_dots_1367) - KEY_braille_dots_2367 = uint(C.GDK_KEY_braille_dots_2367) - KEY_braille_dots_12367 = uint(C.GDK_KEY_braille_dots_12367) - KEY_braille_dots_467 = uint(C.GDK_KEY_braille_dots_467) - KEY_braille_dots_1467 = uint(C.GDK_KEY_braille_dots_1467) - KEY_braille_dots_2467 = uint(C.GDK_KEY_braille_dots_2467) - KEY_braille_dots_12467 = uint(C.GDK_KEY_braille_dots_12467) - KEY_braille_dots_3467 = uint(C.GDK_KEY_braille_dots_3467) - KEY_braille_dots_13467 = uint(C.GDK_KEY_braille_dots_13467) - KEY_braille_dots_23467 = uint(C.GDK_KEY_braille_dots_23467) - KEY_braille_dots_123467 = uint(C.GDK_KEY_braille_dots_123467) - KEY_braille_dots_567 = uint(C.GDK_KEY_braille_dots_567) - KEY_braille_dots_1567 = uint(C.GDK_KEY_braille_dots_1567) - KEY_braille_dots_2567 = uint(C.GDK_KEY_braille_dots_2567) - KEY_braille_dots_12567 = uint(C.GDK_KEY_braille_dots_12567) - KEY_braille_dots_3567 = uint(C.GDK_KEY_braille_dots_3567) - KEY_braille_dots_13567 = uint(C.GDK_KEY_braille_dots_13567) - KEY_braille_dots_23567 = uint(C.GDK_KEY_braille_dots_23567) - KEY_braille_dots_123567 = uint(C.GDK_KEY_braille_dots_123567) - KEY_braille_dots_4567 = uint(C.GDK_KEY_braille_dots_4567) - KEY_braille_dots_14567 = uint(C.GDK_KEY_braille_dots_14567) - KEY_braille_dots_24567 = uint(C.GDK_KEY_braille_dots_24567) - KEY_braille_dots_124567 = uint(C.GDK_KEY_braille_dots_124567) - KEY_braille_dots_34567 = uint(C.GDK_KEY_braille_dots_34567) - KEY_braille_dots_134567 = uint(C.GDK_KEY_braille_dots_134567) - KEY_braille_dots_234567 = uint(C.GDK_KEY_braille_dots_234567) - KEY_braille_dots_1234567 = uint(C.GDK_KEY_braille_dots_1234567) - KEY_braille_dots_8 = uint(C.GDK_KEY_braille_dots_8) - KEY_braille_dots_18 = uint(C.GDK_KEY_braille_dots_18) - KEY_braille_dots_28 = uint(C.GDK_KEY_braille_dots_28) - KEY_braille_dots_128 = uint(C.GDK_KEY_braille_dots_128) - KEY_braille_dots_38 = uint(C.GDK_KEY_braille_dots_38) - KEY_braille_dots_138 = uint(C.GDK_KEY_braille_dots_138) - KEY_braille_dots_238 = uint(C.GDK_KEY_braille_dots_238) - KEY_braille_dots_1238 = uint(C.GDK_KEY_braille_dots_1238) - KEY_braille_dots_48 = uint(C.GDK_KEY_braille_dots_48) - KEY_braille_dots_148 = uint(C.GDK_KEY_braille_dots_148) - KEY_braille_dots_248 = uint(C.GDK_KEY_braille_dots_248) - KEY_braille_dots_1248 = uint(C.GDK_KEY_braille_dots_1248) - KEY_braille_dots_348 = uint(C.GDK_KEY_braille_dots_348) - KEY_braille_dots_1348 = uint(C.GDK_KEY_braille_dots_1348) - KEY_braille_dots_2348 = uint(C.GDK_KEY_braille_dots_2348) - KEY_braille_dots_12348 = uint(C.GDK_KEY_braille_dots_12348) - KEY_braille_dots_58 = uint(C.GDK_KEY_braille_dots_58) - KEY_braille_dots_158 = uint(C.GDK_KEY_braille_dots_158) - KEY_braille_dots_258 = uint(C.GDK_KEY_braille_dots_258) - KEY_braille_dots_1258 = uint(C.GDK_KEY_braille_dots_1258) - KEY_braille_dots_358 = uint(C.GDK_KEY_braille_dots_358) - KEY_braille_dots_1358 = uint(C.GDK_KEY_braille_dots_1358) - KEY_braille_dots_2358 = uint(C.GDK_KEY_braille_dots_2358) - KEY_braille_dots_12358 = uint(C.GDK_KEY_braille_dots_12358) - KEY_braille_dots_458 = uint(C.GDK_KEY_braille_dots_458) - KEY_braille_dots_1458 = uint(C.GDK_KEY_braille_dots_1458) - KEY_braille_dots_2458 = uint(C.GDK_KEY_braille_dots_2458) - KEY_braille_dots_12458 = uint(C.GDK_KEY_braille_dots_12458) - KEY_braille_dots_3458 = uint(C.GDK_KEY_braille_dots_3458) - KEY_braille_dots_13458 = uint(C.GDK_KEY_braille_dots_13458) - KEY_braille_dots_23458 = uint(C.GDK_KEY_braille_dots_23458) - KEY_braille_dots_123458 = uint(C.GDK_KEY_braille_dots_123458) - KEY_braille_dots_68 = uint(C.GDK_KEY_braille_dots_68) - KEY_braille_dots_168 = uint(C.GDK_KEY_braille_dots_168) - KEY_braille_dots_268 = uint(C.GDK_KEY_braille_dots_268) - KEY_braille_dots_1268 = uint(C.GDK_KEY_braille_dots_1268) - KEY_braille_dots_368 = uint(C.GDK_KEY_braille_dots_368) - KEY_braille_dots_1368 = uint(C.GDK_KEY_braille_dots_1368) - KEY_braille_dots_2368 = uint(C.GDK_KEY_braille_dots_2368) - KEY_braille_dots_12368 = uint(C.GDK_KEY_braille_dots_12368) - KEY_braille_dots_468 = uint(C.GDK_KEY_braille_dots_468) - KEY_braille_dots_1468 = uint(C.GDK_KEY_braille_dots_1468) - KEY_braille_dots_2468 = uint(C.GDK_KEY_braille_dots_2468) - KEY_braille_dots_12468 = uint(C.GDK_KEY_braille_dots_12468) - KEY_braille_dots_3468 = uint(C.GDK_KEY_braille_dots_3468) - KEY_braille_dots_13468 = uint(C.GDK_KEY_braille_dots_13468) - KEY_braille_dots_23468 = uint(C.GDK_KEY_braille_dots_23468) - KEY_braille_dots_123468 = uint(C.GDK_KEY_braille_dots_123468) - KEY_braille_dots_568 = uint(C.GDK_KEY_braille_dots_568) - KEY_braille_dots_1568 = uint(C.GDK_KEY_braille_dots_1568) - KEY_braille_dots_2568 = uint(C.GDK_KEY_braille_dots_2568) - KEY_braille_dots_12568 = uint(C.GDK_KEY_braille_dots_12568) - KEY_braille_dots_3568 = uint(C.GDK_KEY_braille_dots_3568) - KEY_braille_dots_13568 = uint(C.GDK_KEY_braille_dots_13568) - KEY_braille_dots_23568 = uint(C.GDK_KEY_braille_dots_23568) - KEY_braille_dots_123568 = uint(C.GDK_KEY_braille_dots_123568) - KEY_braille_dots_4568 = uint(C.GDK_KEY_braille_dots_4568) - KEY_braille_dots_14568 = uint(C.GDK_KEY_braille_dots_14568) - KEY_braille_dots_24568 = uint(C.GDK_KEY_braille_dots_24568) - KEY_braille_dots_124568 = uint(C.GDK_KEY_braille_dots_124568) - KEY_braille_dots_34568 = uint(C.GDK_KEY_braille_dots_34568) - KEY_braille_dots_134568 = uint(C.GDK_KEY_braille_dots_134568) - KEY_braille_dots_234568 = uint(C.GDK_KEY_braille_dots_234568) - KEY_braille_dots_1234568 = uint(C.GDK_KEY_braille_dots_1234568) - KEY_braille_dots_78 = uint(C.GDK_KEY_braille_dots_78) - KEY_braille_dots_178 = uint(C.GDK_KEY_braille_dots_178) - KEY_braille_dots_278 = uint(C.GDK_KEY_braille_dots_278) - KEY_braille_dots_1278 = uint(C.GDK_KEY_braille_dots_1278) - KEY_braille_dots_378 = uint(C.GDK_KEY_braille_dots_378) - KEY_braille_dots_1378 = uint(C.GDK_KEY_braille_dots_1378) - KEY_braille_dots_2378 = uint(C.GDK_KEY_braille_dots_2378) - KEY_braille_dots_12378 = uint(C.GDK_KEY_braille_dots_12378) - KEY_braille_dots_478 = uint(C.GDK_KEY_braille_dots_478) - KEY_braille_dots_1478 = uint(C.GDK_KEY_braille_dots_1478) - KEY_braille_dots_2478 = uint(C.GDK_KEY_braille_dots_2478) - KEY_braille_dots_12478 = uint(C.GDK_KEY_braille_dots_12478) - KEY_braille_dots_3478 = uint(C.GDK_KEY_braille_dots_3478) - KEY_braille_dots_13478 = uint(C.GDK_KEY_braille_dots_13478) - KEY_braille_dots_23478 = uint(C.GDK_KEY_braille_dots_23478) - KEY_braille_dots_123478 = uint(C.GDK_KEY_braille_dots_123478) - KEY_braille_dots_578 = uint(C.GDK_KEY_braille_dots_578) - KEY_braille_dots_1578 = uint(C.GDK_KEY_braille_dots_1578) - KEY_braille_dots_2578 = uint(C.GDK_KEY_braille_dots_2578) - KEY_braille_dots_12578 = uint(C.GDK_KEY_braille_dots_12578) - KEY_braille_dots_3578 = uint(C.GDK_KEY_braille_dots_3578) - KEY_braille_dots_13578 = uint(C.GDK_KEY_braille_dots_13578) - KEY_braille_dots_23578 = uint(C.GDK_KEY_braille_dots_23578) - KEY_braille_dots_123578 = uint(C.GDK_KEY_braille_dots_123578) - KEY_braille_dots_4578 = uint(C.GDK_KEY_braille_dots_4578) - KEY_braille_dots_14578 = uint(C.GDK_KEY_braille_dots_14578) - KEY_braille_dots_24578 = uint(C.GDK_KEY_braille_dots_24578) - KEY_braille_dots_124578 = uint(C.GDK_KEY_braille_dots_124578) - KEY_braille_dots_34578 = uint(C.GDK_KEY_braille_dots_34578) - KEY_braille_dots_134578 = uint(C.GDK_KEY_braille_dots_134578) - KEY_braille_dots_234578 = uint(C.GDK_KEY_braille_dots_234578) - KEY_braille_dots_1234578 = uint(C.GDK_KEY_braille_dots_1234578) - KEY_braille_dots_678 = uint(C.GDK_KEY_braille_dots_678) - KEY_braille_dots_1678 = uint(C.GDK_KEY_braille_dots_1678) - KEY_braille_dots_2678 = uint(C.GDK_KEY_braille_dots_2678) - KEY_braille_dots_12678 = uint(C.GDK_KEY_braille_dots_12678) - KEY_braille_dots_3678 = uint(C.GDK_KEY_braille_dots_3678) - KEY_braille_dots_13678 = uint(C.GDK_KEY_braille_dots_13678) - KEY_braille_dots_23678 = uint(C.GDK_KEY_braille_dots_23678) - KEY_braille_dots_123678 = uint(C.GDK_KEY_braille_dots_123678) - KEY_braille_dots_4678 = uint(C.GDK_KEY_braille_dots_4678) - KEY_braille_dots_14678 = uint(C.GDK_KEY_braille_dots_14678) - KEY_braille_dots_24678 = uint(C.GDK_KEY_braille_dots_24678) - KEY_braille_dots_124678 = uint(C.GDK_KEY_braille_dots_124678) - KEY_braille_dots_34678 = uint(C.GDK_KEY_braille_dots_34678) - KEY_braille_dots_134678 = uint(C.GDK_KEY_braille_dots_134678) - KEY_braille_dots_234678 = uint(C.GDK_KEY_braille_dots_234678) - KEY_braille_dots_1234678 = uint(C.GDK_KEY_braille_dots_1234678) - KEY_braille_dots_5678 = uint(C.GDK_KEY_braille_dots_5678) - KEY_braille_dots_15678 = uint(C.GDK_KEY_braille_dots_15678) - KEY_braille_dots_25678 = uint(C.GDK_KEY_braille_dots_25678) - KEY_braille_dots_125678 = uint(C.GDK_KEY_braille_dots_125678) - KEY_braille_dots_35678 = uint(C.GDK_KEY_braille_dots_35678) - KEY_braille_dots_135678 = uint(C.GDK_KEY_braille_dots_135678) - KEY_braille_dots_235678 = uint(C.GDK_KEY_braille_dots_235678) - KEY_braille_dots_1235678 = uint(C.GDK_KEY_braille_dots_1235678) - KEY_braille_dots_45678 = uint(C.GDK_KEY_braille_dots_45678) - KEY_braille_dots_145678 = uint(C.GDK_KEY_braille_dots_145678) - KEY_braille_dots_245678 = uint(C.GDK_KEY_braille_dots_245678) - KEY_braille_dots_1245678 = uint(C.GDK_KEY_braille_dots_1245678) - KEY_braille_dots_345678 = uint(C.GDK_KEY_braille_dots_345678) - KEY_braille_dots_1345678 = uint(C.GDK_KEY_braille_dots_1345678) - KEY_braille_dots_2345678 = uint(C.GDK_KEY_braille_dots_2345678) - KEY_braille_dots_12345678 = uint(C.GDK_KEY_braille_dots_12345678) - KEY_Sinh_ng = uint(C.GDK_KEY_Sinh_ng) - KEY_Sinh_h2 = uint(C.GDK_KEY_Sinh_h2) - KEY_Sinh_a = uint(C.GDK_KEY_Sinh_a) - KEY_Sinh_aa = uint(C.GDK_KEY_Sinh_aa) - KEY_Sinh_ae = uint(C.GDK_KEY_Sinh_ae) - KEY_Sinh_aee = uint(C.GDK_KEY_Sinh_aee) - KEY_Sinh_i = uint(C.GDK_KEY_Sinh_i) - KEY_Sinh_ii = uint(C.GDK_KEY_Sinh_ii) - KEY_Sinh_u = uint(C.GDK_KEY_Sinh_u) - KEY_Sinh_uu = uint(C.GDK_KEY_Sinh_uu) - KEY_Sinh_ri = uint(C.GDK_KEY_Sinh_ri) - KEY_Sinh_rii = uint(C.GDK_KEY_Sinh_rii) - KEY_Sinh_lu = uint(C.GDK_KEY_Sinh_lu) - KEY_Sinh_luu = uint(C.GDK_KEY_Sinh_luu) - KEY_Sinh_e = uint(C.GDK_KEY_Sinh_e) - KEY_Sinh_ee = uint(C.GDK_KEY_Sinh_ee) - KEY_Sinh_ai = uint(C.GDK_KEY_Sinh_ai) - KEY_Sinh_o = uint(C.GDK_KEY_Sinh_o) - KEY_Sinh_oo = uint(C.GDK_KEY_Sinh_oo) - KEY_Sinh_au = uint(C.GDK_KEY_Sinh_au) - KEY_Sinh_ka = uint(C.GDK_KEY_Sinh_ka) - KEY_Sinh_kha = uint(C.GDK_KEY_Sinh_kha) - KEY_Sinh_ga = uint(C.GDK_KEY_Sinh_ga) - KEY_Sinh_gha = uint(C.GDK_KEY_Sinh_gha) - KEY_Sinh_ng2 = uint(C.GDK_KEY_Sinh_ng2) - KEY_Sinh_nga = uint(C.GDK_KEY_Sinh_nga) - KEY_Sinh_ca = uint(C.GDK_KEY_Sinh_ca) - KEY_Sinh_cha = uint(C.GDK_KEY_Sinh_cha) - KEY_Sinh_ja = uint(C.GDK_KEY_Sinh_ja) - KEY_Sinh_jha = uint(C.GDK_KEY_Sinh_jha) - KEY_Sinh_nya = uint(C.GDK_KEY_Sinh_nya) - KEY_Sinh_jnya = uint(C.GDK_KEY_Sinh_jnya) - KEY_Sinh_nja = uint(C.GDK_KEY_Sinh_nja) - KEY_Sinh_tta = uint(C.GDK_KEY_Sinh_tta) - KEY_Sinh_ttha = uint(C.GDK_KEY_Sinh_ttha) - KEY_Sinh_dda = uint(C.GDK_KEY_Sinh_dda) - KEY_Sinh_ddha = uint(C.GDK_KEY_Sinh_ddha) - KEY_Sinh_nna = uint(C.GDK_KEY_Sinh_nna) - KEY_Sinh_ndda = uint(C.GDK_KEY_Sinh_ndda) - KEY_Sinh_tha = uint(C.GDK_KEY_Sinh_tha) - KEY_Sinh_thha = uint(C.GDK_KEY_Sinh_thha) - KEY_Sinh_dha = uint(C.GDK_KEY_Sinh_dha) - KEY_Sinh_dhha = uint(C.GDK_KEY_Sinh_dhha) - KEY_Sinh_na = uint(C.GDK_KEY_Sinh_na) - KEY_Sinh_ndha = uint(C.GDK_KEY_Sinh_ndha) - KEY_Sinh_pa = uint(C.GDK_KEY_Sinh_pa) - KEY_Sinh_pha = uint(C.GDK_KEY_Sinh_pha) - KEY_Sinh_ba = uint(C.GDK_KEY_Sinh_ba) - KEY_Sinh_bha = uint(C.GDK_KEY_Sinh_bha) - KEY_Sinh_ma = uint(C.GDK_KEY_Sinh_ma) - KEY_Sinh_mba = uint(C.GDK_KEY_Sinh_mba) - KEY_Sinh_ya = uint(C.GDK_KEY_Sinh_ya) - KEY_Sinh_ra = uint(C.GDK_KEY_Sinh_ra) - KEY_Sinh_la = uint(C.GDK_KEY_Sinh_la) - KEY_Sinh_va = uint(C.GDK_KEY_Sinh_va) - KEY_Sinh_sha = uint(C.GDK_KEY_Sinh_sha) - KEY_Sinh_ssha = uint(C.GDK_KEY_Sinh_ssha) - KEY_Sinh_sa = uint(C.GDK_KEY_Sinh_sa) - KEY_Sinh_ha = uint(C.GDK_KEY_Sinh_ha) - KEY_Sinh_lla = uint(C.GDK_KEY_Sinh_lla) - KEY_Sinh_fa = uint(C.GDK_KEY_Sinh_fa) - KEY_Sinh_al = uint(C.GDK_KEY_Sinh_al) - KEY_Sinh_aa2 = uint(C.GDK_KEY_Sinh_aa2) - KEY_Sinh_ae2 = uint(C.GDK_KEY_Sinh_ae2) - KEY_Sinh_aee2 = uint(C.GDK_KEY_Sinh_aee2) - KEY_Sinh_i2 = uint(C.GDK_KEY_Sinh_i2) - KEY_Sinh_ii2 = uint(C.GDK_KEY_Sinh_ii2) - KEY_Sinh_u2 = uint(C.GDK_KEY_Sinh_u2) - KEY_Sinh_uu2 = uint(C.GDK_KEY_Sinh_uu2) - KEY_Sinh_ru2 = uint(C.GDK_KEY_Sinh_ru2) - KEY_Sinh_e2 = uint(C.GDK_KEY_Sinh_e2) - KEY_Sinh_ee2 = uint(C.GDK_KEY_Sinh_ee2) - KEY_Sinh_ai2 = uint(C.GDK_KEY_Sinh_ai2) - KEY_Sinh_o2 = uint(C.GDK_KEY_Sinh_o2) - KEY_Sinh_oo2 = uint(C.GDK_KEY_Sinh_oo2) - KEY_Sinh_au2 = uint(C.GDK_KEY_Sinh_au2) - KEY_Sinh_lu2 = uint(C.GDK_KEY_Sinh_lu2) - KEY_Sinh_ruu2 = uint(C.GDK_KEY_Sinh_ruu2) - KEY_Sinh_luu2 = uint(C.GDK_KEY_Sinh_luu2) - KEY_Sinh_kunddaliya = uint(C.GDK_KEY_Sinh_kunddaliya) - KEY_ModeLock = uint(C.GDK_KEY_ModeLock) - KEY_MonBrightnessUp = uint(C.GDK_KEY_MonBrightnessUp) - KEY_MonBrightnessDown = uint(C.GDK_KEY_MonBrightnessDown) - KEY_KbdLightOnOff = uint(C.GDK_KEY_KbdLightOnOff) - KEY_KbdBrightnessUp = uint(C.GDK_KEY_KbdBrightnessUp) - KEY_KbdBrightnessDown = uint(C.GDK_KEY_KbdBrightnessDown) - KEY_Standby = uint(C.GDK_KEY_Standby) - KEY_AudioLowerVolume = uint(C.GDK_KEY_AudioLowerVolume) - KEY_AudioMute = uint(C.GDK_KEY_AudioMute) - KEY_AudioRaiseVolume = uint(C.GDK_KEY_AudioRaiseVolume) - KEY_AudioPlay = uint(C.GDK_KEY_AudioPlay) - KEY_AudioStop = uint(C.GDK_KEY_AudioStop) - KEY_AudioPrev = uint(C.GDK_KEY_AudioPrev) - KEY_AudioNext = uint(C.GDK_KEY_AudioNext) - KEY_HomePage = uint(C.GDK_KEY_HomePage) - KEY_Mail = uint(C.GDK_KEY_Mail) - KEY_Start = uint(C.GDK_KEY_Start) - KEY_Search = uint(C.GDK_KEY_Search) - KEY_AudioRecord = uint(C.GDK_KEY_AudioRecord) - KEY_Calculator = uint(C.GDK_KEY_Calculator) - KEY_Memo = uint(C.GDK_KEY_Memo) - KEY_ToDoList = uint(C.GDK_KEY_ToDoList) - KEY_Calendar = uint(C.GDK_KEY_Calendar) - KEY_PowerDown = uint(C.GDK_KEY_PowerDown) - KEY_ContrastAdjust = uint(C.GDK_KEY_ContrastAdjust) - KEY_RockerUp = uint(C.GDK_KEY_RockerUp) - KEY_RockerDown = uint(C.GDK_KEY_RockerDown) - KEY_RockerEnter = uint(C.GDK_KEY_RockerEnter) - KEY_Back = uint(C.GDK_KEY_Back) - KEY_Forward = uint(C.GDK_KEY_Forward) - KEY_Stop = uint(C.GDK_KEY_Stop) - KEY_Refresh = uint(C.GDK_KEY_Refresh) - KEY_PowerOff = uint(C.GDK_KEY_PowerOff) - KEY_WakeUp = uint(C.GDK_KEY_WakeUp) - KEY_Eject = uint(C.GDK_KEY_Eject) - KEY_ScreenSaver = uint(C.GDK_KEY_ScreenSaver) - KEY_WWW = uint(C.GDK_KEY_WWW) - KEY_Sleep = uint(C.GDK_KEY_Sleep) - KEY_Favorites = uint(C.GDK_KEY_Favorites) - KEY_AudioPause = uint(C.GDK_KEY_AudioPause) - KEY_AudioMedia = uint(C.GDK_KEY_AudioMedia) - KEY_MyComputer = uint(C.GDK_KEY_MyComputer) - KEY_VendorHome = uint(C.GDK_KEY_VendorHome) - KEY_LightBulb = uint(C.GDK_KEY_LightBulb) - KEY_Shop = uint(C.GDK_KEY_Shop) - KEY_History = uint(C.GDK_KEY_History) - KEY_OpenURL = uint(C.GDK_KEY_OpenURL) - KEY_AddFavorite = uint(C.GDK_KEY_AddFavorite) - KEY_HotLinks = uint(C.GDK_KEY_HotLinks) - KEY_BrightnessAdjust = uint(C.GDK_KEY_BrightnessAdjust) - KEY_Finance = uint(C.GDK_KEY_Finance) - KEY_Community = uint(C.GDK_KEY_Community) - KEY_AudioRewind = uint(C.GDK_KEY_AudioRewind) - KEY_BackForward = uint(C.GDK_KEY_BackForward) - KEY_Launch0 = uint(C.GDK_KEY_Launch0) - KEY_Launch1 = uint(C.GDK_KEY_Launch1) - KEY_Launch2 = uint(C.GDK_KEY_Launch2) - KEY_Launch3 = uint(C.GDK_KEY_Launch3) - KEY_Launch4 = uint(C.GDK_KEY_Launch4) - KEY_Launch5 = uint(C.GDK_KEY_Launch5) - KEY_Launch6 = uint(C.GDK_KEY_Launch6) - KEY_Launch7 = uint(C.GDK_KEY_Launch7) - KEY_Launch8 = uint(C.GDK_KEY_Launch8) - KEY_Launch9 = uint(C.GDK_KEY_Launch9) - KEY_LaunchA = uint(C.GDK_KEY_LaunchA) - KEY_LaunchB = uint(C.GDK_KEY_LaunchB) - KEY_LaunchC = uint(C.GDK_KEY_LaunchC) - KEY_LaunchD = uint(C.GDK_KEY_LaunchD) - KEY_LaunchE = uint(C.GDK_KEY_LaunchE) - KEY_LaunchF = uint(C.GDK_KEY_LaunchF) - KEY_ApplicationLeft = uint(C.GDK_KEY_ApplicationLeft) - KEY_ApplicationRight = uint(C.GDK_KEY_ApplicationRight) - KEY_Book = uint(C.GDK_KEY_Book) - KEY_CD = uint(C.GDK_KEY_CD) - KEY_WindowClear = uint(C.GDK_KEY_WindowClear) - KEY_Close = uint(C.GDK_KEY_Close) - KEY_Copy = uint(C.GDK_KEY_Copy) - KEY_Cut = uint(C.GDK_KEY_Cut) - KEY_Display = uint(C.GDK_KEY_Display) - KEY_DOS = uint(C.GDK_KEY_DOS) - KEY_Documents = uint(C.GDK_KEY_Documents) - KEY_Excel = uint(C.GDK_KEY_Excel) - KEY_Explorer = uint(C.GDK_KEY_Explorer) - KEY_Game = uint(C.GDK_KEY_Game) - KEY_Go = uint(C.GDK_KEY_Go) - KEY_iTouch = uint(C.GDK_KEY_iTouch) - KEY_LogOff = uint(C.GDK_KEY_LogOff) - KEY_Market = uint(C.GDK_KEY_Market) - KEY_Meeting = uint(C.GDK_KEY_Meeting) - KEY_MenuKB = uint(C.GDK_KEY_MenuKB) - KEY_MenuPB = uint(C.GDK_KEY_MenuPB) - KEY_MySites = uint(C.GDK_KEY_MySites) - KEY_New = uint(C.GDK_KEY_New) - KEY_News = uint(C.GDK_KEY_News) - KEY_OfficeHome = uint(C.GDK_KEY_OfficeHome) - KEY_Open = uint(C.GDK_KEY_Open) - KEY_Option = uint(C.GDK_KEY_Option) - KEY_Paste = uint(C.GDK_KEY_Paste) - KEY_Phone = uint(C.GDK_KEY_Phone) - KEY_Reply = uint(C.GDK_KEY_Reply) - KEY_Reload = uint(C.GDK_KEY_Reload) - KEY_RotateWindows = uint(C.GDK_KEY_RotateWindows) - KEY_RotationPB = uint(C.GDK_KEY_RotationPB) - KEY_RotationKB = uint(C.GDK_KEY_RotationKB) - KEY_Save = uint(C.GDK_KEY_Save) - KEY_ScrollUp = uint(C.GDK_KEY_ScrollUp) - KEY_ScrollDown = uint(C.GDK_KEY_ScrollDown) - KEY_ScrollClick = uint(C.GDK_KEY_ScrollClick) - KEY_Send = uint(C.GDK_KEY_Send) - KEY_Spell = uint(C.GDK_KEY_Spell) - KEY_SplitScreen = uint(C.GDK_KEY_SplitScreen) - KEY_Support = uint(C.GDK_KEY_Support) - KEY_TaskPane = uint(C.GDK_KEY_TaskPane) - KEY_Terminal = uint(C.GDK_KEY_Terminal) - KEY_Tools = uint(C.GDK_KEY_Tools) - KEY_Travel = uint(C.GDK_KEY_Travel) - KEY_UserPB = uint(C.GDK_KEY_UserPB) - KEY_User1KB = uint(C.GDK_KEY_User1KB) - KEY_User2KB = uint(C.GDK_KEY_User2KB) - KEY_Video = uint(C.GDK_KEY_Video) - KEY_WheelButton = uint(C.GDK_KEY_WheelButton) - KEY_Word = uint(C.GDK_KEY_Word) - KEY_Xfer = uint(C.GDK_KEY_Xfer) - KEY_ZoomIn = uint(C.GDK_KEY_ZoomIn) - KEY_ZoomOut = uint(C.GDK_KEY_ZoomOut) - KEY_Away = uint(C.GDK_KEY_Away) - KEY_Messenger = uint(C.GDK_KEY_Messenger) - KEY_WebCam = uint(C.GDK_KEY_WebCam) - KEY_MailForward = uint(C.GDK_KEY_MailForward) - KEY_Pictures = uint(C.GDK_KEY_Pictures) - KEY_Music = uint(C.GDK_KEY_Music) - KEY_Battery = uint(C.GDK_KEY_Battery) - KEY_Bluetooth = uint(C.GDK_KEY_Bluetooth) - KEY_WLAN = uint(C.GDK_KEY_WLAN) - KEY_UWB = uint(C.GDK_KEY_UWB) - KEY_AudioForward = uint(C.GDK_KEY_AudioForward) - KEY_AudioRepeat = uint(C.GDK_KEY_AudioRepeat) - KEY_AudioRandomPlay = uint(C.GDK_KEY_AudioRandomPlay) - KEY_Subtitle = uint(C.GDK_KEY_Subtitle) - KEY_AudioCycleTrack = uint(C.GDK_KEY_AudioCycleTrack) - KEY_CycleAngle = uint(C.GDK_KEY_CycleAngle) - KEY_FrameBack = uint(C.GDK_KEY_FrameBack) - KEY_FrameForward = uint(C.GDK_KEY_FrameForward) - KEY_Time = uint(C.GDK_KEY_Time) - KEY_SelectButton = uint(C.GDK_KEY_SelectButton) - KEY_View = uint(C.GDK_KEY_View) - KEY_TopMenu = uint(C.GDK_KEY_TopMenu) - KEY_Red = uint(C.GDK_KEY_Red) - KEY_Green = uint(C.GDK_KEY_Green) - KEY_Yellow = uint(C.GDK_KEY_Yellow) - KEY_Blue = uint(C.GDK_KEY_Blue) - KEY_Suspend = uint(C.GDK_KEY_Suspend) - KEY_Hibernate = uint(C.GDK_KEY_Hibernate) - KEY_TouchpadToggle = uint(C.GDK_KEY_TouchpadToggle) - KEY_TouchpadOn = uint(C.GDK_KEY_TouchpadOn) - KEY_TouchpadOff = uint(C.GDK_KEY_TouchpadOff) - KEY_AudioMicMute = uint(C.GDK_KEY_AudioMicMute) - KEY_Switch_VT_1 = uint(C.GDK_KEY_Switch_VT_1) - KEY_Switch_VT_2 = uint(C.GDK_KEY_Switch_VT_2) - KEY_Switch_VT_3 = uint(C.GDK_KEY_Switch_VT_3) - KEY_Switch_VT_4 = uint(C.GDK_KEY_Switch_VT_4) - KEY_Switch_VT_5 = uint(C.GDK_KEY_Switch_VT_5) - KEY_Switch_VT_6 = uint(C.GDK_KEY_Switch_VT_6) - KEY_Switch_VT_7 = uint(C.GDK_KEY_Switch_VT_7) - KEY_Switch_VT_8 = uint(C.GDK_KEY_Switch_VT_8) - KEY_Switch_VT_9 = uint(C.GDK_KEY_Switch_VT_9) - KEY_Switch_VT_10 = uint(C.GDK_KEY_Switch_VT_10) - KEY_Switch_VT_11 = uint(C.GDK_KEY_Switch_VT_11) - KEY_Switch_VT_12 = uint(C.GDK_KEY_Switch_VT_12) - KEY_Ungrab = uint(C.GDK_KEY_Ungrab) - KEY_ClearGrab = uint(C.GDK_KEY_ClearGrab) - KEY_Next_VMode = uint(C.GDK_KEY_Next_VMode) - KEY_Prev_VMode = uint(C.GDK_KEY_Prev_VMode) - KEY_LogWindowTree = uint(C.GDK_KEY_LogWindowTree) - KEY_LogGrabInfo = uint(C.GDK_KEY_LogGrabInfo) -) diff --git a/vendor/github.com/gotk3/gotk3/gdk/screen.go b/vendor/github.com/gotk3/gotk3/gdk/screen.go deleted file mode 100644 index da18c13..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/screen.go +++ /dev/null @@ -1,113 +0,0 @@ -package gdk - -// #include <gdk/gdk.h> -// #include "gdk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -/* - * GdkScreen - */ - -// Screen is a representation of GDK's GdkScreen. -type Screen struct { - *glib.Object -} - -// native returns a pointer to the underlying GdkScreen. -func (v *Screen) native() *C.GdkScreen { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGdkScreen(p) -} - -// Native returns a pointer to the underlying GdkScreen. -func (v *Screen) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalScreen(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(c))} - return &Screen{obj}, nil -} - -func toScreen(s *C.GdkScreen) (*Screen, error) { - if s == nil { - return nil, nilPtrErr - } - obj := &glib.Object{glib.ToGObject(unsafe.Pointer(s))} - return &Screen{obj}, nil -} - -// GetRGBAVisual is a wrapper around gdk_screen_get_rgba_visual(). -func (v *Screen) GetRGBAVisual() (*Visual, error) { - c := C.gdk_screen_get_rgba_visual(v.native()) - if c == nil { - return nil, nilPtrErr - } - - return &Visual{glib.Take(unsafe.Pointer(c))}, nil -} - -// GetSystemVisual is a wrapper around gdk_screen_get_system_visual(). -func (v *Screen) GetSystemVisual() (*Visual, error) { - c := C.gdk_screen_get_system_visual(v.native()) - if c == nil { - return nil, nilPtrErr - } - - return &Visual{glib.Take(unsafe.Pointer(c))}, nil -} - -// ScreenGetDefault is a wrapper around gdk_screen_get_default(). -func ScreenGetDefault() (*Screen, error) { - return toScreen(C.gdk_screen_get_default()) -} - -// IsComposited is a wrapper around gdk_screen_is_composited(). -func (v *Screen) IsComposited() bool { - return gobool(C.gdk_screen_is_composited(v.native())) -} - -// GetRootWindow is a wrapper around gdk_screen_get_root_window(). -func (v *Screen) GetRootWindow() (*Window, error) { - return toWindow(C.gdk_screen_get_root_window(v.native())) -} - -// GetDisplay is a wrapper around gdk_screen_get_display(). -func (v *Screen) GetDisplay() (*Display, error) { - return toDisplay(C.gdk_screen_get_display(v.native())) -} - -func toString(c *C.gchar) (string, error) { - if c == nil { - return "", nilPtrErr - } - return C.GoString((*C.char)(c)), nil -} - -// GetResolution is a wrapper around gdk_screen_get_resolution(). -func (v *Screen) GetResolution() float64 { - return float64(C.gdk_screen_get_resolution(v.native())) -} - -// SetResolution is a wrapper around gdk_screen_set_resolution(). -func (v *Screen) SetResolution(r float64) { - C.gdk_screen_set_resolution(v.native(), C.gdouble(r)) -} - -// void gdk_screen_set_font_options () -// gboolean gdk_screen_get_setting () -// const cairo_font_options_t * gdk_screen_get_font_options () -// GList * gdk_screen_get_window_stack () -// GList * gdk_screen_list_visuals () -// GList * gdk_screen_get_toplevel_windows () -// void gdk_screen_get_monitor_geometry () -// void gdk_screen_get_monitor_workarea () diff --git a/vendor/github.com/gotk3/gotk3/gdk/screen_no_x11.go b/vendor/github.com/gotk3/gotk3/gdk/screen_no_x11.go deleted file mode 100644 index 9551598..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/screen_no_x11.go +++ /dev/null @@ -1,25 +0,0 @@ -// +build !linux no_x11 - -package gdk - -func WorkspaceControlSupported() bool { - return false -} - -// GetScreenNumber is a wrapper around gdk_x11_screen_get_screen_number(). -// It only works on GDK versions compiled with X11 support - its return value can't be used if WorkspaceControlSupported returns false -func (v *Screen) GetScreenNumber() int { - return -1 -} - -// GetNumberOfDesktops is a wrapper around gdk_x11_screen_get_number_of_desktops(). -// It only works on GDK versions compiled with X11 support - its return value can't be used if WorkspaceControlSupported returns false -func (v *Screen) GetNumberOfDesktops() uint32 { - return 0 -} - -// GetCurrentDesktop is a wrapper around gdk_x11_screen_get_current_desktop(). -// It only works on GDK versions compiled with X11 support - its return value can't be used if WorkspaceControlSupported returns false -func (v *Screen) GetCurrentDesktop() uint32 { - return 0 -} diff --git a/vendor/github.com/gotk3/gotk3/gdk/screen_x11.go b/vendor/github.com/gotk3/gotk3/gdk/screen_x11.go deleted file mode 100644 index ba17d1a..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/screen_x11.go +++ /dev/null @@ -1,30 +0,0 @@ -// +build linux -// +build !no_x11 - -package gdk - -// #include <gdk/gdk.h> -// #include <gdk/gdkx.h> -import "C" - -func WorkspaceControlSupported() bool { - return true -} - -// GetScreenNumber is a wrapper around gdk_x11_screen_get_screen_number(). -// It only works on GDK versions compiled with X11 support - its return value can't be used if WorkspaceControlSupported returns false -func (v *Screen) GetScreenNumber() int { - return int(C.gdk_x11_screen_get_screen_number(v.native())) -} - -// GetNumberOfDesktops is a wrapper around gdk_x11_screen_get_number_of_desktops(). -// It only works on GDK versions compiled with X11 support - its return value can't be used if WorkspaceControlSupported returns false -func (v *Screen) GetNumberOfDesktops() uint32 { - return uint32(C.gdk_x11_screen_get_number_of_desktops(v.native())) -} - -// GetCurrentDesktop is a wrapper around gdk_x11_screen_get_current_desktop(). -// It only works on GDK versions compiled with X11 support - its return value can't be used if WorkspaceControlSupported returns false -func (v *Screen) GetCurrentDesktop() uint32 { - return uint32(C.gdk_x11_screen_get_current_desktop(v.native())) -} diff --git a/vendor/github.com/gotk3/gotk3/gdk/window_no_x11.go b/vendor/github.com/gotk3/gotk3/gdk/window_no_x11.go deleted file mode 100644 index 72c5665..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/window_no_x11.go +++ /dev/null @@ -1,17 +0,0 @@ -// +build !linux no_x11 - -package gdk - -func (v *Window) MoveToCurrentDesktop() { -} - -// GetDesktop is a wrapper around gdk_x11_window_get_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) GetDesktop() uint32 { - return 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) { -} diff --git a/vendor/github.com/gotk3/gotk3/gdk/window_x11.go b/vendor/github.com/gotk3/gotk3/gdk/window_x11.go deleted file mode 100644 index 5161c8c..0000000 --- a/vendor/github.com/gotk3/gotk3/gdk/window_x11.go +++ /dev/null @@ -1,26 +0,0 @@ -// +build linux -// +build !no_x11 - -package gdk - -// #include <gdk/gdk.h> -// #include <gdk/gdkx.h> -import "C" - -// MoveToCurrentDesktop is a wrapper around gdk_x11_window_move_to_current_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) MoveToCurrentDesktop() { - C.gdk_x11_window_move_to_current_desktop(v.native()) -} - -// GetDesktop is a wrapper around gdk_x11_window_get_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) GetDesktop() uint32 { - return uint32(C.gdk_x11_window_get_desktop(v.native())) -} - -// 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)) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/application.go b/vendor/github.com/gotk3/gotk3/glib/application.go deleted file mode 100644 index 81ad34e..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/application.go +++ /dev/null @@ -1,219 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// Application is a representation of GApplication. -type Application struct { - *Object - - // Interfaces - IActionMap - IActionGroup -} - -// native() returns a pointer to the underlying GApplication. -func (v *Application) native() *C.GApplication { - if v == nil || v.GObject == nil { - return nil - } - return C.toGApplication(unsafe.Pointer(v.GObject)) -} - -func (v *Application) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalApplication(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapApplication(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapApplication(obj *Object) *Application { - am := wrapActionMap(obj) - ag := wrapActionGroup(obj) - return &Application{obj, am, ag} -} - -// ApplicationIDIsValid is a wrapper around g_application_id_is_valid(). -func ApplicationIDIsValid(id string) bool { - cstr1 := (*C.gchar)(C.CString(id)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_application_id_is_valid(cstr1)) -} - -// ApplicationNew is a wrapper around g_application_new(). -func ApplicationNew(appID string, flags ApplicationFlags) *Application { - cstr1 := (*C.gchar)(C.CString(appID)) - defer C.free(unsafe.Pointer(cstr1)) - - c := C.g_application_new(cstr1, C.GApplicationFlags(flags)) - if c == nil { - return nil - } - return wrapApplication(wrapObject(unsafe.Pointer(c))) -} - -// GetApplicationID is a wrapper around g_application_get_application_id(). -func (v *Application) GetApplicationID() string { - c := C.g_application_get_application_id(v.native()) - - return C.GoString((*C.char)(c)) -} - -// SetApplicationID is a wrapper around g_application_set_application_id(). -func (v *Application) SetApplicationID(id string) { - cstr1 := (*C.gchar)(C.CString(id)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_application_set_application_id(v.native(), cstr1) -} - -// GetInactivityTimeout is a wrapper around g_application_get_inactivity_timeout(). -func (v *Application) GetInactivityTimeout() uint { - return uint(C.g_application_get_inactivity_timeout(v.native())) -} - -// SetInactivityTimeout is a wrapper around g_application_set_inactivity_timeout(). -func (v *Application) SetInactivityTimeout(timeout uint) { - C.g_application_set_inactivity_timeout(v.native(), C.guint(timeout)) -} - -// GetFlags is a wrapper around g_application_get_flags(). -func (v *Application) GetFlags() ApplicationFlags { - return ApplicationFlags(C.g_application_get_flags(v.native())) -} - -// SetFlags is a wrapper around g_application_set_flags(). -func (v *Application) SetFlags(flags ApplicationFlags) { - C.g_application_set_flags(v.native(), C.GApplicationFlags(flags)) -} - -// Only available in GLib 2.42+ -// // GetResourceBasePath is a wrapper around g_application_get_resource_base_path(). -// func (v *Application) GetResourceBasePath() string { -// c := C.g_application_get_resource_base_path(v.native()) - -// return C.GoString((*C.char)(c)) -// } - -// Only available in GLib 2.42+ -// // SetResourceBasePath is a wrapper around g_application_set_resource_base_path(). -// func (v *Application) SetResourceBasePath(bp string) { -// cstr1 := (*C.gchar)(C.CString(bp)) -// defer C.free(unsafe.Pointer(cstr1)) - -// C.g_application_set_resource_base_path(v.native(), cstr1) -// } - -// GetDbusObjectPath is a wrapper around g_application_get_dbus_object_path(). -func (v *Application) GetDbusObjectPath() string { - c := C.g_application_get_dbus_object_path(v.native()) - - return C.GoString((*C.char)(c)) -} - -// GetIsRegistered is a wrapper around g_application_get_is_registered(). -func (v *Application) GetIsRegistered() bool { - return gobool(C.g_application_get_is_registered(v.native())) -} - -// GetIsRemote is a wrapper around g_application_get_is_remote(). -func (v *Application) GetIsRemote() bool { - return gobool(C.g_application_get_is_remote(v.native())) -} - -// Hold is a wrapper around g_application_hold(). -func (v *Application) Hold() { - C.g_application_hold(v.native()) -} - -// Release is a wrapper around g_application_release(). -func (v *Application) Release() { - C.g_application_release(v.native()) -} - -// Quit is a wrapper around g_application_quit(). -func (v *Application) Quit() { - C.g_application_quit(v.native()) -} - -// Activate is a wrapper around g_application_activate(). -func (v *Application) Activate() { - C.g_application_activate(v.native()) -} - -// SendNotification is a wrapper around g_application_send_notification(). -func (v *Application) SendNotification(id string, notification *Notification) { - cstr1 := (*C.gchar)(C.CString(id)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_application_send_notification(v.native(), cstr1, notification.native()) -} - -// WithdrawNotification is a wrapper around g_application_withdraw_notification(). -func (v *Application) WithdrawNotification(id string) { - cstr1 := (*C.gchar)(C.CString(id)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_application_withdraw_notification(v.native(), cstr1) -} - -// SetDefault is a wrapper around g_application_set_default(). -func (v *Application) SetDefault() { - C.g_application_set_default(v.native()) -} - -// ApplicationGetDefault is a wrapper around g_application_get_default(). -func ApplicationGetDefault() *Application { - c := C.g_application_get_default() - if c == nil { - return nil - } - return wrapApplication(wrapObject(unsafe.Pointer(c))) -} - -// MarkBusy is a wrapper around g_application_mark_busy(). -func (v *Application) MarkBusy() { - C.g_application_mark_busy(v.native()) -} - -// UnmarkBusy is a wrapper around g_application_unmark_busy(). -func (v *Application) UnmarkBusy() { - C.g_application_unmark_busy(v.native()) -} - -// Run is a wrapper around g_application_run(). -func (v *Application) Run(args []string) int { - cargs := C.make_strings(C.int(len(args))) - defer C.destroy_strings(cargs) - - for i, arg := range args { - cstr := C.CString(arg) - defer C.free(unsafe.Pointer(cstr)) - C.set_string(cargs, C.int(i), (*C.char)(cstr)) - } - - return int(C.g_application_run(v.native(), C.int(len(args)), cargs)) -} - -// Only available in GLib 2.44+ -// // GetIsBusy is a wrapper around g_application_get_is_busy(). -// func (v *Application) GetIsBusy() bool { -// return gobool(C.g_application_get_is_busy(v.native())) -// } - -// void g_application_bind_busy_property () -// void g_application_unbind_busy_property () -// gboolean g_application_register () // requires GCancellable -// void g_application_set_action_group () // Deprecated since 2.32 -// GDBusConnection * g_application_get_dbus_connection () // No support for GDBusConnection -// void g_application_open () // Needs GFile -// void g_application_add_main_option_entries () //Needs GOptionEntry -// void g_application_add_main_option () //Needs GOptionFlags and GOptionArg -// void g_application_add_option_group () // Needs GOptionGroup diff --git a/vendor/github.com/gotk3/gotk3/glib/connect.go b/vendor/github.com/gotk3/gotk3/glib/connect.go deleted file mode 100644 index 9cd9a0e..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/connect.go +++ /dev/null @@ -1,116 +0,0 @@ -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import ( - "errors" - "reflect" - "unsafe" -) - -/* - * Events - */ - -type SignalHandle uint - -func (v *Object) connectClosure(after bool, detailedSignal string, f interface{}, userData ...interface{}) (SignalHandle, error) { - if len(userData) > 1 { - return 0, errors.New("userData len must be 0 or 1") - } - - cstr := C.CString(detailedSignal) - defer C.free(unsafe.Pointer(cstr)) - - closure, err := ClosureNew(f, userData...) - if err != nil { - return 0, err - } - - C._g_closure_add_finalize_notifier(closure) - - c := C.g_signal_connect_closure(C.gpointer(v.native()), - (*C.gchar)(cstr), closure, gbool(after)) - handle := SignalHandle(c) - - // Map the signal handle to the closure. - signals[handle] = closure - - return handle, nil -} - -// Connect is a wrapper around g_signal_connect_closure(). f must be -// a function with a signaure matching the callback signature for -// detailedSignal. userData must either 0 or 1 elements which can -// be optionally passed to f. If f takes less arguments than it is -// passed from the GLib runtime, the extra arguments are ignored. -// -// Arguments for f must be a matching Go equivalent type for the -// C callback, or an interface type which the value may be packed in. -// If the type is not suitable, a runtime panic will occur when the -// signal is emitted. -func (v *Object) Connect(detailedSignal string, f interface{}, userData ...interface{}) (SignalHandle, error) { - return v.connectClosure(false, detailedSignal, f, userData...) -} - -// ConnectAfter is a wrapper around g_signal_connect_closure(). f must be -// a function with a signaure matching the callback signature for -// detailedSignal. userData must either 0 or 1 elements which can -// be optionally passed to f. If f takes less arguments than it is -// passed from the GLib runtime, the extra arguments are ignored. -// -// Arguments for f must be a matching Go equivalent type for the -// C callback, or an interface type which the value may be packed in. -// If the type is not suitable, a runtime panic will occur when the -// signal is emitted. -// -// The difference between Connect and ConnectAfter is that the latter -// will be invoked after the default handler, not before. -func (v *Object) ConnectAfter(detailedSignal string, f interface{}, userData ...interface{}) (SignalHandle, error) { - return v.connectClosure(true, detailedSignal, f, userData...) -} - -// ClosureNew creates a new GClosure and adds its callback function -// to the internally-maintained map. It's exported for visibility to other -// gotk3 packages and shouldn't be used in application code. -func ClosureNew(f interface{}, marshalData ...interface{}) (*C.GClosure, error) { - // Create a reflect.Value from f. This is called when the - // returned GClosure runs. - rf := reflect.ValueOf(f) - - // Create closure context which points to the reflected func. - cc := closureContext{rf: rf} - - // Closures can only be created from funcs. - if rf.Type().Kind() != reflect.Func { - return nil, errors.New("value is not a func") - } - - if len(marshalData) > 0 { - cc.userData = reflect.ValueOf(marshalData[0]) - } - - c := C._g_closure_new() - - // Associate the GClosure with rf. rf will be looked up in this - // map by the closure when the closure runs. - closures.Lock() - closures.m[c] = cc - closures.Unlock() - - return c, nil -} - -// removeClosure removes a closure from the internal closures map. This is -// needed to prevent a leak where Go code can access the closure context -// (along with rf and userdata) even after an object has been destroyed and -// the GClosure is invalidated and will never run. -// -//export removeClosure -func removeClosure(_ C.gpointer, closure *C.GClosure) { - closures.Lock() - delete(closures.m, closure) - closures.Unlock() -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gaction.go b/vendor/github.com/gotk3/gotk3/glib/gaction.go deleted file mode 100644 index 94bc32e..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gaction.go +++ /dev/null @@ -1,215 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// Action is a representation of glib's GAction GInterface. -type Action struct { - *Object -} - -// IAction is an interface type implemented by all structs -// embedding an Action. It is meant to be used as an argument type -// for wrapper functions that wrap around a C function taking a -// GAction. -type IAction interface { - toGAction() *C.GAction - toAction() *Action -} - -func (v *Action) toGAction() *C.GAction { - if v == nil { - return nil - } - return v.native() -} - -func (v *Action) toAction() *Action { - return v -} - -// gboolean g_action_parse_detailed_name (const gchar *detailed_name, gchar **action_name, GVariant **target_value, GError **error); -// gchar * g_action_print_detailed_name (const gchar *action_name, GVariant *target_value); - -// native() returns a pointer to the underlying GAction. -func (v *Action) native() *C.GAction { - if v == nil || v.GObject == nil { - return nil - } - return C.toGAction(unsafe.Pointer(v.GObject)) -} - -func (v *Action) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalAction(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapAction(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapAction(obj *Object) *Action { - return &Action{obj} -} - -// ActionNameIsValid is a wrapper around g_action_name_is_valid -func ActionNameIsValid(actionName string) bool { - cstr := (*C.gchar)(C.CString(actionName)) - return gobool(C.g_action_name_is_valid(cstr)) -} - -// GetName is a wrapper around g_action_get_name -func (v *Action) GetName() string { - return C.GoString((*C.char)(C.g_action_get_name(v.native()))) -} - -// GetEnabled is a wrapper around g_action_get_enabled -func (v *Action) GetEnabled() bool { - return gobool(C.g_action_get_enabled(v.native())) -} - -// GetState is a wrapper around g_action_get_state -func (v *Action) GetState() *Variant { - c := C.g_action_get_state(v.native()) - if c == nil { - return nil - } - return newVariant((*C.GVariant)(c)) -} - -// GetStateHint is a wrapper around g_action_get_state_hint -func (v *Action) GetStateHint() *Variant { - c := C.g_action_get_state_hint(v.native()) - if c == nil { - return nil - } - return newVariant((*C.GVariant)(c)) -} - -// GetParameterType is a wrapper around g_action_get_parameter_type -func (v *Action) GetParameterType() *VariantType { - c := C.g_action_get_parameter_type(v.native()) - if c == nil { - return nil - } - return newVariantType((*C.GVariantType)(c)) -} - -// GetStateType is a wrapper around g_action_get_state_type -func (v *Action) GetStateType() *VariantType { - c := C.g_action_get_state_type(v.native()) - if c == nil { - return nil - } - return newVariantType((*C.GVariantType)(c)) -} - -// ChangeState is a wrapper around g_action_change_state -func (v *Action) ChangeState(value *Variant) { - C.g_action_change_state(v.native(), value.native()) -} - -// Activate is a wrapper around g_action_activate -func (v *Action) Activate(parameter *Variant) { - C.g_action_activate(v.native(), parameter.native()) -} - -// SimpleAction is a representation of GSimpleAction -type SimpleAction struct { - Action -} - -func (v *SimpleAction) native() *C.GSimpleAction { - if v == nil || v.GObject == nil { - return nil - } - return C.toGSimpleAction(unsafe.Pointer(v.GObject)) -} - -func (v *SimpleAction) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalSimpleAction(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapSimpleAction(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapSimpleAction(obj *Object) *SimpleAction { - return &SimpleAction{Action{obj}} -} - -// SimpleActionNew is a wrapper around g_simple_action_new -func SimpleActionNew(name string, parameterType *VariantType) *SimpleAction { - c := C.g_simple_action_new((*C.gchar)(C.CString(name)), parameterType.native()) - if c == nil { - return nil - } - return wrapSimpleAction(wrapObject(unsafe.Pointer(c))) -} - -// SimpleActionNewStateful is a wrapper around g_simple_action_new_stateful -func SimpleActionNewStateful(name string, parameterType *VariantType, state *Variant) *SimpleAction { - c := C.g_simple_action_new_stateful((*C.gchar)(C.CString(name)), parameterType.native(), state.native()) - if c == nil { - return nil - } - return wrapSimpleAction(wrapObject(unsafe.Pointer(c))) -} - -// SetEnabled is a wrapper around g_simple_action_set_enabled -func (v *SimpleAction) SetEnabled(enabled bool) { - C.g_simple_action_set_enabled(v.native(), gbool(enabled)) -} - -// SetState is a wrapper around g_simple_action_set_state -// This should only be called by the implementor of the action. -// Users of the action should not attempt to directly modify the 'state' property. -// Instead, they should call ChangeState [g_action_change_state()] to request the change. -func (v *SimpleAction) SetState(value *Variant) { - C.g_simple_action_set_state(v.native(), value.native()) -} - -// SetStateHint is a wrapper around g_simple_action_set_state_hint -// GLib 2.44 only (currently no build tags, so commented out) -/*func (v *SimpleAction) SetStateHint(stateHint *Variant) { - C.g_simple_action_set_state_hint(v.native(), stateHint.native()) -}*/ - -// PropertyAction is a representation of GPropertyAction -type PropertyAction struct { - Action -} - -func (v *PropertyAction) native() *C.GPropertyAction { - if v == nil || v.GObject == nil { - return nil - } - return C.toGPropertyAction(unsafe.Pointer(v.GObject)) -} - -func (v *PropertyAction) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalPropertyAction(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapPropertyAction(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapPropertyAction(obj *Object) *PropertyAction { - return &PropertyAction{Action{obj}} -} - -// PropertyActionNew is a wrapper around g_property_action_new -func PropertyActionNew(name string, object *Object, propertyName string) *PropertyAction { - c := C.g_property_action_new((*C.gchar)(C.CString(name)), C.gpointer(unsafe.Pointer(object.native())), (*C.gchar)(C.CString(propertyName))) - if c == nil { - return nil - } - return wrapPropertyAction(wrapObject(unsafe.Pointer(c))) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gactiongroup.go b/vendor/github.com/gotk3/gotk3/glib/gactiongroup.go deleted file mode 100644 index 4c1c654..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gactiongroup.go +++ /dev/null @@ -1,113 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// IActionGroup is an interface representation of ActionGroup, -// used to avoid duplication when embedding the type in a wrapper of another GObject-based type. -type IActionGroup interface { - Native() uintptr - - HasAction(actionName string) bool - GetActionEnabled(actionName string) bool - GetActionParameterType(actionName string) *VariantType - GetActionStateType(actionName string) *VariantType - GetActionState(actionName string) *Variant - GetActionStateHint(actionName string) *Variant - ChangeActionState(actionName string, value *Variant) - Activate(actionName string, parameter *Variant) -} - -// ActionGroup is a representation of glib's GActionGroup GInterface -type ActionGroup struct { - *Object -} - -// g_action_group_list_actions() -// g_action_group_query_action() -// should only called from implementations: -// g_action_group_action_added -// g_action_group_action_removed -// g_action_group_action_enabled_changed -// g_action_group_action_state_changed - -// native() returns a pointer to the underlying GActionGroup. -func (v *ActionGroup) native() *C.GActionGroup { - if v == nil || v.GObject == nil { - return nil - } - return C.toGActionGroup(unsafe.Pointer(v.GObject)) -} - -func (v *ActionGroup) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalActionGroup(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapActionGroup(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapActionGroup(obj *Object) *ActionGroup { - return &ActionGroup{obj} -} - -// HasAction is a wrapper around g_action_group_has_action(). -func (v *ActionGroup) HasAction(actionName string) bool { - return gobool(C.g_action_group_has_action(v.native(), (*C.gchar)(C.CString(actionName)))) -} - -// GetActionEnabled is a wrapper around g_action_group_get_action_enabled(). -func (v *ActionGroup) GetActionEnabled(actionName string) bool { - return gobool(C.g_action_group_get_action_enabled(v.native(), (*C.gchar)(C.CString(actionName)))) -} - -// GetActionParameterType is a wrapper around g_action_group_get_action_parameter_type(). -func (v *ActionGroup) GetActionParameterType(actionName string) *VariantType { - c := C.g_action_group_get_action_parameter_type(v.native(), (*C.gchar)(C.CString(actionName))) - if c == nil { - return nil - } - return newVariantType((*C.GVariantType)(c)) -} - -// GetActionStateType is a wrapper around g_action_group_get_action_state_type(). -func (v *ActionGroup) GetActionStateType(actionName string) *VariantType { - c := C.g_action_group_get_action_state_type(v.native(), (*C.gchar)(C.CString(actionName))) - if c == nil { - return nil - } - return newVariantType((*C.GVariantType)(c)) -} - -// GetActionState is a wrapper around g_action_group_get_action_state(). -func (v *ActionGroup) GetActionState(actionName string) *Variant { - c := C.g_action_group_get_action_state(v.native(), (*C.gchar)(C.CString(actionName))) - if c == nil { - return nil - } - return newVariant((*C.GVariant)(c)) -} - -// GetActionStateHint is a wrapper around g_action_group_get_action_state_hint(). -func (v *ActionGroup) GetActionStateHint(actionName string) *Variant { - c := C.g_action_group_get_action_state_hint(v.native(), (*C.gchar)(C.CString(actionName))) - if c == nil { - return nil - } - return newVariant((*C.GVariant)(c)) -} - -// ChangeActionState is a wrapper around g_action_group_change_action_state -func (v *ActionGroup) ChangeActionState(actionName string, value *Variant) { - C.g_action_group_change_action_state(v.native(), (*C.gchar)(C.CString(actionName)), value.native()) -} - -// Activate is a wrapper around g_action_group_activate_action -func (v *ActionGroup) Activate(actionName string, parameter *Variant) { - C.g_action_group_activate_action(v.native(), (*C.gchar)(C.CString(actionName)), parameter.native()) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gactionmap.go b/vendor/github.com/gotk3/gotk3/glib/gactionmap.go deleted file mode 100644 index f5b8998..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gactionmap.go +++ /dev/null @@ -1,66 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// IActionMap is an interface representation of ActionMap, -// used to avoid duplication when embedding the type in a wrapper of another GObject-based type. -type IActionMap interface { - Native() uintptr - - LookupAction(actionName string) *Action - AddAction(action IAction) - RemoveAction(actionName string) -} - -// ActionMap is a representation of glib's GActionMap GInterface -type ActionMap struct { - *Object -} - -// void g_action_map_add_action_entries (GActionMap *action_map, const GActionEntry *entries, gint n_entries, gpointer user_data); -// struct GActionEntry - -// native() returns a pointer to the underlying GActionMap. -func (v *ActionMap) native() *C.GActionMap { - if v == nil || v.GObject == nil { - return nil - } - return C.toGActionMap(unsafe.Pointer(v.GObject)) -} - -func (v *ActionMap) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalActionMap(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapActionMap(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapActionMap(obj *Object) *ActionMap { - return &ActionMap{obj} -} - -// LookupAction is a wrapper around g_action_map_lookup_action -func (v *ActionMap) LookupAction(actionName string) *Action { - c := C.g_action_map_lookup_action(v.native(), (*C.gchar)(C.CString(actionName))) - if c == nil { - return nil - } - return wrapAction(wrapObject(unsafe.Pointer(c))) -} - -// AddAction is a wrapper around g_action_map_add_action -func (v *ActionMap) AddAction(action IAction) { - C.g_action_map_add_action(v.native(), action.toGAction()) -} - -// RemoveAction is a wrapper around g_action_map_remove_action -func (v *ActionMap) RemoveAction(actionName string) { - C.g_action_map_remove_action(v.native(), (*C.gchar)(C.CString(actionName))) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gbinding.go b/vendor/github.com/gotk3/gotk3/glib/gbinding.go deleted file mode 100644 index 133ce12..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gbinding.go +++ /dev/null @@ -1,98 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -type BindingFlags int - -const ( - BINDING_DEFAULT BindingFlags = C.G_BINDING_DEFAULT - BINDING_BIDIRECTIONAL BindingFlags = C.G_BINDING_BIDIRECTIONAL - BINDING_SYNC_CREATE = C.G_BINDING_SYNC_CREATE - BINDING_INVERT_BOOLEAN = C.G_BINDING_INVERT_BOOLEAN -) - -type Binding struct { - *Object -} - -func (v *Binding) native() *C.GBinding { - if v == nil || v.GObject == nil { - return nil - } - return C.toGBinding(unsafe.Pointer(v.GObject)) -} - -func marshalBinding(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return &Binding{wrapObject(unsafe.Pointer(c))}, nil -} - -// Creates a binding between source property on source and target property on -// target . Whenever the source property is changed the target_property is -// updated using the same value. -func BindProperty(source *Object, sourceProperty string, - target *Object, targetProperty string, - flags BindingFlags) *Binding { - srcStr := (*C.gchar)(C.CString(sourceProperty)) - defer C.free(unsafe.Pointer(srcStr)) - tgtStr := (*C.gchar)(C.CString(targetProperty)) - defer C.free(unsafe.Pointer(tgtStr)) - obj := C.g_object_bind_property( - C.gpointer(source.GObject), srcStr, - C.gpointer(target.GObject), tgtStr, - C.GBindingFlags(flags), - ) - if obj == nil { - return nil - } - return &Binding{wrapObject(unsafe.Pointer(obj))} -} - -// Explicitly releases the binding between the source and the target property -// expressed by Binding -func (v *Binding) Unbind() { - C.g_binding_unbind(v.native()) -} - -// Retrieves the GObject instance used as the source of the binding -func (v *Binding) GetSource() *Object { - obj := C.g_binding_get_source(v.native()) - if obj == nil { - return nil - } - return wrapObject(unsafe.Pointer(obj)) -} - -// Retrieves the name of the property of “source” used as the source of -// the binding. -func (v *Binding) GetSourceProperty() string { - s := C.g_binding_get_source_property(v.native()) - return C.GoString((*C.char)(s)) -} - -// Retrieves the GObject instance used as the target of the binding. -func (v *Binding) GetTarget() *Object { - obj := C.g_binding_get_target(v.native()) - if obj == nil { - return nil - } - return wrapObject(unsafe.Pointer(obj)) -} - -// Retrieves the name of the property of “target” used as the target of -// the binding. -func (v *Binding) GetTargetProperty() string { - s := C.g_binding_get_target_property(v.native()) - return C.GoString((*C.char)(s)) -} - -// Retrieves the flags passed when constructing the GBinding. -func (v *Binding) GetFlags() BindingFlags { - flags := C.g_binding_get_flags(v.native()) - return BindingFlags(flags) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/glib.go b/vendor/github.com/gotk3/gotk3/glib/glib.go deleted file mode 100644 index 523a711..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/glib.go +++ /dev/null @@ -1,1371 +0,0 @@ -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// Package glib provides Go bindings for GLib 2. Supports version 2.36 -// and later. -package glib - -// #cgo pkg-config: gio-2.0 glib-2.0 gobject-2.0 -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" - -import ( - "errors" - "fmt" - "os" - "reflect" - "runtime" - "sync" - "unsafe" -) - -/* - * Type conversions - */ - -func gbool(b bool) C.gboolean { - if b { - return C.gboolean(1) - } - return C.gboolean(0) -} -func gobool(b C.gboolean) bool { - if b != 0 { - return true - } - return false -} - -/* - * Unexported vars - */ - -type closureContext struct { - rf reflect.Value - userData reflect.Value -} - -var ( - errNilPtr = errors.New("cgo returned unexpected nil pointer") - - closures = struct { - sync.RWMutex - m map[*C.GClosure]closureContext - }{ - m: make(map[*C.GClosure]closureContext), - } - - signals = make(map[SignalHandle]*C.GClosure) -) - -/* - * Constants - */ - -// Type is a representation of GLib's GType. -type Type uint - -const ( - TYPE_INVALID Type = C.G_TYPE_INVALID - TYPE_NONE Type = C.G_TYPE_NONE - TYPE_INTERFACE Type = C.G_TYPE_INTERFACE - TYPE_CHAR Type = C.G_TYPE_CHAR - TYPE_UCHAR Type = C.G_TYPE_UCHAR - TYPE_BOOLEAN Type = C.G_TYPE_BOOLEAN - TYPE_INT Type = C.G_TYPE_INT - TYPE_UINT Type = C.G_TYPE_UINT - TYPE_LONG Type = C.G_TYPE_LONG - TYPE_ULONG Type = C.G_TYPE_ULONG - TYPE_INT64 Type = C.G_TYPE_INT64 - TYPE_UINT64 Type = C.G_TYPE_UINT64 - TYPE_ENUM Type = C.G_TYPE_ENUM - TYPE_FLAGS Type = C.G_TYPE_FLAGS - TYPE_FLOAT Type = C.G_TYPE_FLOAT - TYPE_DOUBLE Type = C.G_TYPE_DOUBLE - TYPE_STRING Type = C.G_TYPE_STRING - TYPE_POINTER Type = C.G_TYPE_POINTER - TYPE_BOXED Type = C.G_TYPE_BOXED - TYPE_PARAM Type = C.G_TYPE_PARAM - TYPE_OBJECT Type = C.G_TYPE_OBJECT - TYPE_VARIANT Type = C.G_TYPE_VARIANT -) - -// Name is a wrapper around g_type_name(). -func (t Type) Name() string { - return C.GoString((*C.char)(C.g_type_name(C.GType(t)))) -} - -// Depth is a wrapper around g_type_depth(). -func (t Type) Depth() uint { - return uint(C.g_type_depth(C.GType(t))) -} - -// Parent is a wrapper around g_type_parent(). -func (t Type) Parent() Type { - return Type(C.g_type_parent(C.GType(t))) -} - -// UserDirectory is a representation of GLib's GUserDirectory. -type UserDirectory int - -const ( - USER_DIRECTORY_DESKTOP UserDirectory = C.G_USER_DIRECTORY_DESKTOP - USER_DIRECTORY_DOCUMENTS UserDirectory = C.G_USER_DIRECTORY_DOCUMENTS - USER_DIRECTORY_DOWNLOAD UserDirectory = C.G_USER_DIRECTORY_DOWNLOAD - USER_DIRECTORY_MUSIC UserDirectory = C.G_USER_DIRECTORY_MUSIC - USER_DIRECTORY_PICTURES UserDirectory = C.G_USER_DIRECTORY_PICTURES - USER_DIRECTORY_PUBLIC_SHARE UserDirectory = C.G_USER_DIRECTORY_PUBLIC_SHARE - USER_DIRECTORY_TEMPLATES UserDirectory = C.G_USER_DIRECTORY_TEMPLATES - USER_DIRECTORY_VIDEOS UserDirectory = C.G_USER_DIRECTORY_VIDEOS -) - -const USER_N_DIRECTORIES int = C.G_USER_N_DIRECTORIES - -/* - * GApplicationFlags - */ - -type ApplicationFlags int - -const ( - APPLICATION_FLAGS_NONE ApplicationFlags = C.G_APPLICATION_FLAGS_NONE - APPLICATION_IS_SERVICE ApplicationFlags = C.G_APPLICATION_IS_SERVICE - APPLICATION_HANDLES_OPEN ApplicationFlags = C.G_APPLICATION_HANDLES_OPEN - APPLICATION_HANDLES_COMMAND_LINE ApplicationFlags = C.G_APPLICATION_HANDLES_COMMAND_LINE - APPLICATION_SEND_ENVIRONMENT ApplicationFlags = C.G_APPLICATION_SEND_ENVIRONMENT - APPLICATION_NON_UNIQUE ApplicationFlags = C.G_APPLICATION_NON_UNIQUE -) - -// goMarshal is called by the GLib runtime when a closure needs to be invoked. -// The closure will be invoked with as many arguments as it can take, from 0 to -// the full amount provided by the call. If the closure asks for more parameters -// than there are to give, a warning is printed to stderr and the closure is -// not run. -// -//export goMarshal -func goMarshal(closure *C.GClosure, retValue *C.GValue, - nParams C.guint, params *C.GValue, - invocationHint C.gpointer, marshalData *C.GValue) { - - // Get the context associated with this callback closure. - closures.RLock() - cc := closures.m[closure] - closures.RUnlock() - - // Get number of parameters passed in. If user data was saved with the - // closure context, increment the total number of parameters. - nGLibParams := int(nParams) - nTotalParams := nGLibParams - if cc.userData.IsValid() { - nTotalParams++ - } - - // Get number of parameters from the callback closure. If this exceeds - // the total number of marshaled parameters, a warning will be printed - // to stderr, and the callback will not be run. - nCbParams := cc.rf.Type().NumIn() - if nCbParams > nTotalParams { - fmt.Fprintf(os.Stderr, - "too many closure args: have %d, max allowed %d\n", - nCbParams, nTotalParams) - return - } - - // Create a slice of reflect.Values as arguments to call the function. - gValues := gValueSlice(params, nCbParams) - args := make([]reflect.Value, 0, nCbParams) - - // Fill beginning of args, up to the minimum of the total number of callback - // parameters and parameters from the glib runtime. - for i := 0; i < nCbParams && i < nGLibParams; i++ { - v := &Value{&gValues[i]} - val, err := v.GoValue() - if err != nil { - fmt.Fprintf(os.Stderr, - "no suitable Go value for arg %d: %v\n", i, err) - return - } - rv := reflect.ValueOf(val) - args = append(args, rv.Convert(cc.rf.Type().In(i))) - } - - // If non-nil user data was passed in and not all args have been set, - // get and set the reflect.Value directly from the GValue. - if cc.userData.IsValid() && len(args) < cap(args) { - args = append(args, cc.userData.Convert(cc.rf.Type().In(nCbParams-1))) - } - - // Call closure with args. If the callback returns one or more - // values, save the GValue equivalent of the first. - rv := cc.rf.Call(args) - if retValue != nil && len(rv) > 0 { - if g, err := GValue(rv[0].Interface()); err != nil { - fmt.Fprintf(os.Stderr, - "cannot save callback return value: %v", err) - } else { - *retValue = *g.native() - } - } -} - -// gValueSlice converts a C array of GValues to a Go slice. -func gValueSlice(values *C.GValue, nValues int) (slice []C.GValue) { - header := (*reflect.SliceHeader)((unsafe.Pointer(&slice))) - header.Cap = nValues - header.Len = nValues - header.Data = uintptr(unsafe.Pointer(values)) - return -} - -/* - * Main event loop - */ - -type SourceHandle uint - -// IdleAdd adds an idle source to the default main event loop -// context. After running once, the source func will be removed -// from the main event loop, unless f returns a single bool true. -// -// This function will cause a panic when f eventually runs if the -// types of args do not match those of f. -func IdleAdd(f interface{}, args ...interface{}) (SourceHandle, error) { - // f must be a func with no parameters. - rf := reflect.ValueOf(f) - if rf.Type().Kind() != reflect.Func { - return 0, errors.New("f is not a function") - } - - // Create an idle source func to be added to the main loop context. - idleSrc := C.g_idle_source_new() - if idleSrc == nil { - return 0, errNilPtr - } - return sourceAttach(idleSrc, rf, args...) -} - -// TimeoutAdd adds an timeout source to the default main event loop -// context. After running once, the source func will be removed -// from the main event loop, unless f returns a single bool true. -// -// This function will cause a panic when f eventually runs if the -// types of args do not match those of f. -// timeout is in milliseconds -func TimeoutAdd(timeout uint, f interface{}, args ...interface{}) (SourceHandle, error) { - // f must be a func with no parameters. - rf := reflect.ValueOf(f) - if rf.Type().Kind() != reflect.Func { - return 0, errors.New("f is not a function") - } - - // Create a timeout source func to be added to the main loop context. - timeoutSrc := C.g_timeout_source_new(C.guint(timeout)) - if timeoutSrc == nil { - return 0, errNilPtr - } - - return sourceAttach(timeoutSrc, rf, args...) -} - -// sourceAttach attaches a source to the default main loop context. -func sourceAttach(src *C.struct__GSource, rf reflect.Value, args ...interface{}) (SourceHandle, error) { - if src == nil { - return 0, errNilPtr - } - - // rf must be a func with no parameters. - if rf.Type().Kind() != reflect.Func { - C.g_source_destroy(src) - return 0, errors.New("rf is not a function") - } - - // Create a new GClosure from f that invalidates itself when - // f returns false. The error is ignored here, as this will - // always be a function. - var closure *C.GClosure - closure, _ = ClosureNew(rf.Interface(), args...) - - // Remove closure context when closure is finalized. - C._g_closure_add_finalize_notifier(closure) - - // Set closure to run as a callback when the idle source runs. - C.g_source_set_closure(src, closure) - - // Attach the idle source func to the default main event loop - // context. - cid := C.g_source_attach(src, nil) - return SourceHandle(cid), nil -} - -/* - * Miscellaneous Utility Functions - */ - -// GetHomeDir is a wrapper around g_get_home_dir(). -func GetHomeDir() string { - c := C.g_get_home_dir() - return C.GoString((*C.char)(c)) -} - -// GetUserCacheDir is a wrapper around g_get_user_cache_dir(). -func GetUserCacheDir() string { - c := C.g_get_user_cache_dir() - return C.GoString((*C.char)(c)) -} - -// GetUserDataDir is a wrapper around g_get_user_data_dir(). -func GetUserDataDir() string { - c := C.g_get_user_data_dir() - return C.GoString((*C.char)(c)) -} - -// GetUserConfigDir is a wrapper around g_get_user_config_dir(). -func GetUserConfigDir() string { - c := C.g_get_user_config_dir() - return C.GoString((*C.char)(c)) -} - -// GetUserRuntimeDir is a wrapper around g_get_user_runtime_dir(). -func GetUserRuntimeDir() string { - c := C.g_get_user_runtime_dir() - return C.GoString((*C.char)(c)) -} - -// GetUserSpecialDir is a wrapper around g_get_user_special_dir(). A -// non-nil error is returned in the case that g_get_user_special_dir() -// returns NULL to differentiate between NULL and an empty string. -func GetUserSpecialDir(directory UserDirectory) (string, error) { - c := C.g_get_user_special_dir(C.GUserDirectory(directory)) - if c == nil { - return "", errNilPtr - } - return C.GoString((*C.char)(c)), nil -} - -/* - * GObject - */ - -// IObject is an interface type implemented by Object and all types which embed -// an Object. It is meant to be used as a type for function arguments which -// require GObjects or any subclasses thereof. -type IObject interface { - toGObject() *C.GObject - toObject() *Object -} - -// Object is a representation of GLib's GObject. -type Object struct { - GObject *C.GObject -} - -func (v *Object) toGObject() *C.GObject { - if v == nil { - return nil - } - return v.native() -} - -func (v *Object) toObject() *Object { - return v -} - -// newObject creates a new Object from a GObject pointer. -func newObject(p *C.GObject) *Object { - return &Object{GObject: p} -} - -// native returns a pointer to the underlying GObject. -func (v *Object) native() *C.GObject { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGObject(p) -} - -// Take wraps a unsafe.Pointer as a glib.Object, taking ownership of it. -// This function is exported for visibility in other gotk3 packages and -// is not meant to be used by applications. -func Take(ptr unsafe.Pointer) *Object { - obj := newObject(ToGObject(ptr)) - - if obj.IsFloating() { - obj.RefSink() - } else { - obj.Ref() - } - - runtime.SetFinalizer(obj, (*Object).Unref) - return obj -} - -// Native returns a pointer to the underlying GObject. -func (v *Object) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -// IsA is a wrapper around g_type_is_a(). -func (v *Object) IsA(typ Type) bool { - return gobool(C.g_type_is_a(C.GType(v.TypeFromInstance()), C.GType(typ))) -} - -// TypeFromInstance is a wrapper around g_type_from_instance(). -func (v *Object) TypeFromInstance() Type { - c := C._g_type_from_instance(C.gpointer(unsafe.Pointer(v.native()))) - return Type(c) -} - -// ToGObject type converts an unsafe.Pointer as a native C GObject. -// This function is exported for visibility in other gotk3 packages and -// is not meant to be used by applications. -func ToGObject(p unsafe.Pointer) *C.GObject { - return C.toGObject(p) -} - -// Ref is a wrapper around g_object_ref(). -func (v *Object) Ref() { - C.g_object_ref(C.gpointer(v.GObject)) -} - -// Unref is a wrapper around g_object_unref(). -func (v *Object) Unref() { - C.g_object_unref(C.gpointer(v.GObject)) -} - -// RefSink is a wrapper around g_object_ref_sink(). -func (v *Object) RefSink() { - C.g_object_ref_sink(C.gpointer(v.GObject)) -} - -// IsFloating is a wrapper around g_object_is_floating(). -func (v *Object) IsFloating() bool { - c := C.g_object_is_floating(C.gpointer(v.GObject)) - return gobool(c) -} - -// ForceFloating is a wrapper around g_object_force_floating(). -func (v *Object) ForceFloating() { - C.g_object_force_floating(v.GObject) -} - -// StopEmission is a wrapper around g_signal_stop_emission_by_name(). -func (v *Object) StopEmission(s string) { - cstr := C.CString(s) - defer C.free(unsafe.Pointer(cstr)) - C.g_signal_stop_emission_by_name((C.gpointer)(v.GObject), - (*C.gchar)(cstr)) -} - -// 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 { - return v.SetProperty(name, value) - /* - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - - if _, ok := value.(Object); ok { - value = value.(Object).GObject - } - - // Can't call g_object_set() as it uses a variable arg list, use a - // wrapper instead - 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.g_free(C.gpointer(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())) - } - } - } - if p == nil { - return errors.New("Unable to perform type conversion") - } - C._g_object_set_one(C.gpointer(v.GObject), (*C.gchar)(cstr), p) - return nil*/ -} - -// GetPropertyType returns the Type of a property of the underlying GObject. -// If the property is missing it will return TYPE_INVALID and an error. -func (v *Object) GetPropertyType(name string) (Type, error) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - - paramSpec := C.g_object_class_find_property(C._g_object_get_class(v.native()), (*C.gchar)(cstr)) - if paramSpec == nil { - return TYPE_INVALID, errors.New("couldn't find Property") - } - return Type(paramSpec.value_type), nil -} - -// GetProperty is a wrapper around g_object_get_property(). -func (v *Object) GetProperty(name string) (interface{}, error) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - - t, err := v.GetPropertyType(name) - if err != nil { - return nil, err - } - - p, err := ValueInit(t) - if err != nil { - return nil, errors.New("unable to allocate value") - } - C.g_object_get_property(v.GObject, (*C.gchar)(cstr), p.native()) - return p.GoValue() -} - -// SetProperty is a wrapper around g_object_set_property(). -func (v *Object) SetProperty(name string, value interface{}) error { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - - if _, ok := value.(Object); ok { - value = value.(Object).GObject - } - - p, err := GValue(value) - if err != nil { - return errors.New("Unable to perform type conversion") - } - C.g_object_set_property(v.GObject, (*C.gchar)(cstr), p.native()) - return nil -} - -// 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 -}*/ - -/* - * GObject Signals - */ - -// Emit is a wrapper around g_signal_emitv() and emits the signal -// specified by the string s to an Object. Arguments to callback -// functions connected to this signal must be specified in args. Emit() -// returns an interface{} which must be type asserted as the Go -// equivalent type to the return value for native C callback. -// -// Note that this code is unsafe in that the types of values in args are -// not checked against whether they are suitable for the callback. -func (v *Object) Emit(s string, args ...interface{}) (interface{}, error) { - cstr := C.CString(s) - defer C.free(unsafe.Pointer(cstr)) - - // Create array of this instance and arguments - valv := C.alloc_gvalue_list(C.int(len(args)) + 1) - defer C.free(unsafe.Pointer(valv)) - - // Add args and valv - val, err := GValue(v) - if err != nil { - return nil, errors.New("Error converting Object to GValue: " + err.Error()) - } - C.val_list_insert(valv, C.int(0), val.native()) - for i := range args { - val, err := GValue(args[i]) - if err != nil { - return nil, fmt.Errorf("Error converting arg %d to GValue: %s", i, err.Error()) - } - C.val_list_insert(valv, C.int(i+1), val.native()) - } - - t := v.TypeFromInstance() - // TODO: use just the signal name - id := C.g_signal_lookup((*C.gchar)(cstr), C.GType(t)) - - ret, err := ValueAlloc() - if err != nil { - return nil, errors.New("Error creating Value for return value") - } - C.g_signal_emitv(valv, id, C.GQuark(0), ret.native()) - - return ret.GoValue() -} - -// HandlerBlock is a wrapper around g_signal_handler_block(). -func (v *Object) HandlerBlock(handle SignalHandle) { - C.g_signal_handler_block(C.gpointer(v.GObject), C.gulong(handle)) -} - -// HandlerUnblock is a wrapper around g_signal_handler_unblock(). -func (v *Object) HandlerUnblock(handle SignalHandle) { - C.g_signal_handler_unblock(C.gpointer(v.GObject), C.gulong(handle)) -} - -// HandlerDisconnect is a wrapper around g_signal_handler_disconnect(). -func (v *Object) HandlerDisconnect(handle SignalHandle) { - C.g_signal_handler_disconnect(C.gpointer(v.GObject), C.gulong(handle)) - C.g_closure_invalidate(signals[handle]) - delete(closures.m, signals[handle]) - delete(signals, handle) -} - -// Wrapper function for new objects with reference management. -func wrapObject(ptr unsafe.Pointer) *Object { - obj := &Object{ToGObject(ptr)} - - if obj.IsFloating() { - obj.RefSink() - } else { - obj.Ref() - } - - runtime.SetFinalizer(obj, (*Object).Unref) - return obj -} - -/* - * GInitiallyUnowned - */ - -// InitiallyUnowned is a representation of GLib's GInitiallyUnowned. -type InitiallyUnowned struct { - // This must be a pointer so copies of the ref-sinked object - // do not outlive the original object, causing an unref - // finalizer to prematurely run. - *Object -} - -// Native returns a pointer to the underlying GObject. This is implemented -// here rather than calling Native on the embedded Object to prevent a nil -// pointer dereference. -func (v *InitiallyUnowned) Native() uintptr { - if v == nil || v.Object == nil { - return uintptr(unsafe.Pointer(nil)) - } - return v.Object.Native() -} - -/* - * GValue - */ - -// Value is a representation of GLib's GValue. -// -// Don't allocate Values on the stack or heap manually as they may not -// be properly unset when going out of scope. Instead, use ValueAlloc(), -// which will set the runtime finalizer to unset the Value after it has -// left scope. -type Value struct { - GValue *C.GValue -} - -// native returns a pointer to the underlying GValue. -func (v *Value) native() *C.GValue { - return v.GValue -} - -// Native returns a pointer to the underlying GValue. -func (v *Value) Native() unsafe.Pointer { - return unsafe.Pointer(v.native()) -} - -// ValueAlloc allocates a Value and sets a runtime finalizer to call -// g_value_unset() on the underlying GValue after leaving scope. -// ValueAlloc() returns a non-nil error if the allocation failed. -func ValueAlloc() (*Value, error) { - c := C._g_value_alloc() - if c == nil { - return nil, errNilPtr - } - - v := &Value{c} - - //An allocated GValue is not guaranteed to hold a value that can be unset - //We need to double check before unsetting, to prevent: - //`g_value_unset: assertion 'G_IS_VALUE (value)' failed` - runtime.SetFinalizer(v, func(f *Value) { - if t, _, err := f.Type(); err != nil || t == TYPE_INVALID || t == TYPE_NONE { - C.g_free(C.gpointer(f.native())) - return - } - - f.unset() - }) - - return v, nil -} - -// ValueInit is a wrapper around g_value_init() and allocates and -// initializes a new Value with the Type t. A runtime finalizer is set -// to call g_value_unset() on the underlying GValue after leaving scope. -// ValueInit() returns a non-nil error if the allocation failed. -func ValueInit(t Type) (*Value, error) { - c := C._g_value_init(C.GType(t)) - if c == nil { - return nil, errNilPtr - } - - v := &Value{c} - - runtime.SetFinalizer(v, (*Value).unset) - return v, nil -} - -// ValueFromNative returns a type-asserted pointer to the Value. -func ValueFromNative(l unsafe.Pointer) *Value { - //TODO why it does not add finalizer to the value? - return &Value{(*C.GValue)(l)} -} - -func (v *Value) unset() { - C.g_value_unset(v.native()) -} - -// Type is a wrapper around the G_VALUE_HOLDS_GTYPE() macro and -// the g_value_get_gtype() function. GetType() returns TYPE_INVALID if v -// does not hold a Type, or otherwise returns the Type of v. -func (v *Value) Type() (actual Type, fundamental Type, err error) { - if !gobool(C._g_is_value(v.native())) { - return actual, fundamental, errors.New("invalid GValue") - } - cActual := C._g_value_type(v.native()) - cFundamental := C._g_value_fundamental(cActual) - return Type(cActual), Type(cFundamental), nil -} - -// GValue converts a Go type to a comparable GValue. GValue() -// returns a non-nil error if the conversion was unsuccessful. -func GValue(v interface{}) (gvalue *Value, err error) { - if v == nil { - val, err := ValueInit(TYPE_POINTER) - if err != nil { - return nil, err - } - val.SetPointer(uintptr(unsafe.Pointer(nil))) - return val, nil - } - - switch e := v.(type) { - case bool: - val, err := ValueInit(TYPE_BOOLEAN) - if err != nil { - return nil, err - } - val.SetBool(e) - return val, nil - - case int8: - val, err := ValueInit(TYPE_CHAR) - if err != nil { - return nil, err - } - val.SetSChar(e) - return val, nil - - case int64: - val, err := ValueInit(TYPE_INT64) - if err != nil { - return nil, err - } - val.SetInt64(e) - return val, nil - - case int: - val, err := ValueInit(TYPE_INT) - if err != nil { - return nil, err - } - val.SetInt(e) - return val, nil - - case uint8: - val, err := ValueInit(TYPE_UCHAR) - if err != nil { - return nil, err - } - val.SetUChar(e) - return val, nil - - case uint64: - val, err := ValueInit(TYPE_UINT64) - if err != nil { - return nil, err - } - val.SetUInt64(e) - return val, nil - - case uint: - val, err := ValueInit(TYPE_UINT) - if err != nil { - return nil, err - } - val.SetUInt(e) - return val, nil - - case float32: - val, err := ValueInit(TYPE_FLOAT) - if err != nil { - return nil, err - } - val.SetFloat(e) - return val, nil - - case float64: - val, err := ValueInit(TYPE_DOUBLE) - if err != nil { - return nil, err - } - val.SetDouble(e) - return val, nil - - case string: - val, err := ValueInit(TYPE_STRING) - if err != nil { - return nil, err - } - val.SetString(e) - return val, nil - - case *Object: - val, err := ValueInit(TYPE_OBJECT) - if err != nil { - return nil, err - } - val.SetInstance(uintptr(unsafe.Pointer(e.GObject))) - return val, nil - - default: - /* Try this since above doesn't catch constants under other types */ - rval := reflect.ValueOf(v) - switch rval.Kind() { - case reflect.Int8: - val, err := ValueInit(TYPE_CHAR) - if err != nil { - return nil, err - } - val.SetSChar(int8(rval.Int())) - return val, nil - - case reflect.Int16: - return nil, errors.New("Type not implemented") - - case reflect.Int32: - return nil, errors.New("Type not implemented") - - case reflect.Int64: - val, err := ValueInit(TYPE_INT64) - if err != nil { - return nil, err - } - val.SetInt64(rval.Int()) - return val, nil - - case reflect.Int: - val, err := ValueInit(TYPE_INT) - if err != nil { - return nil, err - } - val.SetInt(int(rval.Int())) - return val, nil - - case reflect.Uintptr, reflect.Ptr: - val, err := ValueInit(TYPE_POINTER) - if err != nil { - return nil, err - } - val.SetPointer(rval.Pointer()) - return val, nil - } - } - - return nil, errors.New("Type not implemented") -} - -// GValueMarshaler is a marshal function to convert a GValue into an -// appropriate Go type. The uintptr parameter is a *C.GValue. -type GValueMarshaler func(uintptr) (interface{}, error) - -// TypeMarshaler represents an actual type and it's associated marshaler. -type TypeMarshaler struct { - T Type - F GValueMarshaler -} - -// RegisterGValueMarshalers adds marshalers for several types to the -// internal marshalers map. Once registered, calling GoValue on any -// Value witha registered type will return the data returned by the -// marshaler. -func RegisterGValueMarshalers(tm []TypeMarshaler) { - gValueMarshalers.register(tm) -} - -type marshalMap map[Type]GValueMarshaler - -// gValueMarshalers is a map of Glib types to functions to marshal a -// GValue to a native Go type. -var gValueMarshalers = marshalMap{ - TYPE_INVALID: marshalInvalid, - TYPE_NONE: marshalNone, - TYPE_INTERFACE: marshalInterface, - TYPE_CHAR: marshalChar, - TYPE_UCHAR: marshalUchar, - TYPE_BOOLEAN: marshalBoolean, - TYPE_INT: marshalInt, - TYPE_LONG: marshalLong, - TYPE_ENUM: marshalEnum, - TYPE_INT64: marshalInt64, - TYPE_UINT: marshalUint, - TYPE_ULONG: marshalUlong, - TYPE_FLAGS: marshalFlags, - TYPE_UINT64: marshalUint64, - TYPE_FLOAT: marshalFloat, - TYPE_DOUBLE: marshalDouble, - TYPE_STRING: marshalString, - TYPE_POINTER: marshalPointer, - TYPE_BOXED: marshalBoxed, - TYPE_OBJECT: marshalObject, - TYPE_VARIANT: marshalVariant, -} - -func (m marshalMap) register(tm []TypeMarshaler) { - for i := range tm { - m[tm[i].T] = tm[i].F - } -} - -func (m marshalMap) lookup(v *Value) (GValueMarshaler, error) { - actual, fundamental, err := v.Type() - if err != nil { - return nil, err - } - - if f, ok := m[actual]; ok { - return f, nil - } - if f, ok := m[fundamental]; ok { - return f, nil - } - return nil, errors.New("missing marshaler for type") -} - -func marshalInvalid(uintptr) (interface{}, error) { - return nil, errors.New("invalid type") -} - -func marshalNone(uintptr) (interface{}, error) { - return nil, nil -} - -func marshalInterface(uintptr) (interface{}, error) { - return nil, errors.New("interface conversion not yet implemented") -} - -func marshalChar(p uintptr) (interface{}, error) { - c := C.g_value_get_schar((*C.GValue)(unsafe.Pointer(p))) - return int8(c), nil -} - -func marshalUchar(p uintptr) (interface{}, error) { - c := C.g_value_get_uchar((*C.GValue)(unsafe.Pointer(p))) - return uint8(c), nil -} - -func marshalBoolean(p uintptr) (interface{}, error) { - c := C.g_value_get_boolean((*C.GValue)(unsafe.Pointer(p))) - return gobool(c), nil -} - -func marshalInt(p uintptr) (interface{}, error) { - c := C.g_value_get_int((*C.GValue)(unsafe.Pointer(p))) - return int(c), nil -} - -func marshalLong(p uintptr) (interface{}, error) { - c := C.g_value_get_long((*C.GValue)(unsafe.Pointer(p))) - return int(c), nil -} - -func marshalEnum(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return int(c), nil -} - -func marshalInt64(p uintptr) (interface{}, error) { - c := C.g_value_get_int64((*C.GValue)(unsafe.Pointer(p))) - return int64(c), nil -} - -func marshalUint(p uintptr) (interface{}, error) { - c := C.g_value_get_uint((*C.GValue)(unsafe.Pointer(p))) - return uint(c), nil -} - -func marshalUlong(p uintptr) (interface{}, error) { - c := C.g_value_get_ulong((*C.GValue)(unsafe.Pointer(p))) - return uint(c), nil -} - -func marshalFlags(p uintptr) (interface{}, error) { - c := C.g_value_get_flags((*C.GValue)(unsafe.Pointer(p))) - return uint(c), nil -} - -func marshalUint64(p uintptr) (interface{}, error) { - c := C.g_value_get_uint64((*C.GValue)(unsafe.Pointer(p))) - return uint64(c), nil -} - -func marshalFloat(p uintptr) (interface{}, error) { - c := C.g_value_get_float((*C.GValue)(unsafe.Pointer(p))) - return float32(c), nil -} - -func marshalDouble(p uintptr) (interface{}, error) { - c := C.g_value_get_double((*C.GValue)(unsafe.Pointer(p))) - return float64(c), nil -} - -func marshalString(p uintptr) (interface{}, error) { - c := C.g_value_get_string((*C.GValue)(unsafe.Pointer(p))) - return C.GoString((*C.char)(c)), nil -} - -func marshalBoxed(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - return uintptr(unsafe.Pointer(c)), nil -} - -func marshalPointer(p uintptr) (interface{}, error) { - c := C.g_value_get_pointer((*C.GValue)(unsafe.Pointer(p))) - return unsafe.Pointer(c), nil -} - -func marshalObject(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return newObject((*C.GObject)(c)), nil -} - -func marshalVariant(p uintptr) (interface{}, error) { - return nil, errors.New("variant conversion not yet implemented") -} - -// GoValue converts a Value to comparable Go type. GoValue() -// returns a non-nil error if the conversion was unsuccessful. The -// returned interface{} must be type asserted as the actual Go -// representation of the Value. -// -// This function is a wrapper around the many g_value_get_*() -// functions, depending on the type of the Value. -func (v *Value) GoValue() (interface{}, error) { - f, err := gValueMarshalers.lookup(v) - if err != nil { - return nil, err - } - - //No need to add finalizer because it is already done by ValueAlloc and ValueInit - rv, err := f(uintptr(unsafe.Pointer(v.native()))) - return rv, err -} - -// SetBool is a wrapper around g_value_set_boolean(). -func (v *Value) SetBool(val bool) { - C.g_value_set_boolean(v.native(), gbool(val)) -} - -// SetSChar is a wrapper around g_value_set_schar(). -func (v *Value) SetSChar(val int8) { - C.g_value_set_schar(v.native(), C.gint8(val)) -} - -// SetInt64 is a wrapper around g_value_set_int64(). -func (v *Value) SetInt64(val int64) { - C.g_value_set_int64(v.native(), C.gint64(val)) -} - -// SetInt is a wrapper around g_value_set_int(). -func (v *Value) SetInt(val int) { - C.g_value_set_int(v.native(), C.gint(val)) -} - -// SetUChar is a wrapper around g_value_set_uchar(). -func (v *Value) SetUChar(val uint8) { - C.g_value_set_uchar(v.native(), C.guchar(val)) -} - -// SetUInt64 is a wrapper around g_value_set_uint64(). -func (v *Value) SetUInt64(val uint64) { - C.g_value_set_uint64(v.native(), C.guint64(val)) -} - -// SetUInt is a wrapper around g_value_set_uint(). -func (v *Value) SetUInt(val uint) { - C.g_value_set_uint(v.native(), C.guint(val)) -} - -// SetFloat is a wrapper around g_value_set_float(). -func (v *Value) SetFloat(val float32) { - C.g_value_set_float(v.native(), C.gfloat(val)) -} - -// SetDouble is a wrapper around g_value_set_double(). -func (v *Value) SetDouble(val float64) { - C.g_value_set_double(v.native(), C.gdouble(val)) -} - -// SetString is a wrapper around g_value_set_string(). -func (v *Value) SetString(val string) { - cstr := C.CString(val) - defer C.free(unsafe.Pointer(cstr)) - C.g_value_set_string(v.native(), (*C.gchar)(cstr)) -} - -// SetInstance is a wrapper around g_value_set_instance(). -func (v *Value) SetInstance(instance uintptr) { - C.g_value_set_instance(v.native(), C.gpointer(instance)) -} - -// SetPointer is a wrapper around g_value_set_pointer(). -func (v *Value) SetPointer(p uintptr) { - C.g_value_set_pointer(v.native(), C.gpointer(p)) -} - -// GetPointer is a wrapper around g_value_get_pointer(). -func (v *Value) GetPointer() unsafe.Pointer { - return unsafe.Pointer(C.g_value_get_pointer(v.native())) -} - -// GetString is a wrapper around g_value_get_string(). GetString() -// returns a non-nil error if g_value_get_string() returned a NULL -// pointer to distinguish between returning a NULL pointer and returning -// an empty string. -func (v *Value) GetString() (string, error) { - c := C.g_value_get_string(v.native()) - if c == nil { - return "", errNilPtr - } - return C.GoString((*C.char)(c)), nil -} - -type Signal struct { - name string - signalId C.guint -} - -func SignalNew(s string) (*Signal, error) { - cstr := C.CString(s) - defer C.free(unsafe.Pointer(cstr)) - - signalId := C._g_signal_new((*C.gchar)(cstr)) - - if signalId == 0 { - return nil, fmt.Errorf("invalid signal name: %s", s) - } - - return &Signal{ - name: s, - signalId: signalId, - }, nil -} - -func (s *Signal) String() string { - return s.name -} - -type Quark uint32 - -// GetApplicationName is a wrapper around g_get_application_name(). -func GetApplicationName() string { - c := C.g_get_application_name() - - return C.GoString((*C.char)(c)) -} - -// SetApplicationName is a wrapper around g_set_application_name(). -func SetApplicationName(name string) { - cstr := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr)) - - C.g_set_application_name(cstr) -} - -// InitI18n initializes the i18n subsystem. -func InitI18n(domain string, dir string) { - domainStr := C.CString(domain) - defer C.free(unsafe.Pointer(domainStr)) - - dirStr := C.CString(dir) - defer C.free(unsafe.Pointer(dirStr)) - - C.init_i18n(domainStr, dirStr) -} - -// Local localizes a string using gettext -func Local(input string) string { - cstr := C.CString(input) - defer C.free(unsafe.Pointer(cstr)) - - return C.GoString(C.localize(cstr)) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/glib.go.h b/vendor/github.com/gotk3/gotk3/glib/glib.go.h deleted file mode 100644 index 55a324b..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/glib.go.h +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> - * - * This file originated from: http://opensource.conformal.com/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef __GLIB_GO_H__ -#define __GLIB_GO_H__ - -#include <stdint.h> -#include <stdlib.h> -#include <stdio.h> - -#include <gio/gio.h> -#define G_SETTINGS_ENABLE_BACKEND -#include <gio/gsettingsbackend.h> -#include <glib.h> -#include <glib-object.h> -#include <glib/gi18n.h> -#include <locale.h> - -/* GObject Type Casting */ -static GObject * -toGObject(void *p) -{ - return (G_OBJECT(p)); -} - -static GAction * -toGAction(void *p) -{ - return (G_ACTION(p)); -} - -static GActionGroup * -toGActionGroup(void *p) -{ - return (G_ACTION_GROUP(p)); -} - -static GActionMap * -toGActionMap(void *p) -{ - return (G_ACTION_MAP(p)); -} - -static GSimpleAction * -toGSimpleAction(void *p) -{ - return (G_SIMPLE_ACTION(p)); -} - -static GSimpleActionGroup * -toGSimpleActionGroup(void *p) -{ - return (G_SIMPLE_ACTION_GROUP(p)); -} - -static GPropertyAction * -toGPropertyAction(void *p) -{ - return (G_PROPERTY_ACTION(p)); -} - -static GMenuModel * -toGMenuModel(void *p) -{ - return (G_MENU_MODEL(p)); -} - -static GMenu * -toGMenu(void *p) -{ - return (G_MENU(p)); -} - -static GMenuItem * -toGMenuItem(void *p) -{ - return (G_MENU_ITEM(p)); -} - -static GNotification * -toGNotification(void *p) -{ - return (G_NOTIFICATION(p)); -} - -static GApplication * -toGApplication(void *p) -{ - return (G_APPLICATION(p)); -} - -static GSettings * -toGSettings(void *p) -{ - return (G_SETTINGS(p)); -} - -static GSettingsBackend * -toGSettingsBackend(void *p) -{ - return (G_SETTINGS_BACKEND(p)); -} - -static GBinding* -toGBinding(void *p) -{ - return (G_BINDING(p)); -} - -static GType -_g_type_from_instance(gpointer instance) -{ - return (G_TYPE_FROM_INSTANCE(instance)); -} - -/* Wrapper to avoid variable arg list */ -static void -_g_object_set_one(gpointer object, const gchar *property_name, void *val) -{ - g_object_set(object, property_name, *(gpointer **)val, NULL); -} - -static GValue * -alloc_gvalue_list(int n) -{ - GValue *valv; - - valv = g_new0(GValue, n); - return (valv); -} - -static void -val_list_insert(GValue *valv, int i, GValue *val) -{ - valv[i] = *val; -} - -/* - * GValue - */ - -static GValue * -_g_value_alloc() -{ - return (g_new0(GValue, 1)); -} - -static GValue * -_g_value_init(GType g_type) -{ - GValue *value; - - value = g_new0(GValue, 1); - return (g_value_init(value, g_type)); -} - -static gboolean -_g_is_value(GValue *val) -{ - return (G_IS_VALUE(val)); -} - -static GType -_g_value_type(GValue *val) -{ - return (G_VALUE_TYPE(val)); -} - -static GType -_g_value_fundamental(GType type) -{ - return (G_TYPE_FUNDAMENTAL(type)); -} - -static GObjectClass * -_g_object_get_class (GObject *object) -{ - return (G_OBJECT_GET_CLASS(object)); -} - -/* - * Closure support - */ - -extern void goMarshal(GClosure *, GValue *, guint, GValue *, gpointer, GValue *); - -static GClosure * -_g_closure_new() -{ - GClosure *closure; - - closure = g_closure_new_simple(sizeof(GClosure), NULL); - g_closure_set_marshal(closure, (GClosureMarshal)(goMarshal)); - return (closure); -} - -extern void removeClosure(gpointer, GClosure *); - -static void -_g_closure_add_finalize_notifier(GClosure *closure) -{ - g_closure_add_finalize_notifier(closure, NULL, removeClosure); -} - -static inline guint _g_signal_new(const gchar *name) { - return g_signal_new(name, - G_TYPE_OBJECT, - G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, - 0, NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, - 0); -} - -static void init_i18n(const char *domain, const char *dir) { - setlocale(LC_ALL, ""); - bindtextdomain(domain, dir); - bind_textdomain_codeset(domain, "UTF-8"); - textdomain(domain); -} - -static const char* localize(const char *string) { - return _(string); -} - -static inline char** make_strings(int count) { - return (char**)malloc(sizeof(char*) * count); -} - -static inline void destroy_strings(char** strings) { - free(strings); -} - -static inline char* get_string(char** strings, int n) { - return strings[n]; -} - -static inline void set_string(char** strings, int n, char* str) { - strings[n] = str; -} - -static inline gchar** next_gcharptr(gchar** s) { return (s+1); } - -#endif diff --git a/vendor/github.com/gotk3/gotk3/glib/glib_extension.go b/vendor/github.com/gotk3/gotk3/glib/glib_extension.go deleted file mode 100644 index f96286a..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/glib_extension.go +++ /dev/null @@ -1,18 +0,0 @@ -//glib_extension contains definitions and functions to interface between glib/gtk/gio and go universe - -package glib - -import ( - "reflect" -) - -// Should be implemented by any class which need special conversion like -// gtk.Application -> gio.Application -type IGlibConvert interface { - // If conversion can't be done, the function has to panic with a message that it can't convert to type - Convert(reflect.Type) reflect.Value -} - -var ( - IGlibConvertType reflect.Type -) diff --git a/vendor/github.com/gotk3/gotk3/glib/glib_test.go b/vendor/github.com/gotk3/gotk3/glib/glib_test.go deleted file mode 100644 index 14344a4..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/glib_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package glib_test - -import ( - "runtime" - "testing" - - "github.com/gotk3/gotk3/glib" - "github.com/gotk3/gotk3/gtk" -) - -func init() { - gtk.Init(nil) -} - -// TestConnectNotifySignal ensures that property notification signals (those -// whose name begins with "notify::") are queried by the name "notify" (with the -// "::" and the property name omitted). This is because the signal is "notify" -// and the characters after the "::" are not recognized by the signal system. -// -// See -// https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#GObject-notify -// for background, and -// https://developer.gnome.org/gobject/stable/gobject-Signals.html#g-signal-new -// for the specification of valid signal names. -func TestConnectNotifySignal(t *testing.T) { - runtime.LockOSThread() - - // Create any GObject that has defined properties. - spacing := 0 - box, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, spacing) - - // Connect to a "notify::" signal to listen on property changes. - box.Connect("notify::spacing", func() { - gtk.MainQuit() - }) - - glib.IdleAdd(func(s string) bool { - t.Log(s) - spacing++ - box.SetSpacing(spacing) - return true - }, "IdleAdd executed") - - gtk.Main() -} - -/*At this moment Visionect specific*/ -func TestTimeoutAdd(t *testing.T) { - runtime.LockOSThread() - - glib.TimeoutAdd(2500, func(s string) bool { - t.Log(s) - gtk.MainQuit() - return false - }, "TimeoutAdd executed") - - gtk.Main() -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gmain_context.go b/vendor/github.com/gotk3/gotk3/glib/gmain_context.go deleted file mode 100644 index 86ffd89..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gmain_context.go +++ /dev/null @@ -1,31 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" - -type MainContext C.GMainContext - -// native returns a pointer to the underlying GMainContext. -func (v *MainContext) native() *C.GMainContext { - if v == nil { - return nil - } - return (*C.GMainContext)(v) -} - -// MainContextDefault is a wrapper around g_main_context_default(). -func MainContextDefault() *MainContext { - c := C.g_main_context_default() - if c == nil { - return nil - } - return (*MainContext)(c) -} - -// MainDepth is a wrapper around g_main_depth(). -func MainDepth() int { - return int(C.g_main_depth()) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gsimpleactiongroup.go b/vendor/github.com/gotk3/gotk3/glib/gsimpleactiongroup.go deleted file mode 100644 index f96936e..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gsimpleactiongroup.go +++ /dev/null @@ -1,58 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import ( - "unsafe" -) - -// SimpleActionGroup is a representation of glib's GSimpleActionGroup -type SimpleActionGroup struct { - *Object - - // Interfaces - IActionMap - IActionGroup -} - -// deprecated since 2.38: -// g_simple_action_group_lookup() -// g_simple_action_group_insert() -// g_simple_action_group_remove() -// g_simple_action_group_add_entries() -// -> See implementations in ActionMap - -// native() returns a pointer to the underlying GSimpleActionGroup. -func (v *SimpleActionGroup) native() *C.GSimpleActionGroup { - if v == nil || v.GObject == nil { - return nil - } - return C.toGSimpleActionGroup(unsafe.Pointer(v.GObject)) -} - -func (v *SimpleActionGroup) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalSimpleActionGroup(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapSimpleActionGroup(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapSimpleActionGroup(obj *Object) *SimpleActionGroup { - am := wrapActionMap(obj) - ag := wrapActionGroup(obj) - return &SimpleActionGroup{obj, am, ag} -} - -// SimpleActionGroupNew is a wrapper around g_simple_action_group_new -func SimpleActionGroupNew() *SimpleActionGroup { - c := C.g_simple_action_group_new() - if c == nil { - return nil - } - return wrapSimpleActionGroup(wrapObject(unsafe.Pointer(c))) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gsimpleactiongroup_test.go b/vendor/github.com/gotk3/gotk3/glib/gsimpleactiongroup_test.go deleted file mode 100644 index 0982bc6..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gsimpleactiongroup_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package glib - -import ( - "testing" -) - -func TestSimpleActionGroupNew(t *testing.T) { - sag := SimpleActionGroupNew() - if sag == nil { - t.Error("SimpleActionGroupNew returned nil") - } - - if sag.IActionGroup == nil { - t.Error("Embedded IActionGroup is nil") - } - if sag.IActionMap == nil { - t.Error("Embedded IActionGroup is nil") - } -} - -func TestSimpleActionGroup_AddAction_RemoveAction_HasAction(t *testing.T) { - sag := SimpleActionGroupNew() - if sag == nil { - t.Error("SimpleActionGroup returned nil") - } - - // Check before: empty - hasAction := sag.HasAction("nope") - if hasAction { - t.Error("Action group contained unexpected action 'nope'") - } - hasAction = sag.HasAction("yepp") - if hasAction { - t.Error("Action group contained unexpected action 'yepp'") - } - - // Add a new action - act := SimpleActionNew("yepp", nil) - if act == nil { - t.Error("SimpleActionNew returned nil") - } - sag.AddAction(act) - - // Check that it exists - hasAction = sag.HasAction("nope") - if hasAction { - t.Error("Action group contained unexpected action 'nope'") - } - hasAction = sag.HasAction("yepp") - if !hasAction { - t.Error("Action group did not contain action 'yepp' after adding it") - } - - // Remove the action again - sag.RemoveAction("yepp") - - // Check that it was removed - hasAction = sag.HasAction("nope") - if hasAction { - t.Error("Action group contained unexpected action 'nope'") - } - hasAction = sag.HasAction("yepp") - if hasAction { - t.Error("Action group contained unexpected action 'yepp'") - } - - // NoFail check: removing a non-existing action - sag.RemoveAction("yepp") - sag.RemoveAction("nope") -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gsource.go b/vendor/github.com/gotk3/gotk3/glib/gsource.go deleted file mode 100644 index f11e711..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gsource.go +++ /dev/null @@ -1,26 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" - -type Source C.GSource - -// native returns a pointer to the underlying GSource. -func (v *Source) native() *C.GSource { - if v == nil { - return nil - } - return (*C.GSource)(v) -} - -// MainCurrentSource is a wrapper around g_main_current_source(). -func MainCurrentSource() *Source { - c := C.g_main_current_source() - if c == nil { - return nil - } - return (*Source)(c) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gvariant.go b/vendor/github.com/gotk3/gotk3/glib/gvariant.go deleted file mode 100644 index 39e175d..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvariant.go +++ /dev/null @@ -1,284 +0,0 @@ -//GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -package glib - -// #include "gvariant.go.h" -// #include "glib.go.h" -import "C" - -import ( - "fmt" - "unsafe" -) - -/* - * GVariant - */ - -// IVariant is an interface type implemented by Variant and all types which embed -// an Variant. It is meant to be used as a type for function arguments which -// require GVariants or any subclasses thereof. -type IVariant interface { - ToGVariant() *C.GVariant - ToVariant() *Variant -} - -// A Variant is a representation of GLib's GVariant. -type Variant struct { - GVariant *C.GVariant -} - -// ToGVariant exposes the underlying *C.GVariant type for this Variant, -// necessary to implement IVariant. -func (v *Variant) ToGVariant() *C.GVariant { - if v == nil { - return nil - } - return v.native() -} - -// ToVariant returns this Variant, necessary to implement IVariant. -func (v *Variant) ToVariant() *Variant { - return v -} - -// newVariant creates a new Variant from a GVariant pointer. -func newVariant(p *C.GVariant) *Variant { - return &Variant{GVariant: p} -} - -// VariantFromUnsafePointer returns a Variant from an unsafe pointer. -// XXX: unnecessary footgun? -//func VariantFromUnsafePointer(p unsafe.Pointer) *Variant { -// return &Variant{C.toGVariant(p)} -//} - -// native returns a pointer to the underlying GVariant. -func (v *Variant) native() *C.GVariant { - if v == nil || v.GVariant == nil { - return nil - } - return v.GVariant -} - -// Native returns a pointer to the underlying GVariant. -func (v *Variant) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -// TypeString returns the g variant type string for this variant. -func (v *Variant) TypeString() string { - // the string returned from this belongs to GVariant and must not be freed. - return C.GoString((*C.char)(C.g_variant_get_type_string(v.native()))) -} - -// IsContainer returns true if the variant is a container and false otherwise. -func (v *Variant) IsContainer() bool { - return gobool(C.g_variant_is_container(v.native())) -} - -// IsFloating returns true if the variant has a floating reference count. -// XXX: this isn't useful without ref_sink/take_ref, which are themselves -// perhaps not useful for most Go code that may use variants. -//func (v *Variant) IsFloating() bool { -// return gobool(C.g_variant_is_floating(v.native())) -//} - -// GetBoolean returns the bool value of this variant. -func (v *Variant) GetBoolean() bool { - return gobool(C.g_variant_get_boolean(v.native())) -} - -// GetString returns the string value of the variant. -func (v *Variant) GetString() string { - var len C.gsize - gc := C.g_variant_get_string(v.native(), &len) - defer C.g_free(C.gpointer(gc)) - return C.GoStringN((*C.char)(gc), (C.int)(len)) -} - -// GetStrv returns a slice of strings from this variant. It wraps -// g_variant_get_strv, but returns copies of the strings instead. -func (v *Variant) GetStrv() []string { - gstrv := C.g_variant_get_strv(v.native(), nil) - // we do not own the memory for these strings, so we must not use strfreev - // but we must free the actual pointer we receive. - c := gstrv - defer C.g_free(C.gpointer(gstrv)) - var strs []string - - for *c != nil { - strs = append(strs, C.GoString((*C.char)(*c))) - c = C.next_gcharptr(c) - } - return strs -} - -// GetInt returns the int64 value of the variant if it is an integer type, and -// an error otherwise. It wraps variouns `g_variant_get_*` functions dealing -// with integers of different sizes. -func (v *Variant) GetInt() (int64, error) { - t := v.Type().String() - var i int64 - switch t { - case "y": - i = int64(C.g_variant_get_byte(v.native())) - case "n": - i = int64(C.g_variant_get_int16(v.native())) - case "q": - i = int64(C.g_variant_get_uint16(v.native())) - case "i": - i = int64(C.g_variant_get_int32(v.native())) - case "u": - i = int64(C.g_variant_get_uint32(v.native())) - case "x": - i = int64(C.g_variant_get_int64(v.native())) - case "t": - i = int64(C.g_variant_get_uint64(v.native())) - default: - return 0, fmt.Errorf("variant type %s not an integer type", t) - } - return i, nil -} - -// Type returns the VariantType for this variant. -func (v *Variant) Type() *VariantType { - return newVariantType(C.g_variant_get_type(v.native())) -} - -// IsType returns true if the variant's type matches t. -func (v *Variant) IsType(t *VariantType) bool { - return gobool(C.g_variant_is_of_type(v.native(), t.native())) -} - -// String wraps g_variant_print(). It returns a string understood -// by g_variant_parse(). -func (v *Variant) String() string { - gc := C.g_variant_print(v.native(), gbool(false)) - defer C.g_free(C.gpointer(gc)) - return C.GoString((*C.char)(gc)) -} - -// AnnotatedString wraps g_variant_print(), but returns a type-annotated -// string. -func (v *Variant) AnnotatedString() string { - gc := C.g_variant_print(v.native(), gbool(true)) - defer C.g_free(C.gpointer(gc)) - return C.GoString((*C.char)(gc)) -} - -//void g_variant_unref () -//GVariant * g_variant_ref () -//GVariant * g_variant_ref_sink () -//GVariant * g_variant_take_ref () -//gint g_variant_compare () -//GVariantClass g_variant_classify () -//gboolean g_variant_check_format_string () -//void g_variant_get () -//void g_variant_get_va () -//GVariant * g_variant_new () -//GVariant * g_variant_new_va () -//GVariant * g_variant_new_boolean () -//GVariant * g_variant_new_byte () -//GVariant * g_variant_new_int16 () -//GVariant * g_variant_new_uint16 () -//GVariant * g_variant_new_int32 () -//GVariant * g_variant_new_uint32 () -//GVariant * g_variant_new_int64 () -//GVariant * g_variant_new_uint64 () -//GVariant * g_variant_new_handle () -//GVariant * g_variant_new_double () -//GVariant * g_variant_new_string () -//GVariant * g_variant_new_take_string () -//GVariant * g_variant_new_printf () -//GVariant * g_variant_new_object_path () -//gboolean g_variant_is_object_path () -//GVariant * g_variant_new_signature () -//gboolean g_variant_is_signature () -//GVariant * g_variant_new_variant () -//GVariant * g_variant_new_strv () -//GVariant * g_variant_new_objv () -//GVariant * g_variant_new_bytestring () -//GVariant * g_variant_new_bytestring_array () -//guchar g_variant_get_byte () -//gint16 g_variant_get_int16 () -//guint16 g_variant_get_uint16 () -//gint32 g_variant_get_int32 () -//guint32 g_variant_get_uint32 () -//gint64 g_variant_get_int64 () -//guint64 g_variant_get_uint64 () -//gint32 g_variant_get_handle () -//gdouble g_variant_get_double () -//const gchar * g_variant_get_string () -//gchar * g_variant_dup_string () -//GVariant * g_variant_get_variant () -//const gchar ** g_variant_get_strv () -//gchar ** g_variant_dup_strv () -//const gchar ** g_variant_get_objv () -//gchar ** g_variant_dup_objv () -//const gchar * g_variant_get_bytestring () -//gchar * g_variant_dup_bytestring () -//const gchar ** g_variant_get_bytestring_array () -//gchar ** g_variant_dup_bytestring_array () -//GVariant * g_variant_new_maybe () -//GVariant * g_variant_new_array () -//GVariant * g_variant_new_tuple () -//GVariant * g_variant_new_dict_entry () -//GVariant * g_variant_new_fixed_array () -//GVariant * g_variant_get_maybe () -//gsize g_variant_n_children () -//GVariant * g_variant_get_child_value () -//void g_variant_get_child () -//GVariant * g_variant_lookup_value () -//gboolean g_variant_lookup () -//gconstpointer g_variant_get_fixed_array () -//gsize g_variant_get_size () -//gconstpointer g_variant_get_data () -//GBytes * g_variant_get_data_as_bytes () -//void g_variant_store () -//GVariant * g_variant_new_from_data () -//GVariant * g_variant_new_from_bytes () -//GVariant * g_variant_byteswap () -//GVariant * g_variant_get_normal_form () -//gboolean g_variant_is_normal_form () -//guint g_variant_hash () -//gboolean g_variant_equal () -//gchar * g_variant_print () -//GString * g_variant_print_string () -//GVariantIter * g_variant_iter_copy () -//void g_variant_iter_free () -//gsize g_variant_iter_init () -//gsize g_variant_iter_n_children () -//GVariantIter * g_variant_iter_new () -//GVariant * g_variant_iter_next_value () -//gboolean g_variant_iter_next () -//gboolean g_variant_iter_loop () -//void g_variant_builder_unref () -//GVariantBuilder * g_variant_builder_ref () -//GVariantBuilder * g_variant_builder_new () -//void g_variant_builder_init () -//void g_variant_builder_clear () -//void g_variant_builder_add_value () -//void g_variant_builder_add () -//void g_variant_builder_add_parsed () -//GVariant * g_variant_builder_end () -//void g_variant_builder_open () -//void g_variant_builder_close () -//void g_variant_dict_unref () -//GVariantDict * g_variant_dict_ref () -//GVariantDict * g_variant_dict_new () -//void g_variant_dict_init () -//void g_variant_dict_clear () -//gboolean g_variant_dict_contains () -//gboolean g_variant_dict_lookup () -//GVariant * g_variant_dict_lookup_value () -//void g_variant_dict_insert () -//void g_variant_dict_insert_value () -//gboolean g_variant_dict_remove () -//GVariant * g_variant_dict_end () -//#define G_VARIANT_PARSE_ERROR -//GVariant * g_variant_parse () -//GVariant * g_variant_new_parsed_va () -//GVariant * g_variant_new_parsed () -//gchar * g_variant_parse_error_print_context () diff --git a/vendor/github.com/gotk3/gotk3/glib/gvariant.go.h b/vendor/github.com/gotk3/gotk3/glib/gvariant.go.h deleted file mode 100644 index 01d732e..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvariant.go.h +++ /dev/null @@ -1,40 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -//GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -#ifndef __GVARIANT_GO_H__ -#define __GVARIANT_GO_H__ - -#include <stdint.h> -#include <stdlib.h> -#include <stdio.h> -#include <glib.h> - -// Type Casting - -static GVariant * -toGVariant(void *p) -{ - return (GVariant*)p; -} - -static GVariantBuilder * -toGVariantBuilder(void *p) -{ - return (GVariantBuilder*)p; -} - -static GVariantDict * -toGVariantDict(void *p) -{ - return (GVariantDict*)p; -} - -static GVariantIter * -toGVariantIter(void *p) -{ - return (GVariantIter*)p; -} - -#endif diff --git a/vendor/github.com/gotk3/gotk3/glib/gvariant_test.go b/vendor/github.com/gotk3/gotk3/glib/gvariant_test.go deleted file mode 100644 index 796b662..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvariant_test.go +++ /dev/null @@ -1,14 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -package glib_test - -import ( - "testing" -) - -func Test_AcceleratorParse(t *testing.T) { - /* - testVariant := &Variant{} - t.Log("native: " + testVariant.Native()) - */ -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gvariantbuilder.go b/vendor/github.com/gotk3/gotk3/glib/gvariantbuilder.go deleted file mode 100644 index c18e787..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvariantbuilder.go +++ /dev/null @@ -1,52 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -// GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -// #include "gvariant.go.h" -import "C" -import "unsafe" - -/* - * GVariantBuilder - */ - -// VariantBuilder is a representation of GLib's VariantBuilder. -type VariantBuilder struct { - GVariantBuilder *C.GVariantBuilder -} - -func (v *VariantBuilder) toGVariantBuilder() *C.GVariantBuilder { - if v == nil { - return nil - } - return v.native() -} - -func (v *VariantBuilder) toVariantBuilder() *VariantBuilder { - return v -} - -// newVariantBuilder creates a new VariantBuilder from a GVariantBuilder pointer. -func newVariantBuilder(p *C.GVariantBuilder) *VariantBuilder { - return &VariantBuilder{GVariantBuilder: p} -} - -// native returns a pointer to the underlying GVariantBuilder. -func (v *VariantBuilder) native() *C.GVariantBuilder { - if v == nil || v.GVariantBuilder == nil { - return nil - } - p := unsafe.Pointer(v.GVariantBuilder) - return C.toGVariantBuilder(p) -} - -// Native returns a pointer to the underlying GVariantBuilder. -func (v *VariantBuilder) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gvariantclass.go b/vendor/github.com/gotk3/gotk3/glib/gvariantclass.go deleted file mode 100644 index aea0618..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvariantclass.go +++ /dev/null @@ -1,39 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -//GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -// #include "gvariant.go.h" -import "C" - -/* - * GVariantClass - */ - -type VariantClass int - -const ( - VARIANT_CLASS_BOOLEAN VariantClass = C.G_VARIANT_CLASS_BOOLEAN //The GVariant is a boolean. - VARIANT_CLASS_BYTE VariantClass = C.G_VARIANT_CLASS_BYTE //The GVariant is a byte. - VARIANT_CLASS_INT16 VariantClass = C.G_VARIANT_CLASS_INT16 //The GVariant is a signed 16 bit integer. - VARIANT_CLASS_UINT16 VariantClass = C.G_VARIANT_CLASS_UINT16 //The GVariant is an unsigned 16 bit integer. - VARIANT_CLASS_INT32 VariantClass = C.G_VARIANT_CLASS_INT32 //The GVariant is a signed 32 bit integer. - VARIANT_CLASS_UINT32 VariantClass = C.G_VARIANT_CLASS_UINT32 //The GVariant is an unsigned 32 bit integer. - VARIANT_CLASS_INT64 VariantClass = C.G_VARIANT_CLASS_INT64 //The GVariant is a signed 64 bit integer. - VARIANT_CLASS_UINT64 VariantClass = C.G_VARIANT_CLASS_UINT64 //The GVariant is an unsigned 64 bit integer. - VARIANT_CLASS_HANDLE VariantClass = C.G_VARIANT_CLASS_HANDLE //The GVariant is a file handle index. - VARIANT_CLASS_DOUBLE VariantClass = C.G_VARIANT_CLASS_DOUBLE //The GVariant is a double precision floating point value. - VARIANT_CLASS_STRING VariantClass = C.G_VARIANT_CLASS_STRING //The GVariant is a normal string. - VARIANT_CLASS_OBJECT_PATH VariantClass = C.G_VARIANT_CLASS_OBJECT_PATH //The GVariant is a D-Bus object path string. - VARIANT_CLASS_SIGNATURE VariantClass = C.G_VARIANT_CLASS_SIGNATURE //The GVariant is a D-Bus signature string. - VARIANT_CLASS_VARIANT VariantClass = C.G_VARIANT_CLASS_VARIANT //The GVariant is a variant. - VARIANT_CLASS_MAYBE VariantClass = C.G_VARIANT_CLASS_MAYBE //The GVariant is a maybe-typed value. - VARIANT_CLASS_ARRAY VariantClass = C.G_VARIANT_CLASS_ARRAY //The GVariant is an array. - VARIANT_CLASS_TUPLE VariantClass = C.G_VARIANT_CLASS_TUPLE //The GVariant is a tuple. - VARIANT_CLASS_DICT_ENTRY VariantClass = C.G_VARIANT_CLASS_DICT_ENTRY //The GVariant is a dictionary entry. -) diff --git a/vendor/github.com/gotk3/gotk3/glib/gvariantdict.go b/vendor/github.com/gotk3/gotk3/glib/gvariantdict.go deleted file mode 100644 index e682008..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvariantdict.go +++ /dev/null @@ -1,52 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -//GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -// #include "gvariant.go.h" -import "C" -import "unsafe" - -/* - * GVariantDict - */ - -// VariantDict is a representation of GLib's VariantDict. -type VariantDict struct { - GVariantDict *C.GVariantDict -} - -func (v *VariantDict) toGVariantDict() *C.GVariantDict { - if v == nil { - return nil - } - return v.native() -} - -func (v *VariantDict) toVariantDict() *VariantDict { - return v -} - -// newVariantDict creates a new VariantDict from a GVariantDict pointer. -func newVariantDict(p *C.GVariantDict) *VariantDict { - return &VariantDict{GVariantDict: p} -} - -// native returns a pointer to the underlying GVariantDict. -func (v *VariantDict) native() *C.GVariantDict { - if v == nil || v.GVariantDict == nil { - return nil - } - p := unsafe.Pointer(v.GVariantDict) - return C.toGVariantDict(p) -} - -// Native returns a pointer to the underlying GVariantDict. -func (v *VariantDict) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gvariantiter.go b/vendor/github.com/gotk3/gotk3/glib/gvariantiter.go deleted file mode 100644 index 17b55ae..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvariantiter.go +++ /dev/null @@ -1,52 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -//GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -// #include "gvariant.go.h" -import "C" -import "unsafe" - -/* - * GVariantIter - */ - -// VariantIter is a representation of GLib's GVariantIter. -type VariantIter struct { - GVariantIter *C.GVariantIter -} - -func (v *VariantIter) toGVariantIter() *C.GVariantIter { - if v == nil { - return nil - } - return v.native() -} - -func (v *VariantIter) toVariantIter() *VariantIter { - return v -} - -// newVariantIter creates a new VariantIter from a GVariantIter pointer. -func newVariantIter(p *C.GVariantIter) *VariantIter { - return &VariantIter{GVariantIter: p} -} - -// native returns a pointer to the underlying GVariantIter. -func (v *VariantIter) native() *C.GVariantIter { - if v == nil || v.GVariantIter == nil { - return nil - } - p := unsafe.Pointer(v.GVariantIter) - return C.toGVariantIter(p) -} - -// Native returns a pointer to the underlying GVariantIter. -func (v *VariantIter) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/gvarianttype.go b/vendor/github.com/gotk3/gotk3/glib/gvarianttype.go deleted file mode 100644 index 0efe421..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvarianttype.go +++ /dev/null @@ -1,60 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -//GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -package glib - -// #include <glib.h> -// #include "gvarianttype.go.h" -import "C" - -// A VariantType is a wrapper for the GVariantType, which encodes type -// information for GVariants. -type VariantType struct { - GVariantType *C.GVariantType -} - -func (v *VariantType) native() *C.GVariantType { - if v == nil { - return nil - } - return v.GVariantType -} - -// String returns a copy of this VariantType's type string. -func (v *VariantType) String() string { - ch := C.g_variant_type_dup_string(v.native()) - defer C.g_free(C.gpointer(ch)) - return C.GoString((*C.char)(ch)) -} - -func newVariantType(v *C.GVariantType) *VariantType { - return &VariantType{v} -} - -// Variant types for comparing between them. Cannot be const because -// they are pointers. -var ( - VARIANT_TYPE_BOOLEAN = newVariantType(C._G_VARIANT_TYPE_BOOLEAN) - VARIANT_TYPE_BYTE = newVariantType(C._G_VARIANT_TYPE_BYTE) - VARIANT_TYPE_INT16 = newVariantType(C._G_VARIANT_TYPE_INT16) - VARIANT_TYPE_UINT16 = newVariantType(C._G_VARIANT_TYPE_UINT16) - VARIANT_TYPE_INT32 = newVariantType(C._G_VARIANT_TYPE_INT32) - VARIANT_TYPE_UINT32 = newVariantType(C._G_VARIANT_TYPE_UINT32) - VARIANT_TYPE_INT64 = newVariantType(C._G_VARIANT_TYPE_INT64) - VARIANT_TYPE_UINT64 = newVariantType(C._G_VARIANT_TYPE_UINT64) - VARIANT_TYPE_HANDLE = newVariantType(C._G_VARIANT_TYPE_HANDLE) - VARIANT_TYPE_DOUBLE = newVariantType(C._G_VARIANT_TYPE_DOUBLE) - VARIANT_TYPE_STRING = newVariantType(C._G_VARIANT_TYPE_STRING) - VARIANT_TYPE_ANY = newVariantType(C._G_VARIANT_TYPE_ANY) - VARIANT_TYPE_BASIC = newVariantType(C._G_VARIANT_TYPE_BASIC) - VARIANT_TYPE_TUPLE = newVariantType(C._G_VARIANT_TYPE_TUPLE) - VARIANT_TYPE_UNIT = newVariantType(C._G_VARIANT_TYPE_UNIT) - VARIANT_TYPE_DICTIONARY = newVariantType(C._G_VARIANT_TYPE_DICTIONARY) - VARIANT_TYPE_STRING_ARRAY = newVariantType(C._G_VARIANT_TYPE_STRING_ARRAY) - VARIANT_TYPE_OBJECT_PATH_ARRAY = newVariantType(C._G_VARIANT_TYPE_OBJECT_PATH_ARRAY) - VARIANT_TYPE_BYTESTRING = newVariantType(C._G_VARIANT_TYPE_BYTESTRING) - VARIANT_TYPE_BYTESTRING_ARRAY = newVariantType(C._G_VARIANT_TYPE_BYTESTRING_ARRAY) - VARIANT_TYPE_VARDICT = newVariantType(C._G_VARIANT_TYPE_VARDICT) -) diff --git a/vendor/github.com/gotk3/gotk3/glib/gvarianttype.go.h b/vendor/github.com/gotk3/gotk3/glib/gvarianttype.go.h deleted file mode 100644 index a2195de..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/gvarianttype.go.h +++ /dev/null @@ -1,37 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -//GVariant : GVariant — strongly typed value datatype -// https://developer.gnome.org/glib/2.26/glib-GVariant.html - -#ifndef __GVARIANTTYPE_GO_H__ -#define __GVARIANTTYPE_GO_H__ - -const GVariantType* _G_VARIANT_TYPE_BOOLEAN = G_VARIANT_TYPE_BOOLEAN; -const GVariantType* _G_VARIANT_TYPE_BYTE = G_VARIANT_TYPE_BYTE; -const GVariantType* _G_VARIANT_TYPE_INT16 = G_VARIANT_TYPE_INT16; -const GVariantType* _G_VARIANT_TYPE_UINT16 = G_VARIANT_TYPE_UINT16; -const GVariantType* _G_VARIANT_TYPE_INT32 = G_VARIANT_TYPE_INT32; -const GVariantType* _G_VARIANT_TYPE_UINT32 = G_VARIANT_TYPE_UINT32; -const GVariantType* _G_VARIANT_TYPE_INT64 = G_VARIANT_TYPE_INT64; -const GVariantType* _G_VARIANT_TYPE_UINT64 = G_VARIANT_TYPE_UINT64; -const GVariantType* _G_VARIANT_TYPE_HANDLE = G_VARIANT_TYPE_HANDLE; -const GVariantType* _G_VARIANT_TYPE_DOUBLE = G_VARIANT_TYPE_DOUBLE; -const GVariantType* _G_VARIANT_TYPE_STRING = G_VARIANT_TYPE_STRING; -const GVariantType* _G_VARIANT_TYPE_OBJECT_PATH = G_VARIANT_TYPE_OBJECT_PATH; -const GVariantType* _G_VARIANT_TYPE_SIGNATURE = G_VARIANT_TYPE_SIGNATURE; -const GVariantType* _G_VARIANT_TYPE_VARIANT = G_VARIANT_TYPE_VARIANT; -const GVariantType* _G_VARIANT_TYPE_ANY = G_VARIANT_TYPE_ANY; -const GVariantType* _G_VARIANT_TYPE_BASIC = G_VARIANT_TYPE_BASIC; -const GVariantType* _G_VARIANT_TYPE_MAYBE = G_VARIANT_TYPE_MAYBE; -const GVariantType* _G_VARIANT_TYPE_ARRAY = G_VARIANT_TYPE_ARRAY; -const GVariantType* _G_VARIANT_TYPE_TUPLE = G_VARIANT_TYPE_TUPLE; -const GVariantType* _G_VARIANT_TYPE_UNIT = G_VARIANT_TYPE_UNIT; -const GVariantType* _G_VARIANT_TYPE_DICT_ENTRY = G_VARIANT_TYPE_DICT_ENTRY; -const GVariantType* _G_VARIANT_TYPE_DICTIONARY = G_VARIANT_TYPE_DICTIONARY; -const GVariantType* _G_VARIANT_TYPE_STRING_ARRAY = G_VARIANT_TYPE_STRING_ARRAY; -const GVariantType* _G_VARIANT_TYPE_OBJECT_PATH_ARRAY = G_VARIANT_TYPE_OBJECT_PATH_ARRAY; -const GVariantType* _G_VARIANT_TYPE_BYTESTRING = G_VARIANT_TYPE_BYTESTRING; -const GVariantType* _G_VARIANT_TYPE_BYTESTRING_ARRAY = G_VARIANT_TYPE_BYTESTRING_ARRAY; -const GVariantType* _G_VARIANT_TYPE_VARDICT = G_VARIANT_TYPE_VARDICT; - -#endif diff --git a/vendor/github.com/gotk3/gotk3/glib/list.go b/vendor/github.com/gotk3/gotk3/glib/list.go deleted file mode 100644 index 250e426..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/list.go +++ /dev/null @@ -1,155 +0,0 @@ -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -/* - * Linked Lists - */ - -// List is a representation of Glib's GList. -type List struct { - list *C.struct__GList - // If set, dataWrap is called every time NthDataWrapped() - // or DataWrapped() is called to wrap raw underlying - // value into appropriate type. - dataWrap func(unsafe.Pointer) interface{} -} - -func WrapList(obj uintptr) *List { - return wrapList((*C.struct__GList)(unsafe.Pointer(obj))) -} - -func wrapList(obj *C.struct__GList) *List { - if obj == nil { - return nil - } - return &List{list: obj} -} - -func (v *List) wrapNewHead(obj *C.struct__GList) *List { - if obj == nil { - return nil - } - return &List{ - list: obj, - dataWrap: v.dataWrap, - } -} - -func (v *List) Native() uintptr { - return uintptr(unsafe.Pointer(v.list)) -} - -func (v *List) native() *C.struct__GList { - if v == nil || v.list == nil { - return nil - } - return v.list -} - -// DataWapper sets wrap functions, which is called during NthDataWrapped() -// and DataWrapped(). It's used to cast raw C data into appropriate -// Go structures and types every time that data is retreived. -func (v *List) DataWrapper(fn func(unsafe.Pointer) interface{}) { - if v == nil { - return - } - v.dataWrap = fn -} - -// Append is a wrapper around g_list_append(). -func (v *List) Append(data uintptr) *List { - glist := C.g_list_append(v.native(), C.gpointer(data)) - return v.wrapNewHead(glist) -} - -// Prepend is a wrapper around g_list_prepend(). -func (v *List) Prepend(data uintptr) *List { - glist := C.g_list_prepend(v.native(), C.gpointer(data)) - return v.wrapNewHead(glist) -} - -// Insert is a wrapper around g_list_insert(). -func (v *List) Insert(data uintptr, position int) *List { - glist := C.g_list_insert(v.native(), C.gpointer(data), C.gint(position)) - return v.wrapNewHead(glist) -} - -// Length is a wrapper around g_list_length(). -func (v *List) Length() uint { - return uint(C.g_list_length(v.native())) -} - -// nthDataRaw is a wrapper around g_list_nth_data(). -func (v *List) nthDataRaw(n uint) unsafe.Pointer { - return unsafe.Pointer(C.g_list_nth_data(v.native(), C.guint(n))) -} - -// Nth() is a wrapper around g_list_nth(). -func (v *List) Nth(n uint) *List { - list := wrapList(C.g_list_nth(v.native(), C.guint(n))) - list.DataWrapper(v.dataWrap) - return list -} - -// NthDataWrapped acts the same as g_list_nth_data(), but passes -// retrieved value before returning through wrap function, set by DataWrapper(). -// If no wrap function is set, it returns raw unsafe.Pointer. -func (v *List) NthData(n uint) interface{} { - ptr := v.nthDataRaw(n) - if v.dataWrap != nil { - return v.dataWrap(ptr) - } - return ptr -} - -// Free is a wrapper around g_list_free(). -func (v *List) Free() { - C.g_list_free(v.native()) -} - -// Next is a wrapper around the next struct field -func (v *List) Next() *List { - return v.wrapNewHead(v.native().next) -} - -// Previous is a wrapper around the prev struct field -func (v *List) Previous() *List { - return v.wrapNewHead(v.native().prev) -} - -// dataRaw is a wrapper around the data struct field -func (v *List) dataRaw() unsafe.Pointer { - return unsafe.Pointer(v.native().data) -} - -// DataWrapped acts the same as data struct field, but passes -// retrieved value before returning through wrap function, set by DataWrapper(). -// If no wrap function is set, it returns raw unsafe.Pointer. -func (v *List) Data() interface{} { - ptr := v.dataRaw() - if v.dataWrap != nil { - return v.dataWrap(ptr) - } - return ptr -} - -// Foreach acts the same as g_list_foreach(). -// No user_data argument is implemented because of Go clojure capabilities. -func (v *List) Foreach(fn func(item interface{})) { - for l := v; l != nil; l = l.Next() { - fn(l.Data()) - } -} - -// FreeFull acts the same as g_list_free_full(). -// Calling list.FreeFull(fn) is equivalent to calling list.Foreach(fn) and -// list.Free() sequentially. -func (v *List) FreeFull(fn func(item interface{})) { - v.Foreach(fn) - v.Free() -} diff --git a/vendor/github.com/gotk3/gotk3/glib/list_test.go b/vendor/github.com/gotk3/gotk3/glib/list_test.go deleted file mode 100644 index 66e3693..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/list_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package glib - -import ( - "fmt" - "testing" - "unsafe" -) - -func TestList_Basics(t *testing.T) { - list := (&List{}).Append(0).Append(1).Append(2) - if list.Length() != 3 { - t.Errorf("Length of list with 3 appended elements must be 3. (Got %v).", list.Length()) - } - - list = (&List{}).Prepend(0).Prepend(1).Prepend(2) - if list.Length() != 3 { - t.Errorf("Length of list with 3 prepended elements must be 3. (Got %v).", list.Length()) - } - - list = (&List{}).Insert(0, 0).Insert(1, 0).Insert(2, 0) - if list.Length() != 3 { - t.Errorf("Length of list with 3 inserted elements must be 3. (Got %v).", list.Length()) - } -} - -func TestList_DataWrapper(t *testing.T) { - list := (&List{}).Append(0).Append(1).Append(2) - list.DataWrapper(func(ptr unsafe.Pointer) interface{} { - return fmt.Sprintf("Value %v", uintptr(ptr)) - }) - - i := 0 - for l := list; l != nil; l = l.Next() { - expect := fmt.Sprintf("Value %v", i) - i++ - actual, ok := l.Data().(string) - if !ok { - t.Error("DataWrapper must have returned a string!") - } - if actual != expect { - t.Errorf("DataWrapper returned unexpected result. Expected '%v', got '%v'.", expect, actual) - } - } -} - -func TestList_Foreach(t *testing.T) { - list := (&List{}).Append(0).Append(1).Append(2) - list.DataWrapper(func(ptr unsafe.Pointer) interface{} { - return int(uintptr(ptr) + 1) - }) - - sum := 0 - list.Foreach(func(item interface{}) { - sum += item.(int) - }) - - if sum != 6 { - t.Errorf("Foreach resulted into wrong sum. Got %v, expected %v.", sum, 6) - } -} - -func TestList_Nth(t *testing.T) { - list := (&List{}).Append(0).Append(1).Append(2) - list.DataWrapper(func(ptr unsafe.Pointer) interface{} { - return int(uintptr(ptr) + 1) - }) - - for i := uint(0); i < 3; i++ { - nth := list.Nth(i).Data().(int) - nthData := list.NthData(i).(int) - - if nth != nthData { - t.Errorf("%v's element didn't match. Nth->Data returned %v; NthData returned %v.", i, nth, nthData) - } - } -} diff --git a/vendor/github.com/gotk3/gotk3/glib/menu.go b/vendor/github.com/gotk3/gotk3/glib/menu.go deleted file mode 100644 index ce9d268..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/menu.go +++ /dev/null @@ -1,350 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// MenuModel is a representation of GMenuModel. -type MenuModel struct { - *Object -} - -// native() returns a pointer to the underlying GMenuModel. -func (v *MenuModel) native() *C.GMenuModel { - if v == nil || v.GObject == nil { - return nil - } - return C.toGMenuModel(unsafe.Pointer(v.GObject)) -} - -func (v *MenuModel) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalMenuModel(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapMenuModel(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapMenuModel(obj *Object) *MenuModel { - return &MenuModel{obj} -} - -// IsMutable is a wrapper around g_menu_model_is_mutable(). -func (v *MenuModel) IsMutable() bool { - return gobool(C.g_menu_model_is_mutable(v.native())) -} - -// GetNItems is a wrapper around g_menu_model_get_n_items(). -func (v *MenuModel) GetNItems() int { - return int(C.g_menu_model_get_n_items(v.native())) -} - -// GetItemLink is a wrapper around g_menu_model_get_item_link(). -func (v *MenuModel) GetItemLink(index int, link string) *MenuModel { - cstr := (*C.gchar)(C.CString(link)) - defer C.free(unsafe.Pointer(cstr)) - c := C.g_menu_model_get_item_link(v.native(), C.gint(index), cstr) - if c == nil { - return nil - } - return wrapMenuModel(wrapObject(unsafe.Pointer(c))) -} - -// ItemsChanged is a wrapper around g_menu_model_items_changed(). -func (v *MenuModel) ItemsChanged(position, removed, added int) { - C.g_menu_model_items_changed(v.native(), C.gint(position), C.gint(removed), C.gint(added)) -} - -// GVariant * g_menu_model_get_item_attribute_value () -// gboolean g_menu_model_get_item_attribute () -// GMenuAttributeIter * g_menu_model_iterate_item_attributes () -// GMenuLinkIter * g_menu_model_iterate_item_links () - -// Menu is a representation of GMenu. -type Menu struct { - MenuModel -} - -// native() returns a pointer to the underlying GMenu. -func (m *Menu) native() *C.GMenu { - if m == nil || m.GObject == nil { - return nil - } - p := unsafe.Pointer(m.GObject) - return C.toGMenu(p) -} - -func marshalMenu(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapMenu(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapMenu(obj *Object) *Menu { - return &Menu{MenuModel{obj}} -} - -// MenuNew is a wrapper around g_menu_new(). -func MenuNew() *Menu { - c := C.g_menu_new() - if c == nil { - return nil - } - return wrapMenu(wrapObject(unsafe.Pointer(c))) -} - -// Freeze is a wrapper around g_menu_freeze(). -func (v *Menu) Freeze() { - C.g_menu_freeze(v.native()) -} - -// Insert is a wrapper around g_menu_insert(). -func (v *Menu) Insert(position int, label, detailed_action string) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(detailed_action)) - defer C.free(unsafe.Pointer(cstr2)) - - C.g_menu_insert(v.native(), C.gint(position), cstr1, cstr2) -} - -// Prepend is a wrapper around g_menu_prepend(). -func (v *Menu) Prepend(label, detailed_action string) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(detailed_action)) - defer C.free(unsafe.Pointer(cstr2)) - - C.g_menu_prepend(v.native(), cstr1, cstr2) -} - -// Append is a wrapper around g_menu_append(). -func (v *Menu) Append(label, detailed_action string) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(detailed_action)) - defer C.free(unsafe.Pointer(cstr2)) - - C.g_menu_append(v.native(), cstr1, cstr2) -} - -// InsertItem is a wrapper around g_menu_insert_item(). -func (v *Menu) InsertItem(position int, item *MenuItem) { - C.g_menu_insert_item(v.native(), C.gint(position), item.native()) -} - -// AppendItem is a wrapper around g_menu_append_item(). -func (v *Menu) AppendItem(item *MenuItem) { - C.g_menu_append_item(v.native(), item.native()) -} - -// PrependItem is a wrapper around g_menu_prepend_item(). -func (v *Menu) PrependItem(item *MenuItem) { - C.g_menu_prepend_item(v.native(), item.native()) -} - -// InsertSection is a wrapper around g_menu_insert_section(). -func (v *Menu) InsertSection(position int, label string, section *MenuModel) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_insert_section(v.native(), C.gint(position), cstr1, section.native()) -} - -// PrependSection is a wrapper around g_menu_prepend_section(). -func (v *Menu) PrependSection(label string, section *MenuModel) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_prepend_section(v.native(), cstr1, section.native()) -} - -// AppendSection is a wrapper around g_menu_append_section(). -func (v *Menu) AppendSection(label string, section *MenuModel) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_append_section(v.native(), cstr1, section.native()) -} - -// InsertSectionWithoutLabel is a wrapper around g_menu_insert_section() -// with label set to null. -func (v *Menu) InsertSectionWithoutLabel(position int, section *MenuModel) { - C.g_menu_insert_section(v.native(), C.gint(position), nil, section.native()) -} - -// PrependSectionWithoutLabel is a wrapper around -// g_menu_prepend_section() with label set to null. -func (v *Menu) PrependSectionWithoutLabel(section *MenuModel) { - C.g_menu_prepend_section(v.native(), nil, section.native()) -} - -// AppendSectionWithoutLabel is a wrapper around g_menu_append_section() -// with label set to null. -func (v *Menu) AppendSectionWithoutLabel(section *MenuModel) { - C.g_menu_append_section(v.native(), nil, section.native()) -} - -// InsertSubmenu is a wrapper around g_menu_insert_submenu(). -func (v *Menu) InsertSubmenu(position int, label string, submenu *MenuModel) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_insert_submenu(v.native(), C.gint(position), cstr1, submenu.native()) -} - -// PrependSubmenu is a wrapper around g_menu_prepend_submenu(). -func (v *Menu) PrependSubmenu(label string, submenu *MenuModel) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_prepend_submenu(v.native(), cstr1, submenu.native()) -} - -// AppendSubmenu is a wrapper around g_menu_append_submenu(). -func (v *Menu) AppendSubmenu(label string, submenu *MenuModel) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_append_submenu(v.native(), cstr1, submenu.native()) -} - -// Remove is a wrapper around g_menu_remove(). -func (v *Menu) Remove(position int) { - C.g_menu_remove(v.native(), C.gint(position)) -} - -// RemoveAll is a wrapper around g_menu_remove_all(). -func (v *Menu) RemoveAll() { - C.g_menu_remove_all(v.native()) -} - -// MenuItem is a representation of GMenuItem. -type MenuItem struct { - *Object -} - -// native() returns a pointer to the underlying GMenuItem. -func (m *MenuItem) native() *C.GMenuItem { - if m == nil || m.GObject == nil { - return nil - } - p := unsafe.Pointer(m.GObject) - return C.toGMenuItem(p) -} - -func marshalMenuItem(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapMenuItem(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapMenuItem(obj *Object) *MenuItem { - return &MenuItem{obj} -} - -// MenuItemNew is a wrapper around g_menu_item_new(). -func MenuItemNew(label, detailed_action string) *MenuItem { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(detailed_action)) - defer C.free(unsafe.Pointer(cstr2)) - - c := C.g_menu_item_new(cstr1, cstr2) - if c == nil { - return nil - } - return wrapMenuItem(wrapObject(unsafe.Pointer(c))) -} - -// MenuItemNewSection is a wrapper around g_menu_item_new_section(). -func MenuItemNewSection(label string, section *MenuModel) *MenuItem { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - c := C.g_menu_item_new_section(cstr1, section.native()) - if c == nil { - return nil - } - return wrapMenuItem(wrapObject(unsafe.Pointer(c))) -} - -// MenuItemNewSubmenu is a wrapper around g_menu_item_new_submenu(). -func MenuItemNewSubmenu(label string, submenu *MenuModel) *MenuItem { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - c := C.g_menu_item_new_submenu(cstr1, submenu.native()) - if c == nil { - return nil - } - return wrapMenuItem(wrapObject(unsafe.Pointer(c))) -} - -// MenuItemNewFromModel is a wrapper around g_menu_item_new_from_model(). -func MenuItemNewFromModel(model *MenuModel, index int) *MenuItem { - c := C.g_menu_item_new_from_model(model.native(), C.gint(index)) - if c == nil { - return nil - } - return wrapMenuItem(wrapObject(unsafe.Pointer(c))) -} - -//SetLabel is a wrapper around g_menu_item_set_label(). -func (v *MenuItem) SetLabel(label string) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_item_set_label(v.native(), cstr1) -} - -//SetDetailedAction is a wrapper around g_menu_item_set_detailed_action(). -func (v *MenuItem) SetDetailedAction(act string) { - cstr1 := (*C.gchar)(C.CString(act)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_item_set_detailed_action(v.native(), cstr1) -} - -//SetSection is a wrapper around g_menu_item_set_section(). -func (v *MenuItem) SetSection(section *MenuModel) { - C.g_menu_item_set_section(v.native(), section.native()) -} - -//SetSubmenu is a wrapper around g_menu_item_set_submenu(). -func (v *MenuItem) SetSubmenu(submenu *MenuModel) { - C.g_menu_item_set_submenu(v.native(), submenu.native()) -} - -//GetLink is a wrapper around g_menu_item_get_link(). -func (v *MenuItem) GetLink(link string) *MenuModel { - cstr1 := (*C.gchar)(C.CString(link)) - defer C.free(unsafe.Pointer(cstr1)) - - c := C.g_menu_item_get_link(v.native(), cstr1) - if c == nil { - return nil - } - return wrapMenuModel(wrapObject(unsafe.Pointer(c))) -} - -//SetLink is a wrapper around g_menu_item_Set_link(). -func (v *MenuItem) SetLink(link string, model *MenuModel) { - cstr1 := (*C.gchar)(C.CString(link)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_menu_item_set_link(v.native(), cstr1, model.native()) -} - -// void g_menu_item_set_action_and_target_value () -// void g_menu_item_set_action_and_target () -// GVariant * g_menu_item_get_attribute_value () -// gboolean g_menu_item_get_attribute () -// void g_menu_item_set_attribute_value () -// void g_menu_item_set_attribute () diff --git a/vendor/github.com/gotk3/gotk3/glib/notifications.go b/vendor/github.com/gotk3/gotk3/glib/notifications.go deleted file mode 100644 index 9f1ec6a..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/notifications.go +++ /dev/null @@ -1,105 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// Only available from 2.42 -// // NotificationPriority is a representation of GLib's GNotificationPriority. -// type NotificationPriority int - -// const ( -// NOTIFICATION_PRIORITY_NORMAL NotificationPriority = C.G_NOTIFICATION_PRIORITY_NORMAL -// NOTIFICATION_PRIORITY_LOW NotificationPriority = C.G_NOTIFICATION_PRIORITY_LOW -// NOTIFICATION_PRIORITY_HIGH NotificationPriority = C.G_NOTIFICATION_PRIORITY_HIGH -// NOTIFICATION_PRIORITY_URGENT NotificationPriority = C.G_NOTIFICATION_PRIORITY_URGENT -// ) - -// Notification is a representation of GNotification. -type Notification struct { - *Object -} - -// native() returns a pointer to the underlying GNotification. -func (v *Notification) native() *C.GNotification { - if v == nil || v.GObject == nil { - return nil - } - return C.toGNotification(unsafe.Pointer(v.GObject)) -} - -func (v *Notification) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalNotification(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapNotification(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapNotification(obj *Object) *Notification { - return &Notification{obj} -} - -// NotificationNew is a wrapper around g_notification_new(). -func NotificationNew(title string) *Notification { - cstr1 := (*C.gchar)(C.CString(title)) - defer C.free(unsafe.Pointer(cstr1)) - - c := C.g_notification_new(cstr1) - if c == nil { - return nil - } - return wrapNotification(wrapObject(unsafe.Pointer(c))) -} - -// SetTitle is a wrapper around g_notification_set_title(). -func (v *Notification) SetTitle(title string) { - cstr1 := (*C.gchar)(C.CString(title)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_notification_set_title(v.native(), cstr1) -} - -// SetBody is a wrapper around g_notification_set_body(). -func (v *Notification) SetBody(body string) { - cstr1 := (*C.gchar)(C.CString(body)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_notification_set_body(v.native(), cstr1) -} - -// Only available from 2.42 -// // SetPriority is a wrapper around g_notification_set_priority(). -// func (v *Notification) SetPriority(prio NotificationPriority) { -// C.g_notification_set_priority(v.native(), C.GNotificationPriority(prio)) -// } - -// SetDefaultAction is a wrapper around g_notification_set_default_action(). -func (v *Notification) SetDefaultAction(detailedAction string) { - cstr1 := (*C.gchar)(C.CString(detailedAction)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_notification_set_default_action(v.native(), cstr1) -} - -// AddButton is a wrapper around g_notification_add_button(). -func (v *Notification) AddButton(label, detailedAction string) { - cstr1 := (*C.gchar)(C.CString(label)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(detailedAction)) - defer C.free(unsafe.Pointer(cstr2)) - - C.g_notification_add_button(v.native(), cstr1, cstr2) -} - -// void g_notification_set_default_action_and_target () // requires varargs -// void g_notification_set_default_action_and_target_value () // requires variant -// void g_notification_add_button_with_target () // requires varargs -// void g_notification_add_button_with_target_value () //requires variant -// void g_notification_set_urgent () // Deprecated, so not implemented -// void g_notification_set_icon () // Requires support for GIcon, which we don't have yet. diff --git a/vendor/github.com/gotk3/gotk3/glib/settings.go b/vendor/github.com/gotk3/gotk3/glib/settings.go deleted file mode 100644 index 1bca146..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/settings.go +++ /dev/null @@ -1,304 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// Settings is a representation of GSettings. -type Settings struct { - *Object -} - -// native() returns a pointer to the underlying GSettings. -func (v *Settings) native() *C.GSettings { - if v == nil || v.GObject == nil { - return nil - } - return C.toGSettings(unsafe.Pointer(v.GObject)) -} - -func (v *Settings) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalSettings(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapSettings(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapSettings(obj *Object) *Settings { - return &Settings{obj} -} - -func wrapFullSettings(obj *C.GSettings) *Settings { - if obj == nil { - return nil - } - return wrapSettings(wrapObject(unsafe.Pointer(obj))) -} - -// SettingsNew is a wrapper around g_settings_new(). -func SettingsNew(schemaID string) *Settings { - cstr := (*C.gchar)(C.CString(schemaID)) - defer C.free(unsafe.Pointer(cstr)) - - return wrapFullSettings(C.g_settings_new(cstr)) -} - -// SettingsNewWithPath is a wrapper around g_settings_new_with_path(). -func SettingsNewWithPath(schemaID, path string) *Settings { - cstr1 := (*C.gchar)(C.CString(schemaID)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(path)) - defer C.free(unsafe.Pointer(cstr2)) - - return wrapFullSettings(C.g_settings_new_with_path(cstr1, cstr2)) -} - -// SettingsNewWithBackend is a wrapper around g_settings_new_with_backend(). -func SettingsNewWithBackend(schemaID string, backend *SettingsBackend) *Settings { - cstr1 := (*C.gchar)(C.CString(schemaID)) - defer C.free(unsafe.Pointer(cstr1)) - - return wrapFullSettings(C.g_settings_new_with_backend(cstr1, backend.native())) -} - -// SettingsNewWithBackendAndPath is a wrapper around g_settings_new_with_backend_and_path(). -func SettingsNewWithBackendAndPath(schemaID string, backend *SettingsBackend, path string) *Settings { - cstr1 := (*C.gchar)(C.CString(schemaID)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(path)) - defer C.free(unsafe.Pointer(cstr2)) - - return wrapFullSettings(C.g_settings_new_with_backend_and_path(cstr1, backend.native(), cstr2)) -} - -// SettingsNewFull is a wrapper around g_settings_new_full(). -func SettingsNewFull(schema *SettingsSchema, backend *SettingsBackend, path string) *Settings { - cstr1 := (*C.gchar)(C.CString(path)) - defer C.free(unsafe.Pointer(cstr1)) - - return wrapFullSettings(C.g_settings_new_full(schema.native(), backend.native(), cstr1)) -} - -// SettingsSync is a wrapper around g_settings_sync(). -func SettingsSync() { - C.g_settings_sync() -} - -// IsWritable is a wrapper around g_settings_is_writable(). -func (v *Settings) IsWritable(name string) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_is_writable(v.native(), cstr1)) -} - -// Delay is a wrapper around g_settings_delay(). -func (v *Settings) Delay() { - C.g_settings_delay(v.native()) -} - -// Apply is a wrapper around g_settings_apply(). -func (v *Settings) Apply() { - C.g_settings_apply(v.native()) -} - -// Revert is a wrapper around g_settings_revert(). -func (v *Settings) Revert() { - C.g_settings_revert(v.native()) -} - -// GetHasUnapplied is a wrapper around g_settings_get_has_unapplied(). -func (v *Settings) GetHasUnapplied() bool { - return gobool(C.g_settings_get_has_unapplied(v.native())) -} - -// GetChild is a wrapper around g_settings_get_child(). -func (v *Settings) GetChild(name string) *Settings { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return wrapFullSettings(C.g_settings_get_child(v.native(), cstr1)) -} - -// Reset is a wrapper around g_settings_reset(). -func (v *Settings) Reset(name string) { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - C.g_settings_reset(v.native(), cstr1) -} - -// ListChildren is a wrapper around g_settings_list_children(). -func (v *Settings) ListChildren() []string { - return toGoStringArray(C.g_settings_list_children(v.native())) -} - -// GetBoolean is a wrapper around g_settings_get_boolean(). -func (v *Settings) GetBoolean(name string) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_get_boolean(v.native(), cstr1)) -} - -// SetBoolean is a wrapper around g_settings_set_boolean(). -func (v *Settings) SetBoolean(name string, value bool) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_set_boolean(v.native(), cstr1, gbool(value))) -} - -// GetInt is a wrapper around g_settings_get_int(). -func (v *Settings) GetInt(name string) int { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return int(C.g_settings_get_int(v.native(), cstr1)) -} - -// SetInt is a wrapper around g_settings_set_int(). -func (v *Settings) SetInt(name string, value int) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_set_int(v.native(), cstr1, C.gint(value))) -} - -// GetUInt is a wrapper around g_settings_get_uint(). -func (v *Settings) GetUInt(name string) uint { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return uint(C.g_settings_get_uint(v.native(), cstr1)) -} - -// SetUInt is a wrapper around g_settings_set_uint(). -func (v *Settings) SetUInt(name string, value uint) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_set_uint(v.native(), cstr1, C.guint(value))) -} - -// GetDouble is a wrapper around g_settings_get_double(). -func (v *Settings) GetDouble(name string) float64 { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return float64(C.g_settings_get_double(v.native(), cstr1)) -} - -// SetDouble is a wrapper around g_settings_set_double(). -func (v *Settings) SetDouble(name string, value float64) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_set_double(v.native(), cstr1, C.gdouble(value))) -} - -// GetString is a wrapper around g_settings_get_string(). -func (v *Settings) GetString(name string) string { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return C.GoString((*C.char)(C.g_settings_get_string(v.native(), cstr1))) -} - -// SetString is a wrapper around g_settings_set_string(). -func (v *Settings) SetString(name string, value string) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(value)) - defer C.free(unsafe.Pointer(cstr2)) - - return gobool(C.g_settings_set_string(v.native(), cstr1, cstr2)) -} - -// GetEnum is a wrapper around g_settings_get_enum(). -func (v *Settings) GetEnum(name string) int { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return int(C.g_settings_get_enum(v.native(), cstr1)) -} - -// GetStrv is a wrapper around g_settings_get_strv(). -func (v *Settings) GetStrv(name string) []string { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - return toGoStringArray(C.g_settings_get_strv(v.native(), cstr1)) -} - -// SetStrv is a wrapper around g_settings_set_strv(). -func (v *Settings) SetStrv(name string, values []string) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - cvalues := make([]*C.gchar, len(values)) - for i, accel := range values { - cvalues[i] = (*C.gchar)(C.CString(accel)) - defer C.free(unsafe.Pointer(cvalues[i])) - } - cvalues = append(cvalues, nil) - - return gobool(C.g_settings_set_strv(v.native(), cstr1, &cvalues[0])) -} - -// SetEnum is a wrapper around g_settings_set_enum(). -func (v *Settings) SetEnum(name string, value int) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_set_enum(v.native(), cstr1, C.gint(value))) -} - -// GetFlags is a wrapper around g_settings_get_flags(). -func (v *Settings) GetFlags(name string) uint { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return uint(C.g_settings_get_flags(v.native(), cstr1)) -} - -// SetFlags is a wrapper around g_settings_set_flags(). -func (v *Settings) SetFlags(name string, value uint) bool { - cstr1 := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr1)) - - return gobool(C.g_settings_set_flags(v.native(), cstr1, C.guint(value))) -} - -func (v *Settings) GetValue(name string) *Variant { - cstr := (*C.gchar)(C.CString(name)) - defer C.free(unsafe.Pointer(cstr)) - return newVariant(C.g_settings_get_value(v.native(), cstr)) -} - -// GVariant * g_settings_get_value () -// gboolean g_settings_set_value () -// GVariant * g_settings_get_user_value () -// GVariant * g_settings_get_default_value () -// const gchar * const * g_settings_list_schemas () -// const gchar * const * g_settings_list_relocatable_schemas () -// gchar ** g_settings_list_keys () -// GVariant * g_settings_get_range () -// gboolean g_settings_range_check () -// void g_settings_get () -// gboolean g_settings_set () -// gpointer g_settings_get_mapped () -// void g_settings_bind () -// void g_settings_bind_with_mapping () -// void g_settings_bind_writable () -// void g_settings_unbind () -// gaction * g_settings_create_action () -// gchar ** g_settings_get_strv () -// gboolean g_settings_set_strv () diff --git a/vendor/github.com/gotk3/gotk3/glib/settings_backend.go b/vendor/github.com/gotk3/gotk3/glib/settings_backend.go deleted file mode 100644 index 3579ee4..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/settings_backend.go +++ /dev/null @@ -1,70 +0,0 @@ -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// SettingsBackend is a representation of GSettingsBackend. -type SettingsBackend struct { - *Object -} - -// native() returns a pointer to the underlying GSettingsBackend. -func (v *SettingsBackend) native() *C.GSettingsBackend { - if v == nil || v.GObject == nil { - return nil - } - return C.toGSettingsBackend(unsafe.Pointer(v.GObject)) -} - -func (v *SettingsBackend) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func marshalSettingsBackend(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapSettingsBackend(wrapObject(unsafe.Pointer(c))), nil -} - -func wrapSettingsBackend(obj *Object) *SettingsBackend { - return &SettingsBackend{obj} -} - -// SettingsBackendGetDefault is a wrapper around g_settings_backend_get_default(). -func SettingsBackendGetDefault() *SettingsBackend { - return wrapSettingsBackend(wrapObject(unsafe.Pointer(C.g_settings_backend_get_default()))) -} - -// KeyfileSettingsBackendNew is a wrapper around g_keyfile_settings_backend_new(). -func KeyfileSettingsBackendNew(filename, rootPath, rootGroup string) *SettingsBackend { - cstr1 := (*C.gchar)(C.CString(filename)) - defer C.free(unsafe.Pointer(cstr1)) - - cstr2 := (*C.gchar)(C.CString(rootPath)) - defer C.free(unsafe.Pointer(cstr2)) - - cstr3 := (*C.gchar)(C.CString(rootGroup)) - defer C.free(unsafe.Pointer(cstr3)) - - return wrapSettingsBackend(wrapObject(unsafe.Pointer(C.g_keyfile_settings_backend_new(cstr1, cstr2, cstr3)))) -} - -// MemorySettingsBackendNew is a wrapper around g_memory_settings_backend_new(). -func MemorySettingsBackendNew() *SettingsBackend { - return wrapSettingsBackend(wrapObject(unsafe.Pointer(C.g_memory_settings_backend_new()))) -} - -// NullSettingsBackendNew is a wrapper around g_null_settings_backend_new(). -func NullSettingsBackendNew() *SettingsBackend { - return wrapSettingsBackend(wrapObject(unsafe.Pointer(C.g_null_settings_backend_new()))) -} - -// void g_settings_backend_changed () -// void g_settings_backend_path_changed () -// void g_settings_backend_keys_changed () -// void g_settings_backend_path_writable_changed () -// void g_settings_backend_writable_changed () -// void g_settings_backend_changed_tree () -// void g_settings_backend_flatten_tree () diff --git a/vendor/github.com/gotk3/gotk3/glib/settings_schema.go b/vendor/github.com/gotk3/gotk3/glib/settings_schema.go deleted file mode 100644 index 41839b1..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/settings_schema.go +++ /dev/null @@ -1,95 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// SettingsSchema is a representation of GSettingsSchema. -type SettingsSchema struct { - schema *C.GSettingsSchema -} - -func wrapSettingsSchema(obj *C.GSettingsSchema) *SettingsSchema { - if obj == nil { - return nil - } - return &SettingsSchema{obj} -} - -func (v *SettingsSchema) Native() uintptr { - return uintptr(unsafe.Pointer(v.schema)) -} - -func (v *SettingsSchema) native() *C.GSettingsSchema { - if v == nil || v.schema == nil { - return nil - } - return v.schema -} - -// Ref() is a wrapper around g_settings_schema_ref(). -func (v *SettingsSchema) Ref() *SettingsSchema { - return wrapSettingsSchema(C.g_settings_schema_ref(v.native())) -} - -// Unref() is a wrapper around g_settings_schema_unref(). -func (v *SettingsSchema) Unref() { - C.g_settings_schema_unref(v.native()) -} - -// GetID() is a wrapper around g_settings_schema_get_id(). -func (v *SettingsSchema) GetID() string { - return C.GoString((*C.char)(C.g_settings_schema_get_id(v.native()))) -} - -// GetPath() is a wrapper around g_settings_schema_get_path(). -func (v *SettingsSchema) GetPath() string { - return C.GoString((*C.char)(C.g_settings_schema_get_path(v.native()))) -} - -// HasKey() is a wrapper around g_settings_schema_has_key(). -func (v *SettingsSchema) HasKey(v1 string) bool { - cstr := (*C.gchar)(C.CString(v1)) - defer C.free(unsafe.Pointer(cstr)) - - return gobool(C.g_settings_schema_has_key(v.native(), cstr)) -} - -func toGoStringArray(c **C.gchar) []string { - var strs []string - originalc := c - defer C.g_strfreev(originalc) - - for *c != nil { - strs = append(strs, C.GoString((*C.char)(*c))) - c = C.next_gcharptr(c) - } - - return strs - -} - -// // ListChildren() is a wrapper around g_settings_schema_list_children(). -// func (v *SettingsSchema) ListChildren() []string { -// return toGoStringArray(C.g_settings_schema_list_children(v.native())) -// } - -// // ListKeys() is a wrapper around g_settings_schema_list_keys(). -// func (v *SettingsSchema) ListKeys() []string { -// return toGoStringArray(C.g_settings_schema_list_keys(v.native())) -// } - -// const GVariantType * g_settings_schema_key_get_value_type () -// GVariant * g_settings_schema_key_get_default_value () -// GVariant * g_settings_schema_key_get_range () -// gboolean g_settings_schema_key_range_check () -// const gchar * g_settings_schema_key_get_name () -// const gchar * g_settings_schema_key_get_summary () -// const gchar * g_settings_schema_key_get_description () - -// GSettingsSchemaKey * g_settings_schema_get_key () -// GSettingsSchemaKey * g_settings_schema_key_ref () -// void g_settings_schema_key_unref () diff --git a/vendor/github.com/gotk3/gotk3/glib/settings_schema_source.go b/vendor/github.com/gotk3/gotk3/glib/settings_schema_source.go deleted file mode 100644 index a66a4c1..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/settings_schema_source.go +++ /dev/null @@ -1,69 +0,0 @@ -package glib - -// #include <gio/gio.h> -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// SettingsSchemaSource is a representation of GSettingsSchemaSource. -type SettingsSchemaSource struct { - source *C.GSettingsSchemaSource -} - -func wrapSettingsSchemaSource(obj *C.GSettingsSchemaSource) *SettingsSchemaSource { - if obj == nil { - return nil - } - return &SettingsSchemaSource{obj} -} - -func (v *SettingsSchemaSource) Native() uintptr { - return uintptr(unsafe.Pointer(v.source)) -} - -func (v *SettingsSchemaSource) native() *C.GSettingsSchemaSource { - if v == nil || v.source == nil { - return nil - } - return v.source -} - -// SettingsSchemaSourceGetDefault is a wrapper around g_settings_schema_source_get_default(). -func SettingsSchemaSourceGetDefault() *SettingsSchemaSource { - return wrapSettingsSchemaSource(C.g_settings_schema_source_get_default()) -} - -// Ref() is a wrapper around g_settings_schema_source_ref(). -func (v *SettingsSchemaSource) Ref() *SettingsSchemaSource { - return wrapSettingsSchemaSource(C.g_settings_schema_source_ref(v.native())) -} - -// Unref() is a wrapper around g_settings_schema_source_unref(). -func (v *SettingsSchemaSource) Unref() { - C.g_settings_schema_source_unref(v.native()) -} - -// SettingsSchemaSourceNewFromDirectory() is a wrapper around g_settings_schema_source_new_from_directory(). -func SettingsSchemaSourceNewFromDirectory(dir string, parent *SettingsSchemaSource, trusted bool) *SettingsSchemaSource { - cstr := (*C.gchar)(C.CString(dir)) - defer C.free(unsafe.Pointer(cstr)) - - return wrapSettingsSchemaSource(C.g_settings_schema_source_new_from_directory(cstr, parent.native(), gbool(trusted), nil)) -} - -// Lookup() is a wrapper around g_settings_schema_source_lookup(). -func (v *SettingsSchemaSource) Lookup(schema string, recursive bool) *SettingsSchema { - cstr := (*C.gchar)(C.CString(schema)) - defer C.free(unsafe.Pointer(cstr)) - - return wrapSettingsSchema(C.g_settings_schema_source_lookup(v.native(), cstr, gbool(recursive))) -} - -// ListSchemas is a wrapper around g_settings_schema_source_list_schemas(). -func (v *SettingsSchemaSource) ListSchemas(recursive bool) (nonReolcatable, relocatable []string) { - var nonRel, rel **C.gchar - C.g_settings_schema_source_list_schemas(v.native(), gbool(recursive), &nonRel, &rel) - return toGoStringArray(nonRel), toGoStringArray(rel) -} diff --git a/vendor/github.com/gotk3/gotk3/glib/slist.go b/vendor/github.com/gotk3/gotk3/glib/slist.go deleted file mode 100644 index 134e682..0000000 --- a/vendor/github.com/gotk3/gotk3/glib/slist.go +++ /dev/null @@ -1,109 +0,0 @@ -package glib - -// #include <glib.h> -// #include <glib-object.h> -// #include "glib.go.h" -import "C" -import "unsafe" - -// SList is a representation of Glib's GSList. A SList must be manually freed -// by either calling Free() or FreeFull() -type SList struct { - list *C.struct__GSList -} - -func WrapSList(obj uintptr) *SList { - return wrapSList((*C.struct__GSList)(unsafe.Pointer(obj))) -} - -func wrapSList(obj *C.struct__GSList) *SList { - if obj == nil { - return nil - } - - //NOTE a list should be freed by calling either - //g_slist_free() or g_slist_free_full(). However, it's not possible to use a - //finalizer for this. - return &SList{obj} -} - -func (v *SList) Native() uintptr { - return uintptr(unsafe.Pointer(v.list)) -} - -func (v *SList) native() *C.struct__GSList { - if v == nil || v.list == nil { - return nil - } - return v.list -} - -func (v *SList) Append(data uintptr) *SList { - ret := C.g_slist_append(v.native(), C.gpointer(data)) - if ret == v.native() { - return v - } - - return wrapSList(ret) -} - -// Length is a wrapper around g_slist_length(). -func (v *SList) Length() uint { - return uint(C.g_slist_length(v.native())) -} - -// Next is a wrapper around the next struct field -func (v *SList) Next() *SList { - n := v.native() - if n == nil { - return nil - } - - return wrapSList(n.next) -} - -// Foreach acts the same as g_slist_foreach(). -// No user_data argument is implemented because of Go clojure capabilities. -func (v *SList) Foreach(fn func(ptr unsafe.Pointer)) { - for l := v; l != nil; l = l.Next() { - fn(unsafe.Pointer(l.native().data)) - } -} - -// Free is a wrapper around g_slist_free(). -func (v *SList) Free() { - C.g_slist_free(v.native()) - v.list = nil -} - -// FreeFull is a wrapper around g_slist_free_full(). -func (v *SList) FreeFull() { - //TODO implement GDestroyNotify callback - C.g_slist_free_full(v.native(), nil) - v.list = nil -} - -// GSList * g_slist_alloc () -// GSList * g_slist_prepend () -// GSList * g_slist_insert () -// GSList * g_slist_insert_before () -// GSList * g_slist_insert_sorted () -// GSList * g_slist_remove () -// GSList * g_slist_remove_link () -// GSList * g_slist_delete_link () -// GSList * g_slist_remove_all () -// void g_slist_free_1 () -// GSList * g_slist_copy () -// GSList * g_slist_copy_deep () -// GSList * g_slist_reverse () -// GSList * g_slist_insert_sorted_with_data () -// GSList * g_slist_sort () -// GSList * g_slist_sort_with_data () -// GSList * g_slist_concat () -// GSList * g_slist_last () -// GSList * g_slist_nth () -// gpointer g_slist_nth_data () -// GSList * g_slist_find () -// GSList * g_slist_find_custom () -// gint g_slist_position () -// gint g_slist_index () diff --git a/vendor/github.com/gotk3/gotk3/gtk/aboutdialog.go b/vendor/github.com/gotk3/gotk3/gtk/aboutdialog.go deleted file mode 100644 index 5bb61b3..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/aboutdialog.go +++ /dev/null @@ -1,324 +0,0 @@ -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - {glib.Type(C.gtk_about_dialog_get_type()), marshalAboutDialog}, - } - - glib.RegisterGValueMarshalers(tm) - - WrapMap["GtkAboutDialog"] = wrapAboutDialog -} - -/* - * GtkAboutDialog - */ - -// AboutDialog is a representation of GTK's GtkAboutDialog. -type AboutDialog struct { - Dialog -} - -// native returns a pointer to the underlying GtkAboutDialog. -func (v *AboutDialog) native() *C.GtkAboutDialog { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkAboutDialog(p) -} - -func marshalAboutDialog(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapAboutDialog(obj), nil -} - -func wrapAboutDialog(obj *glib.Object) *AboutDialog { - return &AboutDialog{Dialog{Window{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}}}} -} - -// AboutDialogNew is a wrapper around gtk_about_dialog_new(). -func AboutDialogNew() (*AboutDialog, error) { - c := C.gtk_about_dialog_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapAboutDialog(obj), nil -} - -// GetComments is a wrapper around gtk_about_dialog_get_comments(). -func (v *AboutDialog) GetComments() string { - c := C.gtk_about_dialog_get_comments(v.native()) - return C.GoString((*C.char)(c)) -} - -// SetComments is a wrapper around gtk_about_dialog_set_comments(). -func (v *AboutDialog) SetComments(comments string) { - cstr := C.CString(comments) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_about_dialog_set_comments(v.native(), (*C.gchar)(cstr)) -} - -// GetCopyright is a wrapper around gtk_about_dialog_get_copyright(). -func (v *AboutDialog) GetCopyright() string { - c := C.gtk_about_dialog_get_copyright(v.native()) - return C.GoString((*C.char)(c)) -} - -// SetCopyright is a wrapper around gtk_about_dialog_set_copyright(). -func (v *AboutDialog) SetCopyright(copyright string) { - cstr := C.CString(copyright) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_about_dialog_set_copyright(v.native(), (*C.gchar)(cstr)) -} - -// GetLicense is a wrapper around gtk_about_dialog_get_license(). -func (v *AboutDialog) GetLicense() string { - c := C.gtk_about_dialog_get_license(v.native()) - return C.GoString((*C.char)(c)) -} - -// SetLicense is a wrapper around gtk_about_dialog_set_license(). -func (v *AboutDialog) SetLicense(license string) { - cstr := C.CString(license) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_about_dialog_set_license(v.native(), (*C.gchar)(cstr)) -} - -// GetLicenseType is a wrapper around gtk_about_dialog_get_license_type(). -func (v *AboutDialog) GetLicenseType() License { - c := C.gtk_about_dialog_get_license_type(v.native()) - return License(c) -} - -// SetLicenseType is a wrapper around gtk_about_dialog_set_license_type(). -func (v *AboutDialog) SetLicenseType(license License) { - C.gtk_about_dialog_set_license_type(v.native(), C.GtkLicense(license)) -} - -// GetLogo is a wrapper around gtk_about_dialog_get_logo(). -func (v *AboutDialog) GetLogo() (*gdk.Pixbuf, error) { - c := C.gtk_about_dialog_get_logo(v.native()) - if c == nil { - return nil, nilPtrErr - } - - p := &gdk.Pixbuf{glib.Take(unsafe.Pointer(c))} - return p, nil -} - -// SetLogo is a wrapper around gtk_about_dialog_set_logo(). -func (v *AboutDialog) SetLogo(logo *gdk.Pixbuf) { - logoPtr := (*C.GdkPixbuf)(unsafe.Pointer(logo.Native())) - C.gtk_about_dialog_set_logo(v.native(), logoPtr) -} - -// GetLogoIconName is a wrapper around gtk_about_dialog_get_logo_icon_name(). -func (v *AboutDialog) GetLogoIconName() string { - c := C.gtk_about_dialog_get_logo_icon_name(v.native()) - return C.GoString((*C.char)(c)) -} - -// SetLogoIconName is a wrapper around gtk_about_dialog_set_logo_icon_name(). -func (v *AboutDialog) SetLogoIconName(name string) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_about_dialog_set_logo_icon_name(v.native(), (*C.gchar)(cstr)) -} - -// GetProgramName is a wrapper around gtk_about_dialog_get_program_name(). -func (v *AboutDialog) GetProgramName() string { - c := C.gtk_about_dialog_get_program_name(v.native()) - return C.GoString((*C.char)(c)) -} - -// SetProgramName is a wrapper around gtk_about_dialog_set_program_name(). -func (v *AboutDialog) SetProgramName(name string) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_about_dialog_set_program_name(v.native(), (*C.gchar)(cstr)) -} - -// GetAuthors is a wrapper around gtk_about_dialog_get_authors(). -func (v *AboutDialog) GetAuthors() []string { - var authors []string - cauthors := C.gtk_about_dialog_get_authors(v.native()) - if cauthors == nil { - return nil - } - for { - if *cauthors == nil { - break - } - authors = append(authors, C.GoString((*C.char)(*cauthors))) - cauthors = C.next_gcharptr(cauthors) - } - return authors -} - -// SetAuthors is a wrapper around gtk_about_dialog_set_authors(). -func (v *AboutDialog) SetAuthors(authors []string) { - cauthors := C.make_strings(C.int(len(authors) + 1)) - for i, author := range authors { - cstr := C.CString(author) - defer C.free(unsafe.Pointer(cstr)) - C.set_string(cauthors, C.int(i), (*C.gchar)(cstr)) - } - - C.set_string(cauthors, C.int(len(authors)), nil) - C.gtk_about_dialog_set_authors(v.native(), cauthors) - C.destroy_strings(cauthors) -} - -// GetArtists is a wrapper around gtk_about_dialog_get_artists(). -func (v *AboutDialog) GetArtists() []string { - var artists []string - cartists := C.gtk_about_dialog_get_artists(v.native()) - if cartists == nil { - return nil - } - for { - if *cartists == nil { - break - } - artists = append(artists, C.GoString((*C.char)(*cartists))) - cartists = C.next_gcharptr(cartists) - } - return artists -} - -// SetArtists is a wrapper around gtk_about_dialog_set_artists(). -func (v *AboutDialog) SetArtists(artists []string) { - cartists := C.make_strings(C.int(len(artists) + 1)) - for i, artist := range artists { - cstr := C.CString(artist) - defer C.free(unsafe.Pointer(cstr)) - C.set_string(cartists, C.int(i), (*C.gchar)(cstr)) - } - - C.set_string(cartists, C.int(len(artists)), nil) - C.gtk_about_dialog_set_artists(v.native(), cartists) - C.destroy_strings(cartists) -} - -// GetDocumenters is a wrapper around gtk_about_dialog_get_documenters(). -func (v *AboutDialog) GetDocumenters() []string { - var documenters []string - cdocumenters := C.gtk_about_dialog_get_documenters(v.native()) - if cdocumenters == nil { - return nil - } - for { - if *cdocumenters == nil { - break - } - documenters = append(documenters, C.GoString((*C.char)(*cdocumenters))) - cdocumenters = C.next_gcharptr(cdocumenters) - } - return documenters -} - -// SetDocumenters is a wrapper around gtk_about_dialog_set_documenters(). -func (v *AboutDialog) SetDocumenters(documenters []string) { - cdocumenters := C.make_strings(C.int(len(documenters) + 1)) - for i, doc := range documenters { - cstr := C.CString(doc) - defer C.free(unsafe.Pointer(cstr)) - C.set_string(cdocumenters, C.int(i), (*C.gchar)(cstr)) - } - - C.set_string(cdocumenters, C.int(len(documenters)), nil) - C.gtk_about_dialog_set_documenters(v.native(), cdocumenters) - C.destroy_strings(cdocumenters) -} - -// GetTranslatorCredits is a wrapper around gtk_about_dialog_get_translator_credits(). -func (v *AboutDialog) GetTranslatorCredits() string { - c := C.gtk_about_dialog_get_translator_credits(v.native()) - return C.GoString((*C.char)(c)) -} - -// SetTranslatorCredits is a wrapper around gtk_about_dialog_set_translator_credits(). -func (v *AboutDialog) SetTranslatorCredits(translatorCredits string) { - cstr := C.CString(translatorCredits) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_about_dialog_set_translator_credits(v.native(), (*C.gchar)(cstr)) -} - -// GetVersion is a wrapper around gtk_about_dialog_get_version(). -func (v *AboutDialog) GetVersion() string { - c := C.gtk_about_dialog_get_version(v.native()) - return C.GoString((*C.char)(c)) -} - -// SetVersion is a wrapper around gtk_about_dialog_set_version(). -func (v *AboutDialog) SetVersion(version string) { - cstr := C.CString(version) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_about_dialog_set_version(v.native(), (*C.gchar)(cstr)) -} - -// GetWebsite is a wrapper around gtk_about_dialog_get_website(). -func (v *AboutDialog) GetWebsite() string { - c := C.gtk_about_dialog_get_website(v.native()) - return C.GoString((*C.char)(c)) -} - -// SetWebsite is a wrapper around gtk_about_dialog_set_website(). -func (v *AboutDialog) SetWebsite(website string) { - cstr := C.CString(website) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_about_dialog_set_website(v.native(), (*C.gchar)(cstr)) -} - -// GetWebsiteLabel is a wrapper around gtk_about_dialog_get_website_label(). -func (v *AboutDialog) GetWebsiteLabel() string { - c := C.gtk_about_dialog_get_website_label(v.native()) - return C.GoString((*C.char)(c)) -} - -// SetWebsiteLabel is a wrapper around gtk_about_dialog_set_website_label(). -func (v *AboutDialog) SetWebsiteLabel(websiteLabel string) { - cstr := C.CString(websiteLabel) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_about_dialog_set_website_label(v.native(), (*C.gchar)(cstr)) -} - -// GetWrapLicense is a wrapper around gtk_about_dialog_get_wrap_license(). -func (v *AboutDialog) GetWrapLicense() bool { - return gobool(C.gtk_about_dialog_get_wrap_license(v.native())) -} - -// SetWrapLicense is a wrapper around gtk_about_dialog_set_wrap_license(). -func (v *AboutDialog) SetWrapLicense(wrapLicense bool) { - C.gtk_about_dialog_set_wrap_license(v.native(), gbool(wrapLicense)) -} - -// AddCreditSection is a wrapper around gtk_about_dialog_add_credit_section(). -func (v *AboutDialog) AddCreditSection(sectionName string, people []string) { - cname := (*C.gchar)(C.CString(sectionName)) - defer C.free(unsafe.Pointer(cname)) - - cpeople := C.make_strings(C.int(len(people)) + 1) - defer C.destroy_strings(cpeople) - for i, p := range people { - cp := (*C.gchar)(C.CString(p)) - defer C.free(unsafe.Pointer(cp)) - C.set_string(cpeople, C.int(i), cp) - } - C.set_string(cpeople, C.int(len(people)), nil) - - C.gtk_about_dialog_add_credit_section(v.native(), cname, cpeople) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/accel.go b/vendor/github.com/gotk3/gotk3/gtk/accel.go deleted file mode 100644 index b740e6c..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/accel.go +++ /dev/null @@ -1,435 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains accelerator related functions and structures - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" -) - -// AccelFlags is a representation of GTK's GtkAccelFlags -type AccelFlags int - -const ( - ACCEL_VISIBLE AccelFlags = C.GTK_ACCEL_VISIBLE - ACCEL_LOCKED AccelFlags = C.GTK_ACCEL_LOCKED - ACCEL_MASK AccelFlags = C.GTK_ACCEL_MASK -) - -func marshalAccelFlags(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return AccelFlags(c), nil -} - -// AcceleratorName is a wrapper around gtk_accelerator_name(). -func AcceleratorName(key uint, mods gdk.ModifierType) string { - c := C.gtk_accelerator_name(C.guint(key), C.GdkModifierType(mods)) - defer C.free(unsafe.Pointer(c)) - return C.GoString((*C.char)(c)) -} - -// AcceleratorValid is a wrapper around gtk_accelerator_valid(). -func AcceleratorValid(key uint, mods gdk.ModifierType) bool { - return gobool(C.gtk_accelerator_valid(C.guint(key), C.GdkModifierType(mods))) -} - -// AcceleratorGetDefaultModMask is a wrapper around gtk_accelerator_get_default_mod_mask(). -func AcceleratorGetDefaultModMask() gdk.ModifierType { - return gdk.ModifierType(C.gtk_accelerator_get_default_mod_mask()) -} - -// AcceleratorParse is a wrapper around gtk_accelerator_parse(). -func AcceleratorParse(acc string) (key uint, mods gdk.ModifierType) { - cstr := C.CString(acc) - defer C.free(unsafe.Pointer(cstr)) - - k := C.guint(0) - m := C.GdkModifierType(0) - - C.gtk_accelerator_parse((*C.gchar)(cstr), &k, &m) - return uint(k), gdk.ModifierType(m) -} - -// AcceleratorGetLabel is a wrapper around gtk_accelerator_get_label(). -func AcceleratorGetLabel(key uint, mods gdk.ModifierType) string { - c := C.gtk_accelerator_get_label(C.guint(key), C.GdkModifierType(mods)) - defer C.free(unsafe.Pointer(c)) - return C.GoString((*C.char)(c)) -} - -// AcceleratorSetDefaultModMask is a wrapper around gtk_accelerator_set_default_mod_mask(). -func AcceleratorSetDefaultModMask(mods gdk.ModifierType) { - C.gtk_accelerator_set_default_mod_mask(C.GdkModifierType(mods)) -} - -/* - * GtkAccelGroup - */ - -// AccelGroup is a representation of GTK's GtkAccelGroup. -type AccelGroup struct { - *glib.Object -} - -// native returns a pointer to the underlying GtkAccelGroup. -func (v *AccelGroup) native() *C.GtkAccelGroup { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkAccelGroup(p) -} - -func marshalAccelGroup(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapAccelGroup(obj), nil -} - -func wrapAccelGroup(obj *glib.Object) *AccelGroup { - return &AccelGroup{obj} -} - -// AccelGroup is a wrapper around gtk_accel_group_new(). -func AccelGroupNew() (*AccelGroup, error) { - c := C.gtk_accel_group_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapAccelGroup(obj), nil -} - -// Connect is a wrapper around gtk_accel_group_connect(). -func (v *AccelGroup) Connect(key uint, mods gdk.ModifierType, flags AccelFlags, f interface{}) { - closure, _ := glib.ClosureNew(f) - cl := (*C.struct__GClosure)(unsafe.Pointer(closure)) - C.gtk_accel_group_connect( - v.native(), - C.guint(key), - C.GdkModifierType(mods), - C.GtkAccelFlags(flags), - cl) -} - -// ConnectByPath is a wrapper around gtk_accel_group_connect_by_path(). -func (v *AccelGroup) ConnectByPath(path string, f interface{}) { - closure, _ := glib.ClosureNew(f) - cl := (*C.struct__GClosure)(unsafe.Pointer(closure)) - - cstr := C.CString(path) - defer C.free(unsafe.Pointer(cstr)) - - C.gtk_accel_group_connect_by_path( - v.native(), - (*C.gchar)(cstr), - cl) -} - -// Disconnect is a wrapper around gtk_accel_group_disconnect(). -func (v *AccelGroup) Disconnect(f interface{}) { - closure, _ := glib.ClosureNew(f) - cl := (*C.struct__GClosure)(unsafe.Pointer(closure)) - C.gtk_accel_group_disconnect(v.native(), cl) -} - -// DisconnectKey is a wrapper around gtk_accel_group_disconnect_key(). -func (v *AccelGroup) DisconnectKey(key uint, mods gdk.ModifierType) { - C.gtk_accel_group_disconnect_key(v.native(), C.guint(key), C.GdkModifierType(mods)) -} - -// Lock is a wrapper around gtk_accel_group_lock(). -func (v *AccelGroup) Lock() { - C.gtk_accel_group_lock(v.native()) -} - -// Unlock is a wrapper around gtk_accel_group_unlock(). -func (v *AccelGroup) Unlock() { - C.gtk_accel_group_unlock(v.native()) -} - -// IsLocked is a wrapper around gtk_accel_group_get_is_locked(). -func (v *AccelGroup) IsLocked() bool { - return gobool(C.gtk_accel_group_get_is_locked(v.native())) -} - -// AccelGroupFromClosure is a wrapper around gtk_accel_group_from_accel_closure(). -func AccelGroupFromClosure(f interface{}) *AccelGroup { - closure, _ := glib.ClosureNew(f) - cl := (*C.struct__GClosure)(unsafe.Pointer(closure)) - c := C.gtk_accel_group_from_accel_closure(cl) - if c == nil { - return nil - } - return wrapAccelGroup(glib.Take(unsafe.Pointer(c))) -} - -// GetModifierMask is a wrapper around gtk_accel_group_get_modifier_mask(). -func (v *AccelGroup) GetModifierMask() gdk.ModifierType { - return gdk.ModifierType(C.gtk_accel_group_get_modifier_mask(v.native())) -} - -// AccelGroupsActivate is a wrapper around gtk_accel_groups_activate(). -func AccelGroupsActivate(obj *glib.Object, key uint, mods gdk.ModifierType) bool { - return gobool(C.gtk_accel_groups_activate((*C.GObject)(unsafe.Pointer(obj.Native())), C.guint(key), C.GdkModifierType(mods))) -} - -// Activate is a wrapper around gtk_accel_group_activate(). -func (v *AccelGroup) Activate(quark glib.Quark, acceleratable *glib.Object, key uint, mods gdk.ModifierType) bool { - return gobool(C.gtk_accel_group_activate(v.native(), C.GQuark(quark), (*C.GObject)(unsafe.Pointer(acceleratable.Native())), C.guint(key), C.GdkModifierType(mods))) -} - -// AccelGroupsFromObject is a wrapper around gtk_accel_groups_from_object(). -func AccelGroupsFromObject(obj *glib.Object) *glib.SList { - res := C.gtk_accel_groups_from_object((*C.GObject)(unsafe.Pointer(obj.Native()))) - if res == nil { - return nil - } - return (*glib.SList)(unsafe.Pointer(res)) -} - -/* - * GtkAccelMap - */ - -// AccelMap is a representation of GTK's GtkAccelMap. -type AccelMap struct { - *glib.Object -} - -// native returns a pointer to the underlying GtkAccelMap. -func (v *AccelMap) native() *C.GtkAccelMap { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkAccelMap(p) -} - -func marshalAccelMap(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapAccelMap(obj), nil -} - -func wrapAccelMap(obj *glib.Object) *AccelMap { - return &AccelMap{obj} -} - -// AccelMapAddEntry is a wrapper around gtk_accel_map_add_entry(). -func AccelMapAddEntry(path string, key uint, mods gdk.ModifierType) { - cstr := C.CString(path) - defer C.free(unsafe.Pointer(cstr)) - - C.gtk_accel_map_add_entry((*C.gchar)(cstr), C.guint(key), C.GdkModifierType(mods)) -} - -type AccelKey struct { - key uint - mods gdk.ModifierType - flags uint16 -} - -func (v *AccelKey) native() *C.struct__GtkAccelKey { - if v == nil { - return nil - } - - var val C.struct__GtkAccelKey - val.accel_key = C.guint(v.key) - val.accel_mods = C.GdkModifierType(v.mods) - val.accel_flags = v.flags - return &val -} - -func wrapAccelKey(obj *C.struct__GtkAccelKey) *AccelKey { - var v AccelKey - - v.key = uint(obj.accel_key) - v.mods = gdk.ModifierType(obj.accel_mods) - v.flags = uint16(obj.accel_flags) - - return &v -} - -// AccelMapLookupEntry is a wrapper around gtk_accel_map_lookup_entry(). -func AccelMapLookupEntry(path string) *AccelKey { - cstr := C.CString(path) - defer C.free(unsafe.Pointer(cstr)) - - var v *C.struct__GtkAccelKey - - C.gtk_accel_map_lookup_entry((*C.gchar)(cstr), v) - return wrapAccelKey(v) -} - -// AccelMapChangeEntry is a wrapper around gtk_accel_map_change_entry(). -func AccelMapChangeEntry(path string, key uint, mods gdk.ModifierType, replace bool) bool { - cstr := C.CString(path) - defer C.free(unsafe.Pointer(cstr)) - - return gobool(C.gtk_accel_map_change_entry((*C.gchar)(cstr), C.guint(key), C.GdkModifierType(mods), gbool(replace))) -} - -// AccelMapLoad is a wrapper around gtk_accel_map_load(). -func AccelMapLoad(fileName string) { - cstr := C.CString(fileName) - defer C.free(unsafe.Pointer(cstr)) - - C.gtk_accel_map_load((*C.gchar)(cstr)) -} - -// AccelMapSave is a wrapper around gtk_accel_map_save(). -func AccelMapSave(fileName string) { - cstr := C.CString(fileName) - defer C.free(unsafe.Pointer(cstr)) - - C.gtk_accel_map_save((*C.gchar)(cstr)) -} - -// AccelMapLoadFD is a wrapper around gtk_accel_map_load_fd(). -func AccelMapLoadFD(fd int) { - C.gtk_accel_map_load_fd(C.gint(fd)) -} - -// AccelMapSaveFD is a wrapper around gtk_accel_map_save_fd(). -func AccelMapSaveFD(fd int) { - C.gtk_accel_map_save_fd(C.gint(fd)) -} - -// AccelMapAddFilter is a wrapper around gtk_accel_map_add_filter(). -func AccelMapAddFilter(filter string) { - cstr := C.CString(filter) - defer C.free(unsafe.Pointer(cstr)) - - C.gtk_accel_map_add_filter((*C.gchar)(cstr)) -} - -// AccelMapGet is a wrapper around gtk_accel_map_get(). -func AccelMapGet() *AccelMap { - c := C.gtk_accel_map_get() - if c == nil { - return nil - } - return wrapAccelMap(glib.Take(unsafe.Pointer(c))) -} - -// AccelMapLockPath is a wrapper around gtk_accel_map_lock_path(). -func AccelMapLockPath(path string) { - cstr := C.CString(path) - defer C.free(unsafe.Pointer(cstr)) - - C.gtk_accel_map_lock_path((*C.gchar)(cstr)) -} - -// AccelMapUnlockPath is a wrapper around gtk_accel_map_unlock_path(). -func AccelMapUnlockPath(path string) { - cstr := C.CString(path) - defer C.free(unsafe.Pointer(cstr)) - - C.gtk_accel_map_unlock_path((*C.gchar)(cstr)) -} - -// SetAccelGroup is a wrapper around gtk_menu_set_accel_group(). -func (v *Menu) SetAccelGroup(accelGroup *AccelGroup) { - C.gtk_menu_set_accel_group(v.native(), accelGroup.native()) -} - -// GetAccelGroup is a wrapper around gtk_menu_get_accel_group(). -func (v *Menu) GetAccelGroup() *AccelGroup { - c := C.gtk_menu_get_accel_group(v.native()) - if c == nil { - return nil - } - return wrapAccelGroup(glib.Take(unsafe.Pointer(c))) -} - -// SetAccelPath is a wrapper around gtk_menu_set_accel_path(). -func (v *Menu) SetAccelPath(path string) { - cstr := C.CString(path) - defer C.free(unsafe.Pointer(cstr)) - - C.gtk_menu_set_accel_path(v.native(), (*C.gchar)(cstr)) -} - -// GetAccelPath is a wrapper around gtk_menu_get_accel_path(). -func (v *Menu) GetAccelPath() string { - c := C.gtk_menu_get_accel_path(v.native()) - return C.GoString((*C.char)(c)) -} - -// SetAccelPath is a wrapper around gtk_menu_item_set_accel_path(). -func (v *MenuItem) SetAccelPath(path string) { - cstr := C.CString(path) - defer C.free(unsafe.Pointer(cstr)) - - C.gtk_menu_item_set_accel_path(v.native(), (*C.gchar)(cstr)) -} - -// GetAccelPath is a wrapper around gtk_menu_item_get_accel_path(). -func (v *MenuItem) GetAccelPath() string { - c := C.gtk_menu_item_get_accel_path(v.native()) - return C.GoString((*C.char)(c)) -} - -// AddAccelerator is a wrapper around gtk_widget_add_accelerator(). -func (v *Widget) AddAccelerator(signal string, group *AccelGroup, key uint, mods gdk.ModifierType, flags AccelFlags) { - csignal := (*C.gchar)(C.CString(signal)) - defer C.free(unsafe.Pointer(csignal)) - - C.gtk_widget_add_accelerator(v.native(), - csignal, - group.native(), - C.guint(key), - C.GdkModifierType(mods), - C.GtkAccelFlags(flags)) -} - -// RemoveAccelerator is a wrapper around gtk_widget_remove_accelerator(). -func (v *Widget) RemoveAccelerator(group *AccelGroup, key uint, mods gdk.ModifierType) bool { - return gobool(C.gtk_widget_remove_accelerator(v.native(), - group.native(), - C.guint(key), - C.GdkModifierType(mods))) -} - -// SetAccelPath is a wrapper around gtk_widget_set_accel_path(). -func (v *Widget) SetAccelPath(path string, group *AccelGroup) { - cstr := (*C.gchar)(C.CString(path)) - defer C.free(unsafe.Pointer(cstr)) - - C.gtk_widget_set_accel_path(v.native(), cstr, group.native()) -} - -// CanActivateAccel is a wrapper around gtk_widget_can_activate_accel(). -func (v *Widget) CanActivateAccel(signalId uint) bool { - return gobool(C.gtk_widget_can_activate_accel(v.native(), C.guint(signalId))) -} - -// AddAccelGroup() is a wrapper around gtk_window_add_accel_group(). -func (v *Window) AddAccelGroup(accelGroup *AccelGroup) { - C.gtk_window_add_accel_group(v.native(), accelGroup.native()) -} - -// RemoveAccelGroup() is a wrapper around gtk_window_add_accel_group(). -func (v *Window) RemoveAccelGroup(accelGroup *AccelGroup) { - C.gtk_window_remove_accel_group(v.native(), accelGroup.native()) -} - -// These three functions are for system level access - thus not as high priority to implement -// TODO: void gtk_accelerator_parse_with_keycode () -// TODO: gchar * gtk_accelerator_name_with_keycode () -// TODO: gchar * gtk_accelerator_get_label_with_keycode () - -// TODO: GtkAccelKey * gtk_accel_group_find () - this function uses a function type - I don't know how to represent it in cgo -// TODO: gtk_accel_map_foreach_unfiltered - can't be done without a function type -// TODO: gtk_accel_map_foreach - can't be done without a function type - -// TODO: gtk_accel_map_load_scanner -// TODO: gtk_widget_list_accel_closures diff --git a/vendor/github.com/gotk3/gotk3/gtk/accel_test.go b/vendor/github.com/gotk3/gotk3/gtk/accel_test.go deleted file mode 100644 index 938fd22..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/accel_test.go +++ /dev/null @@ -1,34 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -package gtk - -import "testing" - -func Test_AccelGroup_Locking(t *testing.T) { - ag, _ := AccelGroupNew() - if ag.IsLocked() { - t.Error("A newly created AccelGroup should not be locked") - } - - ag.Lock() - - if !ag.IsLocked() { - t.Error("A locked AccelGroup should report being locked") - } - - ag.Unlock() - - if ag.IsLocked() { - t.Error("An unlocked AccelGroup should report being unlocked") - } -} - -func Test_AcceleratorParse(t *testing.T) { - l, r := AcceleratorParse("<Shift><Alt>F1") - if l != 65470 { - t.Errorf("Expected parsed key to equal %d but was %d", 65470, l) - } - if r != 9 { - t.Errorf("Expected parsed mods to equal %d but was %d", 9, r) - } -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/actionable.go b/vendor/github.com/gotk3/gotk3/gtk/actionable.go deleted file mode 100644 index 70b357d..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/actionable.go +++ /dev/null @@ -1,117 +0,0 @@ -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -// #include "actionable.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - {glib.Type(C.gtk_actionable_get_type()), marshalActionable}, - } - - glib.RegisterGValueMarshalers(tm) - - WrapMap["GtkActionable"] = marshalActionable -} - -// IActionable is a representation of the GtkActionable GInterface, -// used to avoid duplication when embedding the type in a wrapper of another GObject-based type. -// The non-Interface version should only be used Actionable is used if the concrete type is not known. -type IActionable interface { - Native() uintptr - toActionable() *C.GtkActionable - - SetActionName(name string) - GetActionName() (string, error) - // SetActionTargetValue(value *glib.Variant) - // GetActionTargetValue() (*glib.Variant, error) - // SetActionTarget(string, params...) - SetDetailedActionName(name string) -} - -// Actionable is a representation of the GtkActionable GInterface. -// Do not embed this concrete type in implementing structs but rather use IActionable -// (see Button wrapper for an example) -type Actionable struct { - *glib.Object -} - -// native returns a pointer to the underlying GtkActionable. -func (v *Actionable) native() *C.GtkActionable { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkActionable(p) -} - -func marshalActionable(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapActionable(obj), nil -} - -func wrapActionable(obj *glib.Object) *Actionable { - return &Actionable{obj} -} - -func (v *Actionable) toActionable() *C.GtkActionable { - if v == nil { - return nil - } - return v.native() -} - -// SetActionName is a wrapper around gtk_actionable_set_action_name(). -// Since 3.4 -func (v *Actionable) SetActionName(action_name string) { - cstr := C.CString(action_name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_actionable_set_action_name(v.native(), (*C.gchar)(cstr)) -} - -// GetActionName is a wrapper around gtk_actionable_set_action_name(). -// Since 3.4 -func (v *Actionable) GetActionName() (string, error) { - c := C.gtk_actionable_get_action_name(v.native()) - if c == nil { - return "", nilPtrErr - } - return C.GoString((*C.char)(c)), nil -} - -// SetDetailedActionName is a wrapper around gtk_actionable_set_detailed_action_name(). -// Since 3.4 -func (v *Actionable) SetDetailedActionName(detailed_action_name string) { - cstr := C.CString(detailed_action_name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_actionable_set_detailed_action_name(v.native(), (*C.gchar)(cstr)) -} - -// SetActionTargetValue is a wrapper around gtk_actionable_set_action_target_value(). -// Since 3.4 -/*func (v *Actionable) SetActionTargetValue(value *glib.Variant) { - // FIXME ToGVariant does not work here - C.gtk_actionable_set_action_target_value(v.native(), value.ToGVariant()) -}*/ - -// GetActionTargetValue is a wrapper around gtk_actionable_get_action_target_value(). -// Since 3.4 -/*func (v *Actionable) GetActionTargetValue() (*glib.Variant, error) { - // FIXME: newVariant is not exported from glib - return newVariant(C.gtk_actionable_get_action_target_value(v.native(), cstr)) -}*/ - -/* -// Since 3.4 -void -gtk_actionable_set_action_target (GtkActionable *actionable, - const gchar *format_string, - ...); -*/ diff --git a/vendor/github.com/gotk3/gotk3/gtk/actionable.go.h b/vendor/github.com/gotk3/gotk3/gtk/actionable.go.h deleted file mode 100644 index d9ff505..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/actionable.go.h +++ /dev/null @@ -1,5 +0,0 @@ -static GtkActionable * -toGtkActionable(void *p) -{ - return (GTK_ACTIONABLE(p)); -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/actionable_test.go b/vendor/github.com/gotk3/gotk3/gtk/actionable_test.go deleted file mode 100644 index 5a572a9..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/actionable_test.go +++ /dev/null @@ -1,35 +0,0 @@ -package gtk - -import "testing" - -func TestActionableImplementsIActionable(t *testing.T) { - var cut interface{} - cut = &Actionable{} - _, ok := cut.(IActionable) - - if !ok { - t.Error("Actionable does not implement IActionable") - return - } -} - -// TestGetSetActionName tests the getter and setter for action name -// using a button, as we need an actual instance implementing Actionable. -func TestGetSetActionName(t *testing.T) { - cut, err := ButtonNew() - if err != nil { - t.Fatal("Error creating button", err.Error()) - } - - expected := "app.stuff" - cut.SetActionName(expected) - - actual, err := cut.GetActionName() - if err != nil { - t.Fatal("Error getting action name", err.Error()) - } - - if expected != actual { - t.Fatalf("Expected %s got %s", expected, actual) - } -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/actionbar_since_3_12.go b/vendor/github.com/gotk3/gotk3/gtk/actionbar_since_3_12.go deleted file mode 100644 index cb9501c..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/actionbar_since_3_12.go +++ /dev/null @@ -1,105 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10 - -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// This file includes wrapers for symbols included since GTK 3.12, and -// and should not be included in a build intended to target any older GTK -// versions. To target an older build, such as 3.10, use -// 'go build -tags gtk_3_10'. Otherwise, if no build tags are used, GTK 3.12 -// is assumed and this file is built. -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10 - -package gtk - -// #include <gtk/gtk.h> -// #include "actionbar_since_3_12.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - {glib.Type(C.gtk_action_bar_get_type()), marshalActionBar}, - } - - glib.RegisterGValueMarshalers(tm) - - WrapMap["GtkActionBar"] = wrapActionBar -} - -//GtkActionBar -type ActionBar struct { - Bin -} - -func (v *ActionBar) native() *C.GtkActionBar { - if v == nil || v.GObject == nil { - return nil - } - - p := unsafe.Pointer(v.GObject) - return C.toGtkActionBar(p) -} - -func marshalActionBar(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapActionBar(glib.Take(unsafe.Pointer(c))), nil -} - -func wrapActionBar(obj *glib.Object) *ActionBar { - return &ActionBar{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -//gtk_action_bar_new() -func ActionBarNew() (*ActionBar, error) { - c := C.gtk_action_bar_new() - if c == nil { - return nil, nilPtrErr - } - return wrapActionBar(glib.Take(unsafe.Pointer(c))), nil -} - -//gtk_action_bar_pack_start(GtkActionBar *action_bar,GtkWidget *child) -func (a *ActionBar) PackStart(child IWidget) { - C.gtk_action_bar_pack_start(a.native(), child.toWidget()) -} - -//gtk_action_bar_pack_end(GtkActionBar *action_bar,GtkWidget *child) -func (a *ActionBar) PackEnd(child IWidget) { - C.gtk_action_bar_pack_end(a.native(), child.toWidget()) -} - -//gtk_action_bar_set_center_widget(GtkActionBar *action_bar,GtkWidget *center_widget) -func (a *ActionBar) SetCenterWidget(child IWidget) { - if child == nil { - C.gtk_action_bar_set_center_widget(a.native(), nil) - } else { - C.gtk_action_bar_set_center_widget(a.native(), child.toWidget()) - } -} - -//gtk_action_bar_get_center_widget(GtkActionBar *action_bar) -func (a *ActionBar) GetCenterWidget() *Widget { - w := C.gtk_action_bar_get_center_widget(a.native()) - if w == nil { - return nil - } - return &Widget{glib.InitiallyUnowned{glib.Take(unsafe.Pointer(w))}} -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/actionbar_since_3_12.go.h b/vendor/github.com/gotk3/gotk3/gtk/actionbar_since_3_12.go.h deleted file mode 100644 index d58e36a..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/actionbar_since_3_12.go.h +++ /dev/null @@ -1,25 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12
-
-/*
- * Copyright (c) 2013-2014 Conformal Systems <info@conformal.com>
- *
- * This file originated from: http://opensource.conformal.com/
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-static GtkActionBar *
-toGtkActionBar(void *p)
-{
- return (GTK_ACTION_BAR(p));
-}
diff --git a/vendor/github.com/gotk3/gotk3/gtk/app_chooser.go b/vendor/github.com/gotk3/gotk3/gtk/app_chooser.go deleted file mode 100644 index dc90e03..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/app_chooser.go +++ /dev/null @@ -1,378 +0,0 @@ -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_app_chooser_get_type()), marshalAppChooser}, - {glib.Type(C.gtk_app_chooser_button_get_type()), marshalAppChooserButton}, - {glib.Type(C.gtk_app_chooser_widget_get_type()), marshalAppChooserWidget}, - {glib.Type(C.gtk_app_chooser_dialog_get_type()), marshalAppChooserDialog}, - } - - glib.RegisterGValueMarshalers(tm) - - WrapMap["GtkAppChooser"] = wrapAppChooser - WrapMap["GtkAppChooserButton"] = wrapAppChooserButton - WrapMap["GtkAppChooserWidget"] = wrapAppChooserWidget - WrapMap["GtkAppChooserDialog"] = wrapAppChooserDialog -} - -/* - * GtkAppChooser - */ - -// AppChooser is a representation of GTK's GtkAppChooser GInterface. -type AppChooser struct { - *glib.Object -} - -// IAppChooser is an interface type implemented by all structs -// embedding an AppChooser. It is meant to be used as an argument type -// for wrapper functions that wrap around a C GTK function taking a -// GtkAppChooser. -type IAppChooser interface { - toAppChooser() *C.GtkAppChooser -} - -// native returns a pointer to the underlying GtkAppChooser. -func (v *AppChooser) native() *C.GtkAppChooser { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkAppChooser(p) -} - -func marshalAppChooser(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapAppChooser(obj), nil -} - -func wrapAppChooser(obj *glib.Object) *AppChooser { - return &AppChooser{obj} -} - -func (v *AppChooser) toAppChooser() *C.GtkAppChooser { - if v == nil { - return nil - } - return v.native() -} - -// TODO: Needs gio/GAppInfo implementation first -// gtk_app_chooser_get_app_info () - -// GetContentType is a wrapper around gtk_app_chooser_get_content_type(). -func (v *AppChooser) GetContentType() string { - cstr := C.gtk_app_chooser_get_content_type(v.native()) - defer C.free(unsafe.Pointer(cstr)) - return C.GoString((*C.char)(cstr)) -} - -// Refresh is a wrapper around gtk_app_chooser_refresh(). -func (v *AppChooser) Refresh() { - C.gtk_app_chooser_refresh(v.native()) -} - -/* - * GtkAppChooserButton - */ - -// AppChooserButton is a representation of GTK's GtkAppChooserButton. -type AppChooserButton struct { - ComboBox - - // Interfaces - AppChooser -} - -// native returns a pointer to the underlying GtkAppChooserButton. -func (v *AppChooserButton) native() *C.GtkAppChooserButton { - if v == nil || v.GObject == nil { - return nil - } - - p := unsafe.Pointer(v.GObject) - return C.toGtkAppChooserButton(p) -} - -func marshalAppChooserButton(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapAppChooserButton(glib.Take(unsafe.Pointer(c))), nil -} - -func wrapAppChooserButton(obj *glib.Object) *AppChooserButton { - cl := wrapCellLayout(obj) - ac := wrapAppChooser(obj) - return &AppChooserButton{ComboBox{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}, *cl}, *ac} -} - -// AppChooserButtonNew() is a wrapper around gtk_app_chooser_button_new(). -func AppChooserButtonNew(content_type string) (*AppChooserButton, error) { - cstr := C.CString(content_type) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_app_chooser_button_new((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapAppChooserButton(glib.Take(unsafe.Pointer(c))), nil -} - -// TODO: Needs gio/GIcon implemented first -// gtk_app_chooser_button_append_custom_item () - -// AppendSeparator() is a wrapper around gtk_app_chooser_button_append_separator(). -func (v *AppChooserButton) AppendSeparator() { - C.gtk_app_chooser_button_append_separator(v.native()) -} - -// SetActiveCustomItem() is a wrapper around gtk_app_chooser_button_set_active_custom_item(). -func (v *AppChooserButton) SetActiveCustomItem(name string) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_app_chooser_button_set_active_custom_item(v.native(), (*C.gchar)(cstr)) -} - -// GetShowDefaultItem() is a wrapper around gtk_app_chooser_button_get_show_default_item(). -func (v *AppChooserButton) GetShowDefaultItem() bool { - return gobool(C.gtk_app_chooser_button_get_show_default_item(v.native())) -} - -// SetShowDefaultItem() is a wrapper around gtk_app_chooser_button_set_show_default_item(). -func (v *AppChooserButton) SetShowDefaultItem(setting bool) { - C.gtk_app_chooser_button_set_show_default_item(v.native(), gbool(setting)) -} - -// GetShowDialogItem() is a wrapper around gtk_app_chooser_button_get_show_dialog_item(). -func (v *AppChooserButton) GetShowDialogItem() bool { - return gobool(C.gtk_app_chooser_button_get_show_dialog_item(v.native())) -} - -// SetShowDialogItem() is a wrapper around gtk_app_chooser_button_set_show_dialog_item(). -func (v *AppChooserButton) SetShowDialogItem(setting bool) { - C.gtk_app_chooser_button_set_show_dialog_item(v.native(), gbool(setting)) -} - -// GetHeading() is a wrapper around gtk_app_chooser_button_get_heading(). -// In case when gtk_app_chooser_button_get_heading() returns a nil string, -// GetHeading() returns a non-nil error. -func (v *AppChooserButton) GetHeading() (string, error) { - cstr := C.gtk_app_chooser_button_get_heading(v.native()) - if cstr == nil { - return "", nilPtrErr - } - defer C.free(unsafe.Pointer(cstr)) - return C.GoString((*C.char)(cstr)), nil -} - -// SetHeading() is a wrapper around gtk_app_chooser_button_set_heading(). -func (v *AppChooserButton) SetHeading(heading string) { - cstr := C.CString(heading) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_app_chooser_button_set_heading(v.native(), (*C.gchar)(cstr)) -} - -/* - * GtkAppChooserWidget - */ - -// AppChooserWidget is a representation of GTK's GtkAppChooserWidget. -type AppChooserWidget struct { - Box - - // Interfaces - AppChooser -} - -// native returns a pointer to the underlying GtkAppChooserWidget. -func (v *AppChooserWidget) native() *C.GtkAppChooserWidget { - if v == nil || v.GObject == nil { - return nil - } - - p := unsafe.Pointer(v.GObject) - return C.toGtkAppChooserWidget(p) -} - -func marshalAppChooserWidget(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapAppChooserWidget(glib.Take(unsafe.Pointer(c))), nil -} - -func wrapAppChooserWidget(obj *glib.Object) *AppChooserWidget { - box := wrapBox(obj) - ac := wrapAppChooser(obj) - return &AppChooserWidget{*box, *ac} -} - -// AppChooserWidgetNew() is a wrapper around gtk_app_chooser_widget_new(). -func AppChooserWidgetNew(content_type string) (*AppChooserWidget, error) { - cstr := C.CString(content_type) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_app_chooser_widget_new((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapAppChooserWidget(glib.Take(unsafe.Pointer(c))), nil -} - -// GetShowDefault() is a wrapper around gtk_app_chooser_widget_get_show_default(). -func (v *AppChooserWidget) GetShowDefault() bool { - return gobool(C.gtk_app_chooser_widget_get_show_default(v.native())) -} - -// SetShowDefault() is a wrapper around gtk_app_chooser_widget_set_show_default(). -func (v *AppChooserWidget) SetShowDefault(setting bool) { - C.gtk_app_chooser_widget_set_show_default(v.native(), gbool(setting)) -} - -// GetShowRecommended() is a wrapper around gtk_app_chooser_widget_get_show_recommended(). -func (v *AppChooserWidget) GetShowRecommended() bool { - return gobool(C.gtk_app_chooser_widget_get_show_recommended(v.native())) -} - -// SetShowRecommended() is a wrapper around gtk_app_chooser_widget_set_show_recommended(). -func (v *AppChooserWidget) SetShowRecommended(setting bool) { - C.gtk_app_chooser_widget_set_show_recommended(v.native(), gbool(setting)) -} - -// GetShowFallback() is a wrapper around gtk_app_chooser_widget_get_show_fallback(). -func (v *AppChooserWidget) GetShowFallback() bool { - return gobool(C.gtk_app_chooser_widget_get_show_fallback(v.native())) -} - -// SetShowFallback() is a wrapper around gtk_app_chooser_widget_set_show_fallback(). -func (v *AppChooserWidget) SetShowFallback(setting bool) { - C.gtk_app_chooser_widget_set_show_fallback(v.native(), gbool(setting)) -} - -// GetShowOther() is a wrapper around gtk_app_chooser_widget_get_show_other(). -func (v *AppChooserWidget) GetShowOther() bool { - return gobool(C.gtk_app_chooser_widget_get_show_other(v.native())) -} - -// SetShowOther() is a wrapper around gtk_app_chooser_widget_set_show_other(). -func (v *AppChooserWidget) SetShowOther(setting bool) { - C.gtk_app_chooser_widget_set_show_other(v.native(), gbool(setting)) -} - -// GetShowAll() is a wrapper around gtk_app_chooser_widget_get_show_all(). -func (v *AppChooserWidget) GetShowAll() bool { - return gobool(C.gtk_app_chooser_widget_get_show_all(v.native())) -} - -// SetShowAll() is a wrapper around gtk_app_chooser_widget_set_show_all(). -func (v *AppChooserWidget) SetShowAll(setting bool) { - C.gtk_app_chooser_widget_set_show_all(v.native(), gbool(setting)) -} - -// GetDefaultText() is a wrapper around gtk_app_chooser_widget_get_default_text(). -// In case when gtk_app_chooser_widget_get_default_text() returns a nil string, -// GetDefaultText() returns a non-nil error. -func (v *AppChooserWidget) GetDefaultText() (string, error) { - cstr := C.gtk_app_chooser_widget_get_default_text(v.native()) - if cstr == nil { - return "", nilPtrErr - } - defer C.free(unsafe.Pointer(cstr)) - return C.GoString((*C.char)(cstr)), nil -} - -// SetDefaultText() is a wrapper around gtk_app_chooser_widget_set_default_text(). -func (v *AppChooserWidget) SetDefaultText(text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_app_chooser_widget_set_default_text(v.native(), (*C.gchar)(cstr)) -} - -/* - * GtkAppChooserDialog - */ - -// AppChooserDialog is a representation of GTK's GtkAppChooserDialog. -type AppChooserDialog struct { - Dialog - - // Interfaces - AppChooser -} - -// native returns a pointer to the underlying GtkAppChooserButton. -func (v *AppChooserDialog) native() *C.GtkAppChooserDialog { - if v == nil || v.GObject == nil { - return nil - } - - p := unsafe.Pointer(v.GObject) - return C.toGtkAppChooserDialog(p) -} - -func marshalAppChooserDialog(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapAppChooserDialog(glib.Take(unsafe.Pointer(c))), nil -} - -func wrapAppChooserDialog(obj *glib.Object) *AppChooserDialog { - dialog := wrapDialog(obj) - ac := wrapAppChooser(obj) - return &AppChooserDialog{*dialog, *ac} -} - -// TODO: Uncomment when gio builds successfully -// AppChooserDialogNew() is a wrapper around gtk_app_chooser_dialog_new(). -// func AppChooserDialogNew(parent *Window, flags DialogFlags, file *gio.File) (*AppChooserDialog, error) { -// var gfile *C.GFile -// if file != nil { -// gfile = (*C.GFile)(unsafe.Pointer(file.Native())) -// } -// c := C.gtk_app_chooser_dialog_new(parent.native(), C.GtkDialogFlags(flags), gfile) -// if c == nil { -// return nil, nilPtrErr -// } -// return wrapAppChooserDialog(glib.Take(unsafe.Pointer(c))), nil -// } - -// AppChooserDialogNewForContentType() is a wrapper around gtk_app_chooser_dialog_new_for_content_type(). -func AppChooserDialogNewForContentType(parent *Window, flags DialogFlags, content_type string) (*AppChooserDialog, error) { - cstr := C.CString(content_type) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_app_chooser_dialog_new_for_content_type(parent.native(), C.GtkDialogFlags(flags), (*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapAppChooserDialog(glib.Take(unsafe.Pointer(c))), nil -} - -// GetWidget() is a wrapper around gtk_app_chooser_dialog_get_widget(). -func (v *AppChooserDialog) GetWidget() *AppChooserWidget { - c := C.gtk_app_chooser_dialog_get_widget(v.native()) - return wrapAppChooserWidget(glib.Take(unsafe.Pointer(c))) -} - -// GetHeading() is a wrapper around gtk_app_chooser_dialog_get_heading(). -// In case when gtk_app_chooser_dialog_get_heading() returns a nil string, -// GetHeading() returns a non-nil error. -func (v *AppChooserDialog) GetHeading() (string, error) { - cstr := C.gtk_app_chooser_dialog_get_heading(v.native()) - if cstr == nil { - return "", nilPtrErr - } - defer C.free(unsafe.Pointer(cstr)) - return C.GoString((*C.char)(cstr)), nil -} - -// SetHeading() is a wrapper around gtk_app_chooser_dialog_set_heading(). -func (v *AppChooserDialog) SetHeading(heading string) { - cstr := C.CString(heading) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_app_chooser_dialog_set_heading(v.native(), (*C.gchar)(cstr)) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/application.go b/vendor/github.com/gotk3/gotk3/gtk/application.go deleted file mode 100644 index 8b30707..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/application.go +++ /dev/null @@ -1,158 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains style related functions and structures - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "runtime" - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -// ApplicationInhibitFlags is a representation of GTK's GtkApplicationInhibitFlags. -type ApplicationInhibitFlags int - -const ( - APPLICATION_INHIBIT_LOGOUT ApplicationInhibitFlags = C.GTK_APPLICATION_INHIBIT_LOGOUT - APPLICATION_INHIBIT_SWITCH ApplicationInhibitFlags = C.GTK_APPLICATION_INHIBIT_SWITCH - APPLICATION_INHIBIT_SUSPEND ApplicationInhibitFlags = C.GTK_APPLICATION_INHIBIT_SUSPEND - APPLICATION_INHIBIT_IDLE ApplicationInhibitFlags = C.GTK_APPLICATION_INHIBIT_IDLE -) - -/* - * GtkApplication - */ - -// Application is a representation of GTK's GtkApplication. -type Application struct { - glib.Application -} - -// native returns a pointer to the underlying GtkApplication. -func (v *Application) native() *C.GtkApplication { - if v == nil || v.GObject == nil { - return nil - } - return C.toGtkApplication(unsafe.Pointer(v.GObject)) -} - -func marshalApplication(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapApplication(obj), nil -} - -func wrapApplication(obj *glib.Object) *Application { - am := &glib.ActionMap{obj} - ag := &glib.ActionGroup{obj} - return &Application{glib.Application{obj, am, ag}} -} - -// ApplicationNew is a wrapper around gtk_application_new(). -func ApplicationNew(appId string, flags glib.ApplicationFlags) (*Application, error) { - cstr := (*C.gchar)(C.CString(appId)) - defer C.free(unsafe.Pointer(cstr)) - - c := C.gtk_application_new(cstr, C.GApplicationFlags(flags)) - if c == nil { - return nil, nilPtrErr - } - return wrapApplication(glib.Take(unsafe.Pointer(c))), nil -} - -// AddWindow is a wrapper around gtk_application_add_window(). -func (v *Application) AddWindow(w *Window) { - C.gtk_application_add_window(v.native(), w.native()) -} - -// RemoveWindow is a wrapper around gtk_application_remove_window(). -func (v *Application) RemoveWindow(w *Window) { - C.gtk_application_remove_window(v.native(), w.native()) -} - -// GetWindowByID is a wrapper around gtk_application_get_window_by_id(). -func (v *Application) GetWindowByID(id uint) *Window { - c := C.gtk_application_get_window_by_id(v.native(), C.guint(id)) - if c == nil { - return nil - } - return wrapWindow(glib.Take(unsafe.Pointer(c))) -} - -// GetActiveWindow is a wrapper around gtk_application_get_active_window(). -func (v *Application) GetActiveWindow() *Window { - c := C.gtk_application_get_active_window(v.native()) - if c == nil { - return nil - } - return wrapWindow(glib.Take(unsafe.Pointer(c))) -} - -// Uninhibit is a wrapper around gtk_application_uninhibit(). -func (v *Application) Uninhibit(cookie uint) { - C.gtk_application_uninhibit(v.native(), C.guint(cookie)) -} - -// GetAppMenu is a wrapper around gtk_application_get_app_menu(). -func (v *Application) GetAppMenu() *glib.MenuModel { - c := C.gtk_application_get_app_menu(v.native()) - if c == nil { - return nil - } - return &glib.MenuModel{glib.Take(unsafe.Pointer(c))} -} - -// SetAppMenu is a wrapper around gtk_application_set_app_menu(). -func (v *Application) SetAppMenu(m *glib.MenuModel) { - mptr := (*C.GMenuModel)(unsafe.Pointer(m.Native())) - C.gtk_application_set_app_menu(v.native(), mptr) -} - -// GetMenubar is a wrapper around gtk_application_get_menubar(). -func (v *Application) GetMenubar() *glib.MenuModel { - c := C.gtk_application_get_menubar(v.native()) - if c == nil { - return nil - } - return &glib.MenuModel{glib.Take(unsafe.Pointer(c))} -} - -// SetMenubar is a wrapper around gtk_application_set_menubar(). -func (v *Application) SetMenubar(m *glib.MenuModel) { - mptr := (*C.GMenuModel)(unsafe.Pointer(m.Native())) - C.gtk_application_set_menubar(v.native(), mptr) -} - -// IsInhibited is a wrapper around gtk_application_is_inhibited(). -func (v *Application) IsInhibited(flags ApplicationInhibitFlags) bool { - return gobool(C.gtk_application_is_inhibited(v.native(), C.GtkApplicationInhibitFlags(flags))) -} - -// Inhibited is a wrapper around gtk_application_inhibit(). -func (v *Application) Inhibited(w *Window, flags ApplicationInhibitFlags, reason string) uint { - cstr1 := (*C.gchar)(C.CString(reason)) - defer C.free(unsafe.Pointer(cstr1)) - - return uint(C.gtk_application_inhibit(v.native(), w.native(), C.GtkApplicationInhibitFlags(flags), cstr1)) -} - -// void gtk_application_add_accelerator () // deprecated and uses a gvariant paramater -// void gtk_application_remove_accelerator () // deprecated and uses a gvariant paramater - -// GetWindows is a wrapper around gtk_application_get_windows(). -// Returned list is wrapped to return *gtk.Window elements. -func (v *Application) GetWindows() *glib.List { - glist := C.gtk_application_get_windows(v.native()) - list := glib.WrapList(uintptr(unsafe.Pointer(glist))) - list.DataWrapper(func(ptr unsafe.Pointer) interface{} { - return wrapWindow(glib.Take(ptr)) - }) - runtime.SetFinalizer(list, func(l *glib.List) { - l.Free() - }) - return list -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/application_since_3_12.go b/vendor/github.com/gotk3/gotk3/gtk/application_since_3_12.go deleted file mode 100644 index 1fd55fb..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/application_since_3_12.go +++ /dev/null @@ -1,62 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10 - -// See: https://developer.gnome.org/gtk3/3.12/api-index-3-12.html - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import "unsafe" - -// GetAccelsForAction is a wrapper around gtk_application_get_accels_for_action(). -func (v *Application) GetAccelsForAction(act string) []string { - cstr1 := (*C.gchar)(C.CString(act)) - defer C.free(unsafe.Pointer(cstr1)) - - var descs []string - c := C.gtk_application_get_accels_for_action(v.native(), cstr1) - originalc := c - defer C.g_strfreev(originalc) - - for *c != nil { - descs = append(descs, C.GoString((*C.char)(*c))) - c = C.next_gcharptr(c) - } - - return descs -} - -// SetAccelsForAction is a wrapper around gtk_application_set_accels_for_action(). -func (v *Application) SetAccelsForAction(act string, accels []string) { - cstr1 := (*C.gchar)(C.CString(act)) - defer C.free(unsafe.Pointer(cstr1)) - - caccels := C.make_strings(C.int(len(accels) + 1)) - defer C.destroy_strings(caccels) - - for i, accel := range accels { - cstr := C.CString(accel) - defer C.free(unsafe.Pointer(cstr)) - C.set_string(caccels, C.int(i), (*C.gchar)(cstr)) - } - - C.set_string(caccels, C.int(len(accels)), nil) - - C.gtk_application_set_accels_for_action(v.native(), cstr1, caccels) -} - -// ListActionDescriptions is a wrapper around gtk_application_list_action_descriptions(). -func (v *Application) ListActionDescriptions() []string { - var descs []string - c := C.gtk_application_list_action_descriptions(v.native()) - originalc := c - defer C.g_strfreev(originalc) - - for *c != nil { - descs = append(descs, C.GoString((*C.char)(*c))) - c = C.next_gcharptr(c) - } - - return descs -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/application_since_3_14.go b/vendor/github.com/gotk3/gotk3/gtk/application_since_3_14.go deleted file mode 100644 index 2a93edb..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/application_since_3_14.go +++ /dev/null @@ -1,49 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12 - -// See: https://developer.gnome.org/gtk3/3.14/api-index-3-14.html - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -// PrefersAppMenu is a wrapper around gtk_application_prefers_app_menu(). -func (v *Application) PrefersAppMenu() bool { - return gobool(C.gtk_application_prefers_app_menu(v.native())) -} - -// GetActionsForAccel is a wrapper around gtk_application_get_actions_for_accel(). -func (v *Application) GetActionsForAccel(acc string) []string { - cstr1 := (*C.gchar)(C.CString(acc)) - defer C.free(unsafe.Pointer(cstr1)) - - var acts []string - c := C.gtk_application_get_actions_for_accel(v.native(), cstr1) - originalc := c - defer C.g_strfreev(originalc) - - for *c != nil { - acts = append(acts, C.GoString((*C.char)(*c))) - c = C.next_gcharptr(c) - } - - return acts -} - -// GetMenuByID is a wrapper around gtk_application_get_menu_by_id(). -func (v *Application) GetMenuByID(id string) *glib.Menu { - cstr1 := (*C.gchar)(C.CString(id)) - defer C.free(unsafe.Pointer(cstr1)) - - c := C.gtk_application_get_menu_by_id(v.native(), cstr1) - if c == nil { - return nil - } - return &glib.Menu{glib.MenuModel{glib.Take(unsafe.Pointer(c))}} -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/application_window.go b/vendor/github.com/gotk3/gotk3/gtk/application_window.go deleted file mode 100644 index cc6a295..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/application_window.go +++ /dev/null @@ -1,71 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains style related functions and structures - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -/* - * GtkApplicationWindow - */ - -// ApplicationWindow is a representation of GTK's GtkApplicationWindow. -type ApplicationWindow struct { - Window - - // Interfaces - glib.IActionMap - glib.IActionGroup -} - -// native returns a pointer to the underlying GtkApplicationWindow. -func (v *ApplicationWindow) native() *C.GtkApplicationWindow { - if v == nil || v.Window.GObject == nil { // v.Window is necessary because v.GObject would be ambiguous - return nil - } - p := unsafe.Pointer(v.Window.GObject) - return C.toGtkApplicationWindow(p) -} - -func marshalApplicationWindow(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapApplicationWindow(obj), nil -} - -func wrapApplicationWindow(obj *glib.Object) *ApplicationWindow { - am := &glib.ActionMap{obj} - ag := &glib.ActionGroup{obj} - return &ApplicationWindow{Window{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}}, am, ag} -} - -// ApplicationWindowNew is a wrapper around gtk_application_window_new(). -func ApplicationWindowNew(app *Application) (*ApplicationWindow, error) { - c := C.gtk_application_window_new(app.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapApplicationWindow(glib.Take(unsafe.Pointer(c))), nil -} - -// SetShowMenubar is a wrapper around gtk_application_window_set_show_menubar(). -func (v *ApplicationWindow) SetShowMenubar(b bool) { - C.gtk_application_window_set_show_menubar(v.native(), gbool(b)) -} - -// GetShowMenubar is a wrapper around gtk_application_window_get_show_menubar(). -func (v *ApplicationWindow) GetShowMenubar() bool { - return gobool(C.gtk_application_window_get_show_menubar(v.native())) -} - -// GetID is a wrapper around gtk_application_window_get_id(). -func (v *ApplicationWindow) GetID() uint { - return uint(C.gtk_application_window_get_id(v.native())) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/box_since_3_12.go b/vendor/github.com/gotk3/gotk3/gtk/box_since_3_12.go deleted file mode 100644 index c9e02e2..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/box_since_3_12.go +++ /dev/null @@ -1,53 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10 - -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// This file includes wrapers for symbols included since GTK 3.12, and -// and should not be included in a build intended to target any older GTK -// versions. To target an older build, such as 3.10, use -// 'go build -tags gtk_3_10'. Otherwise, if no build tags are used, GTK 3.12 -// is assumed and this file is built. -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10 - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -//gtk_box_bar_set_center_widget(GtkBox *box,GtkWidget *center_widget) -func (a *Box) SetCenterWidget(child IWidget) { - if child == nil { - C.gtk_box_set_center_widget(a.native(), nil) - } else { - C.gtk_box_set_center_widget(a.native(), child.toWidget()) - } -} - -//gtk_box_bar_get_center_widget(GtkBox *box) -func (a *Box) GetCenterWidget() *Widget { - w := C.gtk_box_get_center_widget(a.native()) - if w == nil { - return nil - } - return &Widget{glib.InitiallyUnowned{glib.Take(unsafe.Pointer(w))}} -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/color_chooser.go b/vendor/github.com/gotk3/gotk3/gtk/color_chooser.go deleted file mode 100644 index c95bb04..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/color_chooser.go +++ /dev/null @@ -1,148 +0,0 @@ -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - {glib.Type(C.gtk_color_chooser_get_type()), marshalColorChooser}, - {glib.Type(C.gtk_color_chooser_dialog_get_type()), marshalColorChooserDialog}, - } - - glib.RegisterGValueMarshalers(tm) - - WrapMap["GtkColorChooser"] = wrapColorChooser - WrapMap["GtkColorChooserDialog"] = wrapColorChooserDialog -} - -/* - * GtkColorChooser - */ - -// ColorChooser is a representation of GTK's GtkColorChooser GInterface. -type ColorChooser struct { - *glib.Object -} - -// IColorChooser is an interface type implemented by all structs -// embedding an ColorChooser. It is meant to be used as an argument type -// for wrapper functions that wrap around a C GTK function taking a -// GtkColorChooser. -type IColorChooser interface { - toColorChooser() *C.GtkColorChooser -} - -// native returns a pointer to the underlying GtkColorChooser. -func (v *ColorChooser) native() *C.GtkColorChooser { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkColorChooser(p) -} - -func marshalColorChooser(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapColorChooser(obj), nil -} - -func wrapColorChooser(obj *glib.Object) *ColorChooser { - return &ColorChooser{obj} -} - -func (v *ColorChooser) toColorChooser() *C.GtkColorChooser { - if v == nil { - return nil - } - return v.native() -} - -// GetRGBA() is a wrapper around gtk_color_chooser_get_rgba(). -func (v *ColorChooser) GetRGBA() *gdk.RGBA { - gdkColor := gdk.NewRGBA() - C.gtk_color_chooser_get_rgba(v.native(), (*C.GdkRGBA)(unsafe.Pointer(gdkColor.Native()))) - return gdkColor -} - -// SetRGBA() is a wrapper around gtk_color_chooser_set_rgba(). -func (v *ColorChooser) SetRGBA(gdkColor *gdk.RGBA) { - C.gtk_color_chooser_set_rgba(v.native(), (*C.GdkRGBA)(unsafe.Pointer(gdkColor.Native()))) -} - -// GetUseAlpha() is a wrapper around gtk_color_chooser_get_use_alpha(). -func (v *ColorChooser) GetUseAlpha() bool { - return gobool(C.gtk_color_chooser_get_use_alpha(v.native())) -} - -// SetUseAlpha() is a wrapper around gtk_color_chooser_set_use_alpha(). -func (v *ColorChooser) SetUseAlpha(use_alpha bool) { - C.gtk_color_chooser_set_use_alpha(v.native(), gbool(use_alpha)) -} - -// AddPalette() is a wrapper around gtk_color_chooser_add_palette(). -func (v *ColorChooser) AddPalette(orientation Orientation, colors_per_line int, colors []*gdk.RGBA) { - n_colors := len(colors) - var c_colors []C.GdkRGBA - for _, c := range colors { - c_colors = append(c_colors, *(*C.GdkRGBA)(unsafe.Pointer(c.Native()))) - } - C.gtk_color_chooser_add_palette( - v.native(), - C.GtkOrientation(orientation), - C.gint(colors_per_line), - C.gint(n_colors), - &c_colors[0], - ) -} - -/* - * GtkColorChooserDialog - */ - -// ColorChooserDialog is a representation of GTK's GtkColorChooserDialog. -type ColorChooserDialog struct { - Dialog - - // Interfaces - ColorChooser -} - -// native returns a pointer to the underlying GtkColorChooserButton. -func (v *ColorChooserDialog) native() *C.GtkColorChooserDialog { - if v == nil || v.GObject == nil { - return nil - } - - p := unsafe.Pointer(v.GObject) - return C.toGtkColorChooserDialog(p) -} - -func marshalColorChooserDialog(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapColorChooserDialog(glib.Take(unsafe.Pointer(c))), nil -} - -func wrapColorChooserDialog(obj *glib.Object) *ColorChooserDialog { - dialog := wrapDialog(obj) - cc := wrapColorChooser(obj) - return &ColorChooserDialog{*dialog, *cc} -} - -// ColorChooserDialogNew() is a wrapper around gtk_color_chooser_dialog_new(). -func ColorChooserDialogNew(title string, parent *Window) (*ColorChooserDialog, error) { - cstr := C.CString(title) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_color_chooser_dialog_new((*C.gchar)(cstr), parent.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapColorChooserDialog(glib.Take(unsafe.Pointer(c))), nil -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/combo_box.go b/vendor/github.com/gotk3/gotk3/gtk/combo_box.go deleted file mode 100644 index e2062da..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/combo_box.go +++ /dev/null @@ -1,272 +0,0 @@ -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "errors" - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - {glib.Type(C.gtk_combo_box_get_type()), marshalComboBox}, - {glib.Type(C.gtk_combo_box_text_get_type()), marshalComboBoxText}, - } - - glib.RegisterGValueMarshalers(tm) - - WrapMap["GtkComboBox"] = wrapComboBox - WrapMap["GtkComboBoxText"] = wrapComboBoxText -} - -/* - * GtkComboBox - */ - -// ComboBox is a representation of GTK's GtkComboBox. -type ComboBox struct { - Bin - - // Interfaces - CellLayout -} - -// native returns a pointer to the underlying GtkComboBox. -func (v *ComboBox) native() *C.GtkComboBox { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkComboBox(p) -} - -func (v *ComboBox) toCellLayout() *C.GtkCellLayout { - if v == nil { - return nil - } - return C.toGtkCellLayout(unsafe.Pointer(v.GObject)) -} - -func marshalComboBox(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapComboBox(obj), nil -} - -func wrapComboBox(obj *glib.Object) *ComboBox { - cl := wrapCellLayout(obj) - return &ComboBox{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}, *cl} -} - -// ComboBoxNew() is a wrapper around gtk_combo_box_new(). -func ComboBoxNew() (*ComboBox, error) { - c := C.gtk_combo_box_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapComboBox(obj), nil -} - -// ComboBoxNewWithEntry() is a wrapper around gtk_combo_box_new_with_entry(). -func ComboBoxNewWithEntry() (*ComboBox, error) { - c := C.gtk_combo_box_new_with_entry() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapComboBox(obj), nil -} - -// ComboBoxNewWithModel() is a wrapper around gtk_combo_box_new_with_model(). -func ComboBoxNewWithModel(model ITreeModel) (*ComboBox, error) { - c := C.gtk_combo_box_new_with_model(model.toTreeModel()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapComboBox(obj), nil -} - -// GetActive() is a wrapper around gtk_combo_box_get_active(). -func (v *ComboBox) GetActive() int { - c := C.gtk_combo_box_get_active(v.native()) - return int(c) -} - -// SetActive() is a wrapper around gtk_combo_box_set_active(). -func (v *ComboBox) SetActive(index int) { - C.gtk_combo_box_set_active(v.native(), C.gint(index)) -} - -// GetActiveIter is a wrapper around gtk_combo_box_get_active_iter(). -func (v *ComboBox) GetActiveIter() (*TreeIter, error) { - var cIter C.GtkTreeIter - c := C.gtk_combo_box_get_active_iter(v.native(), &cIter) - if !gobool(c) { - return nil, errors.New("unable to get active iter") - } - return &TreeIter{cIter}, nil -} - -// SetActiveIter is a wrapper around gtk_combo_box_set_active_iter(). -func (v *ComboBox) SetActiveIter(iter *TreeIter) { - var cIter *C.GtkTreeIter - if iter != nil { - cIter = &iter.GtkTreeIter - } - C.gtk_combo_box_set_active_iter(v.native(), cIter) -} - -// GetActiveID is a wrapper around gtk_combo_box_get_active_id(). -func (v *ComboBox) GetActiveID() string { - c := C.gtk_combo_box_get_active_id(v.native()) - return C.GoString((*C.char)(c)) -} - -// SetActiveID is a wrapper around gtk_combo_box_set_active_id(). -func (v *ComboBox) SetActiveID(id string) bool { - cid := C.CString(id) - defer C.free(unsafe.Pointer(cid)) - c := C.gtk_combo_box_set_active_id(v.native(), (*C.gchar)(cid)) - return gobool(c) -} - -// GetModel is a wrapper around gtk_combo_box_get_model(). -func (v *ComboBox) GetModel() (*TreeModel, error) { - c := C.gtk_combo_box_get_model(v.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapTreeModel(obj), nil -} - -// SetModel is a wrapper around gtk_combo_box_set_model(). -func (v *ComboBox) SetModel(model ITreeModel) { - C.gtk_combo_box_set_model(v.native(), model.toTreeModel()) -} - -func (v *ComboBox) Popup() { - C.gtk_combo_box_popup(v.native()) -} - -func (v *ComboBox) Popdown() { - C.gtk_combo_box_popdown(v.native()) -} - -/* - * GtkComboBoxText - */ - -// ComboBoxText is a representation of GTK's GtkComboBoxText. -type ComboBoxText struct { - ComboBox -} - -// native returns a pointer to the underlying GtkComboBoxText. -func (v *ComboBoxText) native() *C.GtkComboBoxText { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkComboBoxText(p) -} - -func marshalComboBoxText(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapComboBoxText(obj), nil -} - -func wrapComboBoxText(obj *glib.Object) *ComboBoxText { - return &ComboBoxText{*wrapComboBox(obj)} -} - -// ComboBoxTextNew is a wrapper around gtk_combo_box_text_new(). -func ComboBoxTextNew() (*ComboBoxText, error) { - c := C.gtk_combo_box_text_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapComboBoxText(obj), nil -} - -// ComboBoxTextNewWithEntry is a wrapper around gtk_combo_box_text_new_with_entry(). -func ComboBoxTextNewWithEntry() (*ComboBoxText, error) { - c := C.gtk_combo_box_text_new_with_entry() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapComboBoxText(obj), nil -} - -// Append is a wrapper around gtk_combo_box_text_append(). -func (v *ComboBoxText) Append(id, text string) { - cid := C.CString(id) - ctext := C.CString(text) - defer C.free(unsafe.Pointer(cid)) - defer C.free(unsafe.Pointer(ctext)) - C.gtk_combo_box_text_append(v.native(), (*C.gchar)(cid), (*C.gchar)(ctext)) -} - -// Prepend is a wrapper around gtk_combo_box_text_prepend(). -func (v *ComboBoxText) Prepend(id, text string) { - cid := C.CString(id) - ctext := C.CString(text) - defer C.free(unsafe.Pointer(cid)) - defer C.free(unsafe.Pointer(ctext)) - C.gtk_combo_box_text_prepend(v.native(), (*C.gchar)(cid), (*C.gchar)(ctext)) -} - -// Insert is a wrapper around gtk_combo_box_text_insert(). -func (v *ComboBoxText) Insert(position int, id, text string) { - cid := C.CString(id) - ctext := C.CString(text) - defer C.free(unsafe.Pointer(cid)) - defer C.free(unsafe.Pointer(ctext)) - C.gtk_combo_box_text_insert(v.native(), C.gint(position), (*C.gchar)(cid), (*C.gchar)(ctext)) -} - -// AppendText is a wrapper around gtk_combo_box_text_append_text(). -func (v *ComboBoxText) AppendText(text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_combo_box_text_append_text(v.native(), (*C.gchar)(cstr)) -} - -// PrependText is a wrapper around gtk_combo_box_text_prepend_text(). -func (v *ComboBoxText) PrependText(text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_combo_box_text_prepend_text(v.native(), (*C.gchar)(cstr)) -} - -// InsertText is a wrapper around gtk_combo_box_text_insert_text(). -func (v *ComboBoxText) InsertText(position int, text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_combo_box_text_insert_text(v.native(), C.gint(position), (*C.gchar)(cstr)) -} - -// Remove is a wrapper around gtk_combo_box_text_remove(). -func (v *ComboBoxText) Remove(position int) { - C.gtk_combo_box_text_remove(v.native(), C.gint(position)) -} - -// RemoveAll is a wrapper around gtk_combo_box_text_remove_all(). -func (v *ComboBoxText) RemoveAll() { - C.gtk_combo_box_text_remove_all(v.native()) -} - -// GetActiveText is a wrapper around gtk_combo_box_text_get_active_text(). -func (v *ComboBoxText) GetActiveText() string { - c := (*C.char)(C.gtk_combo_box_text_get_active_text(v.native())) - defer C.free(unsafe.Pointer(c)) - return C.GoString(c) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/fixed.go b/vendor/github.com/gotk3/gotk3/gtk/fixed.go deleted file mode 100644 index edf6648..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/fixed.go +++ /dev/null @@ -1,68 +0,0 @@ -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -// #include "fixed.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - {glib.Type(C.gtk_fixed_get_type()), marshalFixed}, - } - - glib.RegisterGValueMarshalers(tm) - - WrapMap["GtkFixed"] = wrapFixed -} - -/* - * GtkFixed - */ - -// Fixed is a representation of GTK's GtkFixed. -type Fixed struct { - Container -} - -func (v *Fixed) native() *C.GtkFixed { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkFixed(p) -} - -func marshalFixed(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapFixed(obj), nil -} - -func wrapFixed(obj *glib.Object) *Fixed { - return &Fixed{Container{Widget{glib.InitiallyUnowned{obj}}}} -} - -// FixedNew is a wrapper around gtk_fixed_new(). -func FixedNew() (*Fixed, error) { - c := C.gtk_fixed_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapFixed(obj), nil -} - -// Put is a wrapper around gtk_fixed_put(). -func (v *Fixed) Put(w IWidget, x, y int) { - C.gtk_fixed_put(v.native(), w.toWidget(), C.gint(x), C.gint(y)) -} - -// Move is a wrapper around gtk_fixed_move(). -func (v *Fixed) Move(w IWidget, x, y int) { - C.gtk_fixed_move(v.native(), w.toWidget(), C.gint(x), C.gint(y)) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/fixed.go.h b/vendor/github.com/gotk3/gotk3/gtk/fixed.go.h deleted file mode 100644 index 6007f53..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/fixed.go.h +++ /dev/null @@ -1,5 +0,0 @@ -static GtkFixed * -toGtkFixed(void *p) -{ - return (GTK_FIXED(p)); -}
\ No newline at end of file diff --git a/vendor/github.com/gotk3/gotk3/gtk/font_chooser.go b/vendor/github.com/gotk3/gotk3/gtk/font_chooser.go deleted file mode 100644 index 270d5f9..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/font_chooser.go +++ /dev/null @@ -1,148 +0,0 @@ -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_font_chooser_get_type()), marshalFontChooser}, - {glib.Type(C.gtk_font_button_get_type()), marshalFontButton}, - } - - glib.RegisterGValueMarshalers(tm) - - WrapMap["GtkFontChooser"] = wrapFontChooser - WrapMap["GtkFontButton"] = wrapFontButton - -} - -/* - * GtkFontChooser - */ - -// FontChooser is a representation of GTK's GtkFontChooser GInterface. -type FontChooser struct { - *glib.Object -} - -// IFontChooser is an interface type implemented by all structs -// embedding an FontChooser. It is meant to be used as an argument type -// for wrapper functions that wrap around a C GTK function taking a -// GtkFontChooser. -type IFontChooser interface { - toFontChooser() *C.GtkFontChooser -} - -// native returns a pointer to the underlying GtkFontChooser. -func (v *FontChooser) native() *C.GtkFontChooser { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkFontChooser(p) -} - -func marshalFontChooser(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapFontChooser(obj), nil -} - -func wrapFontChooser(obj *glib.Object) *FontChooser { - return &FontChooser{obj} -} - -func (v *FontChooser) toFontChooser() *C.GtkFontChooser { - if v == nil { - return nil - } - return v.native() -} - -// GetFont is a wrapper around gtk_font_chooser_get_font(). -func (v *FontChooser) GetFont() string { - c := C.gtk_font_chooser_get_font(v.native()) - return goString(c) -} - -// SetFont is a wrapper around gtk_font_chooser_set_font(). -func (v *FontChooser) SetFont(font string) { - cstr := C.CString(font) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_font_chooser_set_font(v.native(), (*C.gchar)(cstr)) -} - -//PangoFontFamily * gtk_font_chooser_get_font_family () -//PangoFontFace * gtk_font_chooser_get_font_face () -//gint gtk_font_chooser_get_font_size () -//PangoFontDescription * gtk_font_chooser_get_font_desc () -//void gtk_font_chooser_set_font_desc () -//gchar * gtk_font_chooser_get_preview_text () -//void gtk_font_chooser_set_preview_text () -//gboolean gtk_font_chooser_get_show_preview_entry () -//void gtk_font_chooser_set_show_preview_entry () -//gboolean (*GtkFontFilterFunc) () -//void gtk_font_chooser_set_filter_func () -//void gtk_font_chooser_set_font_map () -//PangoFontMap * gtk_font_chooser_get_font_map () - -/* - * GtkFontButton - */ - -// FontButton is a representation of GTK's GtkFontButton. -type FontButton struct { - Button - - // Interfaces - FontChooser -} - -// native returns a pointer to the underlying GtkFontButton. -func (v *FontButton) native() *C.GtkFontButton { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkFontButton(p) -} - -func marshalFontButton(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapFontButton(obj), nil -} - -func wrapFontButton(obj *glib.Object) *FontButton { - button := wrapButton(obj) - fc := wrapFontChooser(obj) - return &FontButton{*button, *fc} -} - -// FontButtonNew is a wrapper around gtk_font_button_new(). -func FontButtonNew() (*FontButton, error) { - c := C.gtk_font_button_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapFontButton(obj), nil -} - -// FontButtonNewWithFont is a wrapper around gtk_font_button_new_with_font(). -func FontButtonNewWithFont(fontname string) (*FontButton, error) { - cstr := C.CString(fontname) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_font_button_new_with_font((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapFontButton(obj), nil -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gdk.go b/vendor/github.com/gotk3/gotk3/gtk/gdk.go deleted file mode 100644 index 901a6f7..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gdk.go +++ /dev/null @@ -1,20 +0,0 @@ -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import "github.com/gotk3/gotk3/gdk" - -func nativeGdkRectangle(rect gdk.Rectangle) *C.GdkRectangle { - // Note: Here we can't use rect.GdkRectangle because it would return - // C type prefixed with gdk package. A ways how to resolve this Go - // issue with same C structs in different Go packages is documented - // here https://github.com/golang/go/issues/13467 . - // This is the easiest way how to resolve the problem. - return &C.GdkRectangle{ - x: C.int(rect.GetX()), - y: C.int(rect.GetY()), - width: C.int(rect.GetWidth()), - height: C.int(rect.GetHeight()), - } -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk.go b/vendor/github.com/gotk3/gotk3/gtk/gtk.go deleted file mode 100644 index 3ed6ca0..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk.go +++ /dev/null @@ -1,8935 +0,0 @@ -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// Go bindings for GTK+ 3. Supports version 3.6 and later. -// -// Functions use the same names as the native C function calls, but use -// CamelCase. In cases where native GTK uses pointers to values to -// simulate multiple return values, Go's native multiple return values -// are used instead. Whenever a native GTK call could return an -// unexpected NULL pointer, an additional error is returned in the Go -// binding. -// -// GTK's C API documentation can be very useful for understanding how the -// functions in this package work and what each type is for. This -// documentation can be found at https://developer.gnome.org/gtk3/. -// -// In addition to Go versions of the C GTK functions, every struct type -// includes a method named Native (either by direct implementation, or -// by means of struct embedding). These methods return a uintptr of the -// native C object the binding type represents. These pointers may be -// type switched to a native C pointer using unsafe and used with cgo -// function calls outside this package. -// -// Memory management is handled in proper Go fashion, using runtime -// finalizers to properly free memory when it is no longer needed. Each -// time a Go type is created with a pointer to a GObject, a reference is -// added for Go, sinking the floating reference when necessary. After -// going out of scope and the next time Go's garbage collector is run, a -// finalizer is run to remove Go's reference to the GObject. When this -// reference count hits zero (when neither Go nor GTK holds ownership) -// the object will be freed internally by GTK. -package gtk - -// #cgo pkg-config: gdk-3.0 gio-2.0 glib-2.0 gobject-2.0 gtk+-3.0 -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "errors" - "fmt" - "reflect" - "runtime" - "sync" - "unsafe" - - "github.com/gotk3/gotk3/cairo" - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - // Enums - {glib.Type(C.gtk_align_get_type()), marshalAlign}, - {glib.Type(C.gtk_accel_flags_get_type()), marshalAccelFlags}, - {glib.Type(C.gtk_accel_group_get_type()), marshalAccelGroup}, - {glib.Type(C.gtk_accel_map_get_type()), marshalAccelMap}, - {glib.Type(C.gtk_arrow_placement_get_type()), marshalArrowPlacement}, - {glib.Type(C.gtk_arrow_type_get_type()), marshalArrowType}, - {glib.Type(C.gtk_assistant_page_type_get_type()), marshalAssistantPageType}, - {glib.Type(C.gtk_buttons_type_get_type()), marshalButtonsType}, - {glib.Type(C.gtk_calendar_display_options_get_type()), marshalCalendarDisplayOptions}, - {glib.Type(C.gtk_dest_defaults_get_type()), marshalDestDefaults}, - {glib.Type(C.gtk_dialog_flags_get_type()), marshalDialogFlags}, - {glib.Type(C.gtk_entry_icon_position_get_type()), marshalEntryIconPosition}, - {glib.Type(C.gtk_file_chooser_action_get_type()), marshalFileChooserAction}, - {glib.Type(C.gtk_icon_lookup_flags_get_type()), marshalSortType}, - {glib.Type(C.gtk_icon_size_get_type()), marshalIconSize}, - {glib.Type(C.gtk_image_type_get_type()), marshalImageType}, - {glib.Type(C.gtk_input_hints_get_type()), marshalInputHints}, - {glib.Type(C.gtk_input_purpose_get_type()), marshalInputPurpose}, - {glib.Type(C.gtk_justification_get_type()), marshalJustification}, - {glib.Type(C.gtk_license_get_type()), marshalLicense}, - {glib.Type(C.gtk_message_type_get_type()), marshalMessageType}, - {glib.Type(C.gtk_orientation_get_type()), marshalOrientation}, - {glib.Type(C.gtk_pack_type_get_type()), marshalPackType}, - {glib.Type(C.gtk_path_type_get_type()), marshalPathType}, - {glib.Type(C.gtk_policy_type_get_type()), marshalPolicyType}, - {glib.Type(C.gtk_position_type_get_type()), marshalPositionType}, - {glib.Type(C.gtk_relief_style_get_type()), marshalReliefStyle}, - {glib.Type(C.gtk_response_type_get_type()), marshalResponseType}, - {glib.Type(C.gtk_selection_mode_get_type()), marshalSelectionMode}, - {glib.Type(C.gtk_shadow_type_get_type()), marshalShadowType}, - {glib.Type(C.gtk_sort_type_get_type()), marshalSortType}, - {glib.Type(C.gtk_state_flags_get_type()), marshalStateFlags}, - {glib.Type(C.gtk_target_flags_get_type()), marshalTargetFlags}, - {glib.Type(C.gtk_text_direction_get_type()), marshalTextDirection}, - {glib.Type(C.gtk_toolbar_style_get_type()), marshalToolbarStyle}, - {glib.Type(C.gtk_tree_model_flags_get_type()), marshalTreeModelFlags}, - {glib.Type(C.gtk_window_position_get_type()), marshalWindowPosition}, - {glib.Type(C.gtk_window_type_get_type()), marshalWindowType}, - {glib.Type(C.gtk_wrap_mode_get_type()), marshalWrapMode}, - - // Objects/Interfaces - {glib.Type(C.gtk_accel_group_get_type()), marshalAccelGroup}, - {glib.Type(C.gtk_accel_map_get_type()), marshalAccelMap}, - {glib.Type(C.gtk_adjustment_get_type()), marshalAdjustment}, - {glib.Type(C.gtk_application_get_type()), marshalApplication}, - {glib.Type(C.gtk_application_window_get_type()), marshalApplicationWindow}, - {glib.Type(C.gtk_assistant_get_type()), marshalAssistant}, - {glib.Type(C.gtk_bin_get_type()), marshalBin}, - {glib.Type(C.gtk_builder_get_type()), marshalBuilder}, - {glib.Type(C.gtk_button_get_type()), marshalButton}, - {glib.Type(C.gtk_box_get_type()), marshalBox}, - {glib.Type(C.gtk_calendar_get_type()), marshalCalendar}, - {glib.Type(C.gtk_cell_layout_get_type()), marshalCellLayout}, - {glib.Type(C.gtk_cell_renderer_get_type()), marshalCellRenderer}, - {glib.Type(C.gtk_cell_renderer_spinner_get_type()), marshalCellRendererSpinner}, - {glib.Type(C.gtk_cell_renderer_pixbuf_get_type()), marshalCellRendererPixbuf}, - {glib.Type(C.gtk_cell_renderer_text_get_type()), marshalCellRendererText}, - {glib.Type(C.gtk_cell_renderer_toggle_get_type()), marshalCellRendererToggle}, - {glib.Type(C.gtk_check_button_get_type()), marshalCheckButton}, - {glib.Type(C.gtk_check_menu_item_get_type()), marshalCheckMenuItem}, - {glib.Type(C.gtk_clipboard_get_type()), marshalClipboard}, - {glib.Type(C.gtk_container_get_type()), marshalContainer}, - {glib.Type(C.gtk_dialog_get_type()), marshalDialog}, - {glib.Type(C.gtk_drawing_area_get_type()), marshalDrawingArea}, - {glib.Type(C.gtk_editable_get_type()), marshalEditable}, - {glib.Type(C.gtk_entry_get_type()), marshalEntry}, - {glib.Type(C.gtk_entry_buffer_get_type()), marshalEntryBuffer}, - {glib.Type(C.gtk_entry_completion_get_type()), marshalEntryCompletion}, - {glib.Type(C.gtk_event_box_get_type()), marshalEventBox}, - {glib.Type(C.gtk_expander_get_type()), marshalExpander}, - {glib.Type(C.gtk_file_chooser_get_type()), marshalFileChooser}, - {glib.Type(C.gtk_file_chooser_button_get_type()), marshalFileChooserButton}, - {glib.Type(C.gtk_file_chooser_dialog_get_type()), marshalFileChooserDialog}, - {glib.Type(C.gtk_file_chooser_widget_get_type()), marshalFileChooserWidget}, - {glib.Type(C.gtk_frame_get_type()), marshalFrame}, - {glib.Type(C.gtk_aspect_frame_get_type()), marshalAspectFrame}, - {glib.Type(C.gtk_grid_get_type()), marshalGrid}, - {glib.Type(C.gtk_icon_view_get_type()), marshalIconView}, - {glib.Type(C.gtk_image_get_type()), marshalImage}, - {glib.Type(C.gtk_label_get_type()), marshalLabel}, - {glib.Type(C.gtk_link_button_get_type()), marshalLinkButton}, - {glib.Type(C.gtk_layout_get_type()), marshalLayout}, - {glib.Type(C.gtk_list_store_get_type()), marshalListStore}, - {glib.Type(C.gtk_menu_get_type()), marshalMenu}, - {glib.Type(C.gtk_menu_bar_get_type()), marshalMenuBar}, - {glib.Type(C.gtk_menu_button_get_type()), marshalMenuButton}, - {glib.Type(C.gtk_menu_item_get_type()), marshalMenuItem}, - {glib.Type(C.gtk_menu_shell_get_type()), marshalMenuShell}, - {glib.Type(C.gtk_message_dialog_get_type()), marshalMessageDialog}, - {glib.Type(C.gtk_notebook_get_type()), marshalNotebook}, - {glib.Type(C.gtk_offscreen_window_get_type()), marshalOffscreenWindow}, - {glib.Type(C.gtk_orientable_get_type()), marshalOrientable}, - {glib.Type(C.gtk_overlay_get_type()), marshalOverlay}, - {glib.Type(C.gtk_paned_get_type()), marshalPaned}, - {glib.Type(C.gtk_progress_bar_get_type()), marshalProgressBar}, - {glib.Type(C.gtk_radio_button_get_type()), marshalRadioButton}, - {glib.Type(C.gtk_radio_menu_item_get_type()), marshalRadioMenuItem}, - {glib.Type(C.gtk_range_get_type()), marshalRange}, - {glib.Type(C.gtk_scale_button_get_type()), marshalScaleButton}, - {glib.Type(C.gtk_scale_get_type()), marshalScale}, - {glib.Type(C.gtk_scrollbar_get_type()), marshalScrollbar}, - {glib.Type(C.gtk_scrolled_window_get_type()), marshalScrolledWindow}, - {glib.Type(C.gtk_search_entry_get_type()), marshalSearchEntry}, - //{glib.Type(C.gtk_selection_data_get_type()), marshalSelectionData}, - {glib.Type(C.gtk_separator_get_type()), marshalSeparator}, - {glib.Type(C.gtk_separator_menu_item_get_type()), marshalSeparatorMenuItem}, - {glib.Type(C.gtk_separator_tool_item_get_type()), marshalSeparatorToolItem}, - {glib.Type(C.gtk_spin_button_get_type()), marshalSpinButton}, - {glib.Type(C.gtk_spinner_get_type()), marshalSpinner}, - {glib.Type(C.gtk_statusbar_get_type()), marshalStatusbar}, - {glib.Type(C.gtk_switch_get_type()), marshalSwitch}, - {glib.Type(C.gtk_text_view_get_type()), marshalTextView}, - {glib.Type(C.gtk_text_tag_get_type()), marshalTextTag}, - {glib.Type(C.gtk_text_tag_table_get_type()), marshalTextTagTable}, - {glib.Type(C.gtk_text_buffer_get_type()), marshalTextBuffer}, - {glib.Type(C.gtk_toggle_button_get_type()), marshalToggleButton}, - {glib.Type(C.gtk_toolbar_get_type()), marshalToolbar}, - {glib.Type(C.gtk_tool_button_get_type()), marshalToolButton}, - {glib.Type(C.gtk_tool_item_get_type()), marshalToolItem}, - {glib.Type(C.gtk_tooltip_get_type()), marshalTooltip}, - {glib.Type(C.gtk_tree_model_get_type()), marshalTreeModel}, - {glib.Type(C.gtk_tree_selection_get_type()), marshalTreeSelection}, - {glib.Type(C.gtk_tree_store_get_type()), marshalTreeStore}, - {glib.Type(C.gtk_tree_view_get_type()), marshalTreeView}, - {glib.Type(C.gtk_tree_view_column_get_type()), marshalTreeViewColumn}, - {glib.Type(C.gtk_volume_button_get_type()), marshalVolumeButton}, - {glib.Type(C.gtk_widget_get_type()), marshalWidget}, - {glib.Type(C.gtk_window_get_type()), marshalWindow}, - - // Boxed - {glib.Type(C.gtk_target_entry_get_type()), marshalTargetEntry}, - {glib.Type(C.gtk_text_iter_get_type()), marshalTextIter}, - {glib.Type(C.gtk_text_mark_get_type()), marshalTextMark}, - {glib.Type(C.gtk_tree_iter_get_type()), marshalTreeIter}, - {glib.Type(C.gtk_tree_path_get_type()), marshalTreePath}, - } - glib.RegisterGValueMarshalers(tm) -} - -/* - * Type conversions - */ - -func gbool(b bool) C.gboolean { - if b { - return C.gboolean(1) - } - return C.gboolean(0) -} - -func gobool(b C.gboolean) bool { - return b != C.FALSE -} - -func cGSList(clist *glib.SList) *C.GSList { - if clist == nil { - return nil - } - return (*C.GSList)(unsafe.Pointer(clist.Native())) -} - -func free(str ...interface{}) { - for _, s := range str { - switch x := s.(type) { - case *C.char: - C.free(unsafe.Pointer(x)) - case []*C.char: - for _, cp := range x { - C.free(unsafe.Pointer(cp)) - } - /* - case C.gpointer: - C.g_free(C.gpointer(c)) - */ - default: - fmt.Printf("utils.go free(): Unknown type: %T\n", x) - } - - } -} - -func goString(cstr *C.gchar) string { - return C.GoString((*C.char)(cstr)) -} - -// Wrapper function for TestBoolConvs since cgo can't be used with -// testing package -func testBoolConvs() error { - b := gobool(gbool(true)) - if b != true { - return errors.New("Unexpected bool conversion result") - } - - cb := gbool(gobool(C.gboolean(0))) - if cb != C.gboolean(0) { - return errors.New("Unexpected bool conversion result") - } - - return nil -} - -/* - * Unexported vars - */ - -var nilPtrErr = errors.New("cgo returned unexpected nil pointer") - -/* - * Constants - */ - -// Align is a representation of GTK's GtkAlign. -type Align int - -const ( - ALIGN_FILL Align = C.GTK_ALIGN_FILL - ALIGN_START Align = C.GTK_ALIGN_START - ALIGN_END Align = C.GTK_ALIGN_END - ALIGN_CENTER Align = C.GTK_ALIGN_CENTER -) - -func marshalAlign(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return Align(c), nil -} - -// ArrowPlacement is a representation of GTK's GtkArrowPlacement. -type ArrowPlacement int - -const ( - ARROWS_BOTH ArrowPlacement = C.GTK_ARROWS_BOTH - ARROWS_START ArrowPlacement = C.GTK_ARROWS_START - ARROWS_END ArrowPlacement = C.GTK_ARROWS_END -) - -func marshalArrowPlacement(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return ArrowPlacement(c), nil -} - -// ArrowType is a representation of GTK's GtkArrowType. -type ArrowType int - -const ( - ARROW_UP ArrowType = C.GTK_ARROW_UP - ARROW_DOWN ArrowType = C.GTK_ARROW_DOWN - ARROW_LEFT ArrowType = C.GTK_ARROW_LEFT - ARROW_RIGHT ArrowType = C.GTK_ARROW_RIGHT - ARROW_NONE ArrowType = C.GTK_ARROW_NONE -) - -func marshalArrowType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return ArrowType(c), nil -} - -// AssistantPageType is a representation of GTK's GtkAssistantPageType. -type AssistantPageType int - -const ( - ASSISTANT_PAGE_CONTENT AssistantPageType = C.GTK_ASSISTANT_PAGE_CONTENT - ASSISTANT_PAGE_INTRO AssistantPageType = C.GTK_ASSISTANT_PAGE_INTRO - ASSISTANT_PAGE_CONFIRM AssistantPageType = C.GTK_ASSISTANT_PAGE_CONFIRM - ASSISTANT_PAGE_SUMMARY AssistantPageType = C.GTK_ASSISTANT_PAGE_SUMMARY - ASSISTANT_PAGE_PROGRESS AssistantPageType = C.GTK_ASSISTANT_PAGE_PROGRESS - ASSISTANT_PAGE_CUSTOM AssistantPageType = C.GTK_ASSISTANT_PAGE_CUSTOM -) - -func marshalAssistantPageType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return AssistantPageType(c), nil -} - -// ButtonsType is a representation of GTK's GtkButtonsType. -type ButtonsType int - -const ( - BUTTONS_NONE ButtonsType = C.GTK_BUTTONS_NONE - BUTTONS_OK ButtonsType = C.GTK_BUTTONS_OK - BUTTONS_CLOSE ButtonsType = C.GTK_BUTTONS_CLOSE - BUTTONS_CANCEL ButtonsType = C.GTK_BUTTONS_CANCEL - BUTTONS_YES_NO ButtonsType = C.GTK_BUTTONS_YES_NO - BUTTONS_OK_CANCEL ButtonsType = C.GTK_BUTTONS_OK_CANCEL -) - -func marshalButtonsType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return ButtonsType(c), nil -} - -// CalendarDisplayOptions is a representation of GTK's GtkCalendarDisplayOptions -type CalendarDisplayOptions int - -const ( - CALENDAR_SHOW_HEADING CalendarDisplayOptions = C.GTK_CALENDAR_SHOW_HEADING - CALENDAR_SHOW_DAY_NAMES CalendarDisplayOptions = C.GTK_CALENDAR_SHOW_DAY_NAMES - CALENDAR_NO_MONTH_CHANGE CalendarDisplayOptions = C.GTK_CALENDAR_NO_MONTH_CHANGE - CALENDAR_SHOW_WEEK_NUMBERS CalendarDisplayOptions = C.GTK_CALENDAR_SHOW_WEEK_NUMBERS - CALENDAR_SHOW_DETAILS CalendarDisplayOptions = C.GTK_CALENDAR_SHOW_DETAILS -) - -func marshalCalendarDisplayOptions(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return CalendarDisplayOptions(c), nil -} - -// DestDefaults is a representation of GTK's GtkDestDefaults. -type DestDefaults int - -const ( - DEST_DEFAULT_MOTION DestDefaults = C.GTK_DEST_DEFAULT_MOTION - DEST_DEFAULT_HIGHLIGHT DestDefaults = C.GTK_DEST_DEFAULT_HIGHLIGHT - DEST_DEFAULT_DROP DestDefaults = C.GTK_DEST_DEFAULT_DROP - DEST_DEFAULT_ALL DestDefaults = C.GTK_DEST_DEFAULT_ALL -) - -func marshalDestDefaults(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return DestDefaults(c), nil -} - -// DialogFlags is a representation of GTK's GtkDialogFlags. -type DialogFlags int - -const ( - DIALOG_MODAL DialogFlags = C.GTK_DIALOG_MODAL - DIALOG_DESTROY_WITH_PARENT DialogFlags = C.GTK_DIALOG_DESTROY_WITH_PARENT -) - -func marshalDialogFlags(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return DialogFlags(c), nil -} - -// EntryIconPosition is a representation of GTK's GtkEntryIconPosition. -type EntryIconPosition int - -const ( - ENTRY_ICON_PRIMARY EntryIconPosition = C.GTK_ENTRY_ICON_PRIMARY - ENTRY_ICON_SECONDARY EntryIconPosition = C.GTK_ENTRY_ICON_SECONDARY -) - -func marshalEntryIconPosition(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return EntryIconPosition(c), nil -} - -// FileChooserAction is a representation of GTK's GtkFileChooserAction. -type FileChooserAction int - -const ( - FILE_CHOOSER_ACTION_OPEN FileChooserAction = C.GTK_FILE_CHOOSER_ACTION_OPEN - FILE_CHOOSER_ACTION_SAVE FileChooserAction = C.GTK_FILE_CHOOSER_ACTION_SAVE - FILE_CHOOSER_ACTION_SELECT_FOLDER FileChooserAction = C.GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER - FILE_CHOOSER_ACTION_CREATE_FOLDER FileChooserAction = C.GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER -) - -func marshalFileChooserAction(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return FileChooserAction(c), nil -} - -// IconLookupFlags is a representation of GTK's GtkIconLookupFlags. -type IconLookupFlags int - -const ( - ICON_LOOKUP_NO_SVG IconLookupFlags = C.GTK_ICON_LOOKUP_NO_SVG - ICON_LOOKUP_FORCE_SVG = C.GTK_ICON_LOOKUP_FORCE_SVG - ICON_LOOKUP_USE_BUILTIN = C.GTK_ICON_LOOKUP_USE_BUILTIN - ICON_LOOKUP_GENERIC_FALLBACK = C.GTK_ICON_LOOKUP_GENERIC_FALLBACK - ICON_LOOKUP_FORCE_SIZE = C.GTK_ICON_LOOKUP_FORCE_SIZE -) - -func marshalIconLookupFlags(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return IconLookupFlags(c), nil -} - -// IconSize is a representation of GTK's GtkIconSize. -type IconSize int - -const ( - ICON_SIZE_INVALID IconSize = C.GTK_ICON_SIZE_INVALID - ICON_SIZE_MENU IconSize = C.GTK_ICON_SIZE_MENU - ICON_SIZE_SMALL_TOOLBAR IconSize = C.GTK_ICON_SIZE_SMALL_TOOLBAR - ICON_SIZE_LARGE_TOOLBAR IconSize = C.GTK_ICON_SIZE_LARGE_TOOLBAR - ICON_SIZE_BUTTON IconSize = C.GTK_ICON_SIZE_BUTTON - ICON_SIZE_DND IconSize = C.GTK_ICON_SIZE_DND - ICON_SIZE_DIALOG IconSize = C.GTK_ICON_SIZE_DIALOG -) - -func marshalIconSize(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return IconSize(c), nil -} - -// ImageType is a representation of GTK's GtkImageType. -type ImageType int - -const ( - IMAGE_EMPTY ImageType = C.GTK_IMAGE_EMPTY - IMAGE_PIXBUF ImageType = C.GTK_IMAGE_PIXBUF - IMAGE_STOCK ImageType = C.GTK_IMAGE_STOCK - IMAGE_ICON_SET ImageType = C.GTK_IMAGE_ICON_SET - IMAGE_ANIMATION ImageType = C.GTK_IMAGE_ANIMATION - IMAGE_ICON_NAME ImageType = C.GTK_IMAGE_ICON_NAME - IMAGE_GICON ImageType = C.GTK_IMAGE_GICON -) - -func marshalImageType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return ImageType(c), nil -} - -// InputHints is a representation of GTK's GtkInputHints. -type InputHints int - -const ( - INPUT_HINT_NONE InputHints = C.GTK_INPUT_HINT_NONE - INPUT_HINT_SPELLCHECK InputHints = C.GTK_INPUT_HINT_SPELLCHECK - INPUT_HINT_NO_SPELLCHECK InputHints = C.GTK_INPUT_HINT_NO_SPELLCHECK - INPUT_HINT_WORD_COMPLETION InputHints = C.GTK_INPUT_HINT_WORD_COMPLETION - INPUT_HINT_LOWERCASE InputHints = C.GTK_INPUT_HINT_LOWERCASE - INPUT_HINT_UPPERCASE_CHARS InputHints = C.GTK_INPUT_HINT_UPPERCASE_CHARS - INPUT_HINT_UPPERCASE_WORDS InputHints = C.GTK_INPUT_HINT_UPPERCASE_WORDS - INPUT_HINT_UPPERCASE_SENTENCES InputHints = C.GTK_INPUT_HINT_UPPERCASE_SENTENCES - INPUT_HINT_INHIBIT_OSK InputHints = C.GTK_INPUT_HINT_INHIBIT_OSK -) - -func marshalInputHints(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return InputHints(c), nil -} - -// InputPurpose is a representation of GTK's GtkInputPurpose. -type InputPurpose int - -const ( - INPUT_PURPOSE_FREE_FORM InputPurpose = C.GTK_INPUT_PURPOSE_FREE_FORM - INPUT_PURPOSE_ALPHA InputPurpose = C.GTK_INPUT_PURPOSE_ALPHA - INPUT_PURPOSE_DIGITS InputPurpose = C.GTK_INPUT_PURPOSE_DIGITS - INPUT_PURPOSE_NUMBER InputPurpose = C.GTK_INPUT_PURPOSE_NUMBER - INPUT_PURPOSE_PHONE InputPurpose = C.GTK_INPUT_PURPOSE_PHONE - INPUT_PURPOSE_URL InputPurpose = C.GTK_INPUT_PURPOSE_URL - INPUT_PURPOSE_EMAIL InputPurpose = C.GTK_INPUT_PURPOSE_EMAIL - INPUT_PURPOSE_NAME InputPurpose = C.GTK_INPUT_PURPOSE_NAME - INPUT_PURPOSE_PASSWORD InputPurpose = C.GTK_INPUT_PURPOSE_PASSWORD - INPUT_PURPOSE_PIN InputPurpose = C.GTK_INPUT_PURPOSE_PIN -) - -func marshalInputPurpose(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return InputPurpose(c), nil -} - -// Justify is a representation of GTK's GtkJustification. -type Justification int - -const ( - JUSTIFY_LEFT Justification = C.GTK_JUSTIFY_LEFT - JUSTIFY_RIGHT Justification = C.GTK_JUSTIFY_RIGHT - JUSTIFY_CENTER Justification = C.GTK_JUSTIFY_CENTER - JUSTIFY_FILL Justification = C.GTK_JUSTIFY_FILL -) - -func marshalJustification(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return Justification(c), nil -} - -// License is a representation of GTK's GtkLicense. -type License int - -const ( - LICENSE_UNKNOWN License = C.GTK_LICENSE_UNKNOWN - LICENSE_CUSTOM License = C.GTK_LICENSE_CUSTOM - LICENSE_GPL_2_0 License = C.GTK_LICENSE_GPL_2_0 - LICENSE_GPL_3_0 License = C.GTK_LICENSE_GPL_3_0 - LICENSE_LGPL_2_1 License = C.GTK_LICENSE_LGPL_2_1 - LICENSE_LGPL_3_0 License = C.GTK_LICENSE_LGPL_3_0 - LICENSE_BSD License = C.GTK_LICENSE_BSD - LICENSE_MIT_X11 License = C.GTK_LICENSE_MIT_X11 - LICENSE_GTK_ARTISTIC License = C.GTK_LICENSE_ARTISTIC -) - -func marshalLicense(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return License(c), nil -} - -// MessageType is a representation of GTK's GtkMessageType. -type MessageType int - -const ( - MESSAGE_INFO MessageType = C.GTK_MESSAGE_INFO - MESSAGE_WARNING MessageType = C.GTK_MESSAGE_WARNING - MESSAGE_QUESTION MessageType = C.GTK_MESSAGE_QUESTION - MESSAGE_ERROR MessageType = C.GTK_MESSAGE_ERROR - MESSAGE_OTHER MessageType = C.GTK_MESSAGE_OTHER -) - -func marshalMessageType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return MessageType(c), nil -} - -// Orientation is a representation of GTK's GtkOrientation. -type Orientation int - -const ( - ORIENTATION_HORIZONTAL Orientation = C.GTK_ORIENTATION_HORIZONTAL - ORIENTATION_VERTICAL Orientation = C.GTK_ORIENTATION_VERTICAL -) - -func marshalOrientation(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return Orientation(c), nil -} - -// PackType is a representation of GTK's GtkPackType. -type PackType int - -const ( - PACK_START PackType = C.GTK_PACK_START - PACK_END PackType = C.GTK_PACK_END -) - -func marshalPackType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return PackType(c), nil -} - -// PathType is a representation of GTK's GtkPathType. -type PathType int - -const ( - PATH_WIDGET PathType = C.GTK_PATH_WIDGET - PATH_WIDGET_CLASS PathType = C.GTK_PATH_WIDGET_CLASS - PATH_CLASS PathType = C.GTK_PATH_CLASS -) - -func marshalPathType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return PathType(c), nil -} - -// PolicyType is a representation of GTK's GtkPolicyType. -type PolicyType int - -const ( - POLICY_ALWAYS PolicyType = C.GTK_POLICY_ALWAYS - POLICY_AUTOMATIC PolicyType = C.GTK_POLICY_AUTOMATIC - POLICY_NEVER PolicyType = C.GTK_POLICY_NEVER -) - -func marshalPolicyType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return PolicyType(c), nil -} - -// PositionType is a representation of GTK's GtkPositionType. -type PositionType int - -const ( - POS_LEFT PositionType = C.GTK_POS_LEFT - POS_RIGHT PositionType = C.GTK_POS_RIGHT - POS_TOP PositionType = C.GTK_POS_TOP - POS_BOTTOM PositionType = C.GTK_POS_BOTTOM -) - -func marshalPositionType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return PositionType(c), nil -} - -// ReliefStyle is a representation of GTK's GtkReliefStyle. -type ReliefStyle int - -const ( - RELIEF_NORMAL ReliefStyle = C.GTK_RELIEF_NORMAL - RELIEF_HALF ReliefStyle = C.GTK_RELIEF_HALF - RELIEF_NONE ReliefStyle = C.GTK_RELIEF_NONE -) - -func marshalReliefStyle(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return ReliefStyle(c), nil -} - -// ResponseType is a representation of GTK's GtkResponseType. -type ResponseType int - -const ( - RESPONSE_NONE ResponseType = C.GTK_RESPONSE_NONE - RESPONSE_REJECT ResponseType = C.GTK_RESPONSE_REJECT - RESPONSE_ACCEPT ResponseType = C.GTK_RESPONSE_ACCEPT - RESPONSE_DELETE_EVENT ResponseType = C.GTK_RESPONSE_DELETE_EVENT - RESPONSE_OK ResponseType = C.GTK_RESPONSE_OK - RESPONSE_CANCEL ResponseType = C.GTK_RESPONSE_CANCEL - RESPONSE_CLOSE ResponseType = C.GTK_RESPONSE_CLOSE - RESPONSE_YES ResponseType = C.GTK_RESPONSE_YES - RESPONSE_NO ResponseType = C.GTK_RESPONSE_NO - RESPONSE_APPLY ResponseType = C.GTK_RESPONSE_APPLY - RESPONSE_HELP ResponseType = C.GTK_RESPONSE_HELP -) - -func marshalResponseType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return ResponseType(c), nil -} - -// SelectionMode is a representation of GTK's GtkSelectionMode. -type SelectionMode int - -const ( - SELECTION_NONE SelectionMode = C.GTK_SELECTION_NONE - SELECTION_SINGLE SelectionMode = C.GTK_SELECTION_SINGLE - SELECTION_BROWSE SelectionMode = C.GTK_SELECTION_BROWSE - SELECTION_MULTIPLE SelectionMode = C.GTK_SELECTION_MULTIPLE -) - -func marshalSelectionMode(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return SelectionMode(c), nil -} - -// ShadowType is a representation of GTK's GtkShadowType. -type ShadowType int - -const ( - SHADOW_NONE ShadowType = C.GTK_SHADOW_NONE - SHADOW_IN ShadowType = C.GTK_SHADOW_IN - SHADOW_OUT ShadowType = C.GTK_SHADOW_OUT - SHADOW_ETCHED_IN ShadowType = C.GTK_SHADOW_ETCHED_IN - SHADOW_ETCHED_OUT ShadowType = C.GTK_SHADOW_ETCHED_OUT -) - -func marshalShadowType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return ShadowType(c), nil -} - -// SizeGroupMode is a representation of GTK's GtkSizeGroupMode -type SizeGroupMode int - -const ( - SIZE_GROUP_NONE SizeGroupMode = C.GTK_SIZE_GROUP_NONE - SIZE_GROUP_HORIZONTAL SizeGroupMode = C.GTK_SIZE_GROUP_HORIZONTAL - SIZE_GROUP_VERTICAL SizeGroupMode = C.GTK_SIZE_GROUP_VERTICAL - SIZE_GROUP_BOTH SizeGroupMode = C.GTK_SIZE_GROUP_BOTH -) - -func marshalSizeGroupMode(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return SizeGroupMode(c), nil -} - -// SortType is a representation of GTK's GtkSortType. -type SortType int - -const ( - SORT_ASCENDING SortType = C.GTK_SORT_ASCENDING - SORT_DESCENDING = C.GTK_SORT_DESCENDING -) - -// Use as column id in SetSortColumnId to specify ListStore sorted -// by default column or unsorted -const ( - SORT_COLUMN_DEFAULT int = -1 - SORT_COLUMN_UNSORTED int = -2 -) - -func marshalSortType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return SortType(c), nil -} - -// StateFlags is a representation of GTK's GtkStateFlags. -type StateFlags int - -const ( - STATE_FLAG_NORMAL StateFlags = C.GTK_STATE_FLAG_NORMAL - STATE_FLAG_ACTIVE StateFlags = C.GTK_STATE_FLAG_ACTIVE - STATE_FLAG_PRELIGHT StateFlags = C.GTK_STATE_FLAG_PRELIGHT - STATE_FLAG_SELECTED StateFlags = C.GTK_STATE_FLAG_SELECTED - STATE_FLAG_INSENSITIVE StateFlags = C.GTK_STATE_FLAG_INSENSITIVE - STATE_FLAG_INCONSISTENT StateFlags = C.GTK_STATE_FLAG_INCONSISTENT - STATE_FLAG_FOCUSED StateFlags = C.GTK_STATE_FLAG_FOCUSED - STATE_FLAG_BACKDROP StateFlags = C.GTK_STATE_FLAG_BACKDROP -) - -func marshalStateFlags(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return StateFlags(c), nil -} - -// TextDirection is a representation of GTK's GtkTextDirection. -type TextDirection int - -const ( - TEXT_DIR_NONE TextDirection = C.GTK_TEXT_DIR_NONE - TEXT_DIR_LTR TextDirection = C.GTK_TEXT_DIR_LTR - TEXT_DIR_RTL TextDirection = C.GTK_TEXT_DIR_RTL -) - -func marshalTextDirection(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return TextDirection(c), nil -} - -// TargetFlags is a representation of GTK's GtkTargetFlags. -type TargetFlags int - -const ( - TARGET_SAME_APP TargetFlags = C.GTK_TARGET_SAME_APP - TARGET_SAME_WIDGET TargetFlags = C.GTK_TARGET_SAME_WIDGET - TARGET_OTHER_APP TargetFlags = C.GTK_TARGET_OTHER_APP - TARGET_OTHER_WIDGET TargetFlags = C.GTK_TARGET_OTHER_WIDGET -) - -func marshalTargetFlags(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return TargetFlags(c), nil -} - -// ToolbarStyle is a representation of GTK's GtkToolbarStyle. -type ToolbarStyle int - -const ( - TOOLBAR_ICONS ToolbarStyle = C.GTK_TOOLBAR_ICONS - TOOLBAR_TEXT ToolbarStyle = C.GTK_TOOLBAR_TEXT - TOOLBAR_BOTH ToolbarStyle = C.GTK_TOOLBAR_BOTH - TOOLBAR_BOTH_HORIZ ToolbarStyle = C.GTK_TOOLBAR_BOTH_HORIZ -) - -func marshalToolbarStyle(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return ToolbarStyle(c), nil -} - -// TreeModelFlags is a representation of GTK's GtkTreeModelFlags. -type TreeModelFlags int - -const ( - TREE_MODEL_ITERS_PERSIST TreeModelFlags = C.GTK_TREE_MODEL_ITERS_PERSIST - TREE_MODEL_LIST_ONLY TreeModelFlags = C.GTK_TREE_MODEL_LIST_ONLY -) - -func marshalTreeModelFlags(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return TreeModelFlags(c), nil -} - -// WindowPosition is a representation of GTK's GtkWindowPosition. -type WindowPosition int - -const ( - WIN_POS_NONE WindowPosition = C.GTK_WIN_POS_NONE - WIN_POS_CENTER WindowPosition = C.GTK_WIN_POS_CENTER - WIN_POS_MOUSE WindowPosition = C.GTK_WIN_POS_MOUSE - WIN_POS_CENTER_ALWAYS WindowPosition = C.GTK_WIN_POS_CENTER_ALWAYS - WIN_POS_CENTER_ON_PARENT WindowPosition = C.GTK_WIN_POS_CENTER_ON_PARENT -) - -func marshalWindowPosition(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return WindowPosition(c), nil -} - -// WindowType is a representation of GTK's GtkWindowType. -type WindowType int - -const ( - WINDOW_TOPLEVEL WindowType = C.GTK_WINDOW_TOPLEVEL - WINDOW_POPUP WindowType = C.GTK_WINDOW_POPUP -) - -func marshalWindowType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return WindowType(c), nil -} - -// WrapMode is a representation of GTK's GtkWrapMode. -type WrapMode int - -const ( - WRAP_NONE WrapMode = C.GTK_WRAP_NONE - WRAP_CHAR WrapMode = C.GTK_WRAP_CHAR - WRAP_WORD WrapMode = C.GTK_WRAP_WORD - WRAP_WORD_CHAR WrapMode = C.GTK_WRAP_WORD_CHAR -) - -func marshalWrapMode(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return WrapMode(c), nil -} - -/* - * Init and main event loop - */ - -/* -Init() is a wrapper around gtk_init() and must be called before any -other GTK calls and is used to initialize everything necessary. - -In addition to setting up GTK for usage, a pointer to a slice of -strings may be passed in to parse standard GTK command line arguments. -args will be modified to remove any flags that were handled. -Alternatively, nil may be passed in to not perform any command line -parsing. -*/ -func Init(args *[]string) { - if args != nil { - argc := C.int(len(*args)) - argv := C.make_strings(argc) - defer C.destroy_strings(argv) - - for i, arg := range *args { - cstr := C.CString(arg) - C.set_string(argv, C.int(i), (*C.gchar)(cstr)) - } - - C.gtk_init((*C.int)(unsafe.Pointer(&argc)), - (***C.char)(unsafe.Pointer(&argv))) - - unhandled := make([]string, argc) - for i := 0; i < int(argc); i++ { - cstr := C.get_string(argv, C.int(i)) - unhandled[i] = goString(cstr) - C.free(unsafe.Pointer(cstr)) - } - *args = unhandled - } else { - C.gtk_init(nil, nil) - } -} - -/* -InitCheck() is a wrapper around gtk_init_check() and works exactly like Init() -only that it doesn't terminate the program if initialization fails. -*/ -func InitCheck(args *[]string) error { - success := false - if args != nil { - argc := C.int(len(*args)) - argv := C.make_strings(argc) - defer C.destroy_strings(argv) - - for i, arg := range *args { - cstr := C.CString(arg) - C.set_string(argv, C.int(i), (*C.gchar)(cstr)) - } - - success = gobool(C.gtk_init_check((*C.int)(unsafe.Pointer(&argc)), - (***C.char)(unsafe.Pointer(&argv)))) - - unhandled := make([]string, argc) - for i := 0; i < int(argc); i++ { - cstr := C.get_string(argv, C.int(i)) - unhandled[i] = goString(cstr) - C.free(unsafe.Pointer(cstr)) - } - *args = unhandled - } else { - success = gobool(C.gtk_init_check(nil, nil)) - } - if success { - return nil - } else { - return errors.New("Unable to initialize GTK") - } -} - -// Main() is a wrapper around gtk_main() and runs the GTK main loop, -// blocking until MainQuit() is called. -func Main() { - C.gtk_main() -} - -// MainIteration is a wrapper around gtk_main_iteration. -func MainIteration() bool { - return gobool(C.gtk_main_iteration()) -} - -// MainIterationDo is a wrapper around gtk_main_iteration_do. -func MainIterationDo(blocking bool) bool { - return gobool(C.gtk_main_iteration_do(gbool(blocking))) -} - -// EventsPending is a wrapper around gtk_events_pending. -func EventsPending() bool { - return gobool(C.gtk_events_pending()) -} - -// MainQuit() is a wrapper around gtk_main_quit() is used to terminate -// the GTK main loop (started by Main()). -func MainQuit() { - C.gtk_main_quit() -} - -/* - * GtkAdjustment - */ - -// Adjustment is a representation of GTK's GtkAdjustment. -type Adjustment struct { - glib.InitiallyUnowned -} - -// native returns a pointer to the underlying GtkAdjustment. -func (v *Adjustment) native() *C.GtkAdjustment { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkAdjustment(p) -} - -func marshalAdjustment(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapAdjustment(obj), nil -} - -func wrapAdjustment(obj *glib.Object) *Adjustment { - return &Adjustment{glib.InitiallyUnowned{obj}} -} - -// AdjustmentNew is a wrapper around gtk_adjustment_new(). -func AdjustmentNew(value, lower, upper, stepIncrement, pageIncrement, pageSize float64) (*Adjustment, error) { - c := C.gtk_adjustment_new(C.gdouble(value), - C.gdouble(lower), - C.gdouble(upper), - C.gdouble(stepIncrement), - C.gdouble(pageIncrement), - C.gdouble(pageSize)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapAdjustment(obj), nil -} - -// GetValue is a wrapper around gtk_adjustment_get_value(). -func (v *Adjustment) GetValue() float64 { - c := C.gtk_adjustment_get_value(v.native()) - return float64(c) -} - -// SetValue is a wrapper around gtk_adjustment_set_value(). -func (v *Adjustment) SetValue(value float64) { - C.gtk_adjustment_set_value(v.native(), C.gdouble(value)) -} - -// GetLower is a wrapper around gtk_adjustment_get_lower(). -func (v *Adjustment) GetLower() float64 { - c := C.gtk_adjustment_get_lower(v.native()) - return float64(c) -} - -// GetPageSize is a wrapper around gtk_adjustment_get_page_size(). -func (v *Adjustment) GetPageSize() float64 { - return float64(C.gtk_adjustment_get_page_size(v.native())) -} - -// SetPageSize is a wrapper around gtk_adjustment_set_page_size(). -func (v *Adjustment) SetPageSize(value float64) { - C.gtk_adjustment_set_page_size(v.native(), C.gdouble(value)) -} - -// Configure is a wrapper around gtk_adjustment_configure(). -func (v *Adjustment) Configure(value, lower, upper, stepIncrement, pageIncrement, pageSize float64) { - C.gtk_adjustment_configure(v.native(), C.gdouble(value), - C.gdouble(lower), C.gdouble(upper), C.gdouble(stepIncrement), - C.gdouble(pageIncrement), C.gdouble(pageSize)) -} - -// SetLower is a wrapper around gtk_adjustment_set_lower(). -func (v *Adjustment) SetLower(value float64) { - C.gtk_adjustment_set_lower(v.native(), C.gdouble(value)) -} - -// GetUpper is a wrapper around gtk_adjustment_get_upper(). -func (v *Adjustment) GetUpper() float64 { - c := C.gtk_adjustment_get_upper(v.native()) - return float64(c) -} - -// SetUpper is a wrapper around gtk_adjustment_set_upper(). -func (v *Adjustment) SetUpper(value float64) { - C.gtk_adjustment_set_upper(v.native(), C.gdouble(value)) -} - -// GetPageIncrement is a wrapper around gtk_adjustment_get_page_increment(). -func (v *Adjustment) GetPageIncrement() float64 { - c := C.gtk_adjustment_get_page_increment(v.native()) - return float64(c) -} - -// SetPageIncrement is a wrapper around gtk_adjustment_set_page_increment(). -func (v *Adjustment) SetPageIncrement(value float64) { - C.gtk_adjustment_set_page_increment(v.native(), C.gdouble(value)) -} - -// GetStepIncrement is a wrapper around gtk_adjustment_get_step_increment(). -func (v *Adjustment) GetStepIncrement() float64 { - c := C.gtk_adjustment_get_step_increment(v.native()) - return float64(c) -} - -// SetStepIncrement is a wrapper around gtk_adjustment_set_step_increment(). -func (v *Adjustment) SetStepIncrement(value float64) { - C.gtk_adjustment_set_step_increment(v.native(), C.gdouble(value)) -} - -// GetMinimumIncrement is a wrapper around gtk_adjustment_get_minimum_increment(). -func (v *Adjustment) GetMinimumIncrement() float64 { - c := C.gtk_adjustment_get_minimum_increment(v.native()) - return float64(c) -} - -/* -void gtk_adjustment_clamp_page () -void gtk_adjustment_changed () -void gtk_adjustment_value_changed () -void gtk_adjustment_configure () -*/ - -/* - * GtkAssistant - */ - -// Assistant is a representation of GTK's GtkAssistant. -type Assistant struct { - Window -} - -// native returns a pointer to the underlying GtkAssistant. -func (v *Assistant) native() *C.GtkAssistant { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkAssistant(p) -} - -func marshalAssistant(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapAssistant(obj), nil -} - -func wrapAssistant(obj *glib.Object) *Assistant { - return &Assistant{Window{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}}} -} - -// AssistantNew is a wrapper around gtk_assistant_new(). -func AssistantNew() (*Assistant, error) { - c := C.gtk_assistant_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapAssistant(obj), nil -} - -// GetCurrentPage is a wrapper around gtk_assistant_get_current_page(). -func (v *Assistant) GetCurrentPage() int { - c := C.gtk_assistant_get_current_page(v.native()) - return int(c) -} - -// SetCurrentPage is a wrapper around gtk_assistant_set_current_page(). -func (v *Assistant) SetCurrentPage(pageNum int) { - C.gtk_assistant_set_current_page(v.native(), C.gint(pageNum)) -} - -// GetNPages is a wrapper around gtk_assistant_get_n_pages(). -func (v *Assistant) GetNPages() int { - c := C.gtk_assistant_get_n_pages(v.native()) - return int(c) -} - -// GetNthPage is a wrapper around gtk_assistant_get_nth_page(). -func (v *Assistant) GetNthPage(pageNum int) (*Widget, error) { - c := C.gtk_assistant_get_nth_page(v.native(), C.gint(pageNum)) - if c == nil { - return nil, fmt.Errorf("page %d is out of bounds", pageNum) - } - - obj := glib.Take(unsafe.Pointer(c)) - return wrapWidget(obj), nil -} - -// PrependPage is a wrapper around gtk_assistant_prepend_page(). -func (v *Assistant) PrependPage(page IWidget) int { - c := C.gtk_assistant_prepend_page(v.native(), page.toWidget()) - return int(c) -} - -// AppendPage is a wrapper around gtk_assistant_append_page(). -func (v *Assistant) AppendPage(page IWidget) int { - c := C.gtk_assistant_append_page(v.native(), page.toWidget()) - return int(c) -} - -// InsertPage is a wrapper around gtk_assistant_insert_page(). -func (v *Assistant) InsertPage(page IWidget, position int) int { - c := C.gtk_assistant_insert_page(v.native(), page.toWidget(), - C.gint(position)) - return int(c) -} - -// RemovePage is a wrapper around gtk_assistant_remove_page(). -func (v *Assistant) RemovePage(pageNum int) { - C.gtk_assistant_remove_page(v.native(), C.gint(pageNum)) -} - -// TODO: gtk_assistant_set_forward_page_func - -// SetPageType is a wrapper around gtk_assistant_set_page_type(). -func (v *Assistant) SetPageType(page IWidget, ptype AssistantPageType) { - C.gtk_assistant_set_page_type(v.native(), page.toWidget(), - C.GtkAssistantPageType(ptype)) -} - -// GetPageType is a wrapper around gtk_assistant_get_page_type(). -func (v *Assistant) GetPageType(page IWidget) AssistantPageType { - c := C.gtk_assistant_get_page_type(v.native(), page.toWidget()) - return AssistantPageType(c) -} - -// SetPageTitle is a wrapper around gtk_assistant_set_page_title(). -func (v *Assistant) SetPageTitle(page IWidget, title string) { - cstr := C.CString(title) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_assistant_set_page_title(v.native(), page.toWidget(), - (*C.gchar)(cstr)) -} - -// GetPageTitle is a wrapper around gtk_assistant_get_page_title(). -func (v *Assistant) GetPageTitle(page IWidget) string { - return goString(C.gtk_assistant_get_page_title(v.native(), page.toWidget())) -} - -// SetPageComplete is a wrapper around gtk_assistant_set_page_complete(). -func (v *Assistant) SetPageComplete(page IWidget, complete bool) { - C.gtk_assistant_set_page_complete(v.native(), page.toWidget(), - gbool(complete)) -} - -// GetPageComplete is a wrapper around gtk_assistant_get_page_complete(). -func (v *Assistant) GetPageComplete(page IWidget) bool { - c := C.gtk_assistant_get_page_complete(v.native(), page.toWidget()) - return gobool(c) -} - -// AddActionWidget is a wrapper around gtk_assistant_add_action_widget(). -func (v *Assistant) AddActionWidget(child IWidget) { - C.gtk_assistant_add_action_widget(v.native(), child.toWidget()) -} - -// RemoveActionWidget is a wrapper around gtk_assistant_remove_action_widget(). -func (v *Assistant) RemoveActionWidget(child IWidget) { - C.gtk_assistant_remove_action_widget(v.native(), child.toWidget()) -} - -// UpdateButtonsState is a wrapper around gtk_assistant_update_buttons_state(). -func (v *Assistant) UpdateButtonsState() { - C.gtk_assistant_update_buttons_state(v.native()) -} - -// Commit is a wrapper around gtk_assistant_commit(). -func (v *Assistant) Commit() { - C.gtk_assistant_commit(v.native()) -} - -// NextPage is a wrapper around gtk_assistant_next_page(). -func (v *Assistant) NextPage() { - C.gtk_assistant_next_page(v.native()) -} - -// PreviousPage is a wrapper around gtk_assistant_previous_page(). -func (v *Assistant) PreviousPage() { - C.gtk_assistant_previous_page(v.native()) -} - -/* - * GtkBin - */ - -// Bin is a representation of GTK's GtkBin. -type Bin struct { - Container -} - -// native returns a pointer to the underlying GtkBin. -func (v *Bin) native() *C.GtkBin { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkBin(p) -} - -func marshalBin(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapBin(obj), nil -} - -func wrapBin(obj *glib.Object) *Bin { - return &Bin{Container{Widget{glib.InitiallyUnowned{obj}}}} -} - -// GetChild is a wrapper around gtk_bin_get_child(). -func (v *Bin) GetChild() (*Widget, error) { - c := C.gtk_bin_get_child(v.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapWidget(obj), nil -} - -/* - * GtkBuilder - */ - -// Builder is a representation of GTK's GtkBuilder. -type Builder struct { - *glib.Object -} - -// native() returns a pointer to the underlying GtkBuilder. -func (b *Builder) native() *C.GtkBuilder { - if b == nil || b.GObject == nil { - return nil - } - p := unsafe.Pointer(b.GObject) - return C.toGtkBuilder(p) -} - -func marshalBuilder(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return &Builder{obj}, nil -} - -// BuilderNew is a wrapper around gtk_builder_new(). -func BuilderNew() (*Builder, error) { - c := C.gtk_builder_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return &Builder{obj}, nil -} - -// BuilderNewFromFile is a wrapper around gtk_builder_new_from_file(). -func BuilderNewFromFile(filePath string) (*Builder, error) { - cstr := C.CString(filePath) - defer C.free(unsafe.Pointer(cstr)) - - c := C.gtk_builder_new_from_file((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - - obj := glib.Take(unsafe.Pointer(c)) - return &Builder{obj}, nil -} - -// BuilderNewFromResource is a wrapper around gtk_builder_new_from_resource(). -func BuilderNewFromResource(resourcePath string) (*Builder, error) { - cstr := C.CString(resourcePath) - defer C.free(unsafe.Pointer(cstr)) - - c := C.gtk_builder_new_from_resource((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - - obj := glib.Take(unsafe.Pointer(c)) - return &Builder{obj}, nil -} - -// AddFromFile is a wrapper around gtk_builder_add_from_file(). -func (b *Builder) AddFromFile(filename string) error { - cstr := C.CString(filename) - defer C.free(unsafe.Pointer(cstr)) - var err *C.GError = nil - res := C.gtk_builder_add_from_file(b.native(), (*C.gchar)(cstr), &err) - if res == 0 { - defer C.g_error_free(err) - return errors.New(goString(err.message)) - } - return nil -} - -// AddFromResource is a wrapper around gtk_builder_add_from_resource(). -func (b *Builder) AddFromResource(path string) error { - cstr := C.CString(path) - defer C.free(unsafe.Pointer(cstr)) - var err *C.GError = nil - res := C.gtk_builder_add_from_resource(b.native(), (*C.gchar)(cstr), &err) - if res == 0 { - defer C.g_error_free(err) - return errors.New(goString(err.message)) - } - return nil -} - -// AddFromString is a wrapper around gtk_builder_add_from_string(). -func (b *Builder) AddFromString(str string) error { - cstr := C.CString(str) - defer C.free(unsafe.Pointer(cstr)) - length := (C.gsize)(len(str)) - var err *C.GError = nil - res := C.gtk_builder_add_from_string(b.native(), (*C.gchar)(cstr), length, &err) - if res == 0 { - defer C.g_error_free(err) - return errors.New(goString(err.message)) - } - return nil -} - -// GetObject is a wrapper around gtk_builder_get_object(). The returned result -// is an IObject, so it will need to be type-asserted to the appropriate type before -// being used. For example, to get an object and type assert it as a window: -// -// obj, err := builder.GetObject("window") -// if err != nil { -// // object not found -// return -// } -// if w, ok := obj.(*gtk.Window); ok { -// // do stuff with w here -// } else { -// // not a *gtk.Window -// } -// -func (b *Builder) GetObject(name string) (glib.IObject, error) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_builder_get_object(b.native(), (*C.gchar)(cstr)) - if c == nil { - return nil, errors.New("object '" + name + "' not found") - } - obj, err := cast(c) - if err != nil { - return nil, err - } - return obj, nil -} - -var ( - builderSignals = struct { - sync.RWMutex - m map[*C.GtkBuilder]map[string]interface{} - }{ - m: make(map[*C.GtkBuilder]map[string]interface{}), - } -) - -// ConnectSignals is a wrapper around gtk_builder_connect_signals_full(). -func (b *Builder) ConnectSignals(signals map[string]interface{}) { - builderSignals.Lock() - builderSignals.m[b.native()] = signals - builderSignals.Unlock() - - C._gtk_builder_connect_signals_full(b.native()) -} - -/* - * GtkButton - */ - -// Button is a representation of GTK's GtkButton. -type Button struct { - Bin - - // Interfaces - IActionable -} - -// native() returns a pointer to the underlying GtkButton. -func (v *Button) native() *C.GtkButton { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkButton(p) -} - -func marshalButton(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapButton(obj), nil -} - -func wrapButton(obj *glib.Object) *Button { - actionable := &Actionable{obj} - return &Button{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}, actionable} -} - -// ButtonNew() is a wrapper around gtk_button_new(). -func ButtonNew() (*Button, error) { - c := C.gtk_button_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapButton(obj), nil -} - -// ButtonNewWithLabel() is a wrapper around gtk_button_new_with_label(). -func ButtonNewWithLabel(label string) (*Button, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_button_new_with_label((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapButton(obj), nil -} - -// ButtonNewWithMnemonic() is a wrapper around gtk_button_new_with_mnemonic(). -func ButtonNewWithMnemonic(label string) (*Button, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_button_new_with_mnemonic((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapButton(obj), nil -} - -// Clicked() is a wrapper around gtk_button_clicked(). -func (v *Button) Clicked() { - C.gtk_button_clicked(v.native()) -} - -// SetRelief() is a wrapper around gtk_button_set_relief(). -func (v *Button) SetRelief(newStyle ReliefStyle) { - C.gtk_button_set_relief(v.native(), C.GtkReliefStyle(newStyle)) -} - -// GetRelief() is a wrapper around gtk_button_get_relief(). -func (v *Button) GetRelief() ReliefStyle { - c := C.gtk_button_get_relief(v.native()) - return ReliefStyle(c) -} - -// SetLabel() is a wrapper around gtk_button_set_label(). -func (v *Button) SetLabel(label string) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_button_set_label(v.native(), (*C.gchar)(cstr)) -} - -// GetLabel() is a wrapper around gtk_button_get_label(). -func (v *Button) GetLabel() (string, error) { - c := C.gtk_button_get_label(v.native()) - if c == nil { - return "", nilPtrErr - } - return goString(c), nil -} - -// SetUseUnderline() is a wrapper around gtk_button_set_use_underline(). -func (v *Button) SetUseUnderline(useUnderline bool) { - C.gtk_button_set_use_underline(v.native(), gbool(useUnderline)) -} - -// GetUseUnderline() is a wrapper around gtk_button_get_use_underline(). -func (v *Button) GetUseUnderline() bool { - c := C.gtk_button_get_use_underline(v.native()) - return gobool(c) -} - -// SetImage() is a wrapper around gtk_button_set_image(). -func (v *Button) SetImage(image IWidget) { - C.gtk_button_set_image(v.native(), image.toWidget()) -} - -// GetImage() is a wrapper around gtk_button_get_image(). -func (v *Button) GetImage() (*Widget, error) { - c := C.gtk_button_get_image(v.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapWidget(obj), nil -} - -// SetImagePosition() is a wrapper around gtk_button_set_image_position(). -func (v *Button) SetImagePosition(position PositionType) { - C.gtk_button_set_image_position(v.native(), C.GtkPositionType(position)) -} - -// GetImagePosition() is a wrapper around gtk_button_get_image_position(). -func (v *Button) GetImagePosition() PositionType { - c := C.gtk_button_get_image_position(v.native()) - return PositionType(c) -} - -// SetAlwaysShowImage() is a wrapper around gtk_button_set_always_show_image(). -func (v *Button) SetAlwaysShowImage(alwaysShow bool) { - C.gtk_button_set_always_show_image(v.native(), gbool(alwaysShow)) -} - -// GetAlwaysShowImage() is a wrapper around gtk_button_get_always_show_image(). -func (v *Button) GetAlwaysShowImage() bool { - c := C.gtk_button_get_always_show_image(v.native()) - return gobool(c) -} - -// GetEventWindow() is a wrapper around gtk_button_get_event_window(). -func (v *Button) GetEventWindow() (*gdk.Window, error) { - c := C.gtk_button_get_event_window(v.native()) - if c == nil { - return nil, nilPtrErr - } - - w := &gdk.Window{glib.Take(unsafe.Pointer(c))} - return w, nil -} - -/* - * GtkColorButton - */ - -// ColorButton is a representation of GTK's GtkColorButton. -type ColorButton struct { - Button - - // Interfaces - ColorChooser -} - -// Native returns a pointer to the underlying GtkColorButton. -func (v *ColorButton) native() *C.GtkColorButton { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkColorButton(p) -} - -func wrapColorButton(obj *glib.Object) *ColorButton { - cc := wrapColorChooser(obj) - actionable := wrapActionable(obj) - return &ColorButton{Button{Bin{Container{Widget{ - glib.InitiallyUnowned{obj}}}}, actionable}, *cc} -} - -// ColorButtonNew is a wrapper around gtk_color_button_new(). -func ColorButtonNew() (*ColorButton, error) { - c := C.gtk_color_button_new() - if c == nil { - return nil, nilPtrErr - } - return wrapColorButton(glib.Take(unsafe.Pointer(c))), nil -} - -// ColorButtonNewWithRGBA is a wrapper around gtk_color_button_new_with_rgba(). -func ColorButtonNewWithRGBA(gdkColor *gdk.RGBA) (*ColorButton, error) { - c := C.gtk_color_button_new_with_rgba((*C.GdkRGBA)(unsafe.Pointer(gdkColor.Native()))) - if c == nil { - return nil, nilPtrErr - } - return wrapColorButton(glib.Take(unsafe.Pointer(c))), nil -} - -/* - * GtkBox - */ - -// Box is a representation of GTK's GtkBox. -type Box struct { - Container -} - -// native() returns a pointer to the underlying GtkBox. -func (v *Box) native() *C.GtkBox { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkBox(p) -} - -func marshalBox(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapBox(obj), nil -} - -func wrapBox(obj *glib.Object) *Box { - return &Box{Container{Widget{glib.InitiallyUnowned{obj}}}} -} - -func (v *Box) toOrientable() *C.GtkOrientable { - if v == nil { - return nil - } - return C.toGtkOrientable(unsafe.Pointer(v.GObject)) -} - -// GetOrientation() is a wrapper around C.gtk_orientable_get_orientation() for a GtkBox -func (v *Box) GetOrientation() Orientation { - return Orientation(C.gtk_orientable_get_orientation(v.toOrientable())) -} - -// SetOrientation() is a wrapper around C.gtk_orientable_set_orientation() for a GtkBox -func (v *Box) SetOrientation(o Orientation) { - C.gtk_orientable_set_orientation(v.toOrientable(), C.GtkOrientation(o)) -} - -// BoxNew() is a wrapper around gtk_box_new(). -func BoxNew(orientation Orientation, spacing int) (*Box, error) { - c := C.gtk_box_new(C.GtkOrientation(orientation), C.gint(spacing)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapBox(obj), nil -} - -// PackStart() is a wrapper around gtk_box_pack_start(). -func (v *Box) PackStart(child IWidget, expand, fill bool, padding uint) { - C.gtk_box_pack_start(v.native(), child.toWidget(), gbool(expand), - gbool(fill), C.guint(padding)) -} - -// PackEnd() is a wrapper around gtk_box_pack_end(). -func (v *Box) PackEnd(child IWidget, expand, fill bool, padding uint) { - C.gtk_box_pack_end(v.native(), child.toWidget(), gbool(expand), - gbool(fill), C.guint(padding)) -} - -// GetHomogeneous() is a wrapper around gtk_box_get_homogeneous(). -func (v *Box) GetHomogeneous() bool { - c := C.gtk_box_get_homogeneous(v.native()) - return gobool(c) -} - -// SetHomogeneous() is a wrapper around gtk_box_set_homogeneous(). -func (v *Box) SetHomogeneous(homogeneous bool) { - C.gtk_box_set_homogeneous(v.native(), gbool(homogeneous)) -} - -// GetSpacing() is a wrapper around gtk_box_get_spacing(). -func (v *Box) GetSpacing() int { - c := C.gtk_box_get_spacing(v.native()) - return int(c) -} - -// SetSpacing() is a wrapper around gtk_box_set_spacing() -func (v *Box) SetSpacing(spacing int) { - C.gtk_box_set_spacing(v.native(), C.gint(spacing)) -} - -// ReorderChild() is a wrapper around gtk_box_reorder_child(). -func (v *Box) ReorderChild(child IWidget, position int) { - C.gtk_box_reorder_child(v.native(), child.toWidget(), C.gint(position)) -} - -// QueryChildPacking() is a wrapper around gtk_box_query_child_packing(). -func (v *Box) QueryChildPacking(child IWidget) (expand, fill bool, padding uint, packType PackType) { - var cexpand, cfill C.gboolean - var cpadding C.guint - var cpackType C.GtkPackType - - C.gtk_box_query_child_packing(v.native(), child.toWidget(), &cexpand, - &cfill, &cpadding, &cpackType) - return gobool(cexpand), gobool(cfill), uint(cpadding), PackType(cpackType) -} - -// SetChildPacking() is a wrapper around gtk_box_set_child_packing(). -func (v *Box) SetChildPacking(child IWidget, expand, fill bool, padding uint, packType PackType) { - C.gtk_box_set_child_packing(v.native(), child.toWidget(), gbool(expand), - gbool(fill), C.guint(padding), C.GtkPackType(packType)) -} - -/* - * GtkCalendar - */ - -// Calendar is a representation of GTK's GtkCalendar. -type Calendar struct { - Widget -} - -// native() returns a pointer to the underlying GtkCalendar. -func (v *Calendar) native() *C.GtkCalendar { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkCalendar(p) -} - -func marshalCalendar(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapCalendar(obj), nil -} - -func wrapCalendar(obj *glib.Object) *Calendar { - return &Calendar{Widget{glib.InitiallyUnowned{obj}}} -} - -// CalendarNew is a wrapper around gtk_calendar_new(). -func CalendarNew() (*Calendar, error) { - c := C.gtk_calendar_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapCalendar(obj), nil -} - -// SelectMonth is a wrapper around gtk_calendar_select_month(). -func (v *Calendar) SelectMonth(month, year uint) { - C.gtk_calendar_select_month(v.native(), C.guint(month), C.guint(year)) -} - -// SelectDay is a wrapper around gtk_calendar_select_day(). -func (v *Calendar) SelectDay(day uint) { - C.gtk_calendar_select_day(v.native(), C.guint(day)) -} - -// MarkDay is a wrapper around gtk_calendar_mark_day(). -func (v *Calendar) MarkDay(day uint) { - C.gtk_calendar_mark_day(v.native(), C.guint(day)) -} - -// UnmarkDay is a wrapper around gtk_calendar_unmark_day(). -func (v *Calendar) UnmarkDay(day uint) { - C.gtk_calendar_unmark_day(v.native(), C.guint(day)) -} - -// GetDayIsMarked is a wrapper around gtk_calendar_get_day_is_marked(). -func (v *Calendar) GetDayIsMarked(day uint) bool { - c := C.gtk_calendar_get_day_is_marked(v.native(), C.guint(day)) - return gobool(c) -} - -// ClearMarks is a wrapper around gtk_calendar_clear_marks(). -func (v *Calendar) ClearMarks() { - C.gtk_calendar_clear_marks(v.native()) -} - -// GetDisplayOptions is a wrapper around gtk_calendar_get_display_options(). -func (v *Calendar) GetDisplayOptions() CalendarDisplayOptions { - c := C.gtk_calendar_get_display_options(v.native()) - return CalendarDisplayOptions(c) -} - -// SetDisplayOptions is a wrapper around gtk_calendar_set_display_options(). -func (v *Calendar) SetDisplayOptions(flags CalendarDisplayOptions) { - C.gtk_calendar_set_display_options(v.native(), - C.GtkCalendarDisplayOptions(flags)) -} - -// GetDate is a wrapper around gtk_calendar_get_date(). -func (v *Calendar) GetDate() (year, month, day uint) { - var cyear, cmonth, cday C.guint - C.gtk_calendar_get_date(v.native(), &cyear, &cmonth, &cday) - return uint(cyear), uint(cmonth), uint(cday) -} - -// TODO gtk_calendar_set_detail_func - -// GetDetailWidthChars is a wrapper around gtk_calendar_get_detail_width_chars(). -func (v *Calendar) GetDetailWidthChars() int { - c := C.gtk_calendar_get_detail_width_chars(v.native()) - return int(c) -} - -// SetDetailWidthChars is a wrapper around gtk_calendar_set_detail_width_chars(). -func (v *Calendar) SetDetailWidthChars(chars int) { - C.gtk_calendar_set_detail_width_chars(v.native(), C.gint(chars)) -} - -// GetDetailHeightRows is a wrapper around gtk_calendar_get_detail_height_rows(). -func (v *Calendar) GetDetailHeightRows() int { - c := C.gtk_calendar_get_detail_height_rows(v.native()) - return int(c) -} - -// SetDetailHeightRows is a wrapper around gtk_calendar_set_detail_height_rows(). -func (v *Calendar) SetDetailHeightRows(rows int) { - C.gtk_calendar_set_detail_height_rows(v.native(), C.gint(rows)) -} - -/* - * GtkCellLayout - */ - -// CellLayout is a representation of GTK's GtkCellLayout GInterface. -type CellLayout struct { - *glib.Object -} - -// ICellLayout is an interface type implemented by all structs -// embedding a CellLayout. It is meant to be used as an argument type -// for wrapper functions that wrap around a C GTK function taking a -// GtkCellLayout. -type ICellLayout interface { - toCellLayout() *C.GtkCellLayout -} - -// native() returns a pointer to the underlying GObject as a GtkCellLayout. -func (v *CellLayout) native() *C.GtkCellLayout { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkCellLayout(p) -} - -func marshalCellLayout(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapCellLayout(obj), nil -} - -func wrapCellLayout(obj *glib.Object) *CellLayout { - return &CellLayout{obj} -} - -func (v *CellLayout) toCellLayout() *C.GtkCellLayout { - if v == nil { - return nil - } - return v.native() -} - -// PackStart() is a wrapper around gtk_cell_layout_pack_start(). -func (v *CellLayout) PackStart(cell ICellRenderer, expand bool) { - C.gtk_cell_layout_pack_start(v.native(), cell.toCellRenderer(), - gbool(expand)) -} - -// AddAttribute() is a wrapper around gtk_cell_layout_add_attribute(). -func (v *CellLayout) AddAttribute(cell ICellRenderer, attribute string, column int) { - cstr := C.CString(attribute) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_cell_layout_add_attribute(v.native(), cell.toCellRenderer(), - (*C.gchar)(cstr), C.gint(column)) -} - -/* - * GtkCellRenderer - */ - -// CellRenderer is a representation of GTK's GtkCellRenderer. -type CellRenderer struct { - glib.InitiallyUnowned -} - -// ICellRenderer is an interface type implemented by all structs -// embedding a CellRenderer. It is meant to be used as an argument type -// for wrapper functions that wrap around a C GTK function taking a -// GtkCellRenderer. -type ICellRenderer interface { - toCellRenderer() *C.GtkCellRenderer -} - -// native returns a pointer to the underlying GtkCellRenderer. -func (v *CellRenderer) native() *C.GtkCellRenderer { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkCellRenderer(p) -} - -func (v *CellRenderer) toCellRenderer() *C.GtkCellRenderer { - if v == nil { - return nil - } - return v.native() -} - -func marshalCellRenderer(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapCellRenderer(obj), nil -} - -func wrapCellRenderer(obj *glib.Object) *CellRenderer { - return &CellRenderer{glib.InitiallyUnowned{obj}} -} - -/* - * GtkCellRendererSpinner - */ - -// CellRendererSpinner is a representation of GTK's GtkCellRendererSpinner. -type CellRendererSpinner struct { - CellRenderer -} - -// native returns a pointer to the underlying GtkCellRendererSpinner. -func (v *CellRendererSpinner) native() *C.GtkCellRendererSpinner { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkCellRendererSpinner(p) -} - -func marshalCellRendererSpinner(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapCellRendererSpinner(obj), nil -} - -func wrapCellRendererSpinner(obj *glib.Object) *CellRendererSpinner { - return &CellRendererSpinner{CellRenderer{glib.InitiallyUnowned{obj}}} -} - -// CellRendererSpinnerNew is a wrapper around gtk_cell_renderer_text_new(). -func CellRendererSpinnerNew() (*CellRendererSpinner, error) { - c := C.gtk_cell_renderer_spinner_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapCellRendererSpinner(obj), nil -} - -/* - * GtkCellRendererPixbuf - */ - -// CellRendererPixbuf is a representation of GTK's GtkCellRendererPixbuf. -type CellRendererPixbuf struct { - CellRenderer -} - -// native returns a pointer to the underlying GtkCellRendererPixbuf. -func (v *CellRendererPixbuf) native() *C.GtkCellRendererPixbuf { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkCellRendererPixbuf(p) -} - -func marshalCellRendererPixbuf(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapCellRendererPixbuf(obj), nil -} - -func wrapCellRendererPixbuf(obj *glib.Object) *CellRendererPixbuf { - return &CellRendererPixbuf{CellRenderer{glib.InitiallyUnowned{obj}}} -} - -// CellRendererPixbufNew is a wrapper around gtk_cell_renderer_pixbuf_new(). -func CellRendererPixbufNew() (*CellRendererPixbuf, error) { - c := C.gtk_cell_renderer_pixbuf_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapCellRendererPixbuf(obj), nil -} - -/* - * GtkCellRendererText - */ - -// CellRendererText is a representation of GTK's GtkCellRendererText. -type CellRendererText struct { - CellRenderer -} - -// native returns a pointer to the underlying GtkCellRendererText. -func (v *CellRendererText) native() *C.GtkCellRendererText { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkCellRendererText(p) -} - -func marshalCellRendererText(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapCellRendererText(obj), nil -} - -func wrapCellRendererText(obj *glib.Object) *CellRendererText { - return &CellRendererText{CellRenderer{glib.InitiallyUnowned{obj}}} -} - -// CellRendererTextNew is a wrapper around gtk_cell_renderer_text_new(). -func CellRendererTextNew() (*CellRendererText, error) { - c := C.gtk_cell_renderer_text_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapCellRendererText(obj), nil -} - -/* - * GtkCellRendererToggle - */ - -// CellRendererToggle is a representation of GTK's GtkCellRendererToggle. -type CellRendererToggle struct { - CellRenderer -} - -// native returns a pointer to the underlying GtkCellRendererToggle. -func (v *CellRendererToggle) native() *C.GtkCellRendererToggle { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkCellRendererToggle(p) -} - -func (v *CellRendererToggle) toCellRenderer() *C.GtkCellRenderer { - if v == nil { - return nil - } - return v.CellRenderer.native() -} - -func marshalCellRendererToggle(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapCellRendererToggle(obj), nil -} - -func wrapCellRendererToggle(obj *glib.Object) *CellRendererToggle { - return &CellRendererToggle{CellRenderer{glib.InitiallyUnowned{obj}}} -} - -// CellRendererToggleNew is a wrapper around gtk_cell_renderer_toggle_new(). -func CellRendererToggleNew() (*CellRendererToggle, error) { - c := C.gtk_cell_renderer_toggle_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapCellRendererToggle(obj), nil -} - -// SetRadio is a wrapper around gtk_cell_renderer_toggle_set_radio(). -func (v *CellRendererToggle) SetRadio(set bool) { - C.gtk_cell_renderer_toggle_set_radio(v.native(), gbool(set)) -} - -// GetRadio is a wrapper around gtk_cell_renderer_toggle_get_radio(). -func (v *CellRendererToggle) GetRadio() bool { - c := C.gtk_cell_renderer_toggle_get_radio(v.native()) - return gobool(c) -} - -// SetActive is a wrapper around gtk_cell_renderer_toggle_set_active(). -func (v *CellRendererToggle) SetActive(active bool) { - C.gtk_cell_renderer_toggle_set_active(v.native(), gbool(active)) -} - -// GetActive is a wrapper around gtk_cell_renderer_toggle_get_active(). -func (v *CellRendererToggle) GetActive() bool { - c := C.gtk_cell_renderer_toggle_get_active(v.native()) - return gobool(c) -} - -// SetActivatable is a wrapper around gtk_cell_renderer_toggle_set_activatable(). -func (v *CellRendererToggle) SetActivatable(activatable bool) { - C.gtk_cell_renderer_toggle_set_activatable(v.native(), - gbool(activatable)) -} - -// GetActivatable is a wrapper around gtk_cell_renderer_toggle_get_activatable(). -func (v *CellRendererToggle) GetActivatable() bool { - c := C.gtk_cell_renderer_toggle_get_activatable(v.native()) - return gobool(c) -} - -/* - * GtkCheckButton - */ - -// CheckButton is a wrapper around GTK's GtkCheckButton. -type CheckButton struct { - ToggleButton -} - -// native returns a pointer to the underlying GtkCheckButton. -func (v *CheckButton) native() *C.GtkCheckButton { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkCheckButton(p) -} - -func marshalCheckButton(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapCheckButton(obj), nil -} - -func wrapCheckButton(obj *glib.Object) *CheckButton { - actionable := wrapActionable(obj) - return &CheckButton{ToggleButton{Button{Bin{Container{Widget{ - glib.InitiallyUnowned{obj}}}}, actionable}}} -} - -// CheckButtonNew is a wrapper around gtk_check_button_new(). -func CheckButtonNew() (*CheckButton, error) { - c := C.gtk_check_button_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapCheckButton(obj), nil -} - -// CheckButtonNewWithLabel is a wrapper around -// gtk_check_button_new_with_label(). -func CheckButtonNewWithLabel(label string) (*CheckButton, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_check_button_new_with_label((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapCheckButton(glib.Take(unsafe.Pointer(c))), nil -} - -// CheckButtonNewWithMnemonic is a wrapper around -// gtk_check_button_new_with_mnemonic(). -func CheckButtonNewWithMnemonic(label string) (*CheckButton, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_check_button_new_with_mnemonic((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapCheckButton(obj), nil -} - -/* - * GtkCheckMenuItem - */ - -type CheckMenuItem struct { - MenuItem -} - -// native returns a pointer to the underlying GtkCheckMenuItem. -func (v *CheckMenuItem) native() *C.GtkCheckMenuItem { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkCheckMenuItem(p) -} - -func marshalCheckMenuItem(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapCheckMenuItem(obj), nil -} - -func wrapCheckMenuItem(obj *glib.Object) *CheckMenuItem { - return &CheckMenuItem{MenuItem{Bin{Container{Widget{ - glib.InitiallyUnowned{obj}}}}}} -} - -// CheckMenuItemNew is a wrapper around gtk_check_menu_item_new(). -func CheckMenuItemNew() (*CheckMenuItem, error) { - c := C.gtk_check_menu_item_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapCheckMenuItem(obj), nil -} - -// CheckMenuItemNewWithLabel is a wrapper around -// gtk_check_menu_item_new_with_label(). -func CheckMenuItemNewWithLabel(label string) (*CheckMenuItem, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_check_menu_item_new_with_label((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapCheckMenuItem(obj), nil -} - -// CheckMenuItemNewWithMnemonic is a wrapper around -// gtk_check_menu_item_new_with_mnemonic(). -func CheckMenuItemNewWithMnemonic(label string) (*CheckMenuItem, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_check_menu_item_new_with_mnemonic((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapCheckMenuItem(obj), nil -} - -// GetActive is a wrapper around gtk_check_menu_item_get_active(). -func (v *CheckMenuItem) GetActive() bool { - c := C.gtk_check_menu_item_get_active(v.native()) - return gobool(c) -} - -// SetActive is a wrapper around gtk_check_menu_item_set_active(). -func (v *CheckMenuItem) SetActive(isActive bool) { - C.gtk_check_menu_item_set_active(v.native(), gbool(isActive)) -} - -// Toggled is a wrapper around gtk_check_menu_item_toggled(). -func (v *CheckMenuItem) Toggled() { - C.gtk_check_menu_item_toggled(v.native()) -} - -// GetInconsistent is a wrapper around gtk_check_menu_item_get_inconsistent(). -func (v *CheckMenuItem) GetInconsistent() bool { - c := C.gtk_check_menu_item_get_inconsistent(v.native()) - return gobool(c) -} - -// SetInconsistent is a wrapper around gtk_check_menu_item_set_inconsistent(). -func (v *CheckMenuItem) SetInconsistent(setting bool) { - C.gtk_check_menu_item_set_inconsistent(v.native(), gbool(setting)) -} - -// SetDrawAsRadio is a wrapper around gtk_check_menu_item_set_draw_as_radio(). -func (v *CheckMenuItem) SetDrawAsRadio(drawAsRadio bool) { - C.gtk_check_menu_item_set_draw_as_radio(v.native(), gbool(drawAsRadio)) -} - -// GetDrawAsRadio is a wrapper around gtk_check_menu_item_get_draw_as_radio(). -func (v *CheckMenuItem) GetDrawAsRadio() bool { - c := C.gtk_check_menu_item_get_draw_as_radio(v.native()) - return gobool(c) -} - -/* - * GtkClipboard - */ - -// Clipboard is a wrapper around GTK's GtkClipboard. -type Clipboard struct { - *glib.Object -} - -// native returns a pointer to the underlying GtkClipboard. -func (v *Clipboard) native() *C.GtkClipboard { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkClipboard(p) -} - -func marshalClipboard(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapClipboard(obj), nil -} - -func wrapClipboard(obj *glib.Object) *Clipboard { - return &Clipboard{obj} -} - -// Store is a wrapper around gtk_clipboard_store -func (v *Clipboard) Store() { - C.gtk_clipboard_store(v.native()) -} - -// ClipboardGet() is a wrapper around gtk_clipboard_get(). -func ClipboardGet(atom gdk.Atom) (*Clipboard, error) { - c := C.gtk_clipboard_get(C.GdkAtom(unsafe.Pointer(atom))) - if c == nil { - return nil, nilPtrErr - } - - cb := &Clipboard{glib.Take(unsafe.Pointer(c))} - return cb, nil -} - -// ClipboardGetForDisplay() is a wrapper around gtk_clipboard_get_for_display(). -func ClipboardGetForDisplay(display *gdk.Display, atom gdk.Atom) (*Clipboard, error) { - displayPtr := (*C.GdkDisplay)(unsafe.Pointer(display.Native())) - c := C.gtk_clipboard_get_for_display(displayPtr, - C.GdkAtom(unsafe.Pointer(atom))) - if c == nil { - return nil, nilPtrErr - } - - cb := &Clipboard{glib.Take(unsafe.Pointer(c))} - return cb, nil -} - -// WaitIsTextAvailable is a wrapper around gtk_clipboard_wait_is_text_available -func (v *Clipboard) WaitIsTextAvailable() bool { - c := C.gtk_clipboard_wait_is_text_available(v.native()) - return gobool(c) -} - -// WaitForText is a wrapper around gtk_clipboard_wait_for_text -func (v *Clipboard) WaitForText() (string, error) { - c := C.gtk_clipboard_wait_for_text(v.native()) - if c == nil { - return "", nilPtrErr - } - defer C.g_free(C.gpointer(c)) - return goString(c), nil -} - -// SetText() is a wrapper around gtk_clipboard_set_text(). -func (v *Clipboard) SetText(text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_clipboard_set_text(v.native(), (*C.gchar)(cstr), - C.gint(len(text))) -} - -// WaitIsRichTextAvailable is a wrapper around gtk_clipboard_wait_is_rich_text_available -func (v *Clipboard) WaitIsRichTextAvailable(buf *TextBuffer) bool { - c := C.gtk_clipboard_wait_is_rich_text_available(v.native(), buf.native()) - return gobool(c) -} - -// WaitIsUrisAvailable is a wrapper around gtk_clipboard_wait_is_uris_available -func (v *Clipboard) WaitIsUrisAvailable() bool { - c := C.gtk_clipboard_wait_is_uris_available(v.native()) - return gobool(c) -} - -// WaitIsImageAvailable is a wrapper around gtk_clipboard_wait_is_image_available -func (v *Clipboard) WaitIsImageAvailable() bool { - c := C.gtk_clipboard_wait_is_image_available(v.native()) - return gobool(c) -} - -// SetImage is a wrapper around gtk_clipboard_set_image -func (v *Clipboard) SetImage(pixbuf *gdk.Pixbuf) { - C.gtk_clipboard_set_image(v.native(), (*C.GdkPixbuf)(unsafe.Pointer(pixbuf.Native()))) -} - -// WaitForImage is a wrapper around gtk_clipboard_wait_for_image -func (v *Clipboard) WaitForImage() (*gdk.Pixbuf, error) { - c := C.gtk_clipboard_wait_for_image(v.native()) - if c == nil { - return nil, nilPtrErr - } - - p := &gdk.Pixbuf{glib.Take(unsafe.Pointer(c))} - return p, nil -} - -// WaitIsTargetAvailable is a wrapper around gtk_clipboard_wait_is_target_available -func (v *Clipboard) WaitIsTargetAvailable(target gdk.Atom) bool { - c := C.gtk_clipboard_wait_is_target_available(v.native(), C.GdkAtom(unsafe.Pointer(target))) - return gobool(c) -} - -// WaitForContents is a wrapper around gtk_clipboard_wait_for_contents -func (v *Clipboard) WaitForContents(target gdk.Atom) (*SelectionData, error) { - c := C.gtk_clipboard_wait_for_contents(v.native(), C.GdkAtom(unsafe.Pointer(target))) - if c == nil { - return nil, nilPtrErr - } - p := &SelectionData{c} - runtime.SetFinalizer(p, (*SelectionData).free) - return p, nil -} - -/* - * GtkContainer - */ - -// Container is a representation of GTK's GtkContainer. -type Container struct { - Widget -} - -// native returns a pointer to the underlying GtkContainer. -func (v *Container) native() *C.GtkContainer { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkContainer(p) -} - -func marshalContainer(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapContainer(obj), nil -} - -func wrapContainer(obj *glib.Object) *Container { - return &Container{Widget{glib.InitiallyUnowned{obj}}} -} - -// Add is a wrapper around gtk_container_add(). -func (v *Container) Add(w IWidget) { - C.gtk_container_add(v.native(), w.toWidget()) -} - -// Remove is a wrapper around gtk_container_remove(). -func (v *Container) Remove(w IWidget) { - C.gtk_container_remove(v.native(), w.toWidget()) -} - -// TODO: gtk_container_add_with_properties - -// CheckResize is a wrapper around gtk_container_check_resize(). -func (v *Container) CheckResize() { - C.gtk_container_check_resize(v.native()) -} - -// TODO: gtk_container_foreach - -// GetChildren is a wrapper around gtk_container_get_children(). -func (v *Container) GetChildren() *glib.List { - clist := C.gtk_container_get_children(v.native()) - glist := glib.WrapList(uintptr(unsafe.Pointer(clist))) - glist.DataWrapper(func(ptr unsafe.Pointer) interface{} { - return wrapWidget(glib.Take(ptr)) - }) - - return glist -} - -// TODO: gtk_container_get_path_for_child - -// GetFocusChild is a wrapper around gtk_container_get_focus_child(). -func (v *Container) GetFocusChild() *Widget { - c := C.gtk_container_get_focus_child(v.native()) - if c == nil { - return nil - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapWidget(obj) -} - -// SetFocusChild is a wrapper around gtk_container_set_focus_child(). -func (v *Container) SetFocusChild(child IWidget) { - C.gtk_container_set_focus_child(v.native(), child.toWidget()) -} - -// GetFocusVAdjustment is a wrapper around -// gtk_container_get_focus_vadjustment(). -func (v *Container) GetFocusVAdjustment() *Adjustment { - c := C.gtk_container_get_focus_vadjustment(v.native()) - if c == nil { - return nil - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapAdjustment(obj) -} - -// SetFocusVAdjustment is a wrapper around -// gtk_container_set_focus_vadjustment(). -func (v *Container) SetFocusVAdjustment(adjustment *Adjustment) { - C.gtk_container_set_focus_vadjustment(v.native(), adjustment.native()) -} - -// GetFocusHAdjustment is a wrapper around -// gtk_container_get_focus_hadjustment(). -func (v *Container) GetFocusHAdjustment() *Adjustment { - c := C.gtk_container_get_focus_hadjustment(v.native()) - if c == nil { - return nil - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapAdjustment(obj) -} - -// SetFocusHAdjustment is a wrapper around -// gtk_container_set_focus_hadjustment(). -func (v *Container) SetFocusHAdjustment(adjustment *Adjustment) { - C.gtk_container_set_focus_hadjustment(v.native(), adjustment.native()) -} - -// ChildType is a wrapper around gtk_container_child_type(). -func (v *Container) ChildType() glib.Type { - c := C.gtk_container_child_type(v.native()) - return glib.Type(c) -} - -// TODO: gtk_container_child_get_valist -// TODO: gtk_container_child_set_valist - -// ChildNotify is a wrapper around gtk_container_child_notify(). -func (v *Container) ChildNotify(child IWidget, childProperty string) { - cstr := C.CString(childProperty) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_container_child_notify(v.native(), child.toWidget(), - (*C.gchar)(cstr)) -} - -// ChildGetProperty is a wrapper around gtk_container_child_get_property(). -func (v *Container) ChildGetProperty(child IWidget, name string, valueType glib.Type) (interface{}, error) { - gv, e := glib.ValueInit(valueType) - if e != nil { - return nil, e - } - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - - C.gtk_container_child_get_property(v.native(), child.toWidget(), (*C.gchar)(cstr), (*C.GValue)(unsafe.Pointer(gv.Native()))) - return gv.GoValue() -} - -// ChildSetProperty is a wrapper around gtk_container_child_set_property(). -func (v *Container) ChildSetProperty(child IWidget, name string, value interface{}) error { - gv, e := glib.GValue(value) - if e != nil { - return e - } - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - - C.gtk_container_child_set_property(v.native(), child.toWidget(), (*C.gchar)(cstr), (*C.GValue)(unsafe.Pointer(gv.Native()))) - return nil -} - -// TODO: gtk_container_forall - -// GetBorderWidth is a wrapper around gtk_container_get_border_width(). -func (v *Container) GetBorderWidth() uint { - c := C.gtk_container_get_border_width(v.native()) - return uint(c) -} - -// SetBorderWidth is a wrapper around gtk_container_set_border_width(). -func (v *Container) SetBorderWidth(borderWidth uint) { - C.gtk_container_set_border_width(v.native(), C.guint(borderWidth)) -} - -// PropagateDraw is a wrapper around gtk_container_propagate_draw(). -func (v *Container) PropagateDraw(child IWidget, cr *cairo.Context) { - context := (*C.cairo_t)(unsafe.Pointer(cr.Native())) - C.gtk_container_propagate_draw(v.native(), child.toWidget(), context) -} - -// GdkCairoSetSourcePixBuf() is a wrapper around gdk_cairo_set_source_pixbuf(). -func GdkCairoSetSourcePixBuf(cr *cairo.Context, pixbuf *gdk.Pixbuf, pixbufX, pixbufY float64) { - context := (*C.cairo_t)(unsafe.Pointer(cr.Native())) - ptr := (*C.GdkPixbuf)(unsafe.Pointer(pixbuf.Native())) - C.gdk_cairo_set_source_pixbuf(context, ptr, C.gdouble(pixbufX), C.gdouble(pixbufY)) -} - -/* - * GtkCssProvider - */ - -// CssProvider is a representation of GTK's GtkCssProvider. -type CssProvider struct { - *glib.Object -} - -func (v *CssProvider) toStyleProvider() *C.GtkStyleProvider { - if v == nil { - return nil - } - return C.toGtkStyleProvider(unsafe.Pointer(v.native())) -} - -// native returns a pointer to the underlying GtkCssProvider. -func (v *CssProvider) native() *C.GtkCssProvider { - if v == nil || v.Object == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkCssProvider(p) -} - -func wrapCssProvider(obj *glib.Object) *CssProvider { - return &CssProvider{obj} -} - -// CssProviderNew is a wrapper around gtk_css_provider_new(). -func CssProviderNew() (*CssProvider, error) { - c := C.gtk_css_provider_new() - if c == nil { - return nil, nilPtrErr - } - - return wrapCssProvider(glib.Take(unsafe.Pointer(c))), nil -} - -// LoadFromPath is a wrapper around gtk_css_provider_load_from_path(). -func (v *CssProvider) LoadFromPath(path string) error { - cpath := C.CString(path) - defer C.free(unsafe.Pointer(cpath)) - var gerr *C.GError - if C.gtk_css_provider_load_from_path(v.native(), (*C.gchar)(cpath), &gerr) == 0 { - defer C.g_error_free(gerr) - return errors.New(goString(gerr.message)) - } - return nil -} - -// LoadFromData is a wrapper around gtk_css_provider_load_from_data(). -func (v *CssProvider) LoadFromData(data string) error { - cdata := C.CString(data) - defer C.free(unsafe.Pointer(cdata)) - var gerr *C.GError - if C.gtk_css_provider_load_from_data(v.native(), (*C.gchar)(unsafe.Pointer(cdata)), C.gssize(len(data)), &gerr) == 0 { - defer C.g_error_free(gerr) - return errors.New(goString(gerr.message)) - } - return nil -} - -// ToString is a wrapper around gtk_css_provider_to_string(). -func (v *CssProvider) ToString() (string, error) { - c := C.gtk_css_provider_to_string(v.native()) - if c == nil { - return "", nilPtrErr - } - return C.GoString(c), nil -} - -// GetNamed is a wrapper around gtk_css_provider_get_named(). -func CssProviderGetNamed(name string, variant string) (*CssProvider, error) { - cname := C.CString(name) - defer C.free(unsafe.Pointer(cname)) - cvariant := C.CString(variant) - defer C.free(unsafe.Pointer(cvariant)) - - c := C.gtk_css_provider_get_named((*C.gchar)(cname), (*C.gchar)(cvariant)) - if c == nil { - return nil, nilPtrErr - } - - obj := glib.Take(unsafe.Pointer(c)) - return wrapCssProvider(obj), nil -} - -/* - * GtkDialog - */ - -// Dialog is a representation of GTK's GtkDialog. -type Dialog struct { - Window -} - -// native returns a pointer to the underlying GtkDialog. -func (v *Dialog) native() *C.GtkDialog { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkDialog(p) -} - -func marshalDialog(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapDialog(obj), nil -} - -func wrapDialog(obj *glib.Object) *Dialog { - return &Dialog{Window{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}}} -} - -// DialogNew() is a wrapper around gtk_dialog_new(). -func DialogNew() (*Dialog, error) { - c := C.gtk_dialog_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapDialog(obj), nil -} - -// Run() is a wrapper around gtk_dialog_run(). -func (v *Dialog) Run() ResponseType { - c := C.gtk_dialog_run(v.native()) - return ResponseType(c) -} - -// Response() is a wrapper around gtk_dialog_response(). -func (v *Dialog) Response(response ResponseType) { - C.gtk_dialog_response(v.native(), C.gint(response)) -} - -// AddButton() is a wrapper around gtk_dialog_add_button(). text may -// be either the literal button text, or if using GTK 3.8 or earlier, a -// Stock type converted to a string. -func (v *Dialog) AddButton(text string, id ResponseType) (*Button, error) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_dialog_add_button(v.native(), (*C.gchar)(cstr), C.gint(id)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapButton(obj), nil -} - -// AddActionWidget() is a wrapper around gtk_dialog_add_action_widget(). -func (v *Dialog) AddActionWidget(child IWidget, id ResponseType) { - C.gtk_dialog_add_action_widget(v.native(), child.toWidget(), C.gint(id)) -} - -// SetDefaultResponse() is a wrapper around gtk_dialog_set_default_response(). -func (v *Dialog) SetDefaultResponse(id ResponseType) { - C.gtk_dialog_set_default_response(v.native(), C.gint(id)) -} - -// SetResponseSensitive() is a wrapper around -// gtk_dialog_set_response_sensitive(). -func (v *Dialog) SetResponseSensitive(id ResponseType, setting bool) { - C.gtk_dialog_set_response_sensitive(v.native(), C.gint(id), - gbool(setting)) -} - -// GetResponseForWidget() is a wrapper around -// gtk_dialog_get_response_for_widget(). -func (v *Dialog) GetResponseForWidget(widget IWidget) ResponseType { - c := C.gtk_dialog_get_response_for_widget(v.native(), widget.toWidget()) - return ResponseType(c) -} - -// GetWidgetForResponse() is a wrapper around -// gtk_dialog_get_widget_for_response(). -func (v *Dialog) GetWidgetForResponse(id ResponseType) (*Widget, error) { - c := C.gtk_dialog_get_widget_for_response(v.native(), C.gint(id)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapWidget(obj), nil -} - -// GetContentArea() is a wrapper around gtk_dialog_get_content_area(). -func (v *Dialog) GetContentArea() (*Box, error) { - c := C.gtk_dialog_get_content_area(v.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - b := &Box{Container{Widget{glib.InitiallyUnowned{obj}}}} - return b, nil -} - -// TODO(jrick) -/* -func (v *gdk.Screen) AlternativeDialogButtonOrder() bool { - c := C.gtk_alternative_dialog_button_order(v.native()) - return gobool(c) -} -*/ - -// TODO(jrick) -/* -func SetAlternativeButtonOrder(ids ...ResponseType) { -} -*/ - -/* - * GtkDrawingArea - */ - -// DrawingArea is a representation of GTK's GtkDrawingArea. -type DrawingArea struct { - Widget -} - -// native returns a pointer to the underlying GtkDrawingArea. -func (v *DrawingArea) native() *C.GtkDrawingArea { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkDrawingArea(p) -} - -func marshalDrawingArea(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapDrawingArea(obj), nil -} - -func wrapDrawingArea(obj *glib.Object) *DrawingArea { - return &DrawingArea{Widget{glib.InitiallyUnowned{obj}}} -} - -// DrawingAreaNew is a wrapper around gtk_drawing_area_new(). -func DrawingAreaNew() (*DrawingArea, error) { - c := C.gtk_drawing_area_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapDrawingArea(obj), nil -} - -/* - * GtkEditable - */ - -// Editable is a representation of GTK's GtkEditable GInterface. -type Editable struct { - *glib.Object -} - -// IEditable is an interface type implemented by all structs -// embedding an Editable. It is meant to be used as an argument type -// for wrapper functions that wrap around a C GTK function taking a -// GtkEditable. -type IEditable interface { - toEditable() *C.GtkEditable -} - -// native() returns a pointer to the underlying GObject as a GtkEditable. -func (v *Editable) native() *C.GtkEditable { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkEditable(p) -} - -func marshalEditable(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapEditable(obj), nil -} - -func wrapEditable(obj *glib.Object) *Editable { - return &Editable{obj} -} - -func (v *Editable) toEditable() *C.GtkEditable { - if v == nil { - return nil - } - return v.native() -} - -// SelectRegion is a wrapper around gtk_editable_select_region(). -func (v *Editable) SelectRegion(startPos, endPos int) { - C.gtk_editable_select_region(v.native(), C.gint(startPos), - C.gint(endPos)) -} - -// GetSelectionBounds is a wrapper around gtk_editable_get_selection_bounds(). -func (v *Editable) GetSelectionBounds() (start, end int, nonEmpty bool) { - var cstart, cend C.gint - c := C.gtk_editable_get_selection_bounds(v.native(), &cstart, &cend) - return int(cstart), int(cend), gobool(c) -} - -// InsertText is a wrapper around gtk_editable_insert_text(). The returned -// int is the position after the inserted text. -func (v *Editable) InsertText(newText string, position int) int { - cstr := C.CString(newText) - defer C.free(unsafe.Pointer(cstr)) - pos := new(C.gint) - *pos = C.gint(position) - C.gtk_editable_insert_text(v.native(), (*C.gchar)(cstr), - C.gint(len(newText)), pos) - return int(*pos) -} - -// DeleteText is a wrapper around gtk_editable_delete_text(). -func (v *Editable) DeleteText(startPos, endPos int) { - C.gtk_editable_delete_text(v.native(), C.gint(startPos), C.gint(endPos)) -} - -// GetChars is a wrapper around gtk_editable_get_chars(). -func (v *Editable) GetChars(startPos, endPos int) string { - c := C.gtk_editable_get_chars(v.native(), C.gint(startPos), - C.gint(endPos)) - defer C.free(unsafe.Pointer(c)) - return goString(c) -} - -// CutClipboard is a wrapper around gtk_editable_cut_clipboard(). -func (v *Editable) CutClipboard() { - C.gtk_editable_cut_clipboard(v.native()) -} - -// CopyClipboard is a wrapper around gtk_editable_copy_clipboard(). -func (v *Editable) CopyClipboard() { - C.gtk_editable_copy_clipboard(v.native()) -} - -// PasteClipboard is a wrapper around gtk_editable_paste_clipboard(). -func (v *Editable) PasteClipboard() { - C.gtk_editable_paste_clipboard(v.native()) -} - -// DeleteSelection is a wrapper around gtk_editable_delete_selection(). -func (v *Editable) DeleteSelection() { - C.gtk_editable_delete_selection(v.native()) -} - -// SetPosition is a wrapper around gtk_editable_set_position(). -func (v *Editable) SetPosition(position int) { - C.gtk_editable_set_position(v.native(), C.gint(position)) -} - -// GetPosition is a wrapper around gtk_editable_get_position(). -func (v *Editable) GetPosition() int { - c := C.gtk_editable_get_position(v.native()) - return int(c) -} - -// SetEditable is a wrapper around gtk_editable_set_editable(). -func (v *Editable) SetEditable(isEditable bool) { - C.gtk_editable_set_editable(v.native(), gbool(isEditable)) -} - -// GetEditable is a wrapper around gtk_editable_get_editable(). -func (v *Editable) GetEditable() bool { - c := C.gtk_editable_get_editable(v.native()) - return gobool(c) -} - -/* - * GtkEntry - */ - -// Entry is a representation of GTK's GtkEntry. -type Entry struct { - Widget - - // Interfaces - Editable -} - -type IEntry interface { - toEntry() *C.GtkEntry -} - -func (v *Entry) toEntry() *C.GtkEntry { - return v.native() -} - -// native returns a pointer to the underlying GtkEntry. -func (v *Entry) native() *C.GtkEntry { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkEntry(p) -} - -func marshalEntry(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapEntry(obj), nil -} - -func wrapEntry(obj *glib.Object) *Entry { - e := wrapEditable(obj) - return &Entry{Widget{glib.InitiallyUnowned{obj}}, *e} -} - -// EntryNew() is a wrapper around gtk_entry_new(). -func EntryNew() (*Entry, error) { - c := C.gtk_entry_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapEntry(obj), nil -} - -// EntryNewWithBuffer() is a wrapper around gtk_entry_new_with_buffer(). -func EntryNewWithBuffer(buffer *EntryBuffer) (*Entry, error) { - c := C.gtk_entry_new_with_buffer(buffer.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapEntry(obj), nil -} - -// GetBuffer() is a wrapper around gtk_entry_get_buffer(). -func (v *Entry) GetBuffer() (*EntryBuffer, error) { - c := C.gtk_entry_get_buffer(v.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return &EntryBuffer{obj}, nil -} - -// SetBuffer() is a wrapper around gtk_entry_set_buffer(). -func (v *Entry) SetBuffer(buffer *EntryBuffer) { - C.gtk_entry_set_buffer(v.native(), buffer.native()) -} - -// SetText() is a wrapper around gtk_entry_set_text(). -func (v *Entry) SetText(text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_entry_set_text(v.native(), (*C.gchar)(cstr)) -} - -// GetText() is a wrapper around gtk_entry_get_text(). -func (v *Entry) GetText() (string, error) { - c := C.gtk_entry_get_text(v.native()) - if c == nil { - return "", nilPtrErr - } - return goString(c), nil -} - -// GetTextLength() is a wrapper around gtk_entry_get_text_length(). -func (v *Entry) GetTextLength() uint16 { - c := C.gtk_entry_get_text_length(v.native()) - return uint16(c) -} - -// TODO(jrick) GdkRectangle -/* -func (v *Entry) GetTextArea() { -} -*/ - -// SetVisibility() is a wrapper around gtk_entry_set_visibility(). -func (v *Entry) SetVisibility(visible bool) { - C.gtk_entry_set_visibility(v.native(), gbool(visible)) -} - -// SetInvisibleChar() is a wrapper around gtk_entry_set_invisible_char(). -func (v *Entry) SetInvisibleChar(ch rune) { - C.gtk_entry_set_invisible_char(v.native(), C.gunichar(ch)) -} - -// UnsetInvisibleChar() is a wrapper around gtk_entry_unset_invisible_char(). -func (v *Entry) UnsetInvisibleChar() { - C.gtk_entry_unset_invisible_char(v.native()) -} - -// SetMaxLength() is a wrapper around gtk_entry_set_max_length(). -func (v *Entry) SetMaxLength(len int) { - C.gtk_entry_set_max_length(v.native(), C.gint(len)) -} - -// GetActivatesDefault() is a wrapper around gtk_entry_get_activates_default(). -func (v *Entry) GetActivatesDefault() bool { - c := C.gtk_entry_get_activates_default(v.native()) - return gobool(c) -} - -// GetHasFrame() is a wrapper around gtk_entry_get_has_frame(). -func (v *Entry) GetHasFrame() bool { - c := C.gtk_entry_get_has_frame(v.native()) - return gobool(c) -} - -// GetWidthChars() is a wrapper around gtk_entry_get_width_chars(). -func (v *Entry) GetWidthChars() int { - c := C.gtk_entry_get_width_chars(v.native()) - return int(c) -} - -// SetActivatesDefault() is a wrapper around gtk_entry_set_activates_default(). -func (v *Entry) SetActivatesDefault(setting bool) { - C.gtk_entry_set_activates_default(v.native(), gbool(setting)) -} - -// SetHasFrame() is a wrapper around gtk_entry_set_has_frame(). -func (v *Entry) SetHasFrame(setting bool) { - C.gtk_entry_set_has_frame(v.native(), gbool(setting)) -} - -// SetWidthChars() is a wrapper around gtk_entry_set_width_chars(). -func (v *Entry) SetWidthChars(nChars int) { - C.gtk_entry_set_width_chars(v.native(), C.gint(nChars)) -} - -// GetInvisibleChar() is a wrapper around gtk_entry_get_invisible_char(). -func (v *Entry) GetInvisibleChar() rune { - c := C.gtk_entry_get_invisible_char(v.native()) - return rune(c) -} - -// SetAlignment() is a wrapper around gtk_entry_set_alignment(). -func (v *Entry) SetAlignment(xalign float32) { - C.gtk_entry_set_alignment(v.native(), C.gfloat(xalign)) -} - -// GetAlignment() is a wrapper around gtk_entry_get_alignment(). -func (v *Entry) GetAlignment() float32 { - c := C.gtk_entry_get_alignment(v.native()) - return float32(c) -} - -// SetPlaceholderText() is a wrapper around gtk_entry_set_placeholder_text(). -func (v *Entry) SetPlaceholderText(text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_entry_set_placeholder_text(v.native(), (*C.gchar)(cstr)) -} - -// GetPlaceholderText() is a wrapper around gtk_entry_get_placeholder_text(). -func (v *Entry) GetPlaceholderText() (string, error) { - c := C.gtk_entry_get_placeholder_text(v.native()) - if c == nil { - return "", nilPtrErr - } - return goString(c), nil -} - -// SetOverwriteMode() is a wrapper around gtk_entry_set_overwrite_mode(). -func (v *Entry) SetOverwriteMode(overwrite bool) { - C.gtk_entry_set_overwrite_mode(v.native(), gbool(overwrite)) -} - -// GetOverwriteMode() is a wrapper around gtk_entry_get_overwrite_mode(). -func (v *Entry) GetOverwriteMode() bool { - c := C.gtk_entry_get_overwrite_mode(v.native()) - return gobool(c) -} - -// TODO(jrick) Pangolayout -/* -func (v *Entry) GetLayout() { -} -*/ - -// GetLayoutOffsets() is a wrapper around gtk_entry_get_layout_offsets(). -func (v *Entry) GetLayoutOffsets() (x, y int) { - var gx, gy C.gint - C.gtk_entry_get_layout_offsets(v.native(), &gx, &gy) - return int(gx), int(gy) -} - -// LayoutIndexToTextIndex() is a wrapper around -// gtk_entry_layout_index_to_text_index(). -func (v *Entry) LayoutIndexToTextIndex(layoutIndex int) int { - c := C.gtk_entry_layout_index_to_text_index(v.native(), - C.gint(layoutIndex)) - return int(c) -} - -// TextIndexToLayoutIndex() is a wrapper around -// gtk_entry_text_index_to_layout_index(). -func (v *Entry) TextIndexToLayoutIndex(textIndex int) int { - c := C.gtk_entry_text_index_to_layout_index(v.native(), - C.gint(textIndex)) - return int(c) -} - -// TODO(jrick) PandoAttrList -/* -func (v *Entry) SetAttributes() { -} -*/ - -// TODO(jrick) PandoAttrList -/* -func (v *Entry) GetAttributes() { -} -*/ - -// GetMaxLength() is a wrapper around gtk_entry_get_max_length(). -func (v *Entry) GetMaxLength() int { - c := C.gtk_entry_get_max_length(v.native()) - return int(c) -} - -// GetVisibility() is a wrapper around gtk_entry_get_visibility(). -func (v *Entry) GetVisibility() bool { - c := C.gtk_entry_get_visibility(v.native()) - return gobool(c) -} - -// SetCompletion() is a wrapper around gtk_entry_set_completion(). -func (v *Entry) SetCompletion(completion *EntryCompletion) { - C.gtk_entry_set_completion(v.native(), completion.native()) -} - -// GetCompletion() is a wrapper around gtk_entry_get_completion(). -func (v *Entry) GetCompletion() (*EntryCompletion, error) { - c := C.gtk_entry_get_completion(v.native()) - if c == nil { - return nil, nilPtrErr - } - - e := &EntryCompletion{glib.Take(unsafe.Pointer(c))} - return e, nil -} - -// SetCursorHAdjustment() is a wrapper around -// gtk_entry_set_cursor_hadjustment(). -func (v *Entry) SetCursorHAdjustment(adjustment *Adjustment) { - C.gtk_entry_set_cursor_hadjustment(v.native(), adjustment.native()) -} - -// GetCursorHAdjustment() is a wrapper around -// gtk_entry_get_cursor_hadjustment(). -func (v *Entry) GetCursorHAdjustment() (*Adjustment, error) { - c := C.gtk_entry_get_cursor_hadjustment(v.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return &Adjustment{glib.InitiallyUnowned{obj}}, nil -} - -// SetProgressFraction() is a wrapper around gtk_entry_set_progress_fraction(). -func (v *Entry) SetProgressFraction(fraction float64) { - C.gtk_entry_set_progress_fraction(v.native(), C.gdouble(fraction)) -} - -// GetProgressFraction() is a wrapper around gtk_entry_get_progress_fraction(). -func (v *Entry) GetProgressFraction() float64 { - c := C.gtk_entry_get_progress_fraction(v.native()) - return float64(c) -} - -// SetProgressPulseStep() is a wrapper around -// gtk_entry_set_progress_pulse_step(). -func (v *Entry) SetProgressPulseStep(fraction float64) { - C.gtk_entry_set_progress_pulse_step(v.native(), C.gdouble(fraction)) -} - -// GetProgressPulseStep() is a wrapper around -// gtk_entry_get_progress_pulse_step(). -func (v *Entry) GetProgressPulseStep() float64 { - c := C.gtk_entry_get_progress_pulse_step(v.native()) - return float64(c) -} - -// ProgressPulse() is a wrapper around gtk_entry_progress_pulse(). -func (v *Entry) ProgressPulse() { - C.gtk_entry_progress_pulse(v.native()) -} - -// TODO(jrick) GdkEventKey -/* -func (v *Entry) IMContextFilterKeypress() { -} -*/ - -// ResetIMContext() is a wrapper around gtk_entry_reset_im_context(). -func (v *Entry) ResetIMContext() { - C.gtk_entry_reset_im_context(v.native()) -} - -// SetIconFromPixbuf is a wrapper around gtk_entry_set_icon_from_pixbuf(). -func (v *Entry) SetIconFromPixbuf(iconPos EntryIconPosition, pixbuf *gdk.Pixbuf) { - C.gtk_entry_set_icon_from_pixbuf(v.native(), - C.GtkEntryIconPosition(iconPos), - (*C.GdkPixbuf)(unsafe.Pointer(pixbuf.Native()))) -} - -// SetIconFromIconName() is a wrapper around -// gtk_entry_set_icon_from_icon_name(). -func (v *Entry) SetIconFromIconName(iconPos EntryIconPosition, name string) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_entry_set_icon_from_icon_name(v.native(), - C.GtkEntryIconPosition(iconPos), (*C.gchar)(cstr)) -} - -// TODO(jrick) GIcon -/* -func (v *Entry) SetIconFromGIcon() { -} -*/ - -// GetIconStorageType() is a wrapper around gtk_entry_get_icon_storage_type(). -func (v *Entry) GetIconStorageType(iconPos EntryIconPosition) ImageType { - c := C.gtk_entry_get_icon_storage_type(v.native(), - C.GtkEntryIconPosition(iconPos)) - return ImageType(c) -} - -// TODO(jrick) GdkPixbuf -/* -func (v *Entry) GetIconPixbuf() { -} -*/ - -// GetIconName() is a wrapper around gtk_entry_get_icon_name(). -func (v *Entry) GetIconName(iconPos EntryIconPosition) (string, error) { - c := C.gtk_entry_get_icon_name(v.native(), - C.GtkEntryIconPosition(iconPos)) - if c == nil { - return "", nilPtrErr - } - return goString(c), nil -} - -// TODO(jrick) GIcon -/* -func (v *Entry) GetIconGIcon() { -} -*/ - -// SetIconActivatable() is a wrapper around gtk_entry_set_icon_activatable(). -func (v *Entry) SetIconActivatable(iconPos EntryIconPosition, activatable bool) { - C.gtk_entry_set_icon_activatable(v.native(), - C.GtkEntryIconPosition(iconPos), gbool(activatable)) -} - -// GetIconActivatable() is a wrapper around gtk_entry_get_icon_activatable(). -func (v *Entry) GetIconActivatable(iconPos EntryIconPosition) bool { - c := C.gtk_entry_get_icon_activatable(v.native(), - C.GtkEntryIconPosition(iconPos)) - return gobool(c) -} - -// SetIconSensitive() is a wrapper around gtk_entry_set_icon_sensitive(). -func (v *Entry) SetIconSensitive(iconPos EntryIconPosition, sensitive bool) { - C.gtk_entry_set_icon_sensitive(v.native(), - C.GtkEntryIconPosition(iconPos), gbool(sensitive)) -} - -// GetIconSensitive() is a wrapper around gtk_entry_get_icon_sensitive(). -func (v *Entry) GetIconSensitive(iconPos EntryIconPosition) bool { - c := C.gtk_entry_get_icon_sensitive(v.native(), - C.GtkEntryIconPosition(iconPos)) - return gobool(c) -} - -// GetIconAtPos() is a wrapper around gtk_entry_get_icon_at_pos(). -func (v *Entry) GetIconAtPos(x, y int) int { - c := C.gtk_entry_get_icon_at_pos(v.native(), C.gint(x), C.gint(y)) - return int(c) -} - -// SetIconTooltipText() is a wrapper around gtk_entry_set_icon_tooltip_text(). -func (v *Entry) SetIconTooltipText(iconPos EntryIconPosition, tooltip string) { - cstr := C.CString(tooltip) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_entry_set_icon_tooltip_text(v.native(), - C.GtkEntryIconPosition(iconPos), (*C.gchar)(cstr)) -} - -// GetIconTooltipText() is a wrapper around gtk_entry_get_icon_tooltip_text(). -func (v *Entry) GetIconTooltipText(iconPos EntryIconPosition) (string, error) { - c := C.gtk_entry_get_icon_tooltip_text(v.native(), - C.GtkEntryIconPosition(iconPos)) - if c == nil { - return "", nilPtrErr - } - return goString(c), nil -} - -// SetIconTooltipMarkup() is a wrapper around -// gtk_entry_set_icon_tooltip_markup(). -func (v *Entry) SetIconTooltipMarkup(iconPos EntryIconPosition, tooltip string) { - cstr := C.CString(tooltip) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_entry_set_icon_tooltip_markup(v.native(), - C.GtkEntryIconPosition(iconPos), (*C.gchar)(cstr)) -} - -// GetIconTooltipMarkup() is a wrapper around -// gtk_entry_get_icon_tooltip_markup(). -func (v *Entry) GetIconTooltipMarkup(iconPos EntryIconPosition) (string, error) { - c := C.gtk_entry_get_icon_tooltip_markup(v.native(), - C.GtkEntryIconPosition(iconPos)) - if c == nil { - return "", nilPtrErr - } - return goString(c), nil -} - -// TODO(jrick) GdkDragAction -/* -func (v *Entry) SetIconDragSource() { -} -*/ - -// GetCurrentIconDragSource() is a wrapper around -// gtk_entry_get_current_icon_drag_source(). -func (v *Entry) GetCurrentIconDragSource() int { - c := C.gtk_entry_get_current_icon_drag_source(v.native()) - return int(c) -} - -// TODO(jrick) GdkRectangle -/* -func (v *Entry) GetIconArea() { -} -*/ - -// SetInputPurpose() is a wrapper around gtk_entry_set_input_purpose(). -func (v *Entry) SetInputPurpose(purpose InputPurpose) { - C.gtk_entry_set_input_purpose(v.native(), C.GtkInputPurpose(purpose)) -} - -// GetInputPurpose() is a wrapper around gtk_entry_get_input_purpose(). -func (v *Entry) GetInputPurpose() InputPurpose { - c := C.gtk_entry_get_input_purpose(v.native()) - return InputPurpose(c) -} - -// SetInputHints() is a wrapper around gtk_entry_set_input_hints(). -func (v *Entry) SetInputHints(hints InputHints) { - C.gtk_entry_set_input_hints(v.native(), C.GtkInputHints(hints)) -} - -// GetInputHints() is a wrapper around gtk_entry_get_input_hints(). -func (v *Entry) GetInputHints() InputHints { - c := C.gtk_entry_get_input_hints(v.native()) - return InputHints(c) -} - -/* - * GtkEntryBuffer - */ - -// EntryBuffer is a representation of GTK's GtkEntryBuffer. -type EntryBuffer struct { - *glib.Object -} - -// native returns a pointer to the underlying GtkEntryBuffer. -func (v *EntryBuffer) native() *C.GtkEntryBuffer { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkEntryBuffer(p) -} - -func marshalEntryBuffer(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapEntryBuffer(obj), nil -} - -func wrapEntryBuffer(obj *glib.Object) *EntryBuffer { - return &EntryBuffer{obj} -} - -// EntryBufferNew() is a wrapper around gtk_entry_buffer_new(). -func EntryBufferNew(initialChars string, nInitialChars int) (*EntryBuffer, error) { - cstr := C.CString(initialChars) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_entry_buffer_new((*C.gchar)(cstr), C.gint(nInitialChars)) - if c == nil { - return nil, nilPtrErr - } - - e := wrapEntryBuffer(glib.Take(unsafe.Pointer(c))) - return e, nil -} - -// GetText() is a wrapper around gtk_entry_buffer_get_text(). A -// non-nil error is returned in the case that gtk_entry_buffer_get_text -// returns NULL to differentiate between NULL and an empty string. -func (v *EntryBuffer) GetText() (string, error) { - c := C.gtk_entry_buffer_get_text(v.native()) - if c == nil { - return "", nilPtrErr - } - return goString(c), nil -} - -// SetText() is a wrapper around gtk_entry_buffer_set_text(). -func (v *EntryBuffer) SetText(text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_entry_buffer_set_text(v.native(), (*C.gchar)(cstr), - C.gint(len(text))) -} - -// GetBytes() is a wrapper around gtk_entry_buffer_get_bytes(). -func (v *EntryBuffer) GetBytes() uint { - c := C.gtk_entry_buffer_get_bytes(v.native()) - return uint(c) -} - -// GetLength() is a wrapper around gtk_entry_buffer_get_length(). -func (v *EntryBuffer) GetLength() uint { - c := C.gtk_entry_buffer_get_length(v.native()) - return uint(c) -} - -// GetMaxLength() is a wrapper around gtk_entry_buffer_get_max_length(). -func (v *EntryBuffer) GetMaxLength() int { - c := C.gtk_entry_buffer_get_max_length(v.native()) - return int(c) -} - -// SetMaxLength() is a wrapper around gtk_entry_buffer_set_max_length(). -func (v *EntryBuffer) SetMaxLength(maxLength int) { - C.gtk_entry_buffer_set_max_length(v.native(), C.gint(maxLength)) -} - -// InsertText() is a wrapper around gtk_entry_buffer_insert_text(). -func (v *EntryBuffer) InsertText(position uint, text string) uint { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_entry_buffer_insert_text(v.native(), C.guint(position), - (*C.gchar)(cstr), C.gint(len(text))) - return uint(c) -} - -// DeleteText() is a wrapper around gtk_entry_buffer_delete_text(). -func (v *EntryBuffer) DeleteText(position uint, nChars int) uint { - c := C.gtk_entry_buffer_delete_text(v.native(), C.guint(position), - C.gint(nChars)) - return uint(c) -} - -// EmitDeletedText() is a wrapper around gtk_entry_buffer_emit_deleted_text(). -func (v *EntryBuffer) EmitDeletedText(pos, nChars uint) { - C.gtk_entry_buffer_emit_deleted_text(v.native(), C.guint(pos), - C.guint(nChars)) -} - -// EmitInsertedText() is a wrapper around gtk_entry_buffer_emit_inserted_text(). -func (v *EntryBuffer) EmitInsertedText(pos uint, text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_entry_buffer_emit_inserted_text(v.native(), C.guint(pos), - (*C.gchar)(cstr), C.guint(len(text))) -} - -/* - * GtkEntryCompletion - */ - -// EntryCompletion is a representation of GTK's GtkEntryCompletion. -type EntryCompletion struct { - *glib.Object -} - -// native returns a pointer to the underlying GtkEntryCompletion. -func (v *EntryCompletion) native() *C.GtkEntryCompletion { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkEntryCompletion(p) -} - -func marshalEntryCompletion(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapEntryCompletion(obj), nil -} - -func wrapEntryCompletion(obj *glib.Object) *EntryCompletion { - return &EntryCompletion{obj} -} - -/* - * GtkEventBox - */ - -// EventBox is a representation of GTK's GtkEventBox. -type EventBox struct { - Bin -} - -// native returns a pointer to the underlying GtkEventBox. -func (v *EventBox) native() *C.GtkEventBox { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkEventBox(p) -} - -func marshalEventBox(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapEventBox(obj), nil -} - -func wrapEventBox(obj *glib.Object) *EventBox { - return &EventBox{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// EventBoxNew is a wrapper around gtk_event_box_new(). -func EventBoxNew() (*EventBox, error) { - c := C.gtk_event_box_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapEventBox(obj), nil -} - -// SetAboveChild is a wrapper around gtk_event_box_set_above_child(). -func (v *EventBox) SetAboveChild(aboveChild bool) { - C.gtk_event_box_set_above_child(v.native(), gbool(aboveChild)) -} - -// GetAboveChild is a wrapper around gtk_event_box_get_above_child(). -func (v *EventBox) GetAboveChild() bool { - c := C.gtk_event_box_get_above_child(v.native()) - return gobool(c) -} - -// SetVisibleWindow is a wrapper around gtk_event_box_set_visible_window(). -func (v *EventBox) SetVisibleWindow(visibleWindow bool) { - C.gtk_event_box_set_visible_window(v.native(), gbool(visibleWindow)) -} - -// GetVisibleWindow is a wrapper around gtk_event_box_get_visible_window(). -func (v *EventBox) GetVisibleWindow() bool { - c := C.gtk_event_box_get_visible_window(v.native()) - return gobool(c) -} - -/* - * GtkExpander - */ - -// Expander is a representation of GTK's GtkExpander. -type Expander struct { - Bin -} - -// native returns a pointer to the underlying GtkExpander. -func (v *Expander) native() *C.GtkExpander { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkExpander(p) -} - -func marshalExpander(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapExpander(obj), nil -} - -func wrapExpander(obj *glib.Object) *Expander { - return &Expander{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// ExpanderNew is a wrapper around gtk_expander_new(). -func ExpanderNew(label string) (*Expander, error) { - var cstr *C.gchar - if label != "" { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - } - c := C.gtk_expander_new((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapExpander(obj), nil -} - -// SetExpanded is a wrapper around gtk_expander_set_expanded(). -func (v *Expander) SetExpanded(expanded bool) { - C.gtk_expander_set_expanded(v.native(), gbool(expanded)) -} - -// GetExpanded is a wrapper around gtk_expander_get_expanded(). -func (v *Expander) GetExpanded() bool { - c := C.gtk_expander_get_expanded(v.native()) - return gobool(c) -} - -// SetLabel is a wrapper around gtk_expander_set_label(). -func (v *Expander) SetLabel(label string) { - var cstr *C.char - if label != "" { - cstr = C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - } - C.gtk_expander_set_label(v.native(), (*C.gchar)(cstr)) -} - -// GetLabel is a wrapper around gtk_expander_get_label(). -func (v *Expander) GetLabel() string { - c := C.gtk_expander_get_label(v.native()) - return goString(c) -} - -// SetLabelWidget is a wrapper around gtk_expander_set_label_widget(). -func (v *Expander) SetLabelWidget(widget IWidget) { - C.gtk_expander_set_label_widget(v.native(), widget.toWidget()) -} - -/* - * GtkFileChooser - */ - -// FileChoser is a representation of GTK's GtkFileChooser GInterface. -type FileChooser struct { - *glib.Object -} - -// native returns a pointer to the underlying GObject as a GtkFileChooser. -func (v *FileChooser) native() *C.GtkFileChooser { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkFileChooser(p) -} - -func marshalFileChooser(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapFileChooser(obj), nil -} - -func wrapFileChooser(obj *glib.Object) *FileChooser { - return &FileChooser{obj} -} - -// SetFilename is a wrapper around gtk_file_chooser_set_filename(). -func (v *FileChooser) SetFilename(filename string) bool { - cstr := C.CString(filename) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_file_chooser_set_filename(v.native(), cstr) - return gobool(c) -} - -// GetFilename is a wrapper around gtk_file_chooser_get_filename(). -func (v *FileChooser) GetFilename() string { - c := C.gtk_file_chooser_get_filename(v.native()) - s := goString(c) - defer C.g_free((C.gpointer)(c)) - return s -} - -// GetFilenames is a wrapper around gtk_file_chooser_get_filenames(). -func (v *FileChooser) GetFilenames() (*glib.SList, error) { - c := C.gtk_file_chooser_get_filenames(v.native()) - if c == nil { - return nil, nilPtrErr - } - return glib.WrapSList(uintptr(unsafe.Pointer(c))), nil -} - -// GetURIs is a wrapper around gtk_file_chooser_get_uris(). -func (v FileChooser) GetURIs() (*glib.SList, error) { - c := C.gtk_file_chooser_get_uris(v.native()) - if c == nil { - return nil, nilPtrErr - } - return glib.WrapSList(uintptr(unsafe.Pointer(c))), nil -} - -// SetDoOverwriteConfirmation is a wrapper around gtk_file_chooser_set_do_overwrite_confirmation(). -func (v *FileChooser) SetDoOverwriteConfirmation(value bool) { - C.gtk_file_chooser_set_do_overwrite_confirmation(v.native(), gbool(value)) -} - -// GetDoOverwriteConfirmation is a wrapper around gtk_file_chooser_get_do_overwrite_confirmation(). -func (v *FileChooser) GetDoOverwriteConfirmation() bool { - c := C.gtk_file_chooser_get_do_overwrite_confirmation(v.native()) - return gobool(c) -} - -// SetCreateFolders is a wrapper around gtk_file_chooser_set_create_folders(). -func (v *FileChooser) SetCreateFolders(value bool) { - C.gtk_file_chooser_set_create_folders(v.native(), gbool(value)) -} - -// GetCreateFolders is a wrapper around gtk_file_chooser_get_create_folders(). -func (v *FileChooser) GetCreateFolders() bool { - c := C.gtk_file_chooser_get_create_folders(v.native()) - return gobool(c) -} - -// SetCurrentName is a wrapper around gtk_file_chooser_set_current_name(). -func (v *FileChooser) SetCurrentName(name string) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_file_chooser_set_current_name(v.native(), (*C.gchar)(cstr)) - return -} - -// SetCurrentFolder is a wrapper around gtk_file_chooser_set_current_folder(). -func (v *FileChooser) SetCurrentFolder(folder string) bool { - cstr := C.CString(folder) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_file_chooser_set_current_folder(v.native(), (*C.gchar)(cstr)) - return gobool(c) -} - -// GetCurrentFolder is a wrapper around gtk_file_chooser_get_current_folder(). -func (v *FileChooser) GetCurrentFolder() (string, error) { - c := C.gtk_file_chooser_get_current_folder(v.native()) - if c == nil { - return "", nilPtrErr - } - defer C.free(unsafe.Pointer(c)) - return goString(c), nil -} - -// SetPreviewWidget is a wrapper around gtk_file_chooser_set_preview_widget(). -func (v *FileChooser) SetPreviewWidget(widget IWidget) { - C.gtk_file_chooser_set_preview_widget(v.native(), widget.toWidget()) -} - -// SetPreviewWidgetActive is a wrapper around gtk_file_chooser_set_preview_widget_active(). -func (v *FileChooser) SetPreviewWidgetActive(active bool) { - C.gtk_file_chooser_set_preview_widget_active(v.native(), gbool(active)) -} - -// GetPreviewFilename is a wrapper around gtk_file_chooser_get_preview_filename(). -func (v *FileChooser) GetPreviewFilename() string { - c := C.gtk_file_chooser_get_preview_filename(v.native()) - defer C.free(unsafe.Pointer(c)) - return C.GoString(c) -} - -// GetURI is a wrapper around gtk_file_chooser_get_uri(). -func (v *FileChooser) GetURI() string { - c := C.gtk_file_chooser_get_uri(v.native()) - s := goString(c) - defer C.g_free((C.gpointer)(c)) - return s -} - -// AddFilter is a wrapper around gtk_file_chooser_add_filter(). -func (v *FileChooser) AddFilter(filter *FileFilter) { - C.gtk_file_chooser_add_filter(v.native(), filter.native()) -} - -// RemoveFilter is a wrapper around gtk_file_chooser_remove_filter(). -func (v *FileChooser) RemoveFilter(filter *FileFilter) { - C.gtk_file_chooser_remove_filter(v.native(), filter.native()) -} - -// SetFilter is a wrapper around gtk_file_chooser_set_filter(). -func (v *FileChooser) SetFilter(filter *FileFilter) { - C.gtk_file_chooser_set_filter(v.native(), filter.native()) -} - -// AddShortcutFolder is a wrapper around gtk_file_chooser_add_shortcut_folder(). -func (v *FileChooser) AddShortcutFolder(folder string) bool { - cstr := C.CString(folder) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_file_chooser_add_shortcut_folder(v.native(), cstr, nil) - return gobool(c) -} - -// SetLocalOnly is a wrapper around gtk_file_chooser_set_local_only(). -func (v *FileChooser) SetLocalOnly(value bool) { - C.gtk_file_chooser_set_local_only(v.native(), gbool(value)) -} - -// GetLocalOnly is a wrapper around gtk_file_chooser_get_local_only(). -func (v *FileChooser) GetLocalOnly() bool { - c := C.gtk_file_chooser_get_local_only(v.native()) - return gobool(c) -} - -// SetSelectMultiple is a wrapper around gtk_file_chooser_set_select_multiple(). -func (v *FileChooser) SetSelectMultiple(value bool) { - C.gtk_file_chooser_set_select_multiple(v.native(), gbool(value)) -} - -// GetSelectMultiple is a wrapper around gtk_file_chooser_get_select_multiple(). -func (v *FileChooser) GetSelectMultiple() bool { - c := C.gtk_file_chooser_get_select_multiple(v.native()) - return gobool(c) -} - -/* - * GtkFileChooserButton - */ - -// FileChooserButton is a representation of GTK's GtkFileChooserButton. -type FileChooserButton struct { - Box - - // Interfaces - FileChooser -} - -// native returns a pointer to the underlying GtkFileChooserButton. -func (v *FileChooserButton) native() *C.GtkFileChooserButton { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkFileChooserButton(p) -} - -func marshalFileChooserButton(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapFileChooserButton(obj), nil -} - -func wrapFileChooserButton(obj *glib.Object) *FileChooserButton { - fc := wrapFileChooser(obj) - return &FileChooserButton{Box{Container{Widget{glib.InitiallyUnowned{obj}}}}, *fc} -} - -// FileChooserButtonNew is a wrapper around gtk_file_chooser_button_new(). -func FileChooserButtonNew(title string, action FileChooserAction) (*FileChooserButton, error) { - cstr := C.CString(title) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_file_chooser_button_new((*C.gchar)(cstr), - (C.GtkFileChooserAction)(action)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapFileChooserButton(obj), nil -} - -/* - * GtkFileChooserDialog - */ - -// FileChooserDialog is a representation of GTK's GtkFileChooserDialog. -type FileChooserDialog struct { - Dialog - - // Interfaces - FileChooser -} - -// native returns a pointer to the underlying GtkFileChooserDialog. -func (v *FileChooserDialog) native() *C.GtkFileChooserDialog { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkFileChooserDialog(p) -} - -func marshalFileChooserDialog(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapFileChooserDialog(obj), nil -} - -func wrapFileChooserDialog(obj *glib.Object) *FileChooserDialog { - fc := wrapFileChooser(obj) - return &FileChooserDialog{Dialog{Window{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}}}, *fc} -} - -// FileChooserDialogNewWith1Button is a wrapper around gtk_file_chooser_dialog_new() with one button. -func FileChooserDialogNewWith1Button( - title string, - parent *Window, - action FileChooserAction, - first_button_text string, - first_button_id ResponseType) (*FileChooserDialog, error) { - c_title := C.CString(title) - defer C.free(unsafe.Pointer(c_title)) - c_first_button_text := C.CString(first_button_text) - defer C.free(unsafe.Pointer(c_first_button_text)) - c := C.gtk_file_chooser_dialog_new_1( - (*C.gchar)(c_title), parent.native(), C.GtkFileChooserAction(action), - (*C.gchar)(c_first_button_text), C.int(first_button_id)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapFileChooserDialog(obj), nil -} - -// FileChooserDialogNewWith2Buttons is a wrapper around gtk_file_chooser_dialog_new() with two buttons. -func FileChooserDialogNewWith2Buttons( - title string, - parent *Window, - action FileChooserAction, - first_button_text string, - first_button_id ResponseType, - second_button_text string, - second_button_id ResponseType) (*FileChooserDialog, error) { - c_title := C.CString(title) - defer C.free(unsafe.Pointer(c_title)) - c_first_button_text := C.CString(first_button_text) - defer C.free(unsafe.Pointer(c_first_button_text)) - c_second_button_text := C.CString(second_button_text) - defer C.free(unsafe.Pointer(c_second_button_text)) - c := C.gtk_file_chooser_dialog_new_2( - (*C.gchar)(c_title), parent.native(), C.GtkFileChooserAction(action), - (*C.gchar)(c_first_button_text), C.int(first_button_id), - (*C.gchar)(c_second_button_text), C.int(second_button_id)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapFileChooserDialog(obj), nil -} - -/* - * GtkFileChooserWidget - */ - -// FileChooserWidget is a representation of GTK's GtkFileChooserWidget. -type FileChooserWidget struct { - Box - - // Interfaces - FileChooser -} - -// native returns a pointer to the underlying GtkFileChooserWidget. -func (v *FileChooserWidget) native() *C.GtkFileChooserWidget { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkFileChooserWidget(p) -} - -func marshalFileChooserWidget(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapFileChooserWidget(obj), nil -} - -func wrapFileChooserWidget(obj *glib.Object) *FileChooserWidget { - fc := wrapFileChooser(obj) - return &FileChooserWidget{Box{Container{Widget{glib.InitiallyUnowned{obj}}}}, *fc} -} - -// FileChooserWidgetNew is a wrapper around gtk_file_chooser_widget_new(). -func FileChooserWidgetNew(action FileChooserAction) (*FileChooserWidget, error) { - c := C.gtk_file_chooser_widget_new((C.GtkFileChooserAction)(action)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapFileChooserWidget(obj), nil -} - -/* - * GtkFileFilter - */ - -// FileChoser is a representation of GTK's GtkFileFilter GInterface. -type FileFilter struct { - *glib.Object -} - -// native returns a pointer to the underlying GObject as a GtkFileFilter. -func (v *FileFilter) native() *C.GtkFileFilter { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkFileFilter(p) -} - -func marshalFileFilter(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapFileFilter(obj), nil -} - -func wrapFileFilter(obj *glib.Object) *FileFilter { - return &FileFilter{obj} -} - -// FileFilterNew is a wrapper around gtk_file_filter_new(). -func FileFilterNew() (*FileFilter, error) { - c := C.gtk_file_filter_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapFileFilter(obj), nil -} - -// SetName is a wrapper around gtk_file_filter_set_name(). -func (v *FileFilter) SetName(name string) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_file_filter_set_name(v.native(), (*C.gchar)(cstr)) -} - -// AddPattern is a wrapper around gtk_file_filter_add_pattern(). -func (v *FileFilter) AddPattern(pattern string) { - cstr := C.CString(pattern) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_file_filter_add_pattern(v.native(), (*C.gchar)(cstr)) -} - -// AddPixbufFormats is a wrapper around gtk_file_filter_add_pixbuf_formats(). -func (v *FileFilter) AddPixbufFormats() { - C.gtk_file_filter_add_pixbuf_formats(v.native()) -} - -/* - * GtkFrame - */ - -// Frame is a representation of GTK's GtkFrame. -type Frame struct { - Bin -} - -// native returns a pointer to the underlying GtkFrame. -func (v *Frame) native() *C.GtkFrame { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkFrame(p) -} - -func marshalFrame(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapFrame(obj), nil -} - -func wrapFrame(obj *glib.Object) *Frame { - return &Frame{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// FrameNew is a wrapper around gtk_frame_new(). -func FrameNew(label string) (*Frame, error) { - var cstr *C.char - if label != "" { - cstr = C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - } - c := C.gtk_frame_new((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapFrame(obj), nil -} - -// SetLabel is a wrapper around gtk_frame_set_label(). -func (v *Frame) SetLabel(label string) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_frame_set_label(v.native(), (*C.gchar)(cstr)) -} - -// SetLabelWidget is a wrapper around gtk_frame_set_label_widget(). -func (v *Frame) SetLabelWidget(labelWidget IWidget) { - C.gtk_frame_set_label_widget(v.native(), labelWidget.toWidget()) -} - -// SetLabelAlign is a wrapper around gtk_frame_set_label_align(). -func (v *Frame) SetLabelAlign(xAlign, yAlign float32) { - C.gtk_frame_set_label_align(v.native(), C.gfloat(xAlign), - C.gfloat(yAlign)) -} - -// SetShadowType is a wrapper around gtk_frame_set_shadow_type(). -func (v *Frame) SetShadowType(t ShadowType) { - C.gtk_frame_set_shadow_type(v.native(), C.GtkShadowType(t)) -} - -// GetLabel is a wrapper around gtk_frame_get_label(). -func (v *Frame) GetLabel() string { - c := C.gtk_frame_get_label(v.native()) - return goString(c) -} - -// GetLabelAlign is a wrapper around gtk_frame_get_label_align(). -func (v *Frame) GetLabelAlign() (xAlign, yAlign float32) { - var x, y C.gfloat - C.gtk_frame_get_label_align(v.native(), &x, &y) - return float32(x), float32(y) -} - -// GetLabelWidget is a wrapper around gtk_frame_get_label_widget(). -func (v *Frame) GetLabelWidget() (*Widget, error) { - c := C.gtk_frame_get_label_widget(v.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapWidget(obj), nil -} - -// GetShadowType is a wrapper around gtk_frame_get_shadow_type(). -func (v *Frame) GetShadowType() ShadowType { - c := C.gtk_frame_get_shadow_type(v.native()) - return ShadowType(c) -} - -/* - * GtkAspectFrame - */ - -// AspectFrame is a representation of GTK's GtkAspectFrame. -type AspectFrame struct { - Frame -} - -// native returns a pointer to the underlying GtkAspectFrame. -func (v *AspectFrame) native() *C.GtkAspectFrame { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkAspectFrame(p) -} - -func marshalAspectFrame(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapAspectFrame(obj), nil -} - -func wrapAspectFrame(obj *glib.Object) *AspectFrame { - return &AspectFrame{Frame{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}}} -} - -func AspectFrameNew(label string, xalign, yalign, ratio float32, obeyChild bool) (*AspectFrame, error) { - var cstr *C.char - if label != "" { - cstr = C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - } - c := C.gtk_aspect_frame_new((*C.gchar)(cstr), (C.gfloat)(xalign), (C.gfloat)(yalign), (C.gfloat)(ratio), gbool(obeyChild)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapAspectFrame(obj), nil -} - -/* - * GtkGrid - */ - -// Grid is a representation of GTK's GtkGrid. -type Grid struct { - Container - - // Interfaces - Orientable -} - -// native returns a pointer to the underlying GtkGrid. -func (v *Grid) native() *C.GtkGrid { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkGrid(p) -} - -func (v *Grid) toOrientable() *C.GtkOrientable { - if v == nil { - return nil - } - return C.toGtkOrientable(unsafe.Pointer(v.GObject)) -} - -func marshalGrid(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapGrid(obj), nil -} - -func wrapGrid(obj *glib.Object) *Grid { - o := wrapOrientable(obj) - return &Grid{Container{Widget{glib.InitiallyUnowned{obj}}}, *o} -} - -// GridNew() is a wrapper around gtk_grid_new(). -func GridNew() (*Grid, error) { - c := C.gtk_grid_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapGrid(obj), nil -} - -// Attach() is a wrapper around gtk_grid_attach(). -func (v *Grid) Attach(child IWidget, left, top, width, height int) { - C.gtk_grid_attach(v.native(), child.toWidget(), C.gint(left), - C.gint(top), C.gint(width), C.gint(height)) -} - -// AttachNextTo() is a wrapper around gtk_grid_attach_next_to(). -func (v *Grid) AttachNextTo(child, sibling IWidget, side PositionType, width, height int) { - C.gtk_grid_attach_next_to(v.native(), child.toWidget(), - sibling.toWidget(), C.GtkPositionType(side), C.gint(width), - C.gint(height)) -} - -// GetChildAt() is a wrapper around gtk_grid_get_child_at(). -func (v *Grid) GetChildAt(left, top int) (*Widget, error) { - c := C.gtk_grid_get_child_at(v.native(), C.gint(left), C.gint(top)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapWidget(obj), nil -} - -// InsertRow() is a wrapper around gtk_grid_insert_row(). -func (v *Grid) InsertRow(position int) { - C.gtk_grid_insert_row(v.native(), C.gint(position)) -} - -// InsertColumn() is a wrapper around gtk_grid_insert_column(). -func (v *Grid) InsertColumn(position int) { - C.gtk_grid_insert_column(v.native(), C.gint(position)) -} - -// InsertNextTo() is a wrapper around gtk_grid_insert_next_to() -func (v *Grid) InsertNextTo(sibling IWidget, side PositionType) { - C.gtk_grid_insert_next_to(v.native(), sibling.toWidget(), - C.GtkPositionType(side)) -} - -// SetRowHomogeneous() is a wrapper around gtk_grid_set_row_homogeneous(). -func (v *Grid) SetRowHomogeneous(homogeneous bool) { - C.gtk_grid_set_row_homogeneous(v.native(), gbool(homogeneous)) -} - -// GetRowHomogeneous() is a wrapper around gtk_grid_get_row_homogeneous(). -func (v *Grid) GetRowHomogeneous() bool { - c := C.gtk_grid_get_row_homogeneous(v.native()) - return gobool(c) -} - -// SetRowSpacing() is a wrapper around gtk_grid_set_row_spacing(). -func (v *Grid) SetRowSpacing(spacing uint) { - C.gtk_grid_set_row_spacing(v.native(), C.guint(spacing)) -} - -// GetRowSpacing() is a wrapper around gtk_grid_get_row_spacing(). -func (v *Grid) GetRowSpacing() uint { - c := C.gtk_grid_get_row_spacing(v.native()) - return uint(c) -} - -// SetColumnHomogeneous() is a wrapper around gtk_grid_set_column_homogeneous(). -func (v *Grid) SetColumnHomogeneous(homogeneous bool) { - C.gtk_grid_set_column_homogeneous(v.native(), gbool(homogeneous)) -} - -// GetColumnHomogeneous() is a wrapper around gtk_grid_get_column_homogeneous(). -func (v *Grid) GetColumnHomogeneous() bool { - c := C.gtk_grid_get_column_homogeneous(v.native()) - return gobool(c) -} - -// SetColumnSpacing() is a wrapper around gtk_grid_set_column_spacing(). -func (v *Grid) SetColumnSpacing(spacing uint) { - C.gtk_grid_set_column_spacing(v.native(), C.guint(spacing)) -} - -// GetColumnSpacing() is a wrapper around gtk_grid_get_column_spacing(). -func (v *Grid) GetColumnSpacing() uint { - c := C.gtk_grid_get_column_spacing(v.native()) - return uint(c) -} - -/* - * GtkIconTheme - */ - -// IconTheme is a representation of GTK's GtkIconTheme -type IconTheme struct { - Theme *C.GtkIconTheme -} - -// IconThemeGetDefault is a wrapper around gtk_icon_theme_get_default(). -func IconThemeGetDefault() (*IconTheme, error) { - c := C.gtk_icon_theme_get_default() - if c == nil { - return nil, nilPtrErr - } - return &IconTheme{c}, nil -} - -// IconThemeGetForScreen is a wrapper around gtk_icon_theme_get_for_screen(). -func IconThemeGetForScreen(screen gdk.Screen) (*IconTheme, error) { - cScreen := (*C.GdkScreen)(unsafe.Pointer(screen.Native())) - c := C.gtk_icon_theme_get_for_screen(cScreen) - if c == nil { - return nil, nilPtrErr - } - return &IconTheme{c}, nil -} - -// LoadIcon is a wrapper around gtk_icon_theme_load_icon(). -func (v *IconTheme) LoadIcon(iconName string, size int, flags IconLookupFlags) (*gdk.Pixbuf, error) { - cstr := C.CString(iconName) - defer C.free(unsafe.Pointer(cstr)) - var err *C.GError = nil - c := C.gtk_icon_theme_load_icon(v.Theme, (*C.gchar)(cstr), C.gint(size), C.GtkIconLookupFlags(flags), &err) - if c == nil { - defer C.g_error_free(err) - return nil, errors.New(goString(err.message)) - } - return &gdk.Pixbuf{glib.Take(unsafe.Pointer(c))}, nil -} - -/* - * GtkImage - */ - -// Image is a representation of GTK's GtkImage. -type Image struct { - Widget -} - -// native returns a pointer to the underlying GtkImage. -func (v *Image) native() *C.GtkImage { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkImage(p) -} - -func marshalImage(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapImage(obj), nil -} - -func wrapImage(obj *glib.Object) *Image { - return &Image{Widget{glib.InitiallyUnowned{obj}}} -} - -// ImageNew() is a wrapper around gtk_image_new(). -func ImageNew() (*Image, error) { - c := C.gtk_image_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapImage(obj), nil -} - -// ImageNewFromFile() is a wrapper around gtk_image_new_from_file(). -func ImageNewFromFile(filename string) (*Image, error) { - cstr := C.CString(filename) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_image_new_from_file((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapImage(obj), nil -} - -// ImageNewFromResource() is a wrapper around gtk_image_new_from_resource(). -func ImageNewFromResource(resourcePath string) (*Image, error) { - cstr := C.CString(resourcePath) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_image_new_from_resource((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapImage(obj), nil -} - -// ImageNewFromPixbuf is a wrapper around gtk_image_new_from_pixbuf(). -func ImageNewFromPixbuf(pixbuf *gdk.Pixbuf) (*Image, error) { - c := C.gtk_image_new_from_pixbuf((*C.GdkPixbuf)(pixbuf.NativePrivate())) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapImage(obj), nil -} - -// TODO(jrick) GtkIconSet -/* -func ImageNewFromIconSet() { -} -*/ - -// TODO(jrick) GdkPixbufAnimation -/* -func ImageNewFromAnimation() { -} -*/ - -// ImageNewFromIconName() is a wrapper around gtk_image_new_from_icon_name(). -func ImageNewFromIconName(iconName string, size IconSize) (*Image, error) { - cstr := C.CString(iconName) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_image_new_from_icon_name((*C.gchar)(cstr), - C.GtkIconSize(size)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapImage(obj), nil -} - -// TODO(jrick) GIcon -/* -func ImageNewFromGIcon() { -} -*/ - -// Clear() is a wrapper around gtk_image_clear(). -func (v *Image) Clear() { - C.gtk_image_clear(v.native()) -} - -// SetFromFile() is a wrapper around gtk_image_set_from_file(). -func (v *Image) SetFromFile(filename string) { - cstr := C.CString(filename) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_image_set_from_file(v.native(), (*C.gchar)(cstr)) -} - -// SetFromResource() is a wrapper around gtk_image_set_from_resource(). -func (v *Image) SetFromResource(resourcePath string) { - cstr := C.CString(resourcePath) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_image_set_from_resource(v.native(), (*C.gchar)(cstr)) -} - -// SetFromFixbuf is a wrapper around gtk_image_set_from_pixbuf(). -func (v *Image) SetFromPixbuf(pixbuf *gdk.Pixbuf) { - pbptr := (*C.GdkPixbuf)(unsafe.Pointer(pixbuf.Native())) - C.gtk_image_set_from_pixbuf(v.native(), pbptr) -} - -// TODO(jrick) GtkIconSet -/* -func (v *Image) SetFromIconSet() { -} -*/ - -// TODO(jrick) GdkPixbufAnimation -/* -func (v *Image) SetFromAnimation() { -} -*/ - -// SetFromIconName() is a wrapper around gtk_image_set_from_icon_name(). -func (v *Image) SetFromIconName(iconName string, size IconSize) { - cstr := C.CString(iconName) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_image_set_from_icon_name(v.native(), (*C.gchar)(cstr), - C.GtkIconSize(size)) -} - -// TODO(jrick) GIcon -/* -func (v *Image) SetFromGIcon() { -} -*/ - -// SetPixelSize() is a wrapper around gtk_image_set_pixel_size(). -func (v *Image) SetPixelSize(pixelSize int) { - C.gtk_image_set_pixel_size(v.native(), C.gint(pixelSize)) -} - -// GetStorageType() is a wrapper around gtk_image_get_storage_type(). -func (v *Image) GetStorageType() ImageType { - c := C.gtk_image_get_storage_type(v.native()) - return ImageType(c) -} - -// GetPixbuf() is a wrapper around gtk_image_get_pixbuf(). -func (v *Image) GetPixbuf() *gdk.Pixbuf { - c := C.gtk_image_get_pixbuf(v.native()) - if c == nil { - return nil - } - - pb := &gdk.Pixbuf{glib.Take(unsafe.Pointer(c))} - return pb -} - -// TODO(jrick) GtkIconSet -/* -func (v *Image) GetIconSet() { -} -*/ - -// TODO(jrick) GdkPixbufAnimation -/* -func (v *Image) GetAnimation() { -} -*/ - -// GetIconName() is a wrapper around gtk_image_get_icon_name(). -func (v *Image) GetIconName() (string, IconSize) { - var iconName *C.gchar - var size C.GtkIconSize - C.gtk_image_get_icon_name(v.native(), &iconName, &size) - return goString(iconName), IconSize(size) -} - -// TODO(jrick) GIcon -/* -func (v *Image) GetGIcon() { -} -*/ - -// GetPixelSize() is a wrapper around gtk_image_get_pixel_size(). -func (v *Image) GetPixelSize() int { - c := C.gtk_image_get_pixel_size(v.native()) - return int(c) -} - -// added by terrak -/* - * GtkLayout - */ - -// Layout is a representation of GTK's GtkLayout. -type Layout struct { - Container -} - -// native returns a pointer to the underlying GtkDrawingArea. -func (v *Layout) native() *C.GtkLayout { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkLayout(p) -} - -func marshalLayout(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapLayout(obj), nil -} - -func wrapLayout(obj *glib.Object) *Layout { - return &Layout{Container{Widget{glib.InitiallyUnowned{obj}}}} -} - -// LayoutNew is a wrapper around gtk_layout_new(). -func LayoutNew(hadjustment, vadjustment *Adjustment) (*Layout, error) { - c := C.gtk_layout_new(hadjustment.native(), vadjustment.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapLayout(obj), nil -} - -// Layout.Put is a wrapper around gtk_layout_put(). -func (v *Layout) Put(w IWidget, x, y int) { - C.gtk_layout_put(v.native(), w.toWidget(), C.gint(x), C.gint(y)) -} - -// Layout.Move is a wrapper around gtk_layout_move(). -func (v *Layout) Move(w IWidget, x, y int) { - C.gtk_layout_move(v.native(), w.toWidget(), C.gint(x), C.gint(y)) -} - -// Layout.SetSize is a wrapper around gtk_layout_set_size -func (v *Layout) SetSize(width, height uint) { - C.gtk_layout_set_size(v.native(), C.guint(width), C.guint(height)) -} - -// Layout.GetSize is a wrapper around gtk_layout_get_size -func (v *Layout) GetSize() (width, height uint) { - var w, h C.guint - C.gtk_layout_get_size(v.native(), &w, &h) - return uint(w), uint(h) -} - -/* - * GtkLinkButton - */ - -// LinkButton is a representation of GTK's GtkLinkButton. -type LinkButton struct { - Button -} - -// native returns a pointer to the underlying GtkLinkButton. -func (v *LinkButton) native() *C.GtkLinkButton { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkLinkButton(p) -} - -func marshalLinkButton(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapLinkButton(obj), nil -} - -func wrapLinkButton(obj *glib.Object) *LinkButton { - actionable := wrapActionable(obj) - return &LinkButton{Button{Bin{Container{Widget{ - glib.InitiallyUnowned{obj}}}}, actionable}} -} - -// LinkButtonNew is a wrapper around gtk_link_button_new(). -func LinkButtonNew(label string) (*LinkButton, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_link_button_new((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapLinkButton(glib.Take(unsafe.Pointer(c))), nil -} - -// LinkButtonNewWithLabel is a wrapper around gtk_link_button_new_with_label(). -func LinkButtonNewWithLabel(uri, label string) (*LinkButton, error) { - curi := C.CString(uri) - defer C.free(unsafe.Pointer(curi)) - clabel := C.CString(label) - defer C.free(unsafe.Pointer(clabel)) - c := C.gtk_link_button_new_with_label((*C.gchar)(curi), (*C.gchar)(clabel)) - if c == nil { - return nil, nilPtrErr - } - return wrapLinkButton(glib.Take(unsafe.Pointer(c))), nil -} - -// GetUri is a wrapper around gtk_link_button_get_uri(). -func (v *LinkButton) GetUri() string { - c := C.gtk_link_button_get_uri(v.native()) - return goString(c) -} - -// SetUri is a wrapper around gtk_link_button_set_uri(). -func (v *LinkButton) SetUri(uri string) { - cstr := C.CString(uri) - C.gtk_link_button_set_uri(v.native(), (*C.gchar)(cstr)) -} - -/* - * GtkListStore - */ - -// ListStore is a representation of GTK's GtkListStore. -type ListStore struct { - *glib.Object - - // Interfaces - TreeModel -} - -// native returns a pointer to the underlying GtkListStore. -func (v *ListStore) native() *C.GtkListStore { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkListStore(p) -} - -func marshalListStore(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapListStore(obj), nil -} - -func wrapListStore(obj *glib.Object) *ListStore { - tm := wrapTreeModel(obj) - return &ListStore{obj, *tm} -} - -func (v *ListStore) toTreeModel() *C.GtkTreeModel { - if v == nil { - return nil - } - return C.toGtkTreeModel(unsafe.Pointer(v.GObject)) -} - -// ListStoreNew is a wrapper around gtk_list_store_newv(). -func ListStoreNew(types ...glib.Type) (*ListStore, error) { - gtypes := C.alloc_types(C.int(len(types))) - for n, val := range types { - C.set_type(gtypes, C.int(n), C.GType(val)) - } - defer C.g_free(C.gpointer(gtypes)) - c := C.gtk_list_store_newv(C.gint(len(types)), gtypes) - if c == nil { - return nil, nilPtrErr - } - - ls := wrapListStore(glib.Take(unsafe.Pointer(c))) - return ls, nil -} - -// Remove is a wrapper around gtk_list_store_remove(). -func (v *ListStore) Remove(iter *TreeIter) bool { - c := C.gtk_list_store_remove(v.native(), iter.native()) - return gobool(c) -} - -// TODO(jrick) -/* -func (v *ListStore) SetColumnTypes(types ...glib.Type) { -} -*/ - -// Set() is a wrapper around gtk_list_store_set_value() but provides -// a function similar to gtk_list_store_set() in that multiple columns -// may be set by one call. The length of columns and values slices must -// match, or Set() will return a non-nil error. -// -// As an example, a call to: -// store.Set(iter, []int{0, 1}, []interface{}{"Foo", "Bar"}) -// is functionally equivalent to calling the native C GTK function: -// gtk_list_store_set(store, iter, 0, "Foo", 1, "Bar", -1); -func (v *ListStore) Set(iter *TreeIter, columns []int, values []interface{}) error { - if len(columns) != len(values) { - return errors.New("columns and values lengths do not match") - } - for i, val := range values { - v.SetValue(iter, columns[i], val) - } - return nil -} - -// SetValue is a wrapper around gtk_list_store_set_value(). -func (v *ListStore) SetValue(iter *TreeIter, column int, value interface{}) error { - switch value.(type) { - case *gdk.Pixbuf: - pix := value.(*gdk.Pixbuf) - C._gtk_list_store_set(v.native(), iter.native(), C.gint(column), unsafe.Pointer(pix.Native())) - - default: - gv, err := glib.GValue(value) - if err != nil { - return err - } - - C.gtk_list_store_set_value(v.native(), iter.native(), - C.gint(column), - (*C.GValue)(unsafe.Pointer(gv.Native()))) - } - - return nil -} - -// func (v *ListStore) Model(model ITreeModel) { -// obj := &glib.Object{glib.ToGObject(unsafe.Pointer(model.toTreeModel()))} -// v.TreeModel = *wrapTreeModel(obj) -//} - -// SetSortColumnId() is a wrapper around gtk_tree_sortable_set_sort_column_id(). -func (v *ListStore) SetSortColumnId(column int, order SortType) { - sort := C.toGtkTreeSortable(unsafe.Pointer(v.Native())) - C.gtk_tree_sortable_set_sort_column_id(sort, C.gint(column), C.GtkSortType(order)) -} - -func (v *ListStore) SetCols(iter *TreeIter, cols Cols) error { - for key, value := range cols { - err := v.SetValue(iter, key, value) - if err != nil { - return err - } - } - return nil -} - -// Convenient map for Columns and values (See ListStore, TreeStore) -type Cols map[int]interface{} - -// InsertWithValues() is a wrapper around gtk_list_store_insert_with_valuesv(). -func (v *ListStore) InsertWithValues(iter *TreeIter, position int, inColumns []int, inValues []interface{}) error { - length := len(inColumns) - if len(inValues) < length { - length = len(inValues) - } - - var cColumns []C.gint - var cValues []C.GValue - for i := 0; i < length; i++ { - cColumns = append(cColumns, C.gint(inColumns[i])) - - gv, err := glib.GValue(inValues[i]) - if err != nil { - return err - } - - var cvp *C.GValue = (*C.GValue)(gv.Native()) - cValues = append(cValues, *cvp) - } - var cColumnsPointer *C.gint = &cColumns[0] - var cValuesPointer *C.GValue = &cValues[0] - - C.gtk_list_store_insert_with_valuesv(v.native(), iter.native(), C.gint(position), cColumnsPointer, cValuesPointer, C.gint(length)) - - return nil -} - -// InsertBefore() is a wrapper around gtk_list_store_insert_before(). -func (v *ListStore) InsertBefore(sibling *TreeIter) *TreeIter { - var ti C.GtkTreeIter - C.gtk_list_store_insert_before(v.native(), &ti, sibling.native()) - iter := &TreeIter{ti} - return iter -} - -// InsertAfter() is a wrapper around gtk_list_store_insert_after(). -func (v *ListStore) InsertAfter(sibling *TreeIter) *TreeIter { - var ti C.GtkTreeIter - C.gtk_list_store_insert_after(v.native(), &ti, sibling.native()) - iter := &TreeIter{ti} - return iter -} - -// Prepend() is a wrapper around gtk_list_store_prepend(). -func (v *ListStore) Prepend() *TreeIter { - var ti C.GtkTreeIter - C.gtk_list_store_prepend(v.native(), &ti) - iter := &TreeIter{ti} - return iter -} - -// Append() is a wrapper around gtk_list_store_append(). -func (v *ListStore) Append() *TreeIter { - var ti C.GtkTreeIter - C.gtk_list_store_append(v.native(), &ti) - iter := &TreeIter{ti} - return iter -} - -// Clear() is a wrapper around gtk_list_store_clear(). -func (v *ListStore) Clear() { - C.gtk_list_store_clear(v.native()) -} - -// IterIsValid() is a wrapper around gtk_list_store_iter_is_valid(). -func (v *ListStore) IterIsValid(iter *TreeIter) bool { - c := C.gtk_list_store_iter_is_valid(v.native(), iter.native()) - return gobool(c) -} - -// TODO(jrick) -/* -func (v *ListStore) Reorder(newOrder []int) { -} -*/ - -// Swap() is a wrapper around gtk_list_store_swap(). -func (v *ListStore) Swap(a, b *TreeIter) { - C.gtk_list_store_swap(v.native(), a.native(), b.native()) -} - -// MoveBefore() is a wrapper around gtk_list_store_move_before(). -func (v *ListStore) MoveBefore(iter, position *TreeIter) { - C.gtk_list_store_move_before(v.native(), iter.native(), - position.native()) -} - -// MoveAfter() is a wrapper around gtk_list_store_move_after(). -func (v *ListStore) MoveAfter(iter, position *TreeIter) { - C.gtk_list_store_move_after(v.native(), iter.native(), - position.native()) -} - -/* - * GtkMenuBar - */ - -// MenuBar is a representation of GTK's GtkMenuBar. -type MenuBar struct { - MenuShell -} - -// native() returns a pointer to the underlying GtkMenuBar. -func (v *MenuBar) native() *C.GtkMenuBar { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkMenuBar(p) -} - -func marshalMenuBar(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapMenuBar(obj), nil -} - -func wrapMenuBar(obj *glib.Object) *MenuBar { - return &MenuBar{MenuShell{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// MenuBarNew() is a wrapper around gtk_menu_bar_new(). -func MenuBarNew() (*MenuBar, error) { - c := C.gtk_menu_bar_new() - if c == nil { - return nil, nilPtrErr - } - return wrapMenuBar(glib.Take(unsafe.Pointer(c))), nil -} - -/* - * GtkMenuButton - */ - -// MenuButton is a representation of GTK's GtkMenuButton. -type MenuButton struct { - ToggleButton -} - -// native returns a pointer to the underlying GtkMenuButton. -func (v *MenuButton) native() *C.GtkMenuButton { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkMenuButton(p) -} - -func marshalMenuButton(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapMenuButton(obj), nil -} - -func wrapMenuButton(obj *glib.Object) *MenuButton { - actionable := wrapActionable(obj) - return &MenuButton{ToggleButton{Button{Bin{Container{Widget{ - glib.InitiallyUnowned{obj}}}}, actionable}}} -} - -// MenuButtonNew is a wrapper around gtk_menu_button_new(). -func MenuButtonNew() (*MenuButton, error) { - c := C.gtk_menu_button_new() - if c == nil { - return nil, nilPtrErr - } - return wrapMenuButton(glib.Take(unsafe.Pointer(c))), nil -} - -// SetPopup is a wrapper around gtk_menu_button_set_popup(). -func (v *MenuButton) SetPopup(menu IMenu) { - C.gtk_menu_button_set_popup(v.native(), menu.toWidget()) -} - -// GetPopup is a wrapper around gtk_menu_button_get_popup(). -func (v *MenuButton) GetPopup() *Menu { - c := C.gtk_menu_button_get_popup(v.native()) - if c == nil { - return nil - } - return wrapMenu(glib.Take(unsafe.Pointer(c))) -} - -// SetMenuModel is a wrapper around gtk_menu_button_set_menu_model(). -func (v *MenuButton) SetMenuModel(menuModel *glib.MenuModel) { - C.gtk_menu_button_set_menu_model(v.native(), C.toGMenuModel(unsafe.Pointer(menuModel.Native()))) -} - -// GetMenuModel is a wrapper around gtk_menu_button_get_menu_model(). -func (v *MenuButton) GetMenuModel() *glib.MenuModel { - c := C.gtk_menu_button_get_menu_model(v.native()) - if c == nil { - return nil - } - return &glib.MenuModel{glib.Take(unsafe.Pointer(c))} -} - -// SetDirection is a wrapper around gtk_menu_button_set_direction(). -func (v *MenuButton) SetDirection(direction ArrowType) { - C.gtk_menu_button_set_direction(v.native(), C.GtkArrowType(direction)) -} - -// GetDirection is a wrapper around gtk_menu_button_get_direction(). -func (v *MenuButton) GetDirection() ArrowType { - c := C.gtk_menu_button_get_direction(v.native()) - return ArrowType(c) -} - -// SetAlignWidget is a wrapper around gtk_menu_button_set_align_widget(). -func (v *MenuButton) SetAlignWidget(alignWidget IWidget) { - C.gtk_menu_button_set_align_widget(v.native(), alignWidget.toWidget()) -} - -// GetAlignWidget is a wrapper around gtk_menu_button_get_align_widget(). -func (v *MenuButton) GetAlignWidget() *Widget { - c := C.gtk_menu_button_get_align_widget(v.native()) - if c == nil { - return nil - } - return wrapWidget(glib.Take(unsafe.Pointer(c))) -} - -/* - * GtkMenuItem - */ - -// MenuItem is a representation of GTK's GtkMenuItem. -type MenuItem struct { - Bin -} - -// IMenuItem is an interface type implemented by all structs -// embedding a MenuItem. It is meant to be used as an argument type -// for wrapper functions that wrap around a C GTK function taking a -// GtkMenuItem. -type IMenuItem interface { - toMenuItem() *C.GtkMenuItem - toWidget() *C.GtkWidget -} - -// native returns a pointer to the underlying GtkMenuItem. -func (v *MenuItem) native() *C.GtkMenuItem { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkMenuItem(p) -} - -func (v *MenuItem) toMenuItem() *C.GtkMenuItem { - if v == nil { - return nil - } - return v.native() -} - -func marshalMenuItem(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapMenuItem(obj), nil -} - -func wrapMenuItem(obj *glib.Object) *MenuItem { - return &MenuItem{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// MenuItemNew() is a wrapper around gtk_menu_item_new(). -func MenuItemNew() (*MenuItem, error) { - c := C.gtk_menu_item_new() - if c == nil { - return nil, nilPtrErr - } - return wrapMenuItem(glib.Take(unsafe.Pointer(c))), nil -} - -// MenuItemNewWithLabel() is a wrapper around gtk_menu_item_new_with_label(). -func MenuItemNewWithLabel(label string) (*MenuItem, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_menu_item_new_with_label((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapMenuItem(glib.Take(unsafe.Pointer(c))), nil -} - -// MenuItemNewWithMnemonic() is a wrapper around -// gtk_menu_item_new_with_mnemonic(). -func MenuItemNewWithMnemonic(label string) (*MenuItem, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_menu_item_new_with_mnemonic((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapMenuItem(glib.Take(unsafe.Pointer(c))), nil -} - -// SetSubmenu() is a wrapper around gtk_menu_item_set_submenu(). -func (v *MenuItem) SetSubmenu(submenu IWidget) { - C.gtk_menu_item_set_submenu(v.native(), submenu.toWidget()) -} - -// Sets text on the menu_item label -func (v *MenuItem) SetLabel(label string) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_menu_item_set_label(v.native(), (*C.gchar)(cstr)) -} - -// Gets text on the menu_item label -func (v *MenuItem) GetLabel() string { - l := C.gtk_menu_item_get_label(v.native()) - return goString(l) -} - -/* - * GtkMessageDialog - */ - -// MessageDialog is a representation of GTK's GtkMessageDialog. -type MessageDialog struct { - Dialog -} - -// native returns a pointer to the underlying GtkMessageDialog. -func (v *MessageDialog) native() *C.GtkMessageDialog { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkMessageDialog(p) -} - -func marshalMessageDialog(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapMessageDialog(obj), nil -} - -func wrapMessageDialog(obj *glib.Object) *MessageDialog { - return &MessageDialog{Dialog{Window{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}}}} -} - -// MessageDialogNew() is a wrapper around gtk_message_dialog_new(). -// The text is created and formatted by the format specifier and any -// additional arguments. -func MessageDialogNew(parent IWindow, flags DialogFlags, mType MessageType, buttons ButtonsType, format string, a ...interface{}) *MessageDialog { - s := fmt.Sprintf(format, a...) - cstr := C.CString(s) - defer C.free(unsafe.Pointer(cstr)) - var w *C.GtkWindow = nil - if parent != nil { - w = parent.toWindow() - } - c := C._gtk_message_dialog_new(w, - C.GtkDialogFlags(flags), C.GtkMessageType(mType), - C.GtkButtonsType(buttons), cstr) - return wrapMessageDialog(glib.Take(unsafe.Pointer(c))) -} - -// MessageDialogNewWithMarkup is a wrapper around -// gtk_message_dialog_new_with_markup(). -func MessageDialogNewWithMarkup(parent IWindow, flags DialogFlags, mType MessageType, buttons ButtonsType, format string, a ...interface{}) *MessageDialog { - s := fmt.Sprintf(format, a...) - cstr := C.CString(s) - defer C.free(unsafe.Pointer(cstr)) - var w *C.GtkWindow = nil - if parent != nil { - w = parent.toWindow() - } - c := C._gtk_message_dialog_new_with_markup(w, - C.GtkDialogFlags(flags), C.GtkMessageType(mType), - C.GtkButtonsType(buttons), cstr) - return wrapMessageDialog(glib.Take(unsafe.Pointer(c))) -} - -// SetMarkup is a wrapper around gtk_message_dialog_set_markup(). -func (v *MessageDialog) SetMarkup(str string) { - cstr := C.CString(str) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_message_dialog_set_markup(v.native(), (*C.gchar)(cstr)) -} - -// FormatSecondaryText is a wrapper around -// gtk_message_dialog_format_secondary_text(). -func (v *MessageDialog) FormatSecondaryText(format string, a ...interface{}) { - s := fmt.Sprintf(format, a...) - cstr := C.CString(s) - defer C.free(unsafe.Pointer(cstr)) - C._gtk_message_dialog_format_secondary_text(v.native(), - (*C.gchar)(cstr)) -} - -// FormatSecondaryMarkup is a wrapper around -// gtk_message_dialog_format_secondary_text(). -func (v *MessageDialog) FormatSecondaryMarkup(format string, a ...interface{}) { - s := fmt.Sprintf(format, a...) - cstr := C.CString(s) - defer C.free(unsafe.Pointer(cstr)) - C._gtk_message_dialog_format_secondary_markup(v.native(), - (*C.gchar)(cstr)) -} - -/* - * GtkNotebook - */ - -// Notebook is a representation of GTK's GtkNotebook. -type Notebook struct { - Container -} - -// native returns a pointer to the underlying GtkNotebook. -func (v *Notebook) native() *C.GtkNotebook { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkNotebook(p) -} - -func marshalNotebook(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapNotebook(obj), nil -} - -func wrapNotebook(obj *glib.Object) *Notebook { - return &Notebook{Container{Widget{glib.InitiallyUnowned{obj}}}} -} - -// NotebookNew() is a wrapper around gtk_notebook_new(). -func NotebookNew() (*Notebook, error) { - c := C.gtk_notebook_new() - if c == nil { - return nil, nilPtrErr - } - return wrapNotebook(glib.Take(unsafe.Pointer(c))), nil -} - -// AppendPage() is a wrapper around gtk_notebook_append_page(). -func (v *Notebook) AppendPage(child IWidget, tabLabel IWidget) int { - cTabLabel := nullableWidget(tabLabel) - c := C.gtk_notebook_append_page(v.native(), child.toWidget(), cTabLabel) - return int(c) -} - -// AppendPageMenu() is a wrapper around gtk_notebook_append_page_menu(). -func (v *Notebook) AppendPageMenu(child IWidget, tabLabel IWidget, menuLabel IWidget) int { - c := C.gtk_notebook_append_page_menu(v.native(), child.toWidget(), - tabLabel.toWidget(), menuLabel.toWidget()) - return int(c) -} - -// PrependPage() is a wrapper around gtk_notebook_prepend_page(). -func (v *Notebook) PrependPage(child IWidget, tabLabel IWidget) int { - cTabLabel := nullableWidget(tabLabel) - c := C.gtk_notebook_prepend_page(v.native(), child.toWidget(), cTabLabel) - return int(c) -} - -// PrependPageMenu() is a wrapper around gtk_notebook_prepend_page_menu(). -func (v *Notebook) PrependPageMenu(child IWidget, tabLabel IWidget, menuLabel IWidget) int { - c := C.gtk_notebook_prepend_page_menu(v.native(), child.toWidget(), - tabLabel.toWidget(), menuLabel.toWidget()) - return int(c) -} - -// InsertPage() is a wrapper around gtk_notebook_insert_page(). -func (v *Notebook) InsertPage(child IWidget, tabLabel IWidget, position int) int { - label := nullableWidget(tabLabel) - c := C.gtk_notebook_insert_page(v.native(), child.toWidget(), label, C.gint(position)) - - return int(c) -} - -// InsertPageMenu() is a wrapper around gtk_notebook_insert_page_menu(). -func (v *Notebook) InsertPageMenu(child IWidget, tabLabel IWidget, menuLabel IWidget, position int) int { - c := C.gtk_notebook_insert_page_menu(v.native(), child.toWidget(), - tabLabel.toWidget(), menuLabel.toWidget(), C.gint(position)) - return int(c) -} - -// RemovePage() is a wrapper around gtk_notebook_remove_page(). -func (v *Notebook) RemovePage(pageNum int) { - C.gtk_notebook_remove_page(v.native(), C.gint(pageNum)) -} - -// PageNum() is a wrapper around gtk_notebook_page_num(). -func (v *Notebook) PageNum(child IWidget) int { - c := C.gtk_notebook_page_num(v.native(), child.toWidget()) - return int(c) -} - -// NextPage() is a wrapper around gtk_notebook_next_page(). -func (v *Notebook) NextPage() { - C.gtk_notebook_next_page(v.native()) -} - -// PrevPage() is a wrapper around gtk_notebook_prev_page(). -func (v *Notebook) PrevPage() { - C.gtk_notebook_prev_page(v.native()) -} - -// ReorderChild() is a wrapper around gtk_notebook_reorder_child(). -func (v *Notebook) ReorderChild(child IWidget, position int) { - C.gtk_notebook_reorder_child(v.native(), child.toWidget(), - C.gint(position)) -} - -// SetTabPos() is a wrapper around gtk_notebook_set_tab_pos(). -func (v *Notebook) SetTabPos(pos PositionType) { - C.gtk_notebook_set_tab_pos(v.native(), C.GtkPositionType(pos)) -} - -// SetShowTabs() is a wrapper around gtk_notebook_set_show_tabs(). -func (v *Notebook) SetShowTabs(showTabs bool) { - C.gtk_notebook_set_show_tabs(v.native(), gbool(showTabs)) -} - -// SetShowBorder() is a wrapper around gtk_notebook_set_show_border(). -func (v *Notebook) SetShowBorder(showBorder bool) { - C.gtk_notebook_set_show_border(v.native(), gbool(showBorder)) -} - -// SetScrollable() is a wrapper around gtk_notebook_set_scrollable(). -func (v *Notebook) SetScrollable(scrollable bool) { - C.gtk_notebook_set_scrollable(v.native(), gbool(scrollable)) -} - -// PopupEnable() is a wrapper around gtk_notebook_popup_enable(). -func (v *Notebook) PopupEnable() { - C.gtk_notebook_popup_enable(v.native()) -} - -// PopupDisable() is a wrapper around gtk_notebook_popup_disable(). -func (v *Notebook) PopupDisable() { - C.gtk_notebook_popup_disable(v.native()) -} - -// GetCurrentPage() is a wrapper around gtk_notebook_get_current_page(). -func (v *Notebook) GetCurrentPage() int { - c := C.gtk_notebook_get_current_page(v.native()) - return int(c) -} - -// GetMenuLabel() is a wrapper around gtk_notebook_get_menu_label(). -func (v *Notebook) GetMenuLabel(child IWidget) (*Widget, error) { - c := C.gtk_notebook_get_menu_label(v.native(), child.toWidget()) - if c == nil { - return nil, nilPtrErr - } - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -// GetNthPage() is a wrapper around gtk_notebook_get_nth_page(). -func (v *Notebook) GetNthPage(pageNum int) (*Widget, error) { - c := C.gtk_notebook_get_nth_page(v.native(), C.gint(pageNum)) - if c == nil { - return nil, nilPtrErr - } - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -// GetNPages() is a wrapper around gtk_notebook_get_n_pages(). -func (v *Notebook) GetNPages() int { - c := C.gtk_notebook_get_n_pages(v.native()) - return int(c) -} - -// GetTabLabel() is a wrapper around gtk_notebook_get_tab_label(). -func (v *Notebook) GetTabLabel(child IWidget) (*Widget, error) { - c := C.gtk_notebook_get_tab_label(v.native(), child.toWidget()) - if c == nil { - return nil, nilPtrErr - } - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -// SetMenuLabel() is a wrapper around gtk_notebook_set_menu_label(). -func (v *Notebook) SetMenuLabel(child, menuLabel IWidget) { - C.gtk_notebook_set_menu_label(v.native(), child.toWidget(), - menuLabel.toWidget()) -} - -// SetMenuLabelText() is a wrapper around gtk_notebook_set_menu_label_text(). -func (v *Notebook) SetMenuLabelText(child IWidget, menuText string) { - cstr := C.CString(menuText) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_notebook_set_menu_label_text(v.native(), child.toWidget(), - (*C.gchar)(cstr)) -} - -// SetTabLabel() is a wrapper around gtk_notebook_set_tab_label(). -func (v *Notebook) SetTabLabel(child, tabLabel IWidget) { - C.gtk_notebook_set_tab_label(v.native(), child.toWidget(), - tabLabel.toWidget()) -} - -// SetTabLabelText() is a wrapper around gtk_notebook_set_tab_label_text(). -func (v *Notebook) SetTabLabelText(child IWidget, tabText string) { - cstr := C.CString(tabText) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_notebook_set_tab_label_text(v.native(), child.toWidget(), - (*C.gchar)(cstr)) -} - -// SetTabReorderable() is a wrapper around gtk_notebook_set_tab_reorderable(). -func (v *Notebook) SetTabReorderable(child IWidget, reorderable bool) { - C.gtk_notebook_set_tab_reorderable(v.native(), child.toWidget(), - gbool(reorderable)) -} - -// SetTabDetachable() is a wrapper around gtk_notebook_set_tab_detachable(). -func (v *Notebook) SetTabDetachable(child IWidget, detachable bool) { - C.gtk_notebook_set_tab_detachable(v.native(), child.toWidget(), - gbool(detachable)) -} - -// GetMenuLabelText() is a wrapper around gtk_notebook_get_menu_label_text(). -func (v *Notebook) GetMenuLabelText(child IWidget) (string, error) { - c := C.gtk_notebook_get_menu_label_text(v.native(), child.toWidget()) - if c == nil { - return "", errors.New("No menu label for widget") - } - return goString(c), nil -} - -// GetScrollable() is a wrapper around gtk_notebook_get_scrollable(). -func (v *Notebook) GetScrollable() bool { - c := C.gtk_notebook_get_scrollable(v.native()) - return gobool(c) -} - -// GetShowBorder() is a wrapper around gtk_notebook_get_show_border(). -func (v *Notebook) GetShowBorder() bool { - c := C.gtk_notebook_get_show_border(v.native()) - return gobool(c) -} - -// GetShowTabs() is a wrapper around gtk_notebook_get_show_tabs(). -func (v *Notebook) GetShowTabs() bool { - c := C.gtk_notebook_get_show_tabs(v.native()) - return gobool(c) -} - -// GetTabLabelText() is a wrapper around gtk_notebook_get_tab_label_text(). -func (v *Notebook) GetTabLabelText(child IWidget) (string, error) { - c := C.gtk_notebook_get_tab_label_text(v.native(), child.toWidget()) - if c == nil { - return "", errors.New("No tab label for widget") - } - return goString(c), nil -} - -// GetTabPos() is a wrapper around gtk_notebook_get_tab_pos(). -func (v *Notebook) GetTabPos() PositionType { - c := C.gtk_notebook_get_tab_pos(v.native()) - return PositionType(c) -} - -// GetTabReorderable() is a wrapper around gtk_notebook_get_tab_reorderable(). -func (v *Notebook) GetTabReorderable(child IWidget) bool { - c := C.gtk_notebook_get_tab_reorderable(v.native(), child.toWidget()) - return gobool(c) -} - -// GetTabDetachable() is a wrapper around gtk_notebook_get_tab_detachable(). -func (v *Notebook) GetTabDetachable(child IWidget) bool { - c := C.gtk_notebook_get_tab_detachable(v.native(), child.toWidget()) - return gobool(c) -} - -// SetCurrentPage() is a wrapper around gtk_notebook_set_current_page(). -func (v *Notebook) SetCurrentPage(pageNum int) { - C.gtk_notebook_set_current_page(v.native(), C.gint(pageNum)) -} - -// SetGroupName() is a wrapper around gtk_notebook_set_group_name(). -func (v *Notebook) SetGroupName(groupName string) { - cstr := C.CString(groupName) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_notebook_set_group_name(v.native(), (*C.gchar)(cstr)) -} - -// GetGroupName() is a wrapper around gtk_notebook_get_group_name(). -func (v *Notebook) GetGroupName() (string, error) { - c := C.gtk_notebook_get_group_name(v.native()) - if c == nil { - return "", errors.New("No group name") - } - return goString(c), nil -} - -// SetActionWidget() is a wrapper around gtk_notebook_set_action_widget(). -func (v *Notebook) SetActionWidget(widget IWidget, packType PackType) { - C.gtk_notebook_set_action_widget(v.native(), widget.toWidget(), - C.GtkPackType(packType)) -} - -// GetActionWidget() is a wrapper around gtk_notebook_get_action_widget(). -func (v *Notebook) GetActionWidget(packType PackType) (*Widget, error) { - c := C.gtk_notebook_get_action_widget(v.native(), - C.GtkPackType(packType)) - if c == nil { - return nil, nilPtrErr - } - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -/* - * GtkOffscreenWindow - */ - -// OffscreenWindow is a representation of GTK's GtkOffscreenWindow. -type OffscreenWindow struct { - Window -} - -// native returns a pointer to the underlying GtkOffscreenWindow. -func (v *OffscreenWindow) native() *C.GtkOffscreenWindow { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkOffscreenWindow(p) -} - -func marshalOffscreenWindow(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapOffscreenWindow(obj), nil -} - -func wrapOffscreenWindow(obj *glib.Object) *OffscreenWindow { - return &OffscreenWindow{Window{Bin{Container{Widget{ - glib.InitiallyUnowned{obj}}}}}} -} - -// OffscreenWindowNew is a wrapper around gtk_offscreen_window_new(). -func OffscreenWindowNew() (*OffscreenWindow, error) { - c := C.gtk_offscreen_window_new() - if c == nil { - return nil, nilPtrErr - } - return wrapOffscreenWindow(glib.Take(unsafe.Pointer(c))), nil -} - -// GetSurface is a wrapper around gtk_offscreen_window_get_surface(). -// The returned surface is safe to use over window resizes. -func (v *OffscreenWindow) GetSurface() (*cairo.Surface, error) { - c := C.gtk_offscreen_window_get_surface(v.native()) - if c == nil { - return nil, nilPtrErr - } - cairoPtr := (uintptr)(unsafe.Pointer(c)) - s := cairo.NewSurface(cairoPtr, true) - return s, nil -} - -// GetPixbuf is a wrapper around gtk_offscreen_window_get_pixbuf(). -func (v *OffscreenWindow) GetPixbuf() (*gdk.Pixbuf, error) { - c := C.gtk_offscreen_window_get_pixbuf(v.native()) - if c == nil { - return nil, nilPtrErr - } - - // Pixbuf is returned with ref count of 1, so don't increment. - // Is it a floating reference? - pb := &gdk.Pixbuf{glib.Take(unsafe.Pointer(c))} - return pb, nil -} - -/* - * GtkOrientable - */ - -// Orientable is a representation of GTK's GtkOrientable GInterface. -type Orientable struct { - *glib.Object -} - -// IOrientable is an interface type implemented by all structs -// embedding an Orientable. It is meant to be used as an argument type -// for wrapper functions that wrap around a C GTK function taking a -// GtkOrientable. -type IOrientable interface { - toOrientable() *C.GtkOrientable -} - -// native returns a pointer to the underlying GObject as a GtkOrientable. -func (v *Orientable) native() *C.GtkOrientable { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkOrientable(p) -} - -func marshalOrientable(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapOrientable(obj), nil -} - -func wrapOrientable(obj *glib.Object) *Orientable { - return &Orientable{obj} -} - -// GetOrientation() is a wrapper around gtk_orientable_get_orientation(). -func (v *Orientable) GetOrientation() Orientation { - c := C.gtk_orientable_get_orientation(v.native()) - return Orientation(c) -} - -// SetOrientation() is a wrapper around gtk_orientable_set_orientation(). -func (v *Orientable) SetOrientation(orientation Orientation) { - C.gtk_orientable_set_orientation(v.native(), - C.GtkOrientation(orientation)) -} - -/* - * GtkOverlay - */ - -// Overlay is a representation of GTK's GtkOverlay. -type Overlay struct { - Bin -} - -// native returns a pointer to the underlying GtkOverlay. -func (v *Overlay) native() *C.GtkOverlay { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkOverlay(p) -} - -func marshalOverlay(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapOverlay(obj), nil -} - -func wrapOverlay(obj *glib.Object) *Overlay { - return &Overlay{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// OverlayNew() is a wrapper around gtk_overlay_new(). -func OverlayNew() (*Overlay, error) { - c := C.gtk_overlay_new() - if c == nil { - return nil, nilPtrErr - } - return wrapOverlay(glib.Take(unsafe.Pointer(c))), nil -} - -// AddOverlay() is a wrapper around gtk_overlay_add_overlay(). -func (v *Overlay) AddOverlay(widget IWidget) { - C.gtk_overlay_add_overlay(v.native(), widget.toWidget()) -} - -/* - * GtkPaned - */ - -// Paned is a representation of GTK's GtkPaned. -type Paned struct { - Bin -} - -// native returns a pointer to the underlying GtkPaned. -func (v *Paned) native() *C.GtkPaned { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkPaned(p) -} - -func marshalPaned(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapPaned(obj), nil -} - -func wrapPaned(obj *glib.Object) *Paned { - return &Paned{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// PanedNew() is a wrapper around gtk_paned_new(). -func PanedNew(orientation Orientation) (*Paned, error) { - c := C.gtk_paned_new(C.GtkOrientation(orientation)) - if c == nil { - return nil, nilPtrErr - } - return wrapPaned(glib.Take(unsafe.Pointer(c))), nil -} - -// Add1() is a wrapper around gtk_paned_add1(). -func (v *Paned) Add1(child IWidget) { - C.gtk_paned_add1(v.native(), child.toWidget()) -} - -// Add2() is a wrapper around gtk_paned_add2(). -func (v *Paned) Add2(child IWidget) { - C.gtk_paned_add2(v.native(), child.toWidget()) -} - -// Pack1() is a wrapper around gtk_paned_pack1(). -func (v *Paned) Pack1(child IWidget, resize, shrink bool) { - C.gtk_paned_pack1(v.native(), child.toWidget(), gbool(resize), gbool(shrink)) -} - -// Pack2() is a wrapper around gtk_paned_pack2(). -func (v *Paned) Pack2(child IWidget, resize, shrink bool) { - C.gtk_paned_pack2(v.native(), child.toWidget(), gbool(resize), gbool(shrink)) -} - -// SetPosition() is a wrapper around gtk_paned_set_position(). -func (v *Paned) SetPosition(position int) { - C.gtk_paned_set_position(v.native(), C.gint(position)) -} - -// GetChild1() is a wrapper around gtk_paned_get_child1(). -func (v *Paned) GetChild1() (*Widget, error) { - c := C.gtk_paned_get_child1(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -// GetChild2() is a wrapper around gtk_paned_get_child2(). -func (v *Paned) GetChild2() (*Widget, error) { - c := C.gtk_paned_get_child2(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -// GetHandleWindow() is a wrapper around gtk_paned_get_handle_window(). -func (v *Paned) GetHandleWindow() (*Window, error) { - c := C.gtk_paned_get_handle_window(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapWindow(glib.Take(unsafe.Pointer(c))), nil -} - -// GetPosition() is a wrapper around gtk_paned_get_position(). -func (v *Paned) GetPosition() int { - return int(C.gtk_paned_get_position(v.native())) -} - -/* - * GtkProgressBar - */ - -// ProgressBar is a representation of GTK's GtkProgressBar. -type ProgressBar struct { - Widget - // Interfaces - Orientable -} - -// native returns a pointer to the underlying GtkProgressBar. -func (v *ProgressBar) native() *C.GtkProgressBar { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkProgressBar(p) -} - -func marshalProgressBar(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapProgressBar(obj), nil -} - -func wrapProgressBar(obj *glib.Object) *ProgressBar { - o := wrapOrientable(obj) - return &ProgressBar{Widget{glib.InitiallyUnowned{obj}}, *o} -} - -// ProgressBarNew() is a wrapper around gtk_progress_bar_new(). -func ProgressBarNew() (*ProgressBar, error) { - c := C.gtk_progress_bar_new() - if c == nil { - return nil, nilPtrErr - } - return wrapProgressBar(glib.Take(unsafe.Pointer(c))), nil -} - -// SetFraction() is a wrapper around gtk_progress_bar_set_fraction(). -func (v *ProgressBar) SetFraction(fraction float64) { - C.gtk_progress_bar_set_fraction(v.native(), C.gdouble(fraction)) -} - -// GetFraction() is a wrapper around gtk_progress_bar_get_fraction(). -func (v *ProgressBar) GetFraction() float64 { - c := C.gtk_progress_bar_get_fraction(v.native()) - return float64(c) -} - -// SetShowText is a wrapper around gtk_progress_bar_set_show_text(). -func (v *ProgressBar) SetShowText(showText bool) { - C.gtk_progress_bar_set_show_text(v.native(), gbool(showText)) -} - -// GetShowText is a wrapper around gtk_progress_bar_get_show_text(). -func (v *ProgressBar) GetShowText() bool { - c := C.gtk_progress_bar_get_show_text(v.native()) - return gobool(c) -} - -// SetText() is a wrapper around gtk_progress_bar_set_text(). -func (v *ProgressBar) SetText(text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_progress_bar_set_text(v.native(), (*C.gchar)(cstr)) -} - -// SetPulseStep is a wrapper around gtk_progress_bar_set_pulse_step(). -func (v *ProgressBar) SetPulseStep(fraction float64) { - C.gtk_progress_bar_set_pulse_step(v.native(), C.gdouble(fraction)) -} - -// GetPulseStep is a wrapper around gtk_progress_bar_get_pulse_step(). -func (v *ProgressBar) GetPulseStep() float64 { - c := C.gtk_progress_bar_get_pulse_step(v.native()) - return float64(c) -} - -// Pulse is a wrapper arountd gtk_progress_bar_pulse(). -func (v *ProgressBar) Pulse() { - C.gtk_progress_bar_pulse(v.native()) -} - -// SetInverted is a wrapper around gtk_progress_bar_set_inverted(). -func (v *ProgressBar) SetInverted(inverted bool) { - C.gtk_progress_bar_set_inverted(v.native(), gbool(inverted)) -} - -// GetInverted is a wrapper around gtk_progress_bar_get_inverted(). -func (v *ProgressBar) GetInverted() bool { - c := C.gtk_progress_bar_get_inverted(v.native()) - return gobool(c) -} - -/* - * GtkRadioButton - */ - -// RadioButton is a representation of GTK's GtkRadioButton. -type RadioButton struct { - CheckButton -} - -// native returns a pointer to the underlying GtkRadioButton. -func (v *RadioButton) native() *C.GtkRadioButton { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkRadioButton(p) -} - -func marshalRadioButton(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapRadioButton(obj), nil -} - -func wrapRadioButton(obj *glib.Object) *RadioButton { - actionable := wrapActionable(obj) - return &RadioButton{CheckButton{ToggleButton{Button{Bin{Container{ - Widget{glib.InitiallyUnowned{obj}}}}, actionable}}}} -} - -// RadioButtonNew is a wrapper around gtk_radio_button_new(). -func RadioButtonNew(group *glib.SList) (*RadioButton, error) { - c := C.gtk_radio_button_new(cGSList(group)) - if c == nil { - return nil, nilPtrErr - } - return wrapRadioButton(glib.Take(unsafe.Pointer(c))), nil -} - -// RadioButtonNewFromWidget is a wrapper around -// gtk_radio_button_new_from_widget(). -func RadioButtonNewFromWidget(radioGroupMember *RadioButton) (*RadioButton, error) { - c := C.gtk_radio_button_new_from_widget(radioGroupMember.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapRadioButton(glib.Take(unsafe.Pointer(c))), nil -} - -// RadioButtonNewWithLabel is a wrapper around -// gtk_radio_button_new_with_label(). -func RadioButtonNewWithLabel(group *glib.SList, label string) (*RadioButton, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_radio_button_new_with_label(cGSList(group), (*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapRadioButton(glib.Take(unsafe.Pointer(c))), nil -} - -// RadioButtonNewWithLabelFromWidget is a wrapper around -// gtk_radio_button_new_with_label_from_widget(). -func RadioButtonNewWithLabelFromWidget(radioGroupMember *RadioButton, label string) (*RadioButton, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - var cradio *C.GtkRadioButton - if radioGroupMember != nil { - cradio = radioGroupMember.native() - } - c := C.gtk_radio_button_new_with_label_from_widget(cradio, (*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapRadioButton(glib.Take(unsafe.Pointer(c))), nil -} - -// RadioButtonNewWithMnemonic is a wrapper around -// gtk_radio_button_new_with_mnemonic() -func RadioButtonNewWithMnemonic(group *glib.SList, label string) (*RadioButton, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_radio_button_new_with_mnemonic(cGSList(group), (*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapRadioButton(glib.Take(unsafe.Pointer(c))), nil -} - -// RadioButtonNewWithMnemonicFromWidget is a wrapper around -// gtk_radio_button_new_with_mnemonic_from_widget(). -func RadioButtonNewWithMnemonicFromWidget(radioGroupMember *RadioButton, label string) (*RadioButton, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - var cradio *C.GtkRadioButton - if radioGroupMember != nil { - cradio = radioGroupMember.native() - } - c := C.gtk_radio_button_new_with_mnemonic_from_widget(cradio, - (*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapRadioButton(glib.Take(unsafe.Pointer(c))), nil -} - -// SetGroup is a wrapper around gtk_radio_button_set_group(). -func (v *RadioButton) SetGroup(group *glib.SList) { - C.gtk_radio_button_set_group(v.native(), cGSList(group)) -} - -// GetGroup is a wrapper around gtk_radio_button_get_group(). -func (v *RadioButton) GetGroup() (*glib.SList, error) { - c := C.gtk_radio_button_get_group(v.native()) - if c == nil { - return nil, nilPtrErr - } - return glib.WrapSList(uintptr(unsafe.Pointer(c))), nil -} - -// JoinGroup is a wrapper around gtk_radio_button_join_group(). -func (v *RadioButton) JoinGroup(groupSource *RadioButton) { - var cgroup *C.GtkRadioButton - if groupSource != nil { - cgroup = groupSource.native() - } - C.gtk_radio_button_join_group(v.native(), cgroup) -} - -/* - * GtkRadioMenuItem - */ - -// RadioMenuItem is a representation of GTK's GtkRadioMenuItem. -type RadioMenuItem struct { - CheckMenuItem -} - -// native returns a pointer to the underlying GtkRadioMenuItem. -func (v *RadioMenuItem) native() *C.GtkRadioMenuItem { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkRadioMenuItem(p) -} - -func marshalRadioMenuItem(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapRadioMenuItem(obj), nil -} - -func wrapRadioMenuItem(obj *glib.Object) *RadioMenuItem { - return &RadioMenuItem{CheckMenuItem{MenuItem{Bin{Container{ - Widget{glib.InitiallyUnowned{obj}}}}}}} -} - -// RadioMenuItemNew is a wrapper around gtk_radio_menu_item_new(). -func RadioMenuItemNew(group *glib.SList) (*RadioMenuItem, error) { - c := C.gtk_radio_menu_item_new(cGSList(group)) - if c == nil { - return nil, nilPtrErr - } - return wrapRadioMenuItem(glib.Take(unsafe.Pointer(c))), nil -} - -// RadioMenuItemNewWithLabel is a wrapper around -// gtk_radio_menu_item_new_with_label(). -func RadioMenuItemNewWithLabel(group *glib.SList, label string) (*RadioMenuItem, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_radio_menu_item_new_with_label(cGSList(group), (*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapRadioMenuItem(glib.Take(unsafe.Pointer(c))), nil -} - -// RadioMenuItemNewWithMnemonic is a wrapper around -// gtk_radio_menu_item_new_with_mnemonic(). -func RadioMenuItemNewWithMnemonic(group *glib.SList, label string) (*RadioMenuItem, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_radio_menu_item_new_with_mnemonic(cGSList(group), (*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapRadioMenuItem(glib.Take(unsafe.Pointer(c))), nil -} - -// RadioMenuItemNewFromWidget is a wrapper around -// gtk_radio_menu_item_new_from_widget(). -func RadioMenuItemNewFromWidget(group *RadioMenuItem) (*RadioMenuItem, error) { - c := C.gtk_radio_menu_item_new_from_widget(group.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapRadioMenuItem(glib.Take(unsafe.Pointer(c))), nil -} - -// RadioMenuItemNewWithLabelFromWidget is a wrapper around -// gtk_radio_menu_item_new_with_label_from_widget(). -func RadioMenuItemNewWithLabelFromWidget(group *RadioMenuItem, label string) (*RadioMenuItem, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_radio_menu_item_new_with_label_from_widget(group.native(), - (*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapRadioMenuItem(glib.Take(unsafe.Pointer(c))), nil -} - -// RadioMenuItemNewWithMnemonicFromWidget is a wrapper around -// gtk_radio_menu_item_new_with_mnemonic_from_widget(). -func RadioMenuItemNewWithMnemonicFromWidget(group *RadioMenuItem, label string) (*RadioMenuItem, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_radio_menu_item_new_with_mnemonic_from_widget(group.native(), - (*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapRadioMenuItem(glib.Take(unsafe.Pointer(c))), nil -} - -// SetGroup is a wrapper around gtk_radio_menu_item_set_group(). -func (v *RadioMenuItem) SetGroup(group *glib.SList) { - C.gtk_radio_menu_item_set_group(v.native(), cGSList(group)) -} - -// GetGroup is a wrapper around gtk_radio_menu_item_get_group(). -func (v *RadioMenuItem) GetGroup() (*glib.SList, error) { - c := C.gtk_radio_menu_item_get_group(v.native()) - if c == nil { - return nil, nilPtrErr - } - return glib.WrapSList(uintptr(unsafe.Pointer(c))), nil -} - -/* - * GtkRange - */ - -// Range is a representation of GTK's GtkRange. -type Range struct { - Widget -} - -// native returns a pointer to the underlying GtkRange. -func (v *Range) native() *C.GtkRange { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkRange(p) -} - -func marshalRange(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapRange(obj), nil -} - -func wrapRange(obj *glib.Object) *Range { - return &Range{Widget{glib.InitiallyUnowned{obj}}} -} - -// GetValue is a wrapper around gtk_range_get_value(). -func (v *Range) GetValue() float64 { - c := C.gtk_range_get_value(v.native()) - return float64(c) -} - -// SetValue is a wrapper around gtk_range_set_value(). -func (v *Range) SetValue(value float64) { - C.gtk_range_set_value(v.native(), C.gdouble(value)) -} - -// SetIncrements() is a wrapper around gtk_range_set_increments(). -func (v *Range) SetIncrements(step, page float64) { - C.gtk_range_set_increments(v.native(), C.gdouble(step), C.gdouble(page)) -} - -// SetRange() is a wrapper around gtk_range_set_range(). -func (v *Range) SetRange(min, max float64) { - C.gtk_range_set_range(v.native(), C.gdouble(min), C.gdouble(max)) -} - -// IRecentChooser is an interface type implemented by all structs -// embedding a RecentChooser. It is meant to be used as an argument type -// for wrapper functions that wrap around a C GTK function taking a -// GtkWidget. -type IRecentChooser interface { - toRecentChooser() *C.GtkRecentChooser -} - -/* - * GtkRecentChooser - */ - -// RecentChooser is a representation of GTK's GtkRecentChooser. -type RecentChooser struct { - *glib.Object -} - -// native returns a pointer to the underlying GtkRecentChooser. -func (v *RecentChooser) native() *C.GtkRecentChooser { - if v == nil || v.Object == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkRecentChooser(p) -} - -func wrapRecentChooser(obj *glib.Object) *RecentChooser { - return &RecentChooser{obj} -} - -func (v *RecentChooser) toRecentChooser() *C.GtkRecentChooser { - return v.native() -} - -func (v *RecentChooser) GetCurrentUri() string { - curi := C.gtk_recent_chooser_get_current_uri(v.native()) - return goString(curi) -} - -func (v *RecentChooser) AddFilter(filter *RecentFilter) { - C.gtk_recent_chooser_add_filter(v.native(), filter.native()) -} - -func (v *RecentChooser) RemoveFilter(filter *RecentFilter) { - C.gtk_recent_chooser_remove_filter(v.native(), filter.native()) -} - -/* - * GtkRecentChooserMenu - */ - -// RecentChooserMenu is a representation of GTK's GtkRecentChooserMenu. -type RecentChooserMenu struct { - Menu - RecentChooser -} - -// native returns a pointer to the underlying GtkRecentManager. -func (v *RecentChooserMenu) native() *C.GtkRecentChooserMenu { - if v == nil || v.Object == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkRecentChooserMenu(p) -} - -func wrapRecentChooserMenu(obj *glib.Object) *RecentChooserMenu { - return &RecentChooserMenu{ - Menu{MenuShell{Container{Widget{glib.InitiallyUnowned{obj}}}}}, - RecentChooser{obj}, - } -} - -/* - * GtkRecentFilter - */ - -// RecentFilter is a representation of GTK's GtkRecentFilter. -type RecentFilter struct { - glib.InitiallyUnowned -} - -// native returns a pointer to the underlying GtkRecentFilter. -func (v *RecentFilter) native() *C.GtkRecentFilter { - if v == nil || v.Object == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkRecentFilter(p) -} - -func wrapRecentFilter(obj *glib.Object) *RecentFilter { - return &RecentFilter{glib.InitiallyUnowned{obj}} -} - -// RecentFilterNew is a wrapper around gtk_recent_filter_new(). -func RecentFilterNew() (*RecentFilter, error) { - c := C.gtk_recent_filter_new() - if c == nil { - return nil, nilPtrErr - } - return wrapRecentFilter(glib.Take(unsafe.Pointer(c))), nil -} - -/* - * GtkRecentManager - */ - -// RecentManager is a representation of GTK's GtkRecentManager. -type RecentManager struct { - *glib.Object -} - -// native returns a pointer to the underlying GtkRecentManager. -func (v *RecentManager) native() *C.GtkRecentManager { - if v == nil || v.Object == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkRecentManager(p) -} - -func marshalRecentManager(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapRecentManager(obj), nil -} - -func wrapRecentManager(obj *glib.Object) *RecentManager { - return &RecentManager{obj} -} - -// RecentManagerGetDefault is a wrapper around gtk_recent_manager_get_default(). -func RecentManagerGetDefault() (*RecentManager, error) { - c := C.gtk_recent_manager_get_default() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - v := wrapRecentManager(obj) - return v, nil -} - -// AddItem is a wrapper around gtk_recent_manager_add_item(). -func (v *RecentManager) AddItem(fileURI string) bool { - cstr := C.CString(fileURI) - defer C.free(unsafe.Pointer(cstr)) - cok := C.gtk_recent_manager_add_item(v.native(), (*C.gchar)(cstr)) - return gobool(cok) -} - -/* - * GtkScale - */ - -// Scale is a representation of GTK's GtkScale. -type Scale struct { - Range -} - -// native returns a pointer to the underlying GtkScale. -func (v *Scale) native() *C.GtkScale { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkScale(p) -} - -func marshalScale(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapScale(obj), nil -} - -func wrapScale(obj *glib.Object) *Scale { - return &Scale{Range{Widget{glib.InitiallyUnowned{obj}}}} -} - -// ScaleNew is a wrapper around gtk_scale_new(). -func ScaleNew(orientation Orientation, adjustment *Adjustment) (*Scale, error) { - c := C.gtk_scale_new(C.GtkOrientation(orientation), adjustment.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapScale(glib.Take(unsafe.Pointer(c))), nil -} - -// ScaleNewWithRange is a wrapper around gtk_scale_new_with_range(). -func ScaleNewWithRange(orientation Orientation, min, max, step float64) (*Scale, error) { - c := C.gtk_scale_new_with_range(C.GtkOrientation(orientation), - C.gdouble(min), C.gdouble(max), C.gdouble(step)) - - if c == nil { - return nil, nilPtrErr - } - return wrapScale(glib.Take(unsafe.Pointer(c))), nil -} - -// SetDrawValue() is a wrapper around gtk_scale_set_draw_value(). -func (v *Scale) SetDrawValue(drawValue bool) { - C.gtk_scale_set_draw_value(v.native(), gbool(drawValue)) -} - -/* - * GtkScaleButton - */ - -// ScaleButton is a representation of GTK's GtkScaleButton. -type ScaleButton struct { - Button -} - -// native() returns a pointer to the underlying GtkScaleButton. -func (v *ScaleButton) native() *C.GtkScaleButton { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkScaleButton(p) -} - -func marshalScaleButton(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapScaleButton(obj), nil -} - -func wrapScaleButton(obj *glib.Object) *ScaleButton { - actionable := wrapActionable(obj) - return &ScaleButton{Button{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}, actionable}} -} - -// ScaleButtonNew() is a wrapper around gtk_scale_button_new(). -func ScaleButtonNew(size IconSize, min, max, step float64, icons []string) (*ScaleButton, error) { - cicons := make([]*C.gchar, len(icons)) - for i, icon := range icons { - cicons[i] = (*C.gchar)(C.CString(icon)) - defer C.free(unsafe.Pointer(cicons[i])) - } - cicons = append(cicons, nil) - - c := C.gtk_scale_button_new(C.GtkIconSize(size), - C.gdouble(min), - C.gdouble(max), - C.gdouble(step), - &cicons[0]) - if c == nil { - return nil, nilPtrErr - } - return wrapScaleButton(glib.Take(unsafe.Pointer(c))), nil -} - -// GetAdjustment() is a wrapper around gtk_scale_button_get_adjustment(). -func (v *ScaleButton) GetAdjustment() *Adjustment { - c := C.gtk_scale_button_get_adjustment(v.native()) - obj := glib.Take(unsafe.Pointer(c)) - return &Adjustment{glib.InitiallyUnowned{obj}} -} - -// GetPopup() is a wrapper around gtk_scale_button_get_popup(). -func (v *ScaleButton) GetPopup() (*Widget, error) { - c := C.gtk_scale_button_get_popup(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -// GetValue() is a wrapper around gtk_scale_button_get_value(). -func (v *ScaleButton) GetValue() float64 { - return float64(C.gtk_scale_button_get_value(v.native())) -} - -// SetAdjustment() is a wrapper around gtk_scale_button_set_adjustment(). -func (v *ScaleButton) SetAdjustment(adjustment *Adjustment) { - C.gtk_scale_button_set_adjustment(v.native(), adjustment.native()) -} - -// SetValue() is a wrapper around gtk_scale_button_set_value(). -func (v *ScaleButton) SetValue(value float64) { - C.gtk_scale_button_set_value(v.native(), C.gdouble(value)) -} - -/* - * GtkScrollable - */ - -// IScrollable is an interface type implemented by all structs -// embedding a Scrollable. It is meant to be used as an argument type -// for wrapper functions that wrap around a C GTK function taking a -// GtkScrollable. -type IScrollable interface { - toScrollable() *C.GtkScrollable -} - -// Scrollable is a representation of GTK's GtkScrollable GInterface. -type Scrollable struct { - *glib.Object -} - -// native() returns a pointer to the underlying GObject as a GtkScrollable. -func (v *Scrollable) native() *C.GtkScrollable { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkScrollable(p) -} - -func wrapScrollable(obj *glib.Object) *Scrollable { - return &Scrollable{obj} -} - -func (v *Scrollable) toScrollable() *C.GtkScrollable { - if v == nil { - return nil - } - return v.native() -} - -// SetHAdjustment is a wrapper around gtk_scrollable_set_hadjustment(). -func (v *Scrollable) SetHAdjustment(adjustment *Adjustment) { - C.gtk_scrollable_set_hadjustment(v.native(), adjustment.native()) -} - -// GetHAdjustment is a wrapper around gtk_scrollable_get_hadjustment(). -func (v *Scrollable) GetHAdjustment() (*Adjustment, error) { - c := C.gtk_scrollable_get_hadjustment(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapAdjustment(glib.Take(unsafe.Pointer(c))), nil -} - -// SetVAdjustment is a wrapper around gtk_scrollable_set_vadjustment(). -func (v *Scrollable) SetVAdjustment(adjustment *Adjustment) { - C.gtk_scrollable_set_vadjustment(v.native(), adjustment.native()) -} - -// GetVAdjustment is a wrapper around gtk_scrollable_get_vadjustment(). -func (v *Scrollable) GetVAdjustment() (*Adjustment, error) { - c := C.gtk_scrollable_get_vadjustment(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapAdjustment(glib.Take(unsafe.Pointer(c))), nil -} - -/* - * GtkScrollbar - */ - -// Scrollbar is a representation of GTK's GtkScrollbar. -type Scrollbar struct { - Range -} - -// native returns a pointer to the underlying GtkScrollbar. -func (v *Scrollbar) native() *C.GtkScrollbar { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkScrollbar(p) -} - -func marshalScrollbar(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapScrollbar(obj), nil -} - -func wrapScrollbar(obj *glib.Object) *Scrollbar { - return &Scrollbar{Range{Widget{glib.InitiallyUnowned{obj}}}} -} - -// ScrollbarNew is a wrapper around gtk_scrollbar_new(). -func ScrollbarNew(orientation Orientation, adjustment *Adjustment) (*Scrollbar, error) { - c := C.gtk_scrollbar_new(C.GtkOrientation(orientation), adjustment.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapScrollbar(glib.Take(unsafe.Pointer(c))), nil -} - -/* - * GtkScrolledWindow - */ - -// ScrolledWindow is a representation of GTK's GtkScrolledWindow. -type ScrolledWindow struct { - Bin -} - -// native returns a pointer to the underlying GtkScrolledWindow. -func (v *ScrolledWindow) native() *C.GtkScrolledWindow { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkScrolledWindow(p) -} - -func marshalScrolledWindow(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapScrolledWindow(obj), nil -} - -func wrapScrolledWindow(obj *glib.Object) *ScrolledWindow { - return &ScrolledWindow{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// ScrolledWindowNew() is a wrapper around gtk_scrolled_window_new(). -func ScrolledWindowNew(hadjustment, vadjustment *Adjustment) (*ScrolledWindow, error) { - c := C.gtk_scrolled_window_new(hadjustment.native(), - vadjustment.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapScrolledWindow(glib.Take(unsafe.Pointer(c))), nil -} - -// SetPolicy() is a wrapper around gtk_scrolled_window_set_policy(). -func (v *ScrolledWindow) SetPolicy(hScrollbarPolicy, vScrollbarPolicy PolicyType) { - C.gtk_scrolled_window_set_policy(v.native(), - C.GtkPolicyType(hScrollbarPolicy), - C.GtkPolicyType(vScrollbarPolicy)) -} - -// GetHAdjustment() is a wrapper around gtk_scrolled_window_get_hadjustment(). -func (v *ScrolledWindow) GetHAdjustment() *Adjustment { - c := C.gtk_scrolled_window_get_hadjustment(v.native()) - if c == nil { - return nil - } - return wrapAdjustment(glib.Take(unsafe.Pointer(c))) -} - -// SetHAdjustment is a wrapper around gtk_scrolled_window_set_hadjustment(). -func (v *ScrolledWindow) SetHAdjustment(adjustment *Adjustment) { - C.gtk_scrolled_window_set_hadjustment(v.native(), adjustment.native()) -} - -// GetVAdjustment() is a wrapper around gtk_scrolled_window_get_vadjustment(). -func (v *ScrolledWindow) GetVAdjustment() *Adjustment { - c := C.gtk_scrolled_window_get_vadjustment(v.native()) - if c == nil { - return nil - } - return wrapAdjustment(glib.Take(unsafe.Pointer(c))) -} - -// SetVAdjustment is a wrapper around gtk_scrolled_window_set_vadjustment(). -func (v *ScrolledWindow) SetVAdjustment(adjustment *Adjustment) { - C.gtk_scrolled_window_set_vadjustment(v.native(), adjustment.native()) -} - -// GetShadowType is a wrapper around gtk_scrolled_window_get_shadow_type(). -func (v *ScrolledWindow) GetShadowType() ShadowType { - c := C.gtk_scrolled_window_get_shadow_type(v.native()) - return ShadowType(c) -} - -// SetShadowType is a wrapper around gtk_scrolled_window_set_shadow_type(). -func (v *ScrolledWindow) SetShadowType(t ShadowType) { - C.gtk_scrolled_window_set_shadow_type(v.native(), C.GtkShadowType(t)) -} - -/* - * GtkSearchEntry - */ - -// SearchEntry is a reprensentation of GTK's GtkSearchEntry. -type SearchEntry struct { - Entry -} - -// native returns a pointer to the underlying GtkSearchEntry. -func (v *SearchEntry) native() *C.GtkSearchEntry { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkSearchEntry(p) -} - -func marshalSearchEntry(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapSearchEntry(obj), nil -} - -func wrapSearchEntry(obj *glib.Object) *SearchEntry { - e := wrapEditable(obj) - return &SearchEntry{Entry{Widget{glib.InitiallyUnowned{obj}}, *e}} -} - -// SearchEntryNew is a wrapper around gtk_search_entry_new(). -func SearchEntryNew() (*SearchEntry, error) { - c := C.gtk_search_entry_new() - if c == nil { - return nil, nilPtrErr - } - return wrapSearchEntry(glib.Take(unsafe.Pointer(c))), nil -} - -/* -* GtkSelectionData - */ -type SelectionData struct { - GtkSelectionData *C.GtkSelectionData -} - -func marshalSelectionData(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - return (*SelectionData)(unsafe.Pointer(c)), nil -} - -// native returns a pointer to the underlying GtkSelectionData. -func (v *SelectionData) native() *C.GtkSelectionData { - if v == nil { - return nil - } - return v.GtkSelectionData -} - -// GetLength is a wrapper around gtk_selection_data_get_length -func (v *SelectionData) GetLength() int { - return int(C.gtk_selection_data_get_length(v.native())) -} - -// GetData is a wrapper around gtk_selection_data_get_data_with_length. -// It returns a slice of the correct size with the selection's data. -func (v *SelectionData) GetData() (data []byte) { - var length C.gint - c := C.gtk_selection_data_get_data_with_length(v.native(), &length) - sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&data)) - sliceHeader.Data = uintptr(unsafe.Pointer(c)) - sliceHeader.Len = int(length) - sliceHeader.Cap = int(length) - return -} - -//fixed GetData directly from ptr -func GetData(pointer uintptr) (data []byte) { - c := (*C.GValue)(unsafe.Pointer(pointer)) - p := (*C.GtkSelectionData)(unsafe.Pointer(c)) - C.gtk_selection_data_get_text(p) - - var byteData []byte - var length C.gint - cptr := C.gtk_selection_data_get_data_with_length(p, &length) - sliceHeader := (*reflect.SliceHeader)(unsafe.Pointer(&byteData)) - sliceHeader.Data = uintptr(unsafe.Pointer(cptr)) - sliceHeader.Len = int(length) - sliceHeader.Cap = int(length) - - return byteData -} - -func (v *SelectionData) free() { - C.gtk_selection_data_free(v.native()) -} - -/* - * GtkSeparator - */ - -// Separator is a representation of GTK's GtkSeparator. -type Separator struct { - Widget -} - -// native returns a pointer to the underlying GtkSeperator. -func (v *Separator) native() *C.GtkSeparator { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkSeparator(p) -} - -func marshalSeparator(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapSeparator(obj), nil -} - -func wrapSeparator(obj *glib.Object) *Separator { - return &Separator{Widget{glib.InitiallyUnowned{obj}}} -} - -// SeparatorNew is a wrapper around gtk_separator_new(). -func SeparatorNew(orientation Orientation) (*Separator, error) { - c := C.gtk_separator_new(C.GtkOrientation(orientation)) - if c == nil { - return nil, nilPtrErr - } - return wrapSeparator(glib.Take(unsafe.Pointer(c))), nil -} - -/* - * GtkSeparatorMenuItem - */ - -// SeparatorMenuItem is a representation of GTK's GtkSeparatorMenuItem. -type SeparatorMenuItem struct { - MenuItem -} - -// native returns a pointer to the underlying GtkSeparatorMenuItem. -func (v *SeparatorMenuItem) native() *C.GtkSeparatorMenuItem { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkSeparatorMenuItem(p) -} - -func marshalSeparatorMenuItem(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapSeparatorMenuItem(obj), nil -} - -func wrapSeparatorMenuItem(obj *glib.Object) *SeparatorMenuItem { - return &SeparatorMenuItem{MenuItem{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}}} -} - -// SeparatorMenuItemNew is a wrapper around gtk_separator_menu_item_new(). -func SeparatorMenuItemNew() (*SeparatorMenuItem, error) { - c := C.gtk_separator_menu_item_new() - if c == nil { - return nil, nilPtrErr - } - return wrapSeparatorMenuItem(glib.Take(unsafe.Pointer(c))), nil -} - -/* - * GtkSeparatorToolItem - */ - -// SeparatorToolItem is a representation of GTK's GtkSeparatorToolItem. -type SeparatorToolItem struct { - ToolItem -} - -// native returns a pointer to the underlying GtkSeparatorToolItem. -func (v *SeparatorToolItem) native() *C.GtkSeparatorToolItem { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkSeparatorToolItem(p) -} - -func marshalSeparatorToolItem(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapSeparatorToolItem(obj), nil -} - -func wrapSeparatorToolItem(obj *glib.Object) *SeparatorToolItem { - return &SeparatorToolItem{ToolItem{Bin{Container{Widget{ - glib.InitiallyUnowned{obj}}}}}} -} - -// SeparatorToolItemNew is a wrapper around gtk_separator_tool_item_new(). -func SeparatorToolItemNew() (*SeparatorToolItem, error) { - c := C.gtk_separator_tool_item_new() - if c == nil { - return nil, nilPtrErr - } - return wrapSeparatorToolItem(glib.Take(unsafe.Pointer(c))), nil -} - -// SetDraw is a wrapper around gtk_separator_tool_item_set_draw(). -func (v *SeparatorToolItem) SetDraw(draw bool) { - C.gtk_separator_tool_item_set_draw(v.native(), gbool(draw)) -} - -// GetDraw is a wrapper around gtk_separator_tool_item_get_draw(). -func (v *SeparatorToolItem) GetDraw() bool { - c := C.gtk_separator_tool_item_get_draw(v.native()) - return gobool(c) -} - -/* - * GtkSizeGroup - */ - -// SizeGroup is a representation of GTK's GtkSizeGroup -type SizeGroup struct { - *glib.Object -} - -// native() returns a pointer to the underlying GtkSizeGroup -func (v *SizeGroup) native() *C.GtkSizeGroup { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkSizeGroup(p) -} - -func marshalSizeGroup(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return &SizeGroup{obj}, nil -} - -func wrapSizeGroup(obj *glib.Object) *SizeGroup { - return &SizeGroup{obj} -} - -// SizeGroupNew is a wrapper around gtk_size_group_new(). -func SizeGroupNew(mode SizeGroupMode) (*SizeGroup, error) { - c := C.gtk_size_group_new(C.GtkSizeGroupMode(mode)) - if c == nil { - return nil, nilPtrErr - } - return wrapSizeGroup(glib.Take(unsafe.Pointer(c))), nil -} - -func (v *SizeGroup) SetMode(mode SizeGroupMode) { - C.gtk_size_group_set_mode(v.native(), C.GtkSizeGroupMode(mode)) -} - -func (v *SizeGroup) GetMode() SizeGroupMode { - return SizeGroupMode(C.gtk_size_group_get_mode(v.native())) -} - -func (v *SizeGroup) AddWidget(widget IWidget) { - C.gtk_size_group_add_widget(v.native(), widget.toWidget()) -} - -func (v *SizeGroup) RemoveWidget(widget IWidget) { - C.gtk_size_group_remove_widget(v.native(), widget.toWidget()) -} - -func (v *SizeGroup) GetWidgets() *glib.SList { - c := C.gtk_size_group_get_widgets(v.native()) - if c == nil { - return nil - } - return glib.WrapSList(uintptr(unsafe.Pointer(c))) -} - -/* - * GtkSpinButton - */ - -// SpinButton is a representation of GTK's GtkSpinButton. -type SpinButton struct { - Entry -} - -// native returns a pointer to the underlying GtkSpinButton. -func (v *SpinButton) native() *C.GtkSpinButton { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkSpinButton(p) -} - -func marshalSpinButton(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapSpinButton(obj), nil -} - -func wrapSpinButton(obj *glib.Object) *SpinButton { - e := wrapEditable(obj) - return &SpinButton{Entry{Widget{glib.InitiallyUnowned{obj}}, *e}} -} - -// Configure() is a wrapper around gtk_spin_button_configure(). -func (v *SpinButton) Configure(adjustment *Adjustment, climbRate float64, digits uint) { - C.gtk_spin_button_configure(v.native(), adjustment.native(), - C.gdouble(climbRate), C.guint(digits)) -} - -// SpinButtonNew() is a wrapper around gtk_spin_button_new(). -func SpinButtonNew(adjustment *Adjustment, climbRate float64, digits uint) (*SpinButton, error) { - c := C.gtk_spin_button_new(adjustment.native(), - C.gdouble(climbRate), C.guint(digits)) - if c == nil { - return nil, nilPtrErr - } - return wrapSpinButton(glib.Take(unsafe.Pointer(c))), nil -} - -// SpinButtonNewWithRange() is a wrapper around -// gtk_spin_button_new_with_range(). -func SpinButtonNewWithRange(min, max, step float64) (*SpinButton, error) { - c := C.gtk_spin_button_new_with_range(C.gdouble(min), C.gdouble(max), - C.gdouble(step)) - if c == nil { - return nil, nilPtrErr - } - return wrapSpinButton(glib.Take(unsafe.Pointer(c))), nil -} - -// GetValueAsInt() is a wrapper around gtk_spin_button_get_value_as_int(). -func (v *SpinButton) GetValueAsInt() int { - c := C.gtk_spin_button_get_value_as_int(v.native()) - return int(c) -} - -// SetValue() is a wrapper around gtk_spin_button_set_value(). -func (v *SpinButton) SetValue(value float64) { - C.gtk_spin_button_set_value(v.native(), C.gdouble(value)) -} - -// GetValue() is a wrapper around gtk_spin_button_get_value(). -func (v *SpinButton) GetValue() float64 { - c := C.gtk_spin_button_get_value(v.native()) - return float64(c) -} - -// GetAdjustment() is a wrapper around gtk_spin_button_get_adjustment -func (v *SpinButton) GetAdjustment() *Adjustment { - c := C.gtk_spin_button_get_adjustment(v.native()) - if c == nil { - return nil - } - return wrapAdjustment(glib.Take(unsafe.Pointer(c))) -} - -// SetRange is a wrapper around gtk_spin_button_set_range(). -func (v *SpinButton) SetRange(min, max float64) { - C.gtk_spin_button_set_range(v.native(), C.gdouble(min), C.gdouble(max)) -} - -// SetIncrements() is a wrapper around gtk_spin_button_set_increments(). -func (v *SpinButton) SetIncrements(step, page float64) { - C.gtk_spin_button_set_increments(v.native(), C.gdouble(step), C.gdouble(page)) -} - -/* - * GtkSpinner - */ - -// Spinner is a representation of GTK's GtkSpinner. -type Spinner struct { - Widget -} - -// native returns a pointer to the underlying GtkSpinner. -func (v *Spinner) native() *C.GtkSpinner { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkSpinner(p) -} - -func marshalSpinner(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapSpinner(obj), nil -} - -func wrapSpinner(obj *glib.Object) *Spinner { - return &Spinner{Widget{glib.InitiallyUnowned{obj}}} -} - -// SpinnerNew is a wrapper around gtk_spinner_new(). -func SpinnerNew() (*Spinner, error) { - c := C.gtk_spinner_new() - if c == nil { - return nil, nilPtrErr - } - return wrapSpinner(glib.Take(unsafe.Pointer(c))), nil -} - -// Start is a wrapper around gtk_spinner_start(). -func (v *Spinner) Start() { - C.gtk_spinner_start(v.native()) -} - -// Stop is a wrapper around gtk_spinner_stop(). -func (v *Spinner) Stop() { - C.gtk_spinner_stop(v.native()) -} - -/* - * GtkStatusbar - */ - -// Statusbar is a representation of GTK's GtkStatusbar -type Statusbar struct { - Box -} - -// native returns a pointer to the underlying GtkStatusbar -func (v *Statusbar) native() *C.GtkStatusbar { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkStatusbar(p) -} - -func marshalStatusbar(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapStatusbar(obj), nil -} - -func wrapStatusbar(obj *glib.Object) *Statusbar { - return &Statusbar{Box{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// StatusbarNew() is a wrapper around gtk_statusbar_new(). -func StatusbarNew() (*Statusbar, error) { - c := C.gtk_statusbar_new() - if c == nil { - return nil, nilPtrErr - } - return wrapStatusbar(glib.Take(unsafe.Pointer(c))), nil -} - -// GetContextId() is a wrapper around gtk_statusbar_get_context_id(). -func (v *Statusbar) GetContextId(contextDescription string) uint { - cstr := C.CString(contextDescription) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_statusbar_get_context_id(v.native(), (*C.gchar)(cstr)) - return uint(c) -} - -// Push() is a wrapper around gtk_statusbar_push(). -func (v *Statusbar) Push(contextID uint, text string) uint { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_statusbar_push(v.native(), C.guint(contextID), - (*C.gchar)(cstr)) - return uint(c) -} - -// Pop() is a wrapper around gtk_statusbar_pop(). -func (v *Statusbar) Pop(contextID uint) { - C.gtk_statusbar_pop(v.native(), C.guint(contextID)) -} - -// GetMessageArea() is a wrapper around gtk_statusbar_get_message_area(). -func (v *Statusbar) GetMessageArea() (*Box, error) { - c := C.gtk_statusbar_get_message_area(v.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return &Box{Container{Widget{glib.InitiallyUnowned{obj}}}}, nil -} - -/* - * GtkSwitch - */ - -// Switch is a representation of GTK's GtkSwitch. -type Switch struct { - Widget -} - -// native returns a pointer to the underlying GtkSwitch. -func (v *Switch) native() *C.GtkSwitch { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkSwitch(p) -} - -func marshalSwitch(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapSwitch(obj), nil -} - -func wrapSwitch(obj *glib.Object) *Switch { - return &Switch{Widget{glib.InitiallyUnowned{obj}}} -} - -// SwitchNew is a wrapper around gtk_switch_new(). -func SwitchNew() (*Switch, error) { - c := C.gtk_switch_new() - if c == nil { - return nil, nilPtrErr - } - return wrapSwitch(glib.Take(unsafe.Pointer(c))), nil -} - -// GetActive is a wrapper around gtk_switch_get_active(). -func (v *Switch) GetActive() bool { - c := C.gtk_switch_get_active(v.native()) - return gobool(c) -} - -// SetActive is a wrapper around gtk_switch_set_active(). -func (v *Switch) SetActive(isActive bool) { - C.gtk_switch_set_active(v.native(), gbool(isActive)) -} - -/* - * GtkTargetEntry - */ - -// TargetEntry is a representation of GTK's GtkTargetEntry -type TargetEntry C.GtkTargetEntry - -func marshalTargetEntry(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - return (*TargetEntry)(unsafe.Pointer(c)), nil -} - -func (v *TargetEntry) native() *C.GtkTargetEntry { - return (*C.GtkTargetEntry)(unsafe.Pointer(v)) -} - -// TargetEntryNew is a wrapper around gtk_target_entry_new(). -func TargetEntryNew(target string, flags TargetFlags, info uint) (*TargetEntry, error) { - cstr := C.CString(target) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_target_entry_new((*C.gchar)(cstr), C.guint(flags), C.guint(info)) - if c == nil { - return nil, nilPtrErr - } - t := (*TargetEntry)(unsafe.Pointer(c)) - // causes setFinilizer error - // runtime.SetFinalizer(t, (*TargetEntry).free) - return t, nil -} - -func (v *TargetEntry) free() { - C.gtk_target_entry_free(v.native()) -} - -/* - * GtkTextTag - */ - -type TextTag struct { - *glib.Object -} - -// native returns a pointer to the underlying GObject as a GtkTextTag. -func (v *TextTag) native() *C.GtkTextTag { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkTextTag(p) -} - -func marshalTextTag(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapTextTag(obj), nil -} - -func wrapTextTag(obj *glib.Object) *TextTag { - return &TextTag{obj} -} - -func TextTagNew(name string) (*TextTag, error) { - cname := C.CString(name) - defer C.free(unsafe.Pointer(cname)) - c := C.gtk_text_tag_new((*C.gchar)(cname)) - if c == nil { - return nil, nilPtrErr - } - return wrapTextTag(glib.Take(unsafe.Pointer(c))), nil -} - -// GetPriority() is a wrapper around gtk_text_tag_get_priority(). -func (v *TextTag) GetPriority() int { - return int(C.gtk_text_tag_get_priority(v.native())) -} - -// SetPriority() is a wrapper around gtk_text_tag_set_priority(). -func (v *TextTag) SetPriority(priority int) { - C.gtk_text_tag_set_priority(v.native(), C.gint(priority)) -} - -// Event() is a wrapper around gtk_text_tag_event(). -func (v *TextTag) Event(eventObject *glib.Object, event *gdk.Event, iter *TextIter) bool { - ok := C.gtk_text_tag_event(v.native(), - (*C.GObject)(unsafe.Pointer(eventObject.Native())), - (*C.GdkEvent)(unsafe.Pointer(event.Native())), - (*C.GtkTextIter)(iter), - ) - return gobool(ok) -} - -/* - * GtkTextTagTable - */ - -type TextTagTable struct { - *glib.Object -} - -// native returns a pointer to the underlying GObject as a GtkTextTagTable. -func (v *TextTagTable) native() *C.GtkTextTagTable { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkTextTagTable(p) -} - -func marshalTextTagTable(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapTextTagTable(obj), nil -} - -func wrapTextTagTable(obj *glib.Object) *TextTagTable { - return &TextTagTable{obj} -} - -func TextTagTableNew() (*TextTagTable, error) { - c := C.gtk_text_tag_table_new() - if c == nil { - return nil, nilPtrErr - } - return wrapTextTagTable(glib.Take(unsafe.Pointer(c))), nil -} - -// Add() is a wrapper around gtk_text_tag_table_add(). -func (v *TextTagTable) Add(tag *TextTag) { - C.gtk_text_tag_table_add(v.native(), tag.native()) - //return gobool(c) // TODO version-separate -} - -// Lookup() is a wrapper around gtk_text_tag_table_lookup(). -func (v *TextTagTable) Lookup(name string) (*TextTag, error) { - cname := C.CString(name) - defer C.free(unsafe.Pointer(cname)) - c := C.gtk_text_tag_table_lookup(v.native(), (*C.gchar)(cname)) - if c == nil { - return nil, nilPtrErr - } - return wrapTextTag(glib.Take(unsafe.Pointer(c))), nil -} - -// Remove() is a wrapper around gtk_text_tag_table_remove(). -func (v *TextTagTable) Remove(tag *TextTag) { - C.gtk_text_tag_table_remove(v.native(), tag.native()) -} - -/* - * GtkTextBuffer - */ - -// TextBuffer is a representation of GTK's GtkTextBuffer. -type TextBuffer struct { - *glib.Object -} - -// native returns a pointer to the underlying GtkTextBuffer. -func (v *TextBuffer) native() *C.GtkTextBuffer { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkTextBuffer(p) -} - -func marshalTextBuffer(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapTextBuffer(obj), nil -} - -func wrapTextBuffer(obj *glib.Object) *TextBuffer { - return &TextBuffer{obj} -} - -// TextBufferNew() is a wrapper around gtk_text_buffer_new(). -func TextBufferNew(table *TextTagTable) (*TextBuffer, error) { - c := C.gtk_text_buffer_new(table.native()) - if c == nil { - return nil, nilPtrErr - } - - e := wrapTextBuffer(glib.Take(unsafe.Pointer(c))) - return e, nil -} - -// ApplyTag() is a wrapper around gtk_text_buffer_apply_tag(). -func (v *TextBuffer) ApplyTag(tag *TextTag, start, end *TextIter) { - C.gtk_text_buffer_apply_tag(v.native(), tag.native(), (*C.GtkTextIter)(start), (*C.GtkTextIter)(end)) -} - -// ApplyTagByName() is a wrapper around gtk_text_buffer_apply_tag_by_name(). -func (v *TextBuffer) ApplyTagByName(name string, start, end *TextIter) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_text_buffer_apply_tag_by_name(v.native(), (*C.gchar)(cstr), - (*C.GtkTextIter)(start), (*C.GtkTextIter)(end)) -} - -// CreateChildAnchor() is a wrapper around gtk_text_buffer_create_child_anchor(). -// Since it copies garbage from the stack into the padding bytes of iter, -// iter can't be reliably reused after this call unless GODEBUG=cgocheck=0. -func (v *TextBuffer) CreateChildAnchor(iter *TextIter) *TextChildAnchor { - ret := C.gtk_text_buffer_create_child_anchor(v.native(), iter.native()) - return (*TextChildAnchor)(ret) -} - -// Delete() is a wrapper around gtk_text_buffer_delete(). -func (v *TextBuffer) Delete(start, end *TextIter) { - C.gtk_text_buffer_delete(v.native(), (*C.GtkTextIter)(start), (*C.GtkTextIter)(end)) -} - -func (v *TextBuffer) GetBounds() (start, end *TextIter) { - start, end = new(TextIter), new(TextIter) - C.gtk_text_buffer_get_bounds(v.native(), (*C.GtkTextIter)(start), (*C.GtkTextIter)(end)) - return -} - -// GetCharCount() is a wrapper around gtk_text_buffer_get_char_count(). -func (v *TextBuffer) GetCharCount() int { - return int(C.gtk_text_buffer_get_char_count(v.native())) -} - -// GetIterAtOffset() is a wrapper around gtk_text_buffer_get_iter_at_offset(). -func (v *TextBuffer) GetIterAtOffset(charOffset int) *TextIter { - var iter C.GtkTextIter - C.gtk_text_buffer_get_iter_at_offset(v.native(), &iter, C.gint(charOffset)) - return (*TextIter)(&iter) -} - -// GetStartIter() is a wrapper around gtk_text_buffer_get_start_iter(). -func (v *TextBuffer) GetStartIter() *TextIter { - var iter C.GtkTextIter - C.gtk_text_buffer_get_start_iter(v.native(), &iter) - return (*TextIter)(&iter) -} - -// GetEndIter() is a wrapper around gtk_text_buffer_get_end_iter(). -func (v *TextBuffer) GetEndIter() *TextIter { - var iter C.GtkTextIter - C.gtk_text_buffer_get_end_iter(v.native(), &iter) - return (*TextIter)(&iter) -} - -// GetLineCount() is a wrapper around gtk_text_buffer_get_line_count(). -func (v *TextBuffer) GetLineCount() int { - return int(C.gtk_text_buffer_get_line_count(v.native())) -} - -// GetModified() is a wrapper around gtk_text_buffer_get_modified(). -func (v *TextBuffer) GetModified() bool { - return gobool(C.gtk_text_buffer_get_modified(v.native())) -} - -// GetTagTable() is a wrapper around gtk_text_buffer_get_tag_table(). -func (v *TextBuffer) GetTagTable() (*TextTagTable, error) { - c := C.gtk_text_buffer_get_tag_table(v.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapTextTagTable(obj), nil -} - -func (v *TextBuffer) GetText(start, end *TextIter, includeHiddenChars bool) (string, error) { - c := C.gtk_text_buffer_get_text( - v.native(), (*C.GtkTextIter)(start), (*C.GtkTextIter)(end), gbool(includeHiddenChars), - ) - if c == nil { - return "", nilPtrErr - } - gostr := goString(c) - C.g_free(C.gpointer(c)) - return gostr, nil -} - -// Insert() is a wrapper around gtk_text_buffer_insert(). -func (v *TextBuffer) Insert(iter *TextIter, text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_text_buffer_insert(v.native(), (*C.GtkTextIter)(iter), (*C.gchar)(cstr), C.gint(len(text))) -} - -// InsertAtCursor() is a wrapper around gtk_text_buffer_insert_at_cursor(). -func (v *TextBuffer) InsertAtCursor(text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_text_buffer_insert_at_cursor(v.native(), (*C.gchar)(cstr), C.gint(len(text))) -} - -// RemoveTag() is a wrapper around gtk_text_buffer_remove_tag(). -func (v *TextBuffer) RemoveTag(tag *TextTag, start, end *TextIter) { - C.gtk_text_buffer_remove_tag(v.native(), tag.native(), (*C.GtkTextIter)(start), (*C.GtkTextIter)(end)) -} - -// SetModified() is a wrapper around gtk_text_buffer_set_modified(). -func (v *TextBuffer) SetModified(setting bool) { - C.gtk_text_buffer_set_modified(v.native(), gbool(setting)) -} - -func (v *TextBuffer) SetText(text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_text_buffer_set_text(v.native(), (*C.gchar)(cstr), - C.gint(len(text))) -} - -// GetIterAtMark() is a wrapper around gtk_text_buffer_get_iter_at_mark(). -func (v *TextBuffer) GetIterAtMark(mark *TextMark) *TextIter { - var iter C.GtkTextIter - C.gtk_text_buffer_get_iter_at_mark(v.native(), &iter, (*C.GtkTextMark)(mark)) - return (*TextIter)(&iter) -} - -// CreateMark() is a wrapper around gtk_text_buffer_create_mark(). -func (v *TextBuffer) CreateMark(mark_name string, where *TextIter, left_gravity bool) *TextMark { - cstr := C.CString(mark_name) - defer C.free(unsafe.Pointer(cstr)) - ret := C.gtk_text_buffer_create_mark(v.native(), (*C.gchar)(cstr), (*C.GtkTextIter)(where), gbool(left_gravity)) - return (*TextMark)(ret) -} - -/* - * GtkToggleButton - */ - -// ToggleButton is a representation of GTK's GtkToggleButton. -type ToggleButton struct { - Button -} - -// native returns a pointer to the underlying GtkToggleButton. -func (v *ToggleButton) native() *C.GtkToggleButton { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkToggleButton(p) -} - -func marshalToggleButton(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapToggleButton(obj), nil -} - -func wrapToggleButton(obj *glib.Object) *ToggleButton { - actionable := wrapActionable(obj) - return &ToggleButton{Button{Bin{Container{Widget{ - glib.InitiallyUnowned{obj}}}}, actionable}} -} - -// ToggleButtonNew is a wrapper around gtk_toggle_button_new(). -func ToggleButtonNew() (*ToggleButton, error) { - c := C.gtk_toggle_button_new() - if c == nil { - return nil, nilPtrErr - } - return wrapToggleButton(glib.Take(unsafe.Pointer(c))), nil -} - -// ToggleButtonNewWithLabel is a wrapper around -// gtk_toggle_button_new_with_label(). -func ToggleButtonNewWithLabel(label string) (*ToggleButton, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_toggle_button_new_with_label((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapToggleButton(glib.Take(unsafe.Pointer(c))), nil -} - -// ToggleButtonNewWithMnemonic is a wrapper around -// gtk_toggle_button_new_with_mnemonic(). -func ToggleButtonNewWithMnemonic(label string) (*ToggleButton, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_toggle_button_new_with_mnemonic((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapToggleButton(glib.Take(unsafe.Pointer(c))), nil -} - -// GetActive is a wrapper around gtk_toggle_button_get_active(). -func (v *ToggleButton) GetActive() bool { - c := C.gtk_toggle_button_get_active(v.native()) - return gobool(c) -} - -// SetActive is a wrapper around gtk_toggle_button_set_active(). -func (v *ToggleButton) SetActive(isActive bool) { - C.gtk_toggle_button_set_active(v.native(), gbool(isActive)) -} - -// GetMode is a wrapper around gtk_toggle_button_get_mode(). -func (v *ToggleButton) GetMode() bool { - c := C.gtk_toggle_button_get_mode(v.native()) - return gobool(c) -} - -// SetMode is a wrapper around gtk_toggle_button_set_mode(). -func (v *ToggleButton) SetMode(drawIndicator bool) { - C.gtk_toggle_button_set_mode(v.native(), gbool(drawIndicator)) -} - -/* - * GtkToolbar - */ - -// Toolbar is a representation of GTK's GtkToolbar. -type Toolbar struct { - Container -} - -// native returns a pointer to the underlying GtkToolbar. -func (v *Toolbar) native() *C.GtkToolbar { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkToolbar(p) -} - -func marshalToolbar(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapToolbar(obj), nil -} - -func wrapToolbar(obj *glib.Object) *Toolbar { - return &Toolbar{Container{Widget{glib.InitiallyUnowned{obj}}}} -} - -// ToolbarNew is a wrapper around gtk_toolbar_new(). -func ToolbarNew() (*Toolbar, error) { - c := C.gtk_toolbar_new() - if c == nil { - return nil, nilPtrErr - } - return wrapToolbar(glib.Take(unsafe.Pointer(c))), nil -} - -// Insert is a wrapper around gtk_toolbar_insert(). -func (v *Toolbar) Insert(item IToolItem, pos int) { - C.gtk_toolbar_insert(v.native(), item.toToolItem(), C.gint(pos)) -} - -// GetItemIndex is a wrapper around gtk_toolbar_get_item_index(). -func (v *Toolbar) GetItemIndex(item IToolItem) int { - c := C.gtk_toolbar_get_item_index(v.native(), item.toToolItem()) - return int(c) -} - -// GetNItems is a wrapper around gtk_toolbar_get_n_items(). -func (v *Toolbar) GetNItems() int { - c := C.gtk_toolbar_get_n_items(v.native()) - return int(c) -} - -// GetNthItem is a wrapper around gtk_toolbar_get_nth_item(). -func (v *Toolbar) GetNthItem(n int) *ToolItem { - c := C.gtk_toolbar_get_nth_item(v.native(), C.gint(n)) - if c == nil { - return nil - } - return wrapToolItem(glib.Take(unsafe.Pointer(c))) -} - -// GetDropIndex is a wrapper around gtk_toolbar_get_drop_index(). -func (v *Toolbar) GetDropIndex(x, y int) int { - c := C.gtk_toolbar_get_drop_index(v.native(), C.gint(x), C.gint(y)) - return int(c) -} - -// SetDropHighlightItem is a wrapper around -// gtk_toolbar_set_drop_highlight_item(). -func (v *Toolbar) SetDropHighlightItem(toolItem IToolItem, index int) { - C.gtk_toolbar_set_drop_highlight_item(v.native(), - toolItem.toToolItem(), C.gint(index)) -} - -// SetShowArrow is a wrapper around gtk_toolbar_set_show_arrow(). -func (v *Toolbar) SetShowArrow(showArrow bool) { - C.gtk_toolbar_set_show_arrow(v.native(), gbool(showArrow)) -} - -// UnsetIconSize is a wrapper around gtk_toolbar_unset_icon_size(). -func (v *Toolbar) UnsetIconSize() { - C.gtk_toolbar_unset_icon_size(v.native()) -} - -// GetShowArrow is a wrapper around gtk_toolbar_get_show_arrow(). -func (v *Toolbar) GetShowArrow() bool { - c := C.gtk_toolbar_get_show_arrow(v.native()) - return gobool(c) -} - -// GetStyle is a wrapper around gtk_toolbar_get_style(). -func (v *Toolbar) GetStyle() ToolbarStyle { - c := C.gtk_toolbar_get_style(v.native()) - return ToolbarStyle(c) -} - -// GetIconSize is a wrapper around gtk_toolbar_get_icon_size(). -func (v *Toolbar) GetIconSize() IconSize { - c := C.gtk_toolbar_get_icon_size(v.native()) - return IconSize(c) -} - -// GetReliefStyle is a wrapper around gtk_toolbar_get_relief_style(). -func (v *Toolbar) GetReliefStyle() ReliefStyle { - c := C.gtk_toolbar_get_relief_style(v.native()) - return ReliefStyle(c) -} - -// SetStyle is a wrapper around gtk_toolbar_set_style(). -func (v *Toolbar) SetStyle(style ToolbarStyle) { - C.gtk_toolbar_set_style(v.native(), C.GtkToolbarStyle(style)) -} - -// SetIconSize is a wrapper around gtk_toolbar_set_icon_size(). -func (v *Toolbar) SetIconSize(iconSize IconSize) { - C.gtk_toolbar_set_icon_size(v.native(), C.GtkIconSize(iconSize)) -} - -// UnsetStyle is a wrapper around gtk_toolbar_unset_style(). -func (v *Toolbar) UnsetStyle() { - C.gtk_toolbar_unset_style(v.native()) -} - -/* - * GtkToolButton - */ - -// ToolButton is a representation of GTK's GtkToolButton. -type ToolButton struct { - ToolItem -} - -// native returns a pointer to the underlying GtkToolButton. -func (v *ToolButton) native() *C.GtkToolButton { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkToolButton(p) -} - -func marshalToolButton(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapToolButton(obj), nil -} - -func wrapToolButton(obj *glib.Object) *ToolButton { - return &ToolButton{ToolItem{Bin{Container{Widget{ - glib.InitiallyUnowned{obj}}}}}} -} - -// ToolButtonNew is a wrapper around gtk_tool_button_new(). -func ToolButtonNew(iconWidget IWidget, label string) (*ToolButton, error) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - w := nullableWidget(iconWidget) - c := C.gtk_tool_button_new(w, (*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapToolButton(glib.Take(unsafe.Pointer(c))), nil -} - -// SetLabel is a wrapper around gtk_tool_button_set_label(). -func (v *ToolButton) SetLabel(label string) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_tool_button_set_label(v.native(), (*C.gchar)(cstr)) -} - -// GetLabel is a wrapper around gtk_tool_button_get_label(). -func (v *ToolButton) GetLabel() string { - c := C.gtk_tool_button_get_label(v.native()) - return goString(c) -} - -// SetUseUnderline is a wrapper around gtk_tool_button_set_use_underline(). -func (v *ToolButton) SetGetUnderline(useUnderline bool) { - C.gtk_tool_button_set_use_underline(v.native(), gbool(useUnderline)) -} - -// GetUseUnderline is a wrapper around gtk_tool_button_get_use_underline(). -func (v *ToolButton) GetuseUnderline() bool { - c := C.gtk_tool_button_get_use_underline(v.native()) - return gobool(c) -} - -// SetIconName is a wrapper around gtk_tool_button_set_icon_name(). -func (v *ToolButton) SetIconName(iconName string) { - cstr := C.CString(iconName) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_tool_button_set_icon_name(v.native(), (*C.gchar)(cstr)) -} - -// GetIconName is a wrapper around gtk_tool_button_get_icon_name(). -func (v *ToolButton) GetIconName() string { - c := C.gtk_tool_button_get_icon_name(v.native()) - return goString(c) -} - -// SetIconWidget is a wrapper around gtk_tool_button_set_icon_widget(). -func (v *ToolButton) SetIconWidget(iconWidget IWidget) { - C.gtk_tool_button_set_icon_widget(v.native(), iconWidget.toWidget()) -} - -// GetIconWidget is a wrapper around gtk_tool_button_get_icon_widget(). -func (v *ToolButton) GetIconWidget() *Widget { - c := C.gtk_tool_button_get_icon_widget(v.native()) - if c == nil { - return nil - } - return wrapWidget(glib.Take(unsafe.Pointer(c))) -} - -// SetLabelWidget is a wrapper around gtk_tool_button_set_label_widget(). -func (v *ToolButton) SetLabelWidget(labelWidget IWidget) { - C.gtk_tool_button_set_label_widget(v.native(), labelWidget.toWidget()) -} - -// GetLabelWidget is a wrapper around gtk_tool_button_get_label_widget(). -func (v *ToolButton) GetLabelWidget() *Widget { - c := C.gtk_tool_button_get_label_widget(v.native()) - if c == nil { - return nil - } - return wrapWidget(glib.Take(unsafe.Pointer(c))) -} - -/* - * GtkToolItem - */ - -// ToolItem is a representation of GTK's GtkToolItem. -type ToolItem struct { - Bin -} - -// IToolItem is an interface type implemented by all structs embedding -// a ToolItem. It is meant to be used as an argument type for wrapper -// functions that wrap around a C GTK function taking a GtkToolItem. -type IToolItem interface { - toToolItem() *C.GtkToolItem -} - -// native returns a pointer to the underlying GtkToolItem. -func (v *ToolItem) native() *C.GtkToolItem { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkToolItem(p) -} - -func (v *ToolItem) toToolItem() *C.GtkToolItem { - return v.native() -} - -func marshalToolItem(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapToolItem(obj), nil -} - -func wrapToolItem(obj *glib.Object) *ToolItem { - return &ToolItem{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// ToolItemNew is a wrapper around gtk_tool_item_new(). -func ToolItemNew() (*ToolItem, error) { - c := C.gtk_tool_item_new() - if c == nil { - return nil, nilPtrErr - } - return wrapToolItem(glib.Take(unsafe.Pointer(c))), nil -} - -// SetHomogeneous is a wrapper around gtk_tool_item_set_homogeneous(). -func (v *ToolItem) SetHomogeneous(homogeneous bool) { - C.gtk_tool_item_set_homogeneous(v.native(), gbool(homogeneous)) -} - -// GetHomogeneous is a wrapper around gtk_tool_item_get_homogeneous(). -func (v *ToolItem) GetHomogeneous() bool { - c := C.gtk_tool_item_get_homogeneous(v.native()) - return gobool(c) -} - -// SetExpand is a wrapper around gtk_tool_item_set_expand(). -func (v *ToolItem) SetExpand(expand bool) { - C.gtk_tool_item_set_expand(v.native(), gbool(expand)) -} - -// GetExpand is a wrapper around gtk_tool_item_get_expand(). -func (v *ToolItem) GetExpand() bool { - c := C.gtk_tool_item_get_expand(v.native()) - return gobool(c) -} - -// SetTooltipText is a wrapper around gtk_tool_item_set_tooltip_text(). -func (v *ToolItem) SetTooltipText(text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_tool_item_set_tooltip_text(v.native(), (*C.gchar)(cstr)) -} - -// SetTooltipMarkup is a wrapper around gtk_tool_item_set_tooltip_markup(). -func (v *ToolItem) SetTooltipMarkup(text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_tool_item_set_tooltip_markup(v.native(), (*C.gchar)(cstr)) -} - -// SetUseDragWindow is a wrapper around gtk_tool_item_set_use_drag_window(). -func (v *ToolItem) SetUseDragWindow(useDragWindow bool) { - C.gtk_tool_item_set_use_drag_window(v.native(), gbool(useDragWindow)) -} - -// GetUseDragWindow is a wrapper around gtk_tool_item_get_use_drag_window(). -func (v *ToolItem) GetUseDragWindow() bool { - c := C.gtk_tool_item_get_use_drag_window(v.native()) - return gobool(c) -} - -// SetVisibleHorizontal is a wrapper around -// gtk_tool_item_set_visible_horizontal(). -func (v *ToolItem) SetVisibleHorizontal(visibleHorizontal bool) { - C.gtk_tool_item_set_visible_horizontal(v.native(), - gbool(visibleHorizontal)) -} - -// GetVisibleHorizontal is a wrapper around -// gtk_tool_item_get_visible_horizontal(). -func (v *ToolItem) GetVisibleHorizontal() bool { - c := C.gtk_tool_item_get_visible_horizontal(v.native()) - return gobool(c) -} - -// SetVisibleVertical is a wrapper around gtk_tool_item_set_visible_vertical(). -func (v *ToolItem) SetVisibleVertical(visibleVertical bool) { - C.gtk_tool_item_set_visible_vertical(v.native(), gbool(visibleVertical)) -} - -// GetVisibleVertical is a wrapper around gtk_tool_item_get_visible_vertical(). -func (v *ToolItem) GetVisibleVertical() bool { - c := C.gtk_tool_item_get_visible_vertical(v.native()) - return gobool(c) -} - -// SetIsImportant is a wrapper around gtk_tool_item_set_is_important(). -func (v *ToolItem) SetIsImportant(isImportant bool) { - C.gtk_tool_item_set_is_important(v.native(), gbool(isImportant)) -} - -// GetIsImportant is a wrapper around gtk_tool_item_get_is_important(). -func (v *ToolItem) GetIsImportant() bool { - c := C.gtk_tool_item_get_is_important(v.native()) - return gobool(c) -} - -// TODO: gtk_tool_item_get_ellipsize_mode - -// GetIconSize is a wrapper around gtk_tool_item_get_icon_size(). -func (v *ToolItem) GetIconSize() IconSize { - c := C.gtk_tool_item_get_icon_size(v.native()) - return IconSize(c) -} - -// GetOrientation is a wrapper around gtk_tool_item_get_orientation(). -func (v *ToolItem) GetOrientation() Orientation { - c := C.gtk_tool_item_get_orientation(v.native()) - return Orientation(c) -} - -// GetToolbarStyle is a wrapper around gtk_tool_item_get_toolbar_style(). -func (v *ToolItem) gtk_tool_item_get_toolbar_style() ToolbarStyle { - c := C.gtk_tool_item_get_toolbar_style(v.native()) - return ToolbarStyle(c) -} - -// GetReliefStyle is a wrapper around gtk_tool_item_get_relief_style(). -func (v *ToolItem) GetReliefStyle() ReliefStyle { - c := C.gtk_tool_item_get_relief_style(v.native()) - return ReliefStyle(c) -} - -// GetTextAlignment is a wrapper around gtk_tool_item_get_text_alignment(). -func (v *ToolItem) GetTextAlignment() float32 { - c := C.gtk_tool_item_get_text_alignment(v.native()) - return float32(c) -} - -// GetTextOrientation is a wrapper around gtk_tool_item_get_text_orientation(). -func (v *ToolItem) GetTextOrientation() Orientation { - c := C.gtk_tool_item_get_text_orientation(v.native()) - return Orientation(c) -} - -// RetrieveProxyMenuItem is a wrapper around -// gtk_tool_item_retrieve_proxy_menu_item() -func (v *ToolItem) RetrieveProxyMenuItem() *MenuItem { - c := C.gtk_tool_item_retrieve_proxy_menu_item(v.native()) - if c == nil { - return nil - } - return wrapMenuItem(glib.Take(unsafe.Pointer(c))) -} - -// SetProxyMenuItem is a wrapper around gtk_tool_item_set_proxy_menu_item(). -func (v *ToolItem) SetProxyMenuItem(menuItemId string, menuItem IMenuItem) { - cstr := C.CString(menuItemId) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_tool_item_set_proxy_menu_item(v.native(), (*C.gchar)(cstr), - C.toGtkWidget(unsafe.Pointer(menuItem.toMenuItem()))) -} - -// RebuildMenu is a wrapper around gtk_tool_item_rebuild_menu(). -func (v *ToolItem) RebuildMenu() { - C.gtk_tool_item_rebuild_menu(v.native()) -} - -// ToolbarReconfigured is a wrapper around gtk_tool_item_toolbar_reconfigured(). -func (v *ToolItem) ToolbarReconfigured() { - C.gtk_tool_item_toolbar_reconfigured(v.native()) -} - -// TODO: gtk_tool_item_get_text_size_group - -/* - * GtkTreeIter - */ - -// TreeIter is a representation of GTK's GtkTreeIter. -type TreeIter struct { - GtkTreeIter C.GtkTreeIter -} - -// native returns a pointer to the underlying GtkTreeIter. -func (v *TreeIter) native() *C.GtkTreeIter { - if v == nil { - return nil - } - return &v.GtkTreeIter -} - -func marshalTreeIter(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - return (*TreeIter)(unsafe.Pointer(c)), nil -} - -func (v *TreeIter) free() { - C.gtk_tree_iter_free(v.native()) -} - -// Copy() is a wrapper around gtk_tree_iter_copy(). -func (v *TreeIter) Copy() (*TreeIter, error) { - c := C.gtk_tree_iter_copy(v.native()) - if c == nil { - return nil, nilPtrErr - } - t := &TreeIter{*c} - runtime.SetFinalizer(t, (*TreeIter).free) - return t, nil -} - -/* - * GtkTreeModel - */ - -// TreeModel is a representation of GTK's GtkTreeModel GInterface. -type TreeModel struct { - *glib.Object -} - -// ITreeModel is an interface type implemented by all structs -// embedding a TreeModel. It is meant to be used as an argument type -// for wrapper functions that wrap around a C GTK function taking a -// GtkTreeModel. -type ITreeModel interface { - toTreeModel() *C.GtkTreeModel -} - -// native returns a pointer to the underlying GObject as a GtkTreeModel. -func (v *TreeModel) native() *C.GtkTreeModel { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkTreeModel(p) -} - -func (v *TreeModel) toTreeModel() *C.GtkTreeModel { - if v == nil { - return nil - } - return v.native() -} - -func marshalTreeModel(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapTreeModel(obj), nil -} - -func wrapTreeModel(obj *glib.Object) *TreeModel { - return &TreeModel{obj} -} - -// GetFlags() is a wrapper around gtk_tree_model_get_flags(). -func (v *TreeModel) GetFlags() TreeModelFlags { - c := C.gtk_tree_model_get_flags(v.native()) - return TreeModelFlags(c) -} - -// GetNColumns() is a wrapper around gtk_tree_model_get_n_columns(). -func (v *TreeModel) GetNColumns() int { - c := C.gtk_tree_model_get_n_columns(v.native()) - return int(c) -} - -// GetColumnType() is a wrapper around gtk_tree_model_get_column_type(). -func (v *TreeModel) GetColumnType(index int) glib.Type { - c := C.gtk_tree_model_get_column_type(v.native(), C.gint(index)) - return glib.Type(c) -} - -// GetIter() is a wrapper around gtk_tree_model_get_iter(). -func (v *TreeModel) GetIter(path *TreePath) (*TreeIter, error) { - var iter C.GtkTreeIter - c := C.gtk_tree_model_get_iter(v.native(), &iter, path.native()) - if !gobool(c) { - return nil, errors.New("Unable to set iterator") - } - t := &TreeIter{iter} - return t, nil -} - -// GetIterFromString() is a wrapper around -// gtk_tree_model_get_iter_from_string(). -func (v *TreeModel) GetIterFromString(path string) (*TreeIter, error) { - var iter C.GtkTreeIter - cstr := C.CString(path) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_tree_model_get_iter_from_string(v.native(), &iter, - (*C.gchar)(cstr)) - if !gobool(c) { - return nil, errors.New("Unable to set iterator") - } - t := &TreeIter{iter} - return t, nil -} - -// GetIterFirst() is a wrapper around gtk_tree_model_get_iter_first(). -func (v *TreeModel) GetIterFirst() (*TreeIter, bool) { - var iter C.GtkTreeIter - c := C.gtk_tree_model_get_iter_first(v.native(), &iter) - if !gobool(c) { - return nil, false - } - t := &TreeIter{iter} - return t, true -} - -// GetPath() is a wrapper around gtk_tree_model_get_path(). -func (v *TreeModel) GetPath(iter *TreeIter) (*TreePath, error) { - c := C.gtk_tree_model_get_path(v.native(), iter.native()) - if c == nil { - return nil, nilPtrErr - } - p := &TreePath{c} - runtime.SetFinalizer(p, (*TreePath).free) - return p, nil -} - -// GetValue() is a wrapper around gtk_tree_model_get_value(). -func (v *TreeModel) GetValue(iter *TreeIter, column int) (*glib.Value, error) { - val, err := glib.ValueAlloc() - if err != nil { - return nil, err - } - C.gtk_tree_model_get_value( - (*C.GtkTreeModel)(unsafe.Pointer(v.native())), - iter.native(), - C.gint(column), - (*C.GValue)(unsafe.Pointer(val.Native()))) - return val, nil -} - -// IterHasChild() is a wrapper around gtk_tree_model_iter_has_child(). -func (v *TreeModel) IterHasChild(iter *TreeIter) bool { - c := C.gtk_tree_model_iter_has_child(v.native(), iter.native()) - return gobool(c) -} - -// IterNext() is a wrapper around gtk_tree_model_iter_next(). -func (v *TreeModel) IterNext(iter *TreeIter) bool { - c := C.gtk_tree_model_iter_next(v.native(), iter.native()) - return gobool(c) -} - -// IterPrevious is a wrapper around gtk_tree_model_iter_previous(). -func (v *TreeModel) IterPrevious(iter *TreeIter) bool { - c := C.gtk_tree_model_iter_previous(v.native(), iter.native()) - return gobool(c) -} - -// IterParent is a wrapper around gtk_tree_model_iter_parent(). -func (v *TreeModel) IterParent(iter, child *TreeIter) bool { - c := C.gtk_tree_model_iter_parent(v.native(), iter.native(), child.native()) - return gobool(c) -} - -// IterNthChild is a wrapper around gtk_tree_model_iter_nth_child(). -func (v *TreeModel) IterNthChild(iter *TreeIter, parent *TreeIter, n int) bool { - c := C.gtk_tree_model_iter_nth_child(v.native(), iter.native(), parent.native(), C.gint(n)) - return gobool(c) -} - -// IterChildren is a wrapper around gtk_tree_model_iter_children(). -func (v *TreeModel) IterChildren(iter, child *TreeIter) bool { - var cIter, cChild *C.GtkTreeIter - if iter != nil { - cIter = iter.native() - } - cChild = child.native() - c := C.gtk_tree_model_iter_children(v.native(), cChild, cIter) - return gobool(c) -} - -// IterNChildren is a wrapper around gtk_tree_model_iter_n_children(). -func (v *TreeModel) IterNChildren(iter *TreeIter) int { - var cIter *C.GtkTreeIter - if iter != nil { - cIter = iter.native() - } - c := C.gtk_tree_model_iter_n_children(v.native(), cIter) - return int(c) -} - -// FilterNew is a wrapper around gtk_tree_model_filter_new(). -func (v *TreeModel) FilterNew(root *TreePath) (*TreeModelFilter, error) { - c := C.gtk_tree_model_filter_new(v.native(), root.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapTreeModelFilter(obj), nil -} - -/* - * GtkTreeModelFilter - */ - -// TreeModelFilter is a representation of GTK's GtkTreeModelFilter. -type TreeModelFilter struct { - *glib.Object - - // Interfaces - TreeModel -} - -func (v *TreeModelFilter) native() *C.GtkTreeModelFilter { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkTreeModelFilter(p) -} - -func (v *TreeModelFilter) toTreeModelFilter() *C.GtkTreeModelFilter { - if v == nil { - return nil - } - return v.native() -} - -func marshalTreeModelFilter(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapTreeModelFilter(obj), nil -} - -func wrapTreeModelFilter(obj *glib.Object) *TreeModelFilter { - tm := wrapTreeModel(obj) - return &TreeModelFilter{obj, *tm} -} - -// SetVisibleColumn is a wrapper around gtk_tree_model_filter_set_visible_column(). -func (v *TreeModelFilter) SetVisibleColumn(column int) { - C.gtk_tree_model_filter_set_visible_column(v.native(), C.gint(column)) -} - -/* - * GtkTreePath - */ - -// TreePath is a representation of GTK's GtkTreePath. -type TreePath struct { - GtkTreePath *C.GtkTreePath -} - -// Return a TreePath from the GList -func TreePathFromList(list *glib.List) *TreePath { - if list == nil { - return nil - } - return &TreePath{(*C.GtkTreePath)(list.Data().(unsafe.Pointer))} -} - -// native returns a pointer to the underlying GtkTreePath. -func (v *TreePath) native() *C.GtkTreePath { - if v == nil { - return nil - } - return v.GtkTreePath -} - -func marshalTreePath(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - return &TreePath{(*C.GtkTreePath)(unsafe.Pointer(c))}, nil -} - -func (v *TreePath) free() { - C.gtk_tree_path_free(v.native()) -} - -// GetIndices is a wrapper around gtk_tree_path_get_indices_with_depth -func (v *TreePath) GetIndices() []int { - var depth C.gint - var goindices []int - var ginthelp C.gint - indices := uintptr(unsafe.Pointer(C.gtk_tree_path_get_indices_with_depth(v.native(), &depth))) - size := unsafe.Sizeof(ginthelp) - for i := 0; i < int(depth); i++ { - goind := int(*((*C.gint)(unsafe.Pointer(indices)))) - goindices = append(goindices, goind) - indices += size - } - return goindices -} - -// String is a wrapper around gtk_tree_path_to_string(). -func (v *TreePath) String() string { - c := C.gtk_tree_path_to_string(v.native()) - return goString(c) -} - -// TreePathNewFromString is a wrapper around gtk_tree_path_new_from_string(). -func TreePathNewFromString(path string) (*TreePath, error) { - cstr := C.CString(path) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_tree_path_new_from_string((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - t := &TreePath{c} - runtime.SetFinalizer(t, (*TreePath).free) - return t, nil -} - -/* - * GtkTreeSelection - */ - -// TreeSelection is a representation of GTK's GtkTreeSelection. -type TreeSelection struct { - *glib.Object -} - -// native returns a pointer to the underlying GtkTreeSelection. -func (v *TreeSelection) native() *C.GtkTreeSelection { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkTreeSelection(p) -} - -func marshalTreeSelection(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapTreeSelection(obj), nil -} - -func wrapTreeSelection(obj *glib.Object) *TreeSelection { - return &TreeSelection{obj} -} - -// GetSelected() is a wrapper around gtk_tree_selection_get_selected(). -func (v *TreeSelection) GetSelected() (model ITreeModel, iter *TreeIter, ok bool) { - var cmodel *C.GtkTreeModel - var citer C.GtkTreeIter - c := C.gtk_tree_selection_get_selected(v.native(), - &cmodel, &citer) - model = wrapTreeModel(glib.Take(unsafe.Pointer(cmodel))) - iter = &TreeIter{citer} - ok = gobool(c) - return -} - -// SelectPath is a wrapper around gtk_tree_selection_select_path(). -func (v *TreeSelection) SelectPath(path *TreePath) { - C.gtk_tree_selection_select_path(v.native(), path.native()) -} - -// UnselectPath is a wrapper around gtk_tree_selection_unselect_path(). -func (v *TreeSelection) UnselectPath(path *TreePath) { - C.gtk_tree_selection_unselect_path(v.native(), path.native()) -} - -// GetSelectedRows is a wrapper around gtk_tree_selection_get_selected_rows(). -// All the elements of returned list are wrapped into (*gtk.TreePath) values. -// -// Please note that a runtime finalizer is only set on the head of the linked -// list, and must be kept live while accessing any item in the list, or the -// Go garbage collector will free the whole list. -func (v *TreeSelection) GetSelectedRows(model ITreeModel) *glib.List { - var pcmodel **C.GtkTreeModel - if model != nil { - cmodel := model.toTreeModel() - pcmodel = &cmodel - } - - clist := C.gtk_tree_selection_get_selected_rows(v.native(), pcmodel) - if clist == nil { - return nil - } - - glist := glib.WrapList(uintptr(unsafe.Pointer(clist))) - glist.DataWrapper(func(ptr unsafe.Pointer) interface{} { - return &TreePath{(*C.GtkTreePath)(ptr)} - }) - runtime.SetFinalizer(glist, func(glist *glib.List) { - glist.FreeFull(func(item interface{}) { - path := item.(*TreePath) - C.gtk_tree_path_free(path.GtkTreePath) - }) - }) - - return glist -} - -// CountSelectedRows() is a wrapper around gtk_tree_selection_count_selected_rows(). -func (v *TreeSelection) CountSelectedRows() int { - return int(C.gtk_tree_selection_count_selected_rows(v.native())) -} - -// SelectIter is a wrapper around gtk_tree_selection_select_iter(). -func (v *TreeSelection) SelectIter(iter *TreeIter) { - C.gtk_tree_selection_select_iter(v.native(), iter.native()) -} - -// SetMode() is a wrapper around gtk_tree_selection_set_mode(). -func (v *TreeSelection) SetMode(m SelectionMode) { - C.gtk_tree_selection_set_mode(v.native(), C.GtkSelectionMode(m)) -} - -// GetMode() is a wrapper around gtk_tree_selection_get_mode(). -func (v *TreeSelection) GetMode() SelectionMode { - return SelectionMode(C.gtk_tree_selection_get_mode(v.native())) -} - -// SelectAll() is a wrapper around gtk_tree_selection_select_all() -func (v *TreeSelection) SelectAll() { - C.gtk_tree_selection_select_all(v.native()) -} - -// UnelectAll() is a wrapper around gtk_tree_selection_unselect_all() -func (v *TreeSelection) UnselectAll() { - C.gtk_tree_selection_unselect_all(v.native()) -} - -/* - * GtkTreeStore - */ - -// TreeStore is a representation of GTK's GtkTreeStore. -type TreeStore struct { - *glib.Object - - // Interfaces - TreeModel -} - -// native returns a pointer to the underlying GtkTreeStore. -func (v *TreeStore) native() *C.GtkTreeStore { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkTreeStore(p) -} - -func marshalTreeStore(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapTreeStore(obj), nil -} - -func wrapTreeStore(obj *glib.Object) *TreeStore { - tm := wrapTreeModel(obj) - return &TreeStore{obj, *tm} -} - -func (v *TreeStore) toTreeModel() *C.GtkTreeModel { - if v == nil { - return nil - } - return C.toGtkTreeModel(unsafe.Pointer(v.GObject)) -} - -// TreeStoreNew is a wrapper around gtk_tree_store_newv(). -func TreeStoreNew(types ...glib.Type) (*TreeStore, error) { - gtypes := C.alloc_types(C.int(len(types))) - for n, val := range types { - C.set_type(gtypes, C.int(n), C.GType(val)) - } - defer C.g_free(C.gpointer(gtypes)) - c := C.gtk_tree_store_newv(C.gint(len(types)), gtypes) - if c == nil { - return nil, nilPtrErr - } - - ts := wrapTreeStore(glib.Take(unsafe.Pointer(c))) - return ts, nil -} - -// Append is a wrapper around gtk_tree_store_append(). -func (v *TreeStore) Append(parent *TreeIter) *TreeIter { - var ti C.GtkTreeIter - var cParent *C.GtkTreeIter - if parent != nil { - cParent = parent.native() - } - C.gtk_tree_store_append(v.native(), &ti, cParent) - iter := &TreeIter{ti} - return iter -} - -// Insert is a wrapper around gtk_tree_store_insert -func (v *TreeStore) Insert(parent *TreeIter, position int) *TreeIter { - var ti C.GtkTreeIter - var cParent *C.GtkTreeIter - if parent != nil { - cParent = parent.native() - } - C.gtk_tree_store_insert(v.native(), &ti, cParent, C.gint(position)) - iter := &TreeIter{ti} - return iter -} - -// SetValue is a wrapper around gtk_tree_store_set_value() -func (v *TreeStore) SetValue(iter *TreeIter, column int, value interface{}) error { - switch value.(type) { - case *gdk.Pixbuf: - pix := value.(*gdk.Pixbuf) - C._gtk_tree_store_set(v.native(), iter.native(), C.gint(column), unsafe.Pointer(pix.Native())) - - default: - gv, err := glib.GValue(value) - if err != nil { - return err - } - C.gtk_tree_store_set_value(v.native(), iter.native(), - C.gint(column), - (*C.GValue)(C.gpointer(gv.Native()))) - } - return nil -} - -// Remove is a wrapper around gtk_tree_store_remove(). -func (v *TreeStore) Remove(iter *TreeIter) bool { - var ti *C.GtkTreeIter - if iter != nil { - ti = iter.native() - } - return 0 != C.gtk_tree_store_remove(v.native(), ti) -} - -// Clear is a wrapper around gtk_tree_store_clear(). -func (v *TreeStore) Clear() { - C.gtk_tree_store_clear(v.native()) -} - -/* - * GtkViewport - */ - -// Viewport is a representation of GTK's GtkViewport GInterface. -type Viewport struct { - Bin - - // Interfaces - Scrollable -} - -// IViewport is an interface type implemented by all structs -// embedding a Viewport. It is meant to be used as an argument type -// for wrapper functions that wrap around a C GTK function taking a -// GtkViewport. -type IViewport interface { - toViewport() *C.GtkViewport -} - -// native() returns a pointer to the underlying GObject as a GtkViewport. -func (v *Viewport) native() *C.GtkViewport { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkViewport(p) -} - -func wrapViewport(obj *glib.Object) *Viewport { - b := wrapBin(obj) - s := wrapScrollable(obj) - return &Viewport{ - Bin: *b, - Scrollable: *s, - } -} - -func (v *Viewport) toViewport() *C.GtkViewport { - if v == nil { - return nil - } - return v.native() -} - -// ViewportNew() is a wrapper around gtk_viewport_new(). -func ViewportNew(hadjustment, vadjustment *Adjustment) (*Viewport, error) { - c := C.gtk_viewport_new(hadjustment.native(), vadjustment.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapViewport(glib.Take(unsafe.Pointer(c))), nil -} - -func (v *Viewport) SetHAdjustment(adjustment *Adjustment) { - wrapScrollable(v.Object).SetHAdjustment(adjustment) -} - -func (v *Viewport) GetHAdjustment() (*Adjustment, error) { - return wrapScrollable(v.Object).GetHAdjustment() -} - -func (v *Viewport) SetVAdjustment(adjustment *Adjustment) { - wrapScrollable(v.Object).SetVAdjustment(adjustment) -} - -func (v *Viewport) GetVAdjustment() (*Adjustment, error) { - return wrapScrollable(v.Object).GetVAdjustment() -} - -/* - * GtkVolumeButton - */ - -// VolumeButton is a representation of GTK's GtkVolumeButton. -type VolumeButton struct { - ScaleButton -} - -// native() returns a pointer to the underlying GtkVolumeButton. -func (v *VolumeButton) native() *C.GtkVolumeButton { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkVolumeButton(p) -} - -func marshalVolumeButton(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapVolumeButton(obj), nil -} - -func wrapVolumeButton(obj *glib.Object) *VolumeButton { - actionable := wrapActionable(obj) - return &VolumeButton{ScaleButton{Button{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}, actionable}}} -} - -// VolumeButtonNew() is a wrapper around gtk_button_new(). -func VolumeButtonNew() (*VolumeButton, error) { - c := C.gtk_volume_button_new() - if c == nil { - return nil, nilPtrErr - } - return wrapVolumeButton(glib.Take(unsafe.Pointer(c))), nil -} - -type WrapFn interface{} - -var WrapMap = map[string]WrapFn{ - "GtkAccelGroup": wrapAccelGroup, - "GtkAccelMao": wrapAccelMap, - "GtkAdjustment": wrapAdjustment, - "GtkApplicationWindow": wrapApplicationWindow, - "GtkAssistant": wrapAssistant, - "GtkBin": wrapBin, - "GtkBox": wrapBox, - "GtkButton": wrapButton, - "GtkCalendar": wrapCalendar, - "GtkCellLayout": wrapCellLayout, - "GtkCellRenderer": wrapCellRenderer, - "GtkCellRendererSpinner": wrapCellRendererSpinner, - "GtkCellRendererPixbuf": wrapCellRendererPixbuf, - "GtkCellRendererText": wrapCellRendererText, - "GtkCellRendererToggle": wrapCellRendererToggle, - "GtkCheckButton": wrapCheckButton, - "GtkCheckMenuItem": wrapCheckMenuItem, - "GtkClipboard": wrapClipboard, - "GtkColorButton": wrapColorButton, - "GtkContainer": wrapContainer, - "GtkDialog": wrapDialog, - "GtkDrawingArea": wrapDrawingArea, - "GtkEditable": wrapEditable, - "GtkEntry": wrapEntry, - "GtkEntryBuffer": wrapEntryBuffer, - "GtkEntryCompletion": wrapEntryCompletion, - "GtkEventBox": wrapEventBox, - "GtkExpander": wrapExpander, - "GtkFrame": wrapFrame, - "GtkFileChooser": wrapFileChooser, - "GtkFileChooserButton": wrapFileChooserButton, - "GtkFileChooserDialog": wrapFileChooserDialog, - "GtkFileChooserWidget": wrapFileChooserWidget, - "GtkGrid": wrapGrid, - "GtkIconView": wrapIconView, - "GtkImage": wrapImage, - "GtkLabel": wrapLabel, - "GtkLayout": wrapLayout, - "GtkLinkButton": wrapLinkButton, - "GtkListStore": wrapListStore, - "GtkMenu": wrapMenu, - "GtkMenuBar": wrapMenuBar, - "GtkMenuButton": wrapMenuButton, - "GtkMenuItem": wrapMenuItem, - "GtkMenuShell": wrapMenuShell, - "GtkMessageDialog": wrapMessageDialog, - "GtkNotebook": wrapNotebook, - "GtkOffscreenWindow": wrapOffscreenWindow, - "GtkOrientable": wrapOrientable, - "GtkOverlay": wrapOverlay, - "GtkPaned": wrapPaned, - "GtkProgressBar": wrapProgressBar, - "GtkRadioButton": wrapRadioButton, - "GtkRadioMenuItem": wrapRadioMenuItem, - "GtkRange": wrapRange, - "GtkRecentChooser": wrapRecentChooser, - "GtkRecentChooserMenu": wrapRecentChooserMenu, - "GtkRecentFilter": wrapRecentFilter, - "GtkRecentManager": wrapRecentManager, - "GtkScaleButton": wrapScaleButton, - "GtkScale": wrapScale, - "GtkScrollable": wrapScrollable, - "GtkScrollbar": wrapScrollbar, - "GtkScrolledWindow": wrapScrolledWindow, - "GtkSearchEntry": wrapSearchEntry, - "GtkSeparator": wrapSeparator, - "GtkSeparatorMenuItem": wrapSeparatorMenuItem, - "GtkSeparatorToolItem": wrapSeparatorToolItem, - "GtkSpinButton": wrapSpinButton, - "GtkSpinner": wrapSpinner, - "GtkStatusbar": wrapStatusbar, - "GtkSwitch": wrapSwitch, - "GtkTextView": wrapTextView, - "GtkTextBuffer": wrapTextBuffer, - "GtkTextTag": wrapTextTag, - "GtkTextTagTable": wrapTextTagTable, - "GtkToggleButton": wrapToggleButton, - "GtkToolbar": wrapToolbar, - "GtkToolButton": wrapToolButton, - "GtkToolItem": wrapToolItem, - "GtkTreeModel": wrapTreeModel, - "GtkTreeModelFilter": wrapTreeModelFilter, - "GtkTreeSelection": wrapTreeSelection, - "GtkTreeStore": wrapTreeStore, - "GtkTreeView": wrapTreeView, - "GtkTreeViewColumn": wrapTreeViewColumn, - "GtkViewport": wrapViewport, - "GtkVolumeButton": wrapVolumeButton, - "GtkWidget": wrapWidget, - "GtkWindow": wrapWindow, -} - -// cast takes a native GObject and casts it to the appropriate Go struct. -//TODO change all wrapFns to return an IObject -func cast(c *C.GObject) (glib.IObject, error) { - var ( - className = goString(C.object_get_class_name(c)) - obj = glib.Take(unsafe.Pointer(c)) - ) - - fn, ok := WrapMap[className] - if !ok { - return nil, errors.New("unrecognized class name '" + className + "'") - } - - rf := reflect.ValueOf(fn) - if rf.Type().Kind() != reflect.Func { - return nil, errors.New("wraper is not a function") - } - - v := reflect.ValueOf(obj) - rv := rf.Call([]reflect.Value{v}) - - if len(rv) != 1 { - return nil, errors.New("wrapper did not return") - } - - if k := rv[0].Kind(); k != reflect.Ptr { - return nil, fmt.Errorf("wrong return type %s", k) - } - - ret, ok := rv[0].Interface().(glib.IObject) - if !ok { - return nil, errors.New("did not return an IObject") - } - - return ret, nil -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk.go.h b/vendor/github.com/gotk3/gotk3/gtk/gtk.go.h deleted file mode 100644 index 675e144..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk.go.h +++ /dev/null @@ -1,911 +0,0 @@ -/* - * Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> - * - * This file originated from: http://opensource.conformal.com/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#pragma once - -#include <stdint.h> -#include <stdlib.h> -#include <string.h> - -static GtkAboutDialog * -toGtkAboutDialog(void *p) -{ - return (GTK_ABOUT_DIALOG(p)); -} - -static GtkAppChooser * -toGtkAppChooser(void *p) -{ - return (GTK_APP_CHOOSER(p)); -} - -static GtkAppChooserButton * -toGtkAppChooserButton(void *p) -{ - return (GTK_APP_CHOOSER_BUTTON(p)); -} - -static GtkAppChooserDialog * -toGtkAppChooserDialog(void *p) -{ - return (GTK_APP_CHOOSER_DIALOG(p)); -} - -static GtkAppChooserWidget * -toGtkAppChooserWidget(void *p) -{ - return (GTK_APP_CHOOSER_WIDGET(p)); -} - -static GtkApplication * -toGtkApplication(void *p) -{ - return (GTK_APPLICATION(p)); -} - -static GtkApplicationWindow * -toGtkApplicationWindow(void *p) -{ - return (GTK_APPLICATION_WINDOW(p)); -} - -static GtkAssistant * -toGtkAssistant(void *p) -{ - return (GTK_ASSISTANT(p)); -} - -static GtkCalendar * -toGtkCalendar(void *p) -{ - return (GTK_CALENDAR(p)); -} - -static GtkColorChooserDialog * -toGtkColorChooserDialog(void *p) -{ - return (GTK_COLOR_CHOOSER_DIALOG(p)); -} - -static GtkDrawingArea * -toGtkDrawingArea(void *p) -{ - return (GTK_DRAWING_AREA(p)); -} - -static GtkCellRendererSpinner * -toGtkCellRendererSpinner(void *p) -{ - return (GTK_CELL_RENDERER_SPINNER(p)); -} - -static GtkEventBox * -toGtkEventBox(void *p) -{ - return (GTK_EVENT_BOX(p)); -} - -static GtkGrid * -toGtkGrid(void *p) -{ - return (GTK_GRID(p)); -} - -static GtkWidget * -toGtkWidget(void *p) -{ - return (GTK_WIDGET(p)); -} - -static GtkContainer * -toGtkContainer(void *p) -{ - return (GTK_CONTAINER(p)); -} - -static GtkOverlay * -toGtkOverlay(void *p) -{ - return (GTK_OVERLAY(p)); -} - -static GtkPageSetup * -toGtkPageSetup(void *p) -{ - return (GTK_PAGE_SETUP(p)); -} - -static GtkPaned * -toGtkPaned(void *p) -{ - return (GTK_PANED(p)); -} - -static GtkPrintContext * -toGtkPrintContext(void *p) -{ - return (GTK_PRINT_CONTEXT(p)); -} - -static GtkPrintOperation * -toGtkPrintOperation(void *p) -{ - return (GTK_PRINT_OPERATION(p)); -} - -static GtkPrintOperationPreview * -toGtkPrintOperationPreview(void *p) -{ - return (GTK_PRINT_OPERATION_PREVIEW(p)); -} - -static GtkPrintSettings * -toGtkPrintSettings(void *p) -{ - return (GTK_PRINT_SETTINGS(p)); -} - -static GtkProgressBar * -toGtkProgressBar(void *p) -{ - return (GTK_PROGRESS_BAR(p)); -} - -static GtkLevelBar * -toGtkLevelBar(void *p) -{ - return (GTK_LEVEL_BAR(p)); -} - -static GtkBin * -toGtkBin(void *p) -{ - return (GTK_BIN(p)); -} - -static GtkWindow * -toGtkWindow(void *p) -{ - return (GTK_WINDOW(p)); -} - -static GtkBox * -toGtkBox(void *p) -{ - return (GTK_BOX(p)); -} - -static GtkStatusbar * -toGtkStatusbar(void *p) -{ - return (GTK_STATUSBAR(p)); -} - -static GtkLabel * -toGtkLabel(void *p) -{ - return (GTK_LABEL(p)); -} - -static GtkNotebook * -toGtkNotebook(void *p) -{ - return (GTK_NOTEBOOK(p)); -} - -static GtkEntry * -toGtkEntry(void *p) -{ - return (GTK_ENTRY(p)); -} - -static GtkEntryBuffer * -toGtkEntryBuffer(void *p) -{ - return (GTK_ENTRY_BUFFER(p)); -} - -static GtkEntryCompletion * -toGtkEntryCompletion(void *p) -{ - return (GTK_ENTRY_COMPLETION(p)); -} - -static GtkAdjustment * -toGtkAdjustment(void *p) -{ - return (GTK_ADJUSTMENT(p)); -} - -static GtkAccelGroup * -toGtkAccelGroup(void *p) -{ - return (GTK_ACCEL_GROUP(p)); -} - -static GtkAccelMap * -toGtkAccelMap(void *p) -{ - return (GTK_ACCEL_MAP(p)); -} - -static GtkTextTag * -toGtkTextTag(void *p) -{ - return (GTK_TEXT_TAG(p)); -} - -static GtkIconView * -toGtkIconView(void *p) -{ - return (GTK_ICON_VIEW(p)); -} - -static GtkImage * -toGtkImage(void *p) -{ - return (GTK_IMAGE(p)); -} - -static GtkButton * -toGtkButton(void *p) -{ - return (GTK_BUTTON(p)); -} - -static GtkScaleButton * -toGtkScaleButton(void *p) -{ - return (GTK_SCALE_BUTTON(p)); -} - -static GtkColorButton * -toGtkColorButton(void *p) -{ - return (GTK_COLOR_BUTTON(p)); -} - -static GtkViewport * -toGtkViewport(void *p) -{ - return (GTK_VIEWPORT(p)); -} - -static GtkVolumeButton * -toGtkVolumeButton(void *p) -{ - return (GTK_VOLUME_BUTTON(p)); -} - -static GtkScrollable * -toGtkScrollable(void *p) -{ - return (GTK_SCROLLABLE(p)); -} - -static GtkScrolledWindow * -toGtkScrolledWindow(void *p) -{ - return (GTK_SCROLLED_WINDOW(p)); -} - -static GtkMenuItem * -toGtkMenuItem(void *p) -{ - return (GTK_MENU_ITEM(p)); -} - -static GtkMenu * -toGtkMenu(void *p) -{ - return (GTK_MENU(p)); -} - -static GtkMenuShell * -toGtkMenuShell(void *p) -{ - return (GTK_MENU_SHELL(p)); -} - -static GtkMenuBar * -toGtkMenuBar(void *p) -{ - return (GTK_MENU_BAR(p)); -} - -static GtkSizeGroup * -toGtkSizeGroup(void *p) -{ - return (GTK_SIZE_GROUP(p)); -} - -static GtkSpinButton * -toGtkSpinButton(void *p) -{ - return (GTK_SPIN_BUTTON(p)); -} - -static GtkSpinner * -toGtkSpinner(void *p) -{ - return (GTK_SPINNER(p)); -} - -static GtkComboBox * -toGtkComboBox(void *p) -{ - return (GTK_COMBO_BOX(p)); -} - -static GtkComboBoxText * -toGtkComboBoxText(void *p) -{ - return (GTK_COMBO_BOX_TEXT(p)); -} - -static GtkLinkButton * -toGtkLinkButton(void *p) -{ - return (GTK_LINK_BUTTON(p)); -} - -static GtkLayout * -toGtkLayout(void *p) -{ - return (GTK_LAYOUT(p)); -} - -static GtkListStore * -toGtkListStore(void *p) -{ - return (GTK_LIST_STORE(p)); -} - -static GtkSwitch * -toGtkSwitch(void *p) -{ - return (GTK_SWITCH(p)); -} - -static GtkTextView * -toGtkTextView(void *p) -{ - return (GTK_TEXT_VIEW(p)); -} - -static GtkTextTagTable * -toGtkTextTagTable(void *p) -{ - return (GTK_TEXT_TAG_TABLE(p)); -} - -static GtkTextBuffer * -toGtkTextBuffer(void *p) -{ - return (GTK_TEXT_BUFFER(p)); -} - -static GtkTreeModel * -toGtkTreeModel(void *p) -{ - return (GTK_TREE_MODEL(p)); -} - -static GtkTreeModelFilter * -toGtkTreeModelFilter(void *p) -{ - return (GTK_TREE_MODEL_FILTER(p)); -} - -static GtkCellRenderer * -toGtkCellRenderer(void *p) -{ - return (GTK_CELL_RENDERER(p)); -} - -static GtkCellRendererPixbuf * -toGtkCellRendererPixbuf(void *p) -{ - return (GTK_CELL_RENDERER_PIXBUF(p)); -} - -static GtkCellRendererText * -toGtkCellRendererText(void *p) -{ - return (GTK_CELL_RENDERER_TEXT(p)); -} - -static GtkCellRendererToggle * -toGtkCellRendererToggle(void *p) -{ - return (GTK_CELL_RENDERER_TOGGLE(p)); -} - -static GtkCellLayout * -toGtkCellLayout(void *p) -{ - return (GTK_CELL_LAYOUT(p)); -} - -static GtkOrientable * -toGtkOrientable(void *p) -{ - return (GTK_ORIENTABLE(p)); -} - -static GtkTreeStore * -toGtkTreeStore (void *p) -{ - return (GTK_TREE_STORE(p)); -} - -static GtkTreeView * -toGtkTreeView(void *p) -{ - return (GTK_TREE_VIEW(p)); -} - -static GtkTreeViewColumn * -toGtkTreeViewColumn(void *p) -{ - return (GTK_TREE_VIEW_COLUMN(p)); -} - -static GtkTreeSelection * -toGtkTreeSelection(void *p) -{ - return (GTK_TREE_SELECTION(p)); -} - -static GtkTreeSortable * -toGtkTreeSortable(void *p) -{ - return (GTK_TREE_SORTABLE(p)); -} - -static GtkClipboard * -toGtkClipboard(void *p) -{ - return (GTK_CLIPBOARD(p)); -} - -static GtkDialog * -toGtkDialog(void *p) -{ - return (GTK_DIALOG(p)); -} - -static GtkMessageDialog * -toGtkMessageDialog(void *p) -{ - return (GTK_MESSAGE_DIALOG(p)); -} - -static GtkBuilder * -toGtkBuilder(void *p) -{ - return (GTK_BUILDER(p)); -} - -static GtkSeparatorMenuItem * -toGtkSeparatorMenuItem(void *p) -{ - return (GTK_SEPARATOR_MENU_ITEM(p)); -} - -static GtkCheckButton * -toGtkCheckButton(void *p) -{ - return (GTK_CHECK_BUTTON(p)); -} - -static GtkToggleButton * -toGtkToggleButton(void *p) -{ - return (GTK_TOGGLE_BUTTON(p)); -} - -static GtkFontButton * -toGtkFontButton(void *p) -{ - return (GTK_FONT_BUTTON(p)); -} - -static GtkFrame * -toGtkFrame(void *p) -{ - return (GTK_FRAME(p)); -} - -static GtkAspectFrame * -toGtkAspectFrame(void *p) -{ - return (GTK_ASPECT_FRAME(p)); -} - -static GtkSeparator * -toGtkSeparator(void *p) -{ - return (GTK_SEPARATOR(p)); -} - -static GtkScale* -toGtkScale(void *p) -{ - return (GTK_SCALE(p)); -} - -static GtkScrollbar * -toGtkScrollbar(void *p) -{ - return (GTK_SCROLLBAR(p)); -} - -static GtkRange * -toGtkRange(void *p) -{ - return (GTK_RANGE(p)); -} - -static GtkSearchEntry * -toGtkSearchEntry(void *p) -{ - return (GTK_SEARCH_ENTRY(p)); -} - -static GtkOffscreenWindow * -toGtkOffscreenWindow(void *p) -{ - return (GTK_OFFSCREEN_WINDOW(p)); -} - -static GtkExpander * -toGtkExpander(void *p) -{ - return (GTK_EXPANDER(p)); -} - -static GtkFileChooser * -toGtkFileChooser(void *p) -{ - return (GTK_FILE_CHOOSER(p)); -} - -static GtkFileChooserButton * -toGtkFileChooserButton(void *p) -{ - return (GTK_FILE_CHOOSER_BUTTON(p)); -} - -static GtkFileChooserDialog * -toGtkFileChooserDialog(void *p) -{ - return (GTK_FILE_CHOOSER_DIALOG(p)); -} - -static GtkFileChooserWidget * -toGtkFileChooserWidget(void *p) -{ - return (GTK_FILE_CHOOSER_WIDGET(p)); -} - -static GtkFileFilter * -toGtkFileFilter(void *p) -{ - return (GTK_FILE_FILTER(p)); -} - -static GtkMenuButton * -toGtkMenuButton(void *p) -{ - return (GTK_MENU_BUTTON(p)); -} - -static GtkRadioButton * -toGtkRadioButton(void *p) -{ - return (GTK_RADIO_BUTTON(p)); -} - -static GtkRecentChooser * -toGtkRecentChooser(void *p) -{ - return (GTK_RECENT_CHOOSER(p)); -} - -static GtkRecentChooserMenu * -toGtkRecentChooserMenu(void *p) -{ - return (GTK_RECENT_CHOOSER_MENU(p)); -} - -static GtkColorChooser * -toGtkColorChooser(void *p) -{ - return (GTK_COLOR_CHOOSER(p)); -} - -static GtkFontChooser * -toGtkFontChooser(void *p) -{ - return (GTK_FONT_CHOOSER(p)); -} - -static GtkRecentFilter * -toGtkRecentFilter(void *p) -{ - return (GTK_RECENT_FILTER(p)); -} - -static GtkRecentManager * -toGtkRecentManager(void *p) -{ - return (GTK_RECENT_MANAGER(p)); -} - -static GtkCheckMenuItem * -toGtkCheckMenuItem(void *p) -{ - return (GTK_CHECK_MENU_ITEM(p)); -} - -static GtkRadioMenuItem * -toGtkRadioMenuItem(void *p) -{ - return (GTK_RADIO_MENU_ITEM(p)); -} - -static GtkToolItem * -toGtkToolItem(void *p) -{ - return (GTK_TOOL_ITEM(p)); -} - -static GtkToolbar * -toGtkToolbar(void *p) -{ - return (GTK_TOOLBAR(p)); -} - -static GtkTooltip * -toGtkTooltip(void *p) -{ - return (GTK_TOOLTIP(p)); -} - -static GtkEditable * -toGtkEditable(void *p) -{ - return (GTK_EDITABLE(p)); -} - -static GtkToolButton * -toGtkToolButton(void *p) -{ - return (GTK_TOOL_BUTTON(p)); -} - -static GtkSeparatorToolItem * -toGtkSeparatorToolItem(void *p) -{ - return (GTK_SEPARATOR_TOOL_ITEM(p)); -} - -static GtkCssProvider * -toGtkCssProvider(void *p) -{ - return (GTK_CSS_PROVIDER(p)); -} - -static GtkStyleContext * -toGtkStyleContext(void *p) -{ - return (GTK_STYLE_CONTEXT(p)); -} - -static GtkStyleProvider * -toGtkStyleProvider(void *p) -{ - return (GTK_STYLE_PROVIDER(p)); -} - -static GtkInfoBar * -toGtkInfoBar(void *p) -{ - return (GTK_INFO_BAR(p)); -} - -static GMenuModel * -toGMenuModel(void *p) -{ - return (G_MENU_MODEL(p)); -} - -static GActionGroup * -toGActionGroup(void *p) -{ - return (G_ACTION_GROUP(p)); -} - -static GdkPixbuf * -toGdkPixbuf(void *p) -{ - return (GDK_PIXBUF(p)); -} - -static GType * -alloc_types(int n) { - return ((GType *)g_new0(GType, n)); -} - -static void -set_type(GType *types, int n, GType t) -{ - types[n] = t; -} - -static GtkTreeViewColumn * -_gtk_tree_view_column_new_with_attributes_one(const gchar *title, - GtkCellRenderer *renderer, const gchar *attribute, gint column) -{ - GtkTreeViewColumn *tvc; - - tvc = gtk_tree_view_column_new_with_attributes(title, renderer, - attribute, column, NULL); - return (tvc); -} - -static void -_gtk_list_store_set(GtkListStore *list_store, GtkTreeIter *iter, gint column, - void* value) -{ - gtk_list_store_set(list_store, iter, column, value, -1); -} - -static void -_gtk_tree_store_set(GtkTreeStore *store, GtkTreeIter *iter, gint column, - void* value) -{ - gtk_tree_store_set(store, iter, column, value, -1); -} - -extern gboolean substring_match_equal_func(GtkTreeModel *model, - gint column, - gchar *key, - GtkTreeIter *iter, - gpointer data); - -static GtkWidget * -_gtk_message_dialog_new(GtkWindow *parent, GtkDialogFlags flags, - GtkMessageType type, GtkButtonsType buttons, char *msg) -{ - GtkWidget *w; - - w = gtk_message_dialog_new(parent, flags, type, buttons, "%s", msg); - return (w); -} - -static GtkWidget * -_gtk_message_dialog_new_with_markup(GtkWindow *parent, GtkDialogFlags flags, - GtkMessageType type, GtkButtonsType buttons, char *msg) -{ - GtkWidget *w; - - w = gtk_message_dialog_new_with_markup(parent, flags, type, buttons, - "%s", msg); - return (w); -} - -static void -_gtk_message_dialog_format_secondary_text(GtkMessageDialog *message_dialog, - const gchar *msg) -{ - gtk_message_dialog_format_secondary_text(message_dialog, "%s", msg); -} - -static void -_gtk_message_dialog_format_secondary_markup(GtkMessageDialog *message_dialog, - const gchar *msg) -{ - gtk_message_dialog_format_secondary_markup(message_dialog, "%s", msg); -} - -static const gchar * -object_get_class_name(GObject *object) -{ - return G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(object)); -} - -static GtkWidget * -gtk_file_chooser_dialog_new_1( - const gchar *title, - GtkWindow *parent, - GtkFileChooserAction action, - const gchar *first_button_text, int first_button_id -) { - return gtk_file_chooser_dialog_new( - title, parent, action, - first_button_text, first_button_id, - NULL); -} - -static GtkWidget * -gtk_file_chooser_dialog_new_2( - const gchar *title, - GtkWindow *parent, - GtkFileChooserAction action, - const gchar *first_button_text, int first_button_id, - const gchar *second_button_text, int second_button_id -) { - return gtk_file_chooser_dialog_new( - title, parent, action, - first_button_text, first_button_id, - second_button_text, second_button_id, - NULL); -} - -static void _gtk_widget_hide_on_delete(GtkWidget* w) { - g_signal_connect(GTK_WIDGET(w), "delete-event", G_CALLBACK(gtk_widget_hide_on_delete), NULL); -} - -static inline gchar** make_strings(int count) { - return (gchar**)malloc(sizeof(gchar*) * count); -} - -static inline void destroy_strings(gchar** strings) { - free(strings); -} - -static inline gchar* get_string(gchar** strings, int n) { - return strings[n]; -} - -static inline void set_string(gchar** strings, int n, gchar* str) { - strings[n] = str; -} - -static inline gchar** next_gcharptr(gchar** s) { return (s+1); } - -extern void goBuilderConnect (GtkBuilder *builder, - GObject *object, - gchar *signal_name, - gchar *handler_name, - GObject *connect_object, - GConnectFlags flags, - gpointer user_data); - -static inline void _gtk_builder_connect_signals_full(GtkBuilder *builder) { - gtk_builder_connect_signals_full(builder, (GtkBuilderConnectFunc)(goBuilderConnect), NULL); -} - -extern void goPrintSettings (gchar *key, - gchar *value, - gpointer user_data); - -static inline void _gtk_print_settings_foreach(GtkPrintSettings *ps, gpointer user_data) { - gtk_print_settings_foreach(ps, (GtkPrintSettingsFunc)(goPrintSettings), user_data); -} - -extern void goPageSetupDone (GtkPageSetup *setup, - gpointer data); - -static inline void _gtk_print_run_page_setup_dialog_async(GtkWindow *parent, GtkPageSetup *setup, - GtkPrintSettings *settings, gpointer data) { - gtk_print_run_page_setup_dialog_async(parent, setup, settings, - (GtkPageSetupDoneFunc)(goPageSetupDone), data); -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_10.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_10.go deleted file mode 100644 index 0a5fc68..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_10.go +++ /dev/null @@ -1,244 +0,0 @@ -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// This file includes wrapers for symbols deprecated beginning with GTK 3.10, -// and should only be included in a build targeted intended to target GTK -// 3.8 or earlier. To target an earlier build build, use the build tag -// gtk_MAJOR_MINOR. For example, to target GTK 3.8, run -// 'go build -tags gtk_3_8'. -// +build gtk_3_6 gtk_3_8 - -package gtk - -// #include <stdlib.h> -// #include <gtk/gtk.h> -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -// ButtonNewFromStock is a wrapper around gtk_button_new_from_stock(). -func ButtonNewFromStock(stock Stock) (*Button, error) { - cstr := C.CString(string(stock)) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_button_new_from_stock((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapButton(glib.Take(unsafe.Pointer(c))), nil -} - -// SetUseStock is a wrapper around gtk_button_set_use_stock(). -func (v *Button) SetUseStock(useStock bool) { - C.gtk_button_set_use_stock(v.native(), gbool(useStock)) -} - -// GetUseStock is a wrapper around gtk_button_get_use_stock(). -func (v *Button) GetUseStock() bool { - c := C.gtk_button_get_use_stock(v.native()) - return gobool(c) -} - -// GetIconStock is a wrapper around gtk_entry_get_icon_stock(). -func (v *Entry) GetIconStock(iconPos EntryIconPosition) (string, error) { - c := C.gtk_entry_get_icon_stock(v.native(), - C.GtkEntryIconPosition(iconPos)) - if c == nil { - return "", nilPtrErr - } - return C.GoString((*C.char)(c)), nil -} - -// SetIconFromStock is a wrapper around gtk_entry_set_icon_from_stock(). -func (v *Entry) SetIconFromStock(iconPos EntryIconPosition, stockID string) { - cstr := C.CString(stockID) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_entry_set_icon_from_stock(v.native(), - C.GtkEntryIconPosition(iconPos), (*C.gchar)(cstr)) -} - -// ImageNewFromStock is a wrapper around gtk_image_new_from_stock(). -func ImageNewFromStock(stock Stock, size IconSize) (*Image, error) { - cstr := C.CString(string(stock)) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_image_new_from_stock((*C.gchar)(cstr), C.GtkIconSize(size)) - if c == nil { - return nil, nilPtrErr - } - return wrapImage(glib.Take(unsafe.Pointer(c))), nil -} - -// SetFromStock is a wrapper around gtk_image_set_from_stock(). -func (v *Image) SetFromStock(stock Stock, size IconSize) { - cstr := C.CString(string(stock)) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_image_set_from_stock(v.native(), (*C.gchar)(cstr), - C.GtkIconSize(size)) -} - -// StatusIconNewFromStock is a wrapper around gtk_status_icon_new_from_stock(). -// Deprecated since 3.10, use StatusIconNewFromIconName (gtk_status_icon_new_from_icon_name) instead. -func StatusIconNewFromStock(stockId string) (*StatusIcon, error) { - cstr := C.CString(stockId) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_status_icon_new_from_file((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapStatusIcon(obj), nil -} - -// SetFromStock is a wrapper around gtk_status_icon_set_from_stock() -// Deprecated since 3.10, use SetFromIconName (gtk_status_icon_set_from_icon_name) instead. -func (v *StatusIcon) SetFromStock(stockID string) { - cstr := C.CString(stockID) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_status_icon_set_from_stock(v.native(), (*C.gchar)(cstr)) -} - -// GetStock is a wrapper around gtk_status_icon_get_stock() -// Deprecated since 3.10, use GetIconName (gtk_status_icon_get_icon_name) instead -func (v *StatusIcon) GetStock() string { - c := C.gtk_status_icon_get_stock(v.native()) - if c == nil { - return "" - } - return C.GoString((*C.char)(c)) -} - -// Stock is a special type that does not have an equivalent type in -// GTK. It is the type used as a parameter anytime an identifier for -// stock icons are needed. A Stock must be type converted to string when -// function parameters may take a Stock, but when other string values are -// valid as well. -type Stock string - -const ( - STOCK_ABOUT Stock = C.GTK_STOCK_ABOUT - STOCK_ADD Stock = C.GTK_STOCK_ADD - STOCK_APPLY Stock = C.GTK_STOCK_APPLY - STOCK_BOLD Stock = C.GTK_STOCK_BOLD - STOCK_CANCEL Stock = C.GTK_STOCK_CANCEL - STOCK_CAPS_LOCK_WARNING Stock = C.GTK_STOCK_CAPS_LOCK_WARNING - STOCK_CDROM Stock = C.GTK_STOCK_CDROM - STOCK_CLEAR Stock = C.GTK_STOCK_CLEAR - STOCK_CLOSE Stock = C.GTK_STOCK_CLOSE - STOCK_COLOR_PICKER Stock = C.GTK_STOCK_COLOR_PICKER - STOCK_CONNECT Stock = C.GTK_STOCK_CONNECT - STOCK_CONVERT Stock = C.GTK_STOCK_CONVERT - STOCK_COPY Stock = C.GTK_STOCK_COPY - STOCK_CUT Stock = C.GTK_STOCK_CUT - STOCK_DELETE Stock = C.GTK_STOCK_DELETE - STOCK_DIALOG_AUTHENTICATION Stock = C.GTK_STOCK_DIALOG_AUTHENTICATION - STOCK_DIALOG_INFO Stock = C.GTK_STOCK_DIALOG_INFO - STOCK_DIALOG_WARNING Stock = C.GTK_STOCK_DIALOG_WARNING - STOCK_DIALOG_ERROR Stock = C.GTK_STOCK_DIALOG_ERROR - STOCK_DIALOG_QUESTION Stock = C.GTK_STOCK_DIALOG_QUESTION - STOCK_DIRECTORY Stock = C.GTK_STOCK_DIRECTORY - STOCK_DISCARD Stock = C.GTK_STOCK_DISCARD - STOCK_DISCONNECT Stock = C.GTK_STOCK_DISCONNECT - STOCK_DND Stock = C.GTK_STOCK_DND - STOCK_DND_MULTIPLE Stock = C.GTK_STOCK_DND_MULTIPLE - STOCK_EDIT Stock = C.GTK_STOCK_EDIT - STOCK_EXECUTE Stock = C.GTK_STOCK_EXECUTE - STOCK_FILE Stock = C.GTK_STOCK_FILE - STOCK_FIND Stock = C.GTK_STOCK_FIND - STOCK_FIND_AND_REPLACE Stock = C.GTK_STOCK_FIND_AND_REPLACE - STOCK_FLOPPY Stock = C.GTK_STOCK_FLOPPY - STOCK_FULLSCREEN Stock = C.GTK_STOCK_FULLSCREEN - STOCK_GOTO_BOTTOM Stock = C.GTK_STOCK_GOTO_BOTTOM - STOCK_GOTO_FIRST Stock = C.GTK_STOCK_GOTO_FIRST - STOCK_GOTO_LAST Stock = C.GTK_STOCK_GOTO_LAST - STOCK_GOTO_TOP Stock = C.GTK_STOCK_GOTO_TOP - STOCK_GO_BACK Stock = C.GTK_STOCK_GO_BACK - STOCK_GO_DOWN Stock = C.GTK_STOCK_GO_DOWN - STOCK_GO_FORWARD Stock = C.GTK_STOCK_GO_FORWARD - STOCK_GO_UP Stock = C.GTK_STOCK_GO_UP - STOCK_HARDDISK Stock = C.GTK_STOCK_HARDDISK - STOCK_HELP Stock = C.GTK_STOCK_HELP - STOCK_HOME Stock = C.GTK_STOCK_HOME - STOCK_INDEX Stock = C.GTK_STOCK_INDEX - STOCK_INDENT Stock = C.GTK_STOCK_INDENT - STOCK_INFO Stock = C.GTK_STOCK_INFO - STOCK_ITALIC Stock = C.GTK_STOCK_ITALIC - STOCK_JUMP_TO Stock = C.GTK_STOCK_JUMP_TO - STOCK_JUSTIFY_CENTER Stock = C.GTK_STOCK_JUSTIFY_CENTER - STOCK_JUSTIFY_FILL Stock = C.GTK_STOCK_JUSTIFY_FILL - STOCK_JUSTIFY_LEFT Stock = C.GTK_STOCK_JUSTIFY_LEFT - STOCK_JUSTIFY_RIGHT Stock = C.GTK_STOCK_JUSTIFY_RIGHT - STOCK_LEAVE_FULLSCREEN Stock = C.GTK_STOCK_LEAVE_FULLSCREEN - STOCK_MISSING_IMAGE Stock = C.GTK_STOCK_MISSING_IMAGE - STOCK_MEDIA_FORWARD Stock = C.GTK_STOCK_MEDIA_FORWARD - STOCK_MEDIA_NEXT Stock = C.GTK_STOCK_MEDIA_NEXT - STOCK_MEDIA_PAUSE Stock = C.GTK_STOCK_MEDIA_PAUSE - STOCK_MEDIA_PLAY Stock = C.GTK_STOCK_MEDIA_PLAY - STOCK_MEDIA_PREVIOUS Stock = C.GTK_STOCK_MEDIA_PREVIOUS - STOCK_MEDIA_RECORD Stock = C.GTK_STOCK_MEDIA_RECORD - STOCK_MEDIA_REWIND Stock = C.GTK_STOCK_MEDIA_REWIND - STOCK_MEDIA_STOP Stock = C.GTK_STOCK_MEDIA_STOP - STOCK_NETWORK Stock = C.GTK_STOCK_NETWORK - STOCK_NEW Stock = C.GTK_STOCK_NEW - STOCK_NO Stock = C.GTK_STOCK_NO - STOCK_OK Stock = C.GTK_STOCK_OK - STOCK_OPEN Stock = C.GTK_STOCK_OPEN - STOCK_ORIENTATION_PORTRAIT Stock = C.GTK_STOCK_ORIENTATION_PORTRAIT - STOCK_ORIENTATION_LANDSCAPE Stock = C.GTK_STOCK_ORIENTATION_LANDSCAPE - STOCK_ORIENTATION_REVERSE_LANDSCAPE Stock = C.GTK_STOCK_ORIENTATION_REVERSE_LANDSCAPE - STOCK_ORIENTATION_REVERSE_PORTRAIT Stock = C.GTK_STOCK_ORIENTATION_REVERSE_PORTRAIT - STOCK_PAGE_SETUP Stock = C.GTK_STOCK_PAGE_SETUP - STOCK_PASTE Stock = C.GTK_STOCK_PASTE - STOCK_PREFERENCES Stock = C.GTK_STOCK_PREFERENCES - STOCK_PRINT Stock = C.GTK_STOCK_PRINT - STOCK_PRINT_ERROR Stock = C.GTK_STOCK_PRINT_ERROR - STOCK_PRINT_PAUSED Stock = C.GTK_STOCK_PRINT_PAUSED - STOCK_PRINT_PREVIEW Stock = C.GTK_STOCK_PRINT_PREVIEW - STOCK_PRINT_REPORT Stock = C.GTK_STOCK_PRINT_REPORT - STOCK_PRINT_WARNING Stock = C.GTK_STOCK_PRINT_WARNING - STOCK_PROPERTIES Stock = C.GTK_STOCK_PROPERTIES - STOCK_QUIT Stock = C.GTK_STOCK_QUIT - STOCK_REDO Stock = C.GTK_STOCK_REDO - STOCK_REFRESH Stock = C.GTK_STOCK_REFRESH - STOCK_REMOVE Stock = C.GTK_STOCK_REMOVE - STOCK_REVERT_TO_SAVED Stock = C.GTK_STOCK_REVERT_TO_SAVED - STOCK_SAVE Stock = C.GTK_STOCK_SAVE - STOCK_SAVE_AS Stock = C.GTK_STOCK_SAVE_AS - STOCK_SELECT_ALL Stock = C.GTK_STOCK_SELECT_ALL - STOCK_SELECT_COLOR Stock = C.GTK_STOCK_SELECT_COLOR - STOCK_SELECT_FONT Stock = C.GTK_STOCK_SELECT_FONT - STOCK_SORT_ASCENDING Stock = C.GTK_STOCK_SORT_ASCENDING - STOCK_SORT_DESCENDING Stock = C.GTK_STOCK_SORT_DESCENDING - STOCK_SPELL_CHECK Stock = C.GTK_STOCK_SPELL_CHECK - STOCK_STOP Stock = C.GTK_STOCK_STOP - STOCK_STRIKETHROUGH Stock = C.GTK_STOCK_STRIKETHROUGH - STOCK_UNDELETE Stock = C.GTK_STOCK_UNDELETE - STOCK_UNDERLINE Stock = C.GTK_STOCK_UNDERLINE - STOCK_UNDO Stock = C.GTK_STOCK_UNDO - STOCK_UNINDENT Stock = C.GTK_STOCK_UNINDENT - STOCK_YES Stock = C.GTK_STOCK_YES - STOCK_ZOOM_100 Stock = C.GTK_STOCK_ZOOM_100 - STOCK_ZOOM_FIT Stock = C.GTK_STOCK_ZOOM_FIT - STOCK_ZOOM_IN Stock = C.GTK_STOCK_ZOOM_IN - STOCK_ZOOM_OUT Stock = C.GTK_STOCK_ZOOM_OUT -) - -// ReshowWithInitialSize is a wrapper around -// gtk_window_reshow_with_initial_size(). -func (v *Window) ReshowWithInitialSize() { - C.gtk_window_reshow_with_initial_size(v.native()) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_12.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_12.go deleted file mode 100644 index 204b04b..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_12.go +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// This file includes wrapers for symbols deprecated beginning with GTK 3.12, -// and should only be included in a build targeted intended to target GTK -// 3.10 or earlier. To target an earlier build build, use the build tag -// gtk_MAJOR_MINOR. For example, to target GTK 3.8, run -// 'go build -tags gtk_3_8'. -// +build gtk_3_6 gtk_3_8 gtk_3_10 - -package gtk - -// #include <gtk/gtk.h> -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -/* - * GtkDialog - */ - -// GetActionArea() is a wrapper around gtk_dialog_get_action_area(). -func (v *Dialog) GetActionArea() (*Widget, error) { - c := C.gtk_dialog_get_action_area(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -/* - * GtkMessageDialog - */ - -// GetImage is a wrapper around gtk_message_dialog_get_image(). -func (v *MessageDialog) GetImage() (*Widget, error) { - c := C.gtk_message_dialog_get_image(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -// SetImage is a wrapper around gtk_message_dialog_set_image(). -func (v *MessageDialog) SetImage(image IWidget) { - C.gtk_message_dialog_set_image(v.native(), image.toWidget()) -} - -/* - * GtkWidget - */ - -// GetMarginLeft is a wrapper around gtk_widget_get_margin_left(). -func (v *Widget) GetMarginLeft() int { - c := C.gtk_widget_get_margin_left(v.native()) - return int(c) -} - -// SetMarginLeft is a wrapper around gtk_widget_set_margin_left(). -func (v *Widget) SetMarginLeft(margin int) { - C.gtk_widget_set_margin_left(v.native(), C.gint(margin)) -} - -// GetMarginRight is a wrapper around gtk_widget_get_margin_right(). -func (v *Widget) GetMarginRight() int { - c := C.gtk_widget_get_margin_right(v.native()) - return int(c) -} - -// SetMarginRight is a wrapper around gtk_widget_set_margin_right(). -func (v *Widget) SetMarginRight(margin int) { - C.gtk_widget_set_margin_right(v.native(), C.gint(margin)) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_14.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_14.go deleted file mode 100644 index f30f203..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_14.go +++ /dev/null @@ -1,467 +0,0 @@ -// +build gtk_3_6 gtk_3_8 gtk_3_10 gtk_3_12 - -package gtk - -// #include <stdlib.h> -// #include <gtk/gtk.h> -// #include "gtk_deprecated_since_3_14.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - {glib.Type(C.gtk_alignment_get_type()), marshalAlignment}, - {glib.Type(C.gtk_arrow_get_type()), marshalArrow}, - {glib.Type(C.gtk_misc_get_type()), marshalMisc}, - {glib.Type(C.gtk_status_icon_get_type()), marshalStatusIcon}, - } - glib.RegisterGValueMarshalers(tm) - - //Contribute to casting - for k, v := range map[string]WrapFn{ - "GtkAlignment": wrapAlignment, - "GtkArrow": wrapArrow, - "GtkMisc": wrapMisc, - "GtkStatusIcon": wrapStatusIcon, - } { - WrapMap[k] = v - } -} - -/* - * deprecated since version 3.14 and should not be used in newly-written code - */ - -// ResizeGripIsVisible is a wrapper around -// gtk_window_resize_grip_is_visible(). -func (v *Window) ResizeGripIsVisible() bool { - c := C.gtk_window_resize_grip_is_visible(v.native()) - return gobool(c) -} - -// SetHasResizeGrip is a wrapper around gtk_window_set_has_resize_grip(). -func (v *Window) SetHasResizeGrip(setting bool) { - C.gtk_window_set_has_resize_grip(v.native(), gbool(setting)) -} - -// GetHasResizeGrip is a wrapper around gtk_window_get_has_resize_grip(). -func (v *Window) GetHasResizeGrip() bool { - c := C.gtk_window_get_has_resize_grip(v.native()) - return gobool(c) -} - -// Reparent() is a wrapper around gtk_widget_reparent(). -func (v *Widget) Reparent(newParent IWidget) { - C.gtk_widget_reparent(v.native(), newParent.toWidget()) -} - -// GetPadding is a wrapper around gtk_alignment_get_padding(). -func (v *Alignment) GetPadding() (top, bottom, left, right uint) { - var ctop, cbottom, cleft, cright C.guint - C.gtk_alignment_get_padding(v.native(), &ctop, &cbottom, &cleft, - &cright) - return uint(ctop), uint(cbottom), uint(cleft), uint(cright) -} - -// SetPadding is a wrapper around gtk_alignment_set_padding(). -func (v *Alignment) SetPadding(top, bottom, left, right uint) { - C.gtk_alignment_set_padding(v.native(), C.guint(top), C.guint(bottom), - C.guint(left), C.guint(right)) -} - -// AlignmentNew is a wrapper around gtk_alignment_new(). -func AlignmentNew(xalign, yalign, xscale, yscale float32) (*Alignment, error) { - c := C.gtk_alignment_new(C.gfloat(xalign), C.gfloat(yalign), C.gfloat(xscale), - C.gfloat(yscale)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapAlignment(obj), nil -} - -// Set is a wrapper around gtk_alignment_set(). -func (v *Alignment) Set(xalign, yalign, xscale, yscale float32) { - C.gtk_alignment_set(v.native(), C.gfloat(xalign), C.gfloat(yalign), - C.gfloat(xscale), C.gfloat(yscale)) -} - -/* - * GtkArrow - */ - -// Arrow is a representation of GTK's GtkArrow. -type Arrow struct { - Misc -} - -// ArrowNew is a wrapper around gtk_arrow_new(). -func ArrowNew(arrowType ArrowType, shadowType ShadowType) (*Arrow, error) { - c := C.gtk_arrow_new(C.GtkArrowType(arrowType), - C.GtkShadowType(shadowType)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapArrow(obj), nil -} - -// Set is a wrapper around gtk_arrow_set(). -func (v *Arrow) Set(arrowType ArrowType, shadowType ShadowType) { - C.gtk_arrow_set(v.native(), C.GtkArrowType(arrowType), C.GtkShadowType(shadowType)) -} - -// SetAlignment() is a wrapper around gtk_button_set_alignment(). -func (v *Button) SetAlignment(xalign, yalign float32) { - C.gtk_button_set_alignment(v.native(), (C.gfloat)(xalign), - (C.gfloat)(yalign)) -} - -// GetAlignment() is a wrapper around gtk_button_get_alignment(). -func (v *Button) GetAlignment() (xalign, yalign float32) { - var x, y C.gfloat - C.gtk_button_get_alignment(v.native(), &x, &y) - return float32(x), float32(y) -} - -// SetReallocateRedraws is a wrapper around -// gtk_container_set_reallocate_redraws(). -func (v *Container) SetReallocateRedraws(needsRedraws bool) { - C.gtk_container_set_reallocate_redraws(v.native(), gbool(needsRedraws)) -} - -// GetAlignment is a wrapper around gtk_misc_get_alignment(). -func (v *Misc) GetAlignment() (xAlign, yAlign float32) { - var x, y C.gfloat - C.gtk_misc_get_alignment(v.native(), &x, &y) - return float32(x), float32(y) -} - -// SetAlignment is a wrapper around gtk_misc_set_alignment(). -func (v *Misc) SetAlignment(xAlign, yAlign float32) { - C.gtk_misc_set_alignment(v.native(), C.gfloat(xAlign), C.gfloat(yAlign)) -} - -// GetPadding is a wrapper around gtk_misc_get_padding(). -func (v *Misc) GetPadding() (xpad, ypad int) { - var x, y C.gint - C.gtk_misc_get_padding(v.native(), &x, &y) - return int(x), int(y) -} - -// SetPadding is a wrapper around gtk_misc_set_padding(). -func (v *Misc) SetPadding(xPad, yPad int) { - C.gtk_misc_set_padding(v.native(), C.gint(xPad), C.gint(yPad)) -} - -// SetDoubleBuffered is a wrapper around gtk_widget_set_double_buffered(). -func (v *Widget) SetDoubleBuffered(doubleBuffered bool) { - C.gtk_widget_set_double_buffered(v.native(), gbool(doubleBuffered)) -} - -// GetDoubleBuffered is a wrapper around gtk_widget_get_double_buffered(). -func (v *Widget) GetDoubleBuffered() bool { - c := C.gtk_widget_get_double_buffered(v.native()) - return gobool(c) -} - -/* - * GtkArrow - * deprecated since version 3.14 - */ -// native returns a pointer to the underlying GtkButton. -func (v *Arrow) native() *C.GtkArrow { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkArrow(p) -} - -func marshalArrow(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapArrow(obj), nil -} - -func wrapArrow(obj *glib.Object) *Arrow { - return &Arrow{Misc{Widget{glib.InitiallyUnowned{obj}}}} -} - -/* - * GtkAlignment - * deprecated since version 3.14 - */ - -type Alignment struct { - Bin -} - -// native returns a pointer to the underlying GtkAlignment. -func (v *Alignment) native() *C.GtkAlignment { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkAlignment(p) -} - -func marshalAlignment(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapAlignment(obj), nil -} - -func wrapAlignment(obj *glib.Object) *Alignment { - return &Alignment{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -/* - * GtkStatusIcon - * deprecated since version 3.14 - */ - -// StatusIcon is a representation of GTK's GtkStatusIcon. -// Deprecated since 3.14 in favor of notifications -// (no replacement, see https://stackoverflow.com/questions/41917903/gtk-3-statusicon-replacement) -type StatusIcon struct { - *glib.Object -} - -func marshalStatusIcon(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapStatusIcon(obj), nil -} - -func wrapStatusIcon(obj *glib.Object) *StatusIcon { - return &StatusIcon{obj} -} - -func (v *StatusIcon) native() *C.GtkStatusIcon { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkStatusIcon(p) -} - -// TODO: GtkStatusIcon * gtk_status_icon_new_from_gicon (GIcon *icon); -// TODO: void gtk_status_icon_set_from_gicon (GtkStatusIcon *status_icon, GIcon *icon); - -// TODO: GIcon * gtk_status_icon_get_gicon (GtkStatusIcon *status_icon); - -// TODO: void gtk_status_icon_set_screen (GtkStatusIcon *status_icon, GdkScreen *screen); -// TODO: GdkScreen * gtk_status_icon_get_screen (GtkStatusIcon *status_icon); - -// TODO: GdkPixbuf * gtk_status_icon_get_pixbuf (GtkStatusIcon *status_icon); - -// TODO: void gtk_status_icon_position_menu (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data); -// TODO: gboolean gtk_status_icon_get_geometry (GtkStatusIcon *status_icon, GdkScreen **screen, GdkRectangle *area, GtkOrientation *orientation); - -// StatusIconNew is a wrapper around gtk_status_icon_new() -func StatusIconNew() (*StatusIcon, error) { - c := C.gtk_status_icon_new() - if c == nil { - return nil, nilPtrErr - } - return wrapStatusIcon(glib.Take(unsafe.Pointer(c))), nil -} - -// StatusIconNewFromFile is a wrapper around gtk_status_icon_new_from_file() -func StatusIconNewFromFile(filename string) (*StatusIcon, error) { - cstr := C.CString(filename) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_status_icon_new_from_file((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapStatusIcon(glib.Take(unsafe.Pointer(c))), nil -} - -// StatusIconNewFromIconName is a wrapper around gtk_status_icon_new_from_icon_name() -func StatusIconNewFromIconName(iconName string) (*StatusIcon, error) { - cstr := C.CString(iconName) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_status_icon_new_from_icon_name((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - return wrapStatusIcon(glib.Take(unsafe.Pointer(c))), nil -} - -// StatusIconNewFromPixbuf is a wrapper around gtk_status_icon_new_from_pixbuf(). -func StatusIconNewFromPixbuf(pixbuf *gdk.Pixbuf) (*StatusIcon, error) { - c := C.gtk_status_icon_new_from_pixbuf(C.toGdkPixbuf(unsafe.Pointer(pixbuf.Native()))) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapStatusIcon(obj), nil -} - -// SetFromFile is a wrapper around gtk_status_icon_set_from_file() -func (v *StatusIcon) SetFromFile(filename string) { - cstr := C.CString(filename) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_status_icon_set_from_file(v.native(), (*C.gchar)(cstr)) -} - -// SetFromIconName is a wrapper around gtk_status_icon_set_from_icon_name() -func (v *StatusIcon) SetFromIconName(iconName string) { - cstr := C.CString(iconName) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_status_icon_set_from_icon_name(v.native(), (*C.gchar)(cstr)) -} - -// SetFromPixbuf is a wrapper around gtk_status_icon_set_from_pixbuf() -func (v *StatusIcon) SetFromPixbuf(pixbuf *gdk.Pixbuf) { - C.gtk_status_icon_set_from_pixbuf(v.native(), C.toGdkPixbuf(unsafe.Pointer(pixbuf.Native()))) -} - -// GetStorageType is a wrapper around gtk_status_icon_get_storage_type() -func (v *StatusIcon) GetStorageType() ImageType { - return (ImageType)(C.gtk_status_icon_get_storage_type(v.native())) -} - -// SetTooltipText is a wrapper around gtk_status_icon_set_tooltip_text() -func (v *StatusIcon) SetTooltipText(text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_status_icon_set_tooltip_text(v.native(), (*C.gchar)(cstr)) -} - -// GetTooltipText is a wrapper around gtk_status_icon_get_tooltip_text() -func (v *StatusIcon) GetTooltipText() string { - c := C.gtk_status_icon_get_tooltip_text(v.native()) - if c == nil { - return "" - } - return C.GoString((*C.char)(c)) -} - -// SetTooltipMarkup is a wrapper around gtk_status_icon_set_tooltip_markup() -func (v *StatusIcon) SetTooltipMarkup(markup string) { - cstr := C.CString(markup) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_status_icon_set_tooltip_markup(v.native(), (*C.gchar)(cstr)) -} - -// GetTooltipMarkup is a wrapper around gtk_status_icon_get_tooltip_markup() -func (v *StatusIcon) GetTooltipMarkup() string { - c := C.gtk_status_icon_get_tooltip_markup(v.native()) - if c == nil { - return "" - } - return C.GoString((*C.char)(c)) -} - -// SetHasTooltip is a wrapper around gtk_status_icon_set_has_tooltip() -func (v *StatusIcon) SetHasTooltip(hasTooltip bool) { - C.gtk_status_icon_set_has_tooltip(v.native(), gbool(hasTooltip)) -} - -// GetTitle is a wrapper around gtk_status_icon_get_title() -func (v *StatusIcon) GetTitle() string { - c := C.gtk_status_icon_get_title(v.native()) - if c == nil { - return "" - } - return C.GoString((*C.char)(c)) -} - -// SetName is a wrapper around gtk_status_icon_set_name() -func (v *StatusIcon) SetName(name string) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_status_icon_set_name(v.native(), (*C.gchar)(cstr)) -} - -// SetVisible is a wrapper around gtk_status_icon_set_visible() -func (v *StatusIcon) SetVisible(visible bool) { - C.gtk_status_icon_set_visible(v.native(), gbool(visible)) -} - -// GetVisible is a wrapper around gtk_status_icon_get_visible() -func (v *StatusIcon) GetVisible() bool { - return gobool(C.gtk_status_icon_get_visible(v.native())) -} - -// IsEmbedded is a wrapper around gtk_status_icon_is_embedded() -func (v *StatusIcon) IsEmbedded() bool { - return gobool(C.gtk_status_icon_is_embedded(v.native())) -} - -// GetX11WindowID is a wrapper around gtk_status_icon_get_x11_window_id() -func (v *StatusIcon) GetX11WindowID() uint32 { - return uint32(C.gtk_status_icon_get_x11_window_id(v.native())) -} - -// GetHasTooltip is a wrapper around gtk_status_icon_get_has_tooltip() -func (v *StatusIcon) GetHasTooltip() bool { - return gobool(C.gtk_status_icon_get_has_tooltip(v.native())) -} - -// SetTitle is a wrapper around gtk_status_icon_set_title() -func (v *StatusIcon) SetTitle(title string) { - cstr := C.CString(title) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_status_icon_set_title(v.native(), (*C.gchar)(cstr)) -} - -// GetIconName is a wrapper around gtk_status_icon_get_icon_name() -func (v *StatusIcon) GetIconName() string { - c := C.gtk_status_icon_get_icon_name(v.native()) - if c == nil { - return "" - } - return C.GoString((*C.char)(c)) -} - -// GetSize is a wrapper around gtk_status_icon_get_size() -func (v *StatusIcon) GetSize() int { - return int(C.gtk_status_icon_get_size(v.native())) -} - -// PopupAtStatusIcon() is a wrapper around gtk_menu_popup() specific to usage with GtkStatusIcon. -// gomenu_popup() is defined in menu.go.h, this is a workaround to pass gtk_status_icon_position_menu as the GtkMenuPositionFunc. -func (v *Menu) PopupAtStatusIcon(statusIcon *StatusIcon, button uint, activateTime uint32) { - C.gotk_menu_popup_at_status_icon(v.native(), statusIcon.native(), C.guint(button), C.guint32(activateTime)) -} - -/* - * GtkMisc - */ - -// Misc is a representation of GTK's GtkMisc. -type Misc struct { - Widget -} - -// native returns a pointer to the underlying GtkMisc. -func (v *Misc) native() *C.GtkMisc { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkMisc(p) -} - -func marshalMisc(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapMisc(obj), nil -} - -func wrapMisc(obj *glib.Object) *Misc { - return &Misc{Widget{glib.InitiallyUnowned{obj}}} -} - -/* - * End deprecated since version 3.14 - */ diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_14.go.h b/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_14.go.h deleted file mode 100644 index 18a1855..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_14.go.h +++ /dev/null @@ -1,46 +0,0 @@ -
-/*
- * deprecated since version 3.14
- */
-
-// Wrapper for gtk_menu_popup to allow calling gtk_status_icon_position_menu as callback from go code
-// Used in func (v *Menu) PopupAtStatusIcon
-static void
-gotk_menu_popup_at_status_icon(GtkMenu *menu, GtkStatusIcon *status_icon, guint button, guint32 activate_time)
-{
- gtk_menu_popup(menu, NULL, NULL, gtk_status_icon_position_menu, status_icon, button, activate_time);
-}
-
-static GtkAlignment *
-toGtkAlignment(void *p)
-{
- return (GTK_ALIGNMENT(p));
-}
-
-static GtkArrow *
-toGtkArrow(void *p)
-{
- return (GTK_ARROW(p));
-}
-
-static GtkMisc *
-toGtkMisc(void *p)
-{
- return (GTK_MISC(p));
-}
-
-static GtkStatusIcon *
-toGtkStatusIcon(void *p)
-{
- return (GTK_STATUS_ICON(p));
-}
-
-static GdkPixbuf *
-toGdkPixbuf(void *p)
-{
- return (GDK_PIXBUF(p));
-}
-
-/*
- * End deprecated since version 3.14
- */
diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_16.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_16.go deleted file mode 100644 index 1f2e9d4..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_16.go +++ /dev/null @@ -1,48 +0,0 @@ -//+build gtk_3_6 gtk_3_8 gtk_3_10 gtk_3_12 gtk_3_14 - -package gtk - -// #include <gtk/gtk.h> -// #include <stdlib.h> -import "C" - -import ( - "unsafe" - - "github.com/gotk3/gotk3/gdk" -) - -// OverrideColor is a wrapper around gtk_widget_override_color(). -func (v *Widget) OverrideColor(state StateFlags, color *gdk.RGBA) { - var cColor *C.GdkRGBA - if color != nil { - cColor = (*C.GdkRGBA)(unsafe.Pointer(color.Native())) - } - C.gtk_widget_override_color(v.native(), C.GtkStateFlags(state), cColor) -} - -func (v *Widget) OverrideBackgroundColor(state StateFlags, color *gdk.RGBA) { - var cColor *C.GdkRGBA - if color != nil { - cColor = (*C.GdkRGBA)(unsafe.Pointer(color.Native())) - } - C.gtk_widget_override_background_color(v.native(), C.GtkStateFlags(state), cColor) -} - -func (v *Button) SetColor(color string) { - rgba := C.GdkRGBA{} - C.gdk_rgba_parse(&rgba, (*C.gchar)(C.CString(color))) - C.gtk_widget_override_background_color(v.toWidget(), C.GTK_STATE_FLAG_NORMAL, &rgba) -} - -// OverrideFont is a wrapper around gtk_widget_override_font(). -func (v *Widget) OverrideFont(description string) { - cstr := C.CString(description) - defer C.free(unsafe.Pointer(cstr)) - c := C.pango_font_description_from_string(cstr) - C.gtk_widget_override_font(v.native(), c) -} - -func (v *Label) SetFont(font string) { - v.OverrideFont(font) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_20.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_20.go deleted file mode 100644 index a63c206..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_20.go +++ /dev/null @@ -1,34 +0,0 @@ -//+build gtk_3_6 gtk_3_8 gtk_3_10 gtk_3_12 gtk_3_14 gtk_3_16 gtk_3_18 - -package gtk - -// #include <gtk/gtk.h> -// #include <stdlib.h> -import "C" - -// GetFocusOnClick() is a wrapper around gtk_button_get_focus_on_click(). -func (v *Button) GetFocusOnClick() bool { - c := C.gtk_button_get_focus_on_click(v.native()) - return gobool(c) -} - -// BeginsTag is a wrapper around gtk_text_iter_begins_tag(). -func (v *TextIter) BeginsTag(v1 *TextTag) bool { - return gobool(C.gtk_text_iter_begins_tag(v.native(), v1.native())) -} - -// ResizeToGeometry is a wrapper around gtk_window_resize_to_geometry(). -func (v *Window) ResizeToGeometry(width, height int) { - C.gtk_window_resize_to_geometry(v.native(), C.gint(width), C.gint(height)) -} - -// SetDefaultGeometry is a wrapper around gtk_window_set_default_geometry(). -func (v *Window) SetDefaultGeometry(width, height int) { - C.gtk_window_set_default_geometry(v.native(), C.gint(width), - C.gint(height)) -} - -// SetFocusOnClick() is a wrapper around gtk_button_set_focus_on_click(). -func (v *Button) SetFocusOnClick(focusOnClick bool) { - C.gtk_button_set_focus_on_click(v.native(), gbool(focusOnClick)) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_22.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_22.go deleted file mode 100644 index b155cb4..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_22.go +++ /dev/null @@ -1,57 +0,0 @@ -//+build gtk_3_6 gtk_3_8 gtk_3_10 gtk_3_12 gtk_3_14 gtk_3_16 gtk_3_18 gtk_3_20 - -package gtk - -// #include <gtk/gtk.h> -// #include <stdlib.h> -import "C" - -import ( - "unsafe" -) - -// PopupAtMouse() is a wrapper for gtk_menu_popup(), without the option for a custom positioning function. -func (v *Menu) PopupAtMouseCursor(parentMenuShell IMenu, parentMenuItem IMenuItem, button int, activateTime uint32) { - wshell := nullableWidget(parentMenuShell) - witem := nullableWidget(parentMenuItem) - - C.gtk_menu_popup(v.native(), - wshell, - witem, - nil, - nil, - C.guint(button), - C.guint32(activateTime)) -} - -func (v *SizeGroup) GetIgnoreHidden() bool { - c := C.gtk_size_group_get_ignore_hidden(v.native()) - return gobool(c) -} - -// SetWMClass is a wrapper around gtk_window_set_wmclass(). -func (v *Window) SetWMClass(name, class string) { - cName := C.CString(name) - defer C.free(unsafe.Pointer(cName)) - cClass := C.CString(class) - defer C.free(unsafe.Pointer(cClass)) - C.gtk_window_set_wmclass(v.native(), (*C.gchar)(cName), (*C.gchar)(cClass)) -} - -func (v *SizeGroup) SetIgnoreHidden(ignoreHidden bool) { - C.gtk_size_group_set_ignore_hidden(v.native(), gbool(ignoreHidden)) -} - -// GetFontName is a wrapper around gtk_font_button_get_font_name(). -func (v *FontButton) GetFontName() string { - c := C.gtk_font_button_get_font_name(v.native()) - return goString(c) -} - -// SetFontName is a wrapper around gtk_font_button_set_font_name(). -func (v *FontButton) SetFontName(fontname string) bool { - cstr := C.CString(fontname) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_font_button_set_font_name(v.native(), (*C.gchar)(cstr)) - return gobool(c) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_24.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_24.go deleted file mode 100644 index ed144a7..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_24.go +++ /dev/null @@ -1,46 +0,0 @@ -//+build gtk_3_6 gtk_3_8 gtk_3_10 gtk_3_12 gtk_3_14 gtk_3_16 gtk_3_18 gtk_3_20 gtk_3_22 - -package gtk - -// #include <gtk/gtk.h> -// #include <stdlib.h> -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -// GetFocusChain is a wrapper around gtk_container_get_focus_chain(). -func (v *Container) GetFocusChain() ([]*Widget, bool) { - var cwlist *C.GList - c := C.gtk_container_get_focus_chain(v.native(), &cwlist) - - var widgets []*Widget - wlist := glib.WrapList(uintptr(unsafe.Pointer(cwlist))) - for ; wlist.Data() != nil; wlist = wlist.Next() { - widgets = append(widgets, wrapWidget(glib.Take(wlist.Data().(unsafe.Pointer)))) - } - return widgets, gobool(c) -} - -// SetFocusChain is a wrapper around gtk_container_set_focus_chain(). -func (v *Container) SetFocusChain(focusableWidgets []IWidget) { - var list *glib.List - for _, w := range focusableWidgets { - data := uintptr(unsafe.Pointer(w.toWidget())) - list = list.Append(data) - } - glist := (*C.GList)(unsafe.Pointer(list)) - C.gtk_container_set_focus_chain(v.native(), glist) -} - -// CssProviderGetDefault is a wrapper around gtk_css_provider_get_default(). -func CssProviderGetDefault() (*CssProvider, error) { - c := C.gtk_css_provider_get_default() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapCssProvider(obj), nil -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_8.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_8.go deleted file mode 100644 index 223ddf0..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_deprecated_since_3_8.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// This file includes wrapers for symbols deprecated beginning with GTK 3.8, -// and should only be included in a build targeted intended to target GTK -// 3.6 or earlier. To target an earlier build build, use the build tag -// gtk_MAJOR_MINOR. For example, to target GTK 3.6, run -// 'go build -tags gtk_3_6'. -// +build gtk_3_6 - -package gtk - -// #include <stdlib.h> -// #include <gtk/gtk.h> -import "C" - -// SetOpacity is a wrapper around gtk_window_set_opacity() -// Deprecated since 3.8, replaced by SetOpacity on Widget (gtk_widget_set_opacity) -func (v *Window) SetOpacity(opacity float64) { - C.gtk_window_set_opacity(v.native(), C.gdouble(opacity)) -} - -// GetOpacity is a wrapper around gtk_window_get_opacity() -// Deprecated since 3.8, replaced by GetOpacity on Widget (gtk_widget_get_opacity) -func (v *Window) GetOpacity() float64 { - c := C.gtk_window_get_opacity(v.native()) - return float64(c) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_export.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_export.go deleted file mode 100644 index 985aa32..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_export.go +++ /dev/null @@ -1,104 +0,0 @@ -package gtk - -/* - #include <gtk/gtk.h> -*/ -import "C" -import ( - "strings" - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -//export substring_match_equal_func -func substring_match_equal_func(model *C.GtkTreeModel, - column C.gint, - key *C.gchar, - iter *C.GtkTreeIter, - data C.gpointer) C.gboolean { - - goModel := &TreeModel{glib.Take(unsafe.Pointer(model))} - goIter := &TreeIter{(C.GtkTreeIter)(*iter)} - - value, err := goModel.GetValue(goIter, int(column)) - if err != nil { - return gbool(true) - } - - str, _ := value.GetString() - if str == "" { - return gbool(true) - } - - subStr := C.GoString((*C.char)(key)) - res := strings.Contains(str, subStr) - return gbool(!res) -} - -//export goBuilderConnect -func goBuilderConnect(builder *C.GtkBuilder, - object *C.GObject, - signal_name *C.gchar, - handler_name *C.gchar, - connect_object *C.GObject, - flags C.GConnectFlags, - user_data C.gpointer) { - - builderSignals.Lock() - signals, ok := builderSignals.m[builder] - builderSignals.Unlock() - - if !ok { - panic("no signal mapping defined for this GtkBuilder") - } - - h := C.GoString((*C.char)(handler_name)) - s := C.GoString((*C.char)(signal_name)) - - handler, ok := signals[h] - if !ok { - return - } - - if object == nil { - panic("unexpected nil object from builder") - } - - //TODO: figure out a better way to get a glib.Object from a *C.GObject - gobj := glib.Object{glib.ToGObject(unsafe.Pointer(object))} - gobj.Connect(s, handler) -} - -//export goPageSetupDone -func goPageSetupDone(setup *C.GtkPageSetup, - data C.gpointer) { - - id := int(uintptr(data)) - - pageSetupDoneCallbackRegistry.Lock() - r := pageSetupDoneCallbackRegistry.m[id] - delete(pageSetupDoneCallbackRegistry.m, id) - pageSetupDoneCallbackRegistry.Unlock() - - obj := glib.Take(unsafe.Pointer(setup)) - r.fn(wrapPageSetup(obj), r.data) - -} - -//export goPrintSettings -func goPrintSettings(key *C.gchar, - value *C.gchar, - userData C.gpointer) { - - id := int(uintptr(userData)) - - printSettingsCallbackRegistry.Lock() - r := printSettingsCallbackRegistry.m[id] - // TODO: figure out a way to determine when we can clean up - //delete(printSettingsCallbackRegistry.m, id) - printSettingsCallbackRegistry.Unlock() - - r.fn(C.GoString((*C.char)(key)), C.GoString((*C.char)(value)), r.userData) - -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_export_since_3_10.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_export_since_3_10.go deleted file mode 100644 index 51f604f..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_export_since_3_10.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8 - -package gtk - -// #include <gtk/gtk.h> -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -//export goListBoxFilterFuncs -func goListBoxFilterFuncs(row *C.GtkListBoxRow, userData C.gpointer) C.gboolean { - id := int(uintptr(userData)) - - listBoxFilterFuncRegistry.Lock() - r := listBoxFilterFuncRegistry.m[id] - // TODO: figure out a way to determine when we can clean up - //delete(printSettingsCallbackRegistry.m, id) - listBoxFilterFuncRegistry.Unlock() - - return gbool(r.fn(wrapListBoxRow(glib.Take(unsafe.Pointer(row))), r.userData)) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_10.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_10.go deleted file mode 100644 index 35ffb63..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_10.go +++ /dev/null @@ -1,734 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains accelerator related functions and structures - -// +build !gtk_3_6,!gtk_3_8 -// not use this: go build -tags gtk_3_8'. Otherwise, if no build tags are used, GTK 3.10 - -package gtk - -// #include <stdlib.h> -// #include <gtk/gtk.h> -// #include "gtk_since_3_10.go.h" -import "C" -import ( - "sync" - "unsafe" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - // Enums - {glib.Type(C.gtk_revealer_transition_type_get_type()), marshalRevealerTransitionType}, - {glib.Type(C.gtk_stack_transition_type_get_type()), marshalStackTransitionType}, - - // Objects/Interfaces - {glib.Type(C.gtk_header_bar_get_type()), marshalHeaderBar}, - {glib.Type(C.gtk_list_box_get_type()), marshalListBox}, - {glib.Type(C.gtk_list_box_row_get_type()), marshalListBoxRow}, - {glib.Type(C.gtk_revealer_get_type()), marshalRevealer}, - {glib.Type(C.gtk_search_bar_get_type()), marshalSearchBar}, - {glib.Type(C.gtk_stack_get_type()), marshalStack}, - {glib.Type(C.gtk_stack_switcher_get_type()), marshalStackSwitcher}, - } - glib.RegisterGValueMarshalers(tm) - - //Contribute to casting - for k, v := range map[string]WrapFn{ - "GtkHeaderBar": wrapHeaderBar, - "GtkListBox": wrapListBox, - "GtkListBoxRow": wrapListBoxRow, - "GtkRevealer": wrapRevealer, - "GtkSearchBar": wrapSearchBar, - "GtkStack": wrapStack, - } { - WrapMap[k] = v - } -} - -/* - * Constants - */ - -const ( - ALIGN_BASELINE Align = C.GTK_ALIGN_BASELINE -) - -// RevealerTransitionType is a representation of GTK's GtkRevealerTransitionType. -type RevealerTransitionType int - -const ( - REVEALER_TRANSITION_TYPE_NONE RevealerTransitionType = C.GTK_REVEALER_TRANSITION_TYPE_NONE - REVEALER_TRANSITION_TYPE_CROSSFADE RevealerTransitionType = C.GTK_REVEALER_TRANSITION_TYPE_CROSSFADE - REVEALER_TRANSITION_TYPE_SLIDE_RIGHT RevealerTransitionType = C.GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT - REVEALER_TRANSITION_TYPE_SLIDE_LEFT RevealerTransitionType = C.GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT - REVEALER_TRANSITION_TYPE_SLIDE_UP RevealerTransitionType = C.GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP - REVEALER_TRANSITION_TYPE_SLIDE_DOWN RevealerTransitionType = C.GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN -) - -func marshalRevealerTransitionType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return RevealerTransitionType(c), nil -} - -// StackTransitionType is a representation of GTK's GtkStackTransitionType. -type StackTransitionType int - -const ( - STACK_TRANSITION_TYPE_NONE StackTransitionType = C.GTK_STACK_TRANSITION_TYPE_NONE - STACK_TRANSITION_TYPE_CROSSFADE StackTransitionType = C.GTK_STACK_TRANSITION_TYPE_CROSSFADE - STACK_TRANSITION_TYPE_SLIDE_RIGHT StackTransitionType = C.GTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT - STACK_TRANSITION_TYPE_SLIDE_LEFT StackTransitionType = C.GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT - STACK_TRANSITION_TYPE_SLIDE_UP StackTransitionType = C.GTK_STACK_TRANSITION_TYPE_SLIDE_UP - STACK_TRANSITION_TYPE_SLIDE_DOWN StackTransitionType = C.GTK_STACK_TRANSITION_TYPE_SLIDE_DOWN - STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT StackTransitionType = C.GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT - STACK_TRANSITION_TYPE_SLIDE_UP_DOWN StackTransitionType = C.GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN -) - -func marshalStackTransitionType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return StackTransitionType(c), nil -} - -/* - * GtkButton - */ - -// ButtonNewFromIconName is a wrapper around gtk_button_new_from_icon_name(). -func ButtonNewFromIconName(iconName string, size IconSize) (*Button, error) { - cstr := C.CString(iconName) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_button_new_from_icon_name((*C.gchar)(cstr), - C.GtkIconSize(size)) - if c == nil { - return nil, nilPtrErr - } - return wrapButton(glib.Take(unsafe.Pointer(c))), nil -} - -/* - * GtkGrid - */ - -// RemoveRow() is a wrapper around gtk_grid_remove_row(). -func (v *Grid) RemoveRow(position int) { - C.gtk_grid_remove_row(v.native(), C.gint(position)) -} - -// RemoveColumn() is a wrapper around gtk_grid_remove_column(). -func (v *Grid) RemoveColumn(position int) { - C.gtk_grid_remove_column(v.native(), C.gint(position)) -} - -/* - * GtkHeaderBar - */ - -type HeaderBar struct { - Container -} - -// native returns a pointer to the underlying GtkHeaderBar. -func (v *HeaderBar) native() *C.GtkHeaderBar { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkHeaderBar(p) -} - -func marshalHeaderBar(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapHeaderBar(obj), nil -} - -func wrapHeaderBar(obj *glib.Object) *HeaderBar { - return &HeaderBar{Container{Widget{glib.InitiallyUnowned{obj}}}} -} - -// HeaderBarNew is a wrapper around gtk_header_bar_new(). -func HeaderBarNew() (*HeaderBar, error) { - c := C.gtk_header_bar_new() - if c == nil { - return nil, nilPtrErr - } - return wrapHeaderBar(glib.Take(unsafe.Pointer(c))), nil -} - -// SetTitle is a wrapper around gtk_header_bar_set_title(). -func (v *HeaderBar) SetTitle(title string) { - cstr := C.CString(title) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_header_bar_set_title(v.native(), (*C.gchar)(cstr)) -} - -// GetTitle is a wrapper around gtk_header_bar_get_title(). -func (v *HeaderBar) GetTitle() string { - cstr := C.gtk_header_bar_get_title(v.native()) - return C.GoString((*C.char)(cstr)) -} - -// SetSubtitle is a wrapper around gtk_header_bar_set_subtitle(). -func (v *HeaderBar) SetSubtitle(subtitle string) { - cstr := C.CString(subtitle) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_header_bar_set_subtitle(v.native(), (*C.gchar)(cstr)) -} - -// GetSubtitle is a wrapper around gtk_header_bar_get_subtitle(). -func (v *HeaderBar) GetSubtitle() string { - cstr := C.gtk_header_bar_get_subtitle(v.native()) - return C.GoString((*C.char)(cstr)) -} - -// SetCustomTitle is a wrapper around gtk_header_bar_set_custom_title(). -func (v *HeaderBar) SetCustomTitle(titleWidget IWidget) { - C.gtk_header_bar_set_custom_title(v.native(), titleWidget.toWidget()) -} - -// GetCustomTitle is a wrapper around gtk_header_bar_get_custom_title(). -func (v *HeaderBar) GetCustomTitle() (*Widget, error) { - c := C.gtk_header_bar_get_custom_title(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -// PackStart is a wrapper around gtk_header_bar_pack_start(). -func (v *HeaderBar) PackStart(child IWidget) { - C.gtk_header_bar_pack_start(v.native(), child.toWidget()) -} - -// PackEnd is a wrapper around gtk_header_bar_pack_end(). -func (v *HeaderBar) PackEnd(child IWidget) { - C.gtk_header_bar_pack_end(v.native(), child.toWidget()) -} - -// SetShowCloseButton is a wrapper around gtk_header_bar_set_show_close_button(). -func (v *HeaderBar) SetShowCloseButton(setting bool) { - C.gtk_header_bar_set_show_close_button(v.native(), gbool(setting)) -} - -// GetShowCloseButton is a wrapper around gtk_header_bar_get_show_close_button(). -func (v *HeaderBar) GetShowCloseButton() bool { - c := C.gtk_header_bar_get_show_close_button(v.native()) - return gobool(c) -} - -/* - * GtkLabel - */ - -// GetLines() is a wrapper around gtk_label_get_lines(). -func (v *Label) GetLines() int { - c := C.gtk_label_get_lines(v.native()) - return int(c) -} - -// SetLines() is a wrapper around gtk_label_set_lines(). -func (v *Label) SetLines(lines int) { - C.gtk_label_set_lines(v.native(), C.gint(lines)) -} - -/* - * GtkListBox - */ - -// ListBox is a representation of GTK's GtkListBox. -type ListBox struct { - Container -} - -// native returns a pointer to the underlying GtkListBox. -func (v *ListBox) native() *C.GtkListBox { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkListBox(p) -} - -func marshalListBox(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapListBox(obj), nil -} - -func wrapListBox(obj *glib.Object) *ListBox { - return &ListBox{Container{Widget{glib.InitiallyUnowned{obj}}}} -} - -// ListBoxNew is a wrapper around gtk_list_box_new(). -func ListBoxNew() (*ListBox, error) { - c := C.gtk_list_box_new() - if c == nil { - return nil, nilPtrErr - } - return wrapListBox(glib.Take(unsafe.Pointer(c))), nil -} - -// Prepend is a wrapper around gtk_list_box_prepend(). -func (v *ListBox) Prepend(child IWidget) { - C.gtk_list_box_prepend(v.native(), child.toWidget()) -} - -// Insert is a wrapper around gtk_list_box_insert(). -func (v *ListBox) Insert(child IWidget, position int) { - C.gtk_list_box_insert(v.native(), child.toWidget(), C.gint(position)) -} - -// SelectRow is a wrapper around gtk_list_box_select_row(). -func (v *ListBox) SelectRow(row *ListBoxRow) { - C.gtk_list_box_select_row(v.native(), row.native()) -} - -// GetSelectedRow is a wrapper around gtk_list_box_get_selected_row(). -func (v *ListBox) GetSelectedRow() *ListBoxRow { - c := C.gtk_list_box_get_selected_row(v.native()) - if c == nil { - return nil - } - return wrapListBoxRow(glib.Take(unsafe.Pointer(c))) -} - -// SetSelectionMode is a wrapper around gtk_list_box_set_selection_mode(). -func (v *ListBox) SetSelectionMode(mode SelectionMode) { - C.gtk_list_box_set_selection_mode(v.native(), C.GtkSelectionMode(mode)) -} - -// GetSelectionMode is a wrapper around gtk_list_box_get_selection_mode() -func (v *ListBox) GetSelectionMode() SelectionMode { - c := C.gtk_list_box_get_selection_mode(v.native()) - return SelectionMode(c) -} - -// SetActivateOnSingleClick is a wrapper around gtk_list_box_set_activate_on_single_click(). -func (v *ListBox) SetActivateOnSingleClick(single bool) { - C.gtk_list_box_set_activate_on_single_click(v.native(), gbool(single)) -} - -// GetActivateOnSingleClick is a wrapper around gtk_list_box_get_activate_on_single_click(). -func (v *ListBox) GetActivateOnSingleClick() bool { - c := C.gtk_list_box_get_activate_on_single_click(v.native()) - return gobool(c) -} - -// GetAdjustment is a wrapper around gtk_list_box_get_adjustment(). -func (v *ListBox) GetAdjustment() *Adjustment { - c := C.gtk_list_box_get_adjustment(v.native()) - obj := glib.Take(unsafe.Pointer(c)) - return &Adjustment{glib.InitiallyUnowned{obj}} -} - -// SetAdjustment is a wrapper around gtk_list_box_set_adjustment(). -func (v *ListBox) SetAdjustment(adjustment *Adjustment) { - C.gtk_list_box_set_adjustment(v.native(), adjustment.native()) -} - -// SetPlaceholder is a wrapper around gtk_list_box_set_placeholder(). -func (v *ListBox) SetPlaceholder(placeholder IWidget) { - C.gtk_list_box_set_placeholder(v.native(), placeholder.toWidget()) -} - -// GetRowAtIndex is a wrapper around gtk_list_box_get_row_at_index(). -func (v *ListBox) GetRowAtIndex(index int) *ListBoxRow { - c := C.gtk_list_box_get_row_at_index(v.native(), C.gint(index)) - if c == nil { - return nil - } - return wrapListBoxRow(glib.Take(unsafe.Pointer(c))) -} - -// GetRowAtY is a wrapper around gtk_list_box_get_row_at_y(). -func (v *ListBox) GetRowAtY(y int) *ListBoxRow { - c := C.gtk_list_box_get_row_at_y(v.native(), C.gint(y)) - if c == nil { - return nil - } - return wrapListBoxRow(glib.Take(unsafe.Pointer(c))) -} - -// InvalidateFilter is a wrapper around gtk_list_box_invalidate_filter(). -func (v *ListBox) InvalidateFilter() { - C.gtk_list_box_invalidate_filter(v.native()) -} - -// InvalidateHeaders is a wrapper around gtk_list_box_invalidate_headers(). -func (v *ListBox) InvalidateHeaders() { - C.gtk_list_box_invalidate_headers(v.native()) -} - -// InvalidateSort is a wrapper around gtk_list_box_invalidate_sort(). -func (v *ListBox) InvalidateSort() { - C.gtk_list_box_invalidate_sort(v.native()) -} - -type ListBoxFilterFunc func(row *ListBoxRow, userData uintptr) bool - -type listBoxFilterFuncData struct { - fn ListBoxFilterFunc - userData uintptr -} - -var ( - listBoxFilterFuncRegistry = struct { - sync.RWMutex - next int - m map[int]listBoxFilterFuncData - }{ - next: 1, - m: make(map[int]listBoxFilterFuncData), - } -) - -func (v *ListBox) SetFilterFunc(fn ListBoxFilterFunc, userData uintptr) { - listBoxFilterFuncRegistry.Lock() - id := listBoxFilterFuncRegistry.next - listBoxFilterFuncRegistry.next++ - listBoxFilterFuncRegistry.m[id] = listBoxFilterFuncData{fn: fn, userData: userData} - listBoxFilterFuncRegistry.Unlock() - - C._gtk_list_box_set_filter_func(v.native(), C.gpointer(uintptr(id))) -} - -// TODO: SetHeaderFunc -// TODO: SetSortFunc - -// DragHighlightRow is a wrapper around gtk_list_box_drag_highlight_row() -func (v *ListBox) DragHighlightRow(row *ListBoxRow) { - C.gtk_list_box_drag_highlight_row(v.native(), row.native()) -} - -/* - * GtkListBoxRow - */ - -// ListBoxRow is a representation of GTK's GtkListBoxRow. -type ListBoxRow struct { - Bin -} - -// native returns a pointer to the underlying GtkListBoxRow. -func (v *ListBoxRow) native() *C.GtkListBoxRow { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkListBoxRow(p) -} - -func marshalListBoxRow(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapListBoxRow(obj), nil -} - -func wrapListBoxRow(obj *glib.Object) *ListBoxRow { - return &ListBoxRow{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -func ListBoxRowNew() (*ListBoxRow, error) { - c := C.gtk_list_box_row_new() - if c == nil { - return nil, nilPtrErr - } - return wrapListBoxRow(glib.Take(unsafe.Pointer(c))), nil -} - -// Changed is a wrapper around gtk_list_box_row_changed(). -func (v *ListBoxRow) Changed() { - C.gtk_list_box_row_changed(v.native()) -} - -// GetHeader is a wrapper around gtk_list_box_row_get_header(). -func (v *ListBoxRow) GetHeader() *Widget { - c := C.gtk_list_box_row_get_header(v.native()) - if c == nil { - return nil - } - return wrapWidget(glib.Take(unsafe.Pointer(c))) -} - -// SetHeader is a wrapper around gtk_list_box_row_get_header(). -func (v *ListBoxRow) SetHeader(header IWidget) { - C.gtk_list_box_row_set_header(v.native(), header.toWidget()) -} - -// GetIndex is a wrapper around gtk_list_box_row_get_index() -func (v *ListBoxRow) GetIndex() int { - c := C.gtk_list_box_row_get_index(v.native()) - return int(c) -} - -/* - * GtkRevealer - */ - -// Revealer is a representation of GTK's GtkRevealer -type Revealer struct { - Bin -} - -// native returns a pointer to the underlying GtkRevealer. -func (v *Revealer) native() *C.GtkRevealer { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkRevealer(p) -} - -func marshalRevealer(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapRevealer(obj), nil -} - -func wrapRevealer(obj *glib.Object) *Revealer { - return &Revealer{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// RevealerNew is a wrapper around gtk_revealer_new() -func RevealerNew() (*Revealer, error) { - c := C.gtk_revealer_new() - if c == nil { - return nil, nilPtrErr - } - return wrapRevealer(glib.Take(unsafe.Pointer(c))), nil -} - -// GetRevealChild is a wrapper around gtk_revealer_get_reveal_child(). -func (v *Revealer) GetRevealChild() bool { - c := C.gtk_revealer_get_reveal_child(v.native()) - return gobool(c) -} - -// SetRevealChild is a wrapper around gtk_revealer_set_reveal_child(). -func (v *Revealer) SetRevealChild(revealChild bool) { - C.gtk_revealer_set_reveal_child(v.native(), gbool(revealChild)) -} - -// GetChildRevealed is a wrapper around gtk_revealer_get_child_revealed(). -func (v *Revealer) GetChildRevealed() bool { - c := C.gtk_revealer_get_child_revealed(v.native()) - return gobool(c) -} - -// GetTransitionDuration is a wrapper around gtk_revealer_get_transition_duration() -func (v *Revealer) GetTransitionDuration() uint { - c := C.gtk_revealer_get_transition_duration(v.native()) - return uint(c) -} - -// SetTransitionDuration is a wrapper around gtk_revealer_set_transition_duration(). -func (v *Revealer) SetTransitionDuration(duration uint) { - C.gtk_revealer_set_transition_duration(v.native(), C.guint(duration)) -} - -// GetTransitionType is a wrapper around gtk_revealer_get_transition_type() -func (v *Revealer) GetTransitionType() RevealerTransitionType { - c := C.gtk_revealer_get_transition_type(v.native()) - return RevealerTransitionType(c) -} - -// SetTransitionType is a wrapper around gtk_revealer_set_transition_type() -func (v *Revealer) SetTransitionType(transition RevealerTransitionType) { - t := C.GtkRevealerTransitionType(transition) - C.gtk_revealer_set_transition_type(v.native(), t) -} - -/* - * GtkSearchBar - */ - -// SearchBar is a representation of GTK's GtkSearchBar. -type SearchBar struct { - Bin -} - -// native returns a pointer to the underlying GtkSearchBar. -func (v *SearchBar) native() *C.GtkSearchBar { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkSearchBar(p) -} - -func marshalSearchBar(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapSearchBar(obj), nil -} - -func wrapSearchBar(obj *glib.Object) *SearchBar { - return &SearchBar{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// SearchBarNew is a wrapper around gtk_search_bar_new() -func SearchBarNew() (*SearchBar, error) { - c := C.gtk_search_bar_new() - if c == nil { - return nil, nilPtrErr - } - return wrapSearchBar(glib.Take(unsafe.Pointer(c))), nil -} - -// ConnectEntry is a wrapper around gtk_search_bar_connect_entry(). -func (v *SearchBar) ConnectEntry(entry IEntry) { - C.gtk_search_bar_connect_entry(v.native(), entry.toEntry()) -} - -// GetSearchMode is a wrapper around gtk_search_bar_get_search_mode(). -func (v *SearchBar) GetSearchMode() bool { - c := C.gtk_search_bar_get_search_mode(v.native()) - return gobool(c) -} - -// SetSearchMode is a wrapper around gtk_search_bar_set_search_mode(). -func (v *SearchBar) SetSearchMode(searchMode bool) { - C.gtk_search_bar_set_search_mode(v.native(), gbool(searchMode)) -} - -// GetShowCloseButton is a wrapper arounb gtk_search_bar_get_show_close_button(). -func (v *SearchBar) GetShowCloseButton() bool { - c := C.gtk_search_bar_get_show_close_button(v.native()) - return gobool(c) -} - -// SetShowCloseButton is a wrapper around gtk_search_bar_set_show_close_button() -func (v *SearchBar) SetShowCloseButton(visible bool) { - C.gtk_search_bar_set_show_close_button(v.native(), gbool(visible)) -} - -// HandleEvent is a wrapper around gtk_search_bar_handle_event() -func (v *SearchBar) HandleEvent(event *gdk.Event) { - e := (*C.GdkEvent)(unsafe.Pointer(event.Native())) - C.gtk_search_bar_handle_event(v.native(), e) -} - -/* - * GtkStack - */ - -// Stack is a representation of GTK's GtkStack. -type Stack struct { - Container -} - -// native returns a pointer to the underlying GtkStack. -func (v *Stack) native() *C.GtkStack { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkStack(p) -} - -func marshalStack(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapStack(obj), nil -} - -func wrapStack(obj *glib.Object) *Stack { - return &Stack{Container{Widget{glib.InitiallyUnowned{obj}}}} -} - -// StackNew is a wrapper around gtk_stack_new(). -func StackNew() (*Stack, error) { - c := C.gtk_stack_new() - if c == nil { - return nil, nilPtrErr - } - return wrapStack(glib.Take(unsafe.Pointer(c))), nil -} - -// AddNamed is a wrapper around gtk_stack_add_named(). -func (v *Stack) AddNamed(child IWidget, name string) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_stack_add_named(v.native(), child.toWidget(), (*C.gchar)(cstr)) -} - -// AddTitled is a wrapper around gtk_stack_add_titled(). -func (v *Stack) AddTitled(child IWidget, name, title string) { - cName := C.CString(name) - defer C.free(unsafe.Pointer(cName)) - cTitle := C.CString(title) - defer C.free(unsafe.Pointer(cTitle)) - C.gtk_stack_add_titled(v.native(), child.toWidget(), (*C.gchar)(cName), - (*C.gchar)(cTitle)) -} - -// SetVisibleChild is a wrapper around gtk_stack_set_visible_child(). -func (v *Stack) SetVisibleChild(child IWidget) { - C.gtk_stack_set_visible_child(v.native(), child.toWidget()) -} - -// GetVisibleChild is a wrapper around gtk_stack_get_visible_child(). -func (v *Stack) GetVisibleChild() *Widget { - c := C.gtk_stack_get_visible_child(v.native()) - if c == nil { - return nil - } - return wrapWidget(glib.Take(unsafe.Pointer(c))) -} - -// SetVisibleChildName is a wrapper around gtk_stack_set_visible_child_name(). -func (v *Stack) SetVisibleChildName(name string) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_stack_set_visible_child_name(v.native(), (*C.gchar)(cstr)) -} - -// GetVisibleChildName is a wrapper around gtk_stack_get_visible_child_name(). -func (v *Stack) GetVisibleChildName() string { - c := C.gtk_stack_get_visible_child_name(v.native()) - return C.GoString((*C.char)(c)) -} - -// SetVisibleChildFull is a wrapper around gtk_stack_set_visible_child_full(). -func (v *Stack) SetVisibleChildFull(name string, transaction StackTransitionType) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_stack_set_visible_child_full(v.native(), (*C.gchar)(cstr), - C.GtkStackTransitionType(transaction)) -} - -// SetHomogeneous is a wrapper around gtk_stack_set_homogeneous(). -func (v *Stack) SetHomogeneous(homogeneous bool) { - C.gtk_stack_set_homogeneous(v.native(), gbool(homogeneous)) -} - -// GetHomogeneous is a wrapper around gtk_stack_get_homogeneous(). -func (v *Stack) GetHomogeneous() bool { - c := C.gtk_stack_get_homogeneous(v.native()) - return gobool(c) -} - -// SetTransitionDuration is a wrapper around gtk_stack_set_transition_duration(). -func (v *Stack) SetTransitionDuration(duration uint) { - C.gtk_stack_set_transition_duration(v.native(), C.guint(duration)) -} - -// GetTransitionDuration is a wrapper around gtk_stack_get_transition_duration(). -func (v *Stack) GetTransitionDuration() uint { - c := C.gtk_stack_get_transition_duration(v.native()) - return uint(c) -} - -// SetTransitionType is a wrapper around gtk_stack_set_transition_type(). -func (v *Stack) SetTransitionType(transition StackTransitionType) { - C.gtk_stack_set_transition_type(v.native(), C.GtkStackTransitionType(transition)) -} - -// GetTransitionType is a wrapper around gtk_stack_get_transition_type(). -func (v *Stack) GetTransitionType() StackTransitionType { - c := C.gtk_stack_get_transition_type(v.native()) - return StackTransitionType(c) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_10.go.h b/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_10.go.h deleted file mode 100644 index 20eb95a..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_10.go.h +++ /dev/null @@ -1,67 +0,0 @@ -/*
- * Copyright (c) 2013-2014 Conformal Systems <info@conformal.com>
- *
- * This file originated from: http://opensource.conformal.com/
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-static GtkHeaderBar *
-toGtkHeaderBar(void *p)
-{
- return (GTK_HEADER_BAR(p));
-}
-
-static GtkListBox *
-toGtkListBox(void *p)
-{
- return (GTK_LIST_BOX(p));
-}
-
-static GtkListBoxRow *
-toGtkListBoxRow(void *p)
-{
- return (GTK_LIST_BOX_ROW(p));
-}
-
-static GtkRevealer *
-toGtkRevealer(void *p)
-{
- return (GTK_REVEALER(p));
-}
-
-static GtkSearchBar *
-toGtkSearchBar(void *p)
-{
- return (GTK_SEARCH_BAR(p));
-}
-
-static GtkStack *
-toGtkStack(void *p)
-{
- return (GTK_STACK(p));
-}
-
-static GtkStackSwitcher *
-toGtkStackSwitcher(void *p)
-{
- return (GTK_STACK_SWITCHER(p));
-}
-
-extern gboolean goListBoxFilterFuncs (GtkListBoxRow *row,
- gpointer user_data);
-
-static inline void _gtk_list_box_set_filter_func(GtkListBox *box, gpointer user_data) {
- gtk_list_box_set_filter_func(box, (GtkListBoxFilterFunc)(goListBoxFilterFuncs), user_data, NULL);
-}
-
diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_12.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_12.go deleted file mode 100644 index 10a0da4..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_12.go +++ /dev/null @@ -1,351 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10 -// not use this: go build -tags gtk_3_8'. Otherwise, if no build tags are used, GTK 3.10 - -package gtk - -// #include <stdlib.h> -// #include <gtk/gtk.h> -// #include "gtk_since_3_12.go.h" -import "C" - -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - // Objects/Interfaces - {glib.Type(C.gtk_flow_box_get_type()), marshalFlowBox}, - {glib.Type(C.gtk_flow_box_child_get_type()), marshalFlowBoxChild}, - } - glib.RegisterGValueMarshalers(tm) - - WrapMap["GtkFlowBox"] = wrapFlowBox - WrapMap["GtkFlowBoxChild"] = wrapFlowBoxChild -} - -// GetLocaleDirection() is a wrapper around gtk_get_locale_direction(). -func GetLocaleDirection() TextDirection { - c := C.gtk_get_locale_direction() - return TextDirection(c) -} - -/* - * Dialog - */ - -// GetHeaderBar is a wrapper around gtk_dialog_get_header_bar(). -func (v *Dialog) GetHeaderBar() *Widget { - c := C.gtk_dialog_get_header_bar(v.native()) - if c == nil { - return nil - } - return wrapWidget(glib.Take(unsafe.Pointer(c))) -} - -/* - * Entry - */ - -// SetMaxWidthChars() is a wrapper around gtk_entry_set_max_width_chars(). -func (v *Entry) SetMaxWidthChars(nChars int) { - C.gtk_entry_set_max_width_chars(v.native(), C.gint(nChars)) -} - -// GetMaxWidthChars() is a wrapper around gtk_entry_get_max_width_chars(). -func (v *Entry) GetMaxWidthChars() int { - c := C.gtk_entry_get_max_width_chars(v.native()) - return int(c) -} - -/* - * HeaderBar - */ - -// GetDecorationLayout is a wrapper around gtk_header_bar_get_decoration_layout(). -func (v *HeaderBar) GetDecorationLayout() string { - c := C.gtk_header_bar_get_decoration_layout(v.native()) - return C.GoString((*C.char)(c)) -} - -// SetDecorationLayout is a wrapper around gtk_header_bar_set_decoration_layout(). -func (v *HeaderBar) SetDecorationLayout(layout string) { - cstr := C.CString(layout) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_header_bar_set_decoration_layout(v.native(), (*C.gchar)(cstr)) -} - -// GetHasSubtitle is a wrapper around gtk_header_bar_get_has_subtitle(). -func (v *HeaderBar) GetHasSubtitle() bool { - c := C.gtk_header_bar_get_has_subtitle(v.native()) - return gobool(c) -} - -// SetHasSubtitle is a wrapper around gtk_header_bar_set_has_subtitle(). -func (v *HeaderBar) SetHasSubtitle(setting bool) { - C.gtk_header_bar_set_has_subtitle(v.native(), gbool(setting)) -} - -/* - * MenuButton - */ - -// SetPopover is a wrapper around gtk_menu_button_set_popover(). -func (v *MenuButton) SetPopover(popover *Popover) { - C.gtk_menu_button_set_popover(v.native(), popover.toWidget()) -} - -// GetPopover is a wrapper around gtk_menu_button_get_popover(). -func (v *MenuButton) GetPopover() *Popover { - c := C.gtk_menu_button_get_popover(v.native()) - if c == nil { - return nil - } - return wrapPopover(glib.Take(unsafe.Pointer(c))) -} - -// GetUsePopover is a wrapper around gtk_menu_button_get_use_popover(). -func (v *MenuButton) GetUsePopover() bool { - c := C.gtk_menu_button_get_use_popover(v.native()) - return gobool(c) -} - -// SetUsePopover is a wrapper around gtk_menu_button_set_use_popover(). -func (v *MenuButton) SetUsePopover(setting bool) { - C.gtk_menu_button_set_use_popover(v.native(), gbool(setting)) -} - -/* - * FlowBox - */ -type FlowBox struct { - Container -} - -func (fb *FlowBox) native() *C.GtkFlowBox { - if fb == nil || fb.GObject == nil { - return nil - } - p := unsafe.Pointer(fb.GObject) - return C.toGtkFlowBox(p) -} - -func marshalFlowBox(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapFlowBox(obj), nil -} - -func wrapFlowBox(obj *glib.Object) *FlowBox { - return &FlowBox{Container{Widget{glib.InitiallyUnowned{obj}}}} -} - -// FlowBoxNew is a wrapper around gtk_flow_box_new() -func FlowBoxNew() (*FlowBox, error) { - c := C.gtk_flow_box_new() - if c == nil { - return nil, nilPtrErr - } - return wrapFlowBox(glib.Take(unsafe.Pointer(c))), nil -} - -// Insert is a wrapper around gtk_flow_box_insert() -func (fb *FlowBox) Insert(widget IWidget, position int) { - C.gtk_flow_box_insert(fb.native(), widget.toWidget(), C.gint(position)) -} - -// GetChildAtIndex is a wrapper around gtk_flow_box_get_child_at_index() -func (fb *FlowBox) GetChildAtIndex(idx int) *FlowBoxChild { - c := C.gtk_flow_box_get_child_at_index(fb.native(), C.gint(idx)) - if c == nil { - return nil - } - return wrapFlowBoxChild(glib.Take(unsafe.Pointer(c))) -} - -// TODO 3.22.6 gtk_flow_box_get_child_at_pos() - -// SetHAdjustment is a wrapper around gtk_flow_box_set_hadjustment() -func (fb *FlowBox) SetHAdjustment(adjustment *Adjustment) { - C.gtk_flow_box_set_hadjustment(fb.native(), adjustment.native()) -} - -// SetVAdjustment is a wrapper around gtk_flow_box_set_vadjustment() -func (fb *FlowBox) SetVAdjustment(adjustment *Adjustment) { - C.gtk_flow_box_set_vadjustment(fb.native(), adjustment.native()) -} - -// SetHomogeneous is a wrapper around gtk_flow_box_set_homogeneous() -func (fb *FlowBox) SetHomogeneous(homogeneous bool) { - C.gtk_flow_box_set_homogeneous(fb.native(), gbool(homogeneous)) -} - -// GetHomogeneous is a wrapper around gtk_flow_box_get_homogeneous() -func (fb *FlowBox) GetHomogeneous() bool { - c := C.gtk_flow_box_get_homogeneous(fb.native()) - return gobool(c) -} - -// SetRowSpacing is a wrapper around gtk_flow_box_set_row_spacing() -func (fb *FlowBox) SetRowSpacing(spacing uint) { - C.gtk_flow_box_set_row_spacing(fb.native(), C.guint(spacing)) -} - -// GetRowSpacing is a wrapper around gtk_flow_box_get_row_spacing() -func (fb *FlowBox) GetRowSpacing() uint { - c := C.gtk_flow_box_get_row_spacing(fb.native()) - return uint(c) -} - -// SetColumnSpacing is a wrapper around gtk_flow_box_set_column_spacing() -func (fb *FlowBox) SetColumnSpacing(spacing uint) { - C.gtk_flow_box_set_column_spacing(fb.native(), C.guint(spacing)) -} - -// GetColumnSpacing is a wrapper around gtk_flow_box_get_column_spacing() -func (fb *FlowBox) GetColumnSpacing() uint { - c := C.gtk_flow_box_get_column_spacing(fb.native()) - return uint(c) -} - -// SetMinChildrenPerLine is a wrapper around gtk_flow_box_set_min_children_per_line() -func (fb *FlowBox) SetMinChildrenPerLine(n_children uint) { - C.gtk_flow_box_set_min_children_per_line(fb.native(), C.guint(n_children)) -} - -// GetMinChildrenPerLine is a wrapper around gtk_flow_box_get_min_children_per_line() -func (fb *FlowBox) GetMinChildrenPerLine() uint { - c := C.gtk_flow_box_get_min_children_per_line(fb.native()) - return uint(c) -} - -// SetMaxChildrenPerLine is a wrapper around gtk_flow_box_set_max_children_per_line() -func (fb *FlowBox) SetMaxChildrenPerLine(n_children uint) { - C.gtk_flow_box_set_max_children_per_line(fb.native(), C.guint(n_children)) -} - -// GetMaxChildrenPerLine is a wrapper around gtk_flow_box_get_max_children_per_line() -func (fb *FlowBox) GetMaxChildrenPerLine() uint { - c := C.gtk_flow_box_get_max_children_per_line(fb.native()) - return uint(c) -} - -// SetActivateOnSingleClick is a wrapper around gtk_flow_box_set_activate_on_single_click() -func (fb *FlowBox) SetActivateOnSingleClick(single bool) { - C.gtk_flow_box_set_activate_on_single_click(fb.native(), gbool(single)) -} - -// GetActivateOnSingleClick gtk_flow_box_get_activate_on_single_click() -func (fb *FlowBox) GetActivateOnSingleClick() bool { - c := C.gtk_flow_box_get_activate_on_single_click(fb.native()) - return gobool(c) -} - -// TODO: gtk_flow_box_selected_foreach() - -// GetSelectedChildren is a wrapper around gtk_flow_box_get_selected_children() -func (fb *FlowBox) GetSelectedChildren() (rv []*FlowBoxChild) { - c := C.gtk_flow_box_get_selected_children(fb.native()) - if c == nil { - return - } - list := glib.WrapList(uintptr(unsafe.Pointer(c))) - for l := list; l != nil; l = l.Next() { - o := wrapFlowBoxChild(glib.Take(l.Data().(unsafe.Pointer))) - rv = append(rv, o) - } - // We got a transfer container, so we must free the list. - list.Free() - - return -} - -// SelectChild is a wrapper around gtk_flow_box_select_child() -func (fb *FlowBox) SelectChild(child *FlowBoxChild) { - C.gtk_flow_box_select_child(fb.native(), child.native()) -} - -// UnselectChild is a wrapper around gtk_flow_box_unselect_child() -func (fb *FlowBox) UnselectChild(child *FlowBoxChild) { - C.gtk_flow_box_unselect_child(fb.native(), child.native()) -} - -// SelectAll is a wrapper around gtk_flow_box_select_all() -func (fb *FlowBox) SelectAll() { - C.gtk_flow_box_select_all(fb.native()) -} - -// UnselectAll is a wrapper around gtk_flow_box_unselect_all() -func (fb *FlowBox) UnselectAll() { - C.gtk_flow_box_unselect_all(fb.native()) -} - -// SetSelectionMode is a wrapper around gtk_flow_box_set_selection_mode() -func (fb *FlowBox) SetSelectionMode(mode SelectionMode) { - C.gtk_flow_box_set_selection_mode(fb.native(), C.GtkSelectionMode(mode)) -} - -// GetSelectionMode is a wrapper around gtk_flow_box_get_selection_mode() -func (fb *FlowBox) GetSelectionMode() SelectionMode { - c := C.gtk_flow_box_get_selection_mode(fb.native()) - return SelectionMode(c) -} - -// TODO gtk_flow_box_set_filter_func() -// TODO gtk_flow_box_invalidate_filter() -// TODO gtk_flow_box_set_sort_func() -// TODO gtk_flow_box_invalidate_sort() -// TODO 3.18 gtk_flow_box_bind_model() - -/* - * FlowBoxChild - */ -type FlowBoxChild struct { - Bin -} - -func (fbc *FlowBoxChild) native() *C.GtkFlowBoxChild { - if fbc == nil || fbc.GObject == nil { - return nil - } - p := unsafe.Pointer(fbc.GObject) - return C.toGtkFlowBoxChild(p) -} - -func marshalFlowBoxChild(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapFlowBoxChild(obj), nil -} - -func wrapFlowBoxChild(obj *glib.Object) *FlowBoxChild { - return &FlowBoxChild{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// FlowBoxChildNew is a wrapper around gtk_flow_box_child_new() -func FlowBoxChildNew() (*FlowBoxChild, error) { - c := C.gtk_flow_box_child_new() - if c == nil { - return nil, nilPtrErr - } - return wrapFlowBoxChild(glib.Take(unsafe.Pointer(c))), nil -} - -// GetIndex is a wrapper around gtk_flow_box_child_get_index() -func (fbc *FlowBoxChild) GetIndex() int { - c := C.gtk_flow_box_child_get_index(fbc.native()) - return int(c) -} - -// IsSelected is a wrapper around gtk_flow_box_child_is_selected() -func (fbc *FlowBoxChild) IsSelected() bool { - c := C.gtk_flow_box_child_is_selected(fbc.native()) - return gobool(c) -} - -// Changed is a wrapper around gtk_flow_box_child_changed() -func (fbc *FlowBoxChild) Changed() { - C.gtk_flow_box_child_changed(fbc.native()) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_12.go.h b/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_12.go.h deleted file mode 100644 index 92992fe..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_12.go.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> - * - * This file originated from: http://opensource.conformal.com/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -static GtkFlowBox * -toGtkFlowBox(void *p) -{ - return (GTK_FLOW_BOX(p)); -} - -static GtkFlowBoxChild * -toGtkFlowBoxChild(void *p) -{ - return (GTK_FLOW_BOX_CHILD(p)); -}
\ No newline at end of file diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_16.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_16.go deleted file mode 100644 index b6b88cc..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_16.go +++ /dev/null @@ -1,126 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12,!gtk_3_14 - -// See: https://developer.gnome.org/gtk3/3.16/api-index-3-16.html - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk_since_3_16.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - - // Objects/Interfaces - {glib.Type(C.gtk_stack_sidebar_get_type()), marshalStackSidebar}, - } - glib.RegisterGValueMarshalers(tm) - - //Contribute to casting - for k, v := range map[string]WrapFn{ - "GtkStackSidebar": wrapStackSidebar, - } { - WrapMap[k] = v - } -} - -// SetOverlayScrolling is a wrapper around gtk_scrolled_window_set_overlay_scrolling(). -func (v *ScrolledWindow) SetOverlayScrolling(scrolling bool) { - C.gtk_scrolled_window_set_overlay_scrolling(v.native(), gbool(scrolling)) -} - -// GetOverlayScrolling is a wrapper around gtk_scrolled_window_get_overlay_scrolling(). -func (v *ScrolledWindow) GetOverlayScrolling() bool { - return gobool(C.gtk_scrolled_window_get_overlay_scrolling(v.native())) -} - -// SetWideHandle is a wrapper around gtk_paned_set_wide_handle(). -func (v *Paned) SetWideHandle(wide bool) { - C.gtk_paned_set_wide_handle(v.native(), gbool(wide)) -} - -// GetWideHandle is a wrapper around gtk_paned_get_wide_handle(). -func (v *Paned) GetWideHandle() bool { - return gobool(C.gtk_paned_get_wide_handle(v.native())) -} - -// GetXAlign is a wrapper around gtk_label_get_xalign(). -func (v *Label) GetXAlign() float64 { - c := C.gtk_label_get_xalign(v.native()) - return float64(c) -} - -// GetYAlign is a wrapper around gtk_label_get_yalign(). -func (v *Label) GetYAlign() float64 { - c := C.gtk_label_get_yalign(v.native()) - return float64(c) -} - -// SetXAlign is a wrapper around gtk_label_set_xalign(). -func (v *Label) SetXAlign(n float64) { - C.gtk_label_set_xalign(v.native(), C.gfloat(n)) -} - -// SetYAlign is a wrapper around gtk_label_set_yalign(). -func (v *Label) SetYAlign(n float64) { - C.gtk_label_set_yalign(v.native(), C.gfloat(n)) -} - -/* - * GtkStackSidebar - */ - -// StackSidebar is a representation of GTK's GtkStackSidebar. -type StackSidebar struct { - Bin -} - -// native returns a pointer to the underlying GtkStack. -func (v *StackSidebar) native() *C.GtkStackSidebar { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkStackSidebar(p) -} - -func marshalStackSidebar(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapStackSidebar(obj), nil -} - -func wrapStackSidebar(obj *glib.Object) *StackSidebar { - return &StackSidebar{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// StackSidebarNew is a wrapper around gtk_stack_sidebar_new(). -func StackSidebarNew() (*StackSidebar, error) { - c := C.gtk_stack_sidebar_new() - if c == nil { - return nil, nilPtrErr - } - return wrapStackSidebar(glib.Take(unsafe.Pointer(c))), nil -} - -func (v *StackSidebar) SetStack(stack *Stack) { - C.gtk_stack_sidebar_set_stack(v.native(), stack.native()) -} - -func (v *StackSidebar) GetStack() *Stack { - c := C.gtk_stack_sidebar_get_stack(v.native()) - if c == nil { - return nil - } - return wrapStack(glib.Take(unsafe.Pointer(c))) -} - -// GrabFocusWithoutSelecting is a wrapper for gtk_entry_grab_focus_without_selecting() -func (v *Entry) GrabFocusWithoutSelecting() { - C.gtk_entry_grab_focus_without_selecting(v.native()) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_16.go.h b/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_16.go.h deleted file mode 100644 index c2e0222..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_16.go.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> - * - * This file originated from: http://opensource.conformal.com/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -static GtkStackSidebar * -toGtkStackSidebar(void *p) -{ - return (GTK_STACK_SIDEBAR(p)); -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_18.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_18.go deleted file mode 100644 index 1f67e90..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_18.go +++ /dev/null @@ -1,29 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12,!gtk_3_14,!gtk_3_16,gtk_3_18 - -// See: https://developer.gnome.org/gtk3/3.18/api-index-3-18.html - -// For gtk_overlay_reorder_overlay(): -// See: https://git.gnome.org/browse/gtk+/tree/gtk/gtkoverlay.h?h=gtk-3-18 - -package gtk - -// #include <gtk/gtk.h> -import "C" - -// ReorderOverlay() is a wrapper around gtk_overlay_reorder_overlay(). -func (v *Overlay) ReorderOverlay(child IWidget, position int) { - C.gtk_overlay_reorder_overlay(v.native(), child.toWidget(), C.gint(position)) -} - -// GetOverlayPassThrough() is a wrapper around -// gtk_overlay_get_overlay_pass_through(). -func (v *Overlay) GetOverlayPassThrough(widget IWidget) bool { - c := C.gtk_overlay_get_overlay_pass_through(v.native(), widget.toWidget()) - return gobool(c) -} - -// SetOverlayPassThrough() is a wrapper around -// gtk_overlay_set_overlay_pass_through(). -func (v *Overlay) SetOverlayPassThrough(widget IWidget, passThrough bool) { - C.gtk_overlay_set_overlay_pass_through(v.native(), widget.toWidget(), gbool(passThrough)) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_20.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_20.go deleted file mode 100644 index 797191c..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_20.go +++ /dev/null @@ -1,207 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12,!gtk_3_14,!gtk_3_16,!gtk_3_18 - -// See: https://developer.gnome.org/gtk3/3.20/api-index-3-20.html - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk_since_3_20.go.h" -import "C" - -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -/* - * GtkNativeDialog - */ - -// NativeDialog is a representation of GTK's GtkNativeDialog. -type NativeDialog struct { - glib.InitiallyUnowned -} - -// native returns a pointer to the underlying GObject as a GtkNativeDialog. -func (v *NativeDialog) native() *C.GtkNativeDialog { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkNativeDialog(p) -} - -func wrapNativeDialog(obj *glib.Object) *NativeDialog { - return &NativeDialog{glib.InitiallyUnowned{obj}} -} - -// Run() is a wrapper around gtk_native_dialog_run(). -func (v *NativeDialog) Run() int { - c := C.gtk_native_dialog_run(v.native()) - return int(c) -} - -// Destroy() is a wrapper around gtk_native_dialog_destroy(). -func (v *NativeDialog) Destroy() { - C.gtk_native_dialog_destroy(v.native()) -} - -// SetModal is a wrapper around gtk_native_dialog_set_modal(). -func (v *NativeDialog) SetModal(modal bool) { - C.gtk_native_dialog_set_modal(v.native(), gbool(modal)) -} - -// GetModal() is a wrapper around gtk_native_dialog_get_modal(). -func (v *NativeDialog) GetModal() bool { - c := C.gtk_native_dialog_get_modal(v.native()) - return gobool(c) -} - -// SetTitle is a wrapper around gtk_native_dialog_set_title(). -func (v *NativeDialog) SetTitle(title string) { - cstr := C.CString(title) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_native_dialog_set_title(v.native(), (*C.char)(cstr)) -} - -// GetTitle() is a wrapper around gtk_native_dialog_get_title(). -func (v *NativeDialog) GetTitle() (string, error) { - return stringReturn((*C.gchar)(C.gtk_native_dialog_get_title(v.native()))) -} - -// SetTransientFor() is a wrapper around gtk_native_dialog_set_transient_for(). -func (v *NativeDialog) SetTransientFor(parent IWindow) { - var pw *C.GtkWindow = nil - if parent != nil { - pw = parent.toWindow() - } - C.gtk_native_dialog_set_transient_for(v.native(), pw) -} - -// GetTransientFor() is a wrapper around gtk_native_dialog_get_transient_for(). -func (v *NativeDialog) GetTransientFor() (*Window, error) { - c := C.gtk_native_dialog_get_transient_for(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapWindow(glib.Take(unsafe.Pointer(c))), nil -} - -// GetVisible() is a wrapper around gtk_native_dialog_get_visible(). -func (v *NativeDialog) GetVisible() bool { - c := C.gtk_native_dialog_get_visible(v.native()) - return gobool(c) -} - -// Show() is a wrapper around gtk_native_dialog_show(). -func (v *NativeDialog) Show() { - C.gtk_native_dialog_show(v.native()) -} - -// Hide() is a wrapper around gtk_native_dialog_hide(). -func (v *NativeDialog) Hide() { - C.gtk_native_dialog_hide(v.native()) -} - -/* - * GtkFileChooserNative - */ - -// FileChooserNativeDialog is a representation of GTK's GtkFileChooserNative. -type FileChooserNativeDialog struct { - NativeDialog - - // Interfaces - FileChooser -} - -// native returns a pointer to the underlying GObject as a GtkNativeDialog. -func (v *FileChooserNativeDialog) native() *C.GtkFileChooserNative { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkFileChooserNative(p) -} - -func wrapFileChooserNativeDialog(obj *glib.Object) *FileChooserNativeDialog { - fc := wrapFileChooser(obj) - return &FileChooserNativeDialog{NativeDialog{glib.InitiallyUnowned{obj}}, *fc} -} - -// FileChooserNativeDialogNew is a wrapper around gtk_file_chooser_native_new(). -func FileChooserNativeDialogNew( - title string, - parent *Window, - action FileChooserAction, - accept_label string, - cancel_label string) (*FileChooserNativeDialog, error) { - c_title := C.CString(title) - defer C.free(unsafe.Pointer(c_title)) - c_accept_label := C.CString(accept_label) - defer C.free(unsafe.Pointer(c_accept_label)) - c_cancel_label := C.CString(cancel_label) - defer C.free(unsafe.Pointer(c_cancel_label)) - c := C.gtk_file_chooser_native_new( - (*C.gchar)(c_title), parent.native(), C.GtkFileChooserAction(action), - (*C.gchar)(c_accept_label), (*C.gchar)(c_cancel_label)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapFileChooserNativeDialog(obj), nil -} - -/* - * FileChooserNative - */ -func OpenFileChooserNative(title string, parent_window *Window) *string { - c_title := C.CString(title) - - var native *C.GtkFileChooserNative - - native = C.gtk_file_chooser_native_new((*C.gchar)(c_title), - parent_window.native(), - C.GtkFileChooserAction(FILE_CHOOSER_ACTION_OPEN), - (*C.gchar)(C.CString("_Open")), - (*C.gchar)(C.CString("_Cancel"))) - - p := unsafe.Pointer(unsafe.Pointer(native)) - dlg := C.toGtkNativeDialog(p) - res := C.gtk_native_dialog_run(dlg) - - if res == C.GTK_RESPONSE_ACCEPT { - c := C.gtk_file_chooser_get_filename(C.toGtkFileChooser(p)) - s := goString(c) - defer C.g_free((C.gpointer)(c)) - - return &s - } - - return nil -} - -// SetAcceptLabel is a wrapper around gtk_file_chooser_native_set_accept_label(). -func (v *FileChooserNativeDialog) SetAcceptLabel(accept_label string) { - cstr := C.CString(accept_label) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_file_chooser_native_set_accept_label(v.native(), (*C.char)(cstr)) -} - -// GetAcceptLabel() is a wrapper around gtk_file_chooser_native_get_accept_label(). -func (v *FileChooserNativeDialog) GetAcceptLabel() (string, error) { - return stringReturn((*C.gchar)(C.gtk_file_chooser_native_get_accept_label(v.native()))) -} - -// SetCancelLabel is a wrapper around gtk_file_chooser_native_set_cancel_label(). -func (v *FileChooserNativeDialog) SetCancelLabel(cancel_label string) { - cstr := C.CString(cancel_label) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_file_chooser_native_set_cancel_label(v.native(), (*C.char)(cstr)) -} - -// GetCancelLabel() is a wrapper around gtk_file_chooser_native_get_cancel_label(). -func (v *FileChooserNativeDialog) GetCancelLabel() (string, error) { - return stringReturn((*C.gchar)(C.gtk_file_chooser_native_get_cancel_label(v.native()))) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_20.go.h b/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_20.go.h deleted file mode 100644 index fc903dc..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_20.go.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> - * - * This file originated from: http://opensource.conformal.com/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#pragma once - -#include <stdlib.h> - -static GtkFileChooser * -toGtkFileChooser(void *p) -{ - return (GTK_FILE_CHOOSER(p)); -} - -static GtkFileChooserNative * -toGtkFileChooserNative(void *p) -{ - return (GTK_FILE_CHOOSER_NATIVE(p)); -} - -static GtkNativeDialog * -toGtkNativeDialog(void *p) -{ - return (GTK_NATIVE_DIALOG(p)); -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_8.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_8.go deleted file mode 100644 index 21ffa40..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_since_3_8.go +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// This file includes wrapers for symbols included since GTK 3.8, and -// and should not be included in a build intended to target any older GTK -// versions. To target an older build, such as 3.8, use -// 'go build -tags gtk_3_8'. Otherwise, if no build tags are used, GTK 3.18 -// is assumed and this file is built. -// +build !gtk_3_6 - -package gtk - -// #include <gtk/gtk.h> -import "C" - -/* - * Constants - */ - -const ( - STATE_FLAG_DIR_LTR StateFlags = C.GTK_STATE_FLAG_DIR_LTR - STATE_FLAG_DIR_RTL StateFlags = C.GTK_STATE_FLAG_DIR_RTL -) diff --git a/vendor/github.com/gotk3/gotk3/gtk/gtk_test.go b/vendor/github.com/gotk3/gotk3/gtk/gtk_test.go deleted file mode 100644 index bde4d0e..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/gtk_test.go +++ /dev/null @@ -1,739 +0,0 @@ -/* - * Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> - * - * This file originated from: http://opensource.conformal.com/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package gtk - -import ( - "fmt" - "log" - "testing" - "time" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" -) - -func init() { - Init(nil) -} - -// TestBoolConvs tests the conversion between Go bools and gboolean -// types. -func TestBoolConvs(t *testing.T) { - if err := testBoolConvs(); err != nil { - t.Error(err) - } -} - -// TestBox tests creating and adding widgets to a Box -func TestBox(t *testing.T) { - vbox, err := BoxNew(ORIENTATION_VERTICAL, 0) - if err != nil { - t.Error("Unable to create box") - } - - vbox.Set("homogeneous", true) - if vbox.GetHomogeneous() != true { - t.Error("Could not set or get Box homogeneous property") - } - - vbox.SetHomogeneous(false) - if vbox.GetHomogeneous() != false { - t.Error("Could not set or get Box homogeneous property") - } - - vbox.Set("spacing", 1) - if vbox.GetSpacing() != 1 { - t.Error("Could not set or get Box spacing") - } - - vbox.SetSpacing(2) - if vbox.GetSpacing() != 2 { - t.Error("Could not set or get Box spacing") - } - - // add a child to start and end - start, err := LabelNew("Start") - if err != nil { - t.Error("Unable to create label") - } - - end, err := LabelNew("End") - if err != nil { - t.Error("Unable to create label") - } - - vbox.PackStart(start, true, true, 3) - vbox.PackEnd(end, true, true, 3) -} -func TestTextBuffer_WhenSetText_ExpectGetTextReturnsSame(t *testing.T) { - buffer, err := TextBufferNew(nil) - if err != nil { - t.Error("Unable to create text buffer") - } - expected := "Hello, World!" - buffer.SetText(expected) - - start, end := buffer.GetBounds() - - actual, err := buffer.GetText(start, end, true) - if err != nil { - t.Error("Unable to get text from buffer") - } - - if actual != expected { - t.Errorf("Expected '%s'; Got '%s'", expected, actual) - } -} - -func testTextViewEditable(set bool) error { - tv, err := TextViewNew() - if err != nil { - return err - } - - exp := set - tv.SetEditable(exp) - act := tv.GetEditable() - if exp != act { - return fmt.Errorf("Expected GetEditable(): %v; Got: %v", exp, act) - } - return nil -} - -func TestTextView_WhenSetEditableFalse_ExpectGetEditableReturnsFalse(t *testing.T) { - if err := testTextViewEditable(false); err != nil { - t.Error(err) - } -} - -func TestTextView_WhenSetEditableTrue_ExpectGetEditableReturnsTrue(t *testing.T) { - if err := testTextViewEditable(true); err != nil { - t.Error(err) - } -} - -func testTextViewWrapMode(set WrapMode) error { - tv, err := TextViewNew() - if err != nil { - return err - } - - exp := set - tv.SetWrapMode(set) - act := tv.GetWrapMode() - if act != exp { - return fmt.Errorf("Expected GetWrapMode(): %v; Got: %v", exp, act) - } - return nil -} - -func TestTextView_WhenSetWrapModeNone_ExpectGetWrapModeReturnsNone(t *testing.T) { - if err := testTextViewWrapMode(WRAP_NONE); err != nil { - t.Error(err) - } -} - -func TestTextView_WhenSetWrapModeWord_ExpectGetWrapModeReturnsWord(t *testing.T) { - if err := testTextViewWrapMode(WRAP_WORD); err != nil { - t.Error(err) - } -} - -func testTextViewCursorVisible(set bool) error { - tv, err := TextViewNew() - if err != nil { - return err - } - - exp := set - tv.SetCursorVisible(set) - act := tv.GetCursorVisible() - if act != exp { - return fmt.Errorf("Expected GetCursorVisible(): %v; Got: %v", exp, act) - } - return nil -} - -func TestTextView_WhenSetCursorVisibleFalse_ExpectGetCursorVisibleReturnsFalse(t *testing.T) { - if err := testTextViewCursorVisible(false); err != nil { - t.Error(err) - } -} - -func TestTextView_WhenSetCursorVisibleTrue_ExpectGetCursorVisibleReturnsTrue(t *testing.T) { - if err := testTextViewCursorVisible(true); err != nil { - t.Error(err) - } -} - -func testTextViewOverwrite(set bool) error { - tv, err := TextViewNew() - if err != nil { - return err - } - - exp := set - tv.SetOverwrite(set) - act := tv.GetOverwrite() - if act != exp { - return fmt.Errorf("Expected GetOverwrite(): %v; Got: %v", exp, act) - } - return nil -} - -func TestTextView_WhenSetOverwriteFalse_ExpectGetOverwriteReturnsFalse(t *testing.T) { - if err := testTextViewOverwrite(false); err != nil { - t.Error(err) - } -} - -func TestTextView_WhenSetOverwriteTrue_ExpectGetOverwriteReturnsTrue(t *testing.T) { - if err := testTextViewOverwrite(true); err != nil { - t.Error(err) - } -} - -func testTextViewJustification(justify Justification) error { - tv, err := TextViewNew() - if err != nil { - return err - } - - exp := justify - tv.SetJustification(justify) - act := tv.GetJustification() - if act != exp { - return fmt.Errorf("Expected GetJustification(): %v; Got: %v", exp, act) - } - return nil -} - -func TestTextView_WhenSetJustificationLeft_ExpectGetJustificationReturnsLeft(t *testing.T) { - if err := testTextViewJustification(JUSTIFY_LEFT); err != nil { - t.Error(err) - } -} - -func TestTextView_WhenSetJustificationRight_ExpectGetJustificationReturnsRight(t *testing.T) { - if err := testTextViewJustification(JUSTIFY_RIGHT); err != nil { - t.Error(err) - } -} - -func testTextViewAcceptsTab(set bool) error { - tv, err := TextViewNew() - if err != nil { - return err - } - - exp := set - tv.SetAcceptsTab(set) - if act := tv.GetAcceptsTab(); act != exp { - return fmt.Errorf("Expected GetAcceptsTab(): %v; Got: %v", exp, act) - } - return nil -} - -func TestTextView_WhenSetAcceptsTabFalse_ExpectGetAcceptsTabReturnsFalse(t *testing.T) { - if err := testTextViewAcceptsTab(false); err != nil { - t.Error(err) - } -} - -func TestTextView_WhenSetAcceptsTabTrue_ExpectGetAcceptsTabReturnsTrue(t *testing.T) { - if err := testTextViewAcceptsTab(true); err != nil { - t.Error(err) - } -} - -func testIntProperty(val int, set func(int), get func() int) error { - set(val) - if exp, act := val, get(); act != exp { - return fmt.Errorf("Expected: %d; got: %d", exp, act) - } - return nil -} - -func testTextViewPixelsAboveLines(px int) error { - tv, err := TextViewNew() - if err != nil { - return err - } - return testIntProperty(px, (*tv).SetPixelsAboveLines, (*tv).GetPixelsAboveLines) -} - -func TestTextView_WhenSetPixelsAboveLines10_ExpectGetPixelsAboveLinesReturns10(t *testing.T) { - if err := testTextViewPixelsAboveLines(10); err != nil { - t.Error(err) - } -} - -func TestTextView_WhenSetPixelsAboveLines11_ExpectGetPixelsAboveLinesReturns11(t *testing.T) { - if err := testTextViewPixelsAboveLines(11); err != nil { - t.Error(err) - } -} - -func testTextViewPixelsBelowLines(px int) error { - tv, err := TextViewNew() - if err != nil { - return err - } - return testIntProperty(px, (*tv).SetPixelsBelowLines, (*tv).GetPixelsBelowLines) -} - -func TestTextView_WhenSetPixelsBelowLines10_ExpectGetPixelsAboveLinesReturns10(t *testing.T) { - if err := testTextViewPixelsBelowLines(10); err != nil { - t.Error(err) - } -} - -func TestTextView_WhenSetPixelsBelowLines11_ExpectGetPixelsBelowLinesReturns11(t *testing.T) { - if err := testTextViewPixelsBelowLines(11); err != nil { - t.Error(err) - } -} - -func testTextViewPixelsInsideWrap(px int) error { - tv, err := TextViewNew() - if err != nil { - return err - } - - return testIntProperty(px, (*tv).SetPixelsInsideWrap, (*tv).GetPixelsInsideWrap) -} - -func TestTextView_WhenSetPixelsInsideWrap10_ExpectGetPixelsInsideWrapReturns11(t *testing.T) { - if err := testTextViewPixelsInsideWrap(10); err != nil { - t.Error(err) - } -} - -func TestTextView_WhenSetPixelsInsideWrap11_ExpectGetPixelsInsideWrapReturns11(t *testing.T) { - if err := testTextViewPixelsInsideWrap(11); err != nil { - t.Error(err) - } -} - -func testTextViewLeftMargin(margin int) error { - tv, err := TextViewNew() - if err != nil { - return err - } - - return testIntProperty(margin, (*tv).SetLeftMargin, (*tv).GetLeftMargin) -} - -func TestTextView_WhenSetLeftMargin11_ExpectGetLeftMarginReturns11(t *testing.T) { - if err := testTextViewLeftMargin(11); err != nil { - t.Error(err) - } -} - -func TestTextView_WhenSetLeftMargin10_ExpectGetLeftMarginReturns10(t *testing.T) { - if err := testTextViewLeftMargin(10); err != nil { - t.Error(err) - } -} - -func testTextViewRightMargin(margin int) error { - tv, err := TextViewNew() - if err != nil { - return err - } - - return testIntProperty(margin, (*tv).SetRightMargin, (*tv).GetRightMargin) -} - -func TestTextView_WhenSetRightMargin10_ExpectGetRightMarginReturns10(t *testing.T) { - if err := testTextViewRightMargin(10); err != nil { - t.Error(err) - } -} - -func TestTextView_WhenSetRightMargin11_ExpectGetRightMarginReturns11(t *testing.T) { - if err := testTextViewRightMargin(11); err != nil { - t.Error(err) - } -} - -func testTextViewIndent(indent int) error { - tv, err := TextViewNew() - if err != nil { - return err - } - - return testIntProperty(indent, (*tv).SetIndent, (*tv).GetIndent) -} - -func TestTextView_WhenSetIndent10_ExpectGetIndentReturns10(t *testing.T) { - if err := testTextViewIndent(10); err != nil { - t.Error(err) - } -} - -func TestTextView_WhenSetIndent11_ExpectGetIndentReturns11(t *testing.T) { - if err := testTextViewIndent(11); err != nil { - t.Error(err) - } -} - -func testTextViewInputHints(hint InputHints) error { - tv, err := TextViewNew() - if err != nil { - return err - } - - tv.SetInputHints(hint) - if exp, act := hint, tv.GetInputHints(); act != exp { - return fmt.Errorf("Expected %v; Got %v", exp, act) - } - return nil -} - -func TestTextView_WhenSetInputHintsNone_ExpectGetInputHintsReturnsNone(t *testing.T) { - if err := testTextViewInputHints(INPUT_HINT_NONE); err != nil { - t.Error(err) - } -} - -func TestTextView_WhenSetInputHintsSpellCheck_ExpectGetInputHintsReturnsSpellCheck(t *testing.T) { - if err := testTextViewInputHints(INPUT_HINT_SPELLCHECK); err != nil { - t.Error(err) - } -} - -func testTextViewInputPurpose(purpose InputPurpose) error { - tv, err := TextViewNew() - if err != nil { - return err - } - - tv.SetInputPurpose(purpose) - if exp, act := purpose, tv.GetInputPurpose(); act != exp { - return fmt.Errorf("Expected %v; Got %v", exp, act) - } - return nil -} - -func TestTextView_WhenSetInputPurposeURL_ExpectGetInputPurposeReturnsURL(t *testing.T) { - if err := testTextViewInputPurpose(INPUT_PURPOSE_URL); err != nil { - t.Error(err) - } -} - -func TestTextView_WhenSetInputPurposeALPHA_ExpectGetInputPurposeReturnsALPHA(t *testing.T) { - if err := testTextViewInputPurpose(INPUT_PURPOSE_ALPHA); err != nil { - t.Error(err) - } -} - -func testCellRendererToggleSetRadio(set bool) error { - renderer, err := CellRendererToggleNew() - if err != nil { - return err - } - - renderer.SetRadio(set) - if exp, act := set, renderer.GetRadio(); act != exp { - return fmt.Errorf("Expected GetRadio(): %v; Got: %v", exp, act) - } - return nil -} - -func TestCellRendererToggle_WhenSetRadioFalse_ExpectGetRadioReturnsFalse(t *testing.T) { - if err := testCellRendererToggleSetRadio(false); err != nil { - t.Error(err) - } -} - -func TestCellRendererToggle_WhenSetRadioTrue_ExpectGetRadioReturnsTrue(t *testing.T) { - if err := testCellRendererToggleSetRadio(true); err != nil { - t.Error(err) - } -} - -func testCellRendererToggleSetActive(set bool) error { - renderer, err := CellRendererToggleNew() - if err != nil { - return err - } - - renderer.SetActive(set) - if exp, act := set, renderer.GetActive(); act != exp { - return fmt.Errorf("Expected GetActive(): %v; Got: %v", exp, act) - } - return nil -} - -func TestCellRendererToggle_WhenSetActiveFalse_ExpectGetActiveReturnsFalse(t *testing.T) { - if err := testCellRendererToggleSetActive(false); err != nil { - t.Error(err) - } -} - -func TestCellRendererToggle_WhenSetActiveTrue_ExpectGetActiveReturnsTrue(t *testing.T) { - if err := testCellRendererToggleSetActive(true); err != nil { - t.Error(err) - } -} - -func testCellRendererToggleSetActivatable(set bool) error { - renderer, err := CellRendererToggleNew() - if err != nil { - return err - } - - renderer.SetActivatable(set) - if exp, act := set, renderer.GetActivatable(); act != exp { - return fmt.Errorf("Expected GetActivatable(): %v; Got: %v", exp, act) - } - return nil -} - -func TestCellRendererToggle_WhenSetActivatableFalse_ExpectGetActivatableReturnsFalse(t *testing.T) { - if err := testCellRendererToggleSetActivatable(false); err != nil { - t.Error(err) - } -} - -func TestCellRendererToggle_WhenSetActivatableTrue_ExpectGetActivatableReturnsTrue(t *testing.T) { - if err := testCellRendererToggleSetActivatable(true); err != nil { - t.Error(err) - } -} - -func setupListStore() *ListStore { - ls, err := ListStoreNew(glib.TYPE_STRING) - if err != nil { - log.Fatal("Unexpected err:", err) - } - return ls -} - -func getLastIter(ls *ListStore) (*TreeIter, bool) { - iter, listIsntEmpty := ls.GetIterFirst() - if !listIsntEmpty { - return iter, listIsntEmpty - } - - for { - temp := *iter - last := &temp - if !ls.IterNext(iter) { - return last, true - } - } - - panic("Shouldn't get here") -} - -// TestListStoreRemoveLastInvalidIterator tests that when a ListStore stores -// one item and it is removed, the iterator becomes invalid. -func TestListStoreRemoveLastInvalidIterator(t *testing.T) { - ls := setupListStore() - - iter := ls.Append() - - if iterValid := ls.Remove(iter); iterValid { - t.Fatal("Remove() returned true (iter valid); expected false (iter invalid)") - } -} - -func TestListStoreInsertBefore(t *testing.T) { - ls := setupListStore() - - // Given 1 iter is already in the liststore - initialIter := ls.Append() - - // When another iter is inserted before it - newIter := ls.InsertBefore(initialIter) - - // Expect the newly-inserted iter is first iter in list - firstIter, listIsntEmpty := ls.GetIterFirst() - if !listIsntEmpty { - t.Fatal("Unexpected: liststore is empty") - } - - if *firstIter != *newIter { - t.Fatal("Expected the new iter added to front of list") - } -} - -// When 'sibling' parameter is nil, the new iter should be appended to the liststore -func TestListStoreInsertBefore_WhenNilSibling(t *testing.T) { - ls := setupListStore() - - // Given 2 iters in liststore - ls.Append() - ls.Append() - - // When 'sibling' parameter of InsertBefore() is nil... - newIter := ls.InsertBefore(nil) - - // Then expect newly-inserted iter is the first iter in list - lastIter, listIsntEmpty := getLastIter(ls) - if !listIsntEmpty { - t.Fatal("Unexpected: liststore is empty") - } - - if *lastIter != *newIter { - t.Fatal("Expected the new iter added to end of list") - } -} - -func TestListStoreInsertAfter(t *testing.T) { - ls := setupListStore() - - // Given 1 iter in liststore - sibling := ls.Append() - - // When InsertAfter(sibling) - newIter := ls.InsertAfter(sibling) - - // Then expect newly-inserted iter is the last iter in list - lastIter, listIsntEmpty := getLastIter(ls) - if !listIsntEmpty { - t.Fatal("Unexpected: liststore is empty") - } - - if *lastIter != *newIter { - t.Fatal("Expected the new iter added to end of list") - } -} - -// When 'sibling' parameter is nil, the new iter should be prepended to the liststore -func TestListStoreInsertAfter_WhenNilSibling(t *testing.T) { - ls := setupListStore() - - // Given 2 iters in liststore - ls.Append() - ls.Append() - - // When InsertAfter(nil) - newIter := ls.InsertAfter(nil) - - // Then expect newly-inserted iter is the first iter in the list - first, listIsntEmpty := ls.GetIterFirst() - if !listIsntEmpty { - t.Fatal("Unexpected: liststore is empty") - } - - if *first != *newIter { - t.Fatal("Expected the new iter was prepended to liststore") - } -} - -func TestBuilder(t *testing.T) { - builder, err := BuilderNew() - if err != nil { - t.Error("Unable to create builder") - } - - str := ` -<interface> - <object class="GtkDialog" id="dialog1"> - <child internal-child="vbox"> - <object class="GtkBox" id="vbox1"> - <property name="border-width">10</property> - <child internal-child="action_area"> - <object class="GtkButtonBox" id="hbuttonbox1"> - <property name="border-width">20</property> - <child> - <object class="GtkButton" id="ok_button"> - <property name="label">gtk-ok</property> - <property name="use-stock">TRUE</property> - <signal name="clicked" handler="ok_button_clicked"/> - </object> - </child> - </object> - </child> - </object> - </child> - </object> -</interface> -` - - err = builder.AddFromString(str) - if err != nil { - t.Error("Unable to add from string") - } - - widget, err := builder.GetObject("ok_button") - if err != nil { - t.Error("Unable to get widget from string") - } - - button, ok := widget.(*Button) - if !ok { - t.Error("Unable to cast to gtk.Button") - } - - l, err := button.GetLabel() - if err != nil { - t.Error("Unable to get button label") - } - - if l != "gtk-ok" { - t.Errorf("Label has the wrong value: %q", l) - } - - done := make(chan bool) - - builder.ConnectSignals(map[string]interface{}{ - "ok_button_clicked": func() { - done <- true - }, - }) - - go button.Emit("clicked") - - select { - case <-done: - case <-time.After(1 * time.Second): - t.Error("Failed to call callback") - } -} - -func TestTextTagEvent(t *testing.T) { - textTag, err := TextTagNew("mytexttag") - if err != nil { - t.Error("could not create text tag") - } - - evk := gdk.EventKeyNew() - - var iter TextIter - ok := textTag.Event(textTag.Object, evk.Event, &iter) - - if ok { - t.Error("event should not have been handled") - } - - textTag.Connect("event", func() bool { - return true - }) - - ok = textTag.Event(textTag.Object, evk.Event, &iter) - - if !ok { - t.Error("event should have been handled") - } - -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/icon_view.go b/vendor/github.com/gotk3/gotk3/gtk/icon_view.go deleted file mode 100644 index 5b4f41f..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/icon_view.go +++ /dev/null @@ -1,468 +0,0 @@ -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "runtime" - "unsafe" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" -) - -/* - * GtkIconView - */ - -// IconView is a representation of GTK's GtkIconView. -type IconView struct { - Container -} - -// native returns a pointer to the underlying GtkIconView. -func (v *IconView) native() *C.GtkIconView { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkIconView(p) -} - -func marshalIconView(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapIconView(obj), nil -} - -func wrapIconView(obj *glib.Object) *IconView { - return &IconView{Container{Widget{glib.InitiallyUnowned{obj}}}} -} - -// IconViewNew is a wrapper around gtk_icon_view_new(). -func IconViewNew() (*IconView, error) { - c := C.gtk_icon_view_new() - if c == nil { - return nil, nilPtrErr - } - - return wrapIconView(glib.Take(unsafe.Pointer(c))), nil -} - -// IconViewNewWithModel is a wrapper around gtk_icon_view_new_with_model(). -func IconViewNewWithModel(model ITreeModel) (*IconView, error) { - c := C.gtk_icon_view_new_with_model(model.toTreeModel()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapIconView(obj), nil -} - -// SetModel is a wrapper around gtk_icon_view_set_model(). -func (v *IconView) SetModel(model ITreeModel) { - C.gtk_icon_view_set_model(v.native(), model.toTreeModel()) -} - -// GetModel is a wrapper around gtk_icon_view_get_model(). -func (v *IconView) GetModel() (*TreeModel, error) { - c := C.gtk_icon_view_get_model(v.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapTreeModel(obj), nil -} - -// SetTextColumn is a wrapper around gtk_icon_view_set_text_column(). -func (v *IconView) SetTextColumn(column int) { - C.gtk_icon_view_set_text_column(v.native(), C.gint(column)) -} - -// GetTextColumn is a wrapper around gtk_icon_view_get_text_column(). -func (v *IconView) GetTextColumn() int { - return int(C.gtk_icon_view_get_text_column(v.native())) -} - -// SetMarkupColumn is a wrapper around gtk_icon_view_set_markup_column(). -func (v *IconView) SetMarkupColumn(column int) { - C.gtk_icon_view_set_markup_column(v.native(), C.gint(column)) -} - -// GetMarkupColumn is a wrapper around gtk_icon_view_get_markup_column(). -func (v *IconView) GetMarkupColumn() int { - return int(C.gtk_icon_view_get_markup_column(v.native())) -} - -// SetPixbufColumn is a wrapper around gtk_icon_view_set_pixbuf_column(). -func (v *IconView) SetPixbufColumn(column int) { - C.gtk_icon_view_set_pixbuf_column(v.native(), C.gint(column)) -} - -// GetPixbufColumn is a wrapper around gtk_icon_view_get_pixbuf_column(). -func (v *IconView) GetPixbufColumn() int { - return int(C.gtk_icon_view_get_pixbuf_column(v.native())) -} - -// GetPathAtPos is a wrapper around gtk_icon_view_get_path_at_pos(). -func (v *IconView) GetPathAtPos(x, y int) *TreePath { - var ( - cpath *C.GtkTreePath - path *TreePath - ) - - cpath = C.gtk_icon_view_get_path_at_pos(v.native(), C.gint(x), C.gint(y)) - - if cpath != nil { - path = &TreePath{cpath} - runtime.SetFinalizer(path, (*TreePath).free) - } - - return path -} - -// GetItemAtPos is a wrapper around gtk_icon_view_get_item_at_pos(). -func (v *IconView) GetItemAtPos(x, y int) (*TreePath, *CellRenderer) { - var ( - cpath *C.GtkTreePath - ccell *C.GtkCellRenderer - path *TreePath - cell *CellRenderer - ) - - C.gtk_icon_view_get_item_at_pos(v.native(), C.gint(x), C.gint(y), &cpath, &ccell) - - if cpath != nil { - path = &TreePath{cpath} - runtime.SetFinalizer(path, (*TreePath).free) - } - - if ccell != nil { - cell = wrapCellRenderer(glib.Take(unsafe.Pointer(ccell))) - } - - return path, cell -} - -// ConvertWidgetToBinWindowCoords is a wrapper around gtk_icon_view_convert_widget_to_bin_window_coords(). -func (v *IconView) ConvertWidgetToBinWindowCoords(x, y int) (int, int) { - var bx, by C.gint - - C.gtk_icon_view_convert_widget_to_bin_window_coords(v.native(), C.gint(x), C.gint(y), &bx, &by) - - return int(bx), int(by) -} - -// SetCursor is a wrapper around gtk_icon_view_set_selection_mode(). -func (v *IconView) SetCursor(path *TreePath, cell *CellRenderer, startEditing bool) { - C.gtk_icon_view_set_cursor(v.native(), path.native(), cell.native(), gbool(startEditing)) -} - -// GetCursor is a wrapper around gtk_icon_view_get_cursor(). -func (v *IconView) GetCursor() (*TreePath, *CellRenderer) { - var ( - cpath *C.GtkTreePath - ccell *C.GtkCellRenderer - path *TreePath - cell *CellRenderer - ) - - C.gtk_icon_view_get_cursor(v.native(), &cpath, &ccell) - - if cpath != nil { - path = &TreePath{cpath} - runtime.SetFinalizer(path, (*TreePath).free) - } - - if ccell != nil { - cell = wrapCellRenderer(glib.Take(unsafe.Pointer(ccell))) - } - - return path, cell -} - -// func (v *IconView) SelectedForeach() {} - -// SetSelectionMode is a wrapper around gtk_icon_view_set_selection_mode(). -func (v *IconView) SetSelectionMode(mode SelectionMode) { - C.gtk_icon_view_set_selection_mode(v.native(), C.GtkSelectionMode(mode)) -} - -// GetSelectionMode is a wrapper around gtk_icon_view_get_selection_mode(). -func (v *IconView) GetSelectionMode() SelectionMode { - return SelectionMode(C.gtk_icon_view_get_selection_mode(v.native())) -} - -// SetItemOrientation is a wrapper around gtk_icon_view_set_item_orientation(). -func (v *IconView) SetItemOrientation(orientation Orientation) { - C.gtk_icon_view_set_item_orientation(v.native(), C.GtkOrientation(orientation)) -} - -// GetItemOrientation is a wrapper around gtk_icon_view_get_item_orientation(). -func (v *IconView) GetItemOrientation() Orientation { - return Orientation(C.gtk_icon_view_get_item_orientation(v.native())) -} - -// SetColumns is a wrapper around gtk_icon_view_set_columns(). -func (v *IconView) SetColumns(columns int) { - C.gtk_icon_view_set_columns(v.native(), C.gint(columns)) -} - -// GetColumns is a wrapper around gtk_icon_view_get_columns(). -func (v *IconView) GetColumns() int { - return int(C.gtk_icon_view_get_columns(v.native())) -} - -// SetItemWidth is a wrapper around gtk_icon_view_set_item_width(). -func (v *IconView) SetItemWidth(width int) { - C.gtk_icon_view_set_item_width(v.native(), C.gint(width)) -} - -// GetItemWidth is a wrapper around gtk_icon_view_get_item_width(). -func (v *IconView) GetItemWidth() int { - return int(C.gtk_icon_view_get_item_width(v.native())) -} - -// SetSpacing is a wrapper around gtk_icon_view_set_spacing(). -func (v *IconView) SetSpacing(spacing int) { - C.gtk_icon_view_set_spacing(v.native(), C.gint(spacing)) -} - -// GetSpacing is a wrapper around gtk_icon_view_get_spacing(). -func (v *IconView) GetSpacing() int { - return int(C.gtk_icon_view_get_spacing(v.native())) -} - -// SetRowSpacing is a wrapper around gtk_icon_view_set_row_spacing(). -func (v *IconView) SetRowSpacing(rowSpacing int) { - C.gtk_icon_view_set_row_spacing(v.native(), C.gint(rowSpacing)) -} - -// GetRowSpacing is a wrapper around gtk_icon_view_get_row_spacing(). -func (v *IconView) GetRowSpacing() int { - return int(C.gtk_icon_view_get_row_spacing(v.native())) -} - -// SetColumnSpacing is a wrapper around gtk_icon_view_set_column_spacing(). -func (v *IconView) SetColumnSpacing(columnSpacing int) { - C.gtk_icon_view_set_column_spacing(v.native(), C.gint(columnSpacing)) -} - -// GetColumnSpacing is a wrapper around gtk_icon_view_get_column_spacing(). -func (v *IconView) GetColumnSpacing() int { - return int(C.gtk_icon_view_get_column_spacing(v.native())) -} - -// SetMargin is a wrapper around gtk_icon_view_set_margin(). -func (v *IconView) SetMargin(margin int) { - C.gtk_icon_view_set_margin(v.native(), C.gint(margin)) -} - -// GetMargin is a wrapper around gtk_icon_view_get_margin(). -func (v *IconView) GetMargin() int { - return int(C.gtk_icon_view_get_margin(v.native())) -} - -// SetItemPadding is a wrapper around gtk_icon_view_set_item_padding(). -func (v *IconView) SetItemPadding(itemPadding int) { - C.gtk_icon_view_set_item_padding(v.native(), C.gint(itemPadding)) -} - -// GetItemPadding is a wrapper around gtk_icon_view_get_item_padding(). -func (v *IconView) GetItemPadding() int { - return int(C.gtk_icon_view_get_item_padding(v.native())) -} - -// SetActivateOnSingleClick is a wrapper around gtk_icon_view_set_activate_on_single_click(). -func (v *IconView) SetActivateOnSingleClick(single bool) { - C.gtk_icon_view_set_activate_on_single_click(v.native(), gbool(single)) -} - -// ActivateOnSingleClick is a wrapper around gtk_icon_view_get_activate_on_single_click(). -func (v *IconView) ActivateOnSingleClick() bool { - return gobool(C.gtk_icon_view_get_activate_on_single_click(v.native())) -} - -// GetCellRect is a wrapper around gtk_icon_view_get_cell_rect(). -func (v *IconView) GetCellRect(path *TreePath, cell *CellRenderer) *gdk.Rectangle { - var crect C.GdkRectangle - - C.gtk_icon_view_get_cell_rect(v.native(), path.native(), cell.native(), &crect) - - return gdk.WrapRectangle(uintptr(unsafe.Pointer(&crect))) -} - -// SelectPath is a wrapper around gtk_icon_view_select_path(). -func (v *IconView) SelectPath(path *TreePath) { - C.gtk_icon_view_select_path(v.native(), path.native()) -} - -// UnselectPath is a wrapper around gtk_icon_view_unselect_path(). -func (v *IconView) UnselectPath(path *TreePath) { - C.gtk_icon_view_unselect_path(v.native(), path.native()) -} - -// PathIsSelected is a wrapper around gtk_icon_view_path_is_selected(). -func (v *IconView) PathIsSelected(path *TreePath) bool { - return gobool(C.gtk_icon_view_path_is_selected(v.native(), path.native())) -} - -// GetSelectedItems is a wrapper around gtk_icon_view_unselect_path(). -func (v *IconView) GetSelectedItems() *glib.List { - clist := C.gtk_icon_view_get_selected_items(v.native()) - if clist == nil { - return nil - } - - glist := glib.WrapList(uintptr(unsafe.Pointer(clist))) - glist.DataWrapper(func(ptr unsafe.Pointer) interface{} { - return &TreePath{(*C.GtkTreePath)(ptr)} - }) - runtime.SetFinalizer(glist, func(glist *glib.List) { - glist.FreeFull(func(item interface{}) { - path := item.(*TreePath) - C.gtk_tree_path_free(path.GtkTreePath) - }) - }) - - return glist -} - -// SelectAll is a wrapper around gtk_icon_view_select_all(). -func (v *IconView) SelectAll() { - C.gtk_icon_view_select_all(v.native()) -} - -// UnselectAll is a wrapper around gtk_icon_view_unselect_all(). -func (v *IconView) UnselectAll() { - C.gtk_icon_view_unselect_all(v.native()) -} - -// ItemActivated is a wrapper around gtk_icon_view_item_activated(). -func (v *IconView) ItemActivated(path *TreePath) { - C.gtk_icon_view_item_activated(v.native(), path.native()) -} - -// ScrollToPath is a wrapper around gtk_icon_view_scroll_to_path(). -func (v *IconView) ScrollToPath(path *TreePath, useAlign bool, rowAlign, colAlign float64) { - C.gtk_icon_view_scroll_to_path(v.native(), path.native(), gbool(useAlign), - C.gfloat(rowAlign), C.gfloat(colAlign)) -} - -// GetVisibleRange is a wrapper around gtk_icon_view_get_visible_range(). -func (v *IconView) GetVisibleRange() (*TreePath, *TreePath) { - var ( - cpathStart, cpathEnd *C.GtkTreePath - pathStart, pathEnd *TreePath - ) - - C.gtk_icon_view_get_visible_range(v.native(), &cpathStart, &cpathEnd) - - if cpathStart != nil { - pathStart = &TreePath{cpathStart} - runtime.SetFinalizer(pathStart, (*TreePath).free) - } - - if cpathEnd != nil { - pathEnd = &TreePath{cpathEnd} - runtime.SetFinalizer(pathEnd, (*TreePath).free) - } - - return pathStart, pathEnd -} - -// SetTooltipItem is a wrapper around gtk_icon_view_set_tooltip_item(). -func (v *IconView) SetTooltipItem(tooltip *Tooltip, path *TreePath) { - C.gtk_icon_view_set_tooltip_item(v.native(), tooltip.native(), path.native()) -} - -// SetTooltipCell is a wrapper around gtk_icon_view_set_tooltip_cell(). -func (v *IconView) SetTooltipCell(tooltip *Tooltip, path *TreePath, cell *CellRenderer) { - C.gtk_icon_view_set_tooltip_cell(v.native(), tooltip.native(), path.native(), cell.native()) -} - -// GetTooltipContext is a wrapper around gtk_icon_view_get_tooltip_context(). -func (v *IconView) GetTooltipContext(x, y int, keyboardTip bool) (*TreeModel, *TreePath, *TreeIter) { - var ( - cmodel *C.GtkTreeModel - cpath *C.GtkTreePath - citer *C.GtkTreeIter - model *TreeModel - path *TreePath - iter *TreeIter - ) - - px := C.gint(x) - py := C.gint(y) - if !gobool(C.gtk_icon_view_get_tooltip_context(v.native(), - &px, - &py, - gbool(keyboardTip), - &cmodel, - &cpath, - citer, - )) { - return nil, nil, nil - } - - if cmodel != nil { - model = wrapTreeModel(glib.Take(unsafe.Pointer(cmodel))) - } - - if cpath != nil { - path = &TreePath{cpath} - runtime.SetFinalizer(path, (*TreePath).free) - } - - if citer != nil { - iter = &TreeIter{*citer} - runtime.SetFinalizer(iter, (*TreeIter).free) - } - - return model, path, iter -} - -// SetTooltipColumn is a wrapper around gtk_icon_view_set_tooltip_column(). -func (v *IconView) SetTooltipColumn(column int) { - C.gtk_icon_view_set_tooltip_column(v.native(), C.gint(column)) -} - -// GetTooltipColumn is a wrapper around gtk_icon_view_get_tooltip_column(). -func (v *IconView) GetTooltipColumn() int { - return int(C.gtk_icon_view_get_tooltip_column(v.native())) -} - -// GetItemRow is a wrapper around gtk_icon_view_get_item_row(). -func (v *IconView) GetItemRow(path *TreePath) int { - return int(C.gtk_icon_view_get_item_row(v.native(), path.native())) -} - -/* -func (v *IconView) EnableModelDragSource() {} - -func (v *IconView) EnableModelDragDest() {} - -func (v *IconView) UnsetModelDragSource() {} - -func (v *IconView) UnsetModelDragDest() {} -*/ - -// SetReorderable is a wrapper around gtk_icon_view_set_reorderable(). -func (v *IconView) SetReorderable(reorderable bool) { - C.gtk_icon_view_set_reorderable(v.native(), gbool(reorderable)) -} - -// GetReorderable is a wrapper around gtk_icon_view_get_reorderable(). -func (v *IconView) GetReorderable() bool { - return gobool(C.gtk_icon_view_get_reorderable(v.native())) -} - -/* -func (v *IconView) SetDragDestItem() {} - -func (v *IconView) GetDragDestItem() {} - -func (v *IconView) GetDestItemAtPos() {} - -func (v *IconView) CreateDragIcon() {} -*/ diff --git a/vendor/github.com/gotk3/gotk3/gtk/info_bar.go b/vendor/github.com/gotk3/gotk3/gtk/info_bar.go deleted file mode 100644 index ed4c467..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/info_bar.go +++ /dev/null @@ -1,106 +0,0 @@ -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 { - return &InfoBar{Box{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -func InfoBarNew() (*InfoBar, error) { - c := C.gtk_info_bar_new() - if c == nil { - return nil, nilPtrErr - } - - return wrapInfoBar(glib.Take(unsafe.Pointer(c))), nil -} - -func (v *InfoBar) AddActionWidget(w IWidget, responseId ResponseType) { - C.gtk_info_bar_add_action_widget(v.native(), w.toWidget(), C.gint(responseId)) -} - -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)) -} - -func (v *InfoBar) SetResponseSensitive(responseId ResponseType, setting bool) { - C.gtk_info_bar_set_response_sensitive(v.native(), C.gint(responseId), gbool(setting)) -} - -func (v *InfoBar) SetDefaultResponse(responseId ResponseType) { - C.gtk_info_bar_set_default_response(v.native(), C.gint(responseId)) -} - -func (v *InfoBar) SetMessageType(messageType MessageType) { - C.gtk_info_bar_set_message_type(v.native(), C.GtkMessageType(messageType)) -} - -func (v *InfoBar) GetMessageType() MessageType { - messageType := C.gtk_info_bar_get_message_type(v.native()) - return MessageType(messageType) -} - -func (v *InfoBar) GetActionArea() (*Widget, error) { - c := C.gtk_info_bar_get_action_area(v.native()) - if c == nil { - return nil, nilPtrErr - } - - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -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 -} - -func (v *InfoBar) GetShowCloseButton() bool { - b := C.gtk_info_bar_get_show_close_button(v.native()) - return gobool(b) -} - -func (v *InfoBar) SetShowCloseButton(setting bool) { - C.gtk_info_bar_set_show_close_button(v.native(), gbool(setting)) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/label.go b/vendor/github.com/gotk3/gotk3/gtk/label.go deleted file mode 100644 index 16d418b..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/label.go +++ /dev/null @@ -1,281 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains style related functions and structures - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/pango" - - "github.com/gotk3/gotk3/glib" -) - -/* - * GtkLabel - */ - -// Label is a representation of GTK's GtkLabel. -type Label struct { - Widget -} - -// native returns a pointer to the underlying GtkLabel. -func (v *Label) native() *C.GtkLabel { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkLabel(p) -} - -func marshalLabel(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapLabel(obj), nil -} - -func wrapLabel(obj *glib.Object) *Label { - return &Label{Widget{glib.InitiallyUnowned{obj}}} -} - -func WidgetToLabel(widget *Widget) (interface{}, error) { - obj := glib.Take(unsafe.Pointer(widget.GObject)) - return wrapLabel(obj), nil -} - -// LabelNew is a wrapper around gtk_label_new(). -func LabelNew(str string) (*Label, error) { - cstr := C.CString(str) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_label_new((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapLabel(obj), nil -} - -// SetText is a wrapper around gtk_label_set_text(). -func (v *Label) SetText(str string) { - cstr := C.CString(str) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_label_set_text(v.native(), (*C.gchar)(cstr)) -} - -// SetMarkup is a wrapper around gtk_label_set_markup(). -func (v *Label) SetMarkup(str string) { - cstr := C.CString(str) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_label_set_markup(v.native(), (*C.gchar)(cstr)) -} - -// SetMarkupWithMnemonic is a wrapper around -// gtk_label_set_markup_with_mnemonic(). -func (v *Label) SetMarkupWithMnemonic(str string) { - cstr := C.CString(str) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_label_set_markup_with_mnemonic(v.native(), (*C.gchar)(cstr)) -} - -// SetPattern is a wrapper around gtk_label_set_pattern(). -func (v *Label) SetPattern(patern string) { - cstr := C.CString(patern) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_label_set_pattern(v.native(), (*C.gchar)(cstr)) -} - -// SetJustify is a wrapper around gtk_label_set_justify(). -func (v *Label) SetJustify(jtype Justification) { - C.gtk_label_set_justify(v.native(), C.GtkJustification(jtype)) -} - -// SetEllipsize is a wrapper around gtk_label_set_ellipsize(). -func (v *Label) SetEllipsize(mode pango.EllipsizeMode) { - C.gtk_label_set_ellipsize(v.native(), C.PangoEllipsizeMode(mode)) -} - -// GetWidthChars is a wrapper around gtk_label_get_width_chars(). -func (v *Label) GetWidthChars() int { - c := C.gtk_label_get_width_chars(v.native()) - return int(c) -} - -// SetWidthChars is a wrapper around gtk_label_set_width_chars(). -func (v *Label) SetWidthChars(nChars int) { - C.gtk_label_set_width_chars(v.native(), C.gint(nChars)) -} - -// GetMaxWidthChars is a wrapper around gtk_label_get_max_width_chars(). -func (v *Label) GetMaxWidthChars() int { - c := C.gtk_label_get_max_width_chars(v.native()) - return int(c) -} - -// SetMaxWidthChars is a wrapper around gtk_label_set_max_width_chars(). -func (v *Label) SetMaxWidthChars(nChars int) { - C.gtk_label_set_max_width_chars(v.native(), C.gint(nChars)) -} - -// GetLineWrap is a wrapper around gtk_label_get_line_wrap(). -func (v *Label) GetLineWrap() bool { - c := C.gtk_label_get_line_wrap(v.native()) - return gobool(c) -} - -// SetLineWrap is a wrapper around gtk_label_set_line_wrap(). -func (v *Label) SetLineWrap(wrap bool) { - C.gtk_label_set_line_wrap(v.native(), gbool(wrap)) -} - -// SetLineWrapMode is a wrapper around gtk_label_set_line_wrap_mode(). -func (v *Label) SetLineWrapMode(wrapMode pango.WrapMode) { - C.gtk_label_set_line_wrap_mode(v.native(), C.PangoWrapMode(wrapMode)) -} - -// GetSelectable is a wrapper around gtk_label_get_selectable(). -func (v *Label) GetSelectable() bool { - c := C.gtk_label_get_selectable(v.native()) - return gobool(c) -} - -// GetText is a wrapper around gtk_label_get_text(). -func (v *Label) GetText() (string, error) { - c := C.gtk_label_get_text(v.native()) - if c == nil { - return "", nilPtrErr - } - return C.GoString((*C.char)(c)), nil -} - -// GetJustify is a wrapper around gtk_label_get_justify(). -func (v *Label) GetJustify() Justification { - c := C.gtk_label_get_justify(v.native()) - return Justification(c) -} - -// GetEllipsize is a wrapper around gtk_label_get_ellipsize(). -func (v *Label) GetEllipsize() pango.EllipsizeMode { - c := C.gtk_label_get_ellipsize(v.native()) - return pango.EllipsizeMode(c) -} - -// GetCurrentUri is a wrapper around gtk_label_get_current_uri(). -func (v *Label) GetCurrentUri() string { - c := C.gtk_label_get_current_uri(v.native()) - return C.GoString((*C.char)(c)) -} - -// GetTrackVisitedLinks is a wrapper around gtk_label_get_track_visited_links(). -func (v *Label) GetTrackVisitedLinks() bool { - c := C.gtk_label_get_track_visited_links(v.native()) - return gobool(c) -} - -// SetTrackVisitedLinks is a wrapper around gtk_label_set_track_visited_links(). -func (v *Label) SetTrackVisitedLinks(trackLinks bool) { - C.gtk_label_set_track_visited_links(v.native(), gbool(trackLinks)) -} - -// GetAngle is a wrapper around gtk_label_get_angle(). -func (v *Label) GetAngle() float64 { - c := C.gtk_label_get_angle(v.native()) - return float64(c) -} - -// SetAngle is a wrapper around gtk_label_set_angle(). -func (v *Label) SetAngle(angle float64) { - C.gtk_label_set_angle(v.native(), C.gdouble(angle)) -} - -// GetSelectionBounds is a wrapper around gtk_label_get_selection_bounds(). -func (v *Label) GetSelectionBounds() (start, end int, nonEmpty bool) { - var cstart, cend C.gint - c := C.gtk_label_get_selection_bounds(v.native(), &cstart, &cend) - return int(cstart), int(cend), gobool(c) -} - -// GetSingleLineMode is a wrapper around gtk_label_get_single_line_mode(). -func (v *Label) GetSingleLineMode() bool { - c := C.gtk_label_get_single_line_mode(v.native()) - return gobool(c) -} - -// SetSingleLineMode is a wrapper around gtk_label_set_single_line_mode(). -func (v *Label) SetSingleLineMode(mode bool) { - C.gtk_label_set_single_line_mode(v.native(), gbool(mode)) -} - -// GetUseMarkup is a wrapper around gtk_label_get_use_markup(). -func (v *Label) GetUseMarkup() bool { - c := C.gtk_label_get_use_markup(v.native()) - return gobool(c) -} - -// SetUseMarkup is a wrapper around gtk_label_set_use_markup(). -func (v *Label) SetUseMarkup(use bool) { - C.gtk_label_set_use_markup(v.native(), gbool(use)) -} - -// GetUseUnderline is a wrapper around gtk_label_get_use_underline(). -func (v *Label) GetUseUnderline() bool { - c := C.gtk_label_get_use_underline(v.native()) - return gobool(c) -} - -// SetUseUnderline is a wrapper around gtk_label_set_use_underline(). -func (v *Label) SetUseUnderline(use bool) { - C.gtk_label_set_use_underline(v.native(), gbool(use)) -} - -// LabelNewWithMnemonic is a wrapper around gtk_label_new_with_mnemonic(). -func LabelNewWithMnemonic(str string) (*Label, error) { - cstr := C.CString(str) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_label_new_with_mnemonic((*C.gchar)(cstr)) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapLabel(obj), nil -} - -// SelectRegion is a wrapper around gtk_label_select_region(). -func (v *Label) SelectRegion(startOffset, endOffset int) { - C.gtk_label_select_region(v.native(), C.gint(startOffset), - C.gint(endOffset)) -} - -// SetSelectable is a wrapper around gtk_label_set_selectable(). -func (v *Label) SetSelectable(setting bool) { - C.gtk_label_set_selectable(v.native(), gbool(setting)) -} - -// SetLabel is a wrapper around gtk_label_set_label(). -func (v *Label) SetLabel(str string) { - cstr := C.CString(str) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_label_set_label(v.native(), (*C.gchar)(cstr)) -} - -// GetLabel is a wrapper around gtk_label_get_label(). -func (v *Label) GetLabel() string { - c := C.gtk_label_get_label(v.native()) - if c == nil { - return "" - } - return C.GoString((*C.char)(c)) -} - -// GetMnemonicKeyval is a wrapper around gtk_label_get_mnemonic_keyval(). -func (v *Label) GetMnemonicKeyval() uint { - return uint(C.gtk_label_get_mnemonic_keyval(v.native())) -} - -// SetMnemonicWidget is a wrapper around gtk_label_set_mnemonic_widget(). -func (v *Label) SetMnemonicWidget(widget IWidget) { - C.gtk_label_set_mnemonic_widget(v.native(), widget.toWidget()) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/level_bar.go b/vendor/github.com/gotk3/gotk3/gtk/level_bar.go deleted file mode 100644 index 30c1fe2..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/level_bar.go +++ /dev/null @@ -1,151 +0,0 @@ -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_level_bar_mode_get_type()), marshalLevelBarMode}, - - {glib.Type(C.gtk_level_bar_get_type()), marshalLevelBar}, - } - - glib.RegisterGValueMarshalers(tm) - - WrapMap["GtkLevelBar"] = wrapLevelBar -} - -// LevelBarMode is a representation of GTK's GtkLevelBarMode. -type LevelBarMode int - -const ( - LEVEL_BAR_MODE_CONTINUOUS LevelBarMode = C.GTK_LEVEL_BAR_MODE_CONTINUOUS - LEVEL_BAR_MODE_DISCRETE LevelBarMode = C.GTK_LEVEL_BAR_MODE_DISCRETE -) - -func marshalLevelBarMode(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return LevelBarMode(c), nil -} - -/* - * GtkLevelBar - */ - -type LevelBar struct { - Widget -} - -// native returns a pointer to the underlying GtkLevelBar. -func (v *LevelBar) native() *C.GtkLevelBar { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkLevelBar(p) -} - -func marshalLevelBar(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapLevelBar(obj), nil -} - -func wrapLevelBar(obj *glib.Object) *LevelBar { - return &LevelBar{Widget{glib.InitiallyUnowned{obj}}} -} - -// LevelBarNew() is a wrapper around gtk_level_bar_new(). -func LevelBarNew() (*LevelBar, error) { - c := C.gtk_level_bar_new() - if c == nil { - return nil, nilPtrErr - } - return wrapLevelBar(glib.Take(unsafe.Pointer(c))), nil -} - -// LevelBarNewForInterval() is a wrapper around gtk_level_bar_new_for_interval(). -func LevelBarNewForInterval(min_value, max_value float64) (*LevelBar, error) { - c := C.gtk_level_bar_new_for_interval(C.gdouble(min_value), C.gdouble(max_value)) - if c == nil { - return nil, nilPtrErr - } - return wrapLevelBar(glib.Take(unsafe.Pointer(c))), nil -} - -// SetMode() is a wrapper around gtk_level_bar_set_mode(). -func (v *LevelBar) SetMode(m LevelBarMode) { - C.gtk_level_bar_set_mode(v.native(), C.GtkLevelBarMode(m)) -} - -// GetMode() is a wrapper around gtk_level_bar_get_mode(). -func (v *LevelBar) GetMode() LevelBarMode { - return LevelBarMode(C.gtk_level_bar_get_mode(v.native())) -} - -// SetValue() is a wrapper around gtk_level_bar_set_value(). -func (v *LevelBar) SetValue(value float64) { - C.gtk_level_bar_set_value(v.native(), C.gdouble(value)) -} - -// GetValue() is a wrapper around gtk_level_bar_get_value(). -func (v *LevelBar) GetValue() float64 { - c := C.gtk_level_bar_get_value(v.native()) - return float64(c) -} - -// SetMinValue() is a wrapper around gtk_level_bar_set_min_value(). -func (v *LevelBar) SetMinValue(value float64) { - C.gtk_level_bar_set_min_value(v.native(), C.gdouble(value)) -} - -// GetMinValue() is a wrapper around gtk_level_bar_get_min_value(). -func (v *LevelBar) GetMinValue() float64 { - c := C.gtk_level_bar_get_min_value(v.native()) - return float64(c) -} - -// SetMaxValue() is a wrapper around gtk_level_bar_set_max_value(). -func (v *LevelBar) SetMaxValue(value float64) { - C.gtk_level_bar_set_max_value(v.native(), C.gdouble(value)) -} - -// GetMaxValue() is a wrapper around gtk_level_bar_get_max_value(). -func (v *LevelBar) GetMaxValue() float64 { - c := C.gtk_level_bar_get_max_value(v.native()) - return float64(c) -} - -const ( - LEVEL_BAR_OFFSET_LOW string = C.GTK_LEVEL_BAR_OFFSET_LOW - LEVEL_BAR_OFFSET_HIGH string = C.GTK_LEVEL_BAR_OFFSET_HIGH -) - -// AddOffsetValue() is a wrapper around gtk_level_bar_add_offset_value(). -func (v *LevelBar) AddOffsetValue(name string, value float64) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_level_bar_add_offset_value(v.native(), (*C.gchar)(cstr), C.gdouble(value)) -} - -// RemoveOffsetValue() is a wrapper around gtk_level_bar_remove_offset_value(). -func (v *LevelBar) RemoveOffsetValue(name string) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_level_bar_remove_offset_value(v.native(), (*C.gchar)(cstr)) -} - -// GetOffsetValue() is a wrapper around gtk_level_bar_get_offset_value(). -func (v *LevelBar) GetOffsetValue(name string) (float64, bool) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - var value C.gdouble - c := C.gtk_level_bar_get_offset_value(v.native(), (*C.gchar)(cstr), &value) - return float64(value), gobool(c) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/level_bar_since_3_8.go b/vendor/github.com/gotk3/gotk3/gtk/level_bar_since_3_8.go deleted file mode 100644 index 8df8f29..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/level_bar_since_3_8.go +++ /dev/null @@ -1,18 +0,0 @@ -// +build !gtk_3_6 - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" - -// SetInverted() is a wrapper around gtk_level_bar_set_inverted(). -func (v *LevelBar) SetInverted(inverted bool) { - C.gtk_level_bar_set_inverted(v.native(), gbool(inverted)) -} - -// GetInverted() is a wrapper around gtk_level_bar_get_inverted(). -func (v *LevelBar) GetInverted() bool { - c := C.gtk_level_bar_get_inverted(v.native()) - return gobool(c) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/menu.go b/vendor/github.com/gotk3/gotk3/gtk/menu.go deleted file mode 100644 index 09e1f90..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/menu.go +++ /dev/null @@ -1,76 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains accelerator related functions and structures - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -/* - * GtkMenu - */ - -// Menu is a representation of GTK's GtkMenu. -type Menu struct { - MenuShell -} - -// IMenu is an interface type implemented by all structs embedding -// a Menu. It is meant to be used as an argument type for wrapper -// functions that wrap around a C GTK function taking a -// GtkMenu. -type IMenu interface { - toMenu() *C.GtkMenu - toWidget() *C.GtkWidget -} - -// native() returns a pointer to the underlying GtkMenu. -func (v *Menu) native() *C.GtkMenu { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkMenu(p) -} - -func (v *Menu) toMenu() *C.GtkMenu { - if v == nil { - return nil - } - return v.native() -} - -func marshalMenu(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapMenu(obj), nil -} - -func wrapMenu(obj *glib.Object) *Menu { - return &Menu{MenuShell{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// MenuNew() is a wrapper around gtk_menu_new(). -func MenuNew() (*Menu, error) { - c := C.gtk_menu_new() - if c == nil { - return nil, nilPtrErr - } - return wrapMenu(glib.Take(unsafe.Pointer(c))), nil -} - -// Popdown() is a wrapper around gtk_menu_popdown(). -func (v *Menu) Popdown() { - C.gtk_menu_popdown(v.native()) -} - -// ReorderChild() is a wrapper around gtk_menu_reorder_child(). -func (v *Menu) ReorderChild(child IWidget, position int) { - C.gtk_menu_reorder_child(v.native(), child.toWidget(), C.gint(position)) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/menu_before_3_22.go b/vendor/github.com/gotk3/gotk3/gtk/menu_before_3_22.go deleted file mode 100644 index 5f138a0..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/menu_before_3_22.go +++ /dev/null @@ -1,19 +0,0 @@ -// +build gtk_3_6 gtk_3_8 gtk_3_10 gtk_3_12 gtk_3_14 gtk_3_16 gtk_3_18 gtk_3_20 - -package gtk - -// #include <stdlib.h> -// #include <gtk/gtk.h> -import "C" -import "github.com/gotk3/gotk3/gdk" - -// PopupAtPointer() is a wrapper for gtk_menu_popup_at_pointer(), on older versions it uses PopupAtMouseCursor -func (v *Menu) PopupAtPointer(_ *gdk.Event) { - C.gtk_menu_popup(v.native(), - nil, - nil, - nil, - nil, - C.guint(0), - C.gtk_get_current_event_time()) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/menu_shell.go b/vendor/github.com/gotk3/gotk3/gtk/menu_shell.go deleted file mode 100644 index 436cda0..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/menu_shell.go +++ /dev/null @@ -1,96 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains accelerator related functions and structures - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -/* - * GtkMenuShell - */ - -// MenuShell is a representation of GTK's GtkMenuShell. -type MenuShell struct { - Container -} - -// native returns a pointer to the underlying GtkMenuShell. -func (v *MenuShell) native() *C.GtkMenuShell { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkMenuShell(p) -} - -func marshalMenuShell(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapMenuShell(obj), nil -} - -func wrapMenuShell(obj *glib.Object) *MenuShell { - return &MenuShell{Container{Widget{glib.InitiallyUnowned{obj}}}} -} - -// Append is a wrapper around gtk_menu_shell_append(). -func (v *MenuShell) Append(child IMenuItem) { - C.gtk_menu_shell_append(v.native(), child.toWidget()) -} - -// Prepend is a wrapper around gtk_menu_shell_prepend(). -func (v *MenuShell) Prepend(child IMenuItem) { - C.gtk_menu_shell_prepend(v.native(), child.toWidget()) -} - -// Insert is a wrapper around gtk_menu_shell_insert(). -func (v *MenuShell) Insert(child IMenuItem, position int) { - C.gtk_menu_shell_insert(v.native(), child.toWidget(), C.gint(position)) -} - -// Deactivate is a wrapper around gtk_menu_shell_deactivate(). -func (v *MenuShell) Deactivate() { - C.gtk_menu_shell_deactivate(v.native()) -} - -// SelectItem is a wrapper around gtk_menu_shell_select_item(). -func (v *MenuShell) SelectItem(child IMenuItem) { - C.gtk_menu_shell_select_item(v.native(), child.toWidget()) -} - -// SelectFirst is a wrapper around gtk_menu_shell_select_first(). -func (v *MenuShell) SelectFirst(searchSensitive bool) { - C.gtk_menu_shell_select_first(v.native(), gbool(searchSensitive)) -} - -// Deselect is a wrapper around gtk_menu_shell_deselect(). -func (v *MenuShell) Deselect() { - C.gtk_menu_shell_deselect(v.native()) -} - -// ActivateItem is a wrapper around gtk_menu_shell_activate_item(). -func (v *MenuShell) ActivateItem(child IMenuItem, forceDeactivate bool) { - C.gtk_menu_shell_activate_item(v.native(), child.toWidget(), gbool(forceDeactivate)) -} - -// Cancel is a wrapper around gtk_menu_shell_cancel(). -func (v *MenuShell) Cancel() { - C.gtk_menu_shell_cancel(v.native()) -} - -// SetTakeFocus is a wrapper around gtk_menu_shell_set_take_focus(). -func (v *MenuShell) SetTakeFocus(takeFocus bool) { - C.gtk_menu_shell_set_take_focus(v.native(), gbool(takeFocus)) -} - -// gboolean gtk_menu_shell_get_take_focus () -// GtkWidget * gtk_menu_shell_get_selected_item () -// GtkWidget * gtk_menu_shell_get_parent_shell () -// void gtk_menu_shell_bind_model () diff --git a/vendor/github.com/gotk3/gotk3/gtk/menu_since_3_22.go b/vendor/github.com/gotk3/gotk3/gtk/menu_since_3_22.go deleted file mode 100644 index 85c2e3d..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/menu_since_3_22.go +++ /dev/null @@ -1,24 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12,!gtk_3_14,!gtk_3_16,!gtk_3_18,!gtk_3_20 - -package gtk - -// #include <stdlib.h> -// #include <gtk/gtk.h> -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/gdk" -) - -// PopupAtPointer() is a wrapper for gtk_menu_popup_at_pointer(), on older versions it uses PopupAtMouseCursor -func (v *Menu) PopupAtPointer(triggerEvent *gdk.Event) { - e := (*C.GdkEvent)(unsafe.Pointer(triggerEvent.Native())) - C.gtk_menu_popup_at_pointer(v.native(), e) -} - -// PopupAtWidget() is a wrapper for gtk_menu_popup_at_widget() -func (v *Menu) PopupAtWidget(widget IWidget, widgetAnchor gdk.GdkGravity, menuAnchor gdk.GdkGravity, triggerEvent *gdk.Event) { - e := (*C.GdkEvent)(unsafe.Pointer(triggerEvent.Native())) - C.gtk_menu_popup_at_widget(v.native(), widget.toWidget(), C.GdkGravity(widgetAnchor), C.GdkGravity(menuAnchor), e) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/popover_since_3_12.go b/vendor/github.com/gotk3/gotk3/gtk/popover_since_3_12.go deleted file mode 100644 index 1438899..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/popover_since_3_12.go +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// This file includes wrapers for symbols included since GTK 3.12, and -// and should not be included in a build intended to target any older GTK -// versions. To target an older build, such as 3.10, use -// 'go build -tags gtk_3_10'. Otherwise, if no build tags are used, GTK 3.12 -// is assumed and this file is built. - -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10 - -package gtk - -// #include <gtk/gtk.h> -// #include "popover_since_3_12.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - {glib.Type(C.gtk_popover_get_type()), marshalPopover}, - } - - glib.RegisterGValueMarshalers(tm) - WrapMap["GtkPopover"] = wrapPopover -} - -//TODO(sjon): Implement GtkPopover -//GtkPopover -type Popover struct { - Bin -} - -func (v *Popover) native() *C.GtkPopover { - if v == nil || v.GObject == nil { - return nil - } - - p := unsafe.Pointer(v.GObject) - return C.toGtkPopover(p) -} - -func marshalPopover(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapPopover(glib.Take(unsafe.Pointer(c))), nil -} - -func wrapPopover(obj *glib.Object) *Popover { - return &Popover{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -//gtk_popover_new() -func PopoverNew(relative IWidget) (*Popover, error) { - //Takes relative to widget - var c *C.struct__GtkWidget - if relative == nil { - c = C.gtk_popover_new(nil) - } else { - c = C.gtk_popover_new(relative.toWidget()) - } - if c == nil { - return nil, nilPtrErr - } - return wrapPopover(glib.Take(unsafe.Pointer(c))), nil -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/popover_since_3_12.go.h b/vendor/github.com/gotk3/gotk3/gtk/popover_since_3_12.go.h deleted file mode 100644 index 3cc5564..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/popover_since_3_12.go.h +++ /dev/null @@ -1,25 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12
-
-/*
- * Copyright (c) 2013-2014 Conformal Systems <info@conformal.com>
- *
- * This file originated from: http://opensource.conformal.com/
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-static GtkPopover *
-toGtkPopover(void *p)
-{
- return (GTK_POPOVER(p));
-}
\ No newline at end of file diff --git a/vendor/github.com/gotk3/gotk3/gtk/popover_since_3_18.go b/vendor/github.com/gotk3/gotk3/gtk/popover_since_3_18.go deleted file mode 100644 index 79a8d04..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/popover_since_3_18.go +++ /dev/null @@ -1,29 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12,!gtk_3_14,!gtk_3_16,gtk_3_18 - -// See: https://developer.gnome.org/gtk3/3.18/api-index-3-18.html - -package gtk - -// #include <gtk/gtk.h> -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -//void -//gtk_popover_set_default_widget (GtkPopover *popover, GtkWidget *widget); -func (p *Popover) SetDefaultWidget(widget IWidget) { - C.gtk_popover_set_default_widget(p.native(), widget.toWidget()) -} - -//GtkWidget * -//gtk_popover_get_default_widget (GtkPopover *popover); -func (p *Popover) GetDefaultWidget() *Widget { - w := C.gtk_popover_get_default_widget(p.native()) - if w == nil { - return nil - } - return &Widget{glib.InitiallyUnowned{glib.Take(unsafe.Pointer(w))}} -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/print.go b/vendor/github.com/gotk3/gotk3/gtk/print.go deleted file mode 100644 index 01d169f..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/print.go +++ /dev/null @@ -1,1600 +0,0 @@ -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "errors" - "runtime" - "sync" - "unsafe" - - "github.com/gotk3/gotk3/cairo" - "github.com/gotk3/gotk3/glib" - "github.com/gotk3/gotk3/pango" -) - -func init() { - tm := []glib.TypeMarshaler{ - // Enums - {glib.Type(C.gtk_page_orientation_get_type()), marshalPageOrientation}, - {glib.Type(C.gtk_print_error_get_type()), marshalPrintError}, - {glib.Type(C.gtk_print_operation_action_get_type()), marshalPrintOperationAction}, - {glib.Type(C.gtk_print_operation_result_get_type()), marshalPrintOperationResult}, - {glib.Type(C.gtk_print_status_get_type()), marshalPrintStatus}, - {glib.Type(C.gtk_unit_get_type()), marshalUnit}, - - // Objects/Interfaces - {glib.Type(C.gtk_number_up_layout_get_type()), marshalNumberUpLayout}, - {glib.Type(C.gtk_page_orientation_get_type()), marshalPageOrientation}, - {glib.Type(C.gtk_page_set_get_type()), marshalPageSet}, - {glib.Type(C.gtk_page_setup_get_type()), marshalPageSetup}, - {glib.Type(C.gtk_print_context_get_type()), marshalPrintContext}, - {glib.Type(C.gtk_print_duplex_get_type()), marshalPrintDuplex}, - {glib.Type(C.gtk_print_operation_get_type()), marshalPrintOperation}, - {glib.Type(C.gtk_print_operation_preview_get_type()), marshalPrintOperationPreview}, - {glib.Type(C.gtk_print_pages_get_type()), marshalPrintPages}, - {glib.Type(C.gtk_print_quality_get_type()), marshalPrintQuality}, - {glib.Type(C.gtk_print_settings_get_type()), marshalPrintSettings}, - - // Boxed - {glib.Type(C.gtk_paper_size_get_type()), marshalPaperSize}, - } - - glib.RegisterGValueMarshalers(tm) - - WrapMap["GtkPageSetup"] = wrapPageSetup - WrapMap["GtkPrintContext"] = wrapPrintContext - WrapMap["GtkPrintOperation"] = wrapPrintOperation - WrapMap["GtkPrintOperationPreview"] = wrapPrintOperationPreview - WrapMap["GtkPrintSettings"] = wrapPrintSettings -} - -/* - * Constants - */ - -// NumberUpLayout is a representation of GTK's GtkNumberUpLayout. -type NumberUpLayout int - -const ( - NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM NumberUpLayout = C.GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_TOP_TO_BOTTOM - NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP NumberUpLayout = C.GTK_NUMBER_UP_LAYOUT_LEFT_TO_RIGHT_BOTTOM_TO_TOP - NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TO_BOTTOM NumberUpLayout = C.GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_TOP_TO_BOTTOM - NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_BOTTOM_TO_TOP NumberUpLayout = C.GTK_NUMBER_UP_LAYOUT_RIGHT_TO_LEFT_BOTTOM_TO_TOP - NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_LEFT_TO_RIGHT NumberUpLayout = C.GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_LEFT_TO_RIGHT - NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_RIGHT_TO_LEFT NumberUpLayout = C.GTK_NUMBER_UP_LAYOUT_TOP_TO_BOTTOM_RIGHT_TO_LEFT - NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_LEFT_TO_RIGHT NumberUpLayout = C.GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_LEFT_TO_RIGHT - NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_RIGHT_TO_LEFT NumberUpLayout = C.GTK_NUMBER_UP_LAYOUT_BOTTOM_TO_TOP_RIGHT_TO_LEFT -) - -func marshalNumberUpLayout(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return NumberUpLayout(c), nil -} - -// PageOrientation is a representation of GTK's GtkPageOrientation. -type PageOrientation int - -const ( - PAGE_ORIENTATION_PORTRAIT PageOrientation = C.GTK_PAGE_ORIENTATION_PORTRAIT - PAGE_ORIENTATION_LANDSCAPE PageOrientation = C.GTK_PAGE_ORIENTATION_LANDSCAPE - PAGE_ORIENTATION_REVERSE_PORTRAIT PageOrientation = C.GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT - PAGE_ORIENTATION_REVERSE_LANDSCAPE PageOrientation = C.GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE -) - -func marshalPageOrientation(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return PageOrientation(c), nil -} - -// PrintDuplex is a representation of GTK's GtkPrintDuplex. -type PrintDuplex int - -const ( - PRINT_DUPLEX_SIMPLEX PrintDuplex = C.GTK_PRINT_DUPLEX_SIMPLEX - PRINT_DUPLEX_HORIZONTAL PrintDuplex = C.GTK_PRINT_DUPLEX_HORIZONTAL - PRINT_DUPLEX_VERTICAL PrintDuplex = C.GTK_PRINT_DUPLEX_VERTICAL -) - -func marshalPrintDuplex(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return PrintDuplex(c), nil -} - -// PrintPages is a representation of GTK's GtkPrintPages. -type PrintPages int - -const ( - PRINT_PAGES_ALL PrintPages = C.GTK_PRINT_PAGES_ALL - PRINT_PAGES_CURRENT PrintPages = C.GTK_PRINT_PAGES_CURRENT - PRINT_PAGES_RANGES PrintPages = C.GTK_PRINT_PAGES_RANGES - PRINT_PAGES_SELECTION PrintPages = C.GTK_PRINT_PAGES_SELECTION -) - -func marshalPrintPages(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return PrintPages(c), nil -} - -// PageSet is a representation of GTK's GtkPageSet. -type PageSet int - -const ( - PAGE_SET_ALL PageSet = C.GTK_PAGE_SET_ALL - PAGE_SET_EVEN PageSet = C.GTK_PAGE_SET_EVEN - PAGE_SET_ODD PageSet = C.GTK_PAGE_SET_ODD -) - -func marshalPageSet(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return PageSet(c), nil -} - -// PrintOperationAction is a representation of GTK's GtkPrintError. -type PrintError int - -const ( - PRINT_ERROR_GENERAL PrintError = C.GTK_PRINT_ERROR_GENERAL - PRINT_ERROR_INTERNAL_ERROR PrintError = C.GTK_PRINT_ERROR_INTERNAL_ERROR - PRINT_ERROR_NOMEM PrintError = C.GTK_PRINT_ERROR_NOMEM - PRINT_ERROR_INVALID_FILE PrintError = C.GTK_PRINT_ERROR_INVALID_FILE -) - -func marshalPrintError(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return PrintError(c), nil -} - -// PrintOperationAction is a representation of GTK's GtkPrintOperationAction. -type PrintOperationAction int - -const ( - PRINT_OPERATION_ACTION_PRINT_DIALOG PrintOperationAction = C.GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG - PRINT_OPERATION_ACTION_PRINT PrintOperationAction = C.GTK_PRINT_OPERATION_ACTION_PRINT - PRINT_OPERATION_ACTION_PREVIEW PrintOperationAction = C.GTK_PRINT_OPERATION_ACTION_PREVIEW - PRINT_OPERATION_ACTION_EXPORT PrintOperationAction = C.GTK_PRINT_OPERATION_ACTION_EXPORT -) - -func marshalPrintOperationAction(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return PrintOperationAction(c), nil -} - -// PrintOperationResult is a representation of GTK's GtkPrintOperationResult. -type PrintOperationResult int - -const ( - PRINT_OPERATION_RESULT_ERROR PrintOperationResult = C.GTK_PRINT_OPERATION_RESULT_ERROR - PRINT_OPERATION_RESULT_APPLY PrintOperationResult = C.GTK_PRINT_OPERATION_RESULT_APPLY - PRINT_OPERATION_RESULT_CANCEL PrintOperationResult = C.GTK_PRINT_OPERATION_RESULT_CANCEL - PRINT_OPERATION_RESULT_IN_PROGRESS PrintOperationResult = C.GTK_PRINT_OPERATION_RESULT_IN_PROGRESS -) - -func marshalPrintOperationResult(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return PrintOperationResult(c), nil -} - -// PrintStatus is a representation of GTK's GtkPrintStatus. -type PrintStatus int - -const ( - PRINT_STATUS_INITIAL PrintStatus = C.GTK_PRINT_STATUS_INITIAL - PRINT_STATUS_PREPARING PrintStatus = C.GTK_PRINT_STATUS_PREPARING - PRINT_STATUS_GENERATING_DATA PrintStatus = C.GTK_PRINT_STATUS_GENERATING_DATA - PRINT_STATUS_SENDING_DATA PrintStatus = C.GTK_PRINT_STATUS_SENDING_DATA - PRINT_STATUS_PENDING PrintStatus = C.GTK_PRINT_STATUS_PENDING - PRINT_STATUS_PENDING_ISSUE PrintStatus = C.GTK_PRINT_STATUS_PENDING_ISSUE - PRINT_STATUS_PRINTING PrintStatus = C.GTK_PRINT_STATUS_PRINTING - PRINT_STATUS_FINISHED PrintStatus = C.GTK_PRINT_STATUS_FINISHED - PRINT_STATUS_FINISHED_ABORTED PrintStatus = C.GTK_PRINT_STATUS_FINISHED_ABORTED -) - -func marshalPrintStatus(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return PrintStatus(c), nil -} - -// PrintQuality is a representation of GTK's GtkPrintQuality. -type PrintQuality int - -const ( - PRINT_QUALITY_LOW PrintQuality = C.GTK_PRINT_QUALITY_LOW - PRINT_QUALITY_NORMAL PrintQuality = C.GTK_PRINT_QUALITY_NORMAL - PRINT_QUALITY_HIGH PrintQuality = C.GTK_PRINT_QUALITY_HIGH - PRINT_QUALITY_DRAFT PrintQuality = C.GTK_PRINT_QUALITY_DRAFT -) - -func marshalPrintQuality(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return PrintQuality(c), nil -} - -// Unit is a representation of GTK's GtkUnit. -type Unit int - -const ( - GTK_UNIT_NONE Unit = C.GTK_UNIT_NONE - GTK_UNIT_POINTS Unit = C.GTK_UNIT_POINTS - GTK_UNIT_INCH Unit = C.GTK_UNIT_INCH - GTK_UNIT_MM Unit = C.GTK_UNIT_MM -) - -func marshalUnit(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return Unit(c), nil -} - -/* - * GtkPageSetup - */ -type PageSetup struct { - *glib.Object -} - -func (ps *PageSetup) native() *C.GtkPageSetup { - if ps == nil || ps.GObject == nil { - return nil - } - p := unsafe.Pointer(ps.GObject) - return C.toGtkPageSetup(p) -} - -func marshalPageSetup(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapPageSetup(obj), nil -} - -func wrapPageSetup(obj *glib.Object) *PageSetup { - return &PageSetup{obj} -} - -// PageSetupNew() is a wrapper around gtk_page_setup_new(). -func PageSetupNew() (*PageSetup, error) { - c := C.gtk_page_setup_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapPageSetup(obj), nil -} - -// Copy() is a wrapper around gtk_page_setup_copy(). -func (ps *PageSetup) Copy() (*PageSetup, error) { - c := C.gtk_page_setup_copy(ps.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapPageSetup(obj), nil -} - -// GetOrientation() is a wrapper around gtk_page_setup_get_orientation(). -func (ps *PageSetup) GetOrientation() PageOrientation { - c := C.gtk_page_setup_get_orientation(ps.native()) - return PageOrientation(c) -} - -// SetOrientation() is a wrapper around gtk_page_setup_set_orientation(). -func (ps *PageSetup) SetOrientation(orientation PageOrientation) { - C.gtk_page_setup_set_orientation(ps.native(), C.GtkPageOrientation(orientation)) -} - -// GetPaperSize() is a wrapper around gtk_page_setup_get_paper_size(). -func (ps *PageSetup) GetPaperSize() *PaperSize { - c := C.gtk_page_setup_get_paper_size(ps.native()) - p := &PaperSize{c} - runtime.SetFinalizer(p, (*PaperSize).free) - return p -} - -// SetPaperSize() is a wrapper around gtk_page_setup_set_paper_size(). -func (ps *PageSetup) SetPaperSize(size *PaperSize) { - C.gtk_page_setup_set_paper_size(ps.native(), size.native()) -} - -// GetTopMargin() is a wrapper around gtk_page_setup_get_top_margin(). -func (ps *PageSetup) GetTopMargin(unit Unit) float64 { - c := C.gtk_page_setup_get_top_margin(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// SetTopMargin() is a wrapper around gtk_page_setup_set_top_margin(). -func (ps *PageSetup) SetTopMargin(margin float64, unit Unit) { - C.gtk_page_setup_set_top_margin(ps.native(), C.gdouble(margin), C.GtkUnit(unit)) -} - -// GetBottomMargin() is a wrapper around gtk_page_setup_get_bottom_margin(). -func (ps *PageSetup) GetBottomMargin(unit Unit) float64 { - c := C.gtk_page_setup_get_bottom_margin(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// SetBottomMargin() is a wrapper around gtk_page_setup_set_bottom_margin(). -func (ps *PageSetup) SetBottomMargin(margin float64, unit Unit) { - C.gtk_page_setup_set_bottom_margin(ps.native(), C.gdouble(margin), C.GtkUnit(unit)) -} - -// GetLeftMargin() is a wrapper around gtk_page_setup_get_left_margin(). -func (ps *PageSetup) GetLeftMargin(unit Unit) float64 { - c := C.gtk_page_setup_get_left_margin(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// SetLeftMargin() is a wrapper around gtk_page_setup_set_left_margin(). -func (ps *PageSetup) SetLeftMargin(margin float64, unit Unit) { - C.gtk_page_setup_set_left_margin(ps.native(), C.gdouble(margin), C.GtkUnit(unit)) -} - -// GetRightMargin() is a wrapper around gtk_page_setup_get_right_margin(). -func (ps *PageSetup) GetRightMargin(unit Unit) float64 { - c := C.gtk_page_setup_get_right_margin(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// SetRightMargin() is a wrapper around gtk_page_setup_set_right_margin(). -func (ps *PageSetup) SetRightMargin(margin float64, unit Unit) { - C.gtk_page_setup_set_right_margin(ps.native(), C.gdouble(margin), C.GtkUnit(unit)) -} - -// SetPaperSizeAndDefaultMargins() is a wrapper around gtk_page_setup_set_paper_size_and_default_margins(). -func (ps *PageSetup) SetPaperSizeAndDefaultMargins(size *PaperSize) { - C.gtk_page_setup_set_paper_size_and_default_margins(ps.native(), size.native()) -} - -// GetPaperWidth() is a wrapper around gtk_page_setup_get_paper_width(). -func (ps *PageSetup) GetPaperWidth(unit Unit) float64 { - c := C.gtk_page_setup_get_paper_width(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// GetPaperHeight() is a wrapper around gtk_page_setup_get_paper_height(). -func (ps *PageSetup) GetPaperHeight(unit Unit) float64 { - c := C.gtk_page_setup_get_paper_height(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// GetPageWidth() is a wrapper around gtk_page_setup_get_page_width(). -func (ps *PageSetup) GetPageWidth(unit Unit) float64 { - c := C.gtk_page_setup_get_page_width(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// GetPageHeight() is a wrapper around gtk_page_setup_get_page_height(). -func (ps *PageSetup) GetPageHeight(unit Unit) float64 { - c := C.gtk_page_setup_get_page_height(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// PageSetupNewFromFile() is a wrapper around gtk_page_setup_new_from_file(). -func PageSetupNewFromFile(fileName string) (*PageSetup, error) { - cstr := C.CString(fileName) - defer C.free(unsafe.Pointer(cstr)) - var err *C.GError = nil - c := C.gtk_page_setup_new_from_file((*C.gchar)(cstr), &err) - if c == nil { - defer C.g_error_free(err) - return nil, errors.New(C.GoString((*C.char)(err.message))) - } - obj := glib.Take(unsafe.Pointer(c)) - return &PageSetup{obj}, nil - -} - -// PageSetupNewFromKeyFile() is a wrapper around gtk_page_setup_new_from_key_file(). - -// PageSetupLoadFile() is a wrapper around gtk_page_setup_load_file(). -func (ps *PageSetup) PageSetupLoadFile(name string) error { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - var err *C.GError = nil - res := C.gtk_page_setup_load_file(ps.native(), cstr, &err) - if !gobool(res) { - defer C.g_error_free(err) - return errors.New(C.GoString((*C.char)(err.message))) - } - return nil -} - -// PageSetupLoadKeyFile() is a wrapper around gtk_page_setup_load_key_file(). - -// PageSetupToFile() is a wrapper around gtk_page_setup_to_file(). -func (ps *PageSetup) PageSetupToFile(name string) error { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - var err *C.GError = nil - res := C.gtk_page_setup_to_file(ps.native(), cstr, &err) - if !gobool(res) { - defer C.g_error_free(err) - return errors.New(C.GoString((*C.char)(err.message))) - } - return nil -} - -// PageSetupToKeyFile() is a wrapper around gtk_page_setup_to_key_file(). - -/* - * GtkPaperSize - */ - -// PaperSize is a representation of GTK's GtkPaperSize -type PaperSize struct { - GtkPaperSize *C.GtkPaperSize -} - -// native returns a pointer to the underlying GtkPaperSize. -func (ps *PaperSize) native() *C.GtkPaperSize { - if ps == nil { - return nil - } - return ps.GtkPaperSize -} - -func marshalPaperSize(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - return &PaperSize{(*C.GtkPaperSize)(unsafe.Pointer(c))}, nil -} - -const ( - UNIT_PIXEL int = C.GTK_UNIT_PIXEL - PAPER_NAME_A3 string = C.GTK_PAPER_NAME_A3 - PAPER_NAME_A4 string = C.GTK_PAPER_NAME_A4 - PAPER_NAME_A5 string = C.GTK_PAPER_NAME_A5 - PAPER_NAME_B5 string = C.GTK_PAPER_NAME_B5 - PAPER_NAME_LETTER string = C.GTK_PAPER_NAME_LETTER - PAPER_NAME_EXECUTIVE string = C.GTK_PAPER_NAME_EXECUTIVE - PAPER_NAME_LEGAL string = C.GTK_PAPER_NAME_LEGAL -) - -// PaperSizeNew() is a wrapper around gtk_paper_size_new(). -func PaperSizeNew(name string) (*PaperSize, error) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - var gName *C.gchar - - if name == "" { - gName = nil - } else { - gName = (*C.gchar)(cstr) - } - - c := C.gtk_paper_size_new(gName) - if c == nil { - return nil, nilPtrErr - } - - t := &PaperSize{c} - runtime.SetFinalizer(t, (*PaperSize).free) - return t, nil -} - -// PaperSizeNewFromPPD() is a wrapper around gtk_paper_size_new_from_ppd(). -func PaperSizeNewFromPPD(name, displayName string, width, height float64) (*PaperSize, error) { - cName := C.CString(name) - defer C.free(unsafe.Pointer(cName)) - cDisplayName := C.CString(displayName) - defer C.free(unsafe.Pointer(cDisplayName)) - c := C.gtk_paper_size_new_from_ppd((*C.gchar)(cName), (*C.gchar)(cDisplayName), - C.gdouble(width), C.gdouble(height)) - if c == nil { - return nil, nilPtrErr - } - t := &PaperSize{c} - runtime.SetFinalizer(t, (*PaperSize).free) - return t, nil -} - -// PaperSizeNewCustom() is a wrapper around gtk_paper_size_new_custom(). -func PaperSizeNewCustom(name, displayName string, width, height float64, unit Unit) (*PaperSize, error) { - cName := C.CString(name) - defer C.free(unsafe.Pointer(cName)) - cDisplayName := C.CString(displayName) - defer C.free(unsafe.Pointer(cDisplayName)) - c := C.gtk_paper_size_new_custom((*C.gchar)(cName), (*C.gchar)(cDisplayName), - C.gdouble(width), C.gdouble(height), C.GtkUnit(unit)) - if c == nil { - return nil, nilPtrErr - } - t := &PaperSize{c} - runtime.SetFinalizer(t, (*PaperSize).free) - return t, nil -} - -// Copy() is a wrapper around gtk_paper_size_copy(). -func (ps *PaperSize) Copy() (*PaperSize, error) { - c := C.gtk_paper_size_copy(ps.native()) - if c == nil { - return nil, nilPtrErr - } - t := &PaperSize{c} - runtime.SetFinalizer(t, (*PaperSize).free) - return t, nil -} - -// free() is a wrapper around gtk_paper_size_free(). -func (ps *PaperSize) free() { - C.gtk_paper_size_free(ps.native()) -} - -// IsEqual() is a wrapper around gtk_paper_size_is_equal(). -func (ps *PaperSize) IsEqual(other *PaperSize) bool { - c := C.gtk_paper_size_is_equal(ps.native(), other.native()) - return gobool(c) -} - -// PaperSizeGetPaperSizes() is a wrapper around gtk_paper_size_get_paper_sizes(). -func PaperSizeGetPaperSizes(includeCustom bool) *glib.List { - clist := C.gtk_paper_size_get_paper_sizes(gbool(includeCustom)) - if clist == nil { - return nil - } - - glist := glib.WrapList(uintptr(unsafe.Pointer(clist))) - glist.DataWrapper(func(ptr unsafe.Pointer) interface{} { - return &PaperSize{(*C.GtkPaperSize)(ptr)} - }) - - runtime.SetFinalizer(glist, func(glist *glib.List) { - glist.FreeFull(func(item interface{}) { - ps := item.(*PaperSize) - C.gtk_paper_size_free(ps.GtkPaperSize) - }) - }) - - return glist -} - -// GetName() is a wrapper around gtk_paper_size_get_name(). -func (ps *PaperSize) GetName() string { - c := C.gtk_paper_size_get_name(ps.native()) - return C.GoString((*C.char)(c)) -} - -// GetDisplayName() is a wrapper around gtk_paper_size_get_display_name(). -func (ps *PaperSize) GetDisplayName() string { - c := C.gtk_paper_size_get_display_name(ps.native()) - return C.GoString((*C.char)(c)) -} - -// GetPPDName() is a wrapper around gtk_paper_size_get_ppd_name(). -func (ps *PaperSize) GetPPDName() (string, error) { - c := C.gtk_paper_size_get_ppd_name(ps.native()) - if c == nil { - return "", nilPtrErr - } - return C.GoString((*C.char)(c)), nil -} - -// GetWidth() is a wrapper around gtk_paper_size_get_width(). -func (ps *PaperSize) GetWidth(unit Unit) float64 { - c := C.gtk_paper_size_get_width(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// GetHeight() is a wrapper around gtk_paper_size_get_height(). -func (ps *PaperSize) GetHeight(unit Unit) float64 { - c := C.gtk_paper_size_get_width(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// IsCustom() is a wrapper around gtk_paper_size_is_custom(). -func (ps *PaperSize) IsCustom() bool { - c := C.gtk_paper_size_is_custom(ps.native()) - return gobool(c) -} - -// SetSize() is a wrapper around gtk_paper_size_set_size(). -func (ps *PaperSize) SetSize(width, height float64, unit Unit) { - C.gtk_paper_size_set_size(ps.native(), C.gdouble(width), C.gdouble(height), C.GtkUnit(unit)) -} - -// GetDefaultTopMargin() is a wrapper around gtk_paper_size_get_default_top_margin(). -func (ps *PaperSize) GetDefaultTopMargin(unit Unit) float64 { - c := C.gtk_paper_size_get_default_top_margin(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// GetDefaultBottomMargin() is a wrapper around gtk_paper_size_get_default_bottom_margin(). -func (ps *PaperSize) GetDefaultBottomMargin(unit Unit) float64 { - c := C.gtk_paper_size_get_default_bottom_margin(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// GetDefaultLeftMargin() is a wrapper around gtk_paper_size_get_default_left_margin(). -func (ps *PaperSize) GetDefaultLeftMargin(unit Unit) float64 { - c := C.gtk_paper_size_get_default_left_margin(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// GetDefaultRightMargin() is a wrapper around gtk_paper_size_get_default_right_margin(). -func (ps *PaperSize) GetDefaultRightMargin(unit Unit) float64 { - c := C.gtk_paper_size_get_default_right_margin(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// PaperSizeGetDefault() is a wrapper around gtk_paper_size_get_default(). -func PaperSizeGetDefaultRightMargin(unit Unit) string { - c := C.gtk_paper_size_get_default() - return C.GoString((*C.char)(c)) -} - -// PaperSizeNewFromKeyFile() is a wrapper around gtk_paper_size_new_from_key_file(). -// PaperSizeToKeyFile() is a wrapper around gtk_paper_size_to_key_file(). - -/* - * GtkPrintContext - */ - -// PrintContext is a representation of GTK's GtkPrintContext. -type PrintContext struct { - *glib.Object -} - -// native() returns a pointer to the underlying GtkPrintContext. -func (pc *PrintContext) native() *C.GtkPrintContext { - if pc == nil || pc.GObject == nil { - return nil - } - p := unsafe.Pointer(pc.GObject) - return C.toGtkPrintContext(p) -} - -func marshalPrintContext(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapPrintContext(obj), nil -} - -func wrapPrintContext(obj *glib.Object) *PrintContext { - return &PrintContext{obj} -} - -// GetCairoContext() is a wrapper around gtk_print_context_get_cairo_context(). -func (pc *PrintContext) GetCairoContext() *cairo.Context { - c := C.gtk_print_context_get_cairo_context(pc.native()) - return cairo.WrapContext(uintptr(unsafe.Pointer(c))) -} - -// SetCairoContext() is a wrapper around gtk_print_context_set_cairo_context(). -func (pc *PrintContext) SetCairoContext(cr *cairo.Context, dpiX, dpiY float64) { - C.gtk_print_context_set_cairo_context(pc.native(), - (*C.cairo_t)(unsafe.Pointer(cr.Native())), - C.double(dpiX), C.double(dpiY)) -} - -// GetPageSetup() is a wrapper around gtk_print_context_get_page_setup(). -func (pc *PrintContext) GetPageSetup() *PageSetup { - c := C.gtk_print_context_get_page_setup(pc.native()) - obj := glib.Take(unsafe.Pointer(c)) - return wrapPageSetup(obj) -} - -// GetWidth() is a wrapper around gtk_print_context_get_width(). -func (pc *PrintContext) GetWidth() float64 { - c := C.gtk_print_context_get_width(pc.native()) - return float64(c) -} - -// GetHeight() is a wrapper around gtk_print_context_get_height(). -func (pc *PrintContext) GetHeight() float64 { - c := C.gtk_print_context_get_height(pc.native()) - return float64(c) -} - -// GetDpiX() is a wrapper around gtk_print_context_get_dpi_x(). -func (pc *PrintContext) GetDpiX() float64 { - c := C.gtk_print_context_get_dpi_x(pc.native()) - return float64(c) -} - -// GetDpiY() is a wrapper around gtk_print_context_get_dpi_y(). -func (pc *PrintContext) GetDpiY() float64 { - c := C.gtk_print_context_get_dpi_y(pc.native()) - return float64(c) -} - -// GetPangoFontMap() is a wrapper around gtk_print_context_get_pango_fontmap(). -func (pc *PrintContext) GetPangoFontMap() *pango.FontMap { - c := C.gtk_print_context_get_pango_fontmap(pc.native()) - return pango.WrapFontMap(uintptr(unsafe.Pointer(c))) -} - -// CreatePangoContext() is a wrapper around gtk_print_context_create_pango_context(). -func (pc *PrintContext) CreatePangoContext() *pango.Context { - c := C.gtk_print_context_create_pango_context(pc.native()) - return pango.WrapContext(uintptr(unsafe.Pointer(c))) -} - -// CreatePangoLayout() is a wrapper around gtk_print_context_create_pango_layout(). -func (pc *PrintContext) CreatePangoLayout() *pango.Layout { - c := C.gtk_print_context_create_pango_layout(pc.native()) - return pango.WrapLayout(uintptr(unsafe.Pointer(c))) -} - -// GetHardMargins() is a wrapper around gtk_print_context_get_hard_margins(). -func (pc *PrintContext) GetHardMargins() (float64, float64, float64, float64, error) { - var top, bottom, left, right C.gdouble - c := C.gtk_print_context_get_hard_margins(pc.native(), &top, &bottom, &left, &right) - if gobool(c) == false { - return 0.0, 0.0, 0.0, 0.0, errors.New("unable to retrieve hard margins") - } - return float64(top), float64(bottom), float64(left), float64(right), nil -} - -/* - * GtkPrintOperation - */ -type PrintOperation struct { - *glib.Object - - // Interfaces - PrintOperationPreview -} - -func (po *PrintOperation) native() *C.GtkPrintOperation { - if po == nil || po.GObject == nil { - return nil - } - p := unsafe.Pointer(po.GObject) - return C.toGtkPrintOperation(p) -} - -func (v *PrintOperation) toPrintOperationPreview() *C.GtkPrintOperationPreview { - if v == nil { - return nil - } - return C.toGtkPrintOperationPreview(unsafe.Pointer(v.GObject)) -} - -func marshalPrintOperation(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapPrintOperation(obj), nil -} - -func wrapPrintOperation(obj *glib.Object) *PrintOperation { - pop := wrapPrintOperationPreview(obj) - return &PrintOperation{obj, *pop} -} - -// PrintOperationNew() is a wrapper around gtk_print_operation_new(). -func PrintOperationNew() (*PrintOperation, error) { - c := C.gtk_print_operation_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapPrintOperation(obj), nil -} - -// SetAllowAsync() is a wrapper around gtk_print_operation_set_allow_async(). -func (po *PrintOperation) PrintOperationSetAllowAsync(allowSync bool) { - C.gtk_print_operation_set_allow_async(po.native(), gbool(allowSync)) -} - -// GetError() is a wrapper around gtk_print_operation_get_error(). -func (po *PrintOperation) PrintOperationGetError() error { - var err *C.GError = nil - C.gtk_print_operation_get_error(po.native(), &err) - defer C.g_error_free(err) - return errors.New(C.GoString((*C.char)(err.message))) -} - -// SetDefaultPageSetup() is a wrapper around gtk_print_operation_set_default_page_setup(). -func (po *PrintOperation) SetDefaultPageSetup(ps *PageSetup) { - C.gtk_print_operation_set_default_page_setup(po.native(), ps.native()) -} - -// GetDefaultPageSetup() is a wrapper around gtk_print_operation_get_default_page_setup(). -func (po *PrintOperation) GetDefaultPageSetup() (*PageSetup, error) { - c := C.gtk_print_operation_get_default_page_setup(po.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapPageSetup(obj), nil -} - -// SetPrintSettings() is a wrapper around gtk_print_operation_set_print_settings(). -func (po *PrintOperation) SetPrintSettings(ps *PrintSettings) { - C.gtk_print_operation_set_print_settings(po.native(), ps.native()) -} - -// GetPrintSettings() is a wrapper around gtk_print_operation_get_print_settings(). -func (po *PrintOperation) GetPrintSettings(ps *PageSetup) (*PrintSettings, error) { - c := C.gtk_print_operation_get_print_settings(po.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapPrintSettings(obj), nil -} - -// SetJobName() is a wrapper around gtk_print_operation_set_job_name(). -func (po *PrintOperation) SetJobName(name string) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_print_operation_set_job_name(po.native(), (*C.gchar)(cstr)) -} - -// SetNPages() is a wrapper around gtk_print_operation_set_n_pages(). -func (po *PrintOperation) SetNPages(pages int) { - C.gtk_print_operation_set_n_pages(po.native(), C.gint(pages)) -} - -// GetNPagesToPrint() is a wrapper around gtk_print_operation_get_n_pages_to_print(). -func (po *PrintOperation) GetNPagesToPrint() int { - c := C.gtk_print_operation_get_n_pages_to_print(po.native()) - return int(c) -} - -// SetCurrentPage() is a wrapper around gtk_print_operation_set_current_page(). -func (po *PrintOperation) SetCurrentPage(page int) { - C.gtk_print_operation_set_current_page(po.native(), C.gint(page)) -} - -// SetUseFullPage() is a wrapper around gtk_print_operation_set_use_full_page(). -func (po *PrintOperation) SetUseFullPage(full bool) { - C.gtk_print_operation_set_use_full_page(po.native(), gbool(full)) -} - -// SetUnit() is a wrapper around gtk_print_operation_set_unit(). -func (po *PrintOperation) SetUnit(unit Unit) { - C.gtk_print_operation_set_unit(po.native(), C.GtkUnit(unit)) -} - -// SetExportFilename() is a wrapper around gtk_print_operation_set_export_filename(). -func (po *PrintOperation) SetExportFilename(name string) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_print_operation_set_export_filename(po.native(), (*C.gchar)(cstr)) -} - -// SetShowProgress() is a wrapper around gtk_print_operation_set_show_progress(). -func (po *PrintOperation) SetShowProgress(show bool) { - C.gtk_print_operation_set_show_progress(po.native(), gbool(show)) -} - -// SetTrackPrintStatus() is a wrapper around gtk_print_operation_set_track_print_status(). -func (po *PrintOperation) SetTrackPrintStatus(progress bool) { - C.gtk_print_operation_set_track_print_status(po.native(), gbool(progress)) -} - -// SetCustomTabLabel() is a wrapper around gtk_print_operation_set_custom_tab_label(). -func (po *PrintOperation) SetCustomTabLabel(label string) { - cstr := C.CString(label) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_print_operation_set_custom_tab_label(po.native(), (*C.gchar)(cstr)) -} - -// Run() is a wrapper around gtk_print_operation_run(). -func (po *PrintOperation) Run(action PrintOperationAction, parent *Window) (PrintOperationResult, error) { - var err *C.GError = nil - c := C.gtk_print_operation_run(po.native(), C.GtkPrintOperationAction(action), parent.native(), &err) - res := PrintOperationResult(c) - if res == PRINT_OPERATION_RESULT_ERROR { - defer C.g_error_free(err) - return res, errors.New(C.GoString((*C.char)(err.message))) - } - return res, nil -} - -// Cancel() is a wrapper around gtk_print_operation_cancel(). -func (po *PrintOperation) Cancel() { - C.gtk_print_operation_cancel(po.native()) -} - -// DrawPageFinish() is a wrapper around gtk_print_operation_draw_page_finish(). -func (po *PrintOperation) DrawPageFinish() { - C.gtk_print_operation_draw_page_finish(po.native()) -} - -// SetDeferDrawing() is a wrapper around gtk_print_operation_set_defer_drawing(). -func (po *PrintOperation) SetDeferDrawing() { - C.gtk_print_operation_set_defer_drawing(po.native()) -} - -// GetStatus() is a wrapper around gtk_print_operation_get_status(). -func (po *PrintOperation) GetStatus() PrintStatus { - c := C.gtk_print_operation_get_status(po.native()) - return PrintStatus(c) -} - -// GetStatusString() is a wrapper around gtk_print_operation_get_status_string(). -func (po *PrintOperation) GetStatusString() string { - c := C.gtk_print_operation_get_status_string(po.native()) - return C.GoString((*C.char)(c)) -} - -// IsFinished() is a wrapper around gtk_print_operation_is_finished(). -func (po *PrintOperation) IsFinished() bool { - c := C.gtk_print_operation_is_finished(po.native()) - return gobool(c) -} - -// SetSupportSelection() is a wrapper around gtk_print_operation_set_support_selection(). -func (po *PrintOperation) SetSupportSelection(selection bool) { - C.gtk_print_operation_set_support_selection(po.native(), gbool(selection)) -} - -// GetSupportSelection() is a wrapper around gtk_print_operation_get_support_selection(). -func (po *PrintOperation) GetSupportSelection() bool { - c := C.gtk_print_operation_get_support_selection(po.native()) - return gobool(c) -} - -// SetHasSelection() is a wrapper around gtk_print_operation_set_has_selection(). -func (po *PrintOperation) SetHasSelection(selection bool) { - C.gtk_print_operation_set_has_selection(po.native(), gbool(selection)) -} - -// GetHasSelection() is a wrapper around gtk_print_operation_get_has_selection(). -func (po *PrintOperation) GetHasSelection() bool { - c := C.gtk_print_operation_get_has_selection(po.native()) - return gobool(c) -} - -// SetEmbedPageSetup() is a wrapper around gtk_print_operation_set_embed_page_setup(). -func (po *PrintOperation) SetEmbedPageSetup(embed bool) { - C.gtk_print_operation_set_embed_page_setup(po.native(), gbool(embed)) -} - -// GetEmbedPageSetup() is a wrapper around gtk_print_operation_get_embed_page_setup(). -func (po *PrintOperation) GetEmbedPageSetup() bool { - c := C.gtk_print_operation_get_embed_page_setup(po.native()) - return gobool(c) -} - -// PrintRunPageSetupDialog() is a wrapper around gtk_print_run_page_setup_dialog(). -func PrintRunPageSetupDialog(parent *Window, pageSetup *PageSetup, settings *PrintSettings) *PageSetup { - c := C.gtk_print_run_page_setup_dialog(parent.native(), pageSetup.native(), settings.native()) - obj := glib.Take(unsafe.Pointer(c)) - return wrapPageSetup(obj) -} - -type PageSetupDoneCallback func(setup *PageSetup, userData uintptr) - -type pageSetupDoneCallbackData struct { - fn PageSetupDoneCallback - data uintptr -} - -var ( - pageSetupDoneCallbackRegistry = struct { - sync.RWMutex - next int - m map[int]pageSetupDoneCallbackData - }{ - next: 1, - m: make(map[int]pageSetupDoneCallbackData), - } -) - -// PrintRunPageSetupDialogAsync() is a wrapper around gtk_print_run_page_setup_dialog_async(). -func PrintRunPageSetupDialogAsync(parent *Window, setup *PageSetup, - settings *PrintSettings, cb PageSetupDoneCallback, data uintptr) { - - pageSetupDoneCallbackRegistry.Lock() - id := pageSetupDoneCallbackRegistry.next - pageSetupDoneCallbackRegistry.next++ - pageSetupDoneCallbackRegistry.m[id] = - pageSetupDoneCallbackData{fn: cb, data: data} - pageSetupDoneCallbackRegistry.Unlock() - - C._gtk_print_run_page_setup_dialog_async(parent.native(), setup.native(), - settings.native(), C.gpointer(uintptr(id))) -} - -/* - * GtkPrintOperationPreview - */ - -// PrintOperationPreview is a representation of GTK's GtkPrintOperationPreview GInterface. -type PrintOperationPreview struct { - *glib.Object -} - -// IPrintOperationPreview is an interface type implemented by all structs -// embedding a PrintOperationPreview. It is meant to be used as an argument type -// for wrapper functions that wrap around a C GTK function taking a -// GtkPrintOperationPreview. -type IPrintOperationPreview interface { - toPrintOperationPreview() *C.GtkPrintOperationPreview -} - -// native() returns a pointer to the underlying GObject as a GtkPrintOperationPreview. -func (v *PrintOperationPreview) native() *C.GtkPrintOperationPreview { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkPrintOperationPreview(p) -} - -func marshalPrintOperationPreview(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapPrintOperationPreview(obj), nil -} - -func wrapPrintOperationPreview(obj *glib.Object) *PrintOperationPreview { - return &PrintOperationPreview{obj} -} - -func (v *PrintOperationPreview) toPrintOperationPreview() *C.GtkPrintOperationPreview { - if v == nil { - return nil - } - return v.native() -} - -// RenderPage()() is a wrapper around gtk_print_operation_preview_render_page(). -func (pop *PrintOperationPreview) RenderPage(page int) { - C.gtk_print_operation_preview_render_page(pop.native(), C.gint(page)) -} - -// EndPreview()() is a wrapper around gtk_print_operation_preview_end_preview(). -func (pop *PrintOperationPreview) EndPreview() { - C.gtk_print_operation_preview_end_preview(pop.native()) -} - -// IsSelected()() is a wrapper around gtk_print_operation_preview_is_selected(). -func (pop *PrintOperationPreview) IsSelected(page int) bool { - c := C.gtk_print_operation_preview_is_selected(pop.native(), C.gint(page)) - return gobool(c) -} - -/* - * GtkPrintSettings - */ - -type PrintSettings struct { - *glib.Object -} - -func (ps *PrintSettings) native() *C.GtkPrintSettings { - if ps == nil || ps.GObject == nil { - return nil - } - - p := unsafe.Pointer(ps.GObject) - return C.toGtkPrintSettings(p) -} - -func marshalPrintSettings(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapPrintSettings(glib.Take(unsafe.Pointer(c))), nil -} - -func wrapPrintSettings(obj *glib.Object) *PrintSettings { - return &PrintSettings{obj} -} - -const ( - PRINT_SETTINGS_PRINTER string = C.GTK_PRINT_SETTINGS_PRINTER - PRINT_SETTINGS_ORIENTATION string = C.GTK_PRINT_SETTINGS_ORIENTATION - PRINT_SETTINGS_PAPER_FORMAT string = C.GTK_PRINT_SETTINGS_PAPER_FORMAT - PRINT_SETTINGS_PAPER_WIDTH string = C.GTK_PRINT_SETTINGS_PAPER_WIDTH - PRINT_SETTINGS_PAPER_HEIGHT string = C.GTK_PRINT_SETTINGS_PAPER_HEIGHT - PRINT_SETTINGS_USE_COLOR string = C.GTK_PRINT_SETTINGS_USE_COLOR - PRINT_SETTINGS_COLLATE string = C.GTK_PRINT_SETTINGS_COLLATE - PRINT_SETTINGS_REVERSE string = C.GTK_PRINT_SETTINGS_REVERSE - PRINT_SETTINGS_DUPLEX string = C.GTK_PRINT_SETTINGS_DUPLEX - PRINT_SETTINGS_QUALITY string = C.GTK_PRINT_SETTINGS_QUALITY - PRINT_SETTINGS_N_COPIES string = C.GTK_PRINT_SETTINGS_N_COPIES - PRINT_SETTINGS_NUMBER_UP string = C.GTK_PRINT_SETTINGS_NUMBER_UP - PRINT_SETTINGS_NUMBER_UP_LAYOUT string = C.GTK_PRINT_SETTINGS_NUMBER_UP_LAYOUT - PRINT_SETTINGS_RESOLUTION string = C.GTK_PRINT_SETTINGS_RESOLUTION - PRINT_SETTINGS_RESOLUTION_X string = C.GTK_PRINT_SETTINGS_RESOLUTION_X - PRINT_SETTINGS_RESOLUTION_Y string = C.GTK_PRINT_SETTINGS_RESOLUTION_Y - PRINT_SETTINGS_PRINTER_LPI string = C.GTK_PRINT_SETTINGS_PRINTER_LPI - PRINT_SETTINGS_SCALE string = C.GTK_PRINT_SETTINGS_SCALE - PRINT_SETTINGS_PRINT_PAGES string = C.GTK_PRINT_SETTINGS_PRINT_PAGES - PRINT_SETTINGS_PAGE_RANGES string = C.GTK_PRINT_SETTINGS_PAGE_RANGES - PRINT_SETTINGS_PAGE_SET string = C.GTK_PRINT_SETTINGS_PAGE_SET - PRINT_SETTINGS_DEFAULT_SOURCE string = C.GTK_PRINT_SETTINGS_DEFAULT_SOURCE - PRINT_SETTINGS_MEDIA_TYPE string = C.GTK_PRINT_SETTINGS_MEDIA_TYPE - PRINT_SETTINGS_DITHER string = C.GTK_PRINT_SETTINGS_DITHER - PRINT_SETTINGS_FINISHINGS string = C.GTK_PRINT_SETTINGS_FINISHINGS - PRINT_SETTINGS_OUTPUT_BIN string = C.GTK_PRINT_SETTINGS_OUTPUT_BIN - PRINT_SETTINGS_OUTPUT_DIR string = C.GTK_PRINT_SETTINGS_OUTPUT_DIR - PRINT_SETTINGS_OUTPUT_BASENAME string = C.GTK_PRINT_SETTINGS_OUTPUT_BASENAME - PRINT_SETTINGS_OUTPUT_FILE_FORMAT string = C.GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT - PRINT_SETTINGS_OUTPUT_URI string = C.GTK_PRINT_SETTINGS_OUTPUT_URI - PRINT_SETTINGS_WIN32_DRIVER_EXTRA string = C.GTK_PRINT_SETTINGS_WIN32_DRIVER_EXTRA - PRINT_SETTINGS_WIN32_DRIVER_VERSION string = C.GTK_PRINT_SETTINGS_WIN32_DRIVER_VERSION -) - -// PrintSettingsNew() is a wrapper around gtk_print_settings_new(). -func PrintSettingsNew() (*PrintSettings, error) { - c := C.gtk_print_settings_new() - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapPrintSettings(obj), nil -} - -// Copy() is a wrapper around gtk_print_settings_copy(). -func (ps *PrintSettings) Copy() (*PrintSettings, error) { - c := C.gtk_print_settings_copy(ps.native()) - if c == nil { - return nil, nilPtrErr - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapPrintSettings(obj), nil -} - -// HasKey() is a wrapper around gtk_print_settings_has_key(). -func (ps *PrintSettings) HasKey(key string) bool { - cstr := C.CString(key) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_print_settings_has_key(ps.native(), (*C.gchar)(cstr)) - return gobool(c) -} - -// Get() is a wrapper around gtk_print_settings_get(). -func (ps *PrintSettings) Get(key string) string { - cstr := C.CString(key) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_print_settings_get(ps.native(), (*C.gchar)(cstr)) - return C.GoString((*C.char)(c)) -} - -// Set() is a wrapper around gtk_print_settings_set(). -// TODO: Since value can't be nil, we can't unset values here. -func (ps *PrintSettings) Set(key, value string) { - cKey := C.CString(key) - defer C.free(unsafe.Pointer(cKey)) - cValue := C.CString(value) - defer C.free(unsafe.Pointer(cValue)) - C.gtk_print_settings_set(ps.native(), (*C.gchar)(cKey), (*C.gchar)(cValue)) -} - -// Unset() is a wrapper around gtk_print_settings_unset(). -func (ps *PrintSettings) Unset(key string) { - cstr := C.CString(key) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_print_settings_unset(ps.native(), (*C.gchar)(cstr)) -} - -type PrintSettingsCallback func(key, value string, userData uintptr) - -type printSettingsCallbackData struct { - fn PrintSettingsCallback - userData uintptr -} - -var ( - printSettingsCallbackRegistry = struct { - sync.RWMutex - next int - m map[int]printSettingsCallbackData - }{ - next: 1, - m: make(map[int]printSettingsCallbackData), - } -) - -// Foreach() is a wrapper around gtk_print_settings_foreach(). -func (ps *PrintSettings) ForEach(cb PrintSettingsCallback, userData uintptr) { - printSettingsCallbackRegistry.Lock() - id := printSettingsCallbackRegistry.next - printSettingsCallbackRegistry.next++ - printSettingsCallbackRegistry.m[id] = - printSettingsCallbackData{fn: cb, userData: userData} - printSettingsCallbackRegistry.Unlock() - - C._gtk_print_settings_foreach(ps.native(), C.gpointer(uintptr(id))) -} - -// GetBool() is a wrapper around gtk_print_settings_get_bool(). -func (ps *PrintSettings) GetBool(key string) bool { - cstr := C.CString(key) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_print_settings_get_bool(ps.native(), (*C.gchar)(cstr)) - return gobool(c) -} - -// SetBool() is a wrapper around gtk_print_settings_set_bool(). -func (ps *PrintSettings) SetBool(key string, value bool) { - cstr := C.CString(key) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_print_settings_set_bool(ps.native(), (*C.gchar)(cstr), gbool(value)) -} - -// GetDouble() is a wrapper around gtk_print_settings_get_double(). -func (ps *PrintSettings) GetDouble(key string) float64 { - cstr := C.CString(key) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_print_settings_get_double(ps.native(), (*C.gchar)(cstr)) - return float64(c) -} - -// GetDoubleWithDefault() is a wrapper around gtk_print_settings_get_double_with_default(). -func (ps *PrintSettings) GetDoubleWithDefault(key string, def float64) float64 { - cstr := C.CString(key) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_print_settings_get_double_with_default(ps.native(), - (*C.gchar)(cstr), C.gdouble(def)) - return float64(c) -} - -// SetDouble() is a wrapper around gtk_print_settings_set_double(). -func (ps *PrintSettings) SetDouble(key string, value float64) { - cstr := C.CString(key) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_print_settings_set_double(ps.native(), (*C.gchar)(cstr), C.gdouble(value)) -} - -// GetLength() is a wrapper around gtk_print_settings_get_length(). -func (ps *PrintSettings) GetLength(key string, unit Unit) float64 { - cstr := C.CString(key) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_print_settings_get_length(ps.native(), (*C.gchar)(cstr), C.GtkUnit(unit)) - return float64(c) -} - -// SetLength() is a wrapper around gtk_print_settings_set_length(). -func (ps *PrintSettings) SetLength(key string, value float64, unit Unit) { - cstr := C.CString(key) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_print_settings_set_length(ps.native(), (*C.gchar)(cstr), C.gdouble(value), C.GtkUnit(unit)) -} - -// GetInt() is a wrapper around gtk_print_settings_get_int(). -func (ps *PrintSettings) GetInt(key string) int { - cstr := C.CString(key) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_print_settings_get_int(ps.native(), (*C.gchar)(cstr)) - return int(c) -} - -// GetIntWithDefault() is a wrapper around gtk_print_settings_get_int_with_default(). -func (ps *PrintSettings) GetIntWithDefault(key string, def int) int { - cstr := C.CString(key) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_print_settings_get_int_with_default(ps.native(), (*C.gchar)(cstr), C.gint(def)) - return int(c) -} - -// SetInt() is a wrapper around gtk_print_settings_set_int(). -func (ps *PrintSettings) SetInt(key string, value int) { - cstr := C.CString(key) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_print_settings_set_int(ps.native(), (*C.gchar)(cstr), C.gint(value)) -} - -// GetPrinter() is a wrapper around gtk_print_settings_get_printer(). -func (ps *PrintSettings) GetPrinter() string { - c := C.gtk_print_settings_get_printer(ps.native()) - return C.GoString((*C.char)(c)) -} - -// SetPrinter() is a wrapper around gtk_print_settings_set_printer(). -func (ps *PrintSettings) SetPrinter(printer string) { - cstr := C.CString(printer) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_print_settings_set_printer(ps.native(), (*C.gchar)(cstr)) -} - -// GetOrientation() is a wrapper around gtk_print_settings_get_orientation(). -func (ps *PrintSettings) GetOrientation() PageOrientation { - c := C.gtk_print_settings_get_orientation(ps.native()) - return PageOrientation(c) -} - -// SetOrientation() is a wrapper around gtk_print_settings_set_orientation(). -func (ps *PrintSettings) SetOrientation(orientation PageOrientation) { - C.gtk_print_settings_set_orientation(ps.native(), C.GtkPageOrientation(orientation)) -} - -// GetPaperSize() is a wrapper around gtk_print_settings_get_paper_size(). -func (ps *PrintSettings) GetPaperSize() (*PaperSize, error) { - c := C.gtk_print_settings_get_paper_size(ps.native()) - if c == nil { - return nil, nilPtrErr - } - p := &PaperSize{c} - runtime.SetFinalizer(p, (*PaperSize).free) - return p, nil -} - -// SetPaperSize() is a wrapper around gtk_print_settings_set_paper_size(). -func (ps *PrintSettings) SetPaperSize(size *PaperSize) { - C.gtk_print_settings_set_paper_size(ps.native(), size.native()) -} - -// GetPaperWidth() is a wrapper around gtk_print_settings_get_paper_width(). -func (ps *PrintSettings) GetPaperWidth(unit Unit) float64 { - c := C.gtk_print_settings_get_paper_width(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// SetPaperWidth() is a wrapper around gtk_print_settings_set_paper_width(). -func (ps *PrintSettings) SetPaperWidth(width float64, unit Unit) { - C.gtk_print_settings_set_paper_width(ps.native(), C.gdouble(width), C.GtkUnit(unit)) -} - -// GetPaperHeight() is a wrapper around gtk_print_settings_get_paper_height(). -func (ps *PrintSettings) GetPaperHeight(unit Unit) float64 { - c := C.gtk_print_settings_get_paper_height(ps.native(), C.GtkUnit(unit)) - return float64(c) -} - -// SetPaperHeight() is a wrapper around gtk_print_settings_set_paper_height(). -func (ps *PrintSettings) SetPaperHeight(width float64, unit Unit) { - C.gtk_print_settings_set_paper_height(ps.native(), C.gdouble(width), C.GtkUnit(unit)) -} - -// GetUseColor() is a wrapper around gtk_print_settings_get_use_color(). -func (ps *PrintSettings) GetUseColor() bool { - c := C.gtk_print_settings_get_use_color(ps.native()) - return gobool(c) -} - -// SetUseColor() is a wrapper around gtk_print_settings_set_use_color(). -func (ps *PrintSettings) SetUseColor(color bool) { - C.gtk_print_settings_set_use_color(ps.native(), gbool(color)) -} - -// GetCollate() is a wrapper around gtk_print_settings_get_collate(). -func (ps *PrintSettings) GetCollate() bool { - c := C.gtk_print_settings_get_collate(ps.native()) - return gobool(c) -} - -// SetCollate() is a wrapper around gtk_print_settings_set_collate(). -func (ps *PrintSettings) SetCollate(collate bool) { - C.gtk_print_settings_set_collate(ps.native(), gbool(collate)) -} - -// GetReverse() is a wrapper around gtk_print_settings_get_reverse(). -func (ps *PrintSettings) GetReverse() bool { - c := C.gtk_print_settings_get_reverse(ps.native()) - return gobool(c) -} - -// SetReverse() is a wrapper around gtk_print_settings_set_reverse(). -func (ps *PrintSettings) SetReverse(reverse bool) { - C.gtk_print_settings_set_reverse(ps.native(), gbool(reverse)) -} - -// GetDuplex() is a wrapper around gtk_print_settings_get_duplex(). -func (ps *PrintSettings) GetDuplex() PrintDuplex { - c := C.gtk_print_settings_get_duplex(ps.native()) - return PrintDuplex(c) -} - -// SetDuplex() is a wrapper around gtk_print_settings_set_duplex(). -func (ps *PrintSettings) SetDuplex(duplex PrintDuplex) { - C.gtk_print_settings_set_duplex(ps.native(), C.GtkPrintDuplex(duplex)) -} - -// GetQuality() is a wrapper around gtk_print_settings_get_quality(). -func (ps *PrintSettings) GetQuality() PrintQuality { - c := C.gtk_print_settings_get_quality(ps.native()) - return PrintQuality(c) -} - -// SetQuality() is a wrapper around gtk_print_settings_set_quality(). -func (ps *PrintSettings) SetQuality(quality PrintQuality) { - C.gtk_print_settings_set_quality(ps.native(), C.GtkPrintQuality(quality)) -} - -// GetNCopies() is a wrapper around gtk_print_settings_get_n_copies(). -func (ps *PrintSettings) GetNCopies() int { - c := C.gtk_print_settings_get_n_copies(ps.native()) - return int(c) -} - -// SetNCopies() is a wrapper around gtk_print_settings_set_n_copies(). -func (ps *PrintSettings) SetNCopies(copies int) { - C.gtk_print_settings_set_n_copies(ps.native(), C.gint(copies)) -} - -// GetNmberUp() is a wrapper around gtk_print_settings_get_number_up(). -func (ps *PrintSettings) GetNmberUp() int { - c := C.gtk_print_settings_get_number_up(ps.native()) - return int(c) -} - -// SetNumberUp() is a wrapper around gtk_print_settings_set_number_up(). -func (ps *PrintSettings) SetNumberUp(numberUp int) { - C.gtk_print_settings_set_number_up(ps.native(), C.gint(numberUp)) -} - -// GetNumberUpLayout() is a wrapper around gtk_print_settings_get_number_up_layout(). -func (ps *PrintSettings) GetNumberUpLayout() NumberUpLayout { - c := C.gtk_print_settings_get_number_up_layout(ps.native()) - return NumberUpLayout(c) -} - -// SetNumberUpLayout() is a wrapper around gtk_print_settings_set_number_up_layout(). -func (ps *PrintSettings) SetNumberUpLayout(numberUpLayout NumberUpLayout) { - C.gtk_print_settings_set_number_up_layout(ps.native(), C.GtkNumberUpLayout(numberUpLayout)) -} - -// GetResolution() is a wrapper around gtk_print_settings_get_resolution(). -func (ps *PrintSettings) GetResolution() int { - c := C.gtk_print_settings_get_resolution(ps.native()) - return int(c) -} - -// SetResolution() is a wrapper around gtk_print_settings_set_resolution(). -func (ps *PrintSettings) SetResolution(resolution int) { - C.gtk_print_settings_set_resolution(ps.native(), C.gint(resolution)) -} - -// SetResolutionXY() is a wrapper around gtk_print_settings_set_resolution_xy(). -func (ps *PrintSettings) SetResolutionXY(resolutionX, resolutionY int) { - C.gtk_print_settings_set_resolution_xy(ps.native(), C.gint(resolutionX), C.gint(resolutionY)) -} - -// GetResolutionX() is a wrapper around gtk_print_settings_get_resolution_x(). -func (ps *PrintSettings) GetResolutionX() int { - c := C.gtk_print_settings_get_resolution_x(ps.native()) - return int(c) -} - -// GetResolutionY() is a wrapper around gtk_print_settings_get_resolution_y(). -func (ps *PrintSettings) GetResolutionY() int { - c := C.gtk_print_settings_get_resolution_y(ps.native()) - return int(c) -} - -// GetPrinterLpi() is a wrapper around gtk_print_settings_get_printer_lpi(). -func (ps *PrintSettings) GetPrinterLpi() float64 { - c := C.gtk_print_settings_get_printer_lpi(ps.native()) - return float64(c) -} - -// SetPrinterLpi() is a wrapper around gtk_print_settings_set_printer_lpi(). -func (ps *PrintSettings) SetPrinterLpi(lpi float64) { - C.gtk_print_settings_set_printer_lpi(ps.native(), C.gdouble(lpi)) -} - -// GetScale() is a wrapper around gtk_print_settings_get_scale(). -func (ps *PrintSettings) GetScale() float64 { - c := C.gtk_print_settings_get_scale(ps.native()) - return float64(c) -} - -// SetScale() is a wrapper around gtk_print_settings_set_scale(). -func (ps *PrintSettings) SetScale(scale float64) { - C.gtk_print_settings_set_scale(ps.native(), C.gdouble(scale)) -} - -// GetPrintPages() is a wrapper around gtk_print_settings_get_print_pages(). -func (ps *PrintSettings) GetPrintPages() PrintPages { - c := C.gtk_print_settings_get_print_pages(ps.native()) - return PrintPages(c) -} - -// SetPrintPages() is a wrapper around gtk_print_settings_set_print_pages(). -func (ps *PrintSettings) SetPrintPages(pages PrintPages) { - C.gtk_print_settings_set_print_pages(ps.native(), C.GtkPrintPages(pages)) -} - -// GetPageSet() is a wrapper around gtk_print_settings_get_page_set(). -func (ps *PrintSettings) GetPageSet(pages PrintPages) PageSet { - c := C.gtk_print_settings_get_page_set(ps.native()) - return PageSet(c) -} - -// SetPageSet() is a wrapper around gtk_print_settings_set_page_set(). -func (ps *PrintSettings) SetPageSet(pageSet PageSet) { - C.gtk_print_settings_set_page_set(ps.native(), C.GtkPageSet(pageSet)) -} - -// GetDefaultSource() is a wrapper around gtk_print_settings_get_default_source(). -func (ps *PrintSettings) GetDefaultSource() string { - c := C.gtk_print_settings_get_default_source(ps.native()) - return C.GoString((*C.char)(c)) -} - -// SetSefaultSource() is a wrapper around gtk_print_settings_set_default_source(). -func (ps *PrintSettings) SetSefaultSource(defaultSource string) { - cstr := C.CString(defaultSource) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_print_settings_set_default_source(ps.native(), (*C.gchar)(cstr)) -} - -// GetMediaType() is a wrapper around gtk_print_settings_get_media_type(). -func (ps *PrintSettings) GetMediaType() string { - c := C.gtk_print_settings_get_media_type(ps.native()) - return C.GoString((*C.char)(c)) -} - -// SetMediaType() is a wrapper around gtk_print_settings_set_media_type(). -func (ps *PrintSettings) SetMediaType(mediaType string) { - cstr := C.CString(mediaType) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_print_settings_set_media_type(ps.native(), (*C.gchar)(cstr)) -} - -// GetDither() is a wrapper around gtk_print_settings_get_dither(). -func (ps *PrintSettings) GetDither() string { - c := C.gtk_print_settings_get_dither(ps.native()) - return C.GoString((*C.char)(c)) -} - -// SetDither() is a wrapper around gtk_print_settings_set_dither(). -func (ps *PrintSettings) SetDither(dither string) { - cstr := C.CString(dither) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_print_settings_set_dither(ps.native(), (*C.gchar)(cstr)) -} - -// GetFinishings() is a wrapper around gtk_print_settings_get_finishings(). -func (ps *PrintSettings) GetFinishings() string { - c := C.gtk_print_settings_get_finishings(ps.native()) - return C.GoString((*C.char)(c)) -} - -// SetFinishings() is a wrapper around gtk_print_settings_set_finishings(). -func (ps *PrintSettings) SetFinishings(dither string) { - cstr := C.CString(dither) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_print_settings_set_finishings(ps.native(), (*C.gchar)(cstr)) -} - -// GetOutputBin() is a wrapper around gtk_print_settings_get_output_bin(). -func (ps *PrintSettings) GetOutputBin() string { - c := C.gtk_print_settings_get_output_bin(ps.native()) - return C.GoString((*C.char)(c)) -} - -// SetOutputBin() is a wrapper around gtk_print_settings_set_output_bin(). -func (ps *PrintSettings) SetOutputBin(bin string) { - cstr := C.CString(bin) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_print_settings_set_output_bin(ps.native(), (*C.gchar)(cstr)) -} - -// PrintSettingsNewFromFile() is a wrapper around gtk_print_settings_new_from_file(). -func PrintSettingsNewFromFile(name string) (*PrintSettings, error) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - var err *C.GError = nil - c := C.gtk_print_settings_new_from_file((*C.gchar)(cstr), &err) - if c == nil { - defer C.g_error_free(err) - return nil, errors.New(C.GoString((*C.char)(err.message))) - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapPrintSettings(obj), nil -} - -// PrintSettingsNewFromKeyFile() is a wrapper around gtk_print_settings_new_from_key_file(). - -// LoadFile() is a wrapper around gtk_print_settings_load_file(). -func (ps *PrintSettings) LoadFile(name string) error { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - var err *C.GError = nil - c := C.gtk_print_settings_load_file(ps.native(), (*C.gchar)(cstr), &err) - if gobool(c) == false { - defer C.g_error_free(err) - return errors.New(C.GoString((*C.char)(err.message))) - } - return nil -} - -// LoadKeyFile() is a wrapper around gtk_print_settings_load_key_file(). - -// ToFile() is a wrapper around gtk_print_settings_to_file(). -func (ps *PrintSettings) ToFile(name string) error { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - var err *C.GError = nil - c := C.gtk_print_settings_to_file(ps.native(), (*C.gchar)(cstr), &err) - if gobool(c) == false { - return errors.New(C.GoString((*C.char)(err.message))) - } - return nil -} - -// ToKeyFile() is a wrapper around gtk_print_settings_to_key_file(). diff --git a/vendor/github.com/gotk3/gotk3/gtk/print_since_3_16.go b/vendor/github.com/gotk3/gotk3/gtk/print_since_3_16.go deleted file mode 100644 index 486026d..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/print_since_3_16.go +++ /dev/null @@ -1,34 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12,!gtk_3_14 - -// See: https://developer.gnome.org/gtk3/3.16/api-index-3-16.html - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "runtime" - "unsafe" -) - -// PaperSizeNewFromIpp is a wrapper around gtk_paper_size_new_from_ipp(). -func PaperSizeNewFromIPP(name string, width, height float64) (*PaperSize, error) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - - c := C.gtk_paper_size_new_from_ipp((*C.gchar)(cstr), C.gdouble(width), C.gdouble(height)) - if c == nil { - return nil, nilPtrErr - } - - t := &PaperSize{c} - runtime.SetFinalizer(t, (*PaperSize).free) - return t, nil -} - -// IsIPP() is a wrapper around gtk_paper_size_is_ipp(). -func (ps *PaperSize) IsIPP() bool { - c := C.gtk_paper_size_is_ipp(ps.native()) - return gobool(c) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/print_test.go b/vendor/github.com/gotk3/gotk3/gtk/print_test.go deleted file mode 100644 index ccd9a2c..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/print_test.go +++ /dev/null @@ -1,55 +0,0 @@ -package gtk - -import ( - "testing" -) - -func init() { - Init(nil) -} - -// TestPageSetup tests creating and manipulating PageSetup -func TestPageSetup(t *testing.T) { - _, err := PageSetupNew() - if err != nil { - t.Error(err) - } -} - -// TestPaperSize tests creating and manipulating PaperSize -func TestPaperSize(t *testing.T) { - _, err := PaperSizeNew(PAPER_NAME_A4) - if err != nil { - t.Error(err) - } -} - -// TestPrintContext tests creating and manipulating PrintContext - -// TestPrintOperation tests creating and manipulating PrintOperation -func TestPrintOperation(t *testing.T) { - _, err := PrintOperationNew() - if err != nil { - t.Error(err) - } -} - -// TestPrintOperationPreview tests creating and manipulating PrintOperationPreview - -// TestPrintSettings tests creating and manipulating PrintSettings -func TestPrintSettings(t *testing.T) { - settings, err := PrintSettingsNew() - if err != nil { - t.Error(err) - } - - settings.Set("Key1", "String1") - settings.SetBool("Key2", true) - settings.Set("Key3", "String2") - settings.SetInt("Key4", 2) - - settings.ForEach(func(key, value string, ptr uintptr) { - }, 0) -} - -// TestPrintContext tests creating and manipulating PrintContext diff --git a/vendor/github.com/gotk3/gotk3/gtk/settings.go b/vendor/github.com/gotk3/gotk3/gtk/settings.go deleted file mode 100644 index 7025eda..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/settings.go +++ /dev/null @@ -1,53 +0,0 @@ -package gtk - -// #include <gtk/gtk.h> -// #include "settings.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - {glib.Type(C.gtk_settings_get_type()), marshalSettings}, - } - - glib.RegisterGValueMarshalers(tm) - - WrapMap["GtkSettings"] = wrapSettings -} - -//GtkSettings -type Settings struct { - *glib.Object -} - -func (v *Settings) native() *C.GtkSettings { - if v == nil || v.GObject == nil { - return nil - } - - p := unsafe.Pointer(v.GObject) - return C.toGtkSettings(p) -} - -func marshalSettings(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - return wrapSettings(glib.Take(unsafe.Pointer(c))), nil -} - -func wrapSettings(obj *glib.Object) *Settings { - return &Settings{obj} -} - -//Get the global non window specific settings -func SettingsGetDefault() (*Settings, error) { - c := C.gtk_settings_get_default() - if c == nil { - return nil, nilPtrErr - } - - return wrapSettings(glib.Take(unsafe.Pointer(c))), nil -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/settings.go.h b/vendor/github.com/gotk3/gotk3/gtk/settings.go.h deleted file mode 100644 index 571b91a..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/settings.go.h +++ /dev/null @@ -1,5 +0,0 @@ -static GtkSettings * -toGtkSettings(void *p) -{ - return (GTK_SETTINGS(p)); -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/shortcutswindow_since_3_22.go b/vendor/github.com/gotk3/gotk3/gtk/shortcutswindow_since_3_22.go deleted file mode 100644 index ea98302..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/shortcutswindow_since_3_22.go +++ /dev/null @@ -1,140 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12,!gtk_3_14,!gtk_3_16,!gtk_3_18,!gtk_3_20 - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -// #include "shortcutswindow_since_3_22.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - {glib.Type(C.gtk_shortcuts_window_get_type()), marshalShortcutsWindow}, - {glib.Type(C.gtk_shortcuts_section_get_type()), marshalShortcutsSection}, - {glib.Type(C.gtk_shortcuts_group_get_type()), marshalShortcutsGroup}, - {glib.Type(C.gtk_shortcuts_shortcut_get_type()), marshalShortcutsShortcut}, - } - - glib.RegisterGValueMarshalers(tm) - - WrapMap["GtkShortcutsWindow"] = wrapShortcutsWindow - WrapMap["GtkShortcutsSection"] = wrapShortcutsSection - WrapMap["GtkShortcutsGroup"] = wrapShortcutsGroup - WrapMap["GtkShortcutsShortcut"] = wrapShortcutsShortcut -} - -/* - * GtkShortcutsWindow - */ - -// ShortcutsWindow is a representation of GTK's GtkShortcutsWindow. -type ShortcutsWindow struct { - Window -} - -func (v *ShortcutsWindow) native() *C.GtkShortcutsWindow { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkShortcutsWindow(p) -} - -func marshalShortcutsWindow(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapShortcutsWindow(obj), nil -} - -func wrapShortcutsWindow(obj *glib.Object) *ShortcutsWindow { - return &ShortcutsWindow{Window{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}}} -} - -/* - * GtkShortcutsSection - */ - -// ShortcutsWindow is a representation of GTK's GtkShortcutsSection. -type ShortcutsSection struct { - Box -} - -// native returns a pointer to the underlying GtkShortcutsSection. -func (v *ShortcutsSection) native() *C.GtkShortcutsSection { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkShortcutsSection(p) -} - -func marshalShortcutsSection(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapShortcutsSection(obj), nil -} - -func wrapShortcutsSection(obj *glib.Object) *ShortcutsSection { - return &ShortcutsSection{Box{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -/* - * GtkShortcutsSection - */ - -// ShortcutsWindow is a representation of GTK's GtkShortcutsGroup. -type ShortcutsGroup struct { - Box -} - -// native returns a pointer to the underlying GtkShortcutsGroup. -func (v *ShortcutsGroup) native() *C.GtkShortcutsGroup { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkShortcutsGroup(p) -} - -func marshalShortcutsGroup(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapShortcutsGroup(obj), nil -} - -func wrapShortcutsGroup(obj *glib.Object) *ShortcutsGroup { - return &ShortcutsGroup{Box{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -/* - * GtkShortcutsShortcut - */ - -// ShortcutsWindow is a representation of GTK's GtkShortcutsShortcut. -type ShortcutsShortcut struct { - Box -} - -// native returns a pointer to the underlying GtkShortcutsShortcut. -func (v *ShortcutsShortcut) native() *C.GtkShortcutsShortcut { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkShortcutsShortcut(p) -} - -func marshalShortcutsShortcut(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapShortcutsShortcut(obj), nil -} - -func wrapShortcutsShortcut(obj *glib.Object) *ShortcutsShortcut { - return &ShortcutsShortcut{Box{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/shortcutswindow_since_3_22.go.h b/vendor/github.com/gotk3/gotk3/gtk/shortcutswindow_since_3_22.go.h deleted file mode 100644 index 9a4a1a8..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/shortcutswindow_since_3_22.go.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> - * - * This file originated from: http://opensource.conformal.com/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -static GtkShortcutsWindow * -toGtkShortcutsWindow(void *p) -{ - return (GTK_SHORTCUTS_WINDOW(p)); -} - -static GtkShortcutsSection * -toGtkShortcutsSection(void *p) -{ - return (GTK_SHORTCUTS_SECTION(p)); -} - -static GtkShortcutsGroup * -toGtkShortcutsGroup(void *p) -{ - return (GTK_SHORTCUTS_GROUP(p)); -} - -static GtkShortcutsShortcut * -toGtkShortcutsShortcut(void *p) -{ - return (GTK_SHORTCUTS_SHORTCUT(p)); -}
\ No newline at end of file diff --git a/vendor/github.com/gotk3/gotk3/gtk/stack_since_3_12.go b/vendor/github.com/gotk3/gotk3/gtk/stack_since_3_12.go deleted file mode 100644 index e65604a..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/stack_since_3_12.go +++ /dev/null @@ -1,34 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains accelerator related functions and structures - -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10 -// not use this: go build -tags gtk_3_8'. Otherwise, if no build tags are used, GTK 3.10 - -package gtk - -// #include <stdlib.h> -// #include <gtk/gtk.h> -// #include "gtk_since_3_10.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -// GetChildByName is a wrapper around gtk_stack_get_child_by_name(). -func (v *Stack) GetChildByName(name string) *Widget { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - c := C.gtk_stack_get_child_by_name(v.native(), (*C.gchar)(cstr)) - if c == nil { - return nil - } - return wrapWidget(glib.Take(unsafe.Pointer(c))) -} - -// GetTransitionRunning is a wrapper around gtk_stack_get_transition_running(). -func (v *Stack) GetTransitionRunning() bool { - c := C.gtk_stack_get_transition_running(v.native()) - return gobool(c) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/stackswitcher_since_3_10.go b/vendor/github.com/gotk3/gotk3/gtk/stackswitcher_since_3_10.go deleted file mode 100644 index 3bc4b33..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/stackswitcher_since_3_10.go +++ /dev/null @@ -1,77 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains accelerator related functions and structures - -// +build !gtk_3_6,!gtk_3_8 -// not use this: go build -tags gtk_3_8'. Otherwise, if no build tags are used, GTK 3.10 - -package gtk - -// #include <stdlib.h> -// #include <gtk/gtk.h> -// #include "gtk_since_3_10.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - //Contribute to casting - for k, v := range map[string]WrapFn{ - "GtkStackSwitcher": wrapStackSwitcher, - } { - WrapMap[k] = v - } -} - -/* - * GtkStackSwitcher - */ - -// StackSwitcher is a representation of GTK's GtkStackSwitcher -type StackSwitcher struct { - Box -} - -// native returns a pointer to the underlying GtkStackSwitcher. -func (v *StackSwitcher) native() *C.GtkStackSwitcher { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkStackSwitcher(p) -} - -func marshalStackSwitcher(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapStackSwitcher(obj), nil -} - -func wrapStackSwitcher(obj *glib.Object) *StackSwitcher { - return &StackSwitcher{Box{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// StackSwitcherNew is a wrapper around gtk_stack_switcher_new(). -func StackSwitcherNew() (*StackSwitcher, error) { - c := C.gtk_stack_switcher_new() - if c == nil { - return nil, nilPtrErr - } - return wrapStackSwitcher(glib.Take(unsafe.Pointer(c))), nil -} - -// SetStack is a wrapper around gtk_stack_switcher_set_stack(). -func (v *StackSwitcher) SetStack(stack *Stack) { - C.gtk_stack_switcher_set_stack(v.native(), stack.native()) -} - -// GetStack is a wrapper around gtk_stack_switcher_get_stack(). -func (v *StackSwitcher) GetStack() *Stack { - c := C.gtk_stack_switcher_get_stack(v.native()) - if c == nil { - return nil - } - return wrapStack(glib.Take(unsafe.Pointer(c))) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/style.go b/vendor/github.com/gotk3/gotk3/gtk/style.go deleted file mode 100644 index 3babc74..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/style.go +++ /dev/null @@ -1,232 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains style related functions and structures - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" -) - -type StyleProviderPriority int - -const ( - STYLE_PROVIDER_PRIORITY_FALLBACK StyleProviderPriority = C.GTK_STYLE_PROVIDER_PRIORITY_FALLBACK - STYLE_PROVIDER_PRIORITY_THEME = C.GTK_STYLE_PROVIDER_PRIORITY_THEME - STYLE_PROVIDER_PRIORITY_SETTINGS = C.GTK_STYLE_PROVIDER_PRIORITY_SETTINGS - STYLE_PROVIDER_PRIORITY_APPLICATION = C.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION - STYLE_PROVIDER_PRIORITY_USER = C.GTK_STYLE_PROVIDER_PRIORITY_USER -) - -/* - * GtkStyleContext - */ - -// StyleContext is a representation of GTK's GtkStyleContext. -type StyleContext struct { - *glib.Object -} - -// native returns a pointer to the underlying GtkStyleContext. -func (v *StyleContext) native() *C.GtkStyleContext { - if v == nil || v.Object == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkStyleContext(p) -} - -func wrapStyleContext(obj *glib.Object) *StyleContext { - return &StyleContext{obj} -} - -func (v *StyleContext) AddClass(class_name string) { - cstr := C.CString(class_name) - defer C.free(unsafe.Pointer(cstr)) - - C.gtk_style_context_add_class(v.native(), (*C.gchar)(cstr)) -} - -func (v *StyleContext) RemoveClass(class_name string) { - cstr := C.CString(class_name) - defer C.free(unsafe.Pointer(cstr)) - - C.gtk_style_context_remove_class(v.native(), (*C.gchar)(cstr)) -} - -func fromNativeStyleContext(c *C.GtkStyleContext) (*StyleContext, error) { - if c == nil { - return nil, nilPtrErr - } - - obj := glib.Take(unsafe.Pointer(c)) - return wrapStyleContext(obj), nil -} - -// GetStyleContext is a wrapper around gtk_widget_get_style_context(). -func (v *Widget) GetStyleContext() (*StyleContext, error) { - return fromNativeStyleContext(C.gtk_widget_get_style_context(v.native())) -} - -// GetParent is a wrapper around gtk_style_context_get_parent(). -func (v *StyleContext) GetParent() (*StyleContext, error) { - return fromNativeStyleContext(C.gtk_style_context_get_parent(v.native())) -} - -// GetProperty is a wrapper around gtk_style_context_get_property(). -func (v *StyleContext) GetProperty(property string, state StateFlags) (interface{}, error) { - cstr := (*C.gchar)(C.CString(property)) - defer C.free(unsafe.Pointer(cstr)) - - var gval C.GValue - C.gtk_style_context_get_property(v.native(), cstr, C.GtkStateFlags(state), &gval) - val := glib.ValueFromNative(unsafe.Pointer(&gval)) - return val.GoValue() -} - -// GetStyleProperty is a wrapper around gtk_style_context_get_style_property(). -func (v *StyleContext) GetStyleProperty(property string) (interface{}, error) { - cstr := (*C.gchar)(C.CString(property)) - defer C.free(unsafe.Pointer(cstr)) - - var gval C.GValue - C.gtk_style_context_get_style_property(v.native(), cstr, &gval) - val := glib.ValueFromNative(unsafe.Pointer(&gval)) - return val.GoValue() -} - -// GetScreen is a wrapper around gtk_style_context_get_screen(). -func (v *StyleContext) GetScreen() (*gdk.Screen, error) { - c := C.gtk_style_context_get_screen(v.native()) - if c == nil { - return nil, nilPtrErr - } - - d := &gdk.Screen{glib.Take(unsafe.Pointer(c))} - return d, nil -} - -// GetState is a wrapper around gtk_style_context_get_state(). -func (v *StyleContext) GetState() StateFlags { - return StateFlags(C.gtk_style_context_get_state(v.native())) -} - -// GetColor is a wrapper around gtk_style_context_get_color(). -func (v *StyleContext) GetColor(state StateFlags) *gdk.RGBA { - gdkColor := gdk.NewRGBA() - C.gtk_style_context_get_color(v.native(), C.GtkStateFlags(state), (*C.GdkRGBA)(unsafe.Pointer(gdkColor.Native()))) - return gdkColor -} - -// LookupColor is a wrapper around gtk_style_context_lookup_color(). -func (v *StyleContext) LookupColor(colorName string) (*gdk.RGBA, bool) { - cstr := (*C.gchar)(C.CString(colorName)) - defer C.free(unsafe.Pointer(cstr)) - gdkColor := gdk.NewRGBA() - ret := C.gtk_style_context_lookup_color(v.native(), cstr, (*C.GdkRGBA)(unsafe.Pointer(gdkColor.Native()))) - return gdkColor, gobool(ret) -} - -// StyleContextResetWidgets is a wrapper around gtk_style_context_reset_widgets(). -func StyleContextResetWidgets(v *gdk.Screen) { - C.gtk_style_context_reset_widgets((*C.GdkScreen)(unsafe.Pointer(v.Native()))) -} - -// Restore is a wrapper around gtk_style_context_restore(). -func (v *StyleContext) Restore() { - C.gtk_style_context_restore(v.native()) -} - -// Save is a wrapper around gtk_style_context_save(). -func (v *StyleContext) Save() { - C.gtk_style_context_save(v.native()) -} - -// SetParent is a wrapper around gtk_style_context_set_parent(). -func (v *StyleContext) SetParent(p *StyleContext) { - C.gtk_style_context_set_parent(v.native(), p.native()) -} - -// HasClass is a wrapper around gtk_style_context_has_class(). -func (v *StyleContext) HasClass(className string) bool { - cstr := C.CString(className) - defer C.free(unsafe.Pointer(cstr)) - - return gobool(C.gtk_style_context_has_class(v.native(), (*C.gchar)(cstr))) -} - -// SetScreen is a wrapper around gtk_style_context_set_screen(). -func (v *StyleContext) SetScreen(s *gdk.Screen) { - C.gtk_style_context_set_screen(v.native(), (*C.GdkScreen)(unsafe.Pointer(s.Native()))) -} - -// SetState is a wrapper around gtk_style_context_set_state(). -func (v *StyleContext) SetState(state StateFlags) { - C.gtk_style_context_set_state(v.native(), C.GtkStateFlags(state)) -} - -type IStyleProvider interface { - toStyleProvider() *C.GtkStyleProvider -} - -// AddProvider is a wrapper around gtk_style_context_add_provider(). -func (v *StyleContext) AddProvider(provider IStyleProvider, prio uint) { - C.gtk_style_context_add_provider(v.native(), provider.toStyleProvider(), C.guint(prio)) -} - -// AddProviderForScreen is a wrapper around gtk_style_context_add_provider_for_screen(). -func AddProviderForScreen(s *gdk.Screen, provider IStyleProvider, prio uint) { - C.gtk_style_context_add_provider_for_screen((*C.GdkScreen)(unsafe.Pointer(s.Native())), provider.toStyleProvider(), C.guint(prio)) -} - -// RemoveProvider is a wrapper around gtk_style_context_remove_provider(). -func (v *StyleContext) RemoveProvider(provider IStyleProvider) { - C.gtk_style_context_remove_provider(v.native(), provider.toStyleProvider()) -} - -// RemoveProviderForScreen is a wrapper around gtk_style_context_remove_provider_for_screen(). -func RemoveProviderForScreen(s *gdk.Screen, provider IStyleProvider) { - C.gtk_style_context_remove_provider_for_screen((*C.GdkScreen)(unsafe.Pointer(s.Native())), provider.toStyleProvider()) -} - -// GtkStyleContext * gtk_style_context_new () -// void gtk_style_context_get () -// GtkTextDirection gtk_style_context_get_direction () -// GtkJunctionSides gtk_style_context_get_junction_sides () -// const GtkWidgetPath * gtk_style_context_get_path () -// GdkFrameClock * gtk_style_context_get_frame_clock () -// void gtk_style_context_get_style () -// void gtk_style_context_get_style_valist () -// void gtk_style_context_get_valist () -// GtkCssSection * gtk_style_context_get_section () -// void gtk_style_context_get_background_color () -// void gtk_style_context_get_border_color () -// void gtk_style_context_get_border () -// void gtk_style_context_get_padding () -// void gtk_style_context_get_margin () -// const PangoFontDescription * gtk_style_context_get_font () -// void gtk_style_context_invalidate () -// gboolean gtk_style_context_state_is_running () -// GtkIconSet * gtk_style_context_lookup_icon_set () -// void gtk_style_context_cancel_animations () -// void gtk_style_context_scroll_animations () -// void gtk_style_context_notify_state_change () -// void gtk_style_context_pop_animatable_region () -// void gtk_style_context_push_animatable_region () -// void gtk_style_context_set_background () -// void gtk_style_context_set_direction () -// void gtk_style_context_set_junction_sides () -// void gtk_style_context_set_path () -// void gtk_style_context_add_region () -// void gtk_style_context_remove_region () -// gboolean gtk_style_context_has_region () -// GList * gtk_style_context_list_regions () -// void gtk_style_context_set_frame_clock () -// void gtk_style_context_set_scale () -// gint gtk_style_context_get_scale () -// GList * gtk_style_context_list_classes () diff --git a/vendor/github.com/gotk3/gotk3/gtk/text_child_anchor.go b/vendor/github.com/gotk3/gotk3/gtk/text_child_anchor.go deleted file mode 100644 index 1ba3634..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/text_child_anchor.go +++ /dev/null @@ -1,19 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" - -/* - * GtkTextChildAnchor - */ - -// TextChildAnchor is a representation of GTK's GtkTextChildAnchor -type TextChildAnchor C.GtkTextChildAnchor - -// native returns a pointer to the underlying GtkTextChildAnchor. -func (v *TextChildAnchor) native() *C.GtkTextChildAnchor { - return (*C.GtkTextChildAnchor)(v) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/text_iter.go b/vendor/github.com/gotk3/gotk3/gtk/text_iter.go deleted file mode 100644 index 178f339..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/text_iter.go +++ /dev/null @@ -1,403 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" - -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -/* - * GtkTextIter - */ - -// TextIter is a representation of GTK's GtkTextIter -type TextIter C.GtkTextIter - -// native returns a pointer to the underlying GtkTextIter. -func (v *TextIter) native() *C.GtkTextIter { - if v == nil { - return nil - } - return (*C.GtkTextIter)(v) -} - -func marshalTextIter(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - return (*TextIter)(unsafe.Pointer(c)), nil -} - -// GetBuffer is a wrapper around gtk_text_iter_get_buffer(). -func (v *TextIter) GetBuffer() *TextBuffer { - c := C.gtk_text_iter_get_buffer(v.native()) - if c == nil { - return nil - } - return wrapTextBuffer(glib.Take(unsafe.Pointer(c))) -} - -// GetOffset is a wrapper around gtk_text_iter_get_offset(). -func (v *TextIter) GetOffset() int { - return int(C.gtk_text_iter_get_offset(v.native())) -} - -// GetLine is a wrapper around gtk_text_iter_get_line(). -func (v *TextIter) GetLine() int { - return int(C.gtk_text_iter_get_line(v.native())) -} - -// GetLineOffset is a wrapper around gtk_text_iter_get_line_offset(). -func (v *TextIter) GetLineOffset() int { - return int(C.gtk_text_iter_get_line_offset(v.native())) -} - -// GetLineIndex is a wrapper around gtk_text_iter_get_line_index(). -func (v *TextIter) GetLineIndex() int { - return int(C.gtk_text_iter_get_line_index(v.native())) -} - -// GetVisibleLineOffset is a wrapper around gtk_text_iter_get_visible_line_offset(). -func (v *TextIter) GetVisibleLineOffset() int { - return int(C.gtk_text_iter_get_visible_line_offset(v.native())) -} - -// GetVisibleLineIndex is a wrapper around gtk_text_iter_get_visible_line_index(). -func (v *TextIter) GetVisibleLineIndex() int { - return int(C.gtk_text_iter_get_visible_line_index(v.native())) -} - -// GetChar is a wrapper around gtk_text_iter_get_char(). -func (v *TextIter) GetChar() rune { - return rune(C.gtk_text_iter_get_char(v.native())) -} - -// GetSlice is a wrapper around gtk_text_iter_get_slice(). -func (v *TextIter) GetSlice(end *TextIter) string { - c := C.gtk_text_iter_get_slice(v.native(), end.native()) - return C.GoString((*C.char)(c)) -} - -// GetText is a wrapper around gtk_text_iter_get_text(). -func (v *TextIter) GetText(end *TextIter) string { - c := C.gtk_text_iter_get_text(v.native(), end.native()) - return C.GoString((*C.char)(c)) -} - -// GetVisibleSlice is a wrapper around gtk_text_iter_get_visible_slice(). -func (v *TextIter) GetVisibleSlice(end *TextIter) string { - c := C.gtk_text_iter_get_visible_slice(v.native(), end.native()) - return C.GoString((*C.char)(c)) -} - -// GetVisibleText is a wrapper around gtk_text_iter_get_visible_text(). -func (v *TextIter) GetVisibleText(end *TextIter) string { - c := C.gtk_text_iter_get_visible_text(v.native(), end.native()) - return C.GoString((*C.char)(c)) -} - -// EndsTag is a wrapper around gtk_text_iter_ends_tag(). -func (v *TextIter) EndsTag(v1 *TextTag) bool { - return gobool(C.gtk_text_iter_ends_tag(v.native(), v1.native())) -} - -// TogglesTag is a wrapper around gtk_text_iter_toggles_tag(). -func (v *TextIter) TogglesTag(v1 *TextTag) bool { - return gobool(C.gtk_text_iter_toggles_tag(v.native(), v1.native())) -} - -// HasTag is a wrapper around gtk_text_iter_has_tag(). -func (v *TextIter) HasTag(v1 *TextTag) bool { - return gobool(C.gtk_text_iter_has_tag(v.native(), v1.native())) -} - -// Editable is a wrapper around gtk_text_iter_editable(). -func (v *TextIter) Editable(v1 bool) bool { - return gobool(C.gtk_text_iter_editable(v.native(), gbool(v1))) -} - -// CanInsert is a wrapper around gtk_text_iter_can_insert(). -func (v *TextIter) CanInsert(v1 bool) bool { - return gobool(C.gtk_text_iter_can_insert(v.native(), gbool(v1))) -} - -// StartsWord is a wrapper around gtk_text_iter_starts_word(). -func (v *TextIter) StartsWord() bool { - return gobool(C.gtk_text_iter_starts_word(v.native())) -} - -// EndsWord is a wrapper around gtk_text_iter_ends_word(). -func (v *TextIter) EndsWord() bool { - return gobool(C.gtk_text_iter_ends_word(v.native())) -} - -// InsideWord is a wrapper around gtk_text_iter_inside_word(). -func (v *TextIter) InsideWord() bool { - return gobool(C.gtk_text_iter_inside_word(v.native())) -} - -// StartsLine is a wrapper around gtk_text_iter_starts_line(). -func (v *TextIter) StartsLine() bool { - return gobool(C.gtk_text_iter_starts_line(v.native())) -} - -// EndsLine is a wrapper around gtk_text_iter_ends_line(). -func (v *TextIter) EndsLine() bool { - return gobool(C.gtk_text_iter_ends_line(v.native())) -} - -// StartsSentence is a wrapper around gtk_text_iter_starts_sentence(). -func (v *TextIter) StartsSentence() bool { - return gobool(C.gtk_text_iter_starts_sentence(v.native())) -} - -// EndsSentence is a wrapper around gtk_text_iter_ends_sentence(). -func (v *TextIter) EndsSentence() bool { - return gobool(C.gtk_text_iter_ends_sentence(v.native())) -} - -// InsideSentence is a wrapper around gtk_text_iter_inside_sentence(). -func (v *TextIter) InsideSentence() bool { - return gobool(C.gtk_text_iter_inside_sentence(v.native())) -} - -// IsCursorPosition is a wrapper around gtk_text_iter_is_cursor_position(). -func (v *TextIter) IsCursorPosition() bool { - return gobool(C.gtk_text_iter_is_cursor_position(v.native())) -} - -// GetCharsInLine is a wrapper around gtk_text_iter_get_chars_in_line(). -func (v *TextIter) GetCharsInLine() int { - return int(C.gtk_text_iter_get_chars_in_line(v.native())) -} - -// GetBytesInLine is a wrapper around gtk_text_iter_get_bytes_in_line(). -func (v *TextIter) GetBytesInLine() int { - return int(C.gtk_text_iter_get_bytes_in_line(v.native())) -} - -// IsEnd is a wrapper around gtk_text_iter_is_end(). -func (v *TextIter) IsEnd() bool { - return gobool(C.gtk_text_iter_is_end(v.native())) -} - -// IsStart is a wrapper around gtk_text_iter_is_start(). -func (v *TextIter) IsStart() bool { - return gobool(C.gtk_text_iter_is_start(v.native())) -} - -// ForwardChar is a wrapper around gtk_text_iter_forward_char(). -func (v *TextIter) ForwardChar() bool { - return gobool(C.gtk_text_iter_forward_char(v.native())) -} - -// BackwardChar is a wrapper around gtk_text_iter_backward_char(). -func (v *TextIter) BackwardChar() bool { - return gobool(C.gtk_text_iter_backward_char(v.native())) -} - -// ForwardChars is a wrapper around gtk_text_iter_forward_chars(). -func (v *TextIter) ForwardChars(v1 int) bool { - return gobool(C.gtk_text_iter_forward_chars(v.native(), C.gint(v1))) -} - -// BackwardChars is a wrapper around gtk_text_iter_backward_chars(). -func (v *TextIter) BackwardChars(v1 int) bool { - return gobool(C.gtk_text_iter_backward_chars(v.native(), C.gint(v1))) -} - -// ForwardLine is a wrapper around gtk_text_iter_forward_line(). -func (v *TextIter) ForwardLine() bool { - return gobool(C.gtk_text_iter_forward_line(v.native())) -} - -// BackwardLine is a wrapper around gtk_text_iter_backward_line(). -func (v *TextIter) BackwardLine() bool { - return gobool(C.gtk_text_iter_backward_line(v.native())) -} - -// ForwardLines is a wrapper around gtk_text_iter_forward_lines(). -func (v *TextIter) ForwardLines(v1 int) bool { - return gobool(C.gtk_text_iter_forward_lines(v.native(), C.gint(v1))) -} - -// BackwardLines is a wrapper around gtk_text_iter_backward_lines(). -func (v *TextIter) BackwardLines(v1 int) bool { - return gobool(C.gtk_text_iter_backward_lines(v.native(), C.gint(v1))) -} - -// ForwardWordEnds is a wrapper around gtk_text_iter_forward_word_ends(). -func (v *TextIter) ForwardWordEnds(v1 int) bool { - return gobool(C.gtk_text_iter_forward_word_ends(v.native(), C.gint(v1))) -} - -// ForwardWordEnd is a wrapper around gtk_text_iter_forward_word_end(). -func (v *TextIter) ForwardWordEnd() bool { - return gobool(C.gtk_text_iter_forward_word_end(v.native())) -} - -// ForwardCursorPosition is a wrapper around gtk_text_iter_forward_cursor_position(). -func (v *TextIter) ForwardCursorPosition() bool { - return gobool(C.gtk_text_iter_forward_cursor_position(v.native())) -} - -// BackwardCursorPosition is a wrapper around gtk_text_iter_backward_cursor_position(). -func (v *TextIter) BackwardCursorPosition() bool { - return gobool(C.gtk_text_iter_backward_cursor_position(v.native())) -} - -// ForwardCursorPositions is a wrapper around gtk_text_iter_forward_cursor_positions(). -func (v *TextIter) ForwardCursorPositions(v1 int) bool { - return gobool(C.gtk_text_iter_forward_cursor_positions(v.native(), C.gint(v1))) -} - -// BackwardCursorPositions is a wrapper around gtk_text_iter_backward_cursor_positions(). -func (v *TextIter) BackwardCursorPositions(v1 int) bool { - return gobool(C.gtk_text_iter_backward_cursor_positions(v.native(), C.gint(v1))) -} - -// ForwardSentenceEnds is a wrapper around gtk_text_iter_forward_sentence_ends(). -func (v *TextIter) ForwardSentenceEnds(v1 int) bool { - return gobool(C.gtk_text_iter_forward_sentence_ends(v.native(), C.gint(v1))) -} - -// ForwardSentenceEnd is a wrapper around gtk_text_iter_forward_sentence_end(). -func (v *TextIter) ForwardSentenceEnd() bool { - return gobool(C.gtk_text_iter_forward_sentence_end(v.native())) -} - -// ForwardVisibleWordEnds is a wrapper around gtk_text_iter_forward_word_ends(). -func (v *TextIter) ForwardVisibleWordEnds(v1 int) bool { - return gobool(C.gtk_text_iter_forward_word_ends(v.native(), C.gint(v1))) -} - -// ForwardVisibleWordEnd is a wrapper around gtk_text_iter_forward_visible_word_end(). -func (v *TextIter) ForwardVisibleWordEnd() bool { - return gobool(C.gtk_text_iter_forward_visible_word_end(v.native())) -} - -// ForwardVisibleCursorPosition is a wrapper around gtk_text_iter_forward_visible_cursor_position(). -func (v *TextIter) ForwardVisibleCursorPosition() bool { - return gobool(C.gtk_text_iter_forward_visible_cursor_position(v.native())) -} - -// BackwardVisibleCursorPosition is a wrapper around gtk_text_iter_backward_visible_cursor_position(). -func (v *TextIter) BackwardVisibleCursorPosition() bool { - return gobool(C.gtk_text_iter_backward_visible_cursor_position(v.native())) -} - -// ForwardVisibleCursorPositions is a wrapper around gtk_text_iter_forward_visible_cursor_positions(). -func (v *TextIter) ForwardVisibleCursorPositions(v1 int) bool { - return gobool(C.gtk_text_iter_forward_visible_cursor_positions(v.native(), C.gint(v1))) -} - -// BackwardVisibleCursorPositions is a wrapper around gtk_text_iter_backward_visible_cursor_positions(). -func (v *TextIter) BackwardVisibleCursorPositions(v1 int) bool { - return gobool(C.gtk_text_iter_backward_visible_cursor_positions(v.native(), C.gint(v1))) -} - -// ForwardVisibleLine is a wrapper around gtk_text_iter_forward_visible_line(). -func (v *TextIter) ForwardVisibleLine() bool { - return gobool(C.gtk_text_iter_forward_visible_line(v.native())) -} - -// BackwardVisibleLine is a wrapper around gtk_text_iter_backward_visible_line(). -func (v *TextIter) BackwardVisibleLine() bool { - return gobool(C.gtk_text_iter_backward_visible_line(v.native())) -} - -// ForwardVisibleLines is a wrapper around gtk_text_iter_forward_visible_lines(). -func (v *TextIter) ForwardVisibleLines(v1 int) bool { - return gobool(C.gtk_text_iter_forward_visible_lines(v.native(), C.gint(v1))) -} - -// BackwardVisibleLines is a wrapper around gtk_text_iter_backward_visible_lines(). -func (v *TextIter) BackwardVisibleLines(v1 int) bool { - return gobool(C.gtk_text_iter_backward_visible_lines(v.native(), C.gint(v1))) -} - -// SetOffset is a wrapper around gtk_text_iter_set_offset(). -func (v *TextIter) SetOffset(v1 int) { - C.gtk_text_iter_set_offset(v.native(), C.gint(v1)) -} - -// SetLine is a wrapper around gtk_text_iter_set_line(). -func (v *TextIter) SetLine(v1 int) { - C.gtk_text_iter_set_line(v.native(), C.gint(v1)) -} - -// SetLineOffset is a wrapper around gtk_text_iter_set_line_offset(). -func (v *TextIter) SetLineOffset(v1 int) { - C.gtk_text_iter_set_line_offset(v.native(), C.gint(v1)) -} - -// SetLineIndex is a wrapper around gtk_text_iter_set_line_index(). -func (v *TextIter) SetLineIndex(v1 int) { - C.gtk_text_iter_set_line_index(v.native(), C.gint(v1)) -} - -// SetVisibleLineOffset is a wrapper around gtk_text_iter_set_visible_line_offset(). -func (v *TextIter) SetVisibleLineOffset(v1 int) { - C.gtk_text_iter_set_visible_line_offset(v.native(), C.gint(v1)) -} - -// SetVisibleLineIndex is a wrapper around gtk_text_iter_set_visible_line_index(). -func (v *TextIter) SetVisibleLineIndex(v1 int) { - C.gtk_text_iter_set_visible_line_index(v.native(), C.gint(v1)) -} - -// ForwardToEnd is a wrapper around gtk_text_iter_forward_to_end(). -func (v *TextIter) ForwardToEnd() { - C.gtk_text_iter_forward_to_end(v.native()) -} - -// ForwardToLineEnd is a wrapper around gtk_text_iter_forward_to_line_end(). -func (v *TextIter) ForwardToLineEnd() bool { - return gobool(C.gtk_text_iter_forward_to_line_end(v.native())) -} - -// ForwardToTagToggle is a wrapper around gtk_text_iter_forward_to_tag_toggle(). -func (v *TextIter) ForwardToTagToggle(v1 *TextTag) bool { - return gobool(C.gtk_text_iter_forward_to_tag_toggle(v.native(), v1.native())) -} - -// BackwardToTagToggle is a wrapper around gtk_text_iter_backward_to_tag_toggle(). -func (v *TextIter) BackwardToTagToggle(v1 *TextTag) bool { - return gobool(C.gtk_text_iter_backward_to_tag_toggle(v.native(), v1.native())) -} - -// Equal is a wrapper around gtk_text_iter_equal(). -func (v *TextIter) Equal(v1 *TextIter) bool { - return gobool(C.gtk_text_iter_equal(v.native(), v1.native())) -} - -// Compare is a wrapper around gtk_text_iter_compare(). -func (v *TextIter) Compare(v1 *TextIter) int { - return int(C.gtk_text_iter_compare(v.native(), v1.native())) -} - -// InRange is a wrapper around gtk_text_iter_in_range(). -func (v *TextIter) InRange(v1 *TextIter, v2 *TextIter) bool { - return gobool(C.gtk_text_iter_in_range(v.native(), v1.native(), v2.native())) -} - -// void gtk_text_iter_order () -// gboolean (*GtkTextCharPredicate) () -// gboolean gtk_text_iter_forward_find_char () -// gboolean gtk_text_iter_backward_find_char () -// gboolean gtk_text_iter_forward_search () -// gboolean gtk_text_iter_backward_search () -// gboolean gtk_text_iter_get_attributes () -// GtkTextIter * gtk_text_iter_copy () -// void gtk_text_iter_assign () -// void gtk_text_iter_free () -// GdkPixbuf * gtk_text_iter_get_pixbuf () -// GSList * gtk_text_iter_get_marks () -// GSList * gtk_text_iter_get_toggled_tags () -// GtkTextChildAnchor * gtk_text_iter_get_child_anchor () -// GSList * gtk_text_iter_get_tags () -// PangoLanguage * gtk_text_iter_get_language () diff --git a/vendor/github.com/gotk3/gotk3/gtk/text_mark.go b/vendor/github.com/gotk3/gotk3/gtk/text_mark.go deleted file mode 100644 index 1a41934..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/text_mark.go +++ /dev/null @@ -1,29 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" - -import "unsafe" - -/* - * GtkTextMark - */ - -// TextMark is a representation of GTK's GtkTextMark -type TextMark C.GtkTextMark - -// native returns a pointer to the underlying GtkTextMark. -func (v *TextMark) native() *C.GtkTextMark { - if v == nil { - return nil - } - return (*C.GtkTextMark)(v) -} - -func marshalTextMark(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - return (*TextMark)(unsafe.Pointer(c)), nil -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/text_view.go b/vendor/github.com/gotk3/gotk3/gtk/text_view.go deleted file mode 100644 index 979c3d7..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/text_view.go +++ /dev/null @@ -1,423 +0,0 @@ -// Same copyright and license as the rest of the files in this project - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" -) - -// TextWindowType is a representation of GTK's GtkTextWindowType. -type TextWindowType int - -const ( - TEXT_WINDOW_WIDGET TextWindowType = C.GTK_TEXT_WINDOW_WIDGET - TEXT_WINDOW_TEXT TextWindowType = C.GTK_TEXT_WINDOW_TEXT - TEXT_WINDOW_LEFT TextWindowType = C.GTK_TEXT_WINDOW_LEFT - TEXT_WINDOW_RIGHT TextWindowType = C.GTK_TEXT_WINDOW_RIGHT - TEXT_WINDOW_TOP TextWindowType = C.GTK_TEXT_WINDOW_TOP - TEXT_WINDOW_BOTTOM TextWindowType = C.GTK_TEXT_WINDOW_BOTTOM -) - -/* - * GtkTextView - */ - -// TextView is a representation of GTK's GtkTextView -type TextView struct { - Container -} - -// native returns a pointer to the underlying GtkTextView. -func (v *TextView) native() *C.GtkTextView { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkTextView(p) -} - -func marshalTextView(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapTextView(obj), nil -} - -func wrapTextView(obj *glib.Object) *TextView { - return &TextView{Container{Widget{glib.InitiallyUnowned{obj}}}} -} - -// TextViewNew is a wrapper around gtk_text_view_new(). -func TextViewNew() (*TextView, error) { - c := C.gtk_text_view_new() - if c == nil { - return nil, nilPtrErr - } - return wrapTextView(glib.Take(unsafe.Pointer(c))), nil -} - -// TextViewNewWithBuffer is a wrapper around gtk_text_view_new_with_buffer(). -func TextViewNewWithBuffer(buf *TextBuffer) (*TextView, error) { - cbuf := buf.native() - c := C.gtk_text_view_new_with_buffer(cbuf) - return wrapTextView(glib.Take(unsafe.Pointer(c))), nil -} - -// GetBuffer is a wrapper around gtk_text_view_get_buffer(). -func (v *TextView) GetBuffer() (*TextBuffer, error) { - c := C.gtk_text_view_get_buffer(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapTextBuffer(glib.Take(unsafe.Pointer(c))), nil -} - -// SetBuffer is a wrapper around gtk_text_view_set_buffer(). -func (v *TextView) SetBuffer(buffer *TextBuffer) { - C.gtk_text_view_set_buffer(v.native(), buffer.native()) -} - -// SetEditable is a wrapper around gtk_text_view_set_editable(). -func (v *TextView) SetEditable(editable bool) { - C.gtk_text_view_set_editable(v.native(), gbool(editable)) -} - -// GetEditable is a wrapper around gtk_text_view_get_editable(). -func (v *TextView) GetEditable() bool { - c := C.gtk_text_view_get_editable(v.native()) - return gobool(c) -} - -// SetWrapMode is a wrapper around gtk_text_view_set_wrap_mode(). -func (v *TextView) SetWrapMode(wrapMode WrapMode) { - C.gtk_text_view_set_wrap_mode(v.native(), C.GtkWrapMode(wrapMode)) -} - -// GetWrapMode is a wrapper around gtk_text_view_get_wrap_mode(). -func (v *TextView) GetWrapMode() WrapMode { - return WrapMode(C.gtk_text_view_get_wrap_mode(v.native())) -} - -// SetCursorVisible is a wrapper around gtk_text_view_set_cursor_visible(). -func (v *TextView) SetCursorVisible(visible bool) { - C.gtk_text_view_set_cursor_visible(v.native(), gbool(visible)) -} - -// GetCursorVisible is a wrapper around gtk_text_view_get_cursor_visible(). -func (v *TextView) GetCursorVisible() bool { - c := C.gtk_text_view_get_cursor_visible(v.native()) - return gobool(c) -} - -// SetOverwrite is a wrapper around gtk_text_view_set_overwrite(). -func (v *TextView) SetOverwrite(overwrite bool) { - C.gtk_text_view_set_overwrite(v.native(), gbool(overwrite)) -} - -// GetOverwrite is a wrapper around gtk_text_view_get_overwrite(). -func (v *TextView) GetOverwrite() bool { - c := C.gtk_text_view_get_overwrite(v.native()) - return gobool(c) -} - -// SetJustification is a wrapper around gtk_text_view_set_justification(). -func (v *TextView) SetJustification(justify Justification) { - C.gtk_text_view_set_justification(v.native(), C.GtkJustification(justify)) -} - -// GetJustification is a wrapper around gtk_text_view_get_justification(). -func (v *TextView) GetJustification() Justification { - c := C.gtk_text_view_get_justification(v.native()) - return Justification(c) -} - -// SetAcceptsTab is a wrapper around gtk_text_view_set_accepts_tab(). -func (v *TextView) SetAcceptsTab(acceptsTab bool) { - C.gtk_text_view_set_accepts_tab(v.native(), gbool(acceptsTab)) -} - -// GetAcceptsTab is a wrapper around gtk_text_view_get_accepts_tab(). -func (v *TextView) GetAcceptsTab() bool { - c := C.gtk_text_view_get_accepts_tab(v.native()) - return gobool(c) -} - -// SetPixelsAboveLines is a wrapper around gtk_text_view_set_pixels_above_lines(). -func (v *TextView) SetPixelsAboveLines(px int) { - C.gtk_text_view_set_pixels_above_lines(v.native(), C.gint(px)) -} - -// GetPixelsAboveLines is a wrapper around gtk_text_view_get_pixels_above_lines(). -func (v *TextView) GetPixelsAboveLines() int { - c := C.gtk_text_view_get_pixels_above_lines(v.native()) - return int(c) -} - -// SetPixelsBelowLines is a wrapper around gtk_text_view_set_pixels_below_lines(). -func (v *TextView) SetPixelsBelowLines(px int) { - C.gtk_text_view_set_pixels_below_lines(v.native(), C.gint(px)) -} - -// GetPixelsBelowLines is a wrapper around gtk_text_view_get_pixels_below_lines(). -func (v *TextView) GetPixelsBelowLines() int { - c := C.gtk_text_view_get_pixels_below_lines(v.native()) - return int(c) -} - -// SetPixelsInsideWrap is a wrapper around gtk_text_view_set_pixels_inside_wrap(). -func (v *TextView) SetPixelsInsideWrap(px int) { - C.gtk_text_view_set_pixels_inside_wrap(v.native(), C.gint(px)) -} - -// GetPixelsInsideWrap is a wrapper around gtk_text_view_get_pixels_inside_wrap(). -func (v *TextView) GetPixelsInsideWrap() int { - c := C.gtk_text_view_get_pixels_inside_wrap(v.native()) - return int(c) -} - -// SetLeftMargin is a wrapper around gtk_text_view_set_left_margin(). -func (v *TextView) SetLeftMargin(margin int) { - C.gtk_text_view_set_left_margin(v.native(), C.gint(margin)) -} - -// GetLeftMargin is a wrapper around gtk_text_view_get_left_margin(). -func (v *TextView) GetLeftMargin() int { - c := C.gtk_text_view_get_left_margin(v.native()) - return int(c) -} - -// SetRightMargin is a wrapper around gtk_text_view_set_right_margin(). -func (v *TextView) SetRightMargin(margin int) { - C.gtk_text_view_set_right_margin(v.native(), C.gint(margin)) -} - -// GetRightMargin is a wrapper around gtk_text_view_get_right_margin(). -func (v *TextView) GetRightMargin() int { - c := C.gtk_text_view_get_right_margin(v.native()) - return int(c) -} - -// SetIndent is a wrapper around gtk_text_view_set_indent(). -func (v *TextView) SetIndent(indent int) { - C.gtk_text_view_set_indent(v.native(), C.gint(indent)) -} - -// GetIndent is a wrapper around gtk_text_view_get_indent(). -func (v *TextView) GetIndent() int { - c := C.gtk_text_view_get_indent(v.native()) - return int(c) -} - -// SetInputHints is a wrapper around gtk_text_view_set_input_hints(). -func (v *TextView) SetInputHints(hints InputHints) { - C.gtk_text_view_set_input_hints(v.native(), C.GtkInputHints(hints)) -} - -// GetInputHints is a wrapper around gtk_text_view_get_input_hints(). -func (v *TextView) GetInputHints() InputHints { - c := C.gtk_text_view_get_input_hints(v.native()) - return InputHints(c) -} - -// SetInputPurpose is a wrapper around gtk_text_view_set_input_purpose(). -func (v *TextView) SetInputPurpose(purpose InputPurpose) { - C.gtk_text_view_set_input_purpose(v.native(), - C.GtkInputPurpose(purpose)) -} - -// GetInputPurpose is a wrapper around gtk_text_view_get_input_purpose(). -func (v *TextView) GetInputPurpose() InputPurpose { - c := C.gtk_text_view_get_input_purpose(v.native()) - return InputPurpose(c) -} - -// ScrollToMark is a wrapper around gtk_text_view_scroll_to_mark(). -func (v *TextView) ScrollToMark(mark *TextMark, within_margin float64, use_align bool, xalign, yalign float64) { - C.gtk_text_view_scroll_to_mark(v.native(), mark.native(), C.gdouble(within_margin), gbool(use_align), C.gdouble(xalign), C.gdouble(yalign)) -} - -// ScrollToIter is a wrapper around gtk_text_view_scroll_to_iter(). -func (v *TextView) ScrollToIter(iter *TextIter, within_margin float64, use_align bool, xalign, yalign float64) bool { - return gobool(C.gtk_text_view_scroll_to_iter(v.native(), iter.native(), C.gdouble(within_margin), gbool(use_align), C.gdouble(xalign), C.gdouble(yalign))) -} - -// ScrollMarkOnscreen is a wrapper around gtk_text_view_scroll_mark_onscreen(). -func (v *TextView) ScrollMarkOnscreen(mark *TextMark) { - C.gtk_text_view_scroll_mark_onscreen(v.native(), mark.native()) -} - -// MoveMarkOnscreen is a wrapper around gtk_text_view_move_mark_onscreen(). -func (v *TextView) MoveMarkOnscreen(mark *TextMark) bool { - return gobool(C.gtk_text_view_move_mark_onscreen(v.native(), mark.native())) -} - -// PlaceCursorOnscreen is a wrapper around gtk_text_view_place_cursor_onscreen(). -func (v *TextView) PlaceCursorOnscreen() bool { - return gobool(C.gtk_text_view_place_cursor_onscreen(v.native())) -} - -// GetVisibleRect is a wrapper around gtk_text_view_get_visible_rect(). -func (v *TextView) GetVisibleRect() *gdk.Rectangle { - var rect C.GdkRectangle - C.gtk_text_view_get_visible_rect(v.native(), &rect) - return gdk.WrapRectangle(uintptr(unsafe.Pointer(&rect))) -} - -// GetIterLocation is a wrapper around gtk_text_view_get_iter_location(). -func (v *TextView) GetIterLocation(iter *TextIter) *gdk.Rectangle { - var rect C.GdkRectangle - C.gtk_text_view_get_iter_location(v.native(), iter.native(), &rect) - return gdk.WrapRectangle(uintptr(unsafe.Pointer(&rect))) -} - -// GetCursorLocations is a wrapper around gtk_text_view_get_cursor_locations(). -func (v *TextView) GetCursorLocations(iter *TextIter) (strong, weak *gdk.Rectangle) { - var strongRect, weakRect C.GdkRectangle - C.gtk_text_view_get_cursor_locations(v.native(), iter.native(), &strongRect, &weakRect) - return gdk.WrapRectangle(uintptr(unsafe.Pointer(&strongRect))), gdk.WrapRectangle(uintptr(unsafe.Pointer(&weakRect))) -} - -// GetLineAtY is a wrapper around gtk_text_view_get_line_at_y(). -func (v *TextView) GetLineAtY(y int) (*TextIter, int) { - var iter TextIter - var line_top C.gint - iiter := (C.GtkTextIter)(iter) - C.gtk_text_view_get_line_at_y(v.native(), &iiter, C.gint(y), &line_top) - return &iter, int(line_top) -} - -// GetLineYrange is a wrapper around gtk_text_view_get_line_yrange(). -func (v *TextView) GetLineYrange(iter *TextIter) (y, height int) { - var yx, heightx C.gint - C.gtk_text_view_get_line_yrange(v.native(), iter.native(), &yx, &heightx) - return int(yx), int(heightx) -} - -// GetIterAtLocation is a wrapper around gtk_text_view_get_iter_at_location(). -func (v *TextView) GetIterAtLocation(x, y int) *TextIter { - var iter C.GtkTextIter - C.gtk_text_view_get_iter_at_location(v.native(), &iter, C.gint(x), C.gint(y)) - return (*TextIter)(&iter) -} - -// GetIterAtPosition is a wrapper around gtk_text_view_get_iter_at_position(). -func (v *TextView) GetIterAtPosition(x, y int) (*TextIter, int) { - var iter C.GtkTextIter - var trailing C.gint - C.gtk_text_view_get_iter_at_position(v.native(), &iter, &trailing, C.gint(x), C.gint(y)) - return (*TextIter)(&iter), int(trailing) -} - -// BufferToWindowCoords is a wrapper around gtk_text_view_buffer_to_window_coords(). -func (v *TextView) BufferToWindowCoords(win TextWindowType, buffer_x, buffer_y int) (window_x, window_y int) { - var wx, wy C.gint - C.gtk_text_view_buffer_to_window_coords(v.native(), C.GtkTextWindowType(win), C.gint(buffer_x), C.gint(buffer_y), &wx, &wy) - return int(wx), int(wy) -} - -// WindowToBufferCoords is a wrapper around gtk_text_view_window_to_buffer_coords(). -func (v *TextView) WindowToBufferCoords(win TextWindowType, window_x, window_y int) (buffer_x, buffer_y int) { - var bx, by C.gint - C.gtk_text_view_window_to_buffer_coords(v.native(), C.GtkTextWindowType(win), C.gint(window_x), C.gint(window_y), &bx, &by) - return int(bx), int(by) -} - -// GetWindow is a wrapper around gtk_text_view_get_window(). -func (v *TextView) GetWindow(win TextWindowType) *gdk.Window { - c := C.gtk_text_view_get_window(v.native(), C.GtkTextWindowType(win)) - if c == nil { - return nil - } - return &gdk.Window{glib.Take(unsafe.Pointer(c))} -} - -// GetWindowType is a wrapper around gtk_text_view_get_window_type(). -func (v *TextView) GetWindowType(w *gdk.Window) TextWindowType { - return TextWindowType(C.gtk_text_view_get_window_type(v.native(), (*C.GdkWindow)(unsafe.Pointer(w.Native())))) -} - -// SetBorderWindowSize is a wrapper around gtk_text_view_set_border_window_size(). -func (v *TextView) SetBorderWindowSize(tp TextWindowType, size int) { - C.gtk_text_view_set_border_window_size(v.native(), C.GtkTextWindowType(tp), C.gint(size)) -} - -// GetBorderWindowSize is a wrapper around gtk_text_view_get_border_window_size(). -func (v *TextView) GetBorderWindowSize(tp TextWindowType) int { - return int(C.gtk_text_view_get_border_window_size(v.native(), C.GtkTextWindowType(tp))) -} - -// ForwardDisplayLine is a wrapper around gtk_text_view_forward_display_line(). -func (v *TextView) ForwardDisplayLine(iter *TextIter) bool { - return gobool(C.gtk_text_view_forward_display_line(v.native(), iter.native())) -} - -// BackwardDisplayLine is a wrapper around gtk_text_view_backward_display_line(). -func (v *TextView) BackwardDisplayLine(iter *TextIter) bool { - return gobool(C.gtk_text_view_backward_display_line(v.native(), iter.native())) -} - -// ForwardDisplayLineEnd is a wrapper around gtk_text_view_forward_display_line_end(). -func (v *TextView) ForwardDisplayLineEnd(iter *TextIter) bool { - return gobool(C.gtk_text_view_forward_display_line_end(v.native(), iter.native())) -} - -// BackwardDisplayLineStart is a wrapper around gtk_text_view_backward_display_line_start(). -func (v *TextView) BackwardDisplayLineStart(iter *TextIter) bool { - return gobool(C.gtk_text_view_backward_display_line_start(v.native(), iter.native())) -} - -// StartsDisplayLine is a wrapper around gtk_text_view_starts_display_line(). -func (v *TextView) StartsDisplayLine(iter *TextIter) bool { - return gobool(C.gtk_text_view_starts_display_line(v.native(), iter.native())) -} - -// MoveVisually is a wrapper around gtk_text_view_move_visually(). -func (v *TextView) MoveVisually(iter *TextIter, count int) bool { - return gobool(C.gtk_text_view_move_visually(v.native(), iter.native(), C.gint(count))) -} - -// AddChildInWindow is a wrapper around gtk_text_view_add_child_in_window(). -func (v *TextView) AddChildInWindow(child IWidget, tp TextWindowType, xpos, ypos int) { - C.gtk_text_view_add_child_in_window(v.native(), child.toWidget(), C.GtkTextWindowType(tp), C.gint(xpos), C.gint(ypos)) -} - -// MoveChild is a wrapper around gtk_text_view_move_child(). -func (v *TextView) MoveChild(child IWidget, xpos, ypos int) { - C.gtk_text_view_move_child(v.native(), child.toWidget(), C.gint(xpos), C.gint(ypos)) -} - -// ImContextFilterKeypress is a wrapper around gtk_text_view_im_context_filter_keypress(). -func (v *TextView) ImContextFilterKeypress(event *gdk.EventKey) bool { - return gobool(C.gtk_text_view_im_context_filter_keypress(v.native(), (*C.GdkEventKey)(unsafe.Pointer(event.Native())))) -} - -// ResetImContext is a wrapper around gtk_text_view_reset_im_context(). -func (v *TextView) ResetImContext() { - C.gtk_text_view_reset_im_context(v.native()) -} - -// AddChildAtAnchor is a wrapper around gtk_text_view_add_child_at_anchor(). -func (v *TextView) AddChildAtAnchor(child IWidget, anchor *TextChildAnchor) { - C.gtk_text_view_add_child_at_anchor(v.native(), child.toWidget(), anchor.native()) -} - -// GtkAdjustment * gtk_text_view_get_hadjustment () -- DEPRECATED -// GtkAdjustment * gtk_text_view_get_vadjustment () -- DEPRECATED -// void gtk_text_view_add_child_at_anchor () -// GtkTextChildAnchor * gtk_text_child_anchor_new () -// GList * gtk_text_child_anchor_get_widgets () -// gboolean gtk_text_child_anchor_get_deleted () -// void gtk_text_view_set_top_margin () -- SINCE 3.18 -// gint gtk_text_view_get_top_margin () -- SINCE 3.18 -// void gtk_text_view_set_bottom_margin () -- SINCE 3.18 -// gint gtk_text_view_get_bottom_margin () -- SINCE 3.18 -// void gtk_text_view_set_tabs () -- PangoTabArray -// PangoTabArray * gtk_text_view_get_tabs () -- PangoTabArray -// GtkTextAttributes * gtk_text_view_get_default_attributes () -- GtkTextAttributes -// void gtk_text_view_set_monospace () -- SINCE 3.16 -// gboolean gtk_text_view_get_monospace () -- SINCE 3.16 diff --git a/vendor/github.com/gotk3/gotk3/gtk/tooltip.go b/vendor/github.com/gotk3/gotk3/gtk/tooltip.go deleted file mode 100644 index c713ea5..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/tooltip.go +++ /dev/null @@ -1,79 +0,0 @@ -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" -) - -/* - * GtkTooltip - */ - -type Tooltip struct { - Widget -} - -// native returns a pointer to the underlying GtkIconView. -func (t *Tooltip) native() *C.GtkTooltip { - if t == nil || t.GObject == nil { - return nil - } - p := unsafe.Pointer(t.GObject) - return C.toGtkTooltip(p) -} - -func marshalTooltip(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapTooltip(obj), nil -} - -func wrapTooltip(obj *glib.Object) *Tooltip { - return &Tooltip{Widget{glib.InitiallyUnowned{obj}}} -} - -// SetMarkup is a wrapper around gtk_tooltip_set_markup(). -func (t *Tooltip) SetMarkup(str string) { - cstr := C.CString(str) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_tooltip_set_markup(t.native(), (*C.gchar)(cstr)) -} - -// SetText is a wrapper around gtk_tooltip_set_text(). -func (t *Tooltip) SetText(str string) { - cstr := C.CString(str) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_tooltip_set_text(t.native(), (*C.gchar)(cstr)) -} - -// SetIcon is a wrapper around gtk_tooltip_set_icon(). -func (t *Tooltip) SetIcon(pixbuf *gdk.Pixbuf) { - C.gtk_tooltip_set_icon(t.native(), - (*C.GdkPixbuf)(unsafe.Pointer(pixbuf.Native()))) -} - -// SetIconFromIconName is a wrapper around gtk_tooltip_set_icon_from_icon_name(). -func (t *Tooltip) SetIconFromIconName(iconName string, size IconSize) { - cstr := C.CString(iconName) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_tooltip_set_icon_from_icon_name(t.native(), - (*C.gchar)(cstr), - C.GtkIconSize(size)) -} - -// func (t *Tooltip) SetIconFromGIcon() { } - -// SetCustom is a wrapper around gtk_tooltip_set_custom(). -func (t *Tooltip) SetCustom(w *Widget) { - C.gtk_tooltip_set_custom(t.native(), w.native()) -} - -// SetTipArea is a wrapper around gtk_tooltip_set_tip_area(). -func (t *Tooltip) SetTipArea(rect gdk.Rectangle) { - C.gtk_tooltip_set_tip_area(t.native(), nativeGdkRectangle(rect)) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/tree_view.go b/vendor/github.com/gotk3/gotk3/gtk/tree_view.go deleted file mode 100644 index 5aec6e1..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/tree_view.go +++ /dev/null @@ -1,458 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains accelerator related functions and structures - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "runtime" - "unsafe" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" -) - -/* - * GtkTreeView - */ - -// TreeView is a representation of GTK's GtkTreeView. -type TreeView struct { - Container -} - -// native returns a pointer to the underlying GtkTreeView. -func (v *TreeView) native() *C.GtkTreeView { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkTreeView(p) -} - -func marshalTreeView(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapTreeView(obj), nil -} - -func wrapTreeView(obj *glib.Object) *TreeView { - return &TreeView{Container{Widget{glib.InitiallyUnowned{obj}}}} -} - -func setupTreeView(c unsafe.Pointer) (*TreeView, error) { - if c == nil { - return nil, nilPtrErr - } - - return wrapTreeView(glib.Take(c)), nil -} - -// TreeViewNew is a wrapper around gtk_tree_view_new(). -func TreeViewNew() (*TreeView, error) { - return setupTreeView(unsafe.Pointer(C.gtk_tree_view_new())) -} - -// TreeViewNewWithModel is a wrapper around gtk_tree_view_new_with_model(). -func TreeViewNewWithModel(model ITreeModel) (*TreeView, error) { - return setupTreeView(unsafe.Pointer(C.gtk_tree_view_new_with_model(model.toTreeModel()))) -} - -// GetModel is a wrapper around gtk_tree_view_get_model(). -func (v *TreeView) GetModel() (*TreeModel, error) { - c := C.gtk_tree_view_get_model(v.native()) - if c == nil { - return nil, nil - } - return wrapTreeModel(glib.Take(unsafe.Pointer(c))), nil -} - -// SetModel is a wrapper around gtk_tree_view_set_model(). -func (v *TreeView) SetModel(model ITreeModel) { - if model == nil { - C.gtk_tree_view_set_model(v.native(), nil) - } else { - C.gtk_tree_view_set_model(v.native(), model.toTreeModel()) - } -} - -// GetSelection is a wrapper around gtk_tree_view_get_selection(). -func (v *TreeView) GetSelection() (*TreeSelection, error) { - c := C.gtk_tree_view_get_selection(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapTreeSelection(glib.Take(unsafe.Pointer(c))), nil -} - -// AppendColumn is a wrapper around gtk_tree_view_append_column(). -func (v *TreeView) AppendColumn(column *TreeViewColumn) int { - c := C.gtk_tree_view_append_column(v.native(), column.native()) - return int(c) -} - -// GetPathAtPos is a wrapper around gtk_tree_view_get_path_at_pos(). -func (v *TreeView) GetPathAtPos(x, y int, path *TreePath, column *TreeViewColumn, cellX, cellY *int) bool { - var ctp **C.GtkTreePath - if path != nil { - ctp = (**C.GtkTreePath)(unsafe.Pointer(&path.GtkTreePath)) - } else { - ctp = nil - } - - var pctvcol **C.GtkTreeViewColumn - if column != nil { - ctvcol := column.native() - pctvcol = &ctvcol - } else { - pctvcol = nil - } - - return 0 != C.gtk_tree_view_get_path_at_pos( - v.native(), - (C.gint)(x), - (C.gint)(y), - ctp, - pctvcol, - (*C.gint)(unsafe.Pointer(cellX)), - (*C.gint)(unsafe.Pointer(cellY))) -} - -// GetLevelIndentation is a wrapper around gtk_tree_view_get_level_indentation(). -func (v *TreeView) GetLevelIndentation() int { - return int(C.gtk_tree_view_get_level_indentation(v.native())) -} - -// GetShowExpanders is a wrapper around gtk_tree_view_get_show_expanders(). -func (v *TreeView) GetShowExpanders() bool { - return gobool(C.gtk_tree_view_get_show_expanders(v.native())) -} - -// SetLevelIndentation is a wrapper around gtk_tree_view_set_level_indentation(). -func (v *TreeView) SetLevelIndentation(indent int) { - C.gtk_tree_view_set_level_indentation(v.native(), C.gint(indent)) -} - -// SetShowExpanders is a wrapper around gtk_tree_view_set_show_expanders(). -func (v *TreeView) SetShowExpanders(show bool) { - C.gtk_tree_view_set_show_expanders(v.native(), gbool(show)) -} - -// GetHeadersVisible is a wrapper around gtk_tree_view_get_headers_visible(). -func (v *TreeView) GetHeadersVisible() bool { - return gobool(C.gtk_tree_view_get_headers_visible(v.native())) -} - -// SetHeadersVisible is a wrapper around gtk_tree_view_set_headers_visible(). -func (v *TreeView) SetHeadersVisible(show bool) { - C.gtk_tree_view_set_headers_visible(v.native(), gbool(show)) -} - -// ColumnsAutosize is a wrapper around gtk_tree_view_columns_autosize(). -func (v *TreeView) ColumnsAutosize() { - C.gtk_tree_view_columns_autosize(v.native()) -} - -// GetHeadersClickable is a wrapper around gtk_tree_view_get_headers_clickable(). -func (v *TreeView) GetHeadersClickable() bool { - return gobool(C.gtk_tree_view_get_headers_clickable(v.native())) -} - -// SetHeadersClickable is a wrapper around gtk_tree_view_set_headers_clickable(). -func (v *TreeView) SetHeadersClickable(show bool) { - C.gtk_tree_view_set_headers_clickable(v.native(), gbool(show)) -} - -// GetActivateOnSingleClick is a wrapper around gtk_tree_view_get_activate_on_single_click(). -func (v *TreeView) GetActivateOnSingleClick() bool { - return gobool(C.gtk_tree_view_get_activate_on_single_click(v.native())) -} - -// SetActivateOnSingleClick is a wrapper around gtk_tree_view_set_activate_on_single_click(). -func (v *TreeView) SetActivateOnSingleClick(show bool) { - C.gtk_tree_view_set_activate_on_single_click(v.native(), gbool(show)) -} - -// RemoveColumn is a wrapper around gtk_tree_view_remove_column(). -func (v *TreeView) RemoveColumn(column *TreeViewColumn) int { - return int(C.gtk_tree_view_remove_column(v.native(), column.native())) -} - -// InsertColumn is a wrapper around gtk_tree_view_insert_column(). -func (v *TreeView) InsertColumn(column *TreeViewColumn, pos int) int { - return int(C.gtk_tree_view_insert_column(v.native(), column.native(), C.gint(pos))) -} - -// GetNColumns is a wrapper around gtk_tree_view_get_n_columns(). -func (v *TreeView) GetNColumns() uint { - return uint(C.gtk_tree_view_get_n_columns(v.native())) -} - -// GetColumn is a wrapper around gtk_tree_view_get_column(). -func (v *TreeView) GetColumn(n int) *TreeViewColumn { - c := C.gtk_tree_view_get_column(v.native(), C.gint(n)) - if c == nil { - return nil - } - return wrapTreeViewColumn(glib.Take(unsafe.Pointer(c))) -} - -// MoveColumnAfter is a wrapper around gtk_tree_view_move_column_after(). -func (v *TreeView) MoveColumnAfter(column *TreeViewColumn, baseColumn *TreeViewColumn) { - C.gtk_tree_view_move_column_after(v.native(), column.native(), baseColumn.native()) -} - -// SetExpanderColumn is a wrapper around gtk_tree_view_set_expander_column(). -func (v *TreeView) SetExpanderColumn(column *TreeViewColumn) { - C.gtk_tree_view_set_expander_column(v.native(), column.native()) -} - -// GetExpanderColumn is a wrapper around gtk_tree_view_get_expander_column(). -func (v *TreeView) GetExpanderColumn() *TreeViewColumn { - c := C.gtk_tree_view_get_expander_column(v.native()) - if c == nil { - return nil - } - return wrapTreeViewColumn(glib.Take(unsafe.Pointer(c))) -} - -// ScrollToPoint is a wrapper around gtk_tree_view_scroll_to_point(). -func (v *TreeView) ScrollToPoint(treeX, treeY int) { - C.gtk_tree_view_scroll_to_point(v.native(), C.gint(treeX), C.gint(treeY)) -} - -// SetCursor is a wrapper around gtk_tree_view_set_cursor(). -func (v *TreeView) SetCursor(path *TreePath, focusColumn *TreeViewColumn, startEditing bool) { - C.gtk_tree_view_set_cursor(v.native(), path.native(), focusColumn.native(), gbool(startEditing)) -} - -// SetCursorOnCell is a wrapper around gtk_tree_view_set_cursor_on_cell(). -func (v *TreeView) SetCursorOnCell(path *TreePath, focusColumn *TreeViewColumn, focusCell *CellRenderer, startEditing bool) { - C.gtk_tree_view_set_cursor_on_cell(v.native(), path.native(), focusColumn.native(), focusCell.native(), gbool(startEditing)) -} - -// GetCursor is a wrapper around gtk_tree_view_get_cursor(). -func (v *TreeView) GetCursor() (p *TreePath, c *TreeViewColumn) { - var path *C.GtkTreePath - var col *C.GtkTreeViewColumn - - C.gtk_tree_view_get_cursor(v.native(), &path, &col) - - if path != nil { - p = &TreePath{path} - runtime.SetFinalizer(p, (*TreePath).free) - } - - if col != nil { - c = wrapTreeViewColumn(glib.Take(unsafe.Pointer(col))) - } - - return -} - -// RowActivated is a wrapper around gtk_tree_view_row_activated(). -func (v *TreeView) RowActivated(path *TreePath, column *TreeViewColumn) { - C.gtk_tree_view_row_activated(v.native(), path.native(), column.native()) -} - -// ExpandAll is a wrapper around gtk_tree_view_expand_all(). -func (v *TreeView) ExpandAll() { - C.gtk_tree_view_expand_all(v.native()) -} - -// CollapseAll is a wrapper around gtk_tree_view_collapse_all(). -func (v *TreeView) CollapseAll() { - C.gtk_tree_view_collapse_all(v.native()) -} - -// ExpandToPath is a wrapper around gtk_tree_view_expand_to_path(). -func (v *TreeView) ExpandToPath(path *TreePath) { - C.gtk_tree_view_expand_to_path(v.native(), path.native()) -} - -// ExpandRow is a wrapper around gtk_tree_view_expand_row(). -func (v *TreeView) ExpandRow(path *TreePath, openAll bool) bool { - return gobool(C.gtk_tree_view_expand_row(v.native(), path.native(), gbool(openAll))) -} - -// CollapseRow is a wrapper around gtk_tree_view_collapse_row(). -func (v *TreeView) CollapseRow(path *TreePath) bool { - return gobool(C.gtk_tree_view_collapse_row(v.native(), path.native())) -} - -// RowExpanded is a wrapper around gtk_tree_view_row_expanded(). -func (v *TreeView) RowExpanded(path *TreePath) bool { - return gobool(C.gtk_tree_view_row_expanded(v.native(), path.native())) -} - -// SetReorderable is a wrapper around gtk_tree_view_set_reorderable(). -func (v *TreeView) SetReorderable(b bool) { - C.gtk_tree_view_set_reorderable(v.native(), gbool(b)) -} - -// GetReorderable is a wrapper around gtk_tree_view_get_reorderable(). -func (v *TreeView) GetReorderable() bool { - return gobool(C.gtk_tree_view_get_reorderable(v.native())) -} - -// GetBinWindow is a wrapper around gtk_tree_view_get_bin_window(). -func (v *TreeView) GetBinWindow() *gdk.Window { - c := C.gtk_tree_view_get_bin_window(v.native()) - if c == nil { - return nil - } - - w := &gdk.Window{glib.Take(unsafe.Pointer(c))} - return w -} - -// SetEnableSearch is a wrapper around gtk_tree_view_set_enable_search(). -func (v *TreeView) SetEnableSearch(b bool) { - C.gtk_tree_view_set_enable_search(v.native(), gbool(b)) -} - -// GetEnableSearch is a wrapper around gtk_tree_view_get_enable_search(). -func (v *TreeView) GetEnableSearch() bool { - return gobool(C.gtk_tree_view_get_enable_search(v.native())) -} - -// SetSearchColumn is a wrapper around gtk_tree_view_set_search_column(). -func (v *TreeView) SetSearchColumn(c int) { - C.gtk_tree_view_set_search_column(v.native(), C.gint(c)) -} - -// GetSearchColumn is a wrapper around gtk_tree_view_get_search_column(). -func (v *TreeView) GetSearchColumn() int { - return int(C.gtk_tree_view_get_search_column(v.native())) -} - -// GetSearchEntry is a wrapper around gtk_tree_view_get_search_entry(). -func (v *TreeView) GetSearchEntry() *Entry { - c := C.gtk_tree_view_get_search_entry(v.native()) - if c == nil { - return nil - } - return wrapEntry(glib.Take(unsafe.Pointer(c))) -} - -// SetSearchEntry is a wrapper around gtk_tree_view_set_search_entry(). -func (v *TreeView) SetSearchEntry(e *Entry) { - C.gtk_tree_view_set_search_entry(v.native(), e.native()) -} - -// SetSearchEqualSubstringMatch sets TreeView to search by substring match. -func (v *TreeView) SetSearchEqualSubstringMatch() { - C.gtk_tree_view_set_search_equal_func( - v.native(), - (C.GtkTreeViewSearchEqualFunc)(unsafe.Pointer(C.substring_match_equal_func)), - nil, - nil) -} - -// SetFixedHeightMode is a wrapper around gtk_tree_view_set_fixed_height_mode(). -func (v *TreeView) SetFixedHeightMode(b bool) { - C.gtk_tree_view_set_fixed_height_mode(v.native(), gbool(b)) -} - -// GetFixedHeightMode is a wrapper around gtk_tree_view_get_fixed_height_mode(). -func (v *TreeView) GetFixedHeightMode() bool { - return gobool(C.gtk_tree_view_get_fixed_height_mode(v.native())) -} - -// SetHoverSelection is a wrapper around gtk_tree_view_set_hover_selection(). -func (v *TreeView) SetHoverSelection(b bool) { - C.gtk_tree_view_set_hover_selection(v.native(), gbool(b)) -} - -// GetHoverSelection is a wrapper around gtk_tree_view_get_hover_selection(). -func (v *TreeView) GetHoverSelection() bool { - return gobool(C.gtk_tree_view_get_hover_selection(v.native())) -} - -// SetHoverExpand is a wrapper around gtk_tree_view_set_hover_expand(). -func (v *TreeView) SetHoverExpand(b bool) { - C.gtk_tree_view_set_hover_expand(v.native(), gbool(b)) -} - -// GetHoverExpand is a wrapper around gtk_tree_view_get_hover_expand(). -func (v *TreeView) GetHoverExpand() bool { - return gobool(C.gtk_tree_view_get_hover_expand(v.native())) -} - -// SetRubberBanding is a wrapper around gtk_tree_view_set_rubber_banding(). -func (v *TreeView) SetRubberBanding(b bool) { - C.gtk_tree_view_set_rubber_banding(v.native(), gbool(b)) -} - -// GetRubberBanding is a wrapper around gtk_tree_view_get_rubber_banding(). -func (v *TreeView) GetRubberBanding() bool { - return gobool(C.gtk_tree_view_get_rubber_banding(v.native())) -} - -// IsRubberBandingActive is a wrapper around gtk_tree_view_is_rubber_banding_active(). -func (v *TreeView) IsRubberBandingActive() bool { - return gobool(C.gtk_tree_view_is_rubber_banding_active(v.native())) -} - -// SetEnableTreeLines is a wrapper around gtk_tree_view_set_enable_tree_lines(). -func (v *TreeView) SetEnableTreeLines(b bool) { - C.gtk_tree_view_set_enable_tree_lines(v.native(), gbool(b)) -} - -// GetEnableTreeLines is a wrapper around gtk_tree_view_get_enable_tree_lines(). -func (v *TreeView) GetEnableTreeLines() bool { - return gobool(C.gtk_tree_view_get_enable_tree_lines(v.native())) -} - -// GetTooltipColumn is a wrapper around gtk_tree_view_get_tooltip_column(). -func (v *TreeView) GetTooltipColumn() int { - return int(C.gtk_tree_view_get_tooltip_column(v.native())) -} - -// SetTooltipColumn is a wrapper around gtk_tree_view_set_tooltip_column(). -func (v *TreeView) SetTooltipColumn(c int) { - C.gtk_tree_view_set_tooltip_column(v.native(), C.gint(c)) -} - -// void gtk_tree_view_set_tooltip_row () -// void gtk_tree_view_set_tooltip_cell () -// gboolean gtk_tree_view_get_tooltip_context () -// void gtk_tree_view_set_grid_lines () -// GtkTreeViewGridLines gtk_tree_view_get_grid_lines () -// void (*GtkTreeDestroyCountFunc) () -// void gtk_tree_view_set_destroy_count_func () -// gboolean (*GtkTreeViewRowSeparatorFunc) () -// GtkTreeViewRowSeparatorFunc gtk_tree_view_get_row_separator_func () -// void gtk_tree_view_set_row_separator_func () -// void (*GtkTreeViewSearchPositionFunc) () -// GtkTreeViewSearchPositionFunc gtk_tree_view_get_search_position_func () -// void gtk_tree_view_set_search_position_func () -// void gtk_tree_view_set_search_equal_func () -// GtkTreeViewSearchEqualFunc gtk_tree_view_get_search_equal_func () -// void gtk_tree_view_map_expanded_rows () -// GList * gtk_tree_view_get_columns () -// gint gtk_tree_view_insert_column_with_attributes () -// gint gtk_tree_view_insert_column_with_data_func () -// void gtk_tree_view_set_column_drag_function () -// void gtk_tree_view_scroll_to_cell () -// gboolean gtk_tree_view_is_blank_at_pos () -// void gtk_tree_view_get_cell_area () -// void gtk_tree_view_get_background_area () -// void gtk_tree_view_get_visible_rect () -// gboolean gtk_tree_view_get_visible_range () -// void gtk_tree_view_convert_bin_window_to_tree_coords () -// void gtk_tree_view_convert_bin_window_to_widget_coords () -// void gtk_tree_view_convert_tree_to_bin_window_coords () -// void gtk_tree_view_convert_tree_to_widget_coords () -// void gtk_tree_view_convert_widget_to_bin_window_coords () -// void gtk_tree_view_convert_widget_to_tree_coords () -// void gtk_tree_view_enable_model_drag_dest () -// void gtk_tree_view_enable_model_drag_source () -// void gtk_tree_view_unset_rows_drag_source () -// void gtk_tree_view_unset_rows_drag_dest () -// void gtk_tree_view_set_drag_dest_row () -// void gtk_tree_view_get_drag_dest_row () -// gboolean gtk_tree_view_get_dest_row_at_pos () -// cairo_surface_t * gtk_tree_view_create_row_drag_icon () diff --git a/vendor/github.com/gotk3/gotk3/gtk/tree_view_column.go b/vendor/github.com/gotk3/gotk3/gtk/tree_view_column.go deleted file mode 100644 index 34c8b98..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/tree_view_column.go +++ /dev/null @@ -1,291 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains accelerator related functions and structures - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -/* - * GtkTreeViewColumn - */ - -// TreeViewColumns is a representation of GTK's GtkTreeViewColumn. -type TreeViewColumn struct { - glib.InitiallyUnowned -} - -// native returns a pointer to the underlying GtkTreeViewColumn. -func (v *TreeViewColumn) native() *C.GtkTreeViewColumn { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkTreeViewColumn(p) -} - -func marshalTreeViewColumn(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapTreeViewColumn(obj), nil -} - -func wrapTreeViewColumn(obj *glib.Object) *TreeViewColumn { - return &TreeViewColumn{glib.InitiallyUnowned{obj}} -} - -// TreeViewColumnNew() is a wrapper around gtk_tree_view_column_new(). -func TreeViewColumnNew() (*TreeViewColumn, error) { - c := C.gtk_tree_view_column_new() - if c == nil { - return nil, nilPtrErr - } - return wrapTreeViewColumn(glib.Take(unsafe.Pointer(c))), nil -} - -// TreeViewColumnNewWithAttribute() is a wrapper around -// gtk_tree_view_column_new_with_attributes() that only sets one -// attribute for one column. -func TreeViewColumnNewWithAttribute(title string, renderer ICellRenderer, attribute string, column int) (*TreeViewColumn, error) { - t_cstr := C.CString(title) - defer C.free(unsafe.Pointer(t_cstr)) - a_cstr := C.CString(attribute) - defer C.free(unsafe.Pointer(a_cstr)) - c := C._gtk_tree_view_column_new_with_attributes_one((*C.gchar)(t_cstr), - renderer.toCellRenderer(), (*C.gchar)(a_cstr), C.gint(column)) - if c == nil { - return nil, nilPtrErr - } - return wrapTreeViewColumn(glib.Take(unsafe.Pointer(c))), nil -} - -// AddAttribute() is a wrapper around gtk_tree_view_column_add_attribute(). -func (v *TreeViewColumn) AddAttribute(renderer ICellRenderer, attribute string, column int) { - cstr := C.CString(attribute) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_tree_view_column_add_attribute(v.native(), - renderer.toCellRenderer(), (*C.gchar)(cstr), C.gint(column)) -} - -// SetExpand() is a wrapper around gtk_tree_view_column_set_expand(). -func (v *TreeViewColumn) SetExpand(expand bool) { - C.gtk_tree_view_column_set_expand(v.native(), gbool(expand)) -} - -// GetExpand() is a wrapper around gtk_tree_view_column_get_expand(). -func (v *TreeViewColumn) GetExpand() bool { - c := C.gtk_tree_view_column_get_expand(v.native()) - return gobool(c) -} - -// SetMinWidth() is a wrapper around gtk_tree_view_column_set_min_width(). -func (v *TreeViewColumn) SetMinWidth(minWidth int) { - C.gtk_tree_view_column_set_min_width(v.native(), C.gint(minWidth)) -} - -// GetMinWidth() is a wrapper around gtk_tree_view_column_get_min_width(). -func (v *TreeViewColumn) GetMinWidth() int { - c := C.gtk_tree_view_column_get_min_width(v.native()) - return int(c) -} - -// PackStart() is a wrapper around gtk_tree_view_column_pack_start(). -func (v *TreeViewColumn) PackStart(cell ICellRenderer, expand bool) { - C.gtk_tree_view_column_pack_start(v.native(), cell.toCellRenderer(), gbool(expand)) -} - -// PackEnd() is a wrapper around gtk_tree_view_column_pack_end(). -func (v *TreeViewColumn) PackEnd(cell ICellRenderer, expand bool) { - C.gtk_tree_view_column_pack_end(v.native(), cell.toCellRenderer(), gbool(expand)) -} - -// Clear() is a wrapper around gtk_tree_view_column_clear(). -func (v *TreeViewColumn) Clear() { - C.gtk_tree_view_column_clear(v.native()) -} - -// ClearAttributes() is a wrapper around gtk_tree_view_column_clear_attributes(). -func (v *TreeViewColumn) ClearAttributes(cell *CellRenderer) { - C.gtk_tree_view_column_clear_attributes(v.native(), cell.native()) -} - -// SetSpacing() is a wrapper around gtk_tree_view_column_set_spacing(). -func (v *TreeViewColumn) SetSpacing(spacing int) { - C.gtk_tree_view_column_set_spacing(v.native(), C.gint(spacing)) -} - -// GetSpacing() is a wrapper around gtk_tree_view_column_get_spacing(). -func (v *TreeViewColumn) GetSpacing() int { - return int(C.gtk_tree_view_column_get_spacing(v.native())) -} - -// SetVisible() is a wrapper around gtk_tree_view_column_set_visible(). -func (v *TreeViewColumn) SetVisible(visible bool) { - C.gtk_tree_view_column_set_visible(v.native(), gbool(visible)) -} - -// GetVisible() is a wrapper around gtk_tree_view_column_get_visible(). -func (v *TreeViewColumn) GetVisible() bool { - return gobool(C.gtk_tree_view_column_get_visible(v.native())) -} - -// SetResizable() is a wrapper around gtk_tree_view_column_set_resizable(). -func (v *TreeViewColumn) SetResizable(resizable bool) { - C.gtk_tree_view_column_set_resizable(v.native(), gbool(resizable)) -} - -// GetResizable() is a wrapper around gtk_tree_view_column_get_resizable(). -func (v *TreeViewColumn) GetResizable() bool { - return gobool(C.gtk_tree_view_column_get_resizable(v.native())) -} - -// GetWidth() is a wrapper around gtk_tree_view_column_get_width(). -func (v *TreeViewColumn) GetWidth() int { - return int(C.gtk_tree_view_column_get_width(v.native())) -} - -// SetFixedWidth() is a wrapper around gtk_tree_view_column_set_fixed_width(). -func (v *TreeViewColumn) SetFixedWidth(w int) { - C.gtk_tree_view_column_set_fixed_width(v.native(), C.gint(w)) -} - -// GetFixedWidth() is a wrapper around gtk_tree_view_column_get_fixed_width(). -func (v *TreeViewColumn) GetFixedWidth() int { - return int(C.gtk_tree_view_column_get_fixed_width(v.native())) -} - -// SetMaxWidth() is a wrapper around gtk_tree_view_column_set_max_width(). -func (v *TreeViewColumn) SetMaxWidth(w int) { - C.gtk_tree_view_column_set_max_width(v.native(), C.gint(w)) -} - -// GetMaxWidth() is a wrapper around gtk_tree_view_column_get_max_width(). -func (v *TreeViewColumn) GetMaxWidth() int { - return int(C.gtk_tree_view_column_get_max_width(v.native())) -} - -// Clicked() is a wrapper around gtk_tree_view_column_clicked(). -func (v *TreeViewColumn) Clicked() { - C.gtk_tree_view_column_clicked(v.native()) -} - -// SetTitle() is a wrapper around gtk_tree_view_column_set_title(). -func (v *TreeViewColumn) SetTitle(t string) { - cstr := (*C.gchar)(C.CString(t)) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_tree_view_column_set_title(v.native(), cstr) -} - -// GetTitle() is a wrapper around gtk_tree_view_column_get_title(). -func (v *TreeViewColumn) GetTitle() string { - return C.GoString((*C.char)(C.gtk_tree_view_column_get_title(v.native()))) -} - -// SetClickable() is a wrapper around gtk_tree_view_column_set_clickable(). -func (v *TreeViewColumn) SetClickable(clickable bool) { - C.gtk_tree_view_column_set_clickable(v.native(), gbool(clickable)) -} - -// GetClickable() is a wrapper around gtk_tree_view_column_get_clickable(). -func (v *TreeViewColumn) GetClickable() bool { - return gobool(C.gtk_tree_view_column_get_clickable(v.native())) -} - -// SetReorderable() is a wrapper around gtk_tree_view_column_set_reorderable(). -func (v *TreeViewColumn) SetReorderable(reorderable bool) { - C.gtk_tree_view_column_set_reorderable(v.native(), gbool(reorderable)) -} - -// GetReorderable() is a wrapper around gtk_tree_view_column_get_reorderable(). -func (v *TreeViewColumn) GetReorderable() bool { - return gobool(C.gtk_tree_view_column_get_reorderable(v.native())) -} - -// SetSortIndicator() is a wrapper around gtk_tree_view_column_set_sort_indicator(). -func (v *TreeViewColumn) SetSortIndicator(reorderable bool) { - C.gtk_tree_view_column_set_sort_indicator(v.native(), gbool(reorderable)) -} - -// GetSortIndicator() is a wrapper around gtk_tree_view_column_get_sort_indicator(). -func (v *TreeViewColumn) GetSortIndicator() bool { - return gobool(C.gtk_tree_view_column_get_sort_indicator(v.native())) -} - -// SetSortColumnID() is a wrapper around gtk_tree_view_column_set_sort_column_id(). -func (v *TreeViewColumn) SetSortColumnID(w int) { - C.gtk_tree_view_column_set_sort_column_id(v.native(), C.gint(w)) -} - -// GetSortColumnID() is a wrapper around gtk_tree_view_column_get_sort_column_id(). -func (v *TreeViewColumn) GetSortColumnID() int { - return int(C.gtk_tree_view_column_get_sort_column_id(v.native())) -} - -// CellIsVisible() is a wrapper around gtk_tree_view_column_cell_is_visible(). -func (v *TreeViewColumn) CellIsVisible() bool { - return gobool(C.gtk_tree_view_column_cell_is_visible(v.native())) -} - -// FocusCell() is a wrapper around gtk_tree_view_column_focus_cell(). -func (v *TreeViewColumn) FocusCell(cell *CellRenderer) { - C.gtk_tree_view_column_focus_cell(v.native(), cell.native()) -} - -// QueueResize() is a wrapper around gtk_tree_view_column_queue_resize(). -func (v *TreeViewColumn) QueueResize() { - C.gtk_tree_view_column_queue_resize(v.native()) -} - -// GetXOffset() is a wrapper around gtk_tree_view_column_get_x_offset(). -func (v *TreeViewColumn) GetXOffset() int { - return int(C.gtk_tree_view_column_get_x_offset(v.native())) -} - -// GtkTreeViewColumn * gtk_tree_view_column_new_with_area () -// void gtk_tree_view_column_set_attributes () -// void gtk_tree_view_column_set_cell_data_func () - -type TreeViewColumnSizing int - -const ( - TREE_VIEW_COLUMN_GROW_ONLY TreeViewColumnSizing = C.GTK_TREE_VIEW_COLUMN_GROW_ONLY - TREE_VIEW_COLUMN_AUTOSIZE = C.GTK_TREE_VIEW_COLUMN_AUTOSIZE - TREE_VIEW_COLUMN_FIXED = C.GTK_TREE_VIEW_COLUMN_FIXED -) - -// void gtk_tree_view_column_set_sizing () -func (v *TreeViewColumn) SetSizing(sizing TreeViewColumnSizing) { - C.gtk_tree_view_column_set_sizing(v.native(), C.GtkTreeViewColumnSizing(sizing)) -} - -// GtkTreeViewColumnSizing gtk_tree_view_column_get_sizing () -func (v *TreeViewColumn) GetSizing() TreeViewColumnSizing { - return TreeViewColumnSizing(C.gtk_tree_view_column_get_sizing(v.native())) -} - -// void gtk_tree_view_column_set_widget () -// GtkWidget * gtk_tree_view_column_get_widget () -// GtkWidget * gtk_tree_view_column_get_button () -// void gtk_tree_view_column_set_alignment () -// gfloat gtk_tree_view_column_get_alignment () - -// void gtk_tree_view_column_set_sort_order () -func (v *TreeViewColumn) SetSortOrder(order SortType) { - C.gtk_tree_view_column_set_sort_order(v.native(), C.GtkSortType(order)) -} - -// GtkSortType gtk_tree_view_column_get_sort_order () -func (v *TreeViewColumn) GetSortOrder() SortType { - return SortType(C.gtk_tree_view_column_get_sort_order(v.native())) -} - -// void gtk_tree_view_column_cell_set_cell_data () -// void gtk_tree_view_column_cell_get_size () -// gboolean gtk_tree_view_column_cell_get_position () -// GtkWidget * gtk_tree_view_column_get_tree_view () diff --git a/vendor/github.com/gotk3/gotk3/gtk/version.go b/vendor/github.com/gotk3/gotk3/gtk/version.go deleted file mode 100644 index 0c20162..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/version.go +++ /dev/null @@ -1,29 +0,0 @@ -package gtk - -// #include <gtk/gtk.h> -import "C" -import "errors" - -func CheckVersion(major, minor, micro uint) error { - errChar := C.gtk_check_version(C.guint(major), C.guint(minor), C.guint(micro)) - if errChar == nil { - return nil - } - - return errors.New(C.GoString((*C.char)(errChar))) -} - -func GetMajorVersion() uint { - v := C.gtk_get_major_version() - return uint(v) -} - -func GetMinorVersion() uint { - v := C.gtk_get_minor_version() - return uint(v) -} - -func GetMicroVersion() uint { - v := C.gtk_get_micro_version() - return uint(v) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/version_test.go b/vendor/github.com/gotk3/gotk3/gtk/version_test.go deleted file mode 100644 index d68387c..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/version_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package gtk - -import "testing" - -func TestCheckVersion(t *testing.T) { - err := CheckVersion(GetMajorVersion(), GetMinorVersion(), GetMicroVersion()) - if err != nil { - t.Error(err) - } - - err = CheckVersion(GetMajorVersion(), GetMinorVersion(), GetMicroVersion()-1) - if err != nil { - t.Error(err) - } - - err = CheckVersion(GetMajorVersion(), GetMinorVersion(), GetMicroVersion()+1) - if err == nil { - t.Error("Expected to fail when an more recent version is expected") - } -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/widget.go b/vendor/github.com/gotk3/gotk3/gtk/widget.go deleted file mode 100644 index 135886a..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/widget.go +++ /dev/null @@ -1,637 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains accelerator related functions and structures - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "errors" - "unsafe" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" -) - -/* - * GtkWidget - */ - -// Widget is a representation of GTK's GtkWidget. -type Widget struct { - glib.InitiallyUnowned -} - -// IWidget is an interface type implemented by all structs -// embedding a Widget. It is meant to be used as an argument type -// for wrapper functions that wrap around a C GTK function taking a -// GtkWidget. -type IWidget interface { - toWidget() *C.GtkWidget - Set(string, interface{}) error -} - -type IWidgetable interface { - toWidget() *C.GtkWidget -} - -func nullableWidget(v IWidgetable) *C.GtkWidget { - if v == nil { - return nil - } - - return v.toWidget() -} - -// native returns a pointer to the underlying GtkWidget. -func (v *Widget) native() *C.GtkWidget { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkWidget(p) -} - -func (v *Widget) toWidget() *C.GtkWidget { - if v == nil { - return nil - } - return v.native() -} - -func marshalWidget(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapWidget(obj), nil -} - -func wrapWidget(obj *glib.Object) *Widget { - return &Widget{glib.InitiallyUnowned{obj}} -} - -// Destroy is a wrapper around gtk_widget_destroy(). -func (v *Widget) Destroy() { - C.gtk_widget_destroy(v.native()) -} - -func (v *Widget) HideOnDelete() { - C._gtk_widget_hide_on_delete(v.native()) -} - -func (v *Widget) DragDestSet(flags DestDefaults, targets []TargetEntry, actions gdk.DragAction) { - C.gtk_drag_dest_set(v.native(), C.GtkDestDefaults(flags), (*C.GtkTargetEntry)(&targets[0]), C.gint(len(targets)), C.GdkDragAction(actions)) -} - -// ResetStyle is a wrapper around gtk_widget_reset_style(). -func (v *Widget) ResetStyle() { - C.gtk_widget_reset_style(v.native()) -} - -// InDestruction is a wrapper around gtk_widget_in_destruction(). -func (v *Widget) InDestruction() bool { - return gobool(C.gtk_widget_in_destruction(v.native())) -} - -// TODO(jrick) this may require some rethinking -/* -func (v *Widget) Destroyed(widgetPointer **Widget) { -} -*/ - -// Unparent is a wrapper around gtk_widget_unparent(). -func (v *Widget) Unparent() { - C.gtk_widget_unparent(v.native()) -} - -// Show is a wrapper around gtk_widget_show(). -func (v *Widget) Show() { - C.gtk_widget_show(v.native()) -} - -// Hide is a wrapper around gtk_widget_hide(). -func (v *Widget) Hide() { - C.gtk_widget_hide(v.native()) -} - -// GetCanFocus is a wrapper around gtk_widget_get_can_focus(). -func (v *Widget) GetCanFocus() bool { - c := C.gtk_widget_get_can_focus(v.native()) - return gobool(c) -} - -// SetCanFocus is a wrapper around gtk_widget_set_can_focus(). -func (v *Widget) SetCanFocus(canFocus bool) { - C.gtk_widget_set_can_focus(v.native(), gbool(canFocus)) -} - -// GetCanDefault is a wrapper around gtk_widget_get_can_default(). -func (v *Widget) GetCanDefault() bool { - c := C.gtk_widget_get_can_default(v.native()) - return gobool(c) -} - -// SetCanDefault is a wrapper around gtk_widget_set_can_default(). -func (v *Widget) SetCanDefault(canDefault bool) { - C.gtk_widget_set_can_default(v.native(), gbool(canDefault)) -} - -// GetMapped is a wrapper around gtk_widget_get_mapped(). -func (v *Widget) GetMapped() bool { - c := C.gtk_widget_get_mapped(v.native()) - return gobool(c) -} - -// SetMapped is a wrapper around gtk_widget_set_mapped(). -func (v *Widget) SetMapped(mapped bool) { - C.gtk_widget_set_can_focus(v.native(), gbool(mapped)) -} - -// GetRealized is a wrapper around gtk_widget_get_realized(). -func (v *Widget) GetRealized() bool { - c := C.gtk_widget_get_realized(v.native()) - return gobool(c) -} - -// SetRealized is a wrapper around gtk_widget_set_realized(). -func (v *Widget) SetRealized(realized bool) { - C.gtk_widget_set_realized(v.native(), gbool(realized)) -} - -// GetHasWindow is a wrapper around gtk_widget_get_has_window(). -func (v *Widget) GetHasWindow() bool { - c := C.gtk_widget_get_has_window(v.native()) - return gobool(c) -} - -// SetHasWindow is a wrapper around gtk_widget_set_has_window(). -func (v *Widget) SetHasWindow(hasWindow bool) { - C.gtk_widget_set_has_window(v.native(), gbool(hasWindow)) -} - -// ShowNow is a wrapper around gtk_widget_show_now(). -func (v *Widget) ShowNow() { - C.gtk_widget_show_now(v.native()) -} - -// ShowAll is a wrapper around gtk_widget_show_all(). -func (v *Widget) ShowAll() { - C.gtk_widget_show_all(v.native()) -} - -// SetNoShowAll is a wrapper around gtk_widget_set_no_show_all(). -func (v *Widget) SetNoShowAll(noShowAll bool) { - C.gtk_widget_set_no_show_all(v.native(), gbool(noShowAll)) -} - -// GetNoShowAll is a wrapper around gtk_widget_get_no_show_all(). -func (v *Widget) GetNoShowAll() bool { - c := C.gtk_widget_get_no_show_all(v.native()) - return gobool(c) -} - -// Map is a wrapper around gtk_widget_map(). -func (v *Widget) Map() { - C.gtk_widget_map(v.native()) -} - -// Unmap is a wrapper around gtk_widget_unmap(). -func (v *Widget) Unmap() { - C.gtk_widget_unmap(v.native()) -} - -// QueueDrawArea is a wrapper aroung gtk_widget_queue_draw_area(). -func (v *Widget) QueueDrawArea(x, y, w, h int) { - C.gtk_widget_queue_draw_area(v.native(), C.gint(x), C.gint(y), C.gint(w), C.gint(h)) -} - -//void gtk_widget_realize(GtkWidget *widget); -//void gtk_widget_unrealize(GtkWidget *widget); -//void gtk_widget_draw(GtkWidget *widget, cairo_t *cr); -//void gtk_widget_queue_resize(GtkWidget *widget); -//void gtk_widget_queue_resize_no_redraw(GtkWidget *widget); -//GdkFrameClock *gtk_widget_get_frame_clock(GtkWidget *widget); -//guint gtk_widget_add_tick_callback (GtkWidget *widget, -// GtkTickCallback callback, -// gpointer user_data, -// GDestroyNotify notify); -//void gtk_widget_remove_tick_callback(GtkWidget *widget, guint id); - -// TODO(jrick) GtkAllocation -/* -func (v *Widget) SizeAllocate() { -} -*/ - -// Allocation is a representation of GTK's GtkAllocation type. -type Allocation struct { - gdk.Rectangle -} - -// Native returns a pointer to the underlying GtkAllocation. -func (v *Allocation) native() *C.GtkAllocation { - return (*C.GtkAllocation)(unsafe.Pointer(&v.GdkRectangle)) -} - -// GetAllocatedWidth() is a wrapper around gtk_widget_get_allocated_width(). -func (v *Widget) GetAllocatedWidth() int { - return int(C.gtk_widget_get_allocated_width(v.native())) -} - -// GetAllocatedHeight() is a wrapper around gtk_widget_get_allocated_height(). -func (v *Widget) GetAllocatedHeight() int { - return int(C.gtk_widget_get_allocated_height(v.native())) -} - -// Event() is a wrapper around gtk_widget_event(). -func (v *Widget) Event(event *gdk.Event) bool { - c := C.gtk_widget_event(v.native(), - (*C.GdkEvent)(unsafe.Pointer(event.Native()))) - return gobool(c) -} - -// Activate() is a wrapper around gtk_widget_activate(). -func (v *Widget) Activate() bool { - return gobool(C.gtk_widget_activate(v.native())) -} - -// TODO(jrick) GdkRectangle -/* -func (v *Widget) Intersect() { -} -*/ - -// IsFocus() is a wrapper around gtk_widget_is_focus(). -func (v *Widget) IsFocus() bool { - return gobool(C.gtk_widget_is_focus(v.native())) -} - -// GrabFocus() is a wrapper around gtk_widget_grab_focus(). -func (v *Widget) GrabFocus() { - C.gtk_widget_grab_focus(v.native()) -} - -// GrabDefault() is a wrapper around gtk_widget_grab_default(). -func (v *Widget) GrabDefault() { - C.gtk_widget_grab_default(v.native()) -} - -// SetName() is a wrapper around gtk_widget_set_name(). -func (v *Widget) SetName(name string) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_widget_set_name(v.native(), (*C.gchar)(cstr)) -} - -// GetName() is a wrapper around gtk_widget_get_name(). A non-nil -// error is returned in the case that gtk_widget_get_name returns NULL to -// differentiate between NULL and an empty string. -func (v *Widget) GetName() (string, error) { - c := C.gtk_widget_get_name(v.native()) - if c == nil { - return "", nilPtrErr - } - return C.GoString((*C.char)(c)), nil -} - -// GetSensitive is a wrapper around gtk_widget_get_sensitive(). -func (v *Widget) GetSensitive() bool { - c := C.gtk_widget_get_sensitive(v.native()) - return gobool(c) -} - -// IsSensitive is a wrapper around gtk_widget_is_sensitive(). -func (v *Widget) IsSensitive() bool { - c := C.gtk_widget_is_sensitive(v.native()) - return gobool(c) -} - -// SetSensitive is a wrapper around gtk_widget_set_sensitive(). -func (v *Widget) SetSensitive(sensitive bool) { - C.gtk_widget_set_sensitive(v.native(), gbool(sensitive)) -} - -// GetVisible is a wrapper around gtk_widget_get_visible(). -func (v *Widget) GetVisible() bool { - c := C.gtk_widget_get_visible(v.native()) - return gobool(c) -} - -// SetVisible is a wrapper around gtk_widget_set_visible(). -func (v *Widget) SetVisible(visible bool) { - C.gtk_widget_set_visible(v.native(), gbool(visible)) -} - -// SetParent is a wrapper around gtk_widget_set_parent(). -func (v *Widget) SetParent(parent IWidget) { - C.gtk_widget_set_parent(v.native(), parent.toWidget()) -} - -// GetParent is a wrapper around gtk_widget_get_parent(). -func (v *Widget) GetParent() (*Widget, error) { - c := C.gtk_widget_get_parent(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -// SetSizeRequest is a wrapper around gtk_widget_set_size_request(). -func (v *Widget) SetSizeRequest(width, height int) { - C.gtk_widget_set_size_request(v.native(), C.gint(width), C.gint(height)) -} - -// GetSizeRequest is a wrapper around gtk_widget_get_size_request(). -func (v *Widget) GetSizeRequest() (width, height int) { - var w, h C.gint - C.gtk_widget_get_size_request(v.native(), &w, &h) - return int(w), int(h) -} - -// SetParentWindow is a wrapper around gtk_widget_set_parent_window(). -func (v *Widget) SetParentWindow(parentWindow *gdk.Window) { - C.gtk_widget_set_parent_window(v.native(), - (*C.GdkWindow)(unsafe.Pointer(parentWindow.Native()))) -} - -// GetParentWindow is a wrapper around gtk_widget_get_parent_window(). -func (v *Widget) GetParentWindow() (*gdk.Window, error) { - c := C.gtk_widget_get_parent_window(v.native()) - if v == nil { - return nil, nilPtrErr - } - - w := &gdk.Window{glib.Take(unsafe.Pointer(c))} - return w, nil -} - -// SetEvents is a wrapper around gtk_widget_set_events(). -func (v *Widget) SetEvents(events int) { - C.gtk_widget_set_events(v.native(), C.gint(events)) -} - -// GetEvents is a wrapper around gtk_widget_get_events(). -func (v *Widget) GetEvents() int { - return int(C.gtk_widget_get_events(v.native())) -} - -// AddEvents is a wrapper around gtk_widget_add_events(). -func (v *Widget) AddEvents(events int) { - C.gtk_widget_add_events(v.native(), C.gint(events)) -} - -// HasDefault is a wrapper around gtk_widget_has_default(). -func (v *Widget) HasDefault() bool { - c := C.gtk_widget_has_default(v.native()) - return gobool(c) -} - -// HasFocus is a wrapper around gtk_widget_has_focus(). -func (v *Widget) HasFocus() bool { - c := C.gtk_widget_has_focus(v.native()) - return gobool(c) -} - -// HasVisibleFocus is a wrapper around gtk_widget_has_visible_focus(). -func (v *Widget) HasVisibleFocus() bool { - c := C.gtk_widget_has_visible_focus(v.native()) - return gobool(c) -} - -// HasGrab is a wrapper around gtk_widget_has_grab(). -func (v *Widget) HasGrab() bool { - c := C.gtk_widget_has_grab(v.native()) - return gobool(c) -} - -// IsDrawable is a wrapper around gtk_widget_is_drawable(). -func (v *Widget) IsDrawable() bool { - c := C.gtk_widget_is_drawable(v.native()) - return gobool(c) -} - -// IsToplevel is a wrapper around gtk_widget_is_toplevel(). -func (v *Widget) IsToplevel() bool { - c := C.gtk_widget_is_toplevel(v.native()) - return gobool(c) -} - -// TODO(jrick) GdkEventMask -/* -func (v *Widget) SetDeviceEvents() { -} -*/ - -// TODO(jrick) GdkEventMask -/* -func (v *Widget) GetDeviceEvents() { -} -*/ - -// TODO(jrick) GdkEventMask -/* -func (v *Widget) AddDeviceEvents() { -} -*/ - -// SetDeviceEnabled is a wrapper around gtk_widget_set_device_enabled(). -func (v *Widget) SetDeviceEnabled(device *gdk.Device, enabled bool) { - C.gtk_widget_set_device_enabled(v.native(), - (*C.GdkDevice)(unsafe.Pointer(device.Native())), gbool(enabled)) -} - -// GetDeviceEnabled is a wrapper around gtk_widget_get_device_enabled(). -func (v *Widget) GetDeviceEnabled(device *gdk.Device) bool { - c := C.gtk_widget_get_device_enabled(v.native(), - (*C.GdkDevice)(unsafe.Pointer(device.Native()))) - return gobool(c) -} - -// GetToplevel is a wrapper around gtk_widget_get_toplevel(). -func (v *Widget) GetToplevel() (*Widget, error) { - c := C.gtk_widget_get_toplevel(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -// GetTooltipText is a wrapper around gtk_widget_get_tooltip_text(). -// A non-nil error is returned in the case that -// gtk_widget_get_tooltip_text returns NULL to differentiate between NULL -// and an empty string. -func (v *Widget) GetTooltipText() (string, error) { - c := C.gtk_widget_get_tooltip_text(v.native()) - if c == nil { - return "", nilPtrErr - } - return C.GoString((*C.char)(c)), nil -} - -// SetTooltipText is a wrapper around gtk_widget_set_tooltip_text(). -func (v *Widget) SetTooltipText(text string) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_widget_set_tooltip_text(v.native(), (*C.gchar)(cstr)) -} - -// GetHAlign is a wrapper around gtk_widget_get_halign(). -func (v *Widget) GetHAlign() Align { - c := C.gtk_widget_get_halign(v.native()) - return Align(c) -} - -// SetHAlign is a wrapper around gtk_widget_set_halign(). -func (v *Widget) SetHAlign(align Align) { - C.gtk_widget_set_halign(v.native(), C.GtkAlign(align)) -} - -// GetVAlign is a wrapper around gtk_widget_get_valign(). -func (v *Widget) GetVAlign() Align { - c := C.gtk_widget_get_valign(v.native()) - return Align(c) -} - -// SetVAlign is a wrapper around gtk_widget_set_valign(). -func (v *Widget) SetVAlign(align Align) { - C.gtk_widget_set_valign(v.native(), C.GtkAlign(align)) -} - -// GetMarginTop is a wrapper around gtk_widget_get_margin_top(). -func (v *Widget) GetMarginTop() int { - c := C.gtk_widget_get_margin_top(v.native()) - return int(c) -} - -// SetMarginTop is a wrapper around gtk_widget_set_margin_top(). -func (v *Widget) SetMarginTop(margin int) { - C.gtk_widget_set_margin_top(v.native(), C.gint(margin)) -} - -// GetMarginBottom is a wrapper around gtk_widget_get_margin_bottom(). -func (v *Widget) GetMarginBottom() int { - c := C.gtk_widget_get_margin_bottom(v.native()) - return int(c) -} - -// SetMarginBottom is a wrapper around gtk_widget_set_margin_bottom(). -func (v *Widget) SetMarginBottom(margin int) { - C.gtk_widget_set_margin_bottom(v.native(), C.gint(margin)) -} - -// GetHExpand is a wrapper around gtk_widget_get_hexpand(). -func (v *Widget) GetHExpand() bool { - c := C.gtk_widget_get_hexpand(v.native()) - return gobool(c) -} - -// SetHExpand is a wrapper around gtk_widget_set_hexpand(). -func (v *Widget) SetHExpand(expand bool) { - C.gtk_widget_set_hexpand(v.native(), gbool(expand)) -} - -// GetVExpand is a wrapper around gtk_widget_get_vexpand(). -func (v *Widget) GetVExpand() bool { - c := C.gtk_widget_get_vexpand(v.native()) - return gobool(c) -} - -// SetVExpand is a wrapper around gtk_widget_set_vexpand(). -func (v *Widget) SetVExpand(expand bool) { - C.gtk_widget_set_vexpand(v.native(), gbool(expand)) -} - -// TranslateCoordinates is a wrapper around gtk_widget_translate_coordinates(). -func (v *Widget) TranslateCoordinates(dest IWidget, srcX, srcY int) (destX, destY int, e error) { - cdest := nullableWidget(dest) - - var cdestX, cdestY C.gint - c := C.gtk_widget_translate_coordinates(v.native(), cdest, C.gint(srcX), C.gint(srcY), &cdestX, &cdestY) - if !gobool(c) { - return 0, 0, errors.New("translate coordinates failed") - } - return int(cdestX), int(cdestY), nil -} - -// SetVisual is a wrapper around gtk_widget_set_visual(). -func (v *Widget) SetVisual(visual *gdk.Visual) { - C.gtk_widget_set_visual(v.native(), - (*C.GdkVisual)(unsafe.Pointer(visual.Native()))) -} - -// SetAppPaintable is a wrapper around gtk_widget_set_app_paintable(). -func (v *Widget) SetAppPaintable(paintable bool) { - C.gtk_widget_set_app_paintable(v.native(), gbool(paintable)) -} - -// GetAppPaintable is a wrapper around gtk_widget_get_app_paintable(). -func (v *Widget) GetAppPaintable() bool { - c := C.gtk_widget_get_app_paintable(v.native()) - return gobool(c) -} - -// QueueDraw is a wrapper around gtk_widget_queue_draw(). -func (v *Widget) QueueDraw() { - C.gtk_widget_queue_draw(v.native()) -} - -// GetAllocation is a wrapper around gtk_widget_get_allocation(). -func (v *Widget) GetAllocation() *Allocation { - var a Allocation - C.gtk_widget_get_allocation(v.native(), a.native()) - return &a -} - -// SetAllocation is a wrapper around gtk_widget_set_allocation(). -func (v *Widget) SetAllocation(allocation *Allocation) { - C.gtk_widget_set_allocation(v.native(), allocation.native()) -} - -// SizeAllocate is a wrapper around gtk_widget_size_allocate(). -func (v *Widget) SizeAllocate(allocation *Allocation) { - C.gtk_widget_size_allocate(v.native(), allocation.native()) -} - -// SetStateFlags is a wrapper around gtk_widget_set_state_flags(). -func (v *Widget) SetStateFlags(stateFlags StateFlags, clear bool) { - C.gtk_widget_set_state_flags(v.native(), C.GtkStateFlags(stateFlags), gbool(clear)) -} - -// GetWindow is a wrapper around gtk_widget_get_window(). -func (v *Widget) GetWindow() (*gdk.Window, error) { - c := C.gtk_widget_get_window(v.native()) - if c == nil { - return nil, nilPtrErr - } - - w := &gdk.Window{glib.Take(unsafe.Pointer(c))} - return w, nil -} - -// GetPreferredHeight is a wrapper around gtk_widget_get_preferred_height(). -func (v *Widget) GetPreferredHeight() (int, int) { - var minimum, natural C.gint - C.gtk_widget_get_preferred_height(v.native(), &minimum, &natural) - return int(minimum), int(natural) -} - -// GetPreferredWidth is a wrapper around gtk_widget_get_preferred_width(). -func (v *Widget) GetPreferredWidth() (int, int) { - var minimum, natural C.gint - C.gtk_widget_get_preferred_width(v.native(), &minimum, &natural) - return int(minimum), int(natural) -} - -func (v *Widget) InsertActionGroup(name string, group glib.IActionGroup) { - C.gtk_widget_insert_action_group(v.native(), (*C.gchar)(C.CString(name)), C.toGActionGroup(unsafe.Pointer(group.Native()))) -} - -// GetScreen is a wrapper around gtk_widget_get_screen(). -func (v *Widget) GetScreen() (*gdk.Screen, error) { - c := C.gtk_widget_get_screen(v.native()) - if c == nil { - return nil, nilPtrErr - } - s := &gdk.Screen{glib.Take(unsafe.Pointer(c))} - return s, nil -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/widget_since_3_12.go b/vendor/github.com/gotk3/gotk3/gtk/widget_since_3_12.go deleted file mode 100644 index 7d494d1..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/widget_since_3_12.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// This file includes wrapers for symbols included since GTK 3.12, and -// and should not be included in a build intended to target any older GTK -// versions. To target an older build, such as 3.10, use -// 'go build -tags gtk_3_10'. Otherwise, if no build tags are used, GTK 3.12 -// is assumed and this file is built. -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10 - -package gtk - -// #include <gtk/gtk.h> -import "C" - -func (v *Widget) SetMarginStart(margin int) { - C.gtk_widget_set_margin_start(v.native(), C.gint(margin)) -} - -func (v *Widget) GetMarginStart() int { - c := C.gtk_widget_get_margin_start(v.native()) - return int(c) -} - -func (v *Widget) SetMarginEnd(margin int) { - C.gtk_widget_set_margin_end(v.native(), C.gint(margin)) -} - -func (v *Widget) GetMarginEnd() int { - c := C.gtk_widget_get_margin_end(v.native()) - return int(c) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/widget_since_3_14.go b/vendor/github.com/gotk3/gotk3/gtk/widget_since_3_14.go deleted file mode 100644 index c777127..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/widget_since_3_14.go +++ /dev/null @@ -1,20 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10,!gtk_3_12 - -// See: https://developer.gnome.org/gtk3/3.14/api-index-3-14.html - -package gtk - -// #include <gtk/gtk.h> -import "C" - -// GetClip is a wrapper around gtk_widget_get_clip(). -func (v *Widget) GetClip() *Allocation { - var clip Allocation - C.gtk_widget_get_clip(v.native(), clip.native()) - return &clip -} - -// SetClip is a wrapper around gtk_widget_set_clip(). -func (v *Widget) SetClip(clip *Allocation) { - C.gtk_widget_set_clip(v.native(), clip.native()) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/widget_since_3_8.go b/vendor/github.com/gotk3/gotk3/gtk/widget_since_3_8.go deleted file mode 100644 index 0f90561..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/widget_since_3_8.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// This file includes wrapers for symbols included since GTK 3.8, and -// and should not be included in a build intended to target any older GTK -// versions. To target an older build, such as 3.8, use -// 'go build -tags gtk_3_8'. Otherwise, if no build tags are used, GTK 3.18 -// is assumed and this file is built. -// +build !gtk_3_6 - -package gtk - -// #include <gtk/gtk.h> -import "C" - -/* - * GtkWidget - */ - -// IsVisible is a wrapper around gtk_widget_is_visible(). -func (v *Widget) IsVisible() bool { - c := C.gtk_widget_is_visible(v.native()) - return gobool(c) -} - -// SetOpacity is a wrapper around gtk_widget_set_opacity() -func (v *Widget) SetOpacity(opacity float64) { - C.gtk_widget_set_opacity(v.native(), C.double(opacity)) -} - -// GetOpacity is a wrapper around gtk_widget_get_opacity() -func (v *Widget) GetOpacity() float64 { - c := C.gtk_widget_get_opacity(v.native()) - return float64(c) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/window.go b/vendor/github.com/gotk3/gotk3/gtk/window.go deleted file mode 100644 index 9b49e93..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/window.go +++ /dev/null @@ -1,614 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains accelerator related functions and structures - -package gtk - -// #include <gtk/gtk.h> -// #include "gtk.go.h" -import "C" -import ( - "errors" - "unsafe" - - "github.com/gotk3/gotk3/gdk" - "github.com/gotk3/gotk3/glib" -) - -/* - * GtkWindow - */ - -// Window is a representation of GTK's GtkWindow. -type Window struct { - Bin -} - -// IWindow is an interface type implemented by all structs embedding a -// Window. It is meant to be used as an argument type for wrapper -// functions that wrap around a C GTK function taking a GtkWindow. -type IWindow interface { - toWindow() *C.GtkWindow -} - -// native returns a pointer to the underlying GtkWindow. -func (v *Window) native() *C.GtkWindow { - if v == nil || v.GObject == nil { - return nil - } - p := unsafe.Pointer(v.GObject) - return C.toGtkWindow(p) -} - -func (v *Window) toWindow() *C.GtkWindow { - if v == nil { - return nil - } - return v.native() -} - -func marshalWindow(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := glib.Take(unsafe.Pointer(c)) - return wrapWindow(obj), nil -} - -func wrapWindow(obj *glib.Object) *Window { - return &Window{Bin{Container{Widget{glib.InitiallyUnowned{obj}}}}} -} - -// WindowNew is a wrapper around gtk_window_new(). -func WindowNew(t WindowType) (*Window, error) { - c := C.gtk_window_new(C.GtkWindowType(t)) - if c == nil { - return nil, nilPtrErr - } - return wrapWindow(glib.Take(unsafe.Pointer(c))), nil -} - -// SetTitle is a wrapper around gtk_window_set_title(). -func (v *Window) SetTitle(title string) { - cstr := C.CString(title) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_window_set_title(v.native(), (*C.gchar)(cstr)) -} - -// SetResizable is a wrapper around gtk_window_set_resizable(). -func (v *Window) SetResizable(resizable bool) { - C.gtk_window_set_resizable(v.native(), gbool(resizable)) -} - -// GetResizable is a wrapper around gtk_window_get_resizable(). -func (v *Window) GetResizable() bool { - c := C.gtk_window_get_resizable(v.native()) - return gobool(c) -} - -// ActivateFocus is a wrapper around gtk_window_activate_focus(). -func (v *Window) ActivateFocus() bool { - c := C.gtk_window_activate_focus(v.native()) - return gobool(c) -} - -// ActivateDefault is a wrapper around gtk_window_activate_default(). -func (v *Window) ActivateDefault() bool { - c := C.gtk_window_activate_default(v.native()) - return gobool(c) -} - -// SetModal is a wrapper around gtk_window_set_modal(). -func (v *Window) SetModal(modal bool) { - C.gtk_window_set_modal(v.native(), gbool(modal)) -} - -// SetDefaultSize is a wrapper around gtk_window_set_default_size(). -func (v *Window) SetDefaultSize(width, height int) { - C.gtk_window_set_default_size(v.native(), C.gint(width), C.gint(height)) -} - -// SetIcon is a wrapper around gtk_window_set_icon(). -func (v *Window) SetIcon(icon *gdk.Pixbuf) { - iconPtr := (*C.GdkPixbuf)(unsafe.Pointer(icon.Native())) - C.gtk_window_set_icon(v.native(), iconPtr) -} - -// WindowSetDefaultIcon is a wrapper around gtk_window_set_default_icon(). -func WindowSetDefaultIcon(icon *gdk.Pixbuf) { - iconPtr := (*C.GdkPixbuf)(unsafe.Pointer(icon.Native())) - C.gtk_window_set_default_icon(iconPtr) -} - -// TODO(jrick) GdkGeometry GdkWindowHints. -/* -func (v *Window) SetGeometryHints() { -} -*/ - -// SetGravity is a wrapper around gtk_window_set_gravity(). -func (v *Window) SetGravity(gravity gdk.GdkGravity) { - C.gtk_window_set_gravity(v.native(), C.GdkGravity(gravity)) -} - -// TODO(jrick) GdkGravity. -/* -func (v *Window) GetGravity() { -} -*/ - -// SetPosition is a wrapper around gtk_window_set_position(). -func (v *Window) SetPosition(position WindowPosition) { - C.gtk_window_set_position(v.native(), C.GtkWindowPosition(position)) -} - -// SetTransientFor is a wrapper around gtk_window_set_transient_for(). -func (v *Window) SetTransientFor(parent IWindow) { - var pw *C.GtkWindow = nil - if parent != nil { - pw = parent.toWindow() - } - C.gtk_window_set_transient_for(v.native(), pw) -} - -// SetDestroyWithParent is a wrapper around -// gtk_window_set_destroy_with_parent(). -func (v *Window) SetDestroyWithParent(setting bool) { - C.gtk_window_set_destroy_with_parent(v.native(), gbool(setting)) -} - -// SetHideTitlebarWhenMaximized is a wrapper around -// gtk_window_set_hide_titlebar_when_maximized(). -func (v *Window) SetHideTitlebarWhenMaximized(setting bool) { - C.gtk_window_set_hide_titlebar_when_maximized(v.native(), - gbool(setting)) -} - -// IsActive is a wrapper around gtk_window_is_active(). -func (v *Window) IsActive() bool { - c := C.gtk_window_is_active(v.native()) - return gobool(c) -} - -// HasToplevelFocus is a wrapper around gtk_window_has_toplevel_focus(). -func (v *Window) HasToplevelFocus() bool { - c := C.gtk_window_has_toplevel_focus(v.native()) - return gobool(c) -} - -// GetFocus is a wrapper around gtk_window_get_focus(). -func (v *Window) GetFocus() (*Widget, error) { - c := C.gtk_window_get_focus(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -// SetFocus is a wrapper around gtk_window_set_focus(). -func (v *Window) SetFocus(w *Widget) { - C.gtk_window_set_focus(v.native(), w.native()) -} - -// GetDefaultWidget is a wrapper around gtk_window_get_default_widget(). -func (v *Window) GetDefaultWidget() *Widget { - c := C.gtk_window_get_default_widget(v.native()) - if c == nil { - return nil - } - obj := glib.Take(unsafe.Pointer(c)) - return wrapWidget(obj) -} - -// SetDefault is a wrapper around gtk_window_set_default(). -func (v *Window) SetDefault(widget IWidget) { - C.gtk_window_set_default(v.native(), widget.toWidget()) -} - -// Present is a wrapper around gtk_window_present(). -func (v *Window) Present() { - C.gtk_window_present(v.native()) -} - -// 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)) -} - -// Iconify is a wrapper around gtk_window_iconify(). -func (v *Window) Iconify() { - C.gtk_window_iconify(v.native()) -} - -// Deiconify is a wrapper around gtk_window_deiconify(). -func (v *Window) Deiconify() { - C.gtk_window_deiconify(v.native()) -} - -// Stick is a wrapper around gtk_window_stick(). -func (v *Window) Stick() { - C.gtk_window_stick(v.native()) -} - -// Unstick is a wrapper around gtk_window_unstick(). -func (v *Window) Unstick() { - C.gtk_window_unstick(v.native()) -} - -// Maximize is a wrapper around gtk_window_maximize(). -func (v *Window) Maximize() { - C.gtk_window_maximize(v.native()) -} - -// Unmaximize is a wrapper around gtk_window_unmaximize(). -func (v *Window) Unmaximize() { - C.gtk_window_unmaximize(v.native()) -} - -// Fullscreen is a wrapper around gtk_window_fullscreen(). -func (v *Window) Fullscreen() { - C.gtk_window_fullscreen(v.native()) -} - -// Unfullscreen is a wrapper around gtk_window_unfullscreen(). -func (v *Window) Unfullscreen() { - C.gtk_window_unfullscreen(v.native()) -} - -// SetKeepAbove is a wrapper around gtk_window_set_keep_above(). -func (v *Window) SetKeepAbove(setting bool) { - C.gtk_window_set_keep_above(v.native(), gbool(setting)) -} - -// SetKeepBelow is a wrapper around gtk_window_set_keep_below(). -func (v *Window) SetKeepBelow(setting bool) { - C.gtk_window_set_keep_below(v.native(), gbool(setting)) -} - -// SetDecorated is a wrapper around gtk_window_set_decorated(). -func (v *Window) SetDecorated(setting bool) { - C.gtk_window_set_decorated(v.native(), gbool(setting)) -} - -// SetDeletable is a wrapper around gtk_window_set_deletable(). -func (v *Window) SetDeletable(setting bool) { - C.gtk_window_set_deletable(v.native(), gbool(setting)) -} - -// SetTypeHint is a wrapper around gtk_window_set_type_hint(). -func (v *Window) SetTypeHint(typeHint gdk.WindowTypeHint) { - C.gtk_window_set_type_hint(v.native(), C.GdkWindowTypeHint(typeHint)) -} - -// SetSkipTaskbarHint is a wrapper around gtk_window_set_skip_taskbar_hint(). -func (v *Window) SetSkipTaskbarHint(setting bool) { - C.gtk_window_set_skip_taskbar_hint(v.native(), gbool(setting)) -} - -// SetSkipPagerHint is a wrapper around gtk_window_set_skip_pager_hint(). -func (v *Window) SetSkipPagerHint(setting bool) { - C.gtk_window_set_skip_pager_hint(v.native(), gbool(setting)) -} - -// SetUrgencyHint is a wrapper around gtk_window_set_urgency_hint(). -func (v *Window) SetUrgencyHint(setting bool) { - C.gtk_window_set_urgency_hint(v.native(), gbool(setting)) -} - -// SetAcceptFocus is a wrapper around gtk_window_set_accept_focus(). -func (v *Window) SetAcceptFocus(setting bool) { - C.gtk_window_set_accept_focus(v.native(), gbool(setting)) -} - -// SetFocusOnMap is a wrapper around gtk_window_set_focus_on_map(). -func (v *Window) SetFocusOnMap(setting bool) { - C.gtk_window_set_focus_on_map(v.native(), gbool(setting)) -} - -// SetStartupID is a wrapper around gtk_window_set_startup_id(). -func (v *Window) SetStartupID(sid string) { - cstr := (*C.gchar)(C.CString(sid)) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_window_set_startup_id(v.native(), cstr) -} - -// SetRole is a wrapper around gtk_window_set_role(). -func (v *Window) SetRole(s string) { - cstr := (*C.gchar)(C.CString(s)) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_window_set_role(v.native(), cstr) -} - -// GetDecorated is a wrapper around gtk_window_get_decorated(). -func (v *Window) GetDecorated() bool { - c := C.gtk_window_get_decorated(v.native()) - return gobool(c) -} - -// GetDeletable is a wrapper around gtk_window_get_deletable(). -func (v *Window) GetDeletable() bool { - c := C.gtk_window_get_deletable(v.native()) - return gobool(c) -} - -// WindowGetDefaultIconName is a wrapper around gtk_window_get_default_icon_name(). -func WindowGetDefaultIconName() (string, error) { - return stringReturn(C.gtk_window_get_default_icon_name()) -} - -// GetDefaultSize is a wrapper around gtk_window_get_default_size(). -func (v *Window) GetDefaultSize() (width, height int) { - var w, h C.gint - C.gtk_window_get_default_size(v.native(), &w, &h) - return int(w), int(h) -} - -// GetDestroyWithParent is a wrapper around -// gtk_window_get_destroy_with_parent(). -func (v *Window) GetDestroyWithParent() bool { - c := C.gtk_window_get_destroy_with_parent(v.native()) - return gobool(c) -} - -// GetHideTitlebarWhenMaximized is a wrapper around -// gtk_window_get_hide_titlebar_when_maximized(). -func (v *Window) GetHideTitlebarWhenMaximized() bool { - c := C.gtk_window_get_hide_titlebar_when_maximized(v.native()) - return gobool(c) -} - -// GetIcon is a wrapper around gtk_window_get_icon(). -func (v *Window) GetIcon() (*gdk.Pixbuf, error) { - c := C.gtk_window_get_icon(v.native()) - if c == nil { - return nil, nilPtrErr - } - - p := &gdk.Pixbuf{glib.Take(unsafe.Pointer(c))} - return p, nil -} - -// GetIconName is a wrapper around gtk_window_get_icon_name(). -func (v *Window) GetIconName() (string, error) { - return stringReturn(C.gtk_window_get_icon_name(v.native())) -} - -// GetModal is a wrapper around gtk_window_get_modal(). -func (v *Window) GetModal() bool { - c := C.gtk_window_get_modal(v.native()) - return gobool(c) -} - -// GetPosition is a wrapper around gtk_window_get_position(). -func (v *Window) GetPosition() (root_x, root_y int) { - var x, y C.gint - C.gtk_window_get_position(v.native(), &x, &y) - return int(x), int(y) -} - -func stringReturn(c *C.gchar) (string, error) { - if c == nil { - return "", nilPtrErr - } - return C.GoString((*C.char)(c)), nil -} - -// GetRole is a wrapper around gtk_window_get_role(). -func (v *Window) GetRole() (string, error) { - return stringReturn(C.gtk_window_get_role(v.native())) -} - -// GetSize is a wrapper around gtk_window_get_size(). -func (v *Window) GetSize() (width, height int) { - var w, h C.gint - C.gtk_window_get_size(v.native(), &w, &h) - return int(w), int(h) -} - -// GetTitle is a wrapper around gtk_window_get_title(). -func (v *Window) GetTitle() (string, error) { - return stringReturn(C.gtk_window_get_title(v.native())) -} - -// GetTransientFor is a wrapper around gtk_window_get_transient_for(). -func (v *Window) GetTransientFor() (*Window, error) { - c := C.gtk_window_get_transient_for(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapWindow(glib.Take(unsafe.Pointer(c))), nil -} - -// GetAttachedTo is a wrapper around gtk_window_get_attached_to(). -func (v *Window) GetAttachedTo() (*Widget, error) { - c := C.gtk_window_get_attached_to(v.native()) - if c == nil { - return nil, nilPtrErr - } - return wrapWidget(glib.Take(unsafe.Pointer(c))), nil -} - -// GetTypeHint is a wrapper around gtk_window_get_type_hint(). -func (v *Window) GetTypeHint() gdk.WindowTypeHint { - c := C.gtk_window_get_type_hint(v.native()) - return gdk.WindowTypeHint(c) -} - -// GetSkipTaskbarHint is a wrapper around gtk_window_get_skip_taskbar_hint(). -func (v *Window) GetSkipTaskbarHint() bool { - c := C.gtk_window_get_skip_taskbar_hint(v.native()) - return gobool(c) -} - -// GetSkipPagerHint is a wrapper around gtk_window_get_skip_pager_hint(). -func (v *Window) GetSkipPagerHint() bool { - c := C.gtk_window_get_skip_taskbar_hint(v.native()) - return gobool(c) -} - -// GetUrgencyHint is a wrapper around gtk_window_get_urgency_hint(). -func (v *Window) GetUrgencyHint() bool { - c := C.gtk_window_get_urgency_hint(v.native()) - return gobool(c) -} - -// GetAcceptFocus is a wrapper around gtk_window_get_accept_focus(). -func (v *Window) GetAcceptFocus() bool { - c := C.gtk_window_get_accept_focus(v.native()) - return gobool(c) -} - -// GetFocusOnMap is a wrapper around gtk_window_get_focus_on_map(). -func (v *Window) GetFocusOnMap() bool { - c := C.gtk_window_get_focus_on_map(v.native()) - return gobool(c) -} - -// HasGroup is a wrapper around gtk_window_has_group(). -func (v *Window) HasGroup() bool { - c := C.gtk_window_has_group(v.native()) - return gobool(c) -} - -// Move is a wrapper around gtk_window_move(). -func (v *Window) Move(x, y int) { - C.gtk_window_move(v.native(), C.gint(x), C.gint(y)) -} - -// Resize is a wrapper around gtk_window_resize(). -func (v *Window) Resize(width, height int) { - C.gtk_window_resize(v.native(), C.gint(width), C.gint(height)) -} - -// WindowSetDefaultIconFromFile is a wrapper around gtk_window_set_default_icon_from_file(). -func WindowSetDefaultIconFromFile(file string) error { - cstr := C.CString(file) - defer C.free(unsafe.Pointer(cstr)) - var err *C.GError = nil - res := C.gtk_window_set_default_icon_from_file((*C.gchar)(cstr), &err) - if res == 0 { - defer C.g_error_free(err) - return errors.New(C.GoString((*C.char)(err.message))) - } - return nil -} - -// WindowSetDefaultIconName is a wrapper around gtk_window_set_default_icon_name(). -func WindowSetDefaultIconName(s string) { - cstr := (*C.gchar)(C.CString(s)) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_window_set_default_icon_name(cstr) -} - -// SetIconFromFile is a wrapper around gtk_window_set_icon_from_file(). -func (v *Window) SetIconFromFile(file string) error { - cstr := C.CString(file) - defer C.free(unsafe.Pointer(cstr)) - var err *C.GError = nil - res := C.gtk_window_set_icon_from_file(v.native(), (*C.gchar)(cstr), &err) - if res == 0 { - defer C.g_error_free(err) - return errors.New(C.GoString((*C.char)(err.message))) - } - return nil -} - -// SetIconName is a wrapper around gtk_window_set_icon_name(). -func (v *Window) SetIconName(name string) { - cstr := C.CString(name) - defer C.free(unsafe.Pointer(cstr)) - C.gtk_window_set_icon_name(v.native(), (*C.gchar)(cstr)) -} - -// SetAutoStartupNotification is a wrapper around -// gtk_window_set_auto_startup_notification(). -// This doesn't seem write. Might need to rethink? -/* -func (v *Window) SetAutoStartupNotification(setting bool) { - C.gtk_window_set_auto_startup_notification(gbool(setting)) -} -*/ - -// GetMnemonicsVisible is a wrapper around -// gtk_window_get_mnemonics_visible(). -func (v *Window) GetMnemonicsVisible() bool { - c := C.gtk_window_get_mnemonics_visible(v.native()) - return gobool(c) -} - -// SetMnemonicsVisible is a wrapper around -// gtk_window_get_mnemonics_visible(). -func (v *Window) SetMnemonicsVisible(setting bool) { - C.gtk_window_set_mnemonics_visible(v.native(), gbool(setting)) -} - -// GetFocusVisible is a wrapper around gtk_window_get_focus_visible(). -func (v *Window) GetFocusVisible() bool { - c := C.gtk_window_get_focus_visible(v.native()) - return gobool(c) -} - -// SetFocusVisible is a wrapper around gtk_window_set_focus_visible(). -func (v *Window) SetFocusVisible(setting bool) { - C.gtk_window_set_focus_visible(v.native(), gbool(setting)) -} - -// GetApplication is a wrapper around gtk_window_get_application(). -func (v *Window) GetApplication() (*Application, error) { - c := C.gtk_window_get_application(v.native()) - if c == nil { - return nil, nilPtrErr - } - - return wrapApplication(glib.Take(unsafe.Pointer(c))), nil -} - -// SetApplication is a wrapper around gtk_window_set_application(). -func (v *Window) SetApplication(a *Application) { - C.gtk_window_set_application(v.native(), a.native()) -} - -// ActivateKey is a wrapper around gtk_window_activate_key(). -func (v *Window) ActivateKey(event *gdk.EventKey) bool { - c := C.gtk_window_activate_key(v.native(), (*C.GdkEventKey)(unsafe.Pointer(event.Native()))) - return gobool(c) -} - -// AddMnemonic is a wrapper around gtk_window_add_mnemonic(). -func (v *Window) AddMnemonic(keyval uint, target *Widget) { - C.gtk_window_add_mnemonic(v.native(), C.guint(keyval), target.native()) -} - -// RemoveMnemonic is a wrapper around gtk_window_remove_mnemonic(). -func (v *Window) RemoveMnemonic(keyval uint, target *Widget) { - C.gtk_window_remove_mnemonic(v.native(), C.guint(keyval), target.native()) -} - -// ActivateMnemonic is a wrapper around gtk_window_mnemonic_activate(). -func (v *Window) ActivateMnemonic(keyval uint, mods gdk.ModifierType) bool { - c := C.gtk_window_mnemonic_activate(v.native(), C.guint(keyval), C.GdkModifierType(mods)) - return gobool(c) -} - -// GetMnemonicModifier is a wrapper around gtk_window_get_mnemonic_modifier(). -func (v *Window) GetMnemonicModifier() gdk.ModifierType { - c := C.gtk_window_get_mnemonic_modifier(v.native()) - return gdk.ModifierType(c) -} - -// SetMnemonicModifier is a wrapper around gtk_window_set_mnemonic_modifier(). -func (v *Window) SetMnemonicModifier(mods gdk.ModifierType) { - C.gtk_window_set_mnemonic_modifier(v.native(), C.GdkModifierType(mods)) -} - -// TODO gtk_window_begin_move_drag(). -// TODO gtk_window_begin_resize_drag(). -// TODO gtk_window_get_default_icon_list(). -// TODO gtk_window_get_group(). -// TODO gtk_window_get_icon_list(). -// TODO gtk_window_get_window_type(). -// TODO gtk_window_list_toplevels(). -// TODO gtk_window_parse_geometry(). -// TODO gtk_window_propagate_key_event(). -// TODO gtk_window_set_attached_to(). -// TODO gtk_window_set_default_icon_list(). -// TODO gtk_window_set_icon_list(). -// TODO gtk_window_set_screen(). -// TODO gtk_window_get_resize_grip_area(). diff --git a/vendor/github.com/gotk3/gotk3/gtk/window_since_3_10.go b/vendor/github.com/gotk3/gotk3/gtk/window_since_3_10.go deleted file mode 100644 index 2717f78..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/window_since_3_10.go +++ /dev/null @@ -1,26 +0,0 @@ -// Same copyright and license as the rest of the files in this project -// This file contains accelerator related functions and structures - -// +build !gtk_3_6,!gtk_3_8 -// not use this: go build -tags gtk_3_8'. Otherwise, if no build tags are used, GTK 3.10 - -package gtk - -// #include <stdlib.h> -// #include <gtk/gtk.h> -// #include "gtk_since_3_10.go.h" -import "C" - -/* - * GtkWindow - */ - -// SetTitlebar is a wrapper around gtk_window_set_titlebar(). -func (v *Window) SetTitlebar(titlebar IWidget) { - C.gtk_window_set_titlebar(v.native(), titlebar.toWidget()) -} - -// Close is a wrapper around gtk_window_close(). -func (v *Window) Close() { - C.gtk_window_close(v.native()) -} diff --git a/vendor/github.com/gotk3/gotk3/gtk/window_since_3_12.go b/vendor/github.com/gotk3/gotk3/gtk/window_since_3_12.go deleted file mode 100644 index 4c0228c..0000000 --- a/vendor/github.com/gotk3/gotk3/gtk/window_since_3_12.go +++ /dev/null @@ -1,12 +0,0 @@ -// +build !gtk_3_6,!gtk_3_8,!gtk_3_10 - -package gtk - -// #include <gtk/gtk.h> -import "C" - -// IsMaximized is a wrapper around gtk_window_is_maximized(). -func (v *Window) IsMaximized() bool { - c := C.gtk_window_is_maximized(v.native()) - return gobool(c) -} diff --git a/vendor/github.com/gotk3/gotk3/pango/fontconfig.go.h b/vendor/github.com/gotk3/gotk3/pango/fontconfig.go.h deleted file mode 100644 index de8b743..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/fontconfig.go.h +++ /dev/null @@ -1,7 +0,0 @@ - -#include <fontconfig/fontconfig.h> - -static int addFont(char* font) { - FcBool fontAddStatus = FcConfigAppFontAddFile(FcConfigGetCurrent(), font); - return fontAddStatus; -}
\ No newline at end of file diff --git a/vendor/github.com/gotk3/gotk3/pango/pango-attributes.go b/vendor/github.com/gotk3/gotk3/pango/pango-attributes.go deleted file mode 100644 index 464b595..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/pango-attributes.go +++ /dev/null @@ -1,356 +0,0 @@ -/* - * Copyright (c) 2015- terrak <terrak1975@gmail.com> - * - * This file originated from: http://www.terrak.net/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package pango - -// #include <pango/pango.h> -// #include "pango.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - // Enums - {glib.Type(C.pango_attr_type_get_type()), marshalAttrType}, - {glib.Type(C.pango_underline_get_type()), marshalUnderline}, - } - glib.RegisterGValueMarshalers(tm) -} - -/* PangoColor */ - -// Color is a representation of PangoColor. -type Color struct { - pangoColor *C.PangoColor -} - -// Native returns a pointer to the underlying PangoColor. -func (v *Color) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *Color) native() *C.PangoColor { - return (*C.PangoColor)(unsafe.Pointer(v.pangoColor)) -} - -func (v *Color) Set(red, green, blue uint16) { - v.native().red = C.guint16(red) - v.native().green = C.guint16(green) - v.native().blue = C.guint16(blue) -} - -func (v *Color) Get() (red, green, blue uint16) { - return uint16(v.native().red), uint16(v.native().green), uint16(v.native().blue) -} - -//PangoColor *pango_color_copy (const PangoColor *src); -func (v *Color) Copy(c *Color) *Color { - w := new(Color) - w.pangoColor = C.pango_color_copy(v.native()) - return w -} - -//void pango_color_free (PangoColor *color); -func (v *Color) Free() { - C.pango_color_free(v.native()) -} - -//gboolean pango_color_parse (PangoColor *color, -// const char *spec); -func (v *Color) Parse(spec string) bool { - cstr := C.CString(spec) - defer C.free(unsafe.Pointer(cstr)) - c := C.pango_color_parse(v.native(), (*C.char)(cstr)) - return gobool(c) -} - -//gchar *pango_color_to_string(const PangoColor *color); -func (v *Color) ToString() string { - c := C.pango_color_to_string(v.native()) - return C.GoString((*C.char)(c)) -} - -/* --- --- --- Attributes --- --- --- */ - -// AttrList is a representation of PangoAttrList. -type AttrList struct { - pangoAttrList *C.PangoAttrList -} - -// Native returns a pointer to the underlying PangoLayout. -func (v *AttrList) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *AttrList) native() *C.PangoAttrList { - return (*C.PangoAttrList)(unsafe.Pointer(v.pangoAttrList)) -} - -// AttrType is a representation of Pango's PangoAttrType. -type AttrType int - -const ( - ATTR_INVALID AttrType = C.PANGO_ATTR_INVALID /* 0 is an invalid attribute type */ - ATTR_LANGUAGE AttrType = C.PANGO_ATTR_LANGUAGE /* PangoAttrLanguage */ - ATTR_FAMILY AttrType = C.PANGO_ATTR_FAMILY /* PangoAttrString */ - ATTR_STYLE AttrType = C.PANGO_ATTR_STYLE /* PangoAttrInt */ - ATTR_WEIGHT AttrType = C.PANGO_ATTR_WEIGHT /* PangoAttrInt */ - ATTR_VARIANT AttrType = C.PANGO_ATTR_VARIANT /* PangoAttrInt */ - ATTR_STRETCH AttrType = C.PANGO_ATTR_STRETCH /* PangoAttrInt */ - ATTR_SIZE AttrType = C.PANGO_ATTR_SIZE /* PangoAttrSize */ - ATTR_FONT_DESC AttrType = C.PANGO_ATTR_FONT_DESC /* PangoAttrFontDesc */ - ATTR_FOREGROUND AttrType = C.PANGO_ATTR_FOREGROUND /* PangoAttrColor */ - ATTR_BACKGROUND AttrType = C.PANGO_ATTR_BACKGROUND /* PangoAttrColor */ - ATTR_UNDERLINE AttrType = C.PANGO_ATTR_UNDERLINE /* PangoAttrInt */ - ATTR_STRIKETHROUGH AttrType = C.PANGO_ATTR_STRIKETHROUGH /* PangoAttrInt */ - ATTR_RISE AttrType = C.PANGO_ATTR_RISE /* PangoAttrInt */ - ATTR_SHAPE AttrType = C.PANGO_ATTR_SHAPE /* PangoAttrShape */ - ATTR_SCALE AttrType = C.PANGO_ATTR_SCALE /* PangoAttrFloat */ - ATTR_FALLBACK AttrType = C.PANGO_ATTR_FALLBACK /* PangoAttrInt */ - ATTR_LETTER_SPACING AttrType = C.PANGO_ATTR_LETTER_SPACING /* PangoAttrInt */ - ATTR_UNDERLINE_COLOR AttrType = C.PANGO_ATTR_UNDERLINE_COLOR /* PangoAttrColor */ - ATTR_STRIKETHROUGH_COLOR AttrType = C.PANGO_ATTR_STRIKETHROUGH_COLOR /* PangoAttrColor */ - ATTR_ABSOLUTE_SIZE AttrType = C.PANGO_ATTR_ABSOLUTE_SIZE /* PangoAttrSize */ - ATTR_GRAVITY AttrType = C.PANGO_ATTR_GRAVITY /* PangoAttrInt */ - ATTR_GRAVITY_HINT AttrType = C.PANGO_ATTR_GRAVITY_HINT /* PangoAttrInt */ - -) - -func marshalAttrType(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return AttrType(c), nil -} - -// Underline is a representation of Pango's PangoUnderline. -type Underline int - -const ( - UNDERLINE_NONE Underline = C.PANGO_UNDERLINE_NONE - UNDERLINE_SINGLE Underline = C.PANGO_UNDERLINE_SINGLE - UNDERLINE_DOUBLE Underline = C.PANGO_UNDERLINE_DOUBLE - UNDERLINE_LOW Underline = C.PANGO_UNDERLINE_LOW - UNDERLINE_ERROR Underline = C.PANGO_UNDERLINE_ERROR -) - -func marshalUnderline(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return Underline(c), nil -} - -const ( - ATTR_INDEX_FROM_TEXT_BEGINNING uint = 0 - ATTR_INDEX_TO_TEXT_END uint = C.G_MAXUINT -) - -// Attribute is a representation of Pango's PangoAttribute. -type Attribute struct { - pangoAttribute *C.PangoAttribute - //start_index, end_index uint -} - -// Native returns a pointer to the underlying PangoColor. -func (v *Attribute) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *Attribute) native() *C.PangoAttribute { - return (*C.PangoAttribute)(unsafe.Pointer(v.pangoAttribute)) -} - -/* -//typedef gboolean (*PangoAttrFilterFunc) (PangoAttribute *attribute, -// gpointer user_data); -func (v *Attribute) AttrFilterFunc(user_data uintptr) bool { - c := C.PangoAttrFilterFunc(Attribute.native(), C.gpointer(user_data)) - return gobool(c) -} - -//typedef gpointer (*PangoAttrDataCopyFunc) (gconstpointer user_data); -func AttrDataCopyFunc(user_data uintptr) uintptr { - c := C.PangoAttrDataCopyFunc(C.gpointer(user_data)) - return uintptr(c) -} -*/ - -// AttrClass is a representation of Pango's PangoAttrClass. -type AttrClass struct { - //PangoAttrType type; -} - -// AttrString is a representation of Pango's PangoAttrString. -type AttrString struct { - Attribute - //char *value; -} - -// AttrLanguage is a representation of Pango's PangoAttrLanguage. -type AttrLanguage struct { - Attribute - //PangoLanguage *value; -} - -// AttrInt is a representation of Pango's PangoAttrInt. -type AttrInt struct { - Attribute - //int value; -} - -// AttrFloat is a representation of Pango's PangoAttrFloat. -type AttrFloat struct { - Attribute - //double value; -} - -// AttrColor is a representation of Pango's AttrColor. -type AttrColor struct { - Attribute - Color -} - -// AttrSize is a representation of Pango's PangoAttrSize. -type AttrSize struct { - Attribute - //int size; - //guint absolute : 1; -} - -// AttrShape is a representation of Pango's PangoAttrShape. -type AttrShape struct { - Attribute - //PangoRectangle ink_rect; - //PangoRectangle logical_rect; - - //gpointer data; - //PangoAttrDataCopyFunc copy_func; - //GDestroyNotify destroy_func; -} - -// AttrFontDesc is a representation of Pango's PangoAttrFontDesc. -type AttrFontDesc struct { - Attribute - //PangoFontDescription *desc; -} - -/* -PangoAttrType pango_attr_type_register (const gchar *name); -const char * pango_attr_type_get_name (PangoAttrType type) G_GNUC_CONST; - -void pango_attribute_init (PangoAttribute *attr, - const PangoAttrClass *klass); -PangoAttribute * pango_attribute_copy (const PangoAttribute *attr); -void pango_attribute_destroy (PangoAttribute *attr); -gboolean pango_attribute_equal (const PangoAttribute *attr1, - const PangoAttribute *attr2) G_GNUC_PURE; - -PangoAttribute *pango_attr_language_new (PangoLanguage *language); -PangoAttribute *pango_attr_family_new (const char *family); -PangoAttribute *pango_attr_foreground_new (guint16 red, - guint16 green, - guint16 blue); -PangoAttribute *pango_attr_background_new (guint16 red, - guint16 green, - guint16 blue); -PangoAttribute *pango_attr_size_new (int size); -PangoAttribute *pango_attr_size_new_absolute (int size); -PangoAttribute *pango_attr_style_new (PangoStyle style); -PangoAttribute *pango_attr_weight_new (PangoWeight weight); -PangoAttribute *pango_attr_variant_new (PangoVariant variant); -PangoAttribute *pango_attr_stretch_new (PangoStretch stretch); -PangoAttribute *pango_attr_font_desc_new (const PangoFontDescription *desc); - -PangoAttribute *pango_attr_underline_new (PangoUnderline underline); -PangoAttribute *pango_attr_underline_color_new (guint16 red, - guint16 green, - guint16 blue); -PangoAttribute *pango_attr_strikethrough_new (gboolean strikethrough); -PangoAttribute *pango_attr_strikethrough_color_new (guint16 red, - guint16 green, - guint16 blue); - -PangoAttribute *pango_attr_rise_new (int rise); -PangoAttribute *pango_attr_scale_new (double scale_factor); -PangoAttribute *pango_attr_fallback_new (gboolean enable_fallback); -PangoAttribute *pango_attr_letter_spacing_new (int letter_spacing); - -PangoAttribute *pango_attr_shape_new (const PangoRectangle *ink_rect, - const PangoRectangle *logical_rect); -PangoAttribute *pango_attr_shape_new_with_data (const PangoRectangle *ink_rect, - const PangoRectangle *logical_rect, - gpointer data, - PangoAttrDataCopyFunc copy_func, - GDestroyNotify destroy_func); - -PangoAttribute *pango_attr_gravity_new (PangoGravity gravity); -PangoAttribute *pango_attr_gravity_hint_new (PangoGravityHint hint); - -GType pango_attr_list_get_type (void) G_GNUC_CONST; -PangoAttrList * pango_attr_list_new (void); -PangoAttrList * pango_attr_list_ref (PangoAttrList *list); -void pango_attr_list_unref (PangoAttrList *list); -PangoAttrList * pango_attr_list_copy (PangoAttrList *list); -void pango_attr_list_insert (PangoAttrList *list, - PangoAttribute *attr); -void pango_attr_list_insert_before (PangoAttrList *list, - PangoAttribute *attr); -void pango_attr_list_change (PangoAttrList *list, - PangoAttribute *attr); -void pango_attr_list_splice (PangoAttrList *list, - PangoAttrList *other, - gint pos, - gint len); - -PangoAttrList *pango_attr_list_filter (PangoAttrList *list, - PangoAttrFilterFunc func, - gpointer data); - -PangoAttrIterator *pango_attr_list_get_iterator (PangoAttrList *list); - -void pango_attr_iterator_range (PangoAttrIterator *iterator, - gint *start, - gint *end); -gboolean pango_attr_iterator_next (PangoAttrIterator *iterator); -PangoAttrIterator *pango_attr_iterator_copy (PangoAttrIterator *iterator); -void pango_attr_iterator_destroy (PangoAttrIterator *iterator); -PangoAttribute * pango_attr_iterator_get (PangoAttrIterator *iterator, - PangoAttrType type); -void pango_attr_iterator_get_font (PangoAttrIterator *iterator, - PangoFontDescription *desc, - PangoLanguage **language, - GSList **extra_attrs); -GSList * pango_attr_iterator_get_attrs (PangoAttrIterator *iterator); - - -gboolean pango_parse_markup (const char *markup_text, - int length, - gunichar accel_marker, - PangoAttrList **attr_list, - char **text, - gunichar *accel_char, - GError **error); - -GMarkupParseContext * pango_markup_parser_new (gunichar accel_marker); -gboolean pango_markup_parser_finish (GMarkupParseContext *context, - PangoAttrList **attr_list, - char **text, - gunichar *accel_char, - GError **error); -*/ diff --git a/vendor/github.com/gotk3/gotk3/pango/pango-attributes.go.h b/vendor/github.com/gotk3/gotk3/pango/pango-attributes.go.h deleted file mode 100644 index d1b2e23..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/pango-attributes.go.h +++ /dev/null @@ -1,27 +0,0 @@ -/*
- * Copyright (c) 2015- terrak <terrak1975@gmail.com>
- *
- * This file originated from: http://www.terrak.net/
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-static PangoColor* toPangoColor(void *p)
-{
- return ( (PangoColor*) (p) );
-}
-
diff --git a/vendor/github.com/gotk3/gotk3/pango/pango-context.go b/vendor/github.com/gotk3/gotk3/pango/pango-context.go deleted file mode 100644 index 41b7e57..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/pango-context.go +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2015- terrak <terrak1975@gmail.com> - * - * This file originated from: http://www.terrak.net/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package pango - -// #include <pango/pango.h> -// #include "pango.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - // Enums - // {glib.Type(C.pango_alignment_get_type()), marshalAlignment}, - // {glib.Type(C.pango_ellipsize_mode_get_type()), marshalEllipsizeMode}, - // {glib.Type(C.pango_wrap_mode_get_type()), marshalWrapMode}, - - // Objects/Interfaces - // {glib.Type(C.pango_context_get_type()), marshalContext}, - } - glib.RegisterGValueMarshalers(tm) -} - -// Context is a representation of PangoContext. -type Context struct { - pangoContext *C.PangoContext -} - -// Native returns a pointer to the underlying PangoLayout. -func (v *Context) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *Context) native() *C.PangoContext { - return (*C.PangoContext)(unsafe.Pointer(v.pangoContext)) -} - -/* -func marshalContext(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := wrapObject(unsafe.Pointer(c)) - return wrapContext(obj), nil -} - -func wrapContext(obj *glib.Object) *Context { - return &Context{obj} -} -*/ -func WrapContext(p uintptr) *Context { - context := new(Context) - context.pangoContext = (*C.PangoContext)(unsafe.Pointer(p)) - return context -} - -//PangoContext *pango_context_new (void); -func ContextNew() *Context { - c := C.pango_context_new() - - context := new(Context) - context.pangoContext = (*C.PangoContext)(c) - - return context -} - -//void pango_context_changed (PangoContext *context); -//void pango_context_set_font_map (PangoContext *context, -// PangoFontMap *font_map); -//PangoFontMap *pango_context_get_font_map (PangoContext *context); -//guint pango_context_get_serial (PangoContext *context); -//void pango_context_list_families (PangoContext *context, -// PangoFontFamily ***families, -// int *n_families); -//PangoFont * pango_context_load_font (PangoContext *context, -// const PangoFontDescription *desc); -//PangoFontset *pango_context_load_fontset (PangoContext *context, -// const PangoFontDescription *desc, -// PangoLanguage *language); -// -//PangoFontMetrics *pango_context_get_metrics (PangoContext *context, -// const PangoFontDescription *desc, -// PangoLanguage *language); -// -//void pango_context_set_font_description (PangoContext *context, -// const PangoFontDescription *desc); -//PangoFontDescription * pango_context_get_font_description (PangoContext *context); -//PangoLanguage *pango_context_get_language (PangoContext *context); -//void pango_context_set_language (PangoContext *context, -// PangoLanguage *language); -//void pango_context_set_base_dir (PangoContext *context, -// PangoDirection direction); -//PangoDirection pango_context_get_base_dir (PangoContext *context); -//void pango_context_set_base_gravity (PangoContext *context, -// PangoGravity gravity); -//PangoGravity pango_context_get_base_gravity (PangoContext *context); -//PangoGravity pango_context_get_gravity (PangoContext *context); -//void pango_context_set_gravity_hint (PangoContext *context, -// PangoGravityHint hint); -//PangoGravityHint pango_context_get_gravity_hint (PangoContext *context); -// -//void pango_context_set_matrix (PangoContext *context, -// const PangoMatrix *matrix); -//const PangoMatrix * pango_context_get_matrix (PangoContext *context); - -/* Break a string of Unicode characters into segments with - * consistent shaping/language engine and bidrectional level. - * Returns a #GList of #PangoItem's - */ -//GList *pango_itemize (PangoContext *context, -// const char *text, -// int start_index, -// int length, -// PangoAttrList *attrs, -// PangoAttrIterator *cached_iter); -//GList *pango_itemize_with_base_dir (PangoContext *context, -// PangoDirection base_dir, -// const char *text, -// int start_index, -// int length, -// PangoAttrList *attrs, -// PangoAttrIterator *cached_iter); diff --git a/vendor/github.com/gotk3/gotk3/pango/pango-font.go b/vendor/github.com/gotk3/gotk3/pango/pango-font.go deleted file mode 100644 index ff7ab28..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/pango-font.go +++ /dev/null @@ -1,710 +0,0 @@ -/* - * Copyright (c) 2015- terrak <terrak1975@gmail.com> - * - * This file originated from: http://www.terrak.net/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package pango - -// #include <pango/pango.h> -// #include "pango.go.h" -// #include "fontconfig.go.h" -import "C" -import ( - // "github.com/andre-hub/gotk3/glib" - // "github.com/andre-hub/gotk3/cairo" - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - // Enums - // Objects/Interfaces - {glib.Type(C.pango_font_description_get_type()), marshalFontDescription}, - } - glib.RegisterGValueMarshalers(tm) -} - -func AddFont(fontPath string) { - C.addFont(C.CString(fontPath)) -} - -// FontDescription is a representation of PangoFontDescription. -type FontDescription struct { - pangoFontDescription *C.PangoFontDescription -} - -// Native returns a pointer to the underlying PangoLayout. -func (v *FontDescription) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *FontDescription) native() *C.PangoFontDescription { - return (*C.PangoFontDescription)(unsafe.Pointer(v.pangoFontDescription)) -} - -// FontMetrics is a representation of PangoFontMetrics. -type FontMetrics struct { - pangoFontMetrics *C.PangoFontMetrics -} - -// Native returns a pointer to the underlying PangoLayout. -func (v *FontMetrics) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *FontMetrics) native() *C.PangoFontMetrics { - return (*C.PangoFontMetrics)(unsafe.Pointer(v.pangoFontMetrics)) -} - -const ( - PANGO_SCALE = C.PANGO_SCALE -) - -type Style int - -const ( - STYLE_NORMAL Style = C.PANGO_STYLE_NORMAL - STYLE_OBLIQUE Style = C.PANGO_STYLE_OBLIQUE - STYLE_ITALIC Style = C.PANGO_STYLE_ITALIC -) - -type Variant int - -const ( - VARIANT_NORMAL Variant = C.PANGO_VARIANT_NORMAL - VARIANT_SMALL_CAPS Variant = C.PANGO_VARIANT_SMALL_CAPS -) - -type Weight int - -const ( - WEIGHT_THIN Weight = C.PANGO_WEIGHT_THIN /* 100 */ - WEIGHT_ULTRALIGHT Weight = C.PANGO_WEIGHT_ULTRALIGHT /* 200 */ - WEIGHT_LIGHT Weight = C.PANGO_WEIGHT_LIGHT /* 300 */ - WEIGHT_SEMILIGHT Weight = 350 /* 350 */ - WEIGHT_BOOK Weight = C.PANGO_WEIGHT_BOOK /* 380 */ - WEIGHT_NORMAL Weight = C.PANGO_WEIGHT_NORMAL /* 400 */ - WEIGHT_MEDIUM Weight = C.PANGO_WEIGHT_MEDIUM /* 500 */ - WEIGHT_SEMIBOLD Weight = C.PANGO_WEIGHT_SEMIBOLD /* 600 */ - WEIGHT_BOLD Weight = C.PANGO_WEIGHT_BOLD /* 700 */ - WEIGHT_ULTRABOLD Weight = C.PANGO_WEIGHT_ULTRABOLD /* 800 */ - WEIGHT_HEAVY Weight = C.PANGO_WEIGHT_HEAVY /* 900 */ - WEIGHT_ULTRAHEAVY Weight = C.PANGO_WEIGHT_ULTRAHEAVY /* 1000 */ - -) - -type Stretch int - -const ( - STRETCH_ULTRA_CONDENSED Stretch = C.PANGO_STRETCH_ULTRA_CONDENSED - STRETCH_EXTRA_CONDENSEDStretch Stretch = C.PANGO_STRETCH_EXTRA_CONDENSED - STRETCH_CONDENSEDStretch Stretch = C.PANGO_STRETCH_CONDENSED - STRETCH_SEMI_CONDENSEDStretch Stretch = C.PANGO_STRETCH_SEMI_CONDENSED - STRETCH_NORMALStretch Stretch = C.PANGO_STRETCH_NORMAL - STRETCH_SEMI_EXPANDEDStretch Stretch = C.PANGO_STRETCH_SEMI_EXPANDED - STRETCH_EXPANDEDStretch Stretch = C.PANGO_STRETCH_EXPANDED - STRETCH_EXTRA_EXPANDEDStretch Stretch = C.PANGO_STRETCH_EXTRA_EXPANDED - STRETCH_ULTRA_EXPANDEDStretch Stretch = C.PANGO_STRETCH_ULTRA_EXPANDED -) - -type FontMask int - -const ( - FONT_MASK_FAMILY FontMask = C.PANGO_FONT_MASK_FAMILY /* 1 << 0 */ - FONT_MASK_STYLEFontMask FontMask = C.PANGO_FONT_MASK_STYLE /* 1 << 1 */ - FONT_MASK_VARIANTFontMask FontMask = C.PANGO_FONT_MASK_VARIANT /* 1 << 2 */ - FONT_MASK_WEIGHTFontMask FontMask = C.PANGO_FONT_MASK_WEIGHT /* 1 << 3 */ - FONT_MASK_STRETCHFontMask FontMask = C.PANGO_FONT_MASK_STRETCH /* 1 << 4 */ - FONT_MASK_SIZEFontMask FontMask = C.PANGO_FONT_MASK_SIZE /* 1 << 5 */ - FONT_MASK_GRAVITYFontMask FontMask = C.PANGO_FONT_MASK_GRAVITY /* 1 << 6 */ -) - -type Scale float64 - -const ( - SCALE_XX_SMALL Scale = /* C.PANGO_SCALE_XX_SMALL */ 0.5787037037037 - SCALE_X_SMALL Scale = /*C.PANGO_SCALE_X_SMALL */ 0.6444444444444 - SCALE_SMALL Scale = /*C.PANGO_SCALE_SMALL */ 0.8333333333333 - SCALE_MEDIUM Scale = /*C.PANGO_SCALE_MEDIUM */ 1.0 - SCALE_LARGE Scale = /*C.PANGO_SCALE_LARGE */ 1.2 - SCALE_X_LARGE Scale = /*C.PANGO_SCALE_X_LARGE */ 1.4399999999999 - SCALE_XX_LARGE Scale = /*C.PANGO_SCALE_XX_LARGE */ 1.728 -) - -/* - * PangoFontDescription - */ - -func marshalFontDescription(p uintptr) (interface{}, error) { - c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) - c2 := (*C.PangoFontDescription)(unsafe.Pointer(c)) - return wrapFontDescription(c2), nil -} - -func wrapFontDescription(obj *C.PangoFontDescription) *FontDescription { - return &FontDescription{obj} -} - -//PangoFontDescription *pango_font_description_new (void); -func FontDescriptionNew() *FontDescription { - c := C.pango_font_description_new() - v := new(FontDescription) - v.pangoFontDescription = c - return v -} - -//PangoFontDescription *pango_font_description_copy (const PangoFontDescription *desc); -func (v *FontDescription) Copy() *FontDescription { - c := C.pango_font_description_copy(v.native()) - v2 := new(FontDescription) - v2.pangoFontDescription = c - return v2 -} - -//PangoFontDescription *pango_font_description_copy_static (const PangoFontDescription *desc); -func (v *FontDescription) CopyStatic() *FontDescription { - c := C.pango_font_description_copy_static(v.native()) - v2 := new(FontDescription) - v2.pangoFontDescription = c - return v2 -} - -//guint pango_font_description_hash (const PangoFontDescription *desc) G_GNUC_PURE; -func (v *FontDescription) Hash() uint { - c := C.pango_font_description_hash(v.native()) - return uint(c) -} - -//gboolean pango_font_description_equal (const PangoFontDescription *desc1, -// const PangoFontDescription *desc2) G_GNUC_PURE; -func (v *FontDescription) Equal(v2 *FontDescription) bool { - c := C.pango_font_description_equal(v.native(), v2.native()) - return gobool(c) -} - -//void pango_font_description_free (PangoFontDescription *desc); -func (v *FontDescription) Free() { - C.pango_font_description_free(v.native()) -} - -//void pango_font_descriptions_free (PangoFontDescription **descs, -// int n_descs); -//func (v *FontDescription) FontDescriptionsFree(n_descs int) { -// C.pango_font_descriptions_free(v.native(), C.int(n_descs)) -//} - -//void pango_font_description_set_family (PangoFontDescription *desc, -// const char *family); -func (v *FontDescription) SetFamily(family string) { - cstr := C.CString(family) - defer C.free(unsafe.Pointer(cstr)) - C.pango_font_description_set_family(v.native(), (*C.char)(cstr)) -} - -//void pango_font_description_set_family_static (PangoFontDescription *desc, -// const char *family); -func (v *FontDescription) SetFamilyStatic(family string) { - cstr := C.CString(family) - defer C.free(unsafe.Pointer(cstr)) - C.pango_font_description_set_family_static(v.native(), (*C.char)(cstr)) -} - -//const char *pango_font_description_get_family (const PangoFontDescription *desc) G_GNUC_PURE; -func (v *FontDescription) GetFamily() string { - c := C.pango_font_description_get_family(v.native()) - return C.GoString((*C.char)(c)) -} - -//void pango_font_description_set_style (PangoFontDescription *desc, -// PangoStyle style); -func (v *FontDescription) SetStyle(style Style) { - C.pango_font_description_set_style(v.native(), (C.PangoStyle)(style)) -} - -//PangoStyle pango_font_description_get_style (const PangoFontDescription *desc) G_GNUC_PURE; -func (v *FontDescription) GetStyle() Style { - c := C.pango_font_description_get_style(v.native()) - return Style(c) -} - -//void pango_font_description_set_variant (PangoFontDescription *desc, -// PangoVariant variant); -//PangoVariant pango_font_description_get_variant (const PangoFontDescription *desc) G_GNUC_PURE; - -//void pango_font_description_set_weight (PangoFontDescription *desc, -// PangoWeight weight); -func (v *FontDescription) SetWeight(weight Weight) { - C.pango_font_description_set_weight(v.native(), (C.PangoWeight)(weight)) -} - -//PangoWeight pango_font_description_get_weight (const PangoFontDescription *desc) G_GNUC_PURE; -func (v *FontDescription) GetWeight() Weight { - c := C.pango_font_description_get_weight(v.native()) - return Weight(c) -} - -//void pango_font_description_set_stretch (PangoFontDescription *desc, -// PangoStretch stretch); -func (v *FontDescription) SetStretch(stretch Stretch) { - C.pango_font_description_set_stretch(v.native(), (C.PangoStretch)(stretch)) -} - -//PangoStretch pango_font_description_get_stretch (const PangoFontDescription *desc) G_GNUC_PURE; -func (v *FontDescription) GetStretch() Stretch { - c := C.pango_font_description_get_stretch(v.native()) - return Stretch(c) -} - -//void pango_font_description_set_size (PangoFontDescription *desc, -// gint size); -func (v *FontDescription) SetSize(size int) { - C.pango_font_description_set_size(v.native(), (C.gint)(size)) -} - -//gint pango_font_description_get_size (const PangoFontDescription *desc) G_GNUC_PURE; -func (v *FontDescription) GetSize() int { - c := C.pango_font_description_get_size(v.native()) - return int(c) -} - -//void pango_font_description_set_absolute_size (PangoFontDescription *desc, -// double size); -func (v *FontDescription) SetAbsoluteSize(size float64) { - C.pango_font_description_set_absolute_size(v.native(), (C.double)(size)) -} - -//gboolean pango_font_description_get_size_is_absolute (const PangoFontDescription *desc) G_GNUC_PURE; -func (v *FontDescription) GetSizeIsAbsolute() bool { - c := C.pango_font_description_get_size_is_absolute(v.native()) - return gobool(c) -} - -//void pango_font_description_set_gravity (PangoFontDescription *desc, -// PangoGravity gravity); -func (v *FontDescription) SetGravity(gravity Gravity) { - C.pango_font_description_set_gravity(v.native(), (C.PangoGravity)(gravity)) -} - -//PangoGravity pango_font_description_get_gravity (const PangoFontDescription *desc) G_GNUC_PURE; -func (v *FontDescription) GetGravity() Gravity { - c := C.pango_font_description_get_gravity(v.native()) - return Gravity(c) -} - -//PangoFontMask pango_font_description_get_set_fields (const PangoFontDescription *desc) G_GNUC_PURE; -func (v *FontDescription) GetSetFields() FontMask { - c := C.pango_font_description_get_set_fields(v.native()) - return FontMask(c) -} - -//void pango_font_description_unset_fields (PangoFontDescription *desc, -// PangoFontMask to_unset); -func (v *FontDescription) GetUnsetFields(to_unset FontMask) { - C.pango_font_description_unset_fields(v.native(), (C.PangoFontMask)(to_unset)) -} - -//void pango_font_description_merge (PangoFontDescription *desc, -// const PangoFontDescription *desc_to_merge, -// gboolean replace_existing); -func (v *FontDescription) Merge(desc_to_merge *FontDescription, replace_existing bool) { - C.pango_font_description_merge(v.native(), desc_to_merge.native(), gbool(replace_existing)) -} - -//void pango_font_description_merge_static (PangoFontDescription *desc, -// const PangoFontDescription *desc_to_merge, -// gboolean replace_existing); -func (v *FontDescription) MergeStatic(desc_to_merge *FontDescription, replace_existing bool) { - C.pango_font_description_merge_static(v.native(), desc_to_merge.native(), gbool(replace_existing)) -} - -//gboolean pango_font_description_better_match (const PangoFontDescription *desc, -// const PangoFontDescription *old_match, -// const PangoFontDescription *new_match) G_GNUC_PURE; -func (v *FontDescription) BetterMatch(old_match, new_match *FontDescription) bool { - c := C.pango_font_description_better_match(v.native(), old_match.native(), new_match.native()) - return gobool(c) -} - -//PangoFontDescription *pango_font_description_from_string (const char *str); -func FontDescriptionFromString(str string) *FontDescription { - cstr := C.CString(str) - defer C.free(unsafe.Pointer(cstr)) - c := C.pango_font_description_from_string((*C.char)(cstr)) - v := new(FontDescription) - v.pangoFontDescription = c - return v -} - -//char * pango_font_description_to_string (const PangoFontDescription *desc); -func (v *FontDescription) ToString() string { - c := C.pango_font_description_to_string(v.native()) - return C.GoString((*C.char)(c)) -} - -//char * pango_font_description_to_filename (const PangoFontDescription *desc); -func (v *FontDescription) ToFilename() string { - c := C.pango_font_description_to_filename(v.native()) - return C.GoString((*C.char)(c)) -} - -///* -// * PangoFontMetrics -// */ -// -///** -// * PANGO_TYPE_FONT_METRICS: -// * -// * The #GObject type for #PangoFontMetrics. -// */ -//#define PANGO_TYPE_FONT_METRICS (pango_font_metrics_get_type ()) -//GType pango_font_metrics_get_type (void) G_GNUC_CONST; -//PangoFontMetrics *pango_font_metrics_ref (PangoFontMetrics *metrics); -//void pango_font_metrics_unref (PangoFontMetrics *metrics); -//int pango_font_metrics_get_ascent (PangoFontMetrics *metrics) G_GNUC_PURE; -//int pango_font_metrics_get_descent (PangoFontMetrics *metrics) G_GNUC_PURE; -//int pango_font_metrics_get_approximate_char_width (PangoFontMetrics *metrics) G_GNUC_PURE; -//int pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics) G_GNUC_PURE; -//int pango_font_metrics_get_underline_position (PangoFontMetrics *metrics) G_GNUC_PURE; -//int pango_font_metrics_get_underline_thickness (PangoFontMetrics *metrics) G_GNUC_PURE; -//int pango_font_metrics_get_strikethrough_position (PangoFontMetrics *metrics) G_GNUC_PURE; -//int pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics) G_GNUC_PURE; -// -//#ifdef PANGO_ENABLE_BACKEND -// -//PangoFontMetrics *pango_font_metrics_new (void); -// -//struct _PangoFontMetrics -//{ -// guint ref_count; -// -// int ascent; -// int descent; -// int approximate_char_width; -// int approximate_digit_width; -// int underline_position; -// int underline_thickness; -// int strikethrough_position; -// int strikethrough_thickness; -//}; -// -//#endif /* PANGO_ENABLE_BACKEND */ -// -///* -// * PangoFontFamily -// */ -// -///** -// * PANGO_TYPE_FONT_FAMILY: -// * -// * The #GObject type for #PangoFontFamily. -// */ -///** -// * PANGO_FONT_FAMILY: -// * @object: a #GObject. -// * -// * Casts a #GObject to a #PangoFontFamily. -// */ -///** -// * PANGO_IS_FONT_FAMILY: -// * @object: a #GObject. -// * -// * Returns: %TRUE if @object is a #PangoFontFamily. -// */ -//#define PANGO_TYPE_FONT_FAMILY (pango_font_family_get_type ()) -//#define PANGO_FONT_FAMILY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_FAMILY, PangoFontFamily)) -//#define PANGO_IS_FONT_FAMILY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_FAMILY)) -// -//typedef struct _PangoFontFamily PangoFontFamily; -//typedef struct _PangoFontFace PangoFontFace; -// -//GType pango_font_family_get_type (void) G_GNUC_CONST; -// -//void pango_font_family_list_faces (PangoFontFamily *family, -// PangoFontFace ***faces, -// int *n_faces); -//const char *pango_font_family_get_name (PangoFontFamily *family) G_GNUC_PURE; -//gboolean pango_font_family_is_monospace (PangoFontFamily *family) G_GNUC_PURE; -// -//#ifdef PANGO_ENABLE_BACKEND -// -//#define PANGO_FONT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass)) -//#define PANGO_IS_FONT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FAMILY)) -//#define PANGO_FONT_FAMILY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass)) -// -//typedef struct _PangoFontFamilyClass PangoFontFamilyClass; -// -// -///** -// * PangoFontFamily: -// * -// * The #PangoFontFamily structure is used to represent a family of related -// * font faces. The faces in a family share a common design, but differ in -// * slant, weight, width and other aspects. -// */ -//struct _PangoFontFamily -//{ -// GObject parent_instance; -//}; -// -//struct _PangoFontFamilyClass -//{ -// GObjectClass parent_class; -// -// /*< public >*/ -// -// void (*list_faces) (PangoFontFamily *family, -// PangoFontFace ***faces, -// int *n_faces); -// const char * (*get_name) (PangoFontFamily *family); -// gboolean (*is_monospace) (PangoFontFamily *family); -// -// /*< private >*/ -// -// /* Padding for future expansion */ -// void (*_pango_reserved2) (void); -// void (*_pango_reserved3) (void); -// void (*_pango_reserved4) (void); -//}; -// -//#endif /* PANGO_ENABLE_BACKEND */ -// -///* -// * PangoFontFace -// */ -// -///** -// * PANGO_TYPE_FONT_FACE: -// * -// * The #GObject type for #PangoFontFace. -// */ -///** -// * PANGO_FONT_FACE: -// * @object: a #GObject. -// * -// * Casts a #GObject to a #PangoFontFace. -// */ -///** -// * PANGO_IS_FONT_FACE: -// * @object: a #GObject. -// * -// * Returns: %TRUE if @object is a #PangoFontFace. -// */ -//#define PANGO_TYPE_FONT_FACE (pango_font_face_get_type ()) -//#define PANGO_FONT_FACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_FACE, PangoFontFace)) -//#define PANGO_IS_FONT_FACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_FACE)) -// -//GType pango_font_face_get_type (void) G_GNUC_CONST; -// -//PangoFontDescription *pango_font_face_describe (PangoFontFace *face); -//const char *pango_font_face_get_face_name (PangoFontFace *face) G_GNUC_PURE; -//void pango_font_face_list_sizes (PangoFontFace *face, -// int **sizes, -// int *n_sizes); -//gboolean pango_font_face_is_synthesized (PangoFontFace *face) G_GNUC_PURE; -// -//#ifdef PANGO_ENABLE_BACKEND -// -//#define PANGO_FONT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FACE, PangoFontFaceClass)) -//#define PANGO_IS_FONT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FACE)) -//#define PANGO_FONT_FACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FACE, PangoFontFaceClass)) -// -//typedef struct _PangoFontFaceClass PangoFontFaceClass; -// -///** -// * PangoFontFace: -// * -// * The #PangoFontFace structure is used to represent a group of fonts with -// * the same family, slant, weight, width, but varying sizes. -// */ -//struct _PangoFontFace -//{ -// GObject parent_instance; -//}; -// -//struct _PangoFontFaceClass -//{ -// GObjectClass parent_class; -// -// /*< public >*/ -// -// const char * (*get_face_name) (PangoFontFace *face); -// PangoFontDescription * (*describe) (PangoFontFace *face); -// void (*list_sizes) (PangoFontFace *face, -// int **sizes, -// int *n_sizes); -// gboolean (*is_synthesized) (PangoFontFace *face); -// -// /*< private >*/ -// -// /* Padding for future expansion */ -// void (*_pango_reserved3) (void); -// void (*_pango_reserved4) (void); -//}; -// -//#endif /* PANGO_ENABLE_BACKEND */ -// -///* -// * PangoFont -// */ -// -///** -// * PANGO_TYPE_FONT: -// * -// * The #GObject type for #PangoFont. -// */ -///** -// * PANGO_FONT: -// * @object: a #GObject. -// * -// * Casts a #GObject to a #PangoFont. -// */ -///** -// * PANGO_IS_FONT: -// * @object: a #GObject. -// * -// * Returns: %TRUE if @object is a #PangoFont. -// */ -//#define PANGO_TYPE_FONT (pango_font_get_type ()) -//#define PANGO_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT, PangoFont)) -//#define PANGO_IS_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT)) -// -//GType pango_font_get_type (void) G_GNUC_CONST; -// -//PangoFontDescription *pango_font_describe (PangoFont *font); -//PangoFontDescription *pango_font_describe_with_absolute_size (PangoFont *font); -//PangoCoverage * pango_font_get_coverage (PangoFont *font, -// PangoLanguage *language); -//PangoEngineShape * pango_font_find_shaper (PangoFont *font, -// PangoLanguage *language, -// guint32 ch); -//PangoFontMetrics * pango_font_get_metrics (PangoFont *font, -// PangoLanguage *language); -//void pango_font_get_glyph_extents (PangoFont *font, -// PangoGlyph glyph, -// PangoRectangle *ink_rect, -// PangoRectangle *logical_rect); -//PangoFontMap *pango_font_get_font_map (PangoFont *font); -// -//#ifdef PANGO_ENABLE_BACKEND -// -//#define PANGO_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT, PangoFontClass)) -//#define PANGO_IS_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT)) -//#define PANGO_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT, PangoFontClass)) -// -//typedef struct _PangoFontClass PangoFontClass; -// -///** -// * PangoFont: -// * -// * The #PangoFont structure is used to represent -// * a font in a rendering-system-independent matter. -// * To create an implementation of a #PangoFont, -// * the rendering-system specific code should allocate -// * a larger structure that contains a nested -// * #PangoFont, fill in the <structfield>klass</structfield> member of -// * the nested #PangoFont with a pointer to -// * a appropriate #PangoFontClass, then call -// * pango_font_init() on the structure. -// * -// * The #PangoFont structure contains one member -// * which the implementation fills in. -// */ -//struct _PangoFont -//{ -// GObject parent_instance; -//}; -// -//struct _PangoFontClass -//{ -// GObjectClass parent_class; -// -// /*< public >*/ -// -// PangoFontDescription *(*describe) (PangoFont *font); -// PangoCoverage * (*get_coverage) (PangoFont *font, -// PangoLanguage *lang); -// PangoEngineShape * (*find_shaper) (PangoFont *font, -// PangoLanguage *lang, -// guint32 ch); -// void (*get_glyph_extents) (PangoFont *font, -// PangoGlyph glyph, -// PangoRectangle *ink_rect, -// PangoRectangle *logical_rect); -// PangoFontMetrics * (*get_metrics) (PangoFont *font, -// PangoLanguage *language); -// PangoFontMap * (*get_font_map) (PangoFont *font); -// PangoFontDescription *(*describe_absolute) (PangoFont *font); -// /*< private >*/ -// -// /* Padding for future expansion */ -// void (*_pango_reserved1) (void); -// void (*_pango_reserved2) (void); -//}; -// -///* used for very rare and miserable situtations that we cannot even -// * draw a hexbox -// */ -//#define PANGO_UNKNOWN_GLYPH_WIDTH 10 -//#define PANGO_UNKNOWN_GLYPH_HEIGHT 14 -// -//#endif /* PANGO_ENABLE_BACKEND */ -// -///** -// * PANGO_GLYPH_EMPTY: -// * -// * The %PANGO_GLYPH_EMPTY macro represents a #PangoGlyph value that has a -// * special meaning, which is a zero-width empty glyph. This is useful for -// * example in shaper modules, to use as the glyph for various zero-width -// * Unicode characters (those passing pango_is_zero_width()). -// */ -///** -// * PANGO_GLYPH_INVALID_INPUT: -// * -// * The %PANGO_GLYPH_INVALID_INPUT macro represents a #PangoGlyph value that has a -// * special meaning of invalid input. #PangoLayout produces one such glyph -// * per invalid input UTF-8 byte and such a glyph is rendered as a crossed -// * box. -// * -// * Note that this value is defined such that it has the %PANGO_GLYPH_UNKNOWN_FLAG -// * on. -// * -// * Since: 1.20 -// */ -///** -// * PANGO_GLYPH_UNKNOWN_FLAG: -// * -// * The %PANGO_GLYPH_UNKNOWN_FLAG macro is a flag value that can be added to -// * a #gunichar value of a valid Unicode character, to produce a #PangoGlyph -// * value, representing an unknown-character glyph for the respective #gunichar. -// */ -///** -// * PANGO_GET_UNKNOWN_GLYPH: -// * @wc: a Unicode character -// * -// * The way this unknown glyphs are rendered is backend specific. For example, -// * a box with the hexadecimal Unicode code-point of the character written in it -// * is what is done in the most common backends. -// * -// * Returns: a #PangoGlyph value that means no glyph was found for @wc. -// */ -//#define PANGO_GLYPH_EMPTY ((PangoGlyph)0x0FFFFFFF) -//#define PANGO_GLYPH_INVALID_INPUT ((PangoGlyph)0xFFFFFFFF) -//#define PANGO_GLYPH_UNKNOWN_FLAG ((PangoGlyph)0x10000000) -//#define PANGO_GET_UNKNOWN_GLYPH(wc) ((PangoGlyph)(wc)|PANGO_GLYPH_UNKNOWN_FLAG) -// -// diff --git a/vendor/github.com/gotk3/gotk3/pango/pango-glyph-item.go b/vendor/github.com/gotk3/gotk3/pango/pango-glyph-item.go deleted file mode 100644 index bed9fc2..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/pango-glyph-item.go +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2015- terrak <terrak1975@gmail.com> - * - * This file originated from: http://www.terrak.net/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package pango - -// #include <pango/pango.h> -// #include "pango.go.h" -// #include <stdlib.h> -import "C" -import ( - // "github.com/andre-hub/gotk3/glib" - // "github.com/andre-hub/gotk3/cairo" - "unsafe" -) - -// GlyphItem is a representation of PangoGlyphItem. -type GlyphItem struct { - pangoGlyphItem *C.PangoGlyphItem -} - -// Native returns a pointer to the underlying PangoGlyphItem. -func (v *GlyphItem) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *GlyphItem) native() *C.PangoGlyphItem { - return (*C.PangoGlyphItem)(unsafe.Pointer(v.pangoGlyphItem)) -} diff --git a/vendor/github.com/gotk3/gotk3/pango/pango-glyph.go b/vendor/github.com/gotk3/gotk3/pango/pango-glyph.go deleted file mode 100644 index 2ea29f7..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/pango-glyph.go +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2015- terrak <terrak1975@gmail.com> - * - * This file originated from: http://www.terrak.net/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package pango - -// #include <pango/pango.h> -// #include "pango.go.h" -// #include <stdlib.h> -import "C" -import ( - // "github.com/andre-hub/gotk3/glib" - // "github.com/andre-hub/gotk3/cairo" - "unsafe" -) - -// GlyphGeometry is a representation of PangoGlyphGeometry. -type GlyphGeometry struct { - pangoGlyphGeometry *C.PangoGlyphGeometry -} - -// Native returns a pointer to the underlying PangoLayout. -func (v *GlyphGeometry) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *GlyphGeometry) native() *C.PangoGlyphGeometry { - return (*C.PangoGlyphGeometry)(unsafe.Pointer(v.pangoGlyphGeometry)) -} - -// GlyphVisAttr is a representation of PangoGlyphVisAttr. -type GlyphVisAttr struct { - pangoGlyphVisAttr *C.PangoGlyphGeometry -} - -// Native returns a pointer to the underlying PangoGlyphVisAttr. -func (v *GlyphVisAttr) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *GlyphVisAttr) native() *C.PangoGlyphVisAttr { - return (*C.PangoGlyphVisAttr)(unsafe.Pointer(v.pangoGlyphVisAttr)) -} - -// GlyphInfo is a representation of PangoGlyphInfo. -type GlyphInfo struct { - pangoGlyphInfo *C.PangoGlyphInfo -} - -// Native returns a pointer to the underlying PangoGlyphInfo. -func (v *GlyphInfo) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *GlyphInfo) native() *C.PangoGlyphInfo { - return (*C.PangoGlyphInfo)(unsafe.Pointer(v.pangoGlyphInfo)) -} - -// GlyphGeometry is a representation of PangoGlyphString. -type GlyphString struct { - pangoGlyphString *C.PangoGlyphString -} - -// Native returns a pointer to the underlying PangoGlyphString. -func (v *GlyphString) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *GlyphString) native() *C.PangoGlyphString { - return (*C.PangoGlyphString)(unsafe.Pointer(v.pangoGlyphString)) -} diff --git a/vendor/github.com/gotk3/gotk3/pango/pango-gravity.go b/vendor/github.com/gotk3/gotk3/pango/pango-gravity.go deleted file mode 100644 index 7bd3800..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/pango-gravity.go +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2015- terrak <terrak1975@gmail.com> - * - * This file originated from: http://www.terrak.net/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package pango - -// #include <pango/pango.h> -// #include "pango.go.h" -import "C" - -// "github.com/andre-hub/gotk3/glib" -// "github.com/andre-hub/gotk3/cairo" -// "unsafe" - -type Gravity int - -const ( - GRAVITY_SOUTH Gravity = C.PANGO_GRAVITY_SOUTH - GRAVITY_EAST Gravity = C.PANGO_GRAVITY_EAST - GRAVITY_NORTH Gravity = C.PANGO_GRAVITY_NORTH - GRAVITY_WEST Gravity = C.PANGO_GRAVITY_WEST - GRAVITY_AUTO Gravity = C.PANGO_GRAVITY_AUTO -) - -type GravityHint int - -const ( - GRAVITY_HINT_NATURAL GravityHint = C.PANGO_GRAVITY_HINT_NATURAL - GRAVITY_HINT_STRONG GravityHint = C.PANGO_GRAVITY_HINT_STRONG - GRAVITY_HINT_LINE GravityHint = C.PANGO_GRAVITY_HINT_LINE -) - -//double pango_gravity_to_rotation (PangoGravity gravity) G_GNUC_CONST; -func GravityToRotation(gravity Gravity) float64 { - c := C.pango_gravity_to_rotation((C.PangoGravity)(gravity)) - return float64(c) -} - -//PangoGravity pango_gravity_get_for_matrix (const PangoMatrix *matrix) G_GNUC_PURE; - -//PangoGravity pango_gravity_get_for_script (PangoScript script, -// PangoGravity base_gravity, -// PangoGravityHint hint) G_GNUC_CONST; - -//PangoGravity pango_gravity_get_for_script_and_width -// (PangoScript script, -// gboolean wide, -// PangoGravity base_gravity, -// PangoGravityHint hint) G_GNUC_CONST; diff --git a/vendor/github.com/gotk3/gotk3/pango/pango-layout.go b/vendor/github.com/gotk3/gotk3/pango/pango-layout.go deleted file mode 100644 index 3e3a01b..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/pango-layout.go +++ /dev/null @@ -1,469 +0,0 @@ -/* - * Copyright (c) 2015- terrak <terrak1975@gmail.com> - * - * This file originated from: http://www.terrak.net/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package pango - -// #include <pango/pango.h> -// #include "pango.go.h" -import "C" -import ( - "unsafe" - - "github.com/gotk3/gotk3/glib" -) - -func init() { - tm := []glib.TypeMarshaler{ - // Enums - {glib.Type(C.pango_alignment_get_type()), marshalAlignment}, - {glib.Type(C.pango_ellipsize_mode_get_type()), marshalEllipsizeMode}, - {glib.Type(C.pango_wrap_mode_get_type()), marshalWrapMode}, - - // Objects/Interfaces - // {glib.Type(C.pango_layout_get_type()), marshalLayout}, - } - glib.RegisterGValueMarshalers(tm) -} - -// Layout is a representation of PangoLayout. -type Layout struct { - pangoLayout *C.PangoLayout -} - -// Native returns a pointer to the underlying PangoLayout. -func (v *Layout) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *Layout) native() *C.PangoLayout { - return (*C.PangoLayout)(unsafe.Pointer(v.pangoLayout)) -} - -func WrapLayout(p uintptr) *Layout { - layout := new(Layout) - layout.pangoLayout = (*C.PangoLayout)(unsafe.Pointer(p)) - return layout -} - -// LayoutLine is a representation of PangoLayoutLine. -type LayoutLine struct { - pangoLayoutLine *C.PangoLayout -} - -// Native returns a pointer to the underlying PangoLayoutLine. -func (v *LayoutLine) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *LayoutLine) native() *C.PangoLayoutLine { - return (*C.PangoLayoutLine)(unsafe.Pointer(v.pangoLayoutLine)) -} - -/* - * Constants - */ - -// Alignment is a representation of Pango's PangoAlignment. -type Alignment int - -const ( - ALIGN_LEFT Alignment = C.PANGO_ALIGN_LEFT - ALIGN_CENTER Alignment = C.PANGO_ALIGN_CENTER - ALIGN_RIGHT Alignment = C.PANGO_ALIGN_RIGHT -) - -func marshalAlignment(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return Alignment(c), nil -} - -// WrapMode is a representation of Pango's PangoWrapMode. -type WrapMode int - -const ( - WRAP_WORD WrapMode = C.PANGO_WRAP_WORD - WRAP_CHAR WrapMode = C.PANGO_WRAP_CHAR - WRAP_WORD_CHAR WrapMode = C.PANGO_WRAP_WORD_CHAR -) - -func marshalWrapMode(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return WrapMode(c), nil -} - -// EllipsizeMode is a representation of Pango's PangoEllipsizeMode. -type EllipsizeMode int - -const ( - ELLIPSIZE_NONE EllipsizeMode = C.PANGO_ELLIPSIZE_NONE - ELLIPSIZE_START EllipsizeMode = C.PANGO_ELLIPSIZE_START - ELLIPSIZE_MIDDLE EllipsizeMode = C.PANGO_ELLIPSIZE_MIDDLE - ELLIPSIZE_END EllipsizeMode = C.PANGO_ELLIPSIZE_END -) - -func marshalEllipsizeMode(p uintptr) (interface{}, error) { - c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) - return EllipsizeMode(c), nil -} - -/* -func marshalLayout(p uintptr) (interface{}, error) { - c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) - obj := wrapObject(unsafe.Pointer(c)) - return wrapLayout(obj), nil -} - -func wrapLayout(obj *glib.Object) *Layout { - return &Layout{obj} -} -*/ - -//PangoLayout *pango_layout_new (PangoContext *context); -func LayoutNew(context *Context) *Layout { - c := C.pango_layout_new(context.native()) - - layout := new(Layout) - layout.pangoLayout = (*C.PangoLayout)(c) - return layout -} - -//PangoLayout *pango_layout_copy (PangoLayout *src); -func (v *Layout) Copy() *Layout { - c := C.pango_layout_copy(v.native()) - - layout := new(Layout) - layout.pangoLayout = (*C.PangoLayout)(c) - return layout -} - -//PangoContext *pango_layout_get_context (PangoLayout *layout); -func (v *Layout) GetContext() *Context { - c := C.pango_layout_get_context(v.native()) - - context := new(Context) - context.pangoContext = (*C.PangoContext)(c) - - return context -} - -//void pango_layout_set_attributes (PangoLayout *layout, -// PangoAttrList *attrs); -func (v *Layout) SetAttributes(attrs *AttrList) { - C.pango_layout_set_attributes(v.native(), attrs.native()) -} - -//PangoAttrList *pango_layout_get_attributes (PangoLayout *layout); -func (v *Layout) GetAttributes() *AttrList { - c := C.pango_layout_get_attributes(v.native()) - - attrList := new(AttrList) - attrList.pangoAttrList = (*C.PangoAttrList)(c) - - return attrList -} - -//void pango_layout_set_text (PangoLayout *layout, -// const char *text, -// int length); -func (v *Layout) SetText(text string, length int) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.pango_layout_set_text(v.native(), (*C.char)(cstr), (C.int)(length)) -} - -//const char *pango_layout_get_text (PangoLayout *layout); -func (v *Layout) GetText() string { - c := C.pango_layout_get_text(v.native()) - return C.GoString((*C.char)(c)) -} - -//gint pango_layout_get_character_count (PangoLayout *layout); -func (v *Layout) GetCharacterCount() int { - c := C.pango_layout_get_character_count(v.native()) - return int(c) -} - -//void pango_layout_set_markup (PangoLayout *layout, -// const char *markup, -// int length); -func (v *Layout) SetMarkup(text string, length int) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.pango_layout_set_markup(v.native(), (*C.char)(cstr), (C.int)(length)) -} - -//void pango_layout_set_markup_with_accel (PangoLayout *layout, -// const char *markup, -// int length, -// gunichar accel_marker, -// gunichar *accel_char); - -/* -func (v *Layout)SetMarkupWithAccel (text string, length int, accel_marker, accel_char rune){ - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.pango_layout_set_markup_with_accel (v.native(), (*C.char)(cstr), (C.int)(length), (C.gunichar)(accel_marker), (C.gunichar)(accel_char) ) -} -*/ - -//void pango_layout_set_font_description (PangoLayout *layout, -// const PangoFontDescription *desc); - -func (v *Layout) SetFontDescription(desc *FontDescription) { - C.pango_layout_set_font_description(v.native(), desc.native()) -} - -//const PangoFontDescription *pango_layout_get_font_description (PangoLayout *layout); - -func (v *Layout) GetFontDescription() *FontDescription { - c := C.pango_layout_get_font_description(v.native()) - - desc := new(FontDescription) - desc.pangoFontDescription = (*C.PangoFontDescription)(c) - - return desc -} - -//void pango_layout_set_width (PangoLayout *layout, -// int width); - -func (v *Layout) SetWidth(width int) { - C.pango_layout_set_width(v.native(), C.int(width)) -} - -//int pango_layout_get_width (PangoLayout *layout); - -func (v *Layout) GetWidth() int { - c := C.pango_layout_get_width(v.native()) - return int(c) -} - -//void pango_layout_set_height (PangoLayout *layout, -// int height); - -func (v *Layout) SetHeight(width int) { - C.pango_layout_set_height(v.native(), C.int(width)) -} - -//int pango_layout_get_height (PangoLayout *layout); - -func (v *Layout) GetHeight() int { - c := C.pango_layout_get_height(v.native()) - return int(c) -} - -//void pango_layout_set_wrap (PangoLayout *layout, -// PangoWrapMode wrap); - -func (v *Layout) SetWrap(wrap WrapMode) { - C.pango_layout_set_wrap(v.native(), C.PangoWrapMode(wrap)) -} - -//PangoWrapMode pango_layout_get_wrap (PangoLayout *layout); - -func (v *Layout) GetWrap() WrapMode { - c := C.pango_layout_get_wrap(v.native()) - return WrapMode(c) -} - -//gboolean pango_layout_is_wrapped (PangoLayout *layout); - -func (v *Layout) IsWrapped() bool { - c := C.pango_layout_is_wrapped(v.native()) - return gobool(c) -} - -//void pango_layout_set_indent (PangoLayout *layout, -// int indent); - -func (v *Layout) SetIndent(indent int) { - C.pango_layout_set_indent(v.native(), C.int(indent)) -} - -//int pango_layout_get_indent (PangoLayout *layout); - -func (v *Layout) GetIndent() int { - c := C.pango_layout_get_indent(v.native()) - return int(c) -} - -//void pango_layout_set_spacing (PangoLayout *layout, -// int spacing); -//int pango_layout_get_spacing (PangoLayout *layout); -//void pango_layout_set_justify (PangoLayout *layout, -// gboolean justify); -//gboolean pango_layout_get_justify (PangoLayout *layout); -//void pango_layout_set_auto_dir (PangoLayout *layout, -// gboolean auto_dir); -//gboolean pango_layout_get_auto_dir (PangoLayout *layout); -//void pango_layout_set_alignment (PangoLayout *layout, -// PangoAlignment alignment); -//PangoAlignment pango_layout_get_alignment (PangoLayout *layout); -// -//void pango_layout_set_tabs (PangoLayout *layout, -// PangoTabArray *tabs); -// -//PangoTabArray* pango_layout_get_tabs (PangoLayout *layout); -// -//void pango_layout_set_single_paragraph_mode (PangoLayout *layout, -// gboolean setting); -//gboolean pango_layout_get_single_paragraph_mode (PangoLayout *layout); -// -//void pango_layout_set_ellipsize (PangoLayout *layout, -// PangoEllipsizeMode ellipsize); -//PangoEllipsizeMode pango_layout_get_ellipsize (PangoLayout *layout); -//gboolean pango_layout_is_ellipsized (PangoLayout *layout); -// -//int pango_layout_get_unknown_glyphs_count (PangoLayout *layout); -// -//void pango_layout_context_changed (PangoLayout *layout); -//guint pango_layout_get_serial (PangoLayout *layout); -// -//void pango_layout_get_log_attrs (PangoLayout *layout, -// PangoLogAttr **attrs, -// gint *n_attrs); -// -//const PangoLogAttr *pango_layout_get_log_attrs_readonly (PangoLayout *layout, -// gint *n_attrs); -// -//void pango_layout_index_to_pos (PangoLayout *layout, -// int index_, -// PangoRectangle *pos); -//void pango_layout_index_to_line_x (PangoLayout *layout, -// int index_, -// gboolean trailing, -// int *line, -// int *x_pos); -//void pango_layout_get_cursor_pos (PangoLayout *layout, -// int index_, -// PangoRectangle *strong_pos, -// PangoRectangle *weak_pos); -//void pango_layout_move_cursor_visually (PangoLayout *layout, -// gboolean strong, -// int old_index, -// int old_trailing, -// int direction, -// int *new_index, -// int *new_trailing); -//gboolean pango_layout_xy_to_index (PangoLayout *layout, -// int x, -// int y, -// int *index_, -// int *trailing); -//void pango_layout_get_extents (PangoLayout *layout, -// PangoRectangle *ink_rect, -// PangoRectangle *logical_rect); -//void pango_layout_get_pixel_extents (PangoLayout *layout, -// PangoRectangle *ink_rect, -// PangoRectangle *logical_rect); - -//void pango_layout_get_size (PangoLayout *layout, -// int *width, -// int *height); -func (v *Layout) GetSize() (int, int) { - var w, h C.int - C.pango_layout_get_size(v.native(), &w, &h) - return int(w), int(h) -} - -//void pango_layout_get_pixel_size (PangoLayout *layout, -// int *width, -// int *height); -//int pango_layout_get_baseline (PangoLayout *layout); -// -//int pango_layout_get_line_count (PangoLayout *layout); -//PangoLayoutLine *pango_layout_get_line (PangoLayout *layout, -// int line); -//PangoLayoutLine *pango_layout_get_line_readonly (PangoLayout *layout, -// int line); -//GSList * pango_layout_get_lines (PangoLayout *layout); -//GSList * pango_layout_get_lines_readonly (PangoLayout *layout); -// -// -//#define PANGO_TYPE_LAYOUT_LINE (pango_layout_line_get_type ()) -// -//GType pango_layout_line_get_type (void) G_GNUC_CONST; -// -//PangoLayoutLine *pango_layout_line_ref (PangoLayoutLine *line); -//void pango_layout_line_unref (PangoLayoutLine *line); -// -//gboolean pango_layout_line_x_to_index (PangoLayoutLine *line, -// int x_pos, -// int *index_, -// int *trailing); -//void pango_layout_line_index_to_x (PangoLayoutLine *line, -// int index_, -// gboolean trailing, -// int *x_pos); -//void pango_layout_line_get_x_ranges (PangoLayoutLine *line, -// int start_index, -// int end_index, -// int **ranges, -// int *n_ranges); -//void pango_layout_line_get_extents (PangoLayoutLine *line, -// PangoRectangle *ink_rect, -// PangoRectangle *logical_rect); -//void pango_layout_line_get_pixel_extents (PangoLayoutLine *layout_line, -// PangoRectangle *ink_rect, -// PangoRectangle *logical_rect); -// -//typedef struct _PangoLayoutIter PangoLayoutIter; -// -//#define PANGO_TYPE_LAYOUT_ITER (pango_layout_iter_get_type ()) -// -//GType pango_layout_iter_get_type (void) G_GNUC_CONST; -// -//PangoLayoutIter *pango_layout_get_iter (PangoLayout *layout); -//PangoLayoutIter *pango_layout_iter_copy (PangoLayoutIter *iter); -//void pango_layout_iter_free (PangoLayoutIter *iter); -// -//int pango_layout_iter_get_index (PangoLayoutIter *iter); -//PangoLayoutRun *pango_layout_iter_get_run (PangoLayoutIter *iter); -//PangoLayoutRun *pango_layout_iter_get_run_readonly (PangoLayoutIter *iter); -//PangoLayoutLine *pango_layout_iter_get_line (PangoLayoutIter *iter); -//PangoLayoutLine *pango_layout_iter_get_line_readonly (PangoLayoutIter *iter); -//gboolean pango_layout_iter_at_last_line (PangoLayoutIter *iter); -//PangoLayout *pango_layout_iter_get_layout (PangoLayoutIter *iter); -// -//gboolean pango_layout_iter_next_char (PangoLayoutIter *iter); -//gboolean pango_layout_iter_next_cluster (PangoLayoutIter *iter); -//gboolean pango_layout_iter_next_run (PangoLayoutIter *iter); -//gboolean pango_layout_iter_next_line (PangoLayoutIter *iter); -// -//void pango_layout_iter_get_char_extents (PangoLayoutIter *iter, -// PangoRectangle *logical_rect); -//void pango_layout_iter_get_cluster_extents (PangoLayoutIter *iter, -// PangoRectangle *ink_rect, -// PangoRectangle *logical_rect); -//void pango_layout_iter_get_run_extents (PangoLayoutIter *iter, -// PangoRectangle *ink_rect, -// PangoRectangle *logical_rect); -//void pango_layout_iter_get_line_extents (PangoLayoutIter *iter, -// PangoRectangle *ink_rect, -// PangoRectangle *logical_rect); -/* All the yranges meet, unlike the logical_rect's (i.e. the yranges - * assign between-line spacing to the nearest line) - */ -//void pango_layout_iter_get_line_yrange (PangoLayoutIter *iter, -// int *y0_, -// int *y1_); -//void pango_layout_iter_get_layout_extents (PangoLayoutIter *iter, -// PangoRectangle *ink_rect, -// PangoRectangle *logical_rect); -//int pango_layout_iter_get_baseline (PangoLayoutIter *iter); -// diff --git a/vendor/github.com/gotk3/gotk3/pango/pango-layout.go.h b/vendor/github.com/gotk3/gotk3/pango/pango-layout.go.h deleted file mode 100644 index 0f4e2fd..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/pango-layout.go.h +++ /dev/null @@ -1,27 +0,0 @@ -/*
- * Copyright (c) 2015- terrak <terrak1975@gmail.com>
- *
- * This file originated from: http://www.terrak.net/
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-static PangoLayout* toPangoLayout(void *p)
-{
- return ( (PangoLayout*) (p) );
-}
-
diff --git a/vendor/github.com/gotk3/gotk3/pango/pango-types.go b/vendor/github.com/gotk3/gotk3/pango/pango-types.go deleted file mode 100644 index fb08656..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/pango-types.go +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2015- terrak <terrak1975@gmail.com> - * - * This file originated from: http://www.terrak.net/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package pango - -// #include <pango/pango.h> -// #include "pango.go.h" -// #include <stdlib.h> -import "C" -import ( - "unsafe" -) - -// LogAttr is a representation of PangoLogAttr. -type LogAttr struct { - pangoLogAttr *C.PangoLogAttr -} - -// Native returns a pointer to the underlying PangoLayout. -func (v *LogAttr) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *LogAttr) native() *C.PangoLogAttr { - return (*C.PangoLogAttr)(unsafe.Pointer(v.pangoLogAttr)) -} - -// EngineLang is a representation of PangoEngineLang. -type EngineLang struct { - pangoEngineLang *C.PangoEngineLang -} - -// Native returns a pointer to the underlying PangoLayout. -func (v *EngineLang) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *EngineLang) native() *C.PangoEngineLang { - return (*C.PangoEngineLang)(unsafe.Pointer(v.pangoEngineLang)) -} - -// EngineShape is a representation of PangoEngineShape. -type EngineShape struct { - pangoEngineShape *C.PangoEngineShape -} - -// Native returns a pointer to the underlying PangoLayout. -func (v *EngineShape) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *EngineShape) native() *C.PangoEngineShape { - return (*C.PangoEngineShape)(unsafe.Pointer(v.pangoEngineShape)) -} - -// Font is a representation of PangoFont. -type Font struct { - pangoFont *C.PangoFont -} - -// Native returns a pointer to the underlying PangoLayout. -func (v *Font) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *Font) native() *C.PangoFont { - return (*C.PangoFont)(unsafe.Pointer(v.pangoFont)) -} - -// FontMap is a representation of PangoFontMap. -type FontMap struct { - pangoFontMap *C.PangoFontMap -} - -// Native returns a pointer to the underlying PangoLayout. -func (v *FontMap) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *FontMap) native() *C.PangoFontMap { - return (*C.PangoFontMap)(unsafe.Pointer(v.pangoFontMap)) -} - -func wrapFontMap(fontMap *C.PangoFontMap) *FontMap { - return &FontMap{fontMap} -} - -func WrapFontMap(p uintptr) *FontMap { - fontMap := (*C.PangoFontMap)(unsafe.Pointer(p)) - return wrapFontMap(fontMap) -} - -// Rectangle is a representation of PangoRectangle. -type Rectangle struct { - pangoRectangle *C.PangoRectangle -} - -// Native returns a pointer to the underlying PangoLayout. -func (v *Rectangle) Native() uintptr { - return uintptr(unsafe.Pointer(v.native())) -} - -func (v *Rectangle) native() *C.PangoRectangle { - return (*C.PangoRectangle)(unsafe.Pointer(v.pangoRectangle)) -} - -// Glyph is a representation of PangoGlyph -type Glyph uint32 - -//void pango_extents_to_pixels (PangoRectangle *inclusive, -// PangoRectangle *nearest); -func (inclusive *Rectangle) ExtentsToPixels(nearest *Rectangle) { - C.pango_extents_to_pixels(inclusive.native(), nearest.native()) -} - -func RectangleNew(x, y, width, height int) *Rectangle { - r := new(Rectangle) - r.pangoRectangle = C.createPangoRectangle((C.int)(x), (C.int)(y), (C.int)(width), (C.int)(height)) - return r -} diff --git a/vendor/github.com/gotk3/gotk3/pango/pango.go b/vendor/github.com/gotk3/gotk3/pango/pango.go deleted file mode 100644 index ee39d3d..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/pango.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) 2013-2014 Conformal Systems <info@conformal.com> -// -// This file originated from: http://opensource.conformal.com/ -// -// Permission to use, copy, modify, and distribute this software for any -// purpose with or without fee is hereby granted, provided that the above -// copyright notice and this permission notice appear in all copies. -// -// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -// Go bindings for Pango. -package pango - -// #cgo pkg-config: fontconfig gobject-2.0 pango pangocairo -// #include <pango/pango.h> -// #include "pango.go.h" -import "C" - -// "github.com/andre-hub/gotk3/glib" -// "unsafe" - -func init() { - -} - -/* - * Type conversions - */ - -func gbool(b bool) C.gboolean { - if b { - return C.gboolean(1) - } - return C.gboolean(0) -} -func gobool(b C.gboolean) bool { - if b != 0 { - return true - } - return false -} - -/* - * Constantes - */ - -const ( - SCALE int = 1024 -) diff --git a/vendor/github.com/gotk3/gotk3/pango/pango.go.h b/vendor/github.com/gotk3/gotk3/pango/pango.go.h deleted file mode 100644 index a5fb61d..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/pango.go.h +++ /dev/null @@ -1,38 +0,0 @@ -/*
- * Copyright (c) 2015- terrak <terrak1975@gmail.com>
- *
- * This file originated from: http://www.terrak.net/
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "pango-attributes.go.h"
-#include "pango-layout.go.h"
-
-#include "pangocairo.go.h"
-
-
-static PangoRectangle *
-createPangoRectangle(int x, int y, int width, int height)
-{
- PangoRectangle *r = (PangoRectangle *)malloc(sizeof(PangoRectangle));
- r->x = x;
- r->y = y;
- r->width = width;
- r->height = height;
- return r;
-}
\ No newline at end of file diff --git a/vendor/github.com/gotk3/gotk3/pango/pangocairo.go b/vendor/github.com/gotk3/gotk3/pango/pangocairo.go deleted file mode 100644 index 260e345..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/pangocairo.go +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2015- terrak <terrak1975@gmail.com> - * - * This file originated from: http://www.terrak.net/ - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -package pango - -// #include <pango/pango.h> -// #include <cairo.h> -// #include <pango/pangocairo.h> -// #include "pango.go.h" -import "C" -import ( - // "github.com/gotk3/gotk3/glib" - "unsafe" - - "github.com/gotk3/gotk3/cairo" -) - -func init() { - // tm := []glib.TypeMarshaler{ - // // Enums - // {glib.Type(C.pango_alignement_get_type()), marshalAlignment}, - // {glib.Type(C.pango_ellipsize_mode_get_type()), marshalEllipsizeMode}, - // {glib.Type(C.pango_wrap_mode_get_type()), marshalWrapMode}, - // } - // glib.RegisterGValueMarshalers(tm) -} - -func cairo_context(cr *cairo.Context) *C.cairo_t { - return (*C.cairo_t)(cr.GetCContext()) -} - -/* Convenience - */ -//PangoContext *pango_cairo_create_context (cairo_t *cr); -func CairoCreateContext(cr *cairo.Context) *Context { - c := C.pango_cairo_create_context(cairo_context(cr)) - context := new(Context) - context.pangoContext = (*C.PangoContext)(c) - return context -} - -//PangoLayout *pango_cairo_create_layout (cairo_t *cr); -func CairoCreateLayout(cr *cairo.Context) *Layout { - c := C.pango_cairo_create_layout(cairo_context(cr)) - layout := new(Layout) - layout.pangoLayout = (*C.PangoLayout)(c) - return layout -} - -//void pango_cairo_update_layout (cairo_t *cr, -// PangoLayout *layout); -func CairoUpdateLayout(cr *cairo.Context, v *Layout) { - C.pango_cairo_update_layout(cairo_context(cr), v.native()) -} - -/* - * Rendering - */ -//void pango_cairo_show_glyph_string (cairo_t *cr, -// PangoFont *font, -// PangoGlyphString *glyphs); -func CairoShowGlyphString(cr *cairo.Context, font *Font, glyphs *GlyphString) { - C.pango_cairo_show_glyph_string(cairo_context(cr), font.native(), glyphs.native()) -} - -//void pango_cairo_show_glyph_item (cairo_t *cr, -// const char *text, -// PangoGlyphItem *glyph_item); -func CairoShowGlyphItem(cr *cairo.Context, text string, glyph_item *GlyphItem) { - cstr := C.CString(text) - defer C.free(unsafe.Pointer(cstr)) - C.pango_cairo_show_glyph_item(cairo_context(cr), (*C.char)(cstr), glyph_item.native()) -} - -//void pango_cairo_show_layout_line (cairo_t *cr, -// PangoLayoutLine *line); -func CairoShowLayoutLine(cr *cairo.Context, line *LayoutLine) { - C.pango_cairo_show_layout_line(cairo_context(cr), line.native()) -} - -//void pango_cairo_show_layout (cairo_t *cr, -// PangoLayout *layout); -func CairoShowLayout(cr *cairo.Context, layout *Layout) { - C.pango_cairo_show_layout(cairo_context(cr), layout.native()) -} - -//void pango_cairo_show_error_underline (cairo_t *cr, -// double x, -// double y, -// double width, -// double height); - -/* - * Rendering to a path - */ - -//void pango_cairo_glyph_string_path (cairo_t *cr, -// PangoFont *font, -// PangoGlyphString *glyphs); -func CairoGlyphStringPath(cr *cairo.Context, font *Font, glyphs *GlyphString) { - C.pango_cairo_glyph_string_path(cairo_context(cr), font.native(), glyphs.native()) -} - -//void pango_cairo_layout_line_path (cairo_t *cr, -// PangoLayoutLine *line); -func CairoLayoutLinePath(cr *cairo.Context, line *LayoutLine) { - C.pango_cairo_layout_line_path(cairo_context(cr), line.native()) -} - -//void pango_cairo_layout_path (cairo_t *cr, -// PangoLayout *layout); -func CairoLayoutPath(cr *cairo.Context, layout *Layout) { - C.pango_cairo_layout_path(cairo_context(cr), layout.native()) -} - -//void pango_cairo_error_underline_path (cairo_t *cr, -// double x, -// double y, -// double width, -// double height); -func CairoErrorUnderlinePath(cr *cairo.Context, x, y, width, height float64) { - C.pango_cairo_error_underline_path(cairo_context(cr), C.double(x), C.double(y), C.double(width), C.double(height)) -} diff --git a/vendor/github.com/gotk3/gotk3/pango/pangocairo.go.h b/vendor/github.com/gotk3/gotk3/pango/pangocairo.go.h deleted file mode 100644 index e69de29..0000000 --- a/vendor/github.com/gotk3/gotk3/pango/pangocairo.go.h +++ /dev/null diff --git a/vendor/github.com/jmshal/go-locale/detect_locale_darwin.go b/vendor/github.com/jmshal/go-locale/detect_locale_darwin.go deleted file mode 100644 index 4cce554..0000000 --- a/vendor/github.com/jmshal/go-locale/detect_locale_darwin.go +++ /dev/null @@ -1,9 +0,0 @@ -package go_locale - -func DetectLocale() (string, error) { - return getCommandOutput( - "defaults", - "read", - "/Library/Preferences/.GlobalPreferences", - "AppleLocale") -} diff --git a/vendor/github.com/jmshal/go-locale/detect_locale_linux.go b/vendor/github.com/jmshal/go-locale/detect_locale_linux.go deleted file mode 100644 index df0c33d..0000000 --- a/vendor/github.com/jmshal/go-locale/detect_locale_linux.go +++ /dev/null @@ -1,31 +0,0 @@ -package go_locale - -import ( - "strings" - "errors" -) - -func DetectLocale() (string, error) { - out, err := getCommandOutput("locale") - if err != nil { - return "", err - } - - lines := strings.Split(out, "\n") - for _, line := range lines { - if line != "" { - parts := strings.Split(line, "=") - value := strings.Trim(parts[1], `"`) - - if value != "C" && value != "" { - encodingIndex := strings.Index(value, ".") - if encodingIndex != -1 { - value = value[0:encodingIndex] - } - return value, nil - } - } - } - - return "", errors.New("unable to locale locale") -} diff --git a/vendor/github.com/jmshal/go-locale/detect_locale_windows.go b/vendor/github.com/jmshal/go-locale/detect_locale_windows.go deleted file mode 100644 index 849928d..0000000 --- a/vendor/github.com/jmshal/go-locale/detect_locale_windows.go +++ /dev/null @@ -1,29 +0,0 @@ -package go_locale - -import ( - "strings" - "strconv" -) - -func DetectLocale() (string, error) { - out, err := getCommandOutput("wmic", "os", "get", "locale") - if err != nil { - return "", err - } - - out = strings.Replace(out, "Locale", "", -1) - out = strings.TrimSpace(out) - - id, err := strconv.ParseInt(out, 16, 64) - if err != nil { - return "", err - } - - lcid := LCID() - locale, err := lcid.ById(int(id)) - if err != nil { - return "", err - } - - return locale, nil -} diff --git a/vendor/github.com/jmshal/go-locale/get_command_output.go b/vendor/github.com/jmshal/go-locale/get_command_output.go deleted file mode 100644 index c4013d2..0000000 --- a/vendor/github.com/jmshal/go-locale/get_command_output.go +++ /dev/null @@ -1,16 +0,0 @@ -package go_locale - -import ( - "os/exec" -) - -func getCommandOutput(name string, args ...string) (string, error) { - cmd := exec.Command(name, args...) - - out, err := cmd.Output() - if err != nil { - return "", err - } - - return string(out), nil -} diff --git a/vendor/github.com/jmshal/go-locale/lc_windows.go b/vendor/github.com/jmshal/go-locale/lc_windows.go deleted file mode 100644 index 70c6795..0000000 --- a/vendor/github.com/jmshal/go-locale/lc_windows.go +++ /dev/null @@ -1,241 +0,0 @@ -package go_locale - -import "errors" - -type LC struct { - index map[string]int -} - -var UNKNOWN_LOCALE error = errors.New("unknown locale") -var UNKNOWN_ID error = errors.New("unknown id") - -var _lc LC - -func LCID() LC { - return _lc -} - -func (lc *LC) ByLocaleString(localeString string) (int, error) { - for lcidLocaleString, lcidId := range lc.index { - if localeString == lcidLocaleString { - return lcidId, nil - } - } - return 0, UNKNOWN_LOCALE -} - -func (lc *LC) ById(id int) (string, error) { - for lcidLocaleString, lcidId := range lc.index { - if id == lcidId { - return lcidLocaleString, nil - } - } - return "", UNKNOWN_ID -} - -func init() { - // Source: https://raw.githubusercontent.com/sindresorhus/lcid/master/lcid.json - index := make(map[string]int, 201) - index["af_ZA"] = 1078 - index["am_ET"] = 1118 - index["ar_AE"] = 14337 - index["ar_BH"] = 15361 - index["ar_DZ"] = 5121 - index["ar_EG"] = 3073 - index["ar_IQ"] = 2049 - index["ar_JO"] = 11265 - index["ar_KW"] = 13313 - index["ar_LB"] = 12289 - index["ar_LY"] = 4097 - index["ar_MA"] = 6145 - index["ar_OM"] = 8193 - index["ar_QA"] = 16385 - index["ar_SA"] = 1025 - index["ar_SY"] = 10241 - index["ar_TN"] = 7169 - index["ar_YE"] = 9217 - index["arn_CL"] = 1146 - index["as_IN"] = 1101 - index["az_AZ"] = 2092 - index["ba_RU"] = 1133 - index["be_BY"] = 1059 - index["bg_BG"] = 1026 - index["bn_IN"] = 1093 - index["bo_BT"] = 2129 - index["bo_CN"] = 1105 - index["br_FR"] = 1150 - index["bs_BA"] = 8218 - index["ca_ES"] = 1027 - index["co_FR"] = 1155 - index["cs_CZ"] = 1029 - index["cy_GB"] = 1106 - index["da_DK"] = 1030 - index["de_AT"] = 3079 - index["de_CH"] = 2055 - index["de_DE"] = 1031 - index["de_LI"] = 5127 - index["de_LU"] = 4103 - index["div_MV"] = 1125 - index["dsb_DE"] = 2094 - index["el_GR"] = 1032 - index["en_AU"] = 3081 - index["en_BZ"] = 10249 - index["en_CA"] = 4105 - index["en_CB"] = 9225 - index["en_GB"] = 2057 - index["en_IE"] = 6153 - index["en_IN"] = 18441 - index["en_JA"] = 8201 - index["en_MY"] = 17417 - index["en_NZ"] = 5129 - index["en_PH"] = 13321 - index["en_TT"] = 11273 - index["en_US"] = 1033 - index["en_ZA"] = 7177 - index["en_ZW"] = 12297 - index["es_AR"] = 11274 - index["es_BO"] = 16394 - index["es_CL"] = 13322 - index["es_CO"] = 9226 - index["es_CR"] = 5130 - index["es_DO"] = 7178 - index["es_EC"] = 12298 - index["es_ES"] = 3082 - index["es_GT"] = 4106 - index["es_HN"] = 18442 - index["es_MX"] = 2058 - index["es_NI"] = 19466 - index["es_PA"] = 6154 - index["es_PE"] = 10250 - index["es_PR"] = 20490 - index["es_PY"] = 15370 - index["es_SV"] = 17418 - index["es_UR"] = 14346 - index["es_US"] = 21514 - index["es_VE"] = 8202 - index["et_EE"] = 1061 - index["eu_ES"] = 1069 - index["fa_IR"] = 1065 - index["fi_FI"] = 1035 - index["fil_PH"] = 1124 - index["fo_FO"] = 1080 - index["fr_BE"] = 2060 - index["fr_CA"] = 3084 - index["fr_CH"] = 4108 - index["fr_FR"] = 1036 - index["fr_LU"] = 5132 - index["fr_MC"] = 6156 - index["fy_NL"] = 1122 - index["ga_IE"] = 2108 - index["gbz_AF"] = 1164 - index["gl_ES"] = 1110 - index["gsw_FR"] = 1156 - index["gu_IN"] = 1095 - index["ha_NG"] = 1128 - index["he_IL"] = 1037 - index["hi_IN"] = 1081 - index["hr_BA"] = 4122 - index["hr_HR"] = 1050 - index["hu_HU"] = 1038 - index["hy_AM"] = 1067 - index["id_ID"] = 1057 - index["ii_CN"] = 1144 - index["is_IS"] = 1039 - index["it_CH"] = 2064 - index["it_IT"] = 1040 - index["iu_CA"] = 2141 - index["ja_JP"] = 1041 - index["ka_GE"] = 1079 - index["kh_KH"] = 1107 - index["kk_KZ"] = 1087 - index["kl_GL"] = 1135 - index["kn_IN"] = 1099 - index["ko_KR"] = 1042 - index["kok_IN"] = 1111 - index["ky_KG"] = 1088 - index["lb_LU"] = 1134 - index["lo_LA"] = 1108 - index["lt_LT"] = 1063 - index["lv_LV"] = 1062 - index["mi_NZ"] = 1153 - index["mk_MK"] = 1071 - index["ml_IN"] = 1100 - index["mn_CN"] = 2128 - index["mn_MN"] = 1104 - index["moh_CA"] = 1148 - index["mr_IN"] = 1102 - index["ms_BN"] = 2110 - index["ms_MY"] = 1086 - index["mt_MT"] = 1082 - index["my_MM"] = 1109 - index["nb_NO"] = 1044 - index["ne_NP"] = 1121 - index["nl_BE"] = 2067 - index["nl_NL"] = 1043 - index["nn_NO"] = 2068 - index["ns_ZA"] = 1132 - index["oc_FR"] = 1154 - index["or_IN"] = 1096 - index["pa_IN"] = 1094 - index["pl_PL"] = 1045 - index["ps_AF"] = 1123 - index["pt_BR"] = 1046 - index["pt_PT"] = 2070 - index["qut_GT"] = 1158 - index["quz_BO"] = 1131 - index["quz_EC"] = 2155 - index["quz_PE"] = 3179 - index["rm_CH"] = 1047 - index["ro_RO"] = 1048 - index["ru_RU"] = 1049 - index["rw_RW"] = 1159 - index["sa_IN"] = 1103 - index["sah_RU"] = 1157 - index["se_FI"] = 3131 - index["se_NO"] = 1083 - index["se_SE"] = 2107 - index["si_LK"] = 1115 - index["sk_SK"] = 1051 - index["sl_SI"] = 1060 - index["sma_NO"] = 6203 - index["sma_SE"] = 7227 - index["smj_NO"] = 4155 - index["smj_SE"] = 5179 - index["smn_FI"] = 9275 - index["sms_FI"] = 8251 - index["sq_AL"] = 1052 - index["sr_BA"] = 7194 - index["sr_SP"] = 3098 - index["sv_FI"] = 2077 - index["sv_SE"] = 1053 - index["sw_KE"] = 1089 - index["syr_SY"] = 1114 - index["ta_IN"] = 1097 - index["te_IN"] = 1098 - index["tg_TJ"] = 1064 - index["th_TH"] = 1054 - index["tk_TM"] = 1090 - index["tmz_DZ"] = 2143 - index["tn_ZA"] = 1074 - index["tr_TR"] = 1055 - index["tt_RU"] = 1092 - index["ug_CN"] = 1152 - index["uk_UA"] = 1058 - index["ur_IN"] = 2080 - index["ur_PK"] = 1056 - index["uz_UZ"] = 2115 - index["vi_VN"] = 1066 - index["wen_DE"] = 1070 - index["wo_SN"] = 1160 - index["xh_ZA"] = 1076 - index["yo_NG"] = 1130 - index["zh_CHS"] = 4 - index["zh_CHT"] = 31748 - index["zh_CN"] = 2052 - index["zh_HK"] = 3076 - index["zh_MO"] = 5124 - index["zh_SG"] = 4100 - index["zh_TW"] = 1028 - index["zu_ZA"] = 1077 - _lc = LC{index} -} diff --git a/vendor/github.com/jmshal/go-locale/locale_test.go b/vendor/github.com/jmshal/go-locale/locale_test.go deleted file mode 100644 index e3743b6..0000000 --- a/vendor/github.com/jmshal/go-locale/locale_test.go +++ /dev/null @@ -1,11 +0,0 @@ -package go_locale - -import "testing" - -func TestLocale(t *testing.T) { - if lc, err := DetectLocale(); err != nil { - t.Fatal(err) - } else { - t.Logf("detected locale: %q", lc) - } -} diff --git a/vendor/github.com/mitchellh/go-ps/LICENSE.md b/vendor/github.com/mitchellh/go-ps/LICENSE.md deleted file mode 100644 index 2298515..0000000 --- a/vendor/github.com/mitchellh/go-ps/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Mitchell Hashimoto - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/github.com/mitchellh/go-ps/README.md b/vendor/github.com/mitchellh/go-ps/README.md deleted file mode 100644 index 8e8baf9..0000000 --- a/vendor/github.com/mitchellh/go-ps/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# Process List Library for Go - -go-ps is a library for Go that implements OS-specific APIs to list and -manipulate processes in a platform-safe way. The library can find and -list processes on Linux, Mac OS X, Solaris, and Windows. - -If you're new to Go, this library has a good amount of advanced Go educational -value as well. It uses some advanced features of Go: build tags, accessing -DLL methods for Windows, cgo for Darwin, etc. - -How it works: - - * **Darwin** uses the `sysctl` syscall to retrieve the process table. - * **Unix** uses the procfs at `/proc` to inspect the process tree. - * **Windows** uses the Windows API, and methods such as - `CreateToolhelp32Snapshot` to get a point-in-time snapshot of - the process table. - -## Installation - -Install using standard `go get`: - -``` -$ go get github.com/mitchellh/go-ps -... -``` - -## TODO - -Want to contribute? Here is a short TODO list of things that aren't -implemented for this library that would be nice: - - * FreeBSD support - * Plan9 support diff --git a/vendor/github.com/mitchellh/go-ps/Vagrantfile b/vendor/github.com/mitchellh/go-ps/Vagrantfile deleted file mode 100644 index 61662ab..0000000 --- a/vendor/github.com/mitchellh/go-ps/Vagrantfile +++ /dev/null @@ -1,43 +0,0 @@ -# -*- mode: ruby -*-
-# vi: set ft=ruby :
-
-# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
-VAGRANTFILE_API_VERSION = "2"
-
-Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
- config.vm.box = "chef/ubuntu-12.04"
-
- config.vm.provision "shell", inline: $script
-
- ["vmware_fusion", "vmware_workstation"].each do |p|
- config.vm.provider "p" do |v|
- v.vmx["memsize"] = "1024"
- v.vmx["numvcpus"] = "2"
- v.vmx["cpuid.coresPerSocket"] = "1"
- end
- end
-end
-
-$script = <<SCRIPT
-SRCROOT="/opt/go"
-
-# Install Go
-sudo apt-get update
-sudo apt-get install -y build-essential mercurial
-sudo hg clone -u release https://code.google.com/p/go ${SRCROOT}
-cd ${SRCROOT}/src
-sudo ./all.bash
-
-# Setup the GOPATH
-sudo mkdir -p /opt/gopath
-cat <<EOF >/tmp/gopath.sh
-export GOPATH="/opt/gopath"
-export PATH="/opt/go/bin:\$GOPATH/bin:\$PATH"
-EOF
-sudo mv /tmp/gopath.sh /etc/profile.d/gopath.sh
-sudo chmod 0755 /etc/profile.d/gopath.sh
-
-# Make sure the gopath is usable by bamboo
-sudo chown -R vagrant:vagrant $SRCROOT
-sudo chown -R vagrant:vagrant /opt/gopath
-SCRIPT
diff --git a/vendor/github.com/mitchellh/go-ps/process.go b/vendor/github.com/mitchellh/go-ps/process.go deleted file mode 100644 index 2b5e8ed..0000000 --- a/vendor/github.com/mitchellh/go-ps/process.go +++ /dev/null @@ -1,40 +0,0 @@ -// ps provides an API for finding and listing processes in a platform-agnostic -// way. -// -// NOTE: If you're reading these docs online via GoDocs or some other system, -// you might only see the Unix docs. This project makes heavy use of -// platform-specific implementations. We recommend reading the source if you -// are interested. -package ps - -// Process is the generic interface that is implemented on every platform -// and provides common operations for processes. -type Process interface { - // Pid is the process ID for this process. - Pid() int - - // PPid is the parent process ID for this process. - PPid() int - - // Executable name running this process. This is not a path to the - // executable. - Executable() string -} - -// Processes returns all processes. -// -// This of course will be a point-in-time snapshot of when this method was -// called. Some operating systems don't provide snapshot capability of the -// process table, in which case the process table returned might contain -// ephemeral entities that happened to be running when this was called. -func Processes() ([]Process, error) { - return processes() -} - -// FindProcess looks up a single process by pid. -// -// Process will be nil and error will be nil if a matching process is -// not found. -func FindProcess(pid int) (Process, error) { - return findProcess(pid) -} diff --git a/vendor/github.com/mitchellh/go-ps/process_darwin.go b/vendor/github.com/mitchellh/go-ps/process_darwin.go deleted file mode 100644 index 5ee87fb..0000000 --- a/vendor/github.com/mitchellh/go-ps/process_darwin.go +++ /dev/null @@ -1,138 +0,0 @@ -// +build darwin - -package ps - -import ( - "bytes" - "encoding/binary" - "syscall" - "unsafe" -) - -type DarwinProcess struct { - pid int - ppid int - binary string -} - -func (p *DarwinProcess) Pid() int { - return p.pid -} - -func (p *DarwinProcess) PPid() int { - return p.ppid -} - -func (p *DarwinProcess) Executable() string { - return p.binary -} - -func findProcess(pid int) (Process, error) { - ps, err := processes() - if err != nil { - return nil, err - } - - for _, p := range ps { - if p.Pid() == pid { - return p, nil - } - } - - return nil, nil -} - -func processes() ([]Process, error) { - buf, err := darwinSyscall() - if err != nil { - return nil, err - } - - procs := make([]*kinfoProc, 0, 50) - k := 0 - for i := _KINFO_STRUCT_SIZE; i < buf.Len(); i += _KINFO_STRUCT_SIZE { - proc := &kinfoProc{} - err = binary.Read(bytes.NewBuffer(buf.Bytes()[k:i]), binary.LittleEndian, proc) - if err != nil { - return nil, err - } - - k = i - procs = append(procs, proc) - } - - darwinProcs := make([]Process, len(procs)) - for i, p := range procs { - darwinProcs[i] = &DarwinProcess{ - pid: int(p.Pid), - ppid: int(p.PPid), - binary: darwinCstring(p.Comm), - } - } - - return darwinProcs, nil -} - -func darwinCstring(s [16]byte) string { - i := 0 - for _, b := range s { - if b != 0 { - i++ - } else { - break - } - } - - return string(s[:i]) -} - -func darwinSyscall() (*bytes.Buffer, error) { - mib := [4]int32{_CTRL_KERN, _KERN_PROC, _KERN_PROC_ALL, 0} - size := uintptr(0) - - _, _, errno := syscall.Syscall6( - syscall.SYS___SYSCTL, - uintptr(unsafe.Pointer(&mib[0])), - 4, - 0, - uintptr(unsafe.Pointer(&size)), - 0, - 0) - - if errno != 0 { - return nil, errno - } - - bs := make([]byte, size) - _, _, errno = syscall.Syscall6( - syscall.SYS___SYSCTL, - uintptr(unsafe.Pointer(&mib[0])), - 4, - uintptr(unsafe.Pointer(&bs[0])), - uintptr(unsafe.Pointer(&size)), - 0, - 0) - - if errno != 0 { - return nil, errno - } - - return bytes.NewBuffer(bs[0:size]), nil -} - -const ( - _CTRL_KERN = 1 - _KERN_PROC = 14 - _KERN_PROC_ALL = 0 - _KINFO_STRUCT_SIZE = 648 -) - -type kinfoProc struct { - _ [40]byte - Pid int32 - _ [199]byte - Comm [16]byte - _ [301]byte - PPid int32 - _ [84]byte -} diff --git a/vendor/github.com/mitchellh/go-ps/process_darwin_test.go b/vendor/github.com/mitchellh/go-ps/process_darwin_test.go deleted file mode 100644 index ee04c5c..0000000 --- a/vendor/github.com/mitchellh/go-ps/process_darwin_test.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build darwin - -package ps - -import ( - "testing" -) - -func TestDarwinProcess_impl(t *testing.T) { - var _ Process = new(DarwinProcess) -} diff --git a/vendor/github.com/mitchellh/go-ps/process_freebsd.go b/vendor/github.com/mitchellh/go-ps/process_freebsd.go deleted file mode 100644 index 0212b66..0000000 --- a/vendor/github.com/mitchellh/go-ps/process_freebsd.go +++ /dev/null @@ -1,260 +0,0 @@ -// +build freebsd,amd64 - -package ps - -import ( - "bytes" - "encoding/binary" - "syscall" - "unsafe" -) - -// copied from sys/sysctl.h -const ( - CTL_KERN = 1 // "high kernel": proc, limits - KERN_PROC = 14 // struct: process entries - KERN_PROC_PID = 1 // by process id - KERN_PROC_PROC = 8 // only return procs - KERN_PROC_PATHNAME = 12 // path to executable -) - -// copied from sys/user.h -type Kinfo_proc struct { - Ki_structsize int32 - Ki_layout int32 - Ki_args int64 - Ki_paddr int64 - Ki_addr int64 - Ki_tracep int64 - Ki_textvp int64 - Ki_fd int64 - Ki_vmspace int64 - Ki_wchan int64 - Ki_pid int32 - Ki_ppid int32 - Ki_pgid int32 - Ki_tpgid int32 - Ki_sid int32 - Ki_tsid int32 - Ki_jobc [2]byte - Ki_spare_short1 [2]byte - Ki_tdev int32 - Ki_siglist [16]byte - Ki_sigmask [16]byte - Ki_sigignore [16]byte - Ki_sigcatch [16]byte - Ki_uid int32 - Ki_ruid int32 - Ki_svuid int32 - Ki_rgid int32 - Ki_svgid int32 - Ki_ngroups [2]byte - Ki_spare_short2 [2]byte - Ki_groups [64]byte - Ki_size int64 - Ki_rssize int64 - Ki_swrss int64 - Ki_tsize int64 - Ki_dsize int64 - Ki_ssize int64 - Ki_xstat [2]byte - Ki_acflag [2]byte - Ki_pctcpu int32 - Ki_estcpu int32 - Ki_slptime int32 - Ki_swtime int32 - Ki_cow int32 - Ki_runtime int64 - Ki_start [16]byte - Ki_childtime [16]byte - Ki_flag int64 - Ki_kiflag int64 - Ki_traceflag int32 - Ki_stat [1]byte - Ki_nice [1]byte - Ki_lock [1]byte - Ki_rqindex [1]byte - Ki_oncpu [1]byte - Ki_lastcpu [1]byte - Ki_ocomm [17]byte - Ki_wmesg [9]byte - Ki_login [18]byte - Ki_lockname [9]byte - Ki_comm [20]byte - Ki_emul [17]byte - Ki_sparestrings [68]byte - Ki_spareints [36]byte - Ki_cr_flags int32 - Ki_jid int32 - Ki_numthreads int32 - Ki_tid int32 - Ki_pri int32 - Ki_rusage [144]byte - Ki_rusage_ch [144]byte - Ki_pcb int64 - Ki_kstack int64 - Ki_udata int64 - Ki_tdaddr int64 - Ki_spareptrs [48]byte - Ki_spareint64s [96]byte - Ki_sflag int64 - Ki_tdflags int64 -} - -// UnixProcess is an implementation of Process that contains Unix-specific -// fields and information. -type UnixProcess struct { - pid int - ppid int - state rune - pgrp int - sid int - - binary string -} - -func (p *UnixProcess) Pid() int { - return p.pid -} - -func (p *UnixProcess) PPid() int { - return p.ppid -} - -func (p *UnixProcess) Executable() string { - return p.binary -} - -// Refresh reloads all the data associated with this process. -func (p *UnixProcess) Refresh() error { - - mib := []int32{CTL_KERN, KERN_PROC, KERN_PROC_PID, int32(p.pid)} - - buf, length, err := call_syscall(mib) - if err != nil { - return err - } - proc_k := Kinfo_proc{} - if length != uint64(unsafe.Sizeof(proc_k)) { - return err - } - - k, err := parse_kinfo_proc(buf) - if err != nil { - return err - } - - p.ppid, p.pgrp, p.sid, p.binary = copy_params(&k) - return nil -} - -func copy_params(k *Kinfo_proc) (int, int, int, string) { - n := -1 - for i, b := range k.Ki_comm { - if b == 0 { - break - } - n = i + 1 - } - comm := string(k.Ki_comm[:n]) - - return int(k.Ki_ppid), int(k.Ki_pgid), int(k.Ki_sid), comm -} - -func findProcess(pid int) (Process, error) { - mib := []int32{CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, int32(pid)} - - _, _, err := call_syscall(mib) - if err != nil { - return nil, err - } - - return newUnixProcess(pid) -} - -func processes() ([]Process, error) { - results := make([]Process, 0, 50) - - mib := []int32{CTL_KERN, KERN_PROC, KERN_PROC_PROC, 0} - buf, length, err := call_syscall(mib) - if err != nil { - return results, err - } - - // get kinfo_proc size - k := Kinfo_proc{} - procinfo_len := int(unsafe.Sizeof(k)) - count := int(length / uint64(procinfo_len)) - - // parse buf to procs - for i := 0; i < count; i++ { - b := buf[i*procinfo_len : i*procinfo_len+procinfo_len] - k, err := parse_kinfo_proc(b) - if err != nil { - continue - } - p, err := newUnixProcess(int(k.Ki_pid)) - if err != nil { - continue - } - p.ppid, p.pgrp, p.sid, p.binary = copy_params(&k) - - results = append(results, p) - } - - return results, nil -} - -func parse_kinfo_proc(buf []byte) (Kinfo_proc, error) { - var k Kinfo_proc - br := bytes.NewReader(buf) - err := binary.Read(br, binary.LittleEndian, &k) - if err != nil { - return k, err - } - - return k, nil -} - -func call_syscall(mib []int32) ([]byte, uint64, error) { - miblen := uint64(len(mib)) - - // get required buffer size - length := uint64(0) - _, _, err := syscall.RawSyscall6( - syscall.SYS___SYSCTL, - uintptr(unsafe.Pointer(&mib[0])), - uintptr(miblen), - 0, - uintptr(unsafe.Pointer(&length)), - 0, - 0) - if err != 0 { - b := make([]byte, 0) - return b, length, err - } - if length == 0 { - b := make([]byte, 0) - return b, length, err - } - // get proc info itself - buf := make([]byte, length) - _, _, err = syscall.RawSyscall6( - syscall.SYS___SYSCTL, - uintptr(unsafe.Pointer(&mib[0])), - uintptr(miblen), - uintptr(unsafe.Pointer(&buf[0])), - uintptr(unsafe.Pointer(&length)), - 0, - 0) - if err != 0 { - return buf, length, err - } - - return buf, length, nil -} - -func newUnixProcess(pid int) (*UnixProcess, error) { - p := &UnixProcess{pid: pid} - return p, p.Refresh() -} diff --git a/vendor/github.com/mitchellh/go-ps/process_linux.go b/vendor/github.com/mitchellh/go-ps/process_linux.go deleted file mode 100644 index c1558f7..0000000 --- a/vendor/github.com/mitchellh/go-ps/process_linux.go +++ /dev/null @@ -1,35 +0,0 @@ -// +build linux - -package ps - -import ( - "fmt" - "io/ioutil" - "strings" -) - -// Refresh reloads all the data associated with this process. -func (p *UnixProcess) Refresh() error { - statPath := fmt.Sprintf("/proc/%d/stat", p.pid) - dataBytes, err := ioutil.ReadFile(statPath) - if err != nil { - return err - } - - // First, parse out the image name - data := string(dataBytes) - binStart := strings.IndexRune(data, '(') + 1 - binEnd := strings.IndexRune(data[binStart:], ')') - p.binary = data[binStart : binStart+binEnd] - - // Move past the image name and start parsing the rest - data = data[binStart+binEnd+2:] - _, err = fmt.Sscanf(data, - "%c %d %d %d", - &p.state, - &p.ppid, - &p.pgrp, - &p.sid) - - return err -} diff --git a/vendor/github.com/mitchellh/go-ps/process_solaris.go b/vendor/github.com/mitchellh/go-ps/process_solaris.go deleted file mode 100644 index 014c416..0000000 --- a/vendor/github.com/mitchellh/go-ps/process_solaris.go +++ /dev/null @@ -1,96 +0,0 @@ -// +build solaris - -package ps - -import ( - "encoding/binary" - "fmt" - "os" -) - -type ushort_t uint16 - -type id_t int32 -type pid_t int32 -type uid_t int32 -type gid_t int32 - -type dev_t uint64 -type size_t uint64 -type uintptr_t uint64 - -type timestruc_t [16]byte - -// This is copy from /usr/include/sys/procfs.h -type psinfo_t struct { - Pr_flag int32 /* process flags (DEPRECATED; do not use) */ - Pr_nlwp int32 /* number of active lwps in the process */ - Pr_pid pid_t /* unique process id */ - Pr_ppid pid_t /* process id of parent */ - Pr_pgid pid_t /* pid of process group leader */ - Pr_sid pid_t /* session id */ - Pr_uid uid_t /* real user id */ - Pr_euid uid_t /* effective user id */ - Pr_gid gid_t /* real group id */ - Pr_egid gid_t /* effective group id */ - Pr_addr uintptr_t /* address of process */ - Pr_size size_t /* size of process image in Kbytes */ - Pr_rssize size_t /* resident set size in Kbytes */ - Pr_pad1 size_t - Pr_ttydev dev_t /* controlling tty device (or PRNODEV) */ - - // Guess this following 2 ushort_t values require a padding to properly - // align to the 64bit mark. - Pr_pctcpu ushort_t /* % of recent cpu time used by all lwps */ - Pr_pctmem ushort_t /* % of system memory used by process */ - Pr_pad64bit [4]byte - - Pr_start timestruc_t /* process start time, from the epoch */ - Pr_time timestruc_t /* usr+sys cpu time for this process */ - Pr_ctime timestruc_t /* usr+sys cpu time for reaped children */ - Pr_fname [16]byte /* name of execed file */ - Pr_psargs [80]byte /* initial characters of arg list */ - Pr_wstat int32 /* if zombie, the wait() status */ - Pr_argc int32 /* initial argument count */ - Pr_argv uintptr_t /* address of initial argument vector */ - Pr_envp uintptr_t /* address of initial environment vector */ - Pr_dmodel [1]byte /* data model of the process */ - Pr_pad2 [3]byte - Pr_taskid id_t /* task id */ - Pr_projid id_t /* project id */ - Pr_nzomb int32 /* number of zombie lwps in the process */ - Pr_poolid id_t /* pool id */ - Pr_zoneid id_t /* zone id */ - Pr_contract id_t /* process contract */ - Pr_filler int32 /* reserved for future use */ - Pr_lwp [128]byte /* information for representative lwp */ -} - -func (p *UnixProcess) Refresh() error { - var psinfo psinfo_t - - path := fmt.Sprintf("/proc/%d/psinfo", p.pid) - fh, err := os.Open(path) - if err != nil { - return err - } - defer fh.Close() - - err = binary.Read(fh, binary.LittleEndian, &psinfo) - if err != nil { - return err - } - - p.ppid = int(psinfo.Pr_ppid) - p.binary = toString(psinfo.Pr_fname[:], 16) - return nil -} - -func toString(array []byte, len int) string { - for i := 0; i < len; i++ { - if array[i] == 0 { - return string(array[:i]) - } - } - return string(array[:]) -} diff --git a/vendor/github.com/mitchellh/go-ps/process_test.go b/vendor/github.com/mitchellh/go-ps/process_test.go deleted file mode 100644 index 1bcbc32..0000000 --- a/vendor/github.com/mitchellh/go-ps/process_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package ps - -import ( - "os" - "testing" -) - -func TestFindProcess(t *testing.T) { - p, err := FindProcess(os.Getpid()) - if err != nil { - t.Fatalf("err: %s", err) - } - if p == nil { - t.Fatal("should have process") - } - - if p.Pid() != os.Getpid() { - t.Fatalf("bad: %#v", p.Pid()) - } -} - -func TestProcesses(t *testing.T) { - // This test works because there will always be SOME processes - // running. - p, err := Processes() - if err != nil { - t.Fatalf("err: %s", err) - } - - if len(p) <= 0 { - t.Fatal("should have processes") - } - - found := false - for _, p1 := range p { - if p1.Executable() == "go" || p1.Executable() == "go.exe" { - found = true - break - } - } - - if !found { - t.Fatal("should have Go") - } -} diff --git a/vendor/github.com/mitchellh/go-ps/process_unix.go b/vendor/github.com/mitchellh/go-ps/process_unix.go deleted file mode 100644 index 3b733ce..0000000 --- a/vendor/github.com/mitchellh/go-ps/process_unix.go +++ /dev/null @@ -1,101 +0,0 @@ -// +build linux solaris - -package ps - -import ( - "fmt" - "io" - "os" - "strconv" -) - -// UnixProcess is an implementation of Process that contains Unix-specific -// fields and information. -type UnixProcess struct { - pid int - ppid int - state rune - pgrp int - sid int - - binary string -} - -func (p *UnixProcess) Pid() int { - return p.pid -} - -func (p *UnixProcess) PPid() int { - return p.ppid -} - -func (p *UnixProcess) Executable() string { - return p.binary -} - -func findProcess(pid int) (Process, error) { - dir := fmt.Sprintf("/proc/%d", pid) - _, err := os.Stat(dir) - if err != nil { - if os.IsNotExist(err) { - return nil, nil - } - - return nil, err - } - - return newUnixProcess(pid) -} - -func processes() ([]Process, error) { - d, err := os.Open("/proc") - if err != nil { - return nil, err - } - defer d.Close() - - results := make([]Process, 0, 50) - for { - fis, err := d.Readdir(10) - if err == io.EOF { - break - } - if err != nil { - return nil, err - } - - for _, fi := range fis { - // We only care about directories, since all pids are dirs - if !fi.IsDir() { - continue - } - - // We only care if the name starts with a numeric - name := fi.Name() - if name[0] < '0' || name[0] > '9' { - continue - } - - // From this point forward, any errors we just ignore, because - // it might simply be that the process doesn't exist anymore. - pid, err := strconv.ParseInt(name, 10, 0) - if err != nil { - continue - } - - p, err := newUnixProcess(int(pid)) - if err != nil { - continue - } - - results = append(results, p) - } - } - - return results, nil -} - -func newUnixProcess(pid int) (*UnixProcess, error) { - p := &UnixProcess{pid: pid} - return p, p.Refresh() -} diff --git a/vendor/github.com/mitchellh/go-ps/process_unix_test.go b/vendor/github.com/mitchellh/go-ps/process_unix_test.go deleted file mode 100644 index 754073e..0000000 --- a/vendor/github.com/mitchellh/go-ps/process_unix_test.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build linux solaris - -package ps - -import ( - "testing" -) - -func TestUnixProcess_impl(t *testing.T) { - var _ Process = new(UnixProcess) -} diff --git a/vendor/github.com/mitchellh/go-ps/process_windows.go b/vendor/github.com/mitchellh/go-ps/process_windows.go deleted file mode 100644 index f151974..0000000 --- a/vendor/github.com/mitchellh/go-ps/process_windows.go +++ /dev/null @@ -1,119 +0,0 @@ -// +build windows - -package ps - -import ( - "fmt" - "syscall" - "unsafe" -) - -// Windows API functions -var ( - modKernel32 = syscall.NewLazyDLL("kernel32.dll") - procCloseHandle = modKernel32.NewProc("CloseHandle") - procCreateToolhelp32Snapshot = modKernel32.NewProc("CreateToolhelp32Snapshot") - procProcess32First = modKernel32.NewProc("Process32FirstW") - procProcess32Next = modKernel32.NewProc("Process32NextW") -) - -// Some constants from the Windows API -const ( - ERROR_NO_MORE_FILES = 0x12 - MAX_PATH = 260 -) - -// PROCESSENTRY32 is the Windows API structure that contains a process's -// information. -type PROCESSENTRY32 struct { - Size uint32 - CntUsage uint32 - ProcessID uint32 - DefaultHeapID uintptr - ModuleID uint32 - CntThreads uint32 - ParentProcessID uint32 - PriorityClassBase int32 - Flags uint32 - ExeFile [MAX_PATH]uint16 -} - -// WindowsProcess is an implementation of Process for Windows. -type WindowsProcess struct { - pid int - ppid int - exe string -} - -func (p *WindowsProcess) Pid() int { - return p.pid -} - -func (p *WindowsProcess) PPid() int { - return p.ppid -} - -func (p *WindowsProcess) Executable() string { - return p.exe -} - -func newWindowsProcess(e *PROCESSENTRY32) *WindowsProcess { - // Find when the string ends for decoding - end := 0 - for { - if e.ExeFile[end] == 0 { - break - } - end++ - } - - return &WindowsProcess{ - pid: int(e.ProcessID), - ppid: int(e.ParentProcessID), - exe: syscall.UTF16ToString(e.ExeFile[:end]), - } -} - -func findProcess(pid int) (Process, error) { - ps, err := processes() - if err != nil { - return nil, err - } - - for _, p := range ps { - if p.Pid() == pid { - return p, nil - } - } - - return nil, nil -} - -func processes() ([]Process, error) { - handle, _, _ := procCreateToolhelp32Snapshot.Call( - 0x00000002, - 0) - if handle < 0 { - return nil, syscall.GetLastError() - } - defer procCloseHandle.Call(handle) - - var entry PROCESSENTRY32 - entry.Size = uint32(unsafe.Sizeof(entry)) - ret, _, _ := procProcess32First.Call(handle, uintptr(unsafe.Pointer(&entry))) - if ret == 0 { - return nil, fmt.Errorf("Error retrieving process info.") - } - - results := make([]Process, 0, 50) - for { - results = append(results, newWindowsProcess(&entry)) - - ret, _, _ := procProcess32Next.Call(handle, uintptr(unsafe.Pointer(&entry))) - if ret == 0 { - break - } - } - - return results, nil -} diff --git a/vendor/github.com/oxtoacart/bpool/LICENSE b/vendor/github.com/oxtoacart/bpool/LICENSE deleted file mode 100644 index f94e97c..0000000 --- a/vendor/github.com/oxtoacart/bpool/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2014 Percy Wegmann - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/oxtoacart/bpool/README.md b/vendor/github.com/oxtoacart/bpool/README.md deleted file mode 100644 index 9acf3f9..0000000 --- a/vendor/github.com/oxtoacart/bpool/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# bpool [![GoDoc](https://godoc.org/github.com/oxtoacart/bpool?status.png)](https://godoc.org/github.com/oxtoacart/bpool) - -Package bpool implements leaky pools of byte arrays and Buffers as bounded channels. -It is based on the leaky buffer example from the Effective Go documentation: http://golang.org/doc/effective_go.html#leaky_buffer - -bpool provides the following pool types: - -* [bpool.BufferPool](https://godoc.org/github.com/oxtoacart/bpool#BufferPool) - which provides a fixed-size pool of - [bytes.Buffers](http://golang.org/pkg/bytes/#Buffer). -* [bpool.BytePool](https://godoc.org/github.com/oxtoacart/bpool#BytePool) which - provides a fixed-size pool of `[]byte` slices with a pre-set width (length). -* [bpool.SizedBufferPool](https://godoc.org/github.com/oxtoacart/bpool#SizedBufferPool), - which is an alternative to `bpool.BufferPool` that pre-sizes the capacity of - buffers issued from the pool and discards buffers that have grown too large - upon return. - -A common use case for this package is to use buffers to execute HTML templates -against (via ExecuteTemplate) or encode JSON into (via json.NewEncoder). This -allows you to catch any rendering or marshalling errors prior to writing to a -`http.ResponseWriter`, which helps to avoid writing incomplete or malformed data -to the response. - -## Install - -`go get github.com/oxtoacart/bpool` - -## Documentation - -See [godoc.org](http://godoc.org/github.com/oxtoacart/bpool) or use `godoc github.com/oxtoacart/bpool` - -## Example - -Here's a quick example for using `bpool.BufferPool`. We create a pool of the -desired size, call the `Get()` method to obtain a buffer for use, and call -`Put(buf)` to return the buffer to the pool. - -```go - -var bufpool *bpool.BufferPool - -func main() { - - bufpool = bpool.NewBufferPool(48) - -} - -func someFunction() error { - - // Get a buffer from the pool - buf := bufpool.Get() - ... - ... - ... - // Return the buffer to the pool - bufpool.Put(buf) - - return nil -} -``` - -## License - -Apache 2.0 Licensed. See the LICENSE file for details. - diff --git a/vendor/github.com/oxtoacart/bpool/bpool.go b/vendor/github.com/oxtoacart/bpool/bpool.go deleted file mode 100644 index 6232a38..0000000 --- a/vendor/github.com/oxtoacart/bpool/bpool.go +++ /dev/null @@ -1,6 +0,0 @@ -/* -Package bpool implements leaky pools of byte arrays and Buffers as bounded -channels. It is based on the leaky buffer example from the Effective Go -documentation: http://golang.org/doc/effective_go.html#leaky_buffer -*/ -package bpool diff --git a/vendor/github.com/oxtoacart/bpool/bufferpool.go b/vendor/github.com/oxtoacart/bpool/bufferpool.go deleted file mode 100644 index 8c8ac64..0000000 --- a/vendor/github.com/oxtoacart/bpool/bufferpool.go +++ /dev/null @@ -1,40 +0,0 @@ -package bpool - -import ( - "bytes" -) - -// BufferPool implements a pool of bytes.Buffers in the form of a bounded -// channel. -type BufferPool struct { - c chan *bytes.Buffer -} - -// NewBufferPool creates a new BufferPool bounded to the given size. -func NewBufferPool(size int) (bp *BufferPool) { - return &BufferPool{ - c: make(chan *bytes.Buffer, size), - } -} - -// Get gets a Buffer from the BufferPool, or creates a new one if none are -// available in the pool. -func (bp *BufferPool) Get() (b *bytes.Buffer) { - select { - case b = <-bp.c: - // reuse existing buffer - default: - // create new buffer - b = bytes.NewBuffer([]byte{}) - } - return -} - -// Put returns the given Buffer to the BufferPool. -func (bp *BufferPool) Put(b *bytes.Buffer) { - b.Reset() - select { - case bp.c <- b: - default: // Discard the buffer if the pool is full. - } -} diff --git a/vendor/github.com/oxtoacart/bpool/bufferpool_test.go b/vendor/github.com/oxtoacart/bpool/bufferpool_test.go deleted file mode 100644 index b344bdc..0000000 --- a/vendor/github.com/oxtoacart/bpool/bufferpool_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package bpool - -import ( - "bytes" - "testing" -) - -func TestBufferPool(t *testing.T) { - var size int = 4 - - bufPool := NewBufferPool(size) - - // Test Get/Put - b := bufPool.Get() - bufPool.Put(b) - - // Add some additional buffers beyond the pool size. - for i := 0; i < size*2; i++ { - bufPool.Put(bytes.NewBuffer([]byte{})) - } - - // Close the channel so we can iterate over it. - close(bufPool.c) - - // Check the size of the pool. - if len(bufPool.c) != size { - t.Fatalf("bufferpool size invalid: got %v want %v", len(bufPool.c), size) - } - -} diff --git a/vendor/github.com/oxtoacart/bpool/bytepool.go b/vendor/github.com/oxtoacart/bpool/bytepool.go deleted file mode 100644 index ef3898a..0000000 --- a/vendor/github.com/oxtoacart/bpool/bytepool.go +++ /dev/null @@ -1,45 +0,0 @@ -package bpool - -// BytePool implements a leaky pool of []byte in the form of a bounded -// channel. -type BytePool struct { - c chan []byte - w int -} - -// NewBytePool creates a new BytePool bounded to the given maxSize, with new -// byte arrays sized based on width. -func NewBytePool(maxSize int, width int) (bp *BytePool) { - return &BytePool{ - c: make(chan []byte, maxSize), - w: width, - } -} - -// Get gets a []byte from the BytePool, or creates a new one if none are -// available in the pool. -func (bp *BytePool) Get() (b []byte) { - select { - case b = <-bp.c: - // reuse existing buffer - default: - // create new buffer - b = make([]byte, bp.w) - } - return -} - -// Put returns the given Buffer to the BytePool. -func (bp *BytePool) Put(b []byte) { - select { - case bp.c <- b: - // buffer went back into pool - default: - // buffer didn't go back into pool, just discard - } -} - -// Width returns the width of the byte arrays in this pool. -func (bp *BytePool) Width() (n int) { - return bp.w -} diff --git a/vendor/github.com/oxtoacart/bpool/bytepool_test.go b/vendor/github.com/oxtoacart/bpool/bytepool_test.go deleted file mode 100644 index 216fd5b..0000000 --- a/vendor/github.com/oxtoacart/bpool/bytepool_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package bpool - -import "testing" - -func TestBytePool(t *testing.T) { - var size int = 4 - var width int = 10 - - bufPool := NewBytePool(size, width) - - // Check the width - if bufPool.Width() != width { - t.Fatalf("bytepool width invalid: got %v want %v", bufPool.Width(), width) - } - - // Check that retrieved buffer are of the expected width - b := bufPool.Get() - if len(b) != width { - t.Fatalf("bytepool length invalid: got %v want %v", len(b), width) - } - - bufPool.Put(b) - - // Fill the pool beyond the capped pool size. - for i := 0; i < size*2; i++ { - bufPool.Put(make([]byte, bufPool.w)) - } - - // Close the channel so we can iterate over it. - close(bufPool.c) - - // Check the size of the pool. - if len(bufPool.c) != size { - t.Fatalf("bytepool size invalid: got %v want %v", len(bufPool.c), size) - } - -} diff --git a/vendor/github.com/oxtoacart/bpool/sizedbufferpool.go b/vendor/github.com/oxtoacart/bpool/sizedbufferpool.go deleted file mode 100644 index 8519aca..0000000 --- a/vendor/github.com/oxtoacart/bpool/sizedbufferpool.go +++ /dev/null @@ -1,60 +0,0 @@ -package bpool - -import ( - "bytes" -) - -// SizedBufferPool implements a pool of bytes.Buffers in the form of a bounded -// channel. Buffers are pre-allocated to the requested size. -type SizedBufferPool struct { - c chan *bytes.Buffer - a int -} - -// SizedBufferPool creates a new BufferPool bounded to the given size. -// size defines the number of buffers to be retained in the pool and alloc sets -// the initial capacity of new buffers to minimize calls to make(). -// -// The value of alloc should seek to provide a buffer that is representative of -// most data written to the the buffer (i.e. 95th percentile) without being -// overly large (which will increase static memory consumption). You may wish to -// track the capacity of your last N buffers (i.e. using an []int) prior to -// returning them to the pool as input into calculating a suitable alloc value. -func NewSizedBufferPool(size int, alloc int) (bp *SizedBufferPool) { - return &SizedBufferPool{ - c: make(chan *bytes.Buffer, size), - a: alloc, - } -} - -// Get gets a Buffer from the SizedBufferPool, or creates a new one if none are -// available in the pool. Buffers have a pre-allocated capacity. -func (bp *SizedBufferPool) Get() (b *bytes.Buffer) { - select { - case b = <-bp.c: - // reuse existing buffer - default: - // create new buffer - b = bytes.NewBuffer(make([]byte, 0, bp.a)) - } - return -} - -// Put returns the given Buffer to the SizedBufferPool. -func (bp *SizedBufferPool) Put(b *bytes.Buffer) { - b.Reset() - - // Release buffers over our maximum capacity and re-create a pre-sized - // buffer to replace it. - // Note that the cap(b.Bytes()) provides the capacity from the read off-set - // only, but as we've called b.Reset() the full capacity of the underlying - // byte slice is returned. - if cap(b.Bytes()) > bp.a { - b = bytes.NewBuffer(make([]byte, 0, bp.a)) - } - - select { - case bp.c <- b: - default: // Discard the buffer if the pool is full. - } -} diff --git a/vendor/github.com/oxtoacart/bpool/sizedbufferpool_test.go b/vendor/github.com/oxtoacart/bpool/sizedbufferpool_test.go deleted file mode 100644 index 6e574b3..0000000 --- a/vendor/github.com/oxtoacart/bpool/sizedbufferpool_test.go +++ /dev/null @@ -1,50 +0,0 @@ -package bpool - -import ( - "bytes" - "testing" -) - -// TestSizedBufferPool checks that over-sized buffers are released and that new -// buffers are created in their place. -func TestSizedBufferPool(t *testing.T) { - - var size int = 4 - var capacity int = 1024 - - bufPool := NewSizedBufferPool(size, capacity) - - b := bufPool.Get() - - // Check the cap before we use the buffer. - if cap(b.Bytes()) != capacity { - t.Fatalf("buffer capacity incorrect: got %v want %v", cap(b.Bytes()), - capacity) - } - - // Grow the buffer beyond our capacity and return it to the pool - b.Grow(capacity * 3) - bufPool.Put(b) - - // Add some additional buffers to fill up the pool. - for i := 0; i < size; i++ { - bufPool.Put(bytes.NewBuffer(make([]byte, 0, bufPool.a*2))) - } - - // Check that oversized buffers are being replaced. - if len(bufPool.c) < size { - t.Fatalf("buffer pool too small: got %v want %v", len(bufPool.c), size) - } - - // Close the channel so we can iterate over it. - close(bufPool.c) - - // Check that there are buffers of the correct capacity in the pool. - for buffer := range bufPool.c { - if cap(buffer.Bytes()) != bufPool.a { - t.Fatalf("returned buffers wrong capacity: got %v want %v", - cap(buffer.Bytes()), capacity) - } - } - -} diff --git a/vendor/github.com/skratchdot/open-golang/LICENSE-MIT b/vendor/github.com/skratchdot/open-golang/LICENSE-MIT deleted file mode 100644 index afd04c8..0000000 --- a/vendor/github.com/skratchdot/open-golang/LICENSE-MIT +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2013 skratchdot - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/skratchdot/open-golang/open/exec.go b/vendor/github.com/skratchdot/open-golang/open/exec.go deleted file mode 100644 index 1b0e713..0000000 --- a/vendor/github.com/skratchdot/open-golang/open/exec.go +++ /dev/null @@ -1,18 +0,0 @@ -// +build !windows,!darwin - -package open - -import ( - "os/exec" -) - -// http://sources.debian.net/src/xdg-utils/1.1.0~rc1%2Bgit20111210-7.1/scripts/xdg-open/ -// http://sources.debian.net/src/xdg-utils/1.1.0~rc1%2Bgit20111210-7.1/scripts/xdg-mime/ - -func open(input string) *exec.Cmd { - return exec.Command("xdg-open", input) -} - -func openWith(input string, appName string) *exec.Cmd { - return exec.Command(appName, input) -} diff --git a/vendor/github.com/skratchdot/open-golang/open/exec_darwin.go b/vendor/github.com/skratchdot/open-golang/open/exec_darwin.go deleted file mode 100644 index 16160e6..0000000 --- a/vendor/github.com/skratchdot/open-golang/open/exec_darwin.go +++ /dev/null @@ -1,15 +0,0 @@ -// +build darwin - -package open - -import ( - "os/exec" -) - -func open(input string) *exec.Cmd { - return exec.Command("open", input) -} - -func openWith(input string, appName string) *exec.Cmd { - return exec.Command("open", "-a", appName, input) -} diff --git a/vendor/github.com/skratchdot/open-golang/open/exec_windows.go b/vendor/github.com/skratchdot/open-golang/open/exec_windows.go deleted file mode 100644 index 59f56b0..0000000 --- a/vendor/github.com/skratchdot/open-golang/open/exec_windows.go +++ /dev/null @@ -1,33 +0,0 @@ -// +build windows - -package open - -import ( - "os" - "os/exec" - "path/filepath" - "strings" - "syscall" -) - -var ( - cmd = "url.dll,FileProtocolHandler" - runDll32 = filepath.Join(os.Getenv("SYSTEMROOT"), "System32", "rundll32.exe") -) - -func cleaninput(input string) string { - r := strings.NewReplacer("&", "^&") - return r.Replace(input) -} - -func open(input string) *exec.Cmd { - cmd := exec.Command(runDll32, cmd, input) - cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true} - return cmd -} - -func openWith(input string, appName string) *exec.Cmd { - cmd := exec.Command("cmd", "/C", "start", "", appName, cleaninput(input)) - cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true} - return cmd -} diff --git a/vendor/github.com/skratchdot/open-golang/open/open.go b/vendor/github.com/skratchdot/open-golang/open/open.go deleted file mode 100644 index b1f648f..0000000 --- a/vendor/github.com/skratchdot/open-golang/open/open.go +++ /dev/null @@ -1,50 +0,0 @@ -/* - - Open a file, directory, or URI using the OS's default - application for that object type. Optionally, you can - specify an application to use. - - This is a proxy for the following commands: - - OSX: "open" - Windows: "start" - Linux/Other: "xdg-open" - - This is a golang port of the node.js module: https://github.com/pwnall/node-open - -*/ -package open - -/* - Open a file, directory, or URI using the OS's default - application for that object type. Wait for the open - command to complete. -*/ -func Run(input string) error { - return open(input).Run() -} - -/* - Open a file, directory, or URI using the OS's default - application for that object type. Don't wait for the - open command to complete. -*/ -func Start(input string) error { - return open(input).Start() -} - -/* - Open a file, directory, or URI using the specified application. - Wait for the open command to complete. -*/ -func RunWith(input string, appName string) error { - return openWith(input, appName).Run() -} - -/* - Open a file, directory, or URI using the specified application. - Don't wait for the open command to complete. -*/ -func StartWith(input string, appName string) error { - return openWith(input, appName).Start() -} diff --git a/vendor/github.com/skratchdot/open-golang/open/open_test.go b/vendor/github.com/skratchdot/open-golang/open/open_test.go deleted file mode 100644 index 5db2da2..0000000 --- a/vendor/github.com/skratchdot/open-golang/open/open_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package open - -import "testing" - -func TestRun(t *testing.T) { - // shouldn't error - input := "https://google.com/" - err := Run(input) - if err != nil { - t.Errorf("open.Run(\"%s\") threw an error: %s", input, err) - } - - // should error - input = "xxxxxxxxxxxxxxx" - err = Run(input) - if err == nil { - t.Errorf("Run(\"%s\") did not throw an error as expected", input) - } -} - -func TestStart(t *testing.T) { - // shouldn't error - input := "https://google.com/" - err := Start(input) - if err != nil { - t.Errorf("open.Start(\"%s\") threw an error: %s", input, err) - } - - // shouldn't error - input = "xxxxxxxxxxxxxxx" - err = Start(input) - if err != nil { - t.Errorf("open.Start(\"%s\") shouldn't even fail on invalid input: %s", input, err) - } -} - -func TestRunWith(t *testing.T) { - // shouldn't error - input := "https://google.com/" - app := "firefox" - err := RunWith(input, app) - if err != nil { - t.Errorf("open.RunWith(\"%s\", \"%s\") threw an error: %s", input, app, err) - } - - // should error - app = "xxxxxxxxxxxxxxx" - err = RunWith(input, app) - if err == nil { - t.Errorf("RunWith(\"%s\", \"%s\") did not throw an error as expected", input, app) - } -} - -func TestStartWith(t *testing.T) { - // shouldn't error - input := "https://google.com/" - app := "firefox" - err := StartWith(input, app) - if err != nil { - t.Errorf("open.StartWith(\"%s\", \"%s\") threw an error: %s", input, app, err) - } - - // shouldn't error - input = "[<Invalid URL>]" - err = StartWith(input, app) - if err != nil { - t.Errorf("StartWith(\"%s\", \"%s\") shouldn't even fail on invalid input: %s", input, app, err) - } - -} diff --git a/vendor/vendor.json b/vendor/vendor.json deleted file mode 100644 index d37f69a..0000000 --- a/vendor/vendor.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "comment": "", - "ignore": "", - "package": [ - { - "checksumSHA1": "PglfTtAWpAry6yClb3giq+5chRQ=", - "path": "0xacab.org/leap/go-dialog", - "revision": "0ee8438431a0dca8f25ea788d74bfe7e88078b7a", - "revisionTime": "2018-11-23T04:28:29Z" - }, - { - "checksumSHA1": "tWy7LlSsKWZBESlqJ2pMzi6mDEE=", - "path": "github.com/AllenDang/w32", - "revision": "ad0a36d80adcd081d5c0dded8e97a009b486d1db", - "revisionTime": "2018-04-28T13:02:37Z" - }, - { - "checksumSHA1": "bn7yp2v6nob5/237qF1wXtgKPuU=", - "path": "github.com/ProtonMail/go-autostart", - "revision": "c5272053443a332e50aa4e949551f0fa219b2655", - "revisionTime": "2018-11-14T17:56:02Z" - }, - { - "checksumSHA1": "5fGvCnxQYiQdeifuHDON4xZ8uZc=", - "path": "github.com/apparentlymart/go-openvpn-mgmt/demux", - "revision": "9a305aecd7f2941d9686aef38d0f649dc2189483", - "revisionTime": "2016-10-09T01:09:51Z" - }, - { - "checksumSHA1": "mWxCr1CNYWdbAfj2luw2Dk08n4Q=", - "path": "github.com/apparentlymart/go-openvpn-mgmt/openvpn", - "revision": "9a305aecd7f2941d9686aef38d0f649dc2189483", - "revisionTime": "2016-10-09T01:09:51Z" - }, - { - "checksumSHA1": "aifsvMhKr27PzvL11QUJg3FOrik=", - "path": "github.com/getlantern/context", - "revision": "c447772a6520c1a3ae6294a7df725ee08230f14e", - "revisionTime": "2019-01-09T18:39:33Z" - }, - { - "checksumSHA1": "lhPvTX/l8tHzGU/Rb8vx60AU8gE=", - "path": "github.com/getlantern/errors", - "revision": "e24b7f4ff7c70be59bbefca6b7695d68cda8b399", - "revisionTime": "2018-08-29T14:28:10Z" - }, - { - "checksumSHA1": "8VIFXyoyRUyoEC3b9b6Jug28MXg=", - "path": "github.com/getlantern/golog", - "revision": "cca714f7feb5df8e455f409b549d384441ac4578", - "revisionTime": "2017-05-08T21:41:12Z" - }, - { - "checksumSHA1": "m9pSLobd5Twnq5M/TjDEhohwgDU=", - "path": "github.com/getlantern/hex", - "revision": "083fba3033ad473db3dd31c9bb368473d37581a7", - "revisionTime": "2016-05-23T04:38:25Z" - }, - { - "checksumSHA1": "SoE7GpVeu5zDKyqYCoIrM4o09Vk=", - "path": "github.com/getlantern/hidden", - "revision": "d52a649ab33af200943bb599898dbdcfdbc94cb7", - "revisionTime": "2016-05-23T04:38:07Z" - }, - { - "checksumSHA1": "lvaWyxszbU5/uiTcTCXYugrbO+Y=", - "path": "github.com/getlantern/ops", - "revision": "37353306c90844c8e0591956f56611f46299d202", - "revisionTime": "2017-09-04T18:22:30Z" - }, - { - "path": "github.com/getlantern/systray", - "revision": "" - }, - { - "checksumSHA1": "zELlitdI3OUGxjbFS1sCI/KqPDA=", - "path": "github.com/go-stack/stack", - "revision": "2fee6af1a9795aafbe0253a0cfbdf668e1fb8a9a", - "revisionTime": "2018-08-26T13:48:48Z" - }, - { - "checksumSHA1": "59czwfxTp/og6IEj6Rg92nI9Vwo=", - "path": "github.com/gotk3/gotk3/cairo", - "revision": "d09d58ef3476938a38485424f4453358d212d8f3", - "revisionTime": "2019-01-08T05:27:11Z" - }, - { - "checksumSHA1": "tzu8s8afau05E5ky0A1hQsetQi4=", - "path": "github.com/gotk3/gotk3/gdk", - "revision": "d09d58ef3476938a38485424f4453358d212d8f3", - "revisionTime": "2019-01-08T05:27:11Z" - }, - { - "checksumSHA1": "FB0fz10h8bo9A7gfAdn+ZYBZE2w=", - "path": "github.com/gotk3/gotk3/glib", - "revision": "d09d58ef3476938a38485424f4453358d212d8f3", - "revisionTime": "2019-01-08T05:27:11Z" - }, - { - "checksumSHA1": "4uNQjSytNHV1myFwyBwXV2YcfH0=", - "path": "github.com/gotk3/gotk3/gtk", - "revision": "d09d58ef3476938a38485424f4453358d212d8f3", - "revisionTime": "2019-01-08T05:27:11Z" - }, - { - "checksumSHA1": "Qj0azcgxwHQi439grMfQkR5Rmys=", - "path": "github.com/gotk3/gotk3/pango", - "revision": "d09d58ef3476938a38485424f4453358d212d8f3", - "revisionTime": "2019-01-08T05:27:11Z" - }, - { - "checksumSHA1": "NpmW2isqaJPfftFk6etVRirMeDQ=", - "path": "github.com/jmshal/go-locale", - "revision": "4f541412d67a15c4c1f0ca0866f3234ffed222dd", - "revisionTime": "2016-11-07T08:20:30Z" - }, - { - "checksumSHA1": "HHmofvwECyD7cZ5XKt+GRnzmpmY=", - "path": "github.com/mitchellh/go-ps", - "revision": "4fdf99ab29366514c69ccccddab5dc58b8d84062", - "revisionTime": "2017-03-09T13:30:38Z" - }, - { - "checksumSHA1": "jmUuVnwq7lDv+AdQ/SBAArzU2js=", - "path": "github.com/oxtoacart/bpool", - "revision": "4e1c5567d7c2dd59fa4c7c83d34c2f3528b025d6", - "revisionTime": "2015-07-12T13:31:11Z" - }, - { - "checksumSHA1": "3o5h8EpU/eP5ccHMu4zoBusTGW0=", - "path": "github.com/skratchdot/open-golang/open", - "revision": "a2dfa6d0dab6634ecf39251031a3d52db73b5c7e", - "revisionTime": "2019-01-04T02:26:28Z" - } - ], - "rootPath": "0xacab.org/leap/bitmask-vpn" -} |