diff --git a/README.md b/README.md index d75db64..77ce3cf 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Best way to learn how to use the library is to look at the included **examples** 1. Make sure you have a working Go installation and build environment, see more for details on page below. http://golang.org/doc/install -2. go get github.com/tadvi/winc +2. go get github.com/neurlang/winc ## Icons @@ -94,7 +94,7 @@ Dialog screens are not based on Windows resource files (.rc). They are just wind package main import ( - "github.com/tadvi/winc" + "github.com/neurlang/winc" ) func main() { @@ -146,7 +146,7 @@ This is usually due to string UTF8 and UTF16 conversions. But there are other ty When developing your own controls you might also need to: - import "github.com/tadvi/winc/w32" + import "github.com/neurlang/winc/w32" w32 has Win32 API low level constants and functions. @@ -154,7 +154,7 @@ Look at **sample_control** for example of custom built window. ## Companion Package -[Go package for Windows Systray icon, menu and notifications](https://github.com/tadvi/systray) +[Go package for Windows Systray icon, menu and notifications](https://github.com/neurlang/systray) ## Credits diff --git a/app.go b/app.go index 67bd2d9..3b0f313 100644 --- a/app.go +++ b/app.go @@ -9,7 +9,7 @@ import ( "runtime" "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) var ( diff --git a/bitmap.go b/bitmap.go index aa4f811..58d1f01 100644 --- a/bitmap.go +++ b/bitmap.go @@ -9,7 +9,7 @@ import ( "errors" "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type Bitmap struct { diff --git a/brush.go b/brush.go index e0806f1..fc95ff0 100644 --- a/brush.go +++ b/brush.go @@ -6,7 +6,7 @@ package winc import ( - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) var DefaultBackgroundBrush = NewSystemColorBrush(w32.COLOR_BTNFACE) diff --git a/buttons.go b/buttons.go index 0997024..68dce64 100644 --- a/buttons.go +++ b/buttons.go @@ -8,7 +8,7 @@ package winc import ( "fmt" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type Button struct { diff --git a/canvas.go b/canvas.go index f2bc801..a22d7d6 100644 --- a/canvas.go +++ b/canvas.go @@ -8,7 +8,7 @@ package winc import ( "fmt" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type Canvas struct { diff --git a/combobox.go b/combobox.go index b6fd811..ec11a72 100644 --- a/combobox.go +++ b/combobox.go @@ -8,7 +8,7 @@ import ( "syscall" "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type ComboBox struct { diff --git a/commondlgs.go b/commondlgs.go index 345add6..88572ea 100644 --- a/commondlgs.go +++ b/commondlgs.go @@ -10,7 +10,7 @@ import ( "syscall" "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) func genOFN(parent Controller, title, filter string, filterIndex uint, initialDir string, buf []uint16) *w32.OPENFILENAME { diff --git a/controlbase.go b/controlbase.go index 523b92c..edea98e 100644 --- a/controlbase.go +++ b/controlbase.go @@ -10,7 +10,7 @@ import ( "syscall" "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type ControlBase struct { diff --git a/controller.go b/controller.go index 8efba23..5af9c18 100644 --- a/controller.go +++ b/controller.go @@ -6,7 +6,7 @@ package winc import ( - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type Controller interface { diff --git a/dialog.go b/dialog.go index a200d05..b7633ef 100644 --- a/dialog.go +++ b/dialog.go @@ -5,7 +5,7 @@ package winc -import "github.com/tadvi/winc/w32" +import "github.com/neurlang/winc/w32" // Dialog displayed as z-order top window until closed. // It also disables parent window so it can not be clicked. diff --git a/edit.go b/edit.go index cd342ca..0db5892 100644 --- a/edit.go +++ b/edit.go @@ -5,7 +5,7 @@ package winc -import "github.com/tadvi/winc/w32" +import "github.com/neurlang/winc/w32" type Edit struct { ControlBase diff --git a/eventdata.go b/eventdata.go index 85da0ad..429e267 100644 --- a/eventdata.go +++ b/eventdata.go @@ -6,7 +6,7 @@ package winc import ( - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type RawMsg struct { @@ -43,6 +43,9 @@ type LabelEditEventData struct { type KeyUpEventData struct { VKey, Code int } +type KeyDownEventData struct { + VKey, Code int +} type SizeEventData struct { Type uint diff --git a/examples/sample_contextmenu/main.go b/examples/sample_contextmenu/main.go index 6ef0db7..0efc07e 100644 --- a/examples/sample_contextmenu/main.go +++ b/examples/sample_contextmenu/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/tadvi/winc" + "github.com/neurlang/winc" ) func btnOnClick(arg *winc.Event) { diff --git a/examples/sample_control/main.go b/examples/sample_control/main.go index 2449e8c..ad5daac 100644 --- a/examples/sample_control/main.go +++ b/examples/sample_control/main.go @@ -1,7 +1,7 @@ package main import ( - "github.com/tadvi/winc" + "github.com/neurlang/winc" ) func main() { diff --git a/examples/sample_control/topform.go b/examples/sample_control/topform.go index 46cebbb..8a8ae59 100644 --- a/examples/sample_control/topform.go +++ b/examples/sample_control/topform.go @@ -1,8 +1,8 @@ package main import ( - "github.com/tadvi/winc" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc" + "github.com/neurlang/winc/w32" ) // TopForm displayed as topmost window until closed. diff --git a/examples/sample_docking/main.go b/examples/sample_docking/main.go index 6d24136..c9d367c 100644 --- a/examples/sample_docking/main.go +++ b/examples/sample_docking/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/tadvi/winc" + "github.com/neurlang/winc" ) func btnOnClick(arg *winc.Event) { diff --git a/examples/sample_hello/main.go b/examples/sample_hello/main.go index 90345d1..17eb5ea 100644 --- a/examples/sample_hello/main.go +++ b/examples/sample_hello/main.go @@ -1,7 +1,7 @@ package main import ( - "github.com/tadvi/winc" + "github.com/neurlang/winc" ) func main() { diff --git a/examples/sample_image/main.go b/examples/sample_image/main.go index 7201c0f..bac4007 100644 --- a/examples/sample_image/main.go +++ b/examples/sample_image/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/tadvi/winc" + "github.com/neurlang/winc" ) func btnOnClick(arg *winc.Event) { diff --git a/examples/sample_imagebox/main.go b/examples/sample_imagebox/main.go index 4eb962b..6bf74ba 100644 --- a/examples/sample_imagebox/main.go +++ b/examples/sample_imagebox/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/tadvi/winc" + "github.com/neurlang/winc" ) func btnOnClick(arg *winc.Event) { diff --git a/examples/sample_listview/main.go b/examples/sample_listview/main.go index 0357c34..888aba8 100644 --- a/examples/sample_listview/main.go +++ b/examples/sample_listview/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/tadvi/winc" + "github.com/neurlang/winc" ) func btnOnClick(arg *winc.Event) { diff --git a/examples/sample_minimal/main.go b/examples/sample_minimal/main.go index 5c35151..aea0d5b 100644 --- a/examples/sample_minimal/main.go +++ b/examples/sample_minimal/main.go @@ -1,7 +1,7 @@ package main import ( - "github.com/tadvi/winc" + "github.com/neurlang/winc" ) func main() { diff --git a/examples/sample_scrollview/main.go b/examples/sample_scrollview/main.go index 73fbbfc..4bcd036 100644 --- a/examples/sample_scrollview/main.go +++ b/examples/sample_scrollview/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/tadvi/winc" + "github.com/neurlang/winc" ) func btnOnClick(arg *winc.Event) { diff --git a/examples/sample_slider/main.go b/examples/sample_slider/main.go index 96e0feb..de79a78 100644 --- a/examples/sample_slider/main.go +++ b/examples/sample_slider/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/tadvi/winc" + "github.com/neurlang/winc" ) func btnOnClick(arg *winc.Event) { diff --git a/examples/sample_splitview/main.go b/examples/sample_splitview/main.go index f49874d..55d0e85 100644 --- a/examples/sample_splitview/main.go +++ b/examples/sample_splitview/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/tadvi/winc" + "github.com/neurlang/winc" ) func btnOnClick(arg *winc.Event) { diff --git a/examples/sample_tab/main.go b/examples/sample_tab/main.go index f66ff55..f53c87c 100644 --- a/examples/sample_tab/main.go +++ b/examples/sample_tab/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/tadvi/winc" + "github.com/neurlang/winc" ) func btnOnClick(arg *winc.Event) { diff --git a/examples/sample_treeview/main.go b/examples/sample_treeview/main.go index faf9354..306b9f1 100644 --- a/examples/sample_treeview/main.go +++ b/examples/sample_treeview/main.go @@ -3,7 +3,7 @@ package main import ( "fmt" - "github.com/tadvi/winc" + "github.com/neurlang/winc" ) func btnOnClick(arg *winc.Event) { diff --git a/font.go b/font.go index fadd150..d8c00bd 100644 --- a/font.go +++ b/font.go @@ -8,7 +8,7 @@ package winc import ( "syscall" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) const ( diff --git a/form.go b/form.go index 53cc6e2..3045f3e 100644 --- a/form.go +++ b/form.go @@ -6,7 +6,7 @@ package winc import ( - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" "unsafe" ) @@ -24,6 +24,7 @@ type Form struct { isFullscreen bool previousWindowStyle uint32 previousWindowPlacement w32.WINDOWPLACEMENT + onKeyDown EventManager } func NewCustomForm(parent Controller, exStyle int, dwStyle uint) *Form { @@ -238,8 +239,13 @@ func (fm *Form) WndProc(msg uint32, wparam, lparam uintptr) uintptr { } } case w32.WM_KEYDOWN: - // Accelerator support. + + // key down support. key := Key(wparam) + code := uint32(lparam) + fm.onKeyDown.Fire(NewEvent(fm, &KeyDownEventData{VKey: int(key), Code: int(code)})) + + // Accelerator support. if uint32(lparam)>>30 == 0 { // Using TranslateAccelerators refused to work, so we handle them // ourselves, at least for now. @@ -285,3 +291,7 @@ func (fm *Form) WndProc(msg uint32, wparam, lparam uintptr) uintptr { return w32.DefWindowProc(fm.hwnd, msg, wparam, lparam) } + +func (fm *Form) OnKeyDown() *EventManager { + return &fm.onKeyDown +} diff --git a/globalvars.go b/globalvars.go index a2f9001..90c411c 100644 --- a/globalvars.go +++ b/globalvars.go @@ -8,7 +8,7 @@ package winc import ( "syscall" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) //Private global variables. diff --git a/go.mod b/go.mod index cf59de1..50d185f 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/tadvi/winc +module github.com/neurlang/winc go 1.12 diff --git a/icon.go b/icon.go index c8390b2..c8529de 100644 --- a/icon.go +++ b/icon.go @@ -10,7 +10,7 @@ import ( "fmt" "syscall" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type Icon struct { diff --git a/imagelist.go b/imagelist.go index 66a7bb4..3e3cc65 100644 --- a/imagelist.go +++ b/imagelist.go @@ -8,7 +8,7 @@ package winc import ( "fmt" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type ImageList struct { diff --git a/imageview.go b/imageview.go index 4ac07b5..6b439df 100644 --- a/imageview.go +++ b/imageview.go @@ -4,7 +4,7 @@ package winc -import "github.com/tadvi/winc/w32" +import "github.com/neurlang/winc/w32" type ImageView struct { ControlBase diff --git a/imageviewbox.go b/imageviewbox.go index 0f2af7d..9187f13 100644 --- a/imageviewbox.go +++ b/imageviewbox.go @@ -8,7 +8,7 @@ import ( "fmt" "time" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type direction int diff --git a/init.go b/init.go index 33e8eea..e802693 100644 --- a/init.go +++ b/init.go @@ -6,7 +6,7 @@ package winc import ( - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) func init() { diff --git a/keyboard.go b/keyboard.go index ec70c18..77d4401 100644 --- a/keyboard.go +++ b/keyboard.go @@ -8,7 +8,7 @@ package winc import ( "bytes" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type Key uint16 diff --git a/label.go b/label.go index 1278fbf..7f30480 100644 --- a/label.go +++ b/label.go @@ -5,7 +5,7 @@ package winc import ( - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type Label struct { diff --git a/layout.go b/layout.go index f5963e0..ab6e33b 100644 --- a/layout.go +++ b/layout.go @@ -12,7 +12,7 @@ import ( "sort" "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) // Dockable component must satisfy interface to be docked. diff --git a/listview.go b/listview.go index 27c52cb..a192baf 100644 --- a/listview.go +++ b/listview.go @@ -10,7 +10,7 @@ import ( "syscall" "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) // ListItem represents an item in a ListView widget. diff --git a/menu.go b/menu.go index b24871b..30f9fc1 100644 --- a/menu.go +++ b/menu.go @@ -9,7 +9,7 @@ import ( "syscall" "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) var ( diff --git a/mousecontrol.go b/mousecontrol.go index ba0505a..711f5b5 100644 --- a/mousecontrol.go +++ b/mousecontrol.go @@ -5,7 +5,7 @@ package winc import ( - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) // MouseControl used for creating custom controls that need mouse hover or mouse leave events. diff --git a/msghandlerregistry.go b/msghandlerregistry.go index 98690ff..3ba3981 100644 --- a/msghandlerregistry.go +++ b/msghandlerregistry.go @@ -6,7 +6,7 @@ package winc import ( - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) func RegMsgHandler(controller Controller) { diff --git a/panel.go b/panel.go index 81a9fe9..d74d784 100644 --- a/panel.go +++ b/panel.go @@ -7,7 +7,7 @@ package winc import ( "fmt" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type Panel struct { diff --git a/path.go b/path.go index 269908c..14391a4 100644 --- a/path.go +++ b/path.go @@ -11,7 +11,7 @@ import ( "path/filepath" "syscall" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) func knownFolderPath(id w32.CSIDL) (string, error) { diff --git a/pen.go b/pen.go index 82e2e95..7bcdd98 100644 --- a/pen.go +++ b/pen.go @@ -6,7 +6,7 @@ package winc import ( - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type Pen struct { diff --git a/progressbar.go b/progressbar.go index ca19bd2..a240955 100644 --- a/progressbar.go +++ b/progressbar.go @@ -5,7 +5,7 @@ package winc import ( - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type ProgressBar struct { diff --git a/rect.go b/rect.go index c56cb3e..9c0fc7e 100644 --- a/rect.go +++ b/rect.go @@ -6,7 +6,7 @@ package winc import ( - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type Rect struct { diff --git a/resizer.go b/resizer.go index 97935f8..a078a6a 100644 --- a/resizer.go +++ b/resizer.go @@ -5,7 +5,7 @@ package winc import ( - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type VResizer struct { diff --git a/scrollview.go b/scrollview.go index c39599b..2ab025c 100644 --- a/scrollview.go +++ b/scrollview.go @@ -7,7 +7,7 @@ package winc import ( "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type ScrollView struct { diff --git a/slider.go b/slider.go index 3b5fed6..cac8b7e 100644 --- a/slider.go +++ b/slider.go @@ -4,7 +4,7 @@ package winc -import "github.com/tadvi/winc/w32" +import "github.com/neurlang/winc/w32" type Slider struct { ControlBase diff --git a/tabview.go b/tabview.go index ebc1497..413522d 100644 --- a/tabview.go +++ b/tabview.go @@ -8,7 +8,7 @@ import ( "syscall" "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) // TabView creates MultiPanel internally and manages tabs as panels. diff --git a/toolbar.go b/toolbar.go index 84c02a7..41c7282 100644 --- a/toolbar.go +++ b/toolbar.go @@ -8,7 +8,7 @@ import ( "syscall" "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type Toolbar struct { diff --git a/tooltip.go b/tooltip.go index 5a05bcf..6ba07fb 100644 --- a/tooltip.go +++ b/tooltip.go @@ -9,7 +9,7 @@ import ( "syscall" "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) type ToolTip struct { diff --git a/treeview.go b/treeview.go index 43d88e9..d4dbc6c 100644 --- a/treeview.go +++ b/treeview.go @@ -9,7 +9,7 @@ import ( "syscall" "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) // TreeItem represents an item in a TreeView widget. diff --git a/utils.go b/utils.go index acea407..4b3c4b3 100644 --- a/utils.go +++ b/utils.go @@ -10,7 +10,7 @@ import ( "syscall" "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) func internalTrackMouseEvent(hwnd w32.HWND) { diff --git a/wndproc.go b/wndproc.go index bb16967..65505c2 100644 --- a/wndproc.go +++ b/wndproc.go @@ -8,7 +8,7 @@ package winc import ( "unsafe" - "github.com/tadvi/winc/w32" + "github.com/neurlang/winc/w32" ) func genPoint(p uintptr) (x, y int) {