$B$3$N>O$NL\
$BA0JG(B:2.2 $B%G%#%9%W%l%$!&%i%$%V%i%jDj5A$K$b$I$k(B
$B

2.3 $B%&%#%s%I%&%$%Y%s%H(B

$B""(B $B%&%#%s%I%&%$%Y%s%H(B

IMPORT  WEVENT  wevt;

$B""(B $B%&%#%s%I%&>pJs%l%3!<%I(B

typedef struct {
    W   wid;        /* $B%&%#%s%I%&(BID */
    W   chgmod;     /* $B%&%#%s%I%&B0@-(B */
                    /* 0x10+(W_MOVE/W_MOVEC/WHOLD):$BA4LL%b!<%I2D(B */
                    /* 0x20 : $B%I%i%C%0JQ7A6X;_(B */
                    /* 0x40 : $B%I%i%C%00\F06X;_(B */
    RECT    limit;  /* $BJQ7A%j%_%C%H(B */
    W   pid[3];     /* $B%9%/%m!<%k%P!<%Q!<%D(BID */
    W   info[2];    /* $B%"%W%j%1!<%7%g%sMQ(B */
} WINFOREC;
typedef WINFOREC *WINFOPTR;

$B""(B $B%&%#%s%I%&%$%Y%s%H4X?t%F!<%V%k(B

typedef struct {
    W       (*bgfn)(void);              /* $B%P%C%/%0%i%&%s%I=hM}(B */
    VOID    (*idlefn)(void);            /* idle $B=hM}(B */
    W       (*msgfn)(MESSAGE *msg);     /* $B0lHL%a%C%;!<%8=hM}(B */
    W       (*menufn)(void);            /* $B%a%K%e!<=hM}(B */
    VOID    (*dspfn)(W ix, W mode, RECT *new);  /* $BI=<(=hM}(B */
    VOID    (*stsfn)(W ix, W sts);      /* $B>uBVJQ2==hM}(B */
    W       (*keyfn)(void);             /* $B%-!?HMW5a%$%Y%s%H=hM}(B */
} WFUNCREC;
typedef WFUNCREC    *WFUNCPTR;
IMPORT  FUNCP       p_oprc_dev;
evt_loop
 
$B%$%Y%s%H%k!<%W=hM}(B

$B!Z7A<0![(B

W   evt_loop(WFUNCPTR wf, WINFOPTR wi)

$B!Z%Q%i%a!<%?![(B

WFUNCPTR    wf  $B%&%#%s%I%&%$%Y%s%H4X?t%F!<%V%k$X$N%]%$%s%?(B
WINFOPTR    wi  $B%&%#%s%I%&>pJs%l%3!<%I$X$N%]%$%s%?(B

$B!Z%j%?!<%sCM![(B

$B!a(B 0    $B=hM}7QB3(B
$B!b(B 0    $B=hM}=*N;(B

$B!Z2r@b![(B

$B%$%Y%s%H%k!<%W=hM}$r]$H$9$k%U%!%$%k(B ( $BpJs$r

$B3F%$%Y%s%H=hM}4X?t$GLa$5$l$?CM$rJV$9!#(B

$B%$%Y%s%H%k!<%W=hM}$G$O!"=g

wi $B$O!";HMQ$9$k%&%#%s%I%&$K4X$9$kB0@-$r<($9!"(B $B0J2<$N%&%#%s%I%&>pJs%l%3!<%IG[Ns$X$N%]%$%s%?$G$"$k!#(B

typedef struct {
    W           wid;    -- $B%&%#%s%I%&(BID(0$B$O:G8e!"(B< 0 $B$OL58z(B)
    W        chgmod;    -- $B%&%#%s%I%&B0@-(B
    RECT      limit;    -- $BJQ7A%j%_%C%H(B
    W        pid[3];    -- $B%9%/%m!<%k%P!pJs(B
} WINFOREC;
    typedef WINFOREC  *WINFOPTR;

$B%&%#%s%I%&>pJs%l%3!<%IG[Ns$O!"(B $B;HMQ$9$k%&%#%s%I%&$N8D?t(B + 1 $B$NMWAG$,I,MW$G$"$j!"(B $B:G8e$NMWAG$N(B wid $B$O(B 0 $B$G$J$1$l$P$J$i$J$$!#(B $B%&%#%s%I%&>pJs%l%3!<%IG[Ns$NFbMF$O!"(Bevt_loop() $B$r$C$F!"%&%#%s%I%&$N?t<+BN$,F0E*$KJQ2=$9$k>l9g$O!"(B $B$"$i$+$8$a(B $B:GBg?t(B + 1 $B$NMWAG$N%&%#%s%I%&>pJs%l%3!<%IG[Ns$rMQ0U$7$F$*$-!"(B $BL58z$J%&%#%s%I%&$KBP$7$F$O!$(Bwid $B$H$7$FIi$NCM$r@_Dj$7$F$*$/$3$H$K$J$k!#(B

$B%&%#%s%I%&>pJs%l%3!<%IG[Ns>e$G$N%$%s%G%C%/%9CM(B ( 0 $B!A(B ) $B$O!"(B $BBP>]%&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H$7$?>l9g$K$O!"(B wrsz_drg() $B$N(B limit $B%Q%i%a!<%?$O(B NULL $B$H$5$l$k!#(B

$B%9%/%m!<%k%P!evt_loop() $B

    pid[0]  -- $B1&%9%/%m!<%k%P!<(B ( < 0 $B$OL$@_Dj$r0UL#$9$k(B)
    pid[1]  -- $B2<%9%/%m!<%k%P!<(B ( < 0 $B$OL$@_Dj$r0UL#$9$k(B)
    pid[2]  -- $B:8%9%/%m!<%k%P!<(B ( < 0 $B$OL$@_Dj$r0UL#$9$k(B)

$B$?$@$7!"(Bevt_loop()$Bl9g!"(B $B$=$NDI2C$7$?%&%#%s%I%&$N>pJs$KBP$7$F$O<+F0E*$K@_Dj$5$l$J$$$N$G!"(B $B%"%W%j%1!<%7%g%s$NB&$G@_Dj$7$J$1$l$P$J$i$J$$!#(B $B!J%9%/%m!<%k%P!<$r;}$D>l9g$OBP1~$9$k%9%/%m!<%k%P!l9g$O!"(B $BIi$NCM$r@_Dj$7$J$1$l$P$J$i$J$$!K(B

$B%"%W%j%1!<%7%g%s>pJs$O!"(B $B%"%W%j%1!<%7%g%sB&$GG$0U$K;HMQ$G$-$k%G!<%?$G$"$j!"(B evt_loop() $B4X?t$G$O!"(B $B;2>H$bJQ99$b$7$J$$%G!<%?$G$"$k!#(B

wf $B$O!"%&%#%s%I%&!&%$%Y%s%H$KBP1~$9$k4X?t$r<($9!"(B $B%&%#%s%I%&!&%$%Y%s%H4X?t%F!<%V%k$X$N%F!<%V%k$X$N%]%$%s%?$G$"$k!#(B $B$3$NFbMF$b!"(Bevt_loop() $Bl9g$K$O(B NULL $B$H$7$FNI$$$b$N$b$"$k$,!"(B $B$$$/$D$+$N4X?t$OI,$:@_Dj$7$J$/$F$O$$$1$J$$!#(B

typedef struct {
    W       (*bgfn)(void);              /* $B%P%C%/%0%i%&%s%I=hM}(B */
    VOID    (*idlefn)(void);            /* idle $B=hM}(B */
    W       (*msgfn)(MESSAGE *msg);     /* $B0lHL%a%C%;!<%8=hM}(B */
    W       (*menufn)(void);            /* $B%a%K%e!<=hM}(B */
    VOID    (*dspfn)(W ix, W mode, RECT *new);  /* $BI=<(=hM}(B */
    VOID    (*stsfn)(W ix, W sts);      /* $B>uBVJQ2==hM}(B */
    W       (*keyfn)(void);             /* $B%-!?HMW5a%$%Y%s%H=hM}(B */
} WFUNCREC;

typedef WFUNCREC *WFUNCPTR;

$B@\;HMQ$9$k$3$H$,$G$-$k!#(B

    IMPORT WEVENT wevt;

$B%$%Y%s%H%k!<%W=hM}$G$O!"(B $B4pK\E*$K!"(B $B%$%Y%s%H$N

$B!|(B $B%P%C%/%0%i%&%s%I=hM}!'(B W (*bgfn)(void);

$B%&%#%s%I%&$,F~NOuBV$G$J$$>l9g$N%P%C%/%0%i%&%s%I=hM}$N$?$a$N4X?t$G$"$j!"(B wf->bgfn$B!a(B NULL $B$N>l9g$O!"(B $B%&%#%s%I%&!&%$%Y%s%H$O(B WAIT $B%b!<%I$GNULL $B$G$J$$>l9g$O!"%&%#%s%I%&!&%$%Y%s%H$O(B NOWAIT $B%b!<%I$GEV_NOMSG $B$,F@$i$l$?>l9g!"(B $B$3$N4X?t$,

$B4X?tCM(B $B!b(B 0 $B$N>l9g$O!"(Bevt_loop() $B$+$i%j%?!<%s$7!"(B evt_loop() $B$N4X?tCM$O!"(Bbgfn() $B$N4X?tCM$H$J$k!#(B

$B!|(B IDLE$B=hM}!'(B VOID (*idlefn)(void);

EV_NULL $B$,F@$i$l$?>l9g$K $BDL>o$O!"%]%$%s%?7A>u$NJQ99(B ( $B<+%&%#%s%I%&Fb$K%]%$%s%?$,$"$k;~(B )$B!"(B $B%+%l%C%H(B / $BA*BrNN0h$N%A%i%D%-=hM}Ey$r9T$&!#(B
wf->idlefn $B!a(B NULL $B$N>l9g$O2?$b$7$J$$!#(B

$B!|(B $B0lHL%a%C%;!<%8=hM}!'(B W (*msgfn)(MESSAGE *msg);

EV_MSG $B$,F@$i$l$?>l9g$Kmsg $B$O!"(B $BF@$i$l$?0lHL%a%C%;!<%8$N@hF,(B 4 $B%P%$%H$,3JG<$5$l$F$$$kNN0h$X$N%]%$%s%?$G$"$k!#(B

$B$3$N4X?t$G$O!"(Brsv_msg() $B$K$h$j%a%C%;!<%8$r

$B4X?tCM!b(B 0 $B$N>l9g$O!"(Bevt_loop() $B$+$i%j%?!<%s$7!"(B evt_loop() $B$N4X?tCM$O!"(Bmsgfn() $B$N4X?tCM$H$J$k!#(B

wf->msgfn $B!a(B NULL $B$N>l9g$OF@$i$l$?%a%C%;!<%8$r

$B!|(B $B%a%K%e!<=hM}!'(B W (*menufn)(void);

EV_MENU $B$,F@$i$l$?>l9g$Ku$O!VA*Br;X!W$N7A>u$KJQ99$5$l$F$$$k$?$a!"(B $B4X?t$NCf$G$O%]%$%s%?7A>u$r@_Dj$9$kI,MW$O$J$$!#(B

$B4X?tCM!b(B0 $B$N>l9g$O!"(Bevt_loop() $B$+$i%j%?!<%s$7!"(B evt_loop() $B$N4X?tCM$O!"(Bmenufn() $B$N4X?tCM$H$J$k!#(B

wf->menufn = NULL $B$N>l9g$O2?$b$7$J$$!#(B

$B!|(B $BI=<(=hM}!'(B VOID (*dspfn)(W ix, W mode, RECT *new);

$B%&%#%s%I%&$NI=<(MQ$N4X?t$G$"$j!"(B ix $B$OBP>]%&%#%s%I%&$N%&%#%s%I%&>pJs%l%3!<%IG[Ns$N%$%s%G%C%/%9(B ( 0 $B!A(B) $B$r<($7!"(B mode $B$O!"0J2<$N:FI=<(MW0x$r<($9!#(B

  $B:FI=<($NMWH](Bnew$B$NCM(B
mode= -1 : $B=i4|I=<(MW5a(B$BMW(BNULL
= 0 : $B:FI=<(MW5a%$%Y%s%H(B$BMW(BNULL
= 1 : $B%I%i%C%00\F0(B $BMW(BNULL
= 2 : $B%I%i%C%0JQ7A(B $BH](B$B?7:n6HNN0h(B
= 3 : $B%I%i%C%0JQ7A(B $BMW(B$B?7:n6HNN0h(B
= 4 : $BDL>o%b!<%I@Z49(B $BH](B$B?7:n6HNN0h(B
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O!"(B $B:FI=<(=hM}$G!"$3$N30ItJQ?t$,(B 1 $B$K@_Dj$5$l$F$$$k>l9g$O!"%&%#%s%I%&>pJs%l%3!<%I(B $B$r:FEY IMPORT W wcolor_changed; /* $B%&%#%s%I%&G[?'JQ99(B */

$B!|(B $B>uBVJQ2==hM}!'(B VOID (*stsfn)(W ix, W sts);

$B%&%#%s%I%&$N>uBVJQ99$KBP$7$Fix $B$OBP>]%&%#%s%I%&$N%&%#%s%I%&>pJs%l%3!<%IG[Ns$N%$%s%G%C%/%9(B ( 0 $B!A(B ) $B$r<($7!"(B sts $B$O!"0J2<$N>uBVJQ99MW0x$r<($9!#(B

sts= 0: EV_INACT $B$,H/@8(B ( $BB>%&%#%s%I%&$X$N@Z$j49$((B)
= 1: EV_SWITCH $B$^$?$O(B EV_RSWITCH $B$,H/@8(B
= 2: W_SWITCH $B$,H/@8(B ($BB>%&%#%s%I%&$+$i$NI|5"(B)
= 0x100: EV_INACT $B$,H/@8(B ($B%Q%M%k$X$N@Z$j49$((B)
= 0x102: W_SWITCH $B$,H/@8(B ($B%Q%M%k$+$i$NI|5"(B)
< 0: W_CLOSED $B$,H/@8(B ($B%/%m!<%:$7$?(B wid $B$O(B -sts $B$H$J$k(B)

EV_RSWITCH $B$,H/@8$7$?>l9g$O!"(B $B$^$:(B dspfn() $B$,stsfn() $B$,!"(Bsts = 1 $B$Gpresfn() $BEy$,

EV_SWITCH $B$,H/@8$7$?>l9g$O!"(B stsfn() $B$,(B sts = 1 $B$Gpresfn() $BEy$,

sts = 2(W_SWITCH) $B$N>l9g$O!"(B stsfn() $B$Nstsfn() $B$G$O>uBVJQ99$N=hM}$N$_$r9T$J$&$3$H$K$J$k!#(B

sts$B!a(B0x100 (EV_INACT)$B!"(B0x102(W_SWITCH) $B$O!"(B $B$=$l$>$l%Q%M%k$,%*!<%W%s$5$l$?>l9g!"(B $B$*$h$S!"%/%m!<%:$5$l$?>l9g$KH/@8$9$k!#(B $B%Q%M%k$N>l9g$O!"I=<(%$%a!<%8$OJ]B8(B / $BI|5"$5$l$k$?$a!"(B $B86B'$H$7$FI=<($rJQ99$9$k=hM}$r9T$C$F$O$$$1$J$$!#(B

sts = 0,1,2 $B$*$h$S(B sts < 0 $B$N$H$-$O!"(B $B%&%#%s%I%&Fb$N%Q!<%D$O$9$Y$F(B P_ACT $B>uBV!"(B $B$+$D(B P_NODISP $B>uBV$K@_Dj$5$l$k$?$a!"(B $B%Q!<%D$N:FI=<($r9T$&I,MW$,$"$k!#(B

$B$^$?!"(Bsts = 0 $B$N;~$O!"(B $B%&%#%s%I%&Fb$N%Q!<%D$O$9$Y$F(B P_INACT $B>uBV!"(B $B$+$D(B P_NODISP $B>uBV$K@_Dj$5$l$k$?$a!"(B $B%Q!<%D$N:FI=<($r9T$&I,MW$,$"$k!#(B

wf->stsfn = NULL $B$G$"$C$F$O$$$1$J$$!#(B

$B!|(B $B%-!W (*keyfn)(void);

EV_KEY, EV_AUTKEY $B$,H/@8$7$?>l9g$K

$B4X?tCM(B $B!b(B 0 $B$N>l9g$O!"(Bevt_loop() $B$+$i%j%?!<%s$7!"(B evt_loop() $B$N4X?tCM$O!"(Bkeyfn() $B$N4X?tCM$H$J$k!#(B

wf->keyfn = NULL $B$N>l9g$O2?$b$7$J$$!#(B

$B!|(B PD$B%W%l%9=hM}!'(B W (*presfn)(W ix);

$B%&%#%s%I%&$N:n6HNN0hFb$G$N(B PD $B%W%l%9$KBP$7$F]%&%#%s%I%&$N%&%#%s%I%&>pJs%l%3!<%IG[Ns$N%$%s%G%C%/%9(B ( 0 $B!A(B ) $B$r<($9!#(B

$B4X?tCM!b(B 0 $B$N>l9g$O!"(B evt_loop() $B$+$i%j%?!<%s$7!"(B evt_loop() $B$N4X?tCM$O!"(Bpresfn() $B$N4X?tCM$H$J$k!#(B

wf->presfn = NULL $B$N>l9g$O2?$b$7$J$$!#(B

$B!|(B $B=*N;=hM}!'(B W (*finfn)(W ix, W mode);

$B%&%#%s%I%&$N=*N;MW5a$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$N=hM}$G4|BT30$N%$%Y%s%H$,F@$i$l$?>l9g!"(B $B$=$N%$%Y%s%H$r0lC6La$7$F!"(Bevt_loop()$B!"$^$?$O(B evt_proc() $B$K$h$j!"(B $B8e$G=hM}$9$k$?$a$K;HMQ$5$l$k!#(B

$B$J$*!"$3$N4X?t$G$O!"(Bwugt_evt(&wevt) $B$r
evt_proc
 
$B%$%Y%s%H=hM}(B

$B!Z7A<0![(B

W   evt_proc(void)

$B!Z%Q%i%a!<%?![(B

$B$J$7(B

$B!Z%j%?!<%sCM![(B

$B!a#0(B    $B=hM}7QB3(B
$B!b#0(B    $B=hM}=*N;(B

$B!Z2r@b![(B

$B%&%#%s%I%&!&%$%Y%s%H$revt_loop() $B4X?t$K$h$jEPO?$5$l$?!"(B WINFOREC, WFUNCREC $B$K4p$E$$$?%$%Y%s%H=hM}$r

evt_loop() $B$O!"(B $B$3$N(B evt_proc() $B$r0J2<$N$h$&$KO"B3$7$F

    while ((ret = evt_proc()) == 0);

$B$3$N4X?t$O!"%Q!<%D$d%Q%M%k$N=hM}$G4|BT30$N%$%Y%s%H$,F@$i$l$?>l9g!"(B $B$=$N%$%Y%s%H$rC1H/E*$K=hM}$9$k$?$a$K;HMQ$5$l$k!#(B

$B4X?tCM$O3F%$%Y%s%H=hM}4X?t$GLa$5$l$?CM$G$"$k!#(B

update_sbar
 
$B%9%/%m!<%k%P!<$NI=<(99?7=hM}(B

$B!Z7A<0![(B

W   update_sbar(W ix, W cmd, W *ptr)

$B!Z%Q%i%a!<%?![(B

W     ix    $B%&%#%s%I%&;XDj(B
W    cmd    $B%9%/%m!<%k%P!<$N0LCV(B
W   *ptr    $B%9%/%m!<%k%P!<$r@_Dj$9$kCM$NG[Ns(B

$B!Z%j%?!<%sCM![(B

$B!a(B 0(ER_OK) : $B@5>o=*N;(B
$B!c(B 0         : $B%(%i!<(B  ($B4X?tCM$O%(%i!<%3!<%I(B)

$B!Z2r@b![(B

ix $B$G;XDj$7$?%&%#%s%I%&$N(B cmd $B$G;XDj$7$?%9%/%m!<%k%P!<$NCM$r(B ptr $B$G;XDj$7$?NN0h$K3JG<$5$l$F$$$k(B ( clo, chi, lo, hi ) $B$N(B 4 word $B$NCM$KJQ99$9$k!#(B

cmd $B$O!"%9%/%m!<%k%P!<$N0LCV$r<($90J2<$NCM$G$"$k!#(B

cmd =0 : $B1&%9%/%m!<%k%P!<(B
1 : $B2<%9%/%m!<%k%P!<(B
2 : $B:8%9%/%m!<%k%P!<(B

ptr = NULL $B$N;~$O2?$b$;$:$K4X?tCM(B 0 $B$rLa$9!#(B

chk_scroll
 
$BI=<(%9%/%m!<%kNL$N%A%'%C%/=hM}(B


$B!Z7A<0![(B

PNT chk_scroll(W type, W diff, W unit, RECT view, RECT frame)

$B!Z%Q%i%a!<%?![(B

W       type    $B%9%/%m!<%k$N%?%$%W(B
W       diff    $B%8%c%s%W%9%/%m!<%k$N0\F0NL(B
W       unit    $B%9%`!<%9%9%/%m!<%k;~$N0\F0NL(B
RECT    view    $B8=:_$NI=<(NN0h(B
RECT    frame   $B%G!<%?A4BN$NNN0h(B

$B!Z%j%?!<%sCM![(B

$BI=<(%9%/%m!<%kI,MWNL(B

$B!Z2r@b![(B

evt_loop() $B$N(B scrlfn() $B$KEO$5$l$?(B type, diff $B$KBP1~$7$FI,MW$H$5$l$kI=<(%9%/%m!<%kNL$r%A%'%C%/$7$F!"(B $B4X?tCM$H$7$FLa$9!#(B

$B3F%Q%i%a!<%?$O0J2<$N0UL#$r;}$D!#(B

type : $B%9%/%m!<%k$N%?%$%W(B
( scrlfn() $B$KEO$5$l$?CM$=$N$b$N(B)
diff : $B%8%c%s%W%9%/%m!<%k$N0\F0NL(B
view$B!"(Bframe $B$HF10l$NC10L$NCM$G$J$/$F$O$$$1$J$$!#(B $B%9%/%m!<%k%P!<$N@_DjCM$,!"(Bview$B!"(Bframe $B$HF10lC10L$N>l9g$O!"(Bscrlfn() $B$KEO$5$l$?CM$=$N$b$N$H$J$k!#(B
unit : $B%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