home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
VPR_DATA
/
DOGA
/
SOURCES
/
MEDIT.LZH
/
BMPBTN.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-23
|
4KB
|
183 lines
/* Project medit
Project Team DoGA
Copyright (c) 1995. All Rights Reserved.
サブシステム: medit.apx Application
ファイル: bmpbtn.cpp
作成者: Taka2
概要
====
TBMPButton (TButton) のインプリメンテーション用のソースファイル
*/
#include <owl\owlpch.h>
#pragma hdrstop
#include <owl\button.h>
#include "anim.h"
#include "winframe.h"
#include "bmpbtn.h"
#define TIMELAG 200
//
// このアプリケーションで処理するすべてのメッセージ/コマンドの
// 応答テーブルを作成する
//
DEFINE_RESPONSE_TABLE1(TBMPButton, TButton)
//{{TBMPButtonRSP_TBL_BEGIN}}
EV_WM_PAINT,
EV_WM_TIMER,
EV_WM_LBUTTONDOWN,
EV_WM_LBUTTONUP,
//{{TBMPButtonRSP_TBL_END}}
END_RESPONSE_TABLE;
//{{TBMPButton Implementation}}
TBMPButton::TBMPButton (TWindow* parent, AnimationData *a, int id, int X, int Y, int W, int H, BOOL isDefault, TModule* module):
TButton(parent, id, NULL, X, Y, W, H, isDefault, module)
{
// INSERT>> コンストラクタ用のコードはここに
anim = a;
wid = id;
Attr.Style |= BS_OWNERDRAW;
dib = new TDib(*GetModule(), id);
intimer = FALSE;
push = FALSE;
}
TBMPButton::~TBMPButton ()
{
Destroy();
// INSERT>> デストラクタ用のコードはここに
delete dib;
}
void TBMPButton::EvPaint ()
{
TButton::EvPaint();
// INSERT>> 追加コードはここに
TClientDC dc(*this);
TSize s = dib->Size();
TRect imageRect(0,0, s.cx, s.cy);
dc.SetDIBitsToDevice(imageRect, TPoint(0,0), *dib);
}
void TBMPButton::ODASelect (DRAWITEMSTRUCT far& drawInfo)
{
TButton::ODASelect(drawInfo);
// INSERT>> 追加のコードはここに
#if 0
KillTimer(0);
TClientDC dc(*this);
if (wid == BITMAP_BUTTON_FRAMEFORWARD || wid == BITMAP_BUTTON_FRAMEBACKWARD) {
if (drawInfo.itemState & ODS_SELECTED) {
if (wid == BITMAP_BUTTON_FRAMEFORWARD) {
anim->Frame->EvButtonForward();
} else {
anim->Frame->EvButtonBackward();
}
if (!push) {
SetTimer(0,TIMELAG);
dc.TextOut(0,0,"p");
push = TRUE;
}
} else {
dc.TextOut(0,0,"n");
push = FALSE;
}
}
#endif
#if 0
if (drawInfo.itemAction & ODA_SELECT
&& drawInfo.itemState & ODS_SELECTED) {
if (wid == BITMAP_BUTTON_FRAMEFORWARD) {
anim->Frame->EvButtonForward();
} else {
anim->Frame->EvButtonBackward();
}
SetTimer(0,TIMELAG);
}
#endif
#if 0
if (drawInfo.itemState & ODS_SELECTED) {
if (wid == BITMAP_BUTTON_FRAMEFORWARD) {
anim->Frame->EvButtonForward();
} else {
anim->Frame->EvButtonBackward();
}
SetTimer(0,TIMELAG);
} else {
KillTimer(0);
}
#endif
}
void TBMPButton::EvTimer (UINT timerId)
{
TButton::EvTimer(timerId);
// INSERT>> 追加コードはここに
if (intimer || !push) {
return;
}
intimer = TRUE;
KillTimer(0);
if (wid == BITMAP_BUTTON_FRAMEFORWARD) {
anim->Frame->EvButtonForward();
} else if (wid == BITMAP_BUTTON_FRAMEBACKWARD) {
anim->Frame->EvButtonBackward();
}
if (push) {
SetTimer(0,33);
}
intimer = FALSE;
}
void TBMPButton::EvLButtonDown (UINT modKeys, TPoint& point)
{
TButton::EvLButtonDown(modKeys, point);
// INSERT>> 追加コードはここに
push = TRUE;
if (wid == BITMAP_BUTTON_FRAMEFORWARD || wid == BITMAP_BUTTON_FRAMEBACKWARD) {
if (wid == BITMAP_BUTTON_FRAMEFORWARD) {
anim->Frame->EvButtonForward();
} else {
anim->Frame->EvButtonBackward();
}
SetTimer(0,TIMELAG);
}
}
void TBMPButton::EvLButtonUp (UINT modKeys, TPoint& point)
{
TButton::EvLButtonUp(modKeys, point);
// INSERT>> 追加コードはここに
push = FALSE;
KillTimer(0);
}