2000-03-05 19:58:08 +00:00
|
|
|
/* ------------- menu.c ------------- */
|
|
|
|
|
|
|
|
#include "dflat.h"
|
|
|
|
|
2003-06-19 02:48:13 +00:00
|
|
|
static struct DfPopDown *FindCmd(DF_MBAR *mn, int cmd)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
DF_MENU *mnu = mn->PullDown;
|
2000-03-05 19:58:08 +00:00
|
|
|
while (mnu->Title != (void *)-1) {
|
2003-06-19 02:48:13 +00:00
|
|
|
struct DfPopDown *pd = mnu->Selections;
|
2000-03-05 19:58:08 +00:00
|
|
|
while (pd->SelectionTitle != NULL) {
|
|
|
|
if (pd->ActionId == cmd)
|
|
|
|
return pd;
|
|
|
|
pd++;
|
|
|
|
}
|
|
|
|
mnu++;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-06-19 02:48:13 +00:00
|
|
|
char *DfGetCommandText(DF_MBAR *mn, int cmd)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
struct DfPopDown *pd = FindCmd(mn, cmd);
|
2000-03-05 19:58:08 +00:00
|
|
|
if (pd != NULL)
|
|
|
|
return pd->SelectionTitle;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-06-19 02:48:13 +00:00
|
|
|
BOOL DfIsCascadedCommand(DF_MBAR *mn, int cmd)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
struct DfPopDown *pd = FindCmd(mn, cmd);
|
2000-03-05 19:58:08 +00:00
|
|
|
if (pd != NULL)
|
2003-06-19 02:48:13 +00:00
|
|
|
return pd->Attrib & DF_CASCADED;
|
2000-03-05 19:58:08 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-06-19 02:48:13 +00:00
|
|
|
void DfActivateCommand(DF_MBAR *mn, int cmd)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
struct DfPopDown *pd = FindCmd(mn, cmd);
|
2000-03-05 19:58:08 +00:00
|
|
|
if (pd != NULL)
|
2003-06-19 02:48:13 +00:00
|
|
|
pd->Attrib &= ~DF_INACTIVE;
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
|
|
|
|
2003-06-19 02:48:13 +00:00
|
|
|
void DfDeactivateCommand(DF_MBAR *mn, int cmd)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
struct DfPopDown *pd = FindCmd(mn, cmd);
|
2000-03-05 19:58:08 +00:00
|
|
|
if (pd != NULL)
|
2003-06-19 02:48:13 +00:00
|
|
|
pd->Attrib |= DF_INACTIVE;
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
|
|
|
|
2003-06-19 02:48:13 +00:00
|
|
|
BOOL isActive(DF_MBAR *mn, int cmd)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
struct DfPopDown *pd = FindCmd(mn, cmd);
|
2000-03-05 19:58:08 +00:00
|
|
|
if (pd != NULL)
|
2003-06-19 02:48:13 +00:00
|
|
|
return !(pd->Attrib & DF_INACTIVE);
|
2000-03-05 19:58:08 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-06-19 02:48:13 +00:00
|
|
|
BOOL DfGetCommandToggle(DF_MBAR *mn, int cmd)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
struct DfPopDown *pd = FindCmd(mn, cmd);
|
2000-03-05 19:58:08 +00:00
|
|
|
if (pd != NULL)
|
2003-06-19 02:48:13 +00:00
|
|
|
return (pd->Attrib & DF_CHECKED) != 0;
|
2000-03-05 19:58:08 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-06-19 02:48:13 +00:00
|
|
|
void DfSetCommandToggle(DF_MBAR *mn, int cmd)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
struct DfPopDown *pd = FindCmd(mn, cmd);
|
2000-03-05 19:58:08 +00:00
|
|
|
if (pd != NULL)
|
2003-06-19 02:48:13 +00:00
|
|
|
pd->Attrib |= DF_CHECKED;
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
|
|
|
|
2003-06-19 02:48:13 +00:00
|
|
|
void DfClearCommandToggle(DF_MBAR *mn, int cmd)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
struct DfPopDown *pd = FindCmd(mn, cmd);
|
2000-03-05 19:58:08 +00:00
|
|
|
if (pd != NULL)
|
2003-06-19 02:48:13 +00:00
|
|
|
pd->Attrib &= ~DF_CHECKED;
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|
|
|
|
|
2003-06-19 02:48:13 +00:00
|
|
|
void DfInvertCommandToggle(DF_MBAR *mn, int cmd)
|
2000-03-05 19:58:08 +00:00
|
|
|
{
|
2003-06-19 02:48:13 +00:00
|
|
|
struct DfPopDown *pd = FindCmd(mn, cmd);
|
2000-03-05 19:58:08 +00:00
|
|
|
if (pd != NULL)
|
2003-06-19 02:48:13 +00:00
|
|
|
pd->Attrib ^= DF_CHECKED;
|
2000-03-05 19:58:08 +00:00
|
|
|
}
|