Skip to content

Commit 32f1915

Browse files
committed
Refine package structure to be ready to use "go" command to build and install.
1 parent 06f22e1 commit 32f1915

33 files changed

+91
-195
lines changed

Diff for: src/pkg/gform/app.go renamed to app.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package gform
22

33
import (
4+
"github.com/AllenDang/w32"
5+
"github.com/AllenDang/w32/comctl32"
6+
"github.com/AllenDang/w32/gdiplus"
7+
"github.com/AllenDang/w32/kernel32"
8+
"github.com/AllenDang/w32/user32"
49
"unsafe"
5-
"w32"
6-
"w32/kernel32"
7-
"w32/user32"
8-
"w32/comctl32"
9-
"w32/gdiplus"
1010
)
1111

1212
func Init() {
@@ -19,8 +19,8 @@ func Init() {
1919
var initCtrls w32.INITCOMMONCONTROLSEX
2020
initCtrls.DwSize = uint(unsafe.Sizeof(initCtrls))
2121
initCtrls.DwICC =
22-
w32.ICC_LISTVIEW_CLASSES | w32.ICC_PROGRESS_CLASS | w32.ICC_TAB_CLASSES |
23-
w32.ICC_TREEVIEW_CLASSES | w32.ICC_BAR_CLASSES
22+
w32.ICC_LISTVIEW_CLASSES | w32.ICC_PROGRESS_CLASS | w32.ICC_TAB_CLASSES |
23+
w32.ICC_TREEVIEW_CLASSES | w32.ICC_BAR_CLASSES
2424

2525
comctl32.InitCommonControlsEx(&initCtrls)
2626
}

Diff for: src/pkg/gform/bitmap.go renamed to bitmap.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ package gform
22

33
import (
44
"errors"
5+
"github.com/AllenDang/w32"
6+
"github.com/AllenDang/w32/gdi32"
7+
"github.com/AllenDang/w32/gdiplus"
8+
"github.com/AllenDang/w32/kernel32"
9+
"github.com/AllenDang/w32/ole32"
510
"unsafe"
6-
"w32"
7-
"w32/kernel32"
8-
"w32/ole32"
9-
"w32/gdi32"
10-
"w32/gdiplus"
1111
)
1212

1313
type Bitmap struct {
14-
handle w32.HBITMAP
14+
handle w32.HBITMAP
1515
width, height int
1616
}
1717

@@ -23,7 +23,7 @@ func assembleBitmapFromHBITMAP(hbitmap w32.HBITMAP) (*Bitmap, error) {
2323

2424
return &Bitmap{
2525
handle: hbitmap,
26-
width: dib.DsBmih.BiWidth,
26+
width: dib.DsBmih.BiWidth,
2727
height: dib.DsBmih.BiHeight,
2828
}, nil
2929
}
@@ -52,7 +52,7 @@ func NewBitmapFromResource(instance w32.HINSTANCE, resName *uint16, resType *uin
5252
var gpBitmap *uintptr
5353
var err error
5454
var hRes w32.HRSRC
55-
55+
5656
hRes, err = kernel32.FindResource(w32.HMODULE(instance), resName, resType)
5757
if err != nil {
5858
return nil, err
@@ -73,7 +73,7 @@ func NewBitmapFromResource(instance w32.HINSTANCE, resName *uint16, resType *uin
7373
defer kernel32.GlobalUnlock(resBuffer)
7474
defer kernel32.GlobalFree(resBuffer)
7575
defer gdiplus.GdipDisposeImage(gpBitmap)
76-
76+
7777
var hbitmap w32.HBITMAP
7878
// Reverse gform.RGB to BGR to satisfy gdiplus color schema.
7979
hbitmap, err = gdiplus.GdipCreateHBITMAPFromBitmap(gpBitmap, uint32(RGB(background.B(), background.G(), background.R())))
@@ -105,4 +105,4 @@ func (this *Bitmap) Height() int {
105105

106106
func (this *Bitmap) Width() int {
107107
return this.width
108-
}
108+
}

Diff for: src/pkg/gform/brush.go renamed to brush.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package gform
22

33
import (
4-
"w32"
5-
"w32/gdi32"
4+
"github.com/AllenDang/w32"
5+
"github.com/AllenDang/w32/gdi32"
66
)
77

88
type Brush struct {
9-
hBrush w32.HBRUSH
9+
hBrush w32.HBRUSH
1010
logBrush w32.LOGBRUSH
1111
}
1212

@@ -43,4 +43,4 @@ func (this *Brush) Dispose() {
4343
gdi32.DeleteObject(w32.HGDIOBJ(this.hBrush))
4444
this.hBrush = 0
4545
}
46-
}
46+
}

Diff for: src/pkg/gform/buttons.go renamed to buttons.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package gform
22

33
import (
4-
"w32"
5-
"w32/user32"
4+
"github.com/AllenDang/w32"
5+
"github.com/AllenDang/w32/user32"
66
)
77

88
type Button struct {
@@ -84,7 +84,6 @@ func AttachCheckBox(parent Controller, id int) *CheckBox {
8484
return cb
8585
}
8686

87-
8887
func (this *CheckBox) init(parent Controller) {
8988
this.W32Control.init("BUTTON", parent, 0, w32.WS_TABSTOP|w32.WS_VISIBLE|w32.WS_CHILD|w32.BS_AUTOCHECKBOX)
9089
RegMsgHandler(this)

Diff for: src/pkg/gform/canvas.go renamed to canvas.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package gform
22

33
import (
44
"fmt"
5-
"w32"
6-
"w32/user32"
7-
"w32/gdi32"
5+
"github.com/AllenDang/w32"
6+
"github.com/AllenDang/w32/gdi32"
7+
"github.com/AllenDang/w32/user32"
88
)
99

1010
type Canvas struct {
@@ -99,4 +99,4 @@ func (this *Canvas) DrawText(text string, rect *Rect, format uint, font *Font, t
9999
defer gdi32.SetTextColor(this.hdc, previousTextColor)
100100

101101
user32.DrawText(this.hdc, text, len(text), rect.GetW32Rect(), format)
102-
}
102+
}

Diff for: src/pkg/gform/color.go renamed to color.go

File renamed without changes.

Diff for: src/pkg/gform/commondlgs.go renamed to commondlgs.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package gform
22

33
import (
4+
"github.com/AllenDang/w32"
5+
"github.com/AllenDang/w32/comdlg32"
6+
"github.com/AllenDang/w32/ole32"
7+
"github.com/AllenDang/w32/shell32"
8+
"github.com/AllenDang/w32/user32"
49
"syscall"
510
"unsafe"
6-
"w32"
7-
"w32/user32"
8-
"w32/comdlg32"
9-
"w32/ole32"
10-
"w32/shell32"
1111
)
1212

1313
func genOFN(parent Controller, title, filter string, filterIndex uint, initialDir string, buf []uint16) *w32.OPENFILENAME {

Diff for: src/pkg/gform/controlbase.go renamed to controlbase.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package gform
22

33
import (
4-
"w32"
5-
"w32/user32"
6-
"w32/kernel32"
7-
"w32/shell32"
4+
"github.com/AllenDang/w32"
5+
"github.com/AllenDang/w32/kernel32"
6+
"github.com/AllenDang/w32/shell32"
7+
"github.com/AllenDang/w32/user32"
88
)
99

1010
type ControlBase struct {
@@ -16,7 +16,7 @@ type ControlBase struct {
1616

1717
// General events
1818
onCreate EventManager
19-
onClose EventManager
19+
onClose EventManager
2020

2121
// Focus events
2222
onKillFocus EventManager
@@ -126,7 +126,6 @@ func (this *ControlBase) Bounds() *Rect {
126126
return ScreenToClientRect(this.hwnd, rect)
127127
}
128128

129-
130129
func (this *ControlBase) ClientRect() *Rect {
131130
rect := user32.GetClientRect(this.hwnd)
132131
return ScreenToClientRect(this.hwnd, rect)

Diff for: src/pkg/gform/controller.go renamed to controller.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package gform
22

33
import (
4-
"w32"
4+
"github.com/AllenDang/w32"
55
)
66

77
type Controller interface {

Diff for: src/pkg/gform/customcontrol.go renamed to customcontrol.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package gform
22

33
import (
4-
"w32"
5-
"w32/user32"
4+
"github.com/AllenDang/w32"
5+
"github.com/AllenDang/w32/user32"
66
)
77

88
type CustomControl struct {

Diff for: src/pkg/gform/dialog.go renamed to dialog.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package gform
22

33
import (
4+
"github.com/AllenDang/w32"
5+
"github.com/AllenDang/w32/user32"
46
"unsafe"
5-
"w32"
6-
"w32/user32"
77
)
88

99
type Dialog struct {
1010
Form
1111

1212
isModal bool
1313
template *uint16
14-
14+
1515
Data interface{}
1616

1717
onLoad EventManager
@@ -104,7 +104,7 @@ func (this *Dialog) ShowModalWithData(data interface{}) (result int) {
104104

105105
func (this *Dialog) Close(result int) {
106106
this.onClose.Fire(NewEventArg(this, nil))
107-
107+
108108
if this.isModal {
109109
user32.EndDialog(this.hwnd, uintptr(result))
110110
} else {

Diff for: src/pkg/gform/edit.go renamed to edit.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package gform
22

33
import (
4-
"w32"
5-
"w32/user32"
4+
"github.com/AllenDang/w32"
5+
"github.com/AllenDang/w32/user32"
66
)
77

88
type Edit struct {
@@ -48,10 +48,10 @@ func (this *Edit) WndProc(msg uint, wparam, lparam uintptr) uintptr {
4848
switch msg {
4949
case w32.WM_COMMAND:
5050
switch w32.HIWORD(uint(wparam)) {
51-
case w32.EN_CHANGE:
52-
this.onChange.Fire(NewEventArg(this, nil))
51+
case w32.EN_CHANGE:
52+
this.onChange.Fire(NewEventArg(this, nil))
5353
}
5454
}
5555

5656
return this.W32Control.WndProc(msg, wparam, lparam)
57-
}
57+
}

Diff for: src/pkg/gform/eventarg.go renamed to eventarg.go

File renamed without changes.

Diff for: src/pkg/gform/eventdata.go renamed to eventdata.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
package gform
22

33
import (
4-
"w32"
4+
"github.com/AllenDang/w32"
55
)
66

77
type MouseEventData struct {
8-
X, Y int
8+
X, Y int
99
Button int
10-
Wheel int
10+
Wheel int
1111
}
1212

1313
type DropFilesEventData struct {
14-
X, Y int
14+
X, Y int
1515
Files []string
1616
}
1717

@@ -29,4 +29,4 @@ type LVDBLClickEventData struct {
2929

3030
type KeyUpEventData struct {
3131
VKey, Code int
32-
}
32+
}
File renamed without changes.

Diff for: src/pkg/gform/font.go renamed to font.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package gform
22

33
import (
4+
"github.com/AllenDang/w32"
5+
"github.com/AllenDang/w32/gdi32"
6+
"github.com/AllenDang/w32/kernel32"
7+
"github.com/AllenDang/w32/user32"
48
"syscall"
5-
"w32"
6-
"w32/kernel32"
7-
"w32/gdi32"
8-
"w32/user32"
99
)
1010

1111
const (
@@ -19,7 +19,6 @@ func init() {
1919
DefaultFont = NewFont("MS Shell Dlg 2", 8, 0)
2020
}
2121

22-
2322
type Font struct {
2423
hfont w32.HFONT
2524
family string

Diff for: src/pkg/gform/form.go renamed to form.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package gform
22

33
import (
4+
"github.com/AllenDang/w32"
5+
"github.com/AllenDang/w32/user32"
46
"unsafe"
5-
"w32"
6-
"w32/user32"
77
)
88

99
type Form struct {

Diff for: src/pkg/gform/globalvars.go renamed to globalvars.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package gform
22

33
import (
4+
"github.com/AllenDang/w32"
45
"syscall"
5-
"w32"
66
)
77

88
//Private global variables.

Diff for: src/pkg/gform/imagelist.go renamed to imagelist.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package gform
22

33
import (
4-
"w32"
5-
"w32/comctl32"
4+
"github.com/AllenDang/w32"
5+
"github.com/AllenDang/w32/comctl32"
66
)
77

88
type ImageList struct {
@@ -42,4 +42,4 @@ func (this *ImageList) RemoveAll() bool {
4242

4343
func (this *ImageList) Remove(i int) bool {
4444
return comctl32.ImageList_Remove(this.handle, i)
45-
}
45+
}

Diff for: src/pkg/gform/init.go renamed to init.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package gform
22

33
import (
4-
"w32"
4+
"github.com/AllenDang/w32"
55
)
66

77
func init() {

Diff for: src/pkg/gform/listview.go renamed to listview.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package gform
22

33
import (
4+
"github.com/AllenDang/w32"
5+
"github.com/AllenDang/w32/user32"
46
"syscall"
57
"unsafe"
6-
"w32"
7-
"w32/user32"
88
)
99

1010
type ListView struct {
@@ -180,7 +180,7 @@ func (this *ListView) SetImageList(imageList *ImageList, imageListType int) *Ima
180180
if h == 0 {
181181
return nil
182182
}
183-
183+
184184
return &ImageList{w32.HIMAGELIST(h)}
185185
}
186186

0 commit comments

Comments
 (0)