// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/gui/widgets/special/tooltip.cpp
// Function: smooth::GUI::Tooltip::Show()
S::Int S::GUI::Tooltip::Show()
{
	if (visible) return Success();

	visible = True;

	if (!IsRegistered()) return Success();

	Window	*window	     = container->GetContainerWindow();
	Surface	*surface     = GetDrawSurface();

	Rect	 monitor     = System::Screen::GetActiveScreenWorkArea();
	Float	 scaleFactor = surface->GetSurfaceDPI() / 96.0;

	Size	 tSize	     = (layer != NIL ? layer->GetSize() : Size(font.GetUnscaledTextSizeX(text) + 6, font.GetUnscaledTextSizeY(text) + 4));
	Size	 sSize	     = tSize * scaleFactor;
	Point	 tPos	     = Point(GetX(), GetY() - sSize.cy + 1);

	if (tPos.y + window->GetY() < monitor.top + 2) tPos.y = GetY() + monitor.top + 2 + Setup::HoverHeight;

	if (!IsRightToLeft())
	{
		if (tPos.x + window->GetX() + sSize.cx > monitor.right - 2) tPos.x = -window->GetX() + monitor.right - 2 - sSize.cx;
		if (tPos.x + window->GetX()	       < monitor.left  + 2) tPos.x = -window->GetX() + monitor.left + 2;
	}
	else
	{
		if (window->GetWidth() - tPos.x + window->GetX()	    > monitor.right - 2) tPos.x = -monitor.right + 2 + window->GetWidth() + window->GetX();
		if (window->GetWidth() - tPos.x - sSize.cx + window->GetX() < monitor.left  + 2) tPos.x = -(monitor.left + 2) + window->GetWidth() + window->GetX() - sSize.cx;
	}

	toolWindow = new ToolWindow(tPos, tSize);
	toolWindow->onPaint.Connect(&Tooltip::OnToolWindowPaint, this);
	toolWindow->onEvent.Connect(&Tooltip::OnToolWindowEvent, this);
	toolWindow->SetBackgroundColor(Setup::TooltipColor);

	if (layer != NIL) toolWindow->Add(layer);

	Add(toolWindow);

	if (timeOut != 0)
	{
		timer = new System::Timer();

		timer->onInterval.Connect(&Tooltip::OnTimer, this);
		timer->Start(timeOut);
	}

	onShow.Emit();

	return Success();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xc8(%rbp)
testb $0x1, 0xcb(%rax)
je 0xd4528
leaq -0x20(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x5ca80
movq -0xd8(%rbp), %rdi
callq 0x59680
movl %eax, -0xcc(%rbp)
jmp 0xd44f7
movl -0xcc(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x5a410
jmp 0xd4adc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x5a410
jmp 0xd4ae8
movq -0xc8(%rbp), %rdi
movb $0x1, 0xcb(%rdi)
movq (%rdi), %rax
callq *0x88(%rax)
testb $0x1, %al
jne 0xd4598
leaq -0x40(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x5ca80
movq -0xe8(%rbp), %rdi
callq 0x59680
movl %eax, -0xdc(%rbp)
jmp 0xd4567
movl -0xdc(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x5a410
jmp 0xd4adc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x5a410
jmp 0xd4ae8
movq -0xc8(%rbp), %rax
movq 0x190(%rax), %rdi
callq 0x59bc0
movq -0xc8(%rbp), %rdi
movq %rax, -0x48(%rbp)
movq (%rdi), %rax
callq *0x40(%rax)
movq %rax, -0x50(%rbp)
callq 0x5c790
movq %rax, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
movq -0x50(%rbp), %rdi
callq 0x5d470
movw %ax, %cx
movq -0xc8(%rbp), %rax
movswl %cx, %ecx
cvtsi2sd %ecx, %xmm0
movsd 0xb2ed1(%rip), %xmm1    # 0x1874c0
divsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
cmpq $0x0, 0x5d0(%rax)
je 0xd461e
movq -0xc8(%rbp), %rax
movq 0x5d0(%rax), %rdi
callq 0x5bf70
movq (%rax), %rax
movq %rax, -0x70(%rbp)
jmp 0xd4675
movq -0xc8(%rbp), %rsi
movq %rsi, %rdi
addq $0x140, %rdi            # imm = 0x140
addq $0xf0, %rsi
callq 0x5c860
movq -0xc8(%rbp), %rsi
addl $0x6, %eax
movl %eax, -0xec(%rbp)
movq %rsi, %rdi
addq $0x140, %rdi            # imm = 0x140
addq $0xf0, %rsi
callq 0x5d5e0
movl -0xec(%rbp), %esi
movl %eax, %edx
addl $0x4, %edx
leaq -0x70(%rbp), %rdi
callq 0x59260
movsd -0x68(%rbp), %xmm0
leaq -0x70(%rbp), %rdi
callq 0x5a7b0
movq -0xc8(%rbp), %rdi
movq %rax, -0x78(%rbp)
callq 0x5dab0
movq -0xc8(%rbp), %rdi
movl %eax, -0xf4(%rbp)
callq 0x5ddb0
movl -0xf4(%rbp), %esi
movl %eax, %edx
subl -0x74(%rbp), %edx
addl $0x1, %edx
leaq -0x80(%rbp), %rdi
callq 0x5c2c0
movl -0x7c(%rbp), %eax
movl %eax, -0xf0(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5ddb0
movl %eax, %ecx
movl -0xf0(%rbp), %eax
addl %ecx, %eax
movl -0x5c(%rbp), %ecx
addl $0x2, %ecx
cmpl %ecx, %eax
jge 0xd4700
movq -0xc8(%rbp), %rdi
callq 0x5ddb0
addl -0x5c(%rbp), %eax
addl $0x2, %eax
movq 0x1347f5(%rip), %rcx    # 0x208ef0
addl (%rcx), %eax
movl %eax, -0x7c(%rbp)
movq -0xc8(%rbp), %rdi
movq (%rdi), %rax
callq *0x160(%rax)
testb $0x1, %al
jne 0xd479f
movl -0x80(%rbp), %eax
movl %eax, -0xf8(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5dab0
movl %eax, %ecx
movl -0xf8(%rbp), %eax
addl %ecx, %eax
addl -0x78(%rbp), %eax
movl -0x58(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jle 0xd475c
movq -0x48(%rbp), %rdi
callq 0x5dab0
movl %eax, %ecx
xorl %eax, %eax
subl %ecx, %eax
addl -0x58(%rbp), %eax
subl $0x2, %eax
subl -0x78(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %eax
movl %eax, -0xfc(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5dab0
movl %eax, %ecx
movl -0xfc(%rbp), %eax
addl %ecx, %eax
movl -0x60(%rbp), %ecx
addl $0x2, %ecx
cmpl %ecx, %eax
jge 0xd479a
movq -0x48(%rbp), %rdi
callq 0x5dab0
movl %eax, %ecx
xorl %eax, %eax
subl %ecx, %eax
addl -0x60(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x80(%rbp)
jmp 0xd4881
movq -0x48(%rbp), %rdi
callq 0x5a210
subl -0x80(%rbp), %eax
movl %eax, -0x100(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5dab0
movl %eax, %ecx
movl -0x100(%rbp), %eax
addl %ecx, %eax
movl -0x58(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jle 0xd480b
xorl %eax, %eax
subl -0x58(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x108(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5a210
movl %eax, %ecx
movl -0x108(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x104(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5dab0
movl %eax, %ecx
movl -0x104(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x80(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5a210
subl -0x80(%rbp), %eax
subl -0x78(%rbp), %eax
movl %eax, -0x10c(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5dab0
movl %eax, %ecx
movl -0x10c(%rbp), %eax
addl %ecx, %eax
movl -0x60(%rbp), %ecx
addl $0x2, %ecx
cmpl %ecx, %eax
jge 0xd487f
movl -0x60(%rbp), %ecx
addl $0x2, %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, -0x114(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5a210
movl %eax, %ecx
movl -0x114(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x110(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5dab0
movl %eax, %ecx
movl -0x110(%rbp), %eax
addl %ecx, %eax
subl -0x78(%rbp), %eax
movl %eax, -0x80(%rbp)
jmp 0xd4881
movl $0x6d8, %edi            # imm = 0x6D8
callq 0x59820
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x120(%rbp)
leaq -0x80(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x5dce0
jmp 0xd48a7
movq -0xc8(%rbp), %rcx
movq -0x120(%rbp), %rax
movq %rax, 0x5b8(%rcx)
movq 0x5b8(%rcx), %rdi
addq $0x648, %rdi            # imm = 0x648
movq 0x133a57(%rip), %rax    # 0x208328
movq %rax, -0x90(%rbp)
movq $0x0, -0x88(%rbp)
movq -0x90(%rbp), %rsi
movq -0x88(%rbp), %rdx
callq 0xd4f70
movq -0xc8(%rbp), %rcx
movq 0x5b8(%rcx), %rdi
addq $0x668, %rdi            # imm = 0x668
movq 0x134326(%rip), %rax    # 0x208c38
movq %rax, -0xa0(%rbp)
movq $0x0, -0x98(%rbp)
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
callq 0xd50b0
movq -0xc8(%rbp), %rax
movq 0x5b8(%rax), %rdi
movq (%rdi), %rax
movq 0x133b89(%rip), %rsi    # 0x2084d8
callq *0x138(%rax)
movq -0xc8(%rbp), %rax
cmpq $0x0, 0x5d0(%rax)
je 0xd49a5
movq -0xc8(%rbp), %rax
movq 0x5b8(%rax), %rdi
movq 0x5d0(%rax), %rsi
movq (%rdi), %rax
callq *0x30(%rax)
jmp 0xd49a5
movq -0x120(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x6d8, %esi            # imm = 0x6D8
callq 0x595b0
jmp 0xd4ae8
movq -0xc8(%rbp), %rdi
movq 0x5b8(%rdi), %rsi
movq (%rdi), %rax
callq *0x30(%rax)
movq -0xc8(%rbp), %rax
cmpl $0x0, 0x5c8(%rax)
je 0xd4a71
movl $0x68, %edi
callq 0x59820
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x128(%rbp)
callq 0x59db0
jmp 0xd49eb
movq -0xc8(%rbp), %rcx
movq -0x128(%rbp), %rax
movq %rax, 0x5c0(%rcx)
movq 0x5c0(%rcx), %rdi
addq $0x48, %rdi
movq 0x133ece(%rip), %rax    # 0x2088e0
movq %rax, -0xb0(%rbp)
movq $0x0, -0xa8(%rbp)
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
callq 0xd4f70
movq -0xc8(%rbp), %rax
movq 0x5c0(%rax), %rdi
movl 0x5c8(%rax), %esi
callq 0x59120
jmp 0xd4a71
movq -0x128(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
movl $0x68, %esi
callq 0x595b0
jmp 0xd4ae8
movq -0xc8(%rbp), %rdi
addq $0x1f8, %rdi            # imm = 0x1F8
callq 0x8af60
leaq -0xc0(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x5ca80
movq -0x138(%rbp), %rdi
callq 0x59680
movl %eax, -0x12c(%rbp)
jmp 0xd4aab
movl -0x12c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x5a410
jmp 0xd4adc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x28(%rbp)
movl %eax, -0x2c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x5a410
jmp 0xd4ae8
movl -0x4(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
movq -0x28(%rbp), %rdi
callq 0x5b6b0
nopw %cs:(%rax,%rax)