void
JXDisplayMenu::BuildMenu()
{
	RemoveAllItems();

	JXApplication* app = JXGetApplication();
	const JSize count = app->GetDisplayCount();
	for (JIndex i=1; i<=count; i++)
		{
		JXDisplay* display = app->GetDisplay(i);
		AppendItem(display->GetName(), kRadioType);
		}

	ShowSeparatorAfter(count);
	AppendItem(kNewDisplayStr);
	itsNewDisplayIndex = count+1;

	SetUpdateAction(kDisableNone);

	const JBoolean found =
		(JXGetApplication())->GetDisplayIndex(GetDisplay(), &itsDisplayIndex);
	assert( found );

	ListenTo(this);
	ListenTo( (JXGetApplication())->GetDisplayList() );
}
void
JXCurrentPathMenu::SetPath
	(
	const JCharacter* path
	)
{
	RemoveAllItems();

	JString p = path;
	JCleanPath(&p);

	JString p1, n;
	while (!JIsRootDirectory(p))
		{
		JStripTrailingDirSeparator(&p);
		JSplitPathAndName(p, &p1, &n);
		PrependItem(n);
		SetItemImage(1, GetIcon(p), kJFalse);
		p = p1;
		}

	PrependItem(p);
	SetItemImage(1, GetIcon(p), kJFalse);

	const JXImage* image = NULL;
	GetItemImage(GetItemCount(), &image);
	SetTitle(GetItemText(GetItemCount()), const_cast<JXImage*>(image), kJFalse);
	SetUpdateAction(kDisableNone);
}
void
JXDocumentMenu::JXDocumentMenuX()
{
	itsDocMgr = JXGetDocumentManager();

	ListenTo(this);
	ListenTo(itsDocMgr);

	SetUpdateAction(kDisableNone);
}
void
SCNodeMenu::BuildMenu()
{
	RemoveAllItems();

	const JSize nodeCount = itsCircuit->GetNodeCount();
	for (JIndex i=1; i<=nodeCount; i++)
		{
		const JString& nodeName = itsCircuit->GetNodeName(i);
		AppendItem(nodeName, kJTrue, kJTrue);
		}

	SetUpdateAction(kDisableNone);

	itsNodeIndex = 1;
	ListenTo(this);
}
void
JXFontCharSetMenu::BuildMenu
	(
	const JCharacter*	fontName,
	const JSize			fontSize
	)
{
	RemoveAllItems();

	JPtrArray<JString> charSetList(JPtrArrayT::kDeleteAll);
	if (!(GetFontManager())->GetFontCharSets(fontName, fontSize, &charSetList))
		{
		itsCurrIndex = 0;
		itsCharSet.Clear();
		StopListening(this);
		return;
		}

	const JSize count = charSetList.GetElementCount();
	JString id;
	for (JIndex i=1; i<=count; i++)
		{
		const JString* charSet = charSetList.NthElement(i);
		id                     = *charSet + "::JX";
		AppendItem(*charSet, kJTrue, kJTrue, NULL, NULL, id);
		}

	SetUpdateAction(kDisableNone);

	itsCurrIndex = 1;
	itsCharSet   = *(charSetList.FirstElement());

	StopListening(this);
	JString name, charSet;
	if (JFontManager::ExtractCharacterSet(fontName, &name, &charSet))
		{
		SetCharSet(charSet);
		}
	else
		{
		SelectDefaultCharSet();
		}
	ListenTo(this);
}
void
SCComponentMenu::BuildMenu()
{
	RemoveAllItems();

	const JSize compCount = itsCompList->GetElementCount();
	for (JIndex i=1; i<=compCount; i++)
		{
		const JIndex compIndex  = itsCompList->GetElement(i);
		const SCComponent* comp = itsCircuit->GetComponent(compIndex);
		const JString& compName = comp->GetName();
		AppendItem(compName, kJTrue, kJTrue);
		}

	SetUpdateAction(kDisableNone);

	itsMenuIndex = 1;
	ListenTo(this);
}
JXStringCompletionMenu::JXStringCompletionMenu
	(
	JXTEBase*		te,
	const JBoolean	allowTabChar
	)
	:
	JXTextMenu("*", te, kFixedLeft, kFixedTop, 0,0, 10,10),
	itsAllowTabChar(allowTabChar)
{
	itsTE           = te;
	itsRequestCount = 0;
	itsPrefixLength = 0;

	Hide();
	SetToHiddenPopupMenu(kJTrue);
	CompressHeight();
	SetUpdateAction(kDisableNone);
	ListenTo(this);
}
GMDirectorMenu::GMDirectorMenu
	(
	const JCharacter*	title,
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXTextMenu(title, enclosure, hSizing, vSizing, x,y, w,h)
{
	ListenTo(this);
	ListenTo(GGetDirMgr());
	GGetDirMgr()->UpdateDirectorMenu(this);
	SetUpdateAction(JXMenu::kDisableNone);
}
WizChatShortcutMenu::WizChatShortcutMenu
	(
	JXInputField*		message,
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXTextMenu("", enclosure, hSizing, vSizing, x,y, w,h)
{
	itsMessage = message;

	SetUpdateAction(kDisableNone);
	ListenTo(this);
	ListenTo(WizGetConnectionManager());
}
void
CBFunctionMenu::CBFunctionMenuX
	(
	JXFileDocument*			doc,
	const CBTextFileType	type,
	JXTEBase*				te
	)
{
	itsDoc            = doc;
	itsFileType       = kCBUnknownFT;
	itsLang           = kCBOtherLang;
	itsTE             = te;
	itsCaretItemIndex = 0;

	itsLineIndexList = jnew JArray<JIndex>(100);
	assert( itsLineIndexList != NULL );

	SetEmptyMenuItems();
	SetUpdateAction(kDisableNone);
	ListenTo(this);

	TextChanged(type, "");
}