ZealOS/docs/Demo/PullDownMenu.CC.html
TomAwezome 6b3fd2fecb Rename abs_addres to abs_address.
Update documentation/comments to rename addr, fun, var, stmt, blk, desc, reg, seg, ptr, dup, clus, val, and bttn, to address, function, variable, statement, block, description, register, segment, pointer, duplicate, cluster, value, and button, respectively.
2021-10-06 21:35:32 -04:00

128 lines
11 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.01">
<style type="text/css">
body {background-color:#fef1f0;}
.cF0{color:#000000;background-color:#fef1f0;}
.cF1{color:#0148a4;background-color:#fef1f0;}
.cF2{color:#3b7901;background-color:#fef1f0;}
.cF3{color:#057c7e;background-color:#fef1f0;}
.cF4{color:#bb2020;background-color:#fef1f0;}
.cF5{color:#9e42ae;background-color:#fef1f0;}
.cF6{color:#b57901;background-color:#fef1f0;}
.cF7{color:#b2b6af;background-color:#fef1f0;}
.cF8{color:#555753;background-color:#fef1f0;}
.cF9{color:#678fbb;background-color:#fef1f0;}
.cFA{color:#82bc49;background-color:#fef1f0;}
.cFB{color:#0097a2;background-color:#fef1f0;}
.cFC{color:#e26a6a;background-color:#fef1f0;}
.cFD{color:#c671bc;background-color:#fef1f0;}
.cFE{color:#c7ab00;background-color:#fef1f0;}
.cFF{color:#fef1f0;background-color:#fef1f0;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<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 </span><span class=cFE>1</span><span class=cF0>
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> M_OPTION2 </span><span class=cFE>2</span><span class=cF0>
<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> message_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>( </span><span class=cF6>&quot;File {&quot;</span><span class=cF0>
<a name="l12"></a> </span><span class=cF6>&quot; Open(,'O');&quot;</span><span class=cF0>
<a name="l13"></a> </span><span class=cF6>&quot; Save(,'S');&quot;</span><span class=cF0>
<a name="l14"></a> </span><span class=cF6>&quot; Exit(,CH_SHIFT_ESC);&quot;</span><span class=cF0>
<a name="l15"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l16"></a> </span><span class=cF6>&quot;Edit {&quot;</span><span class=cF0>
<a name="l17"></a> </span><span class=cF6>&quot; Cut(,,SC_DELETE|SCF_SHIFT);&quot;</span><span class=cF0>
<a name="l18"></a> </span><span class=cF6>&quot; Paste(,,SC_INS|SCF_SHIFT);&quot;</span><span class=cF0>
<a name="l19"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l20"></a> </span><span class=cF6>&quot;Misc {&quot;</span><span class=cF0>
<a name="l21"></a> </span><span class=cF6>&quot; Beep(,CH_SPACE);&quot;</span><span class=cF0>
<a name="l22"></a> </span><span class=cF6>&quot; Opt1(MESSAGE_CMD,M_OPTION1);&quot;</span><span class=cF0>
<a name="l23"></a> </span><span class=cF6>&quot; Opt2(MESSAGE_CMD,M_OPTION2);&quot;</span><span class=cF0>
<a name="l24"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>
<a name="l25"></a> </span><span class=cF6>&quot;Help {&quot;</span><span class=cF0>
<a name="l26"></a> </span><span class=cF6>&quot; Help(,,0x3B0000003B);&quot;</span><span class=cF0>
<a name="l27"></a> </span><span class=cF6>&quot; About(,,0x23B0000023B);&quot;</span><span class=cF0>
<a name="l28"></a> </span><span class=cF6>&quot;}&quot;</span><span class=cF0>);
<a name="l29"></a>
<a name="l30"></a> </span><span class=cF6>&quot;A pull-down menu will appear &quot;</span><span class=cF0>
<a name="l31"></a> </span><span class=cF6>&quot;if you move the mouse to the top &quot;</span><span class=cF0>
<a name="l32"></a> </span><span class=cF6>&quot;of the screen.\n\n&quot;</span><span class=cF0>;
<a name="l33"></a>
<a name="l34"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l35"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l36"></a> message_code = </span><span class=cF5>MessageGet</span><span class=cF0>(&amp;arg1, &amp;arg2, </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>MESSAGE_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>, message_code, arg1, arg2;
<a name="l38"></a>
<a name="l39"></a> </span><span class=cF1>switch</span><span class=cF0> (message_code)
<a name="l40"></a> {
<a name="l41"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_KEY_DOWN</span><span class=cF0>:
<a name="l42"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
<a name="l43"></a> </span><span class=cF7>{</span><span class=cF2>//ASCII</span><span class=cF0>
<a name="l44"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>CH_SPACE</span><span class=cF0>:
<a name="l45"></a> </span><span class=cF5>Beep</span><span class=cF0>;
<a name="l46"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l47"></a>
<a name="l48"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
<a name="l49"></a> </span><span class=cF1>switch</span><span class=cF0> (arg2.u8[</span><span class=cFE>0</span><span class=cF0>])
<a name="l50"></a> {</span><span class=cF2>//arg2=Scan code</span><span class=cF0>
<a name="l51"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_F1</span><span class=cF0>:
<a name="l52"></a> </span><span class=cF1>if</span><span class=cF0> (arg2 &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l53"></a> </span><span class=cF6>&quot;About PullDown Demo\n&quot;</span><span class=cF0>;
<a name="l54"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l55"></a> </span><span class=cF6>&quot;Test the menu.\n&quot;</span><span class=cF0>;
<a name="l56"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l57"></a>
<a name="l58"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_DELETE</span><span class=cF0>:
<a name="l59"></a> </span><span class=cF1>if</span><span class=cF0> (arg2 &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l60"></a> </span><span class=cF6>&quot;Cut\n&quot;</span><span class=cF0>;
<a name="l61"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l62"></a>
<a name="l63"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>SC_INS</span><span class=cF0>:
<a name="l64"></a> </span><span class=cF1>if</span><span class=cF0> (arg2 &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l65"></a> </span><span class=cF6>&quot;Paste\n&quot;</span><span class=cF0>;
<a name="l66"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l67"></a> }
<a name="l68"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l69"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l70"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l71"></a>
<a name="l72"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>MESSAGE_CMD</span><span class=cF0>:
<a name="l73"></a> </span><span class=cF2>//Feel free to make your menu</span><span class=cF0>
<a name="l74"></a> </span><span class=cF2>//drive by key strokes, but you can</span><span class=cF0>
<a name="l75"></a> </span><span class=cF2>//use the </span><a href="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l3888"><span class=cF4>MESSAGE_CMD</span></a><span class=cF2> value.</span><span class=cF0>
<a name="l76"></a> </span><span class=cF1>switch</span><span class=cF0> (arg1)
<a name="l77"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l78"></a> </span><span class=cF1>case</span><span class=cF0> M_OPTION1:
<a name="l79"></a> </span><span class=cF6>&quot;Option # 1\n&quot;</span><span class=cF0>;
<a name="l80"></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="l81"></a> tmpse-&gt;checked = !tmpse-&gt;checked;
<a name="l82"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l83"></a>
<a name="l84"></a> </span><span class=cF1>case</span><span class=cF0> M_OPTION2:
<a name="l85"></a> </span><span class=cF6>&quot;Option # 2\n&quot;</span><span class=cF0>;
<a name="l86"></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="l87"></a> tmpse-&gt;checked = !tmpse-&gt;checked;
<a name="l88"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l89"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l90"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l91"></a> }
<a name="l92"></a>
<a name="l93"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l94"></a> </span><span class=cF1>while</span><span class=cF0> (message_code != </span><span class=cF3>MESSAGE_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="l95"></a>
<a name="l96"></a> </span><span class=cF5>MenuPop</span><span class=cF0>;
<a name="l97"></a>}
<a name="l98"></a>
<a name="l99"></a>PullDownMenuDemo;
</span></pre></body>
</html>