home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
VPR_DATA
/
DOGA
/
SOURCES
/
PASM.LZH
/
BMPBTN.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-19
|
3KB
|
145 lines
/* Project partsasm
Project Team DoGA
Copyright (c) 1995. All Rights Reserved.
サブシステム: partsasm.apx Application
ファイル: bmpbtn.cpp
作成者: Taka2
概要
====
TBitmapButton (TButton) のインプリメンテーション用のソースファイル
*/
#include <owl\owlpch.h>
#pragma hdrstop
#include "bmpbtn.h"
#include "design.h"
#include "parts.h"
#include "winframe.h"
#include "seltype.h"
#include "log.h"
const int buttonsize = 16;
//
// このアプリケーションで処理するすべてのメッセージ/コマンドの
// 応答テーブルを作成する
//
DEFINE_RESPONSE_TABLE1(TBitmapButton, TButton)
//{{TBitmapButtonRSP_TBL_BEGIN}}
EV_WM_PAINT,
EV_WM_TIMER,
//{{TBitmapButtonRSP_TBL_END}}
END_RESPONSE_TABLE;
//{{TBitmapButton Implementation}}
TBitmapButton::TBitmapButton (TWindow* parent, DesignData *dd, int id, int X, int Y, int W, int H, BOOL isDefault, TModule* module):
TButton(parent, id, "", X, Y, W, H, isDefault, module)
{
// TButton 用の,デフォルトのウィンドウスタイルをオーバーライドする
Attr.Style |= WS_CHILD | WS_VISIBLE;
Attr.Style &= ~(WS_MAXIMIZEBOX | WS_MINIMIZEBOX);
// INSERT>> コンストラクタ用のコードはここに
Attr.Style |= BS_OWNERDRAW;
dib = new TDib(*GetModule(), id);
designdata = dd;
}
TBitmapButton::~TBitmapButton ()
{
Destroy();
// INSERT>> デストラクタ用のコードはここに
delete dib;
}
void TBitmapButton::EvPaint ()
{
TButton::EvPaint();
// INSERT>> 追加コードはここに
TClientDC dc(*this);
TSize s = dib->Size();
TRect imageRect(0,0, s.cx, s.cy);
if (Attr.W == s.cx && Attr.H == s.cy) {
dc.SetDIBitsToDevice(imageRect, TPoint(0,0), *dib);
} else {
TRect clientRect(0,0, Attr.W, Attr.H);
dc.StretchDIBits(clientRect, imageRect, *dib);
}
}
void TBitmapButton::SetupWindow ()
{
TButton::SetupWindow();
// INSERT>> 追加のコードはここに
}
void TBitmapButton::ODADrawEntire (DRAWITEMSTRUCT far& drawInfo)
{
TButton::ODADrawEntire(drawInfo);
// INSERT>> 追加のコードはここに
}
void TBitmapButton::ODAFocus (DRAWITEMSTRUCT far& drawInfo)
{
TButton::ODAFocus(drawInfo);
// INSERT>> 追加のコードはここに
}
void TBitmapButton::ODASelect (DRAWITEMSTRUCT far& drawInfo)
{
TButton::ODASelect(drawInfo);
// INSERT>> 追加のコードはここに
if (drawInfo.itemState & ODS_SELECTED) {
if (designdata->select == designdata->camera) {
designdata->Frame->EvButton(Attr.Id, SelPers | SelStat);
} else {
designdata->Frame->EvButton(Attr.Id, SelPers);
}
SetTimer(0,100);
} else {
KillTimer(0);
designdata->Redraw(SelXYZ);
}
}
void TBitmapButton::EvTimer (UINT timerId)
{
TButton::EvTimer(timerId);
// INSERT>> 追加コードはここに
if (designdata->select == designdata->camera) {
designdata->Frame->EvButton(Attr.Id, SelPers | SelStat);
} else {
designdata->Frame->EvButton(Attr.Id, SelPers);
}
}