├── .gitignore ├── README.md ├── behavior.go ├── element.go ├── event_handler.go ├── get_htmlayout.py ├── htmlayout.go ├── htmlayout_test.go ├── notify_handler.go └── patch_htmlayout_header.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.8 2 | _obj/ 3 | htmlayout/ 4 | HTMLayoutSDK.zip 5 | htmlayout.dll 6 | *.pyc 7 | *.o 8 | _cgo_export.h 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### What is it? 2 | Go-htmlayout (gohl) is a Go wrapper of the [HTMLayout](http://www.terrainformatica.com/htmlayout/) library by TerraInformatica. HTMLayout is a fast, lightweight, and embeddable HTML/CSS rendering component for Windows. 3 | 4 | ### Project status 5 | Go-htmlayout is written for Go1. Most of the HTMLayout API has been wrapped (especially dom element related stuff), but there is still more of the HTMLayout API that I haven't tackled yet. Tests are also incomplete at this point. In short, this wrapper is probably not ready for serious production use. 6 | 7 | ### Getting started 8 | Clone the repo. In the main directory of the repository, run the following to fetch the latest version of HTMLayout: 9 | 10 | ```bash 11 | python get_htmlayout.py 12 | ``` 13 | 14 | Though the tests provide an example of how to get started using gohl, there are probably better examples of window creation/management elsewhere on the internet. 15 | -------------------------------------------------------------------------------- /behavior.go: -------------------------------------------------------------------------------- 1 | package gohl 2 | -------------------------------------------------------------------------------- /element.go: -------------------------------------------------------------------------------- 1 | package gohl 2 | 3 | /* 4 | #cgo CFLAGS: -I./htmlayout/include 5 | #cgo LDFLAGS: ./htmlayout/lib/HTMLayout.lib 6 | 7 | #include 8 | #include 9 | */ 10 | import "C" 11 | 12 | import ( 13 | "fmt" 14 | "errors" 15 | "regexp" 16 | "runtime" 17 | "strconv" 18 | "strings" 19 | "reflect" 20 | "unicode/utf16" 21 | "unsafe" 22 | ) 23 | 24 | const ( 25 | HLDOM_OK = C.HLDOM_OK 26 | HLDOM_INVALID_HWND = C.HLDOM_INVALID_HWND 27 | HLDOM_INVALID_HANDLE = C.HLDOM_INVALID_HANDLE 28 | HLDOM_PASSIVE_HANDLE = C.HLDOM_PASSIVE_HANDLE 29 | HLDOM_INVALID_PARAMETER = C.HLDOM_INVALID_PARAMETER 30 | HLDOM_OPERATION_FAILED = C.HLDOM_OPERATION_FAILED 31 | HLDOM_OK_NOT_HANDLED = C.HLDOM_OK_NOT_HANDLED 32 | 33 | HV_OK_TRUE = 0xffffffff 34 | HV_OK = C.HV_OK 35 | HV_BAD_PARAMETER = C.HV_BAD_PARAMETER 36 | HV_INCOMPATIBLE_TYPE = C.HV_INCOMPATIBLE_TYPE 37 | 38 | STATE_LINK = 0x00000001 // selector :link, any element having href attribute 39 | STATE_HOVER = 0x00000002 // selector :hover, element is under the cursor, mouse hover 40 | STATE_ACTIVE = 0x00000004 // selector :active, element is activated, e.g. pressed 41 | STATE_FOCUS = 0x00000008 // selector :focus, element is in focus 42 | STATE_VISITED = 0x00000010 // selector :visited, aux flag - not used internally now. 43 | STATE_CURRENT = 0x00000020 // selector :current, current item in collection, e.g. current