home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
MM1
/
GRAPHICS
/
jpegshow_2.0.lzh
/
JPEGSHOW
/
openwin.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-03-22
|
2KB
|
79 lines
#include <stdio.h>
#include <signal.h>
#include <wind.h>
#include <mouse.h>
#include <signal.h>
#define MAIN
#include <stdmenu.h>
#include <buffs.h>
#include <math.h>
#define MS_SIG 200
#define MN_NEXT 30
MNDSCR wnmen[] =
{
{{"Next"}, MN_NEXT, 6, 0, 1}
};
WNDSCR windat = {
"Jpegshow", sizeof(wnmen) / sizeof(wnmen[0]), 40, 10, WINSYNC, wnmen};
int wtype = WT_FSWIN | WC_MOVE | WC_GROW;
int gotsig;
int h_pos, v_pos;
MSRET ms;
int repaint(int x, int y);
openwin(int actwin)
{
register int mx, my;
windat._wnmen = wnmen;
Palette(actwin, 251, 100, 100, 100); /* highlighting */
Palette(actwin, 252, 150, 150, 150); /* shadow */
Palette(actwin, 253, 0, 0, 0); /* background */
Palette(actwin, 254, 180, 180, 180); /* foreground */
Palette(actwin, 255, 180, 180, 180); /* border */
Mn_Colors(actwin, 254, 253, 255, 251, 252);
_ss_wset(actwin, wtype, &windat);
Select(actwin);
Font(actwin, GRP_FONT, FNT_G8X8);
_ss_sbar(actwin, h_pos, v_pos);
}
mmenu(int actwin)
{
int sel, item;
for (;;) {
_ss_msig(actwin, MS_SIG);
sleep(0);
if (gotsig != MS_SIG)
continue;
_gs_mouse(actwin, &ms);
if (ms.pt_area != WR_CNTRL) /* not control region - ignore */
continue;
sel = _gs_msel(actwin, &item);
switch ( sel ) {
case MN_CLOS: kill(getpid(), SIGINT);
case MN_NEXT: return;
case MN_HSCRL:
if ( repaint(item, v_pos) ) {
h_pos = item;
_ss_sbar(actwin, h_pos, v_pos);
}
break;
case MN_VSCRL:
if ( repaint(h_pos, item) ) {
v_pos = item;
_ss_sbar(actwin, h_pos, v_pos);
}
break;
default:
}
}
}