//	Zinc Application Framework - Z_PLLDN.CPP
//	COPYRIGHT (C) 1990-1999.  All Rights Reserved.
//	Zinc Software Incorporated.  Pleasant Grove, Utah  USA

#include <z_plldn.hpp>
#define ZAF_PULLDOWN_INFO
#include "gbl_def.cpp"

ZafPullDownMenu *ZafWindow::PullDownMenu(void) const
{
	for (ZafWindowObject *object = SupportFirst(); object; object = object->Next())
		if (object->NumberID() == ZAF_NUMID_PULL_DOWN_MENU)
			return (DynamicPtrCast(object, ZafPullDownMenu));
	return (ZAF_NULLP(ZafPullDownMenu));
}

// ----- ZafPullDownMenu ----------------------------------------------------

static ZafStringID _stringID = ZAF_ITEXT("ZAF_NUMID_PULL_DOWN_MENU");

ZafPullDownMenu::ZafPullDownMenu(void) :
	ZafWindow(0, 0, 0, 0)
{
	// Initialize the pull-down menu information.
#   if !defined(ZAF_TEXT_MODE)
	SetBordered(true);
#   else
    SetBordered(false);
#   endif
	SetDestroyable(false);
	SetMoveable(false);
	SetNormalHotKeys(true);
	SetNumberID(ZAF_NUMID_PULL_DOWN_MENU);
	SetSizeable(false);
	SetRegionType(ZAF_AVAILABLE_REGION);
	SetStringID(_stringID);
	SetSupportObject(true);

#	if defined(ZAF_MACINTOSH)
	updateMenuBar = true;
#	endif
}

ZafPullDownMenu::ZafPullDownMenu(const ZafPullDownMenu &copy) :
	ZafWindow(copy)
{
#	if defined(ZAF_MACINTOSH)
	updateMenuBar = true;
#	endif
	SetNumberID(ZAF_NUMID_PULL_DOWN_MENU);
}

ZafPullDownMenu::~ZafPullDownMenu(void)
{
	// No menu information needs to be destroyed.
}

ZafWindowObject *ZafPullDownMenu::Duplicate(void)
{
	return (new ZafPullDownMenu(*this));
}

bool ZafPullDownMenu::IsA(ZafClassID compareID) const
{
	return ((compareID == classID) ? true : ZafWindow::IsA(compareID));
}

bool ZafPullDownMenu::IsA(ZafClassName compareName) const
{
	return (!strcmp(compareName, className) ? true : ZafWindow::IsA(compareName));
}

bool ZafPullDownMenu::SetAcceptDrop(bool )
{
	// acceptDrop is false for this class.
	acceptDrop = false;
	return (acceptDrop);
}

bool ZafPullDownMenu::SetBordered(bool )
{
	// bordered is true for this class.
	bordered = true;
	return (bordered);
}

bool ZafPullDownMenu::SetDestroyable(bool )
{
	// destroyable is false for this class.
	destroyable = false;
	return (destroyable);
}

bool ZafPullDownMenu::SetDisabled(bool )
{
	// disabled is false for this class.
	disabled = false;
	return (disabled);
}

bool ZafPullDownMenu::SetLocked(bool )
{
	// locked is false for this class.
	locked = false;
	return (locked);
}

bool ZafPullDownMenu::SetMaximized(bool )
{
	// maximized is false for this class.
	maximized = false;
	return (maximized);
}

bool ZafPullDownMenu::SetMinimized(bool )
{
	// minimized is false for this class.
	minimized = false;
	return (minimized);
}

bool ZafPullDownMenu::SetModal(bool )
{
	// modal is false for this class.
	modal = false;
	return (modal);
}

bool ZafPullDownMenu::SetMoveable(bool )
{
	// moveable is false for this class.
	moveable = false;
	return (moveable);
}

bool ZafPullDownMenu::SetNoncurrent(bool )
{
	// noncurrent is false for this class.
	noncurrent = false;
	return (noncurrent);
}

bool ZafPullDownMenu::SetNormalHotKeys(bool )
{
	// normalHotKeys is true for this class.
	normalHotKeys = true;
	return (normalHotKeys);
}

ZafWindow *ZafPullDownMenu::SetOwner(ZafWindow *)
{
	// owner is null for this class.
	owner = ZAF_NULLP(ZafWindow);
	return (owner);
}

bool ZafPullDownMenu::SetParentPalette(bool )
{
	// parentPalette is false for this class.
	parentPalette = false;
	return (parentPalette);
}

ZafRegionType ZafPullDownMenu::SetRegionType(ZafRegionType )
{
	// regionType is ZAF_AVAILABLE_REGION for this class.
	regionType = ZAF_AVAILABLE_REGION;
	return (regionType);
}

ZafSelectionType ZafPullDownMenu::SetSelectionType(ZafSelectionType )
{
	// selectionType is ZAF_SINGLE_SELECTION for this class.
	selectionType = ZAF_SINGLE_SELECTION;
	return (selectionType);
}

bool ZafPullDownMenu::SetSizeable(bool )
{
	// sizeable is false for this class.
	sizeable = false;
	return (sizeable);
}

bool ZafPullDownMenu::SetSupportObject(bool )
{
	// supportObject is true for this class.
	supportObject = true;
	return (supportObject);
}

bool ZafPullDownMenu::SetTemporary(bool )
{
	// temporary is false for this class.
	temporary = false;
	return (temporary);
}

// ----- Persistent functions -----------------------------------------------
#if defined(USE_ZAF_PERSISTENCE)
ZafPullDownMenu::ZafPullDownMenu(const ZafIChar *name, ZafObjectPersistence &persist) :
	ZafWindow(name, persist.PushLevel(className, classID, ZAF_PERSIST_DIRECTORY))
{
#	if defined(ZAF_MACINTOSH)
	updateMenuBar = true;
#	endif

	persist.PopLevel();
	if (persist.Error() != ZAF_ERROR_NONE)
		SetError(persist.Error());
	SetNumberID(ZAF_NUMID_PULL_DOWN_MENU);
}

ZafElement *ZafPullDownMenu::Read(const ZafIChar *name, ZafObjectPersistence &persist)
{
	return (new ZafPullDownMenu(name, persist));
}

void ZafPullDownMenu::Write(ZafObjectPersistence &persist)
{
	// Write the object.
	ZafWindow::Write(persist.PushLevel(className, classID, ZAF_PERSIST_DIRECTORY));
	persist.PopLevel();
	if (persist.Error() != ZAF_ERROR_NONE)
		SetError(persist.Error());
}
#endif
