templeos-info/public/Wb/Demo/PullDownMenu.HC.HTML

121 lines
9.7 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF2>//See </span><span class=cF4><u>Menus</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></u>#</span><span class=cF1>define</span><span class=cF0> M_OPTION1 1
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> M_OPTION2 2
<a name="l5"></a>
<a name="l6"></a></span><span class=cF1>U0</span><span class=cF0> PullDownMenuDemo()
<a name="l7"></a>{
<a name="l8"></a> </span><span class=cF9>I64</span><span class=cF0> msg_code,arg1,arg2;
<a name="l9"></a> </span><span class=cF9>CMenuEntry</span><span class=cF0> *tmpse;
<a name="l10"></a>
<a name="l11"></a> </span><span class=cF5>MenuPush</span><span class=cF0>(
<a name="l12"></a> </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l13"></a> </span><span class=cF6>&quot; Open(,'O');&quot;</span><span class=cF0>
<a name="l14"></a> </span><span class=cF6>&quot; Save(,'S');&quot;</span><span class=cF0>
<a name="l15"></a> </span><span class=cF6>&quot; Exit(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l16"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l17"></a> </span><span class=cF6>&quot;Edit {&quot;</span><span class=cF0>
<a name="l18"></a> </span><span class=cF6>&quot; Cut(,,SC_DELETE|SCF_SHIFT);&quot;</span><span class=cF0>
<a name="l19"></a> </span><span class=cF6>&quot; Paste(,,SC_INS|SCF_SHIFT);&quot;</span><span class=cF0>
<a name="l20"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l21"></a> </span><span class=cF6>&quot;Misc {&quot;</span><span class=cF0>
<a name="l22"></a> </span><span class=cF6>&quot; Beep(,CH_SPACE);&quot;</span><span class=cF0>
<a name="l23"></a> </span><span class=cF6>&quot; Opt1(MSG_CMD,M_OPTION1);&quot;</span><span class=cF0>
<a name="l24"></a> </span><span class=cF6>&quot; Opt2(MSG_CMD,M_OPTION2);&quot;</span><span class=cF0>
<a name="l25"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l26"></a> </span><span class=cF6>&quot;Help {&quot;</span><span class=cF0>
<a name="l27"></a> </span><span class=cF6>&quot; Help(,,0x3B0000003B);&quot;</span><span class=cF0>
<a name="l28"></a> </span><span class=cF6>&quot; About(,,0x23B0000023B);&quot;</span><span class=cF0>
<a name="l29"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>);
<a name="l30"></a>
<a name="l31"></a> </span><span class=cF6>&quot;A pull-down menu will appear &quot;</span><span class=cF0>
<a name="l32"></a> </span><span class=cF6>&quot;if you move the mouse to the top &quot;</span><span class=cF0>
<a name="l33"></a> </span><span class=cF6>&quot;of the scrn.\n\n&quot;</span><span class=cF0>;
<a name="l34"></a>
<a name="l35"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l36"></a> msg_code=</span><span class=cF5>GetMsg</span><span class=cF0>(&amp;arg1,&amp;arg2,1&lt;&lt;</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>+1&lt;&lt;</span><span class=cF3>MSG_CMD</span><span class=cF0>);
<a name="l37"></a> </span><span class=cF6>&quot;\nCmd:%d ARG1:%X ARG2:%X\n\n&quot;</span><span class=cF0>,msg_code,arg1,arg2;
<a name="l38"></a>
<a name="l39"></a> </span><span class=cF1>switch</span><span class=cF0> (msg_code) {
<a name="l40"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>:
<a name="l41"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1) </span><span class=cF7>{</span><span class=cF2>//ASCII</span><span class=cF0>
<a name="l42"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
<a name="l43"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l44"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l45"></a> </span><span class=cF1>case</span><span class=cF0> 0:
<a name="l46"></a> </span><span class=cF1>switch</span><span class=cF0> (arg2.u8[0]) {</span><span class=cF2>//arg2=Scan code</span><span class=cF0>
<a name="l47"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F1</span><span class=cF0>:
<a name="l48"></a> </span><span class=cF1>if</span><span class=cF0> (arg2&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l49"></a> </span><span class=cF6>&quot;About PullDown Demo\n&quot;</span><span class=cF0>;
<a name="l50"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l51"></a> </span><span class=cF6>&quot;Test the menu.\n&quot;</span><span class=cF0>;
<a name="l52"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l53"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_DELETE</span><span class=cF0>:
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (arg2&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l55"></a> </span><span class=cF6>&quot;Cut\n&quot;</span><span class=cF0>;
<a name="l56"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l57"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_INS</span><span class=cF0>:
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (arg2&amp;</span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l59"></a> </span><span class=cF6>&quot;Paste\n&quot;</span><span class=cF0>;
<a name="l60"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l61"></a> }
<a name="l62"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l63"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l64"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l65"></a>
<a name="l66"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MSG_CMD</span><span class=cF0>:
<a name="l67"></a></span><span class=cF2>//I Recommend making your menu</span><span class=cF0>
<a name="l68"></a> </span><span class=cF2>//drive by key strokes, but you can</span><span class=cF0>
<a name="l69"></a> </span><span class=cF2>//use the </span><a href="/Wb/Kernel/KernelA.HH.HTML#l3175"><span class=cF4>MSG_CMD</span></a><span class=cF2> val.</span><span class=cF0>
<a name="l70"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1) </span><span class=cF7>{</span><span class=cF0>
<a name="l71"></a> </span><span class=cF1>case</span><span class=cF0> M_OPTION1:
<a name="l72"></a> </span><span class=cF6>&quot;Option # 1\n&quot;</span><span class=cF0>;
<a name="l73"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse=</span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu,</span><span class=cF6>&quot;Misc/Opt1&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l74"></a> tmpse-&gt;checked=!tmpse-&gt;checked;
<a name="l75"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l76"></a> </span><span class=cF1>case</span><span class=cF0> M_OPTION2:
<a name="l77"></a> </span><span class=cF6>&quot;Option # 2\n&quot;</span><span class=cF0>;
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (tmpse=</span><span class=cF5>MenuEntryFind</span><span class=cF7>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_menu,</span><span class=cF6>&quot;Misc/Opt2&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l79"></a> tmpse-&gt;checked=!tmpse-&gt;checked;
<a name="l80"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l81"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l82"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l83"></a> }
<a name="l84"></a>
<a name="l85"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>while</span><span class=cF0> (msg_code!=</span><span class=cF3>MSG_KEY_DOWN</span><span class=cF0>||</span><span class=cF7>(</span><span class=cF0>arg1!=</span><span class=cF3>CH_SHIFT_ESC</span><span class=cF0> &amp;&amp; arg1!=</span><span class=cF3>CH_ESC</span><span class=cF7>)</span><span class=cF0>);
<a name="l86"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l87"></a>}
<a name="l88"></a>
<a name="l89"></a>PullDownMenuDemo;
</span></pre></body>
</html>