1 /* ------------- menu.c ------------- */
5 static struct DfPopDown
*FindCmd(DF_MBAR
*mn
, int cmd
)
7 DF_MENU
*mnu
= mn
->PullDown
;
8 while (mnu
->Title
!= (void *)-1) {
9 struct DfPopDown
*pd
= mnu
->Selections
;
10 while (pd
->SelectionTitle
!= NULL
) {
11 if (pd
->ActionId
== cmd
)
20 char *DfGetCommandText(DF_MBAR
*mn
, int cmd
)
22 struct DfPopDown
*pd
= FindCmd(mn
, cmd
);
24 return pd
->SelectionTitle
;
28 BOOL
DfIsCascadedCommand(DF_MBAR
*mn
, int cmd
)
30 struct DfPopDown
*pd
= FindCmd(mn
, cmd
);
32 return pd
->Attrib
& DF_CASCADED
;
36 void DfActivateCommand(DF_MBAR
*mn
, int cmd
)
38 struct DfPopDown
*pd
= FindCmd(mn
, cmd
);
40 pd
->Attrib
&= ~DF_INACTIVE
;
43 void DfDeactivateCommand(DF_MBAR
*mn
, int cmd
)
45 struct DfPopDown
*pd
= FindCmd(mn
, cmd
);
47 pd
->Attrib
|= DF_INACTIVE
;
50 BOOL
isActive(DF_MBAR
*mn
, int cmd
)
52 struct DfPopDown
*pd
= FindCmd(mn
, cmd
);
54 return !(pd
->Attrib
& DF_INACTIVE
);
58 BOOL
DfGetCommandToggle(DF_MBAR
*mn
, int cmd
)
60 struct DfPopDown
*pd
= FindCmd(mn
, cmd
);
62 return (pd
->Attrib
& DF_CHECKED
) != 0;
66 void DfSetCommandToggle(DF_MBAR
*mn
, int cmd
)
68 struct DfPopDown
*pd
= FindCmd(mn
, cmd
);
70 pd
->Attrib
|= DF_CHECKED
;
73 void DfClearCommandToggle(DF_MBAR
*mn
, int cmd
)
75 struct DfPopDown
*pd
= FindCmd(mn
, cmd
);
77 pd
->Attrib
&= ~DF_CHECKED
;
80 void DfInvertCommandToggle(DF_MBAR
*mn
, int cmd
)
82 struct DfPopDown
*pd
= FindCmd(mn
, cmd
);
84 pd
->Attrib
^= DF_CHECKED
;