File: MenuBase.sml

package info (click to toggle)
polyml 5.8.1-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 57,736 kB
  • sloc: cpp: 44,918; ansic: 26,921; asm: 13,495; sh: 4,670; makefile: 610; exp: 525; python: 253; awk: 91
file content (73 lines) | stat: -rw-r--r-- 3,162 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
(*
    Copyright (c) 2001, 2015
        David C.J. Matthews

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License version 2.1 as published by the Free Software Foundation.
    
    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.
    
    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*)

structure MenuBase =
struct
    local
        open Foreign Base
    in
        (* TODO: This duplicates some of the other datatypes. *)
        datatype MenuFlag =
            (*MF_INSERT | MF_CHANGE | MF_APPEND | MF_DELETE | MF_REMOVE | *)
            MF_BYCOMMAND | MF_BYPOSITION | MF_SEPARATOR | MF_ENABLED | MF_GRAYED |
            MF_DISABLED | MF_UNCHECKED | MF_CHECKED | MF_USECHECKBITMAPS | MF_STRING |
            MF_BITMAP | MF_OWNERDRAW | MF_POPUP | MF_MENUBARBREAK | MF_MENUBREAK |
            MF_UNHILITE | MF_HILITE | MF_DEFAULT | MF_SYSMENU | MF_HELP |
            MF_RIGHTJUSTIFY | MF_MOUSESELECT

        local
            val tab = [
                (*(MF_INSERT,   0wx00000000),
                (MF_CHANGE,     0wx00000080),
                (MF_APPEND,     0wx00000100),
                (MF_DELETE,     0wx00000200),
                (MF_REMOVE,     0wx00001000),*)
                (MF_BYCOMMAND,  0wx00000000),
                (MF_BYPOSITION, 0wx00000400),
                (MF_SEPARATOR,  0wx00000800),
                (MF_ENABLED,    0wx00000000),
                (MF_GRAYED,     0wx00000001),
                (MF_DISABLED,   0wx00000002),
                (MF_UNCHECKED,  0wx00000000),
                (MF_CHECKED,    0wx00000008),
                (MF_USECHECKBITMAPS, 0wx00000200),
                (MF_STRING,     0wx00000000),
                (MF_BITMAP,     0wx00000004),
                (MF_OWNERDRAW,  0wx00000100),
                (MF_POPUP,      0wx00000010),
                (MF_MENUBARBREAK, 0wx00000020),
                (MF_MENUBREAK,  0wx00000040),
                (MF_UNHILITE,   0wx00000000),
                (MF_HILITE,     0wx00000080),
                (MF_DEFAULT,    0wx00001000),
                (MF_SYSMENU,    0wx00002000),
                (MF_HELP,       0wx00004000),
                (MF_RIGHTJUSTIFY, 0wx00004000),
                (MF_MOUSESELECT, 0wx00008000)
             ]
        in
            val (fromMenuFlagSet, toMenuFlagSet) = tableSetLookup(tab, NONE)
            val cMENUFLAGSET = absConversion {abs=toMenuFlagSet, rep=fromMenuFlagSet} cUintw
            (* Sometimes we just want a single flag - either MF_BYCOMMAND or MF_BYPOSITION
               or, for WM_MENUCHAR, MF_POPUP or MF_SYSMENU. *)
            val (fromMenuFlag, toMenuFlag) = tableLookup(tab, NONE)
            val cMENUFLAG = tableConversion(tab, NONE) cUintw
        end

    end
end;