// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/gui/widgets/basic/statusbar.cpp
// Function: smooth::GUI::Statusbar::Paint(int)
S::Int S::GUI::Statusbar::Paint(Int message)
{
	if (!IsRegistered()) return Error();
	if (!IsVisible())    return Success();

	switch (message)
	{
		case SP_PAINT:
			{
				Surface	*surface = GetDrawSurface();
				Rect	 frame	 = Rect(GetRealPosition(), GetRealSize());

				surface->Box(frame, Setup::BackgroundColor, Rect::Filled);
				surface->SetText(text, frame + Point(4 * surface->GetSurfaceDPI() / 96.0, Math::Ceil(Float(frame.GetHeight() - font.GetScaledTextSizeY()) / 2) - 1) - Size(8, 2) * surface->GetSurfaceDPI() / 96.0, font);
			}

			break;
	};

	Int	 occupied_right	= 5;
	Int	 occupied_left	= 5;

#ifdef __APPLE__
	/* Check if macOS version is lower than 10.7 (Darwin 11.0) and
	 * occupy ten pixels for the handle at the right in that case.
	 */
	Int	 resizeGripSize = (Backends::BackendCocoa::IsOSXVersionAtLeast(10, 7, 0) ? 0 : 10);

	occupied_right += resizeGripSize;

	if (resizeGripSize > 0)
	{
		Surface	*surface = GetDrawSurface();
		Rect	 frame	 = Rect(GetRealPosition(), GetRealSize());

		surface->Line(Point(frame.right -  2, frame.bottom - 1), Point(frame.right, frame.bottom -  3), Color(116, 116, 116));
		surface->Line(Point(frame.right -  3, frame.bottom - 1), Point(frame.right, frame.bottom -  4), Color(184, 184, 184));

		surface->Line(Point(frame.right -  6, frame.bottom - 1), Point(frame.right, frame.bottom -  7), Color(116, 116, 116));
		surface->Line(Point(frame.right -  7, frame.bottom - 1), Point(frame.right, frame.bottom -  8), Color(184, 184, 184));

		surface->Line(Point(frame.right - 10, frame.bottom - 1), Point(frame.right, frame.bottom - 11), Color(116, 116, 116));
		surface->Line(Point(frame.right - 11, frame.bottom - 1), Point(frame.right, frame.bottom - 12), Color(184, 184, 184));
	}
#endif

	for (Int i = 0; i < GetNOfObjects(); i++)
	{
		Widget	*object = GetNthObject(i);

		if (object->GetOrientation() == OR_UPPERRIGHT)
		{
			object->SetPosition(Point(occupied_right + object->GetWidth(), (GetHeight() - object->GetHeight()) / 2));

			occupied_right += object->GetWidth() + 5;
		}
		else if (object->GetOrientation() == OR_UPPERLEFT)
		{
			object->SetPosition(Point(occupied_left, (GetHeight() - object->GetHeight()) / 2));

			occupied_left += object->GetWidth() + 5;
		}
	}

	return Widget::Paint(message);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x180, %rsp            # imm = 0x180
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
movq (%rdi), %rax
callq *0x88(%rax)
testb $0x1, %al
jne 0xa4184
leaq -0x28(%rbp), %rdi
movq %rdi, -0xf8(%rbp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5a9c0
movq -0xf8(%rbp), %rdi
callq 0x59680
movl %eax, -0xec(%rbp)
jmp 0xa4153
movl -0xec(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5b5b0
jmp 0xa45fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5b5b0
jmp 0xa4609
movq -0xe8(%rbp), %rdi
movq (%rdi), %rax
callq *0x90(%rax)
testb $0x1, %al
jne 0xa41ed
leaq -0x48(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x5ca80
movq -0x108(%rbp), %rdi
callq 0x59680
movl %eax, -0xfc(%rbp)
jmp 0xa41bc
movl -0xfc(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5a410
jmp 0xa45fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5a410
jmp 0xa4609
movl -0x14(%rbp), %eax
testl %eax, %eax
jne 0xa4409
jmp 0xa41fa
movq -0xe8(%rbp), %rdi
movq (%rdi), %rax
movq 0x40(%rax), %rax
callq *%rax
movq -0xe8(%rbp), %rdi
movq %rax, -0x50(%rbp)
movq (%rdi), %rax
movq 0x48(%rax), %rax
callq *%rax
movq -0xe8(%rbp), %rdi
movq %rax, -0x68(%rbp)
movq (%rdi), %rax
movq 0x50(%rax), %rax
callq *%rax
movq %rax, -0x70(%rbp)
leaq -0x60(%rbp), %rdi
movq %rdi, -0x128(%rbp)
leaq -0x68(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0x59ff0
movq -0x50(%rbp), %rax
movq %rax, -0x148(%rbp)
movq 0x164d40(%rip), %rax    # 0x208fa0
movl (%rax), %eax
movl %eax, -0x13c(%rbp)
leaq -0x78(%rbp), %rdi
movq %rdi, -0x138(%rbp)
xorl %edx, %edx
movl %edx, %esi
callq 0x59260
movq -0x148(%rbp), %rdi
movl -0x13c(%rbp), %ecx
movq -0x138(%rbp), %r8
movq -0x128(%rbp), %rsi
movq 0x16420a(%rip), %rdx    # 0x2084a8
callq 0x5c110
movq -0xe8(%rbp), %rax
movq -0x50(%rbp), %rdi
movq %rdi, -0x118(%rbp)
addq $0xf0, %rax
movq %rax, -0x110(%rbp)
callq 0x5d470
movq -0x128(%rbp), %rdi
cwtl
shll $0x2, %eax
cvtsi2sd %eax, %xmm0
movsd 0xe31e2(%rip), %xmm1    # 0x1874c0
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x12c(%rbp)
callq 0x591a0
movq -0xe8(%rbp), %rdi
movl %eax, -0x130(%rbp)
addq $0x140, %rdi            # imm = 0x140
movq 0x164a9c(%rip), %rsi    # 0x208da8
callq 0x5bde0
movl %eax, %ecx
movl -0x130(%rbp), %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd 0xe3061(%rip), %xmm1    # 0x187388
mulsd %xmm1, %xmm0
callq 0x5b240
movl -0x12c(%rbp), %esi
movl %eax, %edx
decl %edx
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x5c2c0
movq -0x128(%rbp), %rdi
movq -0x120(%rbp), %rsi
callq 0x5be80
movq %rax, -0x98(%rbp)
movq %rdx, -0x90(%rbp)
leaq -0xb8(%rbp), %rdi
movl $0x8, %esi
movl $0x2, %edx
callq 0x59260
movq -0x50(%rbp), %rdi
callq 0x5d470
cwtl
cvtsi2sd %eax, %xmm0
leaq -0xb8(%rbp), %rdi
callq 0x5a7b0
movq %rax, -0xb0(%rbp)
leaq -0xb0(%rbp), %rdi
movsd 0xe310c(%rip), %xmm0    # 0x1874c0
callq 0x5c6b0
movq %rax, -0xa8(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x5c040
movq -0xe8(%rbp), %rcx
movq -0x118(%rbp), %rdi
movq -0x110(%rbp), %rsi
movq %rax, -0x88(%rbp)
movq %rdx, -0x80(%rbp)
addq $0x140, %rcx            # imm = 0x140
leaq -0x88(%rbp), %rdx
xorl %r8d, %r8d
callq 0x5c3f0
movl $0x5, -0xbc(%rbp)
movl $0x5, -0xc0(%rbp)
movl $0x0, -0xc4(%rbp)
movq -0xe8(%rbp), %rdi
movl -0xc4(%rbp), %eax
movl %eax, -0x14c(%rbp)
callq 0x5b470
movl %eax, %ecx
movl -0x14c(%rbp), %eax
cmpl %ecx, %eax
jge 0xa45eb
movq -0xe8(%rbp), %rdi
movl -0xc4(%rbp), %esi
callq 0x5c230
movq %rax, -0xd0(%rbp)
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
callq *0x128(%rax)
cmpl $0x24, %eax
jne 0xa452e
movq -0xd0(%rbp), %rax
movq %rax, -0x158(%rbp)
movl -0xbc(%rbp), %eax
movl %eax, -0x164(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x5a210
movq -0xe8(%rbp), %rdi
movl %eax, %ecx
movl -0x164(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x160(%rbp)
callq 0x5b860
movl %eax, -0x15c(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x5b860
movl -0x160(%rbp), %esi
movl %eax, %ecx
movl -0x15c(%rbp), %eax
subl %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %edx
leaq -0xd8(%rbp), %rdi
callq 0x5c2c0
movq -0x158(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x5d8c0
movq -0xd0(%rbp), %rdi
callq 0x5a210
addl $0x5, %eax
addl -0xbc(%rbp), %eax
movl %eax, -0xbc(%rbp)
jmp 0xa45d5
movq -0xd0(%rbp), %rdi
movq (%rdi), %rax
callq *0x128(%rax)
cmpl $0x14, %eax
jne 0xa45d3
movq -0xe8(%rbp), %rdi
movq -0xd0(%rbp), %rax
movq %rax, -0x170(%rbp)
movl -0xc0(%rbp), %eax
movl %eax, -0x178(%rbp)
callq 0x5b860
movl %eax, -0x174(%rbp)
movq -0xd0(%rbp), %rdi
callq 0x5b860
movl -0x178(%rbp), %esi
movl %eax, %ecx
movl -0x174(%rbp), %eax
subl %ecx, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %edx
leaq -0xe0(%rbp), %rdi
callq 0x5c2c0
movq -0x170(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x5d8c0
movq -0xd0(%rbp), %rdi
callq 0x5a210
addl $0x5, %eax
addl -0xc0(%rbp), %eax
movl %eax, -0xc0(%rbp)
jmp 0xa45d5
jmp 0xa45d7
movl -0xc4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc4(%rbp)
jmp 0xa4427
movq -0xe8(%rbp), %rdi
movl -0x14(%rbp), %esi
callq 0x5acb0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x180, %rsp            # imm = 0x180
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x5b6b0
nopw %cs:(%rax,%rax)