summaryrefslogtreecommitdiffstatshomepage
path: root/lineedit.go
diff options
context:
space:
mode:
authorAlexander Neumann <an2048@gmail.com>2017-08-22 14:47:06 +0200
committerAlexander Neumann <an2048@gmail.com>2017-08-22 14:47:06 +0200
commit29bdc4945e244a7c4e1aab3b89d9ad36819d67e2 (patch)
treeb1263c305cd63f66fe615304d0f43d71ed1efb8c /lineedit.go
parentMerge branch 'master' into graphicseffects (diff)
parent[Line|Text]Edit: Add text alignment support (diff)
downloadwireguard-windows-29bdc4945e244a7c4e1aab3b89d9ad36819d67e2.tar.xz
wireguard-windows-29bdc4945e244a7c4e1aab3b89d9ad36819d67e2.zip
Merge branch 'master' into graphicseffects
Diffstat (limited to 'lineedit.go')
-rw-r--r--lineedit.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/lineedit.go b/lineedit.go
index 59c7f010..a0bfe9b2 100644
--- a/lineedit.go
+++ b/lineedit.go
@@ -140,6 +140,35 @@ func (le *LineEdit) SetTextSelection(start, end int) {
le.SendMessage(win.EM_SETSEL, uintptr(start), uintptr(end))
}
+func (le *LineEdit) Alignment() Alignment1D {
+ switch win.GetWindowLong(le.hWnd, win.GWL_STYLE) & (win.ES_LEFT | win.ES_CENTER | win.ES_RIGHT) {
+ case win.ES_CENTER:
+ return AlignCenter
+
+ case win.ES_RIGHT:
+ return AlignFar
+ }
+
+ return AlignNear
+}
+
+func (le *LineEdit) SetAlignment(alignment Alignment1D) error {
+ var bit uint32
+
+ switch alignment {
+ case AlignCenter:
+ bit = win.ES_CENTER
+
+ case AlignFar:
+ bit = win.ES_RIGHT
+
+ default:
+ bit = win.ES_LEFT
+ }
+
+ return le.ensureStyleBits(bit, true)
+}
+
func (le *LineEdit) CaseMode() CaseMode {
style := uint32(win.GetWindowLong(le.hWnd, win.GWL_STYLE))