// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/classes/gui/widgets/basic/divider.cpp
// Function: smooth::GUI::Divider::UpdateMetrics()
S::Void S::GUI::Divider::UpdateMetrics()
{
	Window	*wnd = GetContainerWindow();
	Rect	 rect;

	if (wnd == NIL) return;

	if (Binary::IsFlagSet(flags, OR_VERT))
	{
		Bool	 afterMe = False;

		if (container->GetObjectType() == Window::classID)
		{
			if (Binary::IsFlagSet(flags, OR_RIGHT))	rect.left = ((Window *) container)->GetClientRect().right - position;
			else					rect.left = ((Window *) container)->GetClientRect().left + position;

			rect.top	= wnd->GetClientRect().top;
			rect.bottom	= wnd->GetClientRect().bottom;
		}
		else
		{
			if (Binary::IsFlagSet(flags, OR_RIGHT))	rect.left = container->GetWidth() - position;
			else					rect.left = position;

			rect.top	= 3;
			rect.bottom	= container->GetHeight() - 3;
		}

		rect.right = rect.left + 2;

		for (Int i = container->GetNOfObjects() - 1; i >= 0; i--)
		{
			if (container->GetNthObject(i)->GetObjectType() != classID) continue;

			Divider	*divider = (Divider *) container->GetNthObject(i);

			if (afterMe && !Binary::IsFlagSet(divider->flags, OR_VERT))
			{
				if (Binary::IsFlagSet(divider->flags, OR_BOTTOM))
				{
					if (container->GetHeight() - divider->GetY() <= rect.bottom + 1) rect.bottom = container->GetHeight() - divider->GetY() - 2;
				}
				else
				{
					if (divider->GetY() >= rect.top - 2) rect.top = divider->GetY() + 3;
				}
			}

			if (divider == this) afterMe = True;
		}
	}
	else
	{
		Bool	 afterMe = False;

		if (container->GetObjectType() == Window::classID)
		{
			if (Binary::IsFlagSet(flags, OR_BOTTOM)) rect.top = ((Window *) container)->GetClientRect().bottom - position;
			else					 rect.top = ((Window *) container)->GetClientRect().top	   + position;

			rect.left	= wnd->GetClientRect().left;
			rect.right	= wnd->GetClientRect().right;
		}
		else
		{
			if (Binary::IsFlagSet(flags, OR_BOTTOM)) rect.top = container->GetHeight() - position;
			else					 rect.top = 			     position;

			rect.left	= 3;
			rect.right	= container->GetWidth() - 3;
		}

		rect.bottom = rect.top + 2;

		for (Int i = container->GetNOfObjects() - 1; i >= 0; i--)
		{
			if (container->GetNthObject(i)->GetObjectType() != classID) continue;

			Divider	*divider = (Divider *) container->GetNthObject(i);

			if (afterMe && Binary::IsFlagSet(divider->flags, OR_VERT))
			{
				if (Binary::IsFlagSet(divider->flags, OR_RIGHT))
				{
					if (container->GetWidth() - divider->GetX() <= rect.right + 1) rect.right = container->GetWidth() - divider->GetX() - 2;
				}
				else
				{
					if (divider->GetX() >= rect.left - 2) rect.left = divider->GetX() + 3;
				}
			}

			if (divider == this) afterMe = True;
		}
	}

	SetMetrics(rect.GetPosition(), rect.GetSize());

	if (Binary::IsFlagSet(flags, OR_VERT))	dragHotspot->SetMetrics(Point(-1, 0), rect.GetSize() + Size(2, 1));
	else					dragHotspot->SetMetrics(Point(0, -1), rect.GetSize() + Size(1, 2));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
callq 0x559e0
testq %rax, %rax
je 0x75971
movq %rax, %r15
movl 0x30(%rbx), %edi
movl $0x2, %esi
callq 0x583f0
movl %eax, %ebp
movq 0x190(%rbx), %rdi
addq $0x20, %rdi
movq 0xf7299(%rip), %rax     # 0x16c828
movswl (%rax), %esi
callq 0x57520
movl %eax, %r14d
movl 0x30(%rbx), %edi
testb %bpl, %bpl
je 0x755f9
movl $0x20, %esi
callq 0x583f0
movl %eax, %ebp
testb %r14b, %r14b
je 0x7564e
movq 0x190(%rbx), %rdi
callq 0x56330
movl 0x5c8(%rbx), %ecx
addl %ecx, %eax
subl %ecx, %edx
testb %bpl, %bpl
movq %rdx, %rbp
cmovel %eax, %ebp
movq %r15, %rdi
callq 0x56330
movq %rax, %r14
shrq $0x20, %r14
movq %r15, %rdi
callq 0x56330
movq %rdx, %r12
shrq $0x20, %r12
jmp 0x756a9
movl $0x8, %esi
callq 0x583f0
movl %eax, %ebp
testb %r14b, %r14b
je 0x75668
movq 0x190(%rbx), %rdi
callq 0x56330
movq %rax, %r14
movl 0x5c8(%rbx), %eax
shrq $0x20, %rdx
subl %eax, %edx
shrq $0x20, %r14
addl %eax, %r14d
testb %bpl, %bpl
cmovnel %edx, %r14d
movq %r15, %rdi
callq 0x56330
movq %rax, %rbp
movq %r15, %rdi
callq 0x56330
movq %rdx, %r15
jmp 0x757ca
testb %bpl, %bpl
je 0x7568b
movq 0x190(%rbx), %rax
movl 0xb0(%rax), %ebp
subl 0x5c8(%rbx), %ebp
jmp 0x75691
testb %bpl, %bpl
je 0x757ac
movq 0x190(%rbx), %rax
movl 0xb4(%rax), %r14d
subl 0x5c8(%rbx), %r14d
jmp 0x757b3
movl 0x5c8(%rbx), %ebp
movq 0x190(%rbx), %rax
movl 0xb4(%rax), %r12d
addl $-0x3, %r12d
movl $0x3, %r14d
leal 0x2(%rbp), %r15d
movq 0x190(%rbx), %rax
movl 0x40(%rax), %r13d
testl %r13d, %r13d
jle 0x758da
movq %rbp, (%rsp)
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
incl %r13d
xorl %r14d, %r14d
movq 0xf740c(%rip), %r15     # 0x16cae8
leal -0x2(%r13), %ebp
movq 0x190(%rbx), %rdi
addq $0x38, %rdi
movl %ebp, %esi
callq 0x5b0a4
movq (%rax), %rdi
addq $0x20, %rdi
movswl (%r15), %esi
callq 0x57520
testb %al, %al
je 0x7579a
movq 0x190(%rbx), %rdi
addq $0x38, %rdi
movl %ebp, %esi
callq 0x5b0a4
movq (%rax), %rbp
testb $0x1, %r14b
je 0x7578a
movl 0x30(%rbp), %edi
movl $0x2, %esi
callq 0x583f0
testb %al, %al
jne 0x7578a
movl 0x30(%rbp), %edi
movl $0x8, %esi
callq 0x583f0
testb %al, %al
je 0x7576d
movq 0x190(%rbx), %rax
movl 0xb4(%rax), %eax
subl 0xac(%rbp), %eax
leal 0x1(%r12), %ecx
leal -0x2(%rax), %edx
cmpl %ecx, %eax
cmovgl %r12d, %edx
movl %edx, %r12d
jmp 0x7578a
movl 0xac(%rbp), %eax
movq 0x10(%rsp), %rsi
leal -0x2(%rsi), %ecx
leal 0x3(%rax), %edx
cmpl %ecx, %eax
cmovll %esi, %edx
movl %edx, %eax
movq %rax, 0x10(%rsp)
cmpq %rbx, %rbp
movzbl %r14b, %r14d
movl $0x1, %eax
cmovel %eax, %r14d
decl %r13d
cmpl $0x1, %r13d
jg 0x756dc
jmp 0x758cc
movl 0x5c8(%rbx), %r14d
movq 0x190(%rbx), %rax
movl 0xb0(%rax), %r15d
addl $-0x3, %r15d
movl $0x3, %ebp
leal 0x2(%r14), %r12d
movq 0x190(%rbx), %rax
movl 0x40(%rax), %r13d
testl %r13d, %r13d
jle 0x758da
movq %rbp, (%rsp)
movq %r15, 0x8(%rsp)
movq %r14, 0x10(%rsp)
incl %r13d
xorl %r14d, %r14d
movq 0xf72eb(%rip), %r15     # 0x16cae8
leal -0x2(%r13), %ebp
movq 0x190(%rbx), %rdi
addq $0x38, %rdi
movl %ebp, %esi
callq 0x5b0a4
movq (%rax), %rdi
addq $0x20, %rdi
movswl (%r15), %esi
callq 0x57520
testb %al, %al
je 0x758bf
movq 0x190(%rbx), %rdi
addq $0x38, %rdi
movl %ebp, %esi
callq 0x5b0a4
movq (%rax), %rbp
testb $0x1, %r14b
je 0x758af
movl 0x30(%rbp), %edi
movl $0x2, %esi
callq 0x583f0
testb %al, %al
je 0x758af
movl 0x30(%rbp), %edi
movl $0x20, %esi
callq 0x583f0
testb %al, %al
je 0x75894
movq 0x190(%rbx), %rax
movl 0xb0(%rax), %eax
subl 0xa8(%rbp), %eax
movq 0x8(%rsp), %rsi
leal 0x1(%rsi), %ecx
leal -0x2(%rax), %edx
cmpl %ecx, %eax
cmovgl %esi, %edx
movl %edx, %eax
movq %rax, 0x8(%rsp)
jmp 0x758af
movl 0xa8(%rbp), %eax
movq (%rsp), %rsi
leal -0x2(%rsi), %ecx
leal 0x3(%rax), %edx
cmpl %ecx, %eax
cmovll %esi, %edx
movl %edx, %eax
movq %rax, (%rsp)
cmpq %rbx, %rbp
movzbl %r14b, %r14d
movl $0x1, %eax
cmovel %eax, %r14d
decl %r13d
cmpl $0x1, %r13d
jg 0x757fd
movq 0x10(%rsp), %r14
movq 0x8(%rsp), %r15
movq (%rsp), %rbp
movq %r14, %rax
shlq $0x20, %rax
movl %ebp, %ecx
orq %rax, %rcx
leaq 0x20(%rsp), %rsi
movq %rcx, (%rsi)
subl %ebp, %r15d
subl %r14d, %r12d
movq %r12, %rax
shlq $0x20, %rax
addq %r15, %rax
leaq 0x18(%rsp), %rdx
movq %rax, (%rdx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x150(%rax)
movl 0x30(%rbx), %edi
movl $0x2, %esi
callq 0x583f0
movq 0x5d0(%rbx), %rdi
testb %al, %al
je 0x75940
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
addl $0x2, %r15d
incl %r12d
jmp 0x75959
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
incl %r15d
addl $0x2, %r12d
shlq $0x20, %r12
orq %r12, %r15
leaq 0x18(%rsp), %rdx
movq %r15, (%rdx)
movq (%rdi), %rax
callq *0x150(%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq