// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/gui/widgets/multi/menu/popupmenu.cpp
// Function: smooth::GUI::PopupMenu::CalculateSize()
S::Void S::GUI::PopupMenu::CalculateSize()
{
	SetSize(Size(50, 5));

	Int	 nextYPos		= 3;
	Int	 maxShortcutTextSize	= 0;

	for (Int i = 0; i < Length(); i++)
	{
		PopupMenuEntry	*entry = (PopupMenuEntry *) GetNthEntry(i);

		if (entry->GetObjectType() != PopupMenuEntry::classID) continue;

		maxShortcutTextSize = Math::Max(maxShortcutTextSize, entry->GetShortcutTextSize());
	}

	for (Int i = 0; i < Length(); i++)
	{
		PopupMenuEntry	*entry = (PopupMenuEntry *) GetNthEntry(i);

		if (entry->GetObjectType() != PopupMenuEntry::classID) continue;

		SetWidth(Math::Max(GetWidth(), 6 + entry->GetMinimumSize().cx - (entry->GetShortcutTextSize() > 0 ? entry->GetShortcutTextSize() - maxShortcutTextSize : 0)));
		SetHeight(GetHeight() + 5 + (entry->GetText() != NIL ? 11 : 0));

		entry->SetPosition(Point(3, nextYPos));

		nextYPos += entry->GetHeight() + 1;
	}

	for (Int i = 0; i < Length(); i++)
	{
		PopupMenuEntry	*entry = (PopupMenuEntry *) GetNthEntry(i);

		if (entry->GetObjectType() != PopupMenuEntry::classID) continue;

		entry->SetWidth(GetWidth() - 6);
		entry->SetShortcutOffset(maxShortcutTextSize + 21);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
leaq -0x10(%rbp), %rdi
movl $0x32, %esi
movl $0x5, %edx
callq 0x59260
movq -0x60(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x5de18
movl $0x3, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x60(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0x64(%rbp)
movq (%rdi), %rax
callq *0x178(%rax)
movl %eax, %ecx
movl -0x64(%rbp), %eax
cmpl %ecx, %eax
jge 0xc1026
movq -0x60(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq (%rdi), %rax
callq *0x180(%rax)
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x5bb10
movq %rax, %rdi
movq 0x147671(%rip), %rax    # 0x208660
movswl (%rax), %esi
callq 0x5da50
testb $0x1, %al
jne 0xc0ffd
jmp 0xc0fff
jmp 0xc101b
movl -0x18(%rbp), %eax
movl %eax, -0x68(%rbp)
movq -0x28(%rbp), %rdi
callq 0x5da30
movl -0x68(%rbp), %edi
movl %eax, %esi
callq 0x5aae0
movl %eax, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xc0fac
movl $0x0, -0x2c(%rbp)
movq -0x60(%rbp), %rdi
movl -0x2c(%rbp), %eax
movl %eax, -0x6c(%rbp)
movq (%rdi), %rax
callq *0x178(%rax)
movl %eax, %ecx
movl -0x6c(%rbp), %eax
cmpl %ecx, %eax
jge 0xc1179
movq -0x60(%rbp), %rdi
movl -0x2c(%rbp), %esi
movq (%rdi), %rax
callq *0x180(%rax)
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x5bb10
movq %rax, %rdi
movq 0x1475ec(%rip), %rax    # 0x208660
movswl (%rax), %esi
callq 0x5da50
testb $0x1, %al
jne 0xc1082
jmp 0xc1087
jmp 0xc116b
movq -0x60(%rbp), %rdi
callq 0x5a210
movl %eax, -0x74(%rbp)
movq -0x38(%rbp), %rdi
callq 0x5b010
movq %rax, -0x40(%rbp)
movl -0x40(%rbp), %eax
addl $0x6, %eax
movl %eax, -0x70(%rbp)
movq -0x38(%rbp), %rdi
callq 0x5da30
cmpl $0x0, %eax
jle 0xc10c8
movq -0x38(%rbp), %rdi
callq 0x5da30
subl -0x18(%rbp), %eax
movl %eax, -0x78(%rbp)
jmp 0xc10cf
xorl %eax, %eax
movl %eax, -0x78(%rbp)
jmp 0xc10cf
movl -0x74(%rbp), %edi
movl -0x70(%rbp), %esi
movl -0x78(%rbp), %eax
subl %eax, %esi
callq 0x5aae0
movq -0x60(%rbp), %rdi
movl %eax, %esi
callq 0x5db30
movq -0x60(%rbp), %rdi
callq 0x5b860
addl $0x5, %eax
movl %eax, -0x84(%rbp)
movq -0x38(%rbp), %rdi
movq (%rdi), %rax
callq *0xa8(%rax)
movq %rax, %rdi
xorl %esi, %esi
callq 0x5b110
movl -0x84(%rbp), %esi
movq -0x60(%rbp), %rdi
movb %al, %dl
xorl %eax, %eax
movl $0xb, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
addl %eax, %esi
callq 0x5bed0
movq -0x38(%rbp), %rax
movq %rax, -0x80(%rbp)
movl -0x14(%rbp), %edx
leaq -0x48(%rbp), %rdi
movl $0x3, %esi
callq 0x5c2c0
movq -0x80(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x5d8c0
movq -0x38(%rbp), %rdi
callq 0x5b860
addl $0x1, %eax
addl -0x14(%rbp), %eax
movl %eax, -0x14(%rbp)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xc102d
movl $0x0, -0x4c(%rbp)
movq -0x60(%rbp), %rdi
movl -0x4c(%rbp), %eax
movl %eax, -0x88(%rbp)
movq (%rdi), %rax
callq *0x178(%rax)
movl %eax, %ecx
movl -0x88(%rbp), %eax
cmpl %ecx, %eax
jge 0xc121b
movq -0x60(%rbp), %rdi
movl -0x4c(%rbp), %esi
movq (%rdi), %rax
callq *0x180(%rax)
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
callq 0x5bb10
movq %rax, %rdi
movq 0x147497(%rip), %rax    # 0x208660
movswl (%rax), %esi
callq 0x5da50
testb $0x1, %al
jne 0xc11d7
jmp 0xc11d9
jmp 0xc120d
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rax
movq %rax, -0x90(%rbp)
callq 0x5a210
movq -0x90(%rbp), %rdi
movl %eax, %esi
subl $0x6, %esi
callq 0x5db30
movq -0x58(%rbp), %rdi
movl -0x18(%rbp), %esi
addl $0x15, %esi
callq 0x59a40
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0xc1180
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop