home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
C
/
OMEGA2
/
T_BUTTON.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-25
|
3KB
|
82 lines
//
// *************************************************************************
// * *
// * T_Button Demonstration #1 *
// * *
// * OMEGA C++ Windowing Class Library *
// * ================================= *
// * *
// * Copyright 1991,92 Tom Clancy *
// * Submitted to the public domain, April 1992 *
// * *
// *************************************************************************
//
#include <dos.h>
#include "omscreen.hpp"
#include "ombutton.hpp"
class mybuttons : public oButton {
public:
mybuttons();
int handle_key_event();
int handle_mouse_event();
};
mybuttons::mybuttons() {
setwindow(1,1,50,13,WHITE,BLUE,DOUBLEBAR);
settitle(" Test Buttons ",tCenter,BLACK,CYAN);
setshadow(ON,shBottomright);
addbutton(" 1 ",2, 2,BLACK,GREEN,WHITE,GREEN);
addbutton(" 2 ",2, 4,BLACK,GREEN,WHITE,GREEN);
addbutton(" 3 ",2, 6,BLACK,GREEN,WHITE,GREEN);
addbutton(" 4 ",2, 8,BLACK,GREEN,WHITE,GREEN);
addbutton(" 5 ",2,10,BLACK,GREEN,WHITE,GREEN);
addbutton(" OK ",12, 2,BLACK,GREEN,WHITE,GREEN);
addbutton(" Edit ",12, 4,BLACK,GREEN,WHITE,GREEN);
addbutton(" Delete ",12, 6,BLACK,GREEN,WHITE,GREEN);
addbutton(" Cancel ",12, 8,BLACK,GREEN,WHITE,GREEN);
addbutton(" Help ",12,10,BLACK,GREEN,WHITE,GREEN);
addbutton(" OK ",22, 2,BLACK,GREEN,WHITE,GREEN);
addbutton(" Edit ",22, 4,BLACK,GREEN,WHITE,GREEN);
addbutton(" Delete ",22, 6,BLACK,GREEN,WHITE,GREEN);
addbutton(" Cancel ",22, 8,BLACK,GREEN,WHITE,GREEN);
addbutton(" Help ",22,10,BLACK,GREEN,WHITE,GREEN);
}
int mybuttons::handle_key_event() {
inc c=oWindow::handle_key_event();
if(!c)
c=oButton::handle_key_event();
return c;
}
int mybuttons::handle_mouse_event() {
int c=oWindow::handle_mouse_event();
if(c==cmdWithinwin)
c=oButton::handle_mouse_event();
return c;
}
main () {
initmouse();
OMEGA_SETUP();
oScreen S;
S.setvga50();
S.fillscreen(LIGHTGRAY,WHITE,176);
S.showmouse();
mybuttons B;
B.snaptocenter();
B.run();
S.setvidmode(v80x25);
S.hidemouse();
S.setfgcolor(WHITE);
S.setbkcolor(BLACK);
S.clrscr();
return 0;
}