1(* 2 Copyright (c) 2001 3 David C.J. Matthews 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with this library; if not, write to the Free Software 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18*) 19 20(* Edit windows. *) 21structure Edit: 22sig 23 structure Style: 24 sig 25 (* We use the same type so we can use this everywhere we can use 26 the general window style. *) 27 include BIT_FLAGS where type flags = Window.Style.flags 28 val WS_OVERLAPPED: flags and WS_POPUP: flags and WS_CHILD: flags and WS_MINIMIZE: flags 29 and WS_VISIBLE: flags and WS_DISABLED:flags and WS_CLIPSIBLINGS:flags 30 and WS_CLIPCHILDREN:flags and WS_MAXIMIZE:flags and WS_CAPTION:flags 31 and WS_BORDER:flags and WS_DLGFRAME:flags and WS_VSCROLL:flags and WS_HSCROLL:flags 32 and WS_SYSMENU:flags and WS_THICKFRAME:flags and WS_GROUP:flags and WS_TABSTOP:flags 33 and WS_MINIMIZEBOX:flags and WS_MAXIMIZEBOX:flags and WS_TILED:flags and WS_ICONIC:flags 34 and WS_SIZEBOX:flags and WS_OVERLAPPEDWINDOW:flags and WS_TILEDWINDOW:flags 35 and WS_POPUPWINDOW:flags and WS_CHILDWINDOW:flags 36 and ES_LEFT: flags and ES_CENTER:flags and ES_RIGHT:flags and ES_MULTILINE:flags 37 and ES_UPPERCASE: flags and ES_LOWERCASE: flags and ES_PASSWORD: flags 38 and ES_AUTOVSCROLL: flags and ES_AUTOHSCROLL: flags and ES_NOHIDESEL: flags 39 and ES_OEMCONVERT: flags and ES_READONLY: flags and ES_WANTRETURN: flags and ES_NUMBER: flags 40 end 41 42 structure Notifications: 43 sig 44 val EN_SETFOCUS: int 45 val EN_KILLFOCUS: int 46 val EN_CHANGE: int 47 val EN_UPDATE: int 48 val EN_ERRSPACE: int 49 val EN_MAXTEXT: int 50 val EN_HSCROLL: int 51 val EN_VSCROLL: int 52 end 53end 54= 55struct 56 structure Style = 57 struct 58 open Window.Style (* Include all the windows styles. *) 59 60 val ES_LEFT: flags = fromWord 0wx0000 61 val ES_CENTER: flags = fromWord 0wx0001 62 val ES_RIGHT: flags = fromWord 0wx0002 63 val ES_MULTILINE: flags = fromWord 0wx0004 64 val ES_UPPERCASE: flags = fromWord 0wx0008 65 val ES_LOWERCASE: flags = fromWord 0wx0010 66 val ES_PASSWORD: flags = fromWord 0wx0020 67 val ES_AUTOVSCROLL: flags = fromWord 0wx0040 68 val ES_AUTOHSCROLL: flags = fromWord 0wx0080 69 val ES_NOHIDESEL: flags = fromWord 0wx0100 70 val ES_OEMCONVERT: flags = fromWord 0wx0400 71 val ES_READONLY: flags = fromWord 0wx0800 72 val ES_WANTRETURN: flags = fromWord 0wx1000 73 val ES_NUMBER: flags = fromWord 0wx2000 74 75 val all = flags[Window.Style.all, ES_LEFT, ES_CENTER, ES_RIGHT, ES_MULTILINE, 76 ES_UPPERCASE, ES_LOWERCASE, ES_PASSWORD, ES_AUTOVSCROLL, 77 ES_AUTOHSCROLL, ES_NOHIDESEL, ES_OEMCONVERT, ES_READONLY, 78 ES_WANTRETURN, ES_NUMBER] 79 80 val intersect = 81 List.foldl (fn (a, b) => fromWord(SysWord.andb(toWord a, toWord b))) all 82 end 83 84 structure Notifications = 85 struct 86 val EN_SETFOCUS = 0x0100 87 val EN_KILLFOCUS = 0x0200 88 val EN_CHANGE = 0x0300 89 val EN_UPDATE = 0x0400 90 val EN_ERRSPACE = 0x0500 91 val EN_MAXTEXT = 0x0501 92 val EN_HSCROLL = 0x0601 93 val EN_VSCROLL = 0x0602 94 end 95end; 96 97(* 98let 99 open Edit.Style 100 101 val flagTable = 102 [(ES_CENTER, "ES_CENTER"), 103 (ES_RIGHT, "ES_RIGHT"), 104 (ES_MULTILINE, "ES_MULTILINE"), 105 (ES_UPPERCASE, "ES_UPPERCASE"), 106 (ES_LOWERCASE, "ES_LOWERCASE"), 107 (ES_PASSWORD, "ES_PASSWORD"), 108 (ES_AUTOVSCROLL, "ES_AUTOVSCROLL"), 109 (ES_AUTOHSCROLL, "ES_AUTOHSCROLL"), 110 (ES_NOHIDESEL, "ES_NOHIDESEL"), 111 (ES_OEMCONVERT, "ES_OEMCONVERT"), 112 (ES_READONLY, "ES_READONLY"), 113 (ES_WANTRETURN, "ES_WANTRETURN"), 114 (ES_NUMBER, "ES_NUMBER"), 115 (WS_POPUP, "WS_POPUP"), 116 (WS_CHILD, "WS_CHILD"), 117 (WS_MINIMIZE, "WS_MINIMIZE"), 118 (WS_VISIBLE, "WS_VISIBLE"), 119 (WS_DISABLED, "WS_DISABLED"), 120 (WS_CLIPSIBLINGS, "WS_CLIPSIBLINGS"), 121 (WS_CLIPCHILDREN, "WS_CLIPCHILDREN"), 122 (WS_MAXIMIZE, "WS_MAXIMIZE"), 123 (WS_CAPTION, "WS_CAPTION"), 124 (WS_BORDER, "WS_BORDER"), 125 (WS_DLGFRAME, "WS_DLGFRAME"), 126 (WS_VSCROLL, "WS_VSCROLL"), 127 (WS_HSCROLL, "WS_HSCROLL"), 128 (WS_SYSMENU, "WS_SYSMENU"), 129 (WS_THICKFRAME, "WS_THICKFRAME"), 130 (WS_GROUP, "WS_GROUP"), 131 (WS_TABSTOP, "WS_TABSTOP"), 132 (WS_MINIMIZEBOX, "WS_MINIMIZEBOX"), 133 (WS_MAXIMIZEBOX, "WS_MAXIMIZEBOX")] 134 135 fun accumulateFlags f [] = [] 136 | accumulateFlags f ((w, s)::t) = 137 if allSet(w, f) then s :: accumulateFlags(clear(w, f)) t 138 else accumulateFlags f t 139 140 fun printFlags(put, beg, brk, nd) depth _ x = 141 (* This is just the code to print a list. *) 142 let 143 144 val stringFlags = accumulateFlags x flagTable 145 fun plist [] depth = () 146 | plist _ 0 = put "..." 147 | plist [h] depth = put h 148 | plist (h::t) depth = 149 ( put (h^","); 150 brk (1, 0); 151 plist t (depth - 1) 152 ) 153 in 154 beg (3, false); 155 put "["; 156 if depth <= 0 then put "..." else plist stringFlags depth; 157 put "]"; 158 nd () 159 end 160in 161 PolyML.install_pp printFlags 162end; 163*)