// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/classes/gui/widgets/multi/list/listboxheader.cpp
// Function: smooth::GUI::ListBoxHeader::Process(int, int, int)
S::Int S::GUI::ListBoxHeader::Process(Int message, Int wParam, Int lParam)
{
	if (!IsRegistered())		 return Error();
	if (!IsActive() || !IsVisible()) return Success();

	switch (message)
	{
		case SM_MOUSEMOVE:
			if (draggingTab) break;

			{
				Window	*window	  = GetContainerWindow();
				Surface	*surface  = GetDrawSurface();

				Point	 realPos  = GetRealPosition();
				Size	 realSize = GetRealSize();
				Rect	 frame	  = Rect(realPos, realSize);

				frame.left = realPos.x - 2;

				for (Int i = 0; i < tabWidths.Length() - 1; i++)
				{
					frame.left += (Int) Math::Abs(Math::Round(tabWidths.GetNth(i) * surface->GetSurfaceDPI() / 96.0));
					frame.right = frame.left + 4;

					if (window->IsMouseOn(frame))
					{
						if (moveTab != i)
						{
							moveTab = i;

							Input::Pointer::SetCursor(window, Input::Pointer::CursorHSize);
						}
					}
					else if (moveTab == i)
					{
						moveTab = -1;

						Input::Pointer::SetCursor(window, Input::Pointer::CursorArrow);
					}
				}

				frame.left = realPos.x + 1;
				frame.top++;
				frame.bottom--;

				for (Int j = 0; j < tabWidths.Length(); j++)
				{
					frame.right = (Int) Math::Min(frame.left + Math::Abs(Math::Round(tabWidths.GetNth(j) * surface->GetSurfaceDPI() / 96.0)) - 2, realPos.x + GetRealSize().cx - 1);

					if (window->IsMouseOn(frame) && !tabChecked.GetNth(j) && moveTab == -1)
					{
						surface->StartPaint(frame);

						surface->Box(frame, Setup::LightGrayColor, Rect::Filled);
						surface->SetText(tabNames.GetNth(j), frame + Point(2, Math::Ceil(Float(frame.GetHeight() - font.GetScaledTextSizeY()) / 2) - 1) - Size(2, 0), font);

						surface->EndPaint();

						tabChecked.Set(tabChecked.GetNthIndex(j), True);
					}
					else if ((!window->IsMouseOn(frame) || moveTab != -1) && tabChecked.GetNth(j))
					{
						surface->StartPaint(frame);

						surface->Box(frame, Setup::BackgroundColor, Rect::Filled);
						surface->SetText(tabNames.GetNth(j), frame + Point(2, Math::Ceil(Float(frame.GetHeight() - font.GetScaledTextSizeY()) / 2) - 1) - Size(2, 0), font);

						surface->EndPaint();

						tabChecked.Set(tabChecked.GetNthIndex(j), False);
					}

					frame.left += (Int) Math::Abs(Math::Round(tabWidths.GetNth(j) * surface->GetSurfaceDPI() / 96.0));
				}
			}

			break;
	}

	return Widget::Process(message, wParam, lParam);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movl %esi, %r12d
movq %rdi, %r15
movq (%rdi), %rax
callq *0x88(%rax)
testb %al, %al
je 0x835fb
movq (%r15), %rax
movq %r15, %rdi
callq *0x98(%rax)
xorl %ebx, %ebx
testb %al, %al
je 0x835fe
movq (%r15), %rax
movq %r15, %rdi
callq *0x90(%rax)
testb %al, %al
je 0x835fe
cmpl $0x7800, %r12d          # imm = 0x7800
jne 0x839c7
cmpb $0x0, 0x5bc(%r15)
jne 0x839c7
movl %r12d, 0x44(%rsp)
movl %r14d, 0x48(%rsp)
movl %ebp, 0x4c(%rsp)
movq %r15, %rdi
callq 0x56a50
movq %rax, %rbp
movq (%r15), %rax
movq %r15, %rdi
callq *0x40(%rax)
movq %rax, %r13
movq (%r15), %rax
movq %r15, %rdi
callq *0x48(%rax)
movq %rax, %rbx
movq %rax, %r14
shrq $0x20, %r14
movq (%r15), %rax
movq %r15, %rdi
callq *0x50(%rax)
leal (%rax,%rbx), %ecx
shrq $0x20, %rax
leaq 0x8(%rsp), %rdx
movl %r14d, 0x4(%rdx)
movl %ecx, 0x8(%rdx)
addl %r14d, %eax
movl %eax, 0xc(%rdx)
movq %rbx, 0x60(%rsp)
leal -0x2(%rbx), %eax
movl %eax, (%rdx)
leaq 0x630(%r15), %r12
xorl %r14d, %r14d
movl 0x638(%r15), %ecx
leal -0x1(%rcx), %eax
cmpl %eax, %r14d
jge 0x8360f
movq %r12, %rdi
movl %r14d, %esi
callq 0x840de
movl (%rax), %ebx
movq %r13, %rdi
callq 0x59c60
cwtl
imull %ebx, %eax
cvtsi2sd %eax, %xmm0
divsd 0x5ffa5(%rip), %xmm0    # 0xe3510
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
leaq 0x603f1(%rip), %rcx     # 0xe3970
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
orl $0x1, %ecx
testq %rax, %rax
movl $0x0, %edx
cmovel %edx, %ecx
imull %ecx, %eax
movl 0x8(%rsp), %ecx
leal (%rcx,%rax), %edx
movl %edx, 0x8(%rsp)
addl %ecx, %eax
addl $0x4, %eax
movl %eax, 0x10(%rsp)
movq %rbp, %rdi
leaq 0x8(%rsp), %rsi
callq 0x58ae0
movl 0x5b8(%r15), %ecx
testb %al, %al
je 0x835da
movl %r14d, %eax
pushq $0x3
popq %rsi
cmpl %ecx, %r14d
jne 0x835e4
jmp 0x835f3
xorl %esi, %esi
pushq $-0x1
popq %rax
cmpl %ecx, %r14d
jne 0x835f3
movl %eax, 0x5b8(%r15)
movq %rbp, %rdi
callq 0x56de0
incl %r14d
jmp 0x83533
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x60(%rsp), %rax
incl %eax
leaq 0x8(%rsp), %rdx
movl %eax, (%rdx)
incl 0x4(%rdx)
decl 0xc(%rdx)
leaq 0x6e0(%r15), %rdx
movq %rdx, 0x38(%rsp)
leaq 0x5d8(%r15), %rdx
movq %rdx, 0x58(%rsp)
leaq 0x140(%r15), %rdx
movq %rdx, 0x50(%rsp)
xorl %r14d, %r14d
movq %rbp, 0x70(%rsp)
movq %r12, 0x68(%rsp)
cmpl %ecx, %r14d
jge 0x839b9
movslq %eax, %rbx
movq %r12, %rdi
movl %r14d, %esi
callq 0x840de
movl (%rax), %r12d
movq %r13, %rdi
callq 0x59c60
cwtl
imull %r12d, %eax
cvtsi2sd %eax, %xmm0
divsd 0x5fe89(%rip), %xmm0    # 0xe3510
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
leaq 0x602d5(%rip), %rcx     # 0xe3970
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
orq $0x1, %rcx
testq %rax, %rax
cmoveq %rax, %rcx
imulq %rax, %rcx
addq %rcx, %rbx
addq $-0x2, %rbx
movq (%r15), %rax
movq %r15, %rdi
callq *0x50(%rax)
addl 0x60(%rsp), %eax
shlq $0x20, %rax
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
addq %rcx, %rax
sarq $0x20, %rax
cmpq %rbx, %rax
cmovgeq %rbx, %rax
movl %eax, 0x10(%rsp)
movq %rbp, %rdi
leaq 0x8(%rsp), %rsi
callq 0x58ae0
testb %al, %al
je 0x83805
movq 0x38(%rsp), %rdi
movl %r14d, %esi
callq 0x7ece0
cmpb $0x0, (%rax)
jne 0x83805
cmpl $-0x1, 0x5b8(%r15)
jne 0x83805
movq %r13, %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
callq 0x56160
movq 0xde869(%rip), %rax     # 0x161fa8
movl (%rax), %ecx
andq $0x0, 0x20(%rsp)
movq %r13, %rdi
movq %rbx, %rsi
movq 0xde054(%rip), %rdx     # 0x1617a8
leaq 0x20(%rsp), %r8
callq 0x58b80
movq 0x58(%rsp), %rdi
movl %r14d, %esi
callq 0x6bb28
movq %rax, 0x30(%rsp)
movl 0xc(%rsp), %r12d
movl 0x14(%rsp), %ebp
movq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq 0xde630(%rip), %rsi     # 0x161db8
callq 0x588a0
addl %r12d, %eax
subl %eax, %ebp
cvtsi2sd %ebp, %xmm0
mulsd 0x5fbe2(%rip), %xmm0    # 0xe3380
callq 0x57e30
decl %eax
movl $0x2, 0x18(%rsp)
movl %eax, 0x1c(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x58930
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
addl %edx, %ecx
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
andq %rsi, %rdx
orq %rdx, %rcx
movq %rax, 0x20(%rsp)
movq %rcx, 0x28(%rsp)
movq %r13, %rdi
movq 0x30(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x58df0
leaq 0x62eb6(%rip), %rbx     # 0xe66b6
jmp 0x83918
movq %rbp, %rdi
leaq 0x8(%rsp), %rsi
callq 0x58ae0
testb %al, %al
movq 0x68(%rsp), %r12
je 0x83829
cmpl $-0x1, 0x5b8(%r15)
je 0x83947
movq 0x38(%rsp), %rdi
movl %r14d, %esi
callq 0x7ece0
cmpb $0x1, (%rax)
jne 0x83947
movq %r13, %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
callq 0x56160
movq 0xde752(%rip), %rax     # 0x161fa8
movl (%rax), %ecx
andq $0x0, 0x20(%rsp)
movq %r13, %rdi
movq %rbx, %rsi
movq 0xddc65(%rip), %rdx     # 0x1614d0
leaq 0x20(%rsp), %r8
callq 0x58b80
movq 0x58(%rsp), %rdi
movl %r14d, %esi
callq 0x6bb28
movq %rax, 0x30(%rsp)
movl 0xc(%rsp), %ebp
movl 0x14(%rsp), %r12d
movq 0x50(%rsp), %rbx
movq %rbx, %rdi
movq 0xde519(%rip), %rsi     # 0x161db8
callq 0x588a0
addl %ebp, %eax
subl %eax, %r12d
cvtsi2sd %r12d, %xmm0
mulsd 0x5faca(%rip), %xmm0    # 0xe3380
callq 0x57e30
decl %eax
movl $0x2, 0x18(%rsp)
movl %eax, 0x1c(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rsi
callq 0x58930
movl $0xfffffffe, %ecx       # imm = 0xFFFFFFFE
addl %edx, %ecx
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
andq %rsi, %rdx
orq %rdx, %rcx
movq %rax, 0x20(%rsp)
movq %rcx, 0x28(%rsp)
movq %r13, %rdi
movq 0x30(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %rbx, %rcx
xorl %r8d, %r8d
callq 0x58df0
leaq 0x62d9d(%rip), %rbx     # 0xe66b5
movq %r13, %rdi
callq 0x59a80
movq 0x38(%rsp), %r12
movq %r12, %rdi
movl %r14d, %esi
callq 0x582c0
movq %r12, %rdi
movl %eax, %esi
movq %rbx, %rdx
callq 0x816fc
movq 0x70(%rsp), %rbp
movq 0x68(%rsp), %r12
movq %r12, %rdi
movl %r14d, %esi
callq 0x840de
movl (%rax), %ebx
movq %r13, %rdi
callq 0x59c60
cwtl
imull %ebx, %eax
cvtsi2sd %eax, %xmm0
divsd 0x5fba4(%rip), %xmm0    # 0xe3510
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
leaq 0x5fff0(%rip), %rcx     # 0xe3970
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
orl $0x1, %ecx
testq %rax, %rax
movl $0x0, %edx
cmovel %edx, %ecx
imull %ecx, %eax
addl 0x8(%rsp), %eax
movl %eax, 0x8(%rsp)
incl %r14d
movl 0x638(%r15), %ecx
jmp 0x83654
movl 0x4c(%rsp), %ebp
movl 0x48(%rsp), %r14d
movl 0x44(%rsp), %r12d
movq %r15, %rdi
movl %r12d, %esi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x594d0
movl %eax, %ebx
jmp 0x835fe