summaryrefslogtreecommitdiffstatshomepage
path: root/lineedit.go
diff options
context:
space:
mode:
authorAlexander Neumann <an2048@gmail.com>2017-08-17 19:41:05 +0200
committerAlexander Neumann <an2048@gmail.com>2017-08-17 19:41:05 +0200
commit89ba85c2688ea7fec2c44c04806b42f9ed52d08b (patch)
tree6dcc04381ef2d075fa6be38378ec993b0df43d63 /lineedit.go
parentAdd right to left support (diff)
downloadwireguard-windows-89ba85c2688ea7fec2c44c04806b42f9ed52d08b.tar.xz
wireguard-windows-89ba85c2688ea7fec2c44c04806b42f9ed52d08b.zip
[Line|Text]Edit: Add text alignment support
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 758d4d80..c409c2c8 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))