diff options
| author | Pietro Gagliardi <[email protected]> | 2014-07-29 13:48:31 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-07-29 13:48:31 -0400 |
| commit | f4bb7360d4060d9c62c30d6b5508683a4fb6c472 (patch) | |
| tree | d25ce5d5195a6ffcc01def1b4ae8015b7c9ce723 /redo/controls_windows.go | |
| parent | 8d7f0c9a62b9108e262380ae62f8c8b9cbb12bfc (diff) | |
Added Label and implemented it on all platforms.
Diffstat (limited to 'redo/controls_windows.go')
| -rw-r--r-- | redo/controls_windows.go | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/redo/controls_windows.go b/redo/controls_windows.go index 882c15d..b9c69ed 100644 --- a/redo/controls_windows.go +++ b/redo/controls_windows.go @@ -157,3 +157,43 @@ func (t *textField) Text() string { func (t *textField) SetText(text string) { t.settext(text) } + +type label struct { + *widgetbase + standalone bool +} + +var labelclass = toUTF16("STATIC") + +func finishNewLabel(text string, standalone bool) *label { + w := newWidget(labelclass, + // SS_NOPREFIX avoids accelerator translation; SS_LEFTNOWORDWRAP clips text past the end + // controls are vertically aligned to the top by default (thanks Xeek in irc.freenode.net/#winapi) + C.SS_NOPREFIX | C.SS_LEFTNOWORDWRAP, + 0) + C.setWindowText(w.hwnd, toUTF16(text)) + C.controlSetControlFont(w.hwnd) + l := &label{ + widgetbase: w, + standalone: standalone, + } + return l +} + +func newLabel(text string) Label { + return finishNewLabel(text, false) +} + +func newStandaloneLabel(text string) Label { + return finishNewLabel(text, true) +} + +func (l *label) Text() string { + return l.text() +} + +func (l *label) SetText(text string) { + l.settext(text) +} + +// TODO label commitResize |
