{(k gt;=0 amp; amp; k lt; n) mItem [k] .submenu=mn; gt; supmenu=this;
} Menu :: Show (void) {(int i=0; i lt; n; i ++) mItem [i] .item- gt; Show ();=1;
} Menu :: Hide (void) {* smn=NULL; (selected gt;=0) smn=mItem [selected] .submenu; (smn) smn- gt; Hide (); ( int i=0; i lt; n; i ++) mItem [i] .item- gt; Hide ();=- 1;=0;
} Menu :: setSelect (int k) {(mItem [k] .enabled) {[k] .item- gt; setStatus (1); (selected gt;=0) mItem [selected ] .item- gt; setStatus (0);=k;
}
} Menu :: setEnable (int k) {(k!=selected) mItem [k] .item- gt; setStatus (0); [k] .enabled=1; ();
} Menu :: setDisable (int k) {(k!=selected) mItem [k] .item- gt; setStatus (- 1); [k] .enabled=0; ();
} Menu :: Forward (void) {* smn=NULL; i; (i=selected + 1; i lt; n; i ++) if (mItem [i] .enabled) break; (i lt ;=n - 1) {[i] .item- gt; setStatus (1); (selected gt;=0) {[selected] .item- gt; setStatus (0);=mItem [selected] .submenu;
} (smn) {/ * smn- gt; selected=- 1 * /; smn- gt; Hide (); }=I;
}
} Menu :: Backward (void) {i; (i=selected - 1; i gt;=0; i--) if (mItem [i] .enabled) break; (i gt;= 0) {[i] .item- gt; setStatus (1); [selected] .item- gt; setStatus (0); * smn=mItem [selected] .submenu; (smn) {/ * smn- gt; selected =- 1 * /; smn- gt; Hide (); }=I;
} else if (supmenu) {= - 1; ();
}
} Menu :: Upward (void) {* mn=this, * mn1=NULL; (mn- gt; selected gt;=0 amp; amp; (mn1=mn- gt; mItem [ mn- gt; selected] .submenu) amp; amp; mn1- gt; visible) mn=mn1; gt; Backward ();
} Menu :: Downward (void) {* mn=this, * mn1=NULL; (mn- gt; selected gt;=0 amp; amp; (mn1=mn- gt; mItem [ mn- gt; selected] .submenu) amp; amp; mn1- gt; visible) mn=mn1; gt; Forward ();
} Menu :: setSubMenu (int i, Menu * mn) {(i gt;=0 amp; amp; i lt; n) mItem [i] .submenu=mn;
} * Menu :: getSubMenu (int i) {(i gt;=0 amp; amp; i lt; n) return mItem [i] .submenu; NULL;
} Menu :: getSelected (void) {selected;
}
Додаток 9. Файл Listbox.h
# ifndef LISTBOX_H
# define LISTBOX_H
# ifndef STR_MAX
# define STR_MAX 255
# endif
# define STR_LEN 79
# define LINE_HEIGHT 20ListBox; ListItem {: x, y, w, h; * lbx;: text [STR_LEN + 1]; (void); (int, int, int, int, char * );
~ ListItem (void); setText (char *); Show (void); Erase (void);
}; ListBox {: x, y, w, h; n; * lItem [STR_MAX]; :( void); (int, int, int, int);
~ ListBox (void); Add (char *); AddSeveral (int); UpdateRow (int, char *); Clear (void); Show (void); Erase (void); Count ( void);
};
# endif/* LISTBOX_H */
Додаток 10. Файл Listbox.cpp
# include lt; cstdlib gt;
# include lt; cstdio gt;
# include lt; graphics.h gt;
# include listbox.h :: ListItem () {= 0; y=0; w=100; h=LINE_HEIGHT; (text, );=NULL;
} :: ListItem (int xx, int yy, int ww, int hh, char * s) {= xx; y=yy; w=ww; h=hh; (text, s, STR_LEN - 1); [STR_LEN]= 0 raquo ;;=NULL; ();
} :: ~ ListItem () {();
} ListItem :: setText (char * s) {(text, s, STR_LEN + 1); (strlen (s) gt; STR_LEN) text [STR_LEN + 1]= 0 ;
} ListItem :: Show () {(); clr=getcolor (); (BLUE); (x, y, x + w, y + h); (clr); (BLUE) ; ht=textheight (text); (x + 5, y + (h-ht)/2, text);
} ListItem :: Erase () {
//int clr=getcolor ();
//setcolor (BLUE); (x, y, x + w - 1, y + h);
//setcolor (clr);
} :: ListBox () {// puts ( ListBox () );=0; y=0; w=200; h=100;=0; (int i=0; i lt; STR_MAX; i ++) lItem [i]=NULL; ();
} :: ListBox (int xx, int yy, int ww, int hh) {s [STR_LEN];=xx; y=yy; w=ww; h=hh;=0; ();
} :: ~ ListBox () {// puts ( ~ ListBox () ); (int i=0; i lt; n; i ++) if (lItem [i]) delete lItem [i];
} ListBox :: Add (char * s) {(n lt; 8) {[n]=New ListItem (x + 1, y + n * LINE_HEIGHT + 1, w, LINE_HEIGHT, s); ++;
}
} ListBox :: AddSeveral (i...