home *** CD-ROM | disk | FTP | other *** search
- //
- // *************************************************************************
- // * *
- // * T_Button Demonstration #2 *
- // * *
- // * OMEGA C++ Windowing Class Library *
- // * ================================= *
- // * *
- // * Copyright 1991,92 Tom Clancy *
- // * Submitted to the public domain, April 1992 *
- // * *
- // *************************************************************************
- //
-
- #include "omscreen.hpp"
- #include "ombutton.hpp"
-
- class mybuttons : public oButton {
- public:
- mybuttons();
- int handle_key_event();
- int handle_mouse_event();
- void run();
- };
-
- mybuttons::mybuttons() {
- int x,y;
- setwindow(1,1,80,24,WHITE,LIGHTGRAY,DOUBLEBAR);
- settitle(" Lotsa Buttons ",tCenter,BLACK,LIGHTGRAY);
- setsolidheader(OFF);
- for(y=1; y<=10; y++)
- for(x=1; x<=10; x++)
- addbutton(" PUSH ",8*(x-1)+1,2*y,BLACK,GREEN,WHITE,GREEN);
- }
-
- int mybuttons::handle_mouse_event() {
- int c=oWindow::handle_mouse_event();
- if(c==cmdWithinwin)
- c=oButton::handle_mouse_event();
- return c;
- }
-
- int mybuttons::handle_key_event() {
- int c=oWindow::handle_key_event();
- if(!c)
- c=oButton::handle_key_event();
- return c;
- }
-
- void mybuttons::run() {
- while(getlastcmd()!=cmdClose)
- handle_events();
- }
-
- main() {
- initmouse();
- OMEGA_SETUP;
-
- oScreen s;
- s.setvga50();
- mybuttons b;
- s.fillscreen(WHITE,BLUE,32);
- s.cursoroff();
- b.activate_virtual();
- b.openwin();
- b.deactivate_virtual();
- s.showmouse();
- b.run();
- s.fillscreen(WHITE,BLACK,32);
- s.hidemouse();
- s.cursoron();
- }
-
-