summaryrefslogtreecommitdiff
path: root/src/nigui/private/windows
diff options
context:
space:
mode:
authortrustable-code <krauter.simon@arcor.de>2019-06-19 11:37:04 +0200
committertrustable-code <krauter.simon@arcor.de>2019-06-19 11:37:04 +0200
commit9ed05e7cb2da960c732aa14149a4e2e5bcbed675 (patch)
tree437593791111ee81a01458ec9f2b3d0f289bcc99 /src/nigui/private/windows
parent8b88552444215852f5fe999091d55dc12bd4313f (diff)
downloadNiGui-9ed05e7cb2da960c732aa14149a4e2e5bcbed675.tar.gz
NiGui-9ed05e7cb2da960c732aa14149a4e2e5bcbed675.zip
Eliminate multi methods
Fix #42
Diffstat (limited to 'src/nigui/private/windows')
-rwxr-xr-xsrc/nigui/private/windows/platform_impl.nim15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/nigui/private/windows/platform_impl.nim b/src/nigui/private/windows/platform_impl.nim
index 7d02f1e..017f122 100755
--- a/src/nigui/private/windows/platform_impl.nim
+++ b/src/nigui/private/windows/platform_impl.nim
@@ -815,17 +815,19 @@ method `visible=`(window: WindowImpl, visible: bool) =
else:
pShowWindow(window.fHandle, SW_HIDE)
-method showModal(window, parent: WindowImpl) =
+method showModal(window: WindowImpl, parent: Window) =
+ # Overwrite base method
+
# Set window owner, to hide it from the taskbar
- discard pSetWindowLongPtr(window.fHandle, GWL_HWNDPARENT, parent.fHandle)
+ discard pSetWindowLongPtr(window.fHandle, GWL_HWNDPARENT, cast[WindowImpl](parent).fHandle)
# Hide minimize and maximize buttons:
pSetWindowLong(window.fHandle, GWL_STYLE, WS_CAPTION or WS_THICKFRAME or WS_SYSMENU)
# pSetWindowLong(window.fHandle, GWL_EXSTYLE, WS_EX_TOOLWINDOW) # does not look good
- window.fModalParent = parent
+ window.fModalParent = cast[WindowImpl](parent)
window.visible = true
- discard EnableWindow(parent.fHandle, false)
+ discard EnableWindow(cast[WindowImpl](parent).fHandle, false)
method minimize(window: WindowImpl) =
procCall window.Window.minimize()
@@ -1267,9 +1269,10 @@ method `frame=`(container: ContainerImpl, frame: Frame) =
pSetParent(frame.fHandle, container.fHandle)
container.pUpdateScrollWnd()
-method add(container: ContainerImpl, control: ControlImpl) =
+method add(container: ContainerImpl, control: Control) =
+ # Overwrite base method
procCall container.Container.add(control)
- pSetParent(control.fHandle, container.fInnerHandle)
+ pSetParent(cast[ControlImpl](control).fHandle, container.fInnerHandle)
method remove(container: ContainerImpl, control: ControlImpl) =
procCall container.Container.remove(control)