/[james]/archive/wimplibs/Menu/6
ViewVC logotype

Annotation of /archive/wimplibs/Menu/6

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (hide annotations) (download)
Thu Sep 25 18:54:17 2003 UTC (21 years, 3 months ago) by james
File size: 4249 byte(s)
Initial import.

1 james 32 REM > JLibraries:Menu.6
2     REM © James Bursa, 1997, 1998
3    
4     REM JB 17 Nov 1997 created
5     REM JB 06 Dec 1997 updates to Mess.2
6     REM JB 09 Oct 1998 altered PROCMenu_PopUp to use window handle not name
7    
8    
9     DEF PROCMenu_AttachSub(Menu$, Item$, Subm$)
10     LOCAL Menu%
11     Menu% = FNObject_Hand(2, Menu$, 0)
12     Menu%!(28 + FNObject_Hand(3, Item$, Menu%) * 24 + 4) = FNObject_Hand(2, Subm$, 0)
13     ENDPROC
14    
15     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
16    
17     DEF FNMenu_CountItems(Menu$)
18     LOCAL Size%, Menu%
19     Size% = 28
20     Menu% = FNObject_Hand(2, Menu$, 0)
21     IF (Menu%!Size%) AND (1 << 7) THEN =1
22     REPEAT
23     Size% += 24
24     UNTIL (Menu%!Size%) AND (1 << 7)
25     =((Size% - 28) / 24) + 1
26    
27     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
28    
29     DEF PROCMenu_IconBar(Menu$)
30     LOCAL YPos%, Item%, Loop%, Menu%
31    
32     Menu% = FNObject_Hand(2, Menu$, 0)
33     SYS"Wimp_GetPointerInfo",, B% + 400
34    
35     Item% = FNMenu_CountItems(Menu$)
36     YPos% = Item% * 44
37     FOR Loop% = 1 TO Item%
38     IF Menu%!(4 + 24 * Loop%) AND 1<<1 THEN YPos% += 24
39     NEXT
40    
41     SYS"Wimp_CreateMenu",, Menu%, B%!400 - (Menu%!16 / 2), YPos% + 96
42     Menu_Current% = Menu%
43     Menu_Current$ = Menu$
44     ENDPROC
45    
46     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
47    
48     DEF PROCMenu_Show(Menu$, XPos%, YPos%)
49     LOCAL Menu%
50     Menu% = FNObject_Hand(2, Menu$, 0)
51     SYS"Wimp_CreateMenu",, Menu%, XPos%, YPos%
52     Menu_Current% = Menu%
53     Menu_Current$ = Menu$
54     ENDPROC
55    
56     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
57    
58     DEF PROCMenu_Adjust(Menu$)
59     LOCAL Adju%, Menu%
60    
61     Menu% = FNObject_Hand(2, Menu$, 0)
62     SYS"Wimp_GetPointerInfo",, B% + 400
63     Adju% = (B%!408 AND 1) OR Menu_Open%
64     IF Adju% = 0 THEN ENDPROC
65    
66     SYS"Wimp_CreateMenu",, Menu%
67     Menu_Open% = FALSE
68    
69     ENDPROC
70    
71     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
72    
73     DEF PROCMenu_Window(Wind$)
74     LOCAL Buff%, BuffB%, XPos%, YPos%, Wind%
75    
76     Wind% = FNObject_Hand(0, Wind$, 0)
77    
78     SYS"Wimp_GetPointerInfo",, B% + 400
79     XPos% = B%!400
80     YPos% = B%!404
81    
82     B%!400 = Wind%
83     SYS"Wimp_GetWindowState",, B% + 400
84     XPos% = XPos% + (B%!404 - B%!412) / 2
85     YPos% = YPos% - (B%!408 - B%!416) / 2
86    
87     SYS"Wimp_CreateMenu",, Wind%, XPos%, YPos%
88    
89     ENDPROC
90    
91     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
92    
93     DEF PROCMenu_Make(Menu$, Name$)
94     LOCAL Itms%, Temp%, Menu%, Item%, Subn%, Item$, Subm$, P%, Flag%
95    
96     Itms% = 1
97     Temp% = INSTR(Menu$, ",")
98     WHILE Temp% <> 0
99     Itms% += 1
100     Temp% = INSTR(Menu$, ",", Temp% + 1)
101     ENDWHILE
102    
103     DIM Menu% 28 + 24 * Itms%
104     P% = Menu%
105     Temp% = FNMess_Adr(Name$ + "_Titl", File_Menu%)
106     [OPT 2
107     EQUD Temp%
108     EQUD -1
109     EQUD LEN($Temp%)
110     EQUD &00070207
111     EQUD 100
112     EQUD 44
113     EQUD 0
114     ]
115    
116     FOR Item% = 1 TO Itms%
117    
118     Item$ = LEFT$(Menu$, INSTR(Menu$, ",") - 1)
119     Flag% = 0
120     Subn% = -1
121     IF LEFT$(Item$, 1) = "€" THEN Item$ = MID$(Item$, 2): Flag% += (1<<0)
122     IF LEFT$(Item$, 1) = "-" THEN Item$ = MID$(Item$, 2): Flag% += (1<<1)
123     IF LEFT$(Item$, 1) = "@" THEN Item$ = MID$(Item$, 2): Flag% += (1<<2)
124     IF LEFT$(Item$, 1) = "+" THEN Item$ = MID$(Item$, 2): Flag% += (1<<3)
125     IF Item% = Itms% THEN Flag% += (1<<7)
126     IF Item% = 1 THEN Flag% += (1<<8)
127     IF LEFT$(Item$, 1) = ">" THEN
128     Item$ = MID$(Item$, 2)
129     Subm$ = LEFT$(Item$, INSTR(Item$, "<") - 1)
130     Item$ = MID$(Item$, LENSubm$ + 2)
131     CASE LEFT$(Subm$, 1) OF
132     WHEN "W"
133     Subn% = FNObject_Hand(0, MID$(Subm$, 2), 0)
134     WHEN "I"
135     Subn% = 1
136     OTHERWISE
137     PROCMenu_Make(FNMess_Lookup(Subm$, File_Menu%), Subm$)
138     Subn% = FNObject_Hand(2, Subm$, 0)
139     ENDCASE
140     ENDIF
141     Temp% = FNMess_Adr(Name$ + "_" + Item$, File_Menu%)
142     [OPT 2
143     EQUD Flag%
144     EQUD Subn%
145     EQUD &07000111
146     EQUD Temp%
147     EQUD -1
148     EQUD LEN($Temp%)
149     ]
150     IF NOT Menu_Fast% THEN PROCObject_Add(3, Item% - 1, Menu%, Item$)
151     Menu$ = MID$(Menu$, INSTR(Menu$, ",") + 1)
152     NEXT
153    
154     SYS"WimpExt_MenuWidth",, Menu%
155     IF Menu%!16 < 112 THEN Menu%!16 = 112
156     PROCObject_Add(2, Menu%, 0, Name$)
157     ENDPROC
158    
159     REM ˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜˜
160    
161     DEF PROCMenu_PopUp(Menu$)
162     LOCAL XPos%, YPos%
163    
164     B%!400 = W%
165     SYS"Wimp_GetWindowState",, B% + 400
166     XPos% = B%!404 - B%!420
167     YPos% = B%!416 - B%!424
168    
169     B%!400 = W%
170     B%!404 = I%
171     SYS"Wimp_GetIconState",, B% + 400
172     XPos% += B%!416
173     YPos% += B%!420
174    
175     PROCMenu_Show(Menu$, XPos%, YPos%)
176    
177     ENDPROC

  ViewVC Help
Powered by ViewVC 1.1.26