go.wde: github.com/skelterjohn/go.wde Index | Files | Directories

package wde

import "github.com/skelterjohn/go.wde"

Index

Package Files

cursor.go events.go keys.go wde.go

Constants

const (
    KeyFunction     = "function"
    KeyLeftSuper    = "left_super"
    KeyRightSuper   = "right_super"
    KeyLeftAlt      = "left_alt"
    KeyRightAlt     = "right_alt"
    KeyLeftControl  = "left_control"
    KeyRightControl = "right_control"
    KeyLeftShift    = "left_shift"
    KeyRightShift   = "right_shift"
    KeyUpArrow      = "up_arrow"
    KeyDownArrow    = "down_arrow"
    KeyLeftArrow    = "left_arrow"
    KeyRightArrow   = "right_arrow"
    KeyInsert       = "insert"
    KeyTab          = "tab"
    KeySpace        = "space"
    KeyA            = "a"
    KeyB            = "b"
    KeyC            = "c"
    KeyD            = "d"
    KeyE            = "e"
    KeyF            = "f"
    KeyG            = "g"
    KeyH            = "h"
    KeyI            = "i"
    KeyJ            = "j"
    KeyK            = "k"
    KeyL            = "l"
    KeyM            = "m"
    KeyN            = "n"
    KeyO            = "o"
    KeyP            = "p"
    KeyQ            = "q"
    KeyR            = "r"
    KeyS            = "s"
    KeyT            = "t"
    KeyU            = "u"
    KeyV            = "v"
    KeyW            = "w"
    KeyX            = "x"
    KeyY            = "y"
    KeyZ            = "z"
    Key1            = "1"
    Key2            = "2"
    Key3            = "3"
    Key4            = "4"
    Key5            = "5"
    Key6            = "6"
    Key7            = "7"
    Key8            = "8"
    Key9            = "9"
    Key0            = "0"
    KeyPadEnd       = "kp_end"
    KeyPadDown      = "kp_down"
    KeyPadNext      = "kp_next"
    KeyPadLeft      = "kp_left"
    KeyPadBegin     = "kp_begin"
    KeyPadRight     = "kp_right"
    KeyPadHome      = "kp_home"
    KeyPadUp        = "kp_up"
    KeyPadPrior     = "kp_prior"
    KeyPadInsert    = "kp_insert"
    KeyPadSlash     = "kp_slash"
    KeyPadStar      = "kp_star"
    KeyPadMinus     = "kp_minus"
    KeyPadPlus      = "kp_plus"
    KeyPadDot       = "kp_dot"
    KeyPadEqual     = "kp_equal"
    KeyPadEnter     = "kp_enter"
    KeyBackTick     = "`"
    KeyF1           = "f1"
    KeyF2           = "f2"
    KeyF3           = "f3"
    KeyF4           = "f4"
    KeyF5           = "f5"
    KeyF6           = "f6"
    KeyF7           = "f7"
    KeyF8           = "f8"
    KeyF9           = "f9"
    KeyF10          = "f10"
    KeyF11          = "f11"
    KeyF12          = "f12"
    KeyF13          = "f13"
    KeyF14          = "f14"
    KeyF15          = "f15"
    KeyF16          = "f16"
    KeyMinus        = "-"
    KeyEqual        = "="
    KeyLeftBracket  = "["
    KeyRightBracket = "]"
    KeyBackslash    = `\`
    KeySemicolon    = ";"
    KeyQuote        = "'"
    KeyComma        = ","
    KeyPeriod       = "."
    KeySlash        = "/"
    KeyReturn       = "return"
    KeyEscape       = "escape"
    KeyNumlock      = "numlock"
    KeyDelete       = "delete"
    KeyBackspace    = "backspace"
    KeyHome         = "home"
    KeyEnd          = "end"
    KeyPrior        = "prior"
    KeyNext         = "next"
    KeyCapsLock     = "caps"
)

Variables

var BackendNewWindow = func(width, height int) (Window, error) {
    panic("no wde backend imported")
}
var BackendRun = func() {
    panic("no wde backend imported")
}
var BackendStop = func() {
    panic("no wde backend imported")
}

func ConstructChord Uses

func ConstructChord(keys map[string]bool) (chord string)

func Run Uses

func Run()

Some wde backends (cocoa) require that this function be called in the main thread. To make your code as cross-platform as possible, it is recommended that your main function look like the the code below.

func main() {
	go theRestOfYourProgram()
	wde.Run()
}

wde.Run() will return when wde.Stop() is called.

For this to work, you must import one of the go.wde backends. For instance,

import _ "github.com/skelterjohn/go.wde/xgb"

or

import _ "github.com/skelterjohn/go.wde/win"

or

import _ "github.com/skelterjohn/go.wde/cocoa"

will register a backend with go.wde, allowing you to call wde.Run(), wde.Stop() and wde.NewWindow() without referring to the backend explicitly.

If you pupt the registration import in a separate file filtered for the correct platform, your project will work on all three major platforms without configuration.

That is, if you import go.wde/xgb in a file named "wde_linux.go", go.wde/win in a file named "wde_windows.go" and go.wde/cocoa in a file named "wde_darwin.go", the go tool will import the correct one.

func Stop Uses

func Stop()

Call this when you want wde.Run() to return. Usually to allow your program to exit gracefully.

type Button Uses

type Button int
const (
    LeftButton Button = 1 << iota
    MiddleButton
    RightButton
    WheelUpButton
    WheelDownButton
    WheelLeftButton  // only supported by xgb/win backends atm
    WheelRightButton // only supported by xgb/win backends atm
)

type ChordSorter Uses

type ChordSorter []string

func (ChordSorter) Len Uses

func (c ChordSorter) Len() int

func (ChordSorter) Less Uses

func (c ChordSorter) Less(i, j int) (less bool)

func (ChordSorter) Swap Uses

func (c ChordSorter) Swap(i, j int)

type CloseEvent Uses

type CloseEvent struct{}

CloseEvent is for when the window is closed.

type Cursor Uses

type Cursor int
const (
    NoneCursor Cursor = iota
    NormalCursor
    ResizeNCursor
    ResizeECursor
    ResizeSCursor
    ResizeWCursor
    ResizeEWCursor
    ResizeNSCursor
    ResizeNECursor
    ResizeSECursor
    ResizeSWCursor
    ResizeNWCursor
    CrosshairCursor
    IBeamCursor
    GrabHoverCursor
    GrabActiveCursor
    NotAllowedCursor
)

type CursorCtl Uses

type CursorCtl interface {
    Set(id Cursor)
    Hide()
    Show()
}

type Event Uses

type Event int

type Image Uses

type Image interface {
    draw.Image
    // CopyRGBA() copies the source image to this image, translating
    // the source image to the provided bounds.
    CopyRGBA(src *image.RGBA, bounds image.Rectangle)
}

type KeyDownEvent Uses

type KeyDownEvent KeyEvent

KeyDownEvent is for when a key is pressed.

type KeyEvent Uses

type KeyEvent struct {
    Key string
}

KeyEvent is used for data common to all key events, and should not appear as an event received by the caller program.

type KeyTypedEvent Uses

type KeyTypedEvent struct {
    KeyEvent
    /*
    	The glyph is the string corresponding to what the user wants to have typed in
    	whatever data entry is active.
    */
    Glyph string
    /*
    	The "+" joined set of keys (not glyphs) participating in the chord completed
    	by this key event. The keys will be in a consistent order, no matter what
    	order they are pressed in.
    */
    Chord string
}

KeyTypedEvent is for when a key is typed.

type KeyUpEvent Uses

type KeyUpEvent KeyEvent

KeyUpEvent is for when a key is unpressed.

type MagnifyEvent Uses

type MagnifyEvent struct {
    Event
    Where         image.Point
    Magnification float64 // the multiplicative scale factor
}

MagnifyEvent is used to represent a magnification gesture.

type MouseButtonEvent Uses

type MouseButtonEvent struct {
    MouseEvent
    Which Button
}

MouseButtonEvent is used for data common to all mouse button events, and should not appear as an event received by the caller program.

type MouseDownEvent Uses

type MouseDownEvent MouseButtonEvent

MouseDownEvent is for when the mouse is clicked within the window.

type MouseDraggedEvent Uses

type MouseDraggedEvent struct {
    MouseMovedEvent
    Which Button
}

MouseDraggedEvent is for when the mouse is moved while a button is pressed.

type MouseEnteredEvent Uses

type MouseEnteredEvent MouseMovedEvent

MouseEnteredEvent is for when the mouse enters a window.

type MouseEvent Uses

type MouseEvent struct {
    Event
    Where image.Point
}

MouseEvent is used for data common to all mouse events, and should not appear as an event received by the caller program.

type MouseExitedEvent Uses

type MouseExitedEvent MouseMovedEvent

MouseExitedEvent is for when the mouse exits a window.

type MouseMovedEvent Uses

type MouseMovedEvent struct {
    MouseEvent
    From image.Point
}

MouseMovedEvent is for when the mouse moves within the window.

type MouseUpEvent Uses

type MouseUpEvent MouseButtonEvent

MouseUpEvent is for when the mouse is unclicked within the window.

type ResizeEvent Uses

type ResizeEvent struct {
    Width, Height int
}

ResizeEvent is for when the window changes size.

type RotateEvent Uses

type RotateEvent struct {
    Event
    Where    image.Point
    Rotation float64 // measured in degrees; positive == clockwise
}

RotateEvent is used to represent a rotation gesture.

type ScrollEvent Uses

type ScrollEvent struct {
    Event
    Where image.Point
    Delta image.Point
}

Scroll Event is used to represent a scrolling gesture.

type Window Uses

type Window interface {
    SetTitle(title string)
    SetSize(width, height int)
    Size() (width, height int)
    LockSize(lock bool)
    Show()
    Screen() (im Image)
    FlushImage(bounds ...image.Rectangle)
    EventChan() (events <-chan interface{})
    Close() (err error)
    SetCursor(cursor Cursor)
}

func NewWindow Uses

func NewWindow(width, height int) (Window, error)

Create a new window with the specified width and height.

Directories

PathSynopsis
cocoa
glfw3
glfw3/tests
init
wdetest
win
xgb

Package wde imports 4 packages (graph) and is imported by 172 packages. Updated 2019-03-19. Refresh now. Tools for package owners.