// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/classes/gui/widgets/multi/menu/menubarentry.cpp
// Function: smooth::GUI::MenubarEntry::MenubarEntry(smooth::String const&, smooth::GUI::Bitmap const&, smooth::GUI::PopupMenu*, bool*, int*, int)
S::GUI::MenubarEntry::MenubarEntry(const String &iText, const Bitmap &iBitmap, PopupMenu *iPopup, Bool *ibVar, Int *iiVar, Int iiCode) : MenuEntry(iText, iBitmap, iPopup, ibVar, iiVar, iiCode)
{
	type		= classID;

	if	(text == NIL && bitmap == NIL) SetSize(Size(4, 15));
	else if (text != NIL && bitmap == NIL) SetSize(Size(unscaledTextSize.cx + 7, 16));
	else if (text == NIL && bitmap != NIL) SetSize(bitmap.GetSize() + Size(4 + (popup != NIL ? 12 : 0), 4));

	hotspot		= NIL;
	actionHotspot	= NIL;

	if (text != NIL || bitmap != NIL)
	{
		hotspot	= new HotspotSimpleButton(Point(), GetSize());
		hotspot->onMouseOver.Connect(&MenubarEntry::OnMouseOver, this);
		hotspot->onLeftButtonDown.Connect(&MenubarEntry::OpenPopupMenu, this);

		actionHotspot = new Hotspot(Point(), GetSize() - Size((text == NIL && bitmap != NIL && popup != NIL ? 12 : 0), 0));
		actionHotspot->onLeftButtonClick.Connect(&onAction);

		if (text == NIL && bitmap != NIL && popup != NIL) actionHotspot->onLeftButtonDown.Connect(&MenubarEntry::ClosePopupMenu, this);

		Add(hotspot);
		Add(actionHotspot);
	}

	popupMenuClosed	= 0;

	onChangeSize.Connect(&MenubarEntry::OnChangeSize, this);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl 0x40(%rsp), %eax
movl %eax, (%rsp)
callq 0x57a20
movq 0xdb7cf(%rip), %rax     # 0x161b50
addq $0x10, %rax
movq %rax, (%rbx)
movq 0xdb169(%rip), %rax     # 0x1614f8
movzwl (%rax), %eax
movw %ax, 0x20(%rbx)
leaq 0xf0(%rbx), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x56280
testb %al, %al
je 0x863e7
leaq 0x5c0(%rbx), %rdi
xorl %esi, %esi
callq 0x590c0
testb %al, %al
je 0x863e7
movabsq $0xf00000004, %rax      # imm = 0xF00000004
leaq 0x8(%rsp), %rdx
movq %rax, (%rdx)
leaq 0xa8(%rbx), %rsi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x150(%rax)
jmp 0x86499
movq %r14, %rdi
xorl %esi, %esi
callq 0x57d40
testb %al, %al
je 0x86433
leaq 0x5c0(%rbx), %rdi
xorl %esi, %esi
callq 0x590c0
testb %al, %al
je 0x86433
movl 0x180(%rbx), %eax
addl $0x7, %eax
leaq 0x8(%rsp), %rdx
movl %eax, (%rdx)
movl $0x10, 0x4(%rdx)
leaq 0xa8(%rbx), %rsi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x150(%rax)
jmp 0x86499
movq %r14, %rdi
xorl %esi, %esi
callq 0x56280
testb %al, %al
je 0x86499
leaq 0x5c0(%rbx), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x574f0
testb %al, %al
je 0x86499
movq %r15, %rdi
callq 0x596e0
cmpq $0x0, 0x5b8(%rbx)
pushq $0x4
popq %rcx
pushq $0x10
popq %rsi
cmovel %ecx, %esi
addl (%rax), %esi
movl 0x4(%rax), %eax
addl $0x4, %eax
shlq $0x20, %rax
orq %rax, %rsi
leaq 0x8(%rsp), %rdx
movq %rsi, (%rdx)
leaq 0xa8(%rbx), %rsi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x150(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x5f8(%rbx)
movq %r14, %rdi
xorl %esi, %esi
callq 0x57d40
testb %al, %al
jne 0x864c7
leaq 0x5c0(%rbx), %rdi
xorl %esi, %esi
callq 0x574f0
testb %al, %al
je 0x86626
movl $0x5b8, %edi            # imm = 0x5B8
callq 0x56700
movq %rax, %r15
leaq 0x8(%rsp), %rsi
andq $0x0, (%rsi)
leaq 0xb0(%rbx), %rdx
movq %rax, %rdi
callq 0x56ad0
movq %r15, 0x5f8(%rbx)
addq $0x2b8, %r15            # imm = 0x2B8
movq 0xdbacf(%rip), %rsi     # 0x161fd0
movq %r15, %rdi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x876f2
movl $0x2f8, %edi            # imm = 0x2F8
addq 0x5f8(%rbx), %rdi
movq 0xdaf07(%rip), %rsi     # 0x161428
xorl %edx, %edx
movq %rbx, %rcx
callq 0x8778e
movl $0x5b8, %edi            # imm = 0x5B8
callq 0x56700
movq %rax, %r15
andq $0x0, 0x8(%rsp)
xorl %r12d, %r12d
movq %r14, %rdi
xorl %esi, %esi
callq 0x56280
testb %al, %al
je 0x86576
leaq 0x5c0(%rbx), %rdi
xorl %r12d, %r12d
xorl %esi, %esi
callq 0x574f0
testb %al, %al
je 0x86576
xorl %eax, %eax
cmpq $0x0, 0x5b8(%rbx)
pushq $-0xc
popq %r12
cmovel %eax, %r12d
addl 0xb0(%rbx), %r12d
movl 0xb4(%rbx), %eax
shlq $0x20, %rax
orq %rax, %r12
leaq 0x10(%rsp), %rdx
movq %r12, (%rdx)
leaq 0x8(%rsp), %rsi
movq %r15, %rdi
callq 0x56aa0
movq %r15, 0x600(%rbx)
addq $0x338, %r15            # imm = 0x338
leaq 0x478(%rbx), %rsi
movq %r15, %rdi
callq 0x71412
movq %r14, %rdi
xorl %esi, %esi
callq 0x56280
testb %al, %al
je 0x86606
leaq 0x5c0(%rbx), %rdi
xorl %esi, %esi
callq 0x574f0
cmpq $0x0, 0x5b8(%rbx)
setne %cl
andb %cl, %al
cmpb $0x1, %al
jne 0x86606
movl $0x2f8, %edi            # imm = 0x2F8
addq 0x600(%rbx), %rdi
movq 0xdb884(%rip), %rsi     # 0x161e80
xorl %edx, %edx
movq %rbx, %rcx
callq 0x8778e
movq 0x5f8(%rbx), %rsi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x30(%rax)
movq 0x600(%rbx), %rsi
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x30(%rax)
andq $0x0, 0x5f0(%rbx)
leaq 0x298(%rbx), %rdi
movq 0xdb78c(%rip), %rsi     # 0x161dc8
xorl %edx, %edx
movq %rbx, %rcx
callq 0x8782a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x8666e
jmp 0x8666e
jmp 0x8666e
jmp 0x8666e
jmp 0x8665c
movq %rax, %r14
movl $0x5b8, %esi            # imm = 0x5B8
movq %r15, %rdi
callq 0x564c0
jmp 0x86671
movq %rax, %r14
movq %rbx, %rdi
callq 0x57180
movq %r14, %rdi
callq 0x58260
nop