- Added the properties dialog
[reactos.git] / rosapps / dflat32 / menu.c
1 /* ------------- menu.c ------------- */
2
3 #include "dflat.h"
4
5 static struct DfPopDown *FindCmd(DF_MBAR *mn, int cmd)
6 {
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)
12 return pd;
13 pd++;
14 }
15 mnu++;
16 }
17 return NULL;
18 }
19
20 char *DfGetCommandText(DF_MBAR *mn, int cmd)
21 {
22 struct DfPopDown *pd = FindCmd(mn, cmd);
23 if (pd != NULL)
24 return pd->SelectionTitle;
25 return NULL;
26 }
27
28 BOOL DfIsCascadedCommand(DF_MBAR *mn, int cmd)
29 {
30 struct DfPopDown *pd = FindCmd(mn, cmd);
31 if (pd != NULL)
32 return pd->Attrib & DF_CASCADED;
33 return FALSE;
34 }
35
36 void DfActivateCommand(DF_MBAR *mn, int cmd)
37 {
38 struct DfPopDown *pd = FindCmd(mn, cmd);
39 if (pd != NULL)
40 pd->Attrib &= ~DF_INACTIVE;
41 }
42
43 void DfDeactivateCommand(DF_MBAR *mn, int cmd)
44 {
45 struct DfPopDown *pd = FindCmd(mn, cmd);
46 if (pd != NULL)
47 pd->Attrib |= DF_INACTIVE;
48 }
49
50 BOOL isActive(DF_MBAR *mn, int cmd)
51 {
52 struct DfPopDown *pd = FindCmd(mn, cmd);
53 if (pd != NULL)
54 return !(pd->Attrib & DF_INACTIVE);
55 return FALSE;
56 }
57
58 BOOL DfGetCommandToggle(DF_MBAR *mn, int cmd)
59 {
60 struct DfPopDown *pd = FindCmd(mn, cmd);
61 if (pd != NULL)
62 return (pd->Attrib & DF_CHECKED) != 0;
63 return FALSE;
64 }
65
66 void DfSetCommandToggle(DF_MBAR *mn, int cmd)
67 {
68 struct DfPopDown *pd = FindCmd(mn, cmd);
69 if (pd != NULL)
70 pd->Attrib |= DF_CHECKED;
71 }
72
73 void DfClearCommandToggle(DF_MBAR *mn, int cmd)
74 {
75 struct DfPopDown *pd = FindCmd(mn, cmd);
76 if (pd != NULL)
77 pd->Attrib &= ~DF_CHECKED;
78 }
79
80 void DfInvertCommandToggle(DF_MBAR *mn, int cmd)
81 {
82 struct DfPopDown *pd = FindCmd(mn, cmd);
83 if (pd != NULL)
84 pd->Attrib ^= DF_CHECKED;
85 }