home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
VPR_DATA
/
DOGA
/
SOURCES
/
PASM.LZH
/
DSELCOL.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-07-03
|
4KB
|
171 lines
/* Project partsasm
Project Team DoGA
Copyright (c) 1995. All Rights Reserved.
サブシステム: partsasm.apx Application
ファイル: dselcol.cpp
作成者: Taka2
概要
====
TDSelColor (TDialog) のインプリメンテーション用のソースファイル
*/
#include <owl\owlpch.h>
#pragma hdrstop
#include "dselcol.h"
#include "owl\radiobut.h"
#include "owl\edit.h"
//
// このアプリケーションで処理するすべてのメッセージ/コマンドの
// 応答テーブルを作成する
//
DEFINE_RESPONSE_TABLE1(TDSelColor, TDialog)
//{{TDSelColorRSP_TBL_BEGIN}}
EV_BN_CLICKED(IDOK, CmOK),
EV_WM_PAINT,
EV_WM_LBUTTONDOWN,
//{{TDSelColorRSP_TBL_END}}
END_RESPONSE_TABLE;
//{{TDSelColor Implementation}}
TDSelColor::TDSelColor (TWindow* parent, int icolor, int ilight, int iwidth, int iheight):
TDialog(parent, IDD_COLOR, 0)
{
// INSERT>> コンストラクタ用のコードはここに
editwidth = new TEdit(this, IDC_REND_WIDTH);
editheight = new TEdit(this, IDC_REND_HEIGHT);
selcolor = icolor;
sellight = ilight;
selwidth = iwidth;
selheight = iheight;
int i;
for (i = 0; i < SELCOL_COLORS; ++i) {
button[i] = new TRadioButton(this, IDC_COLOR_WH + i);
}
for (i = 0; i < SELCOL_LIGHTS; ++i) {
lbutton[i] = new TRadioButton(this, IDC_LIGHT_LEFT + i);
}
}
TDSelColor::~TDSelColor ()
{
Destroy();
// INSERT>> デストラクタ用のコードはここに
}
void TDSelColor::SetupWindow ()
{
TDialog::SetupWindow();
// INSERT>> 追加のコードはここに
if (0 <= selcolor && selcolor < SELCOL_COLORS) {
button[selcolor]->Check();
}
if (0 <= sellight && sellight < SELCOL_LIGHTS) {
lbutton[sellight]->Check();
}
char mes[32];
wsprintf(mes, "%d", selwidth);
editwidth->SetText(mes);
wsprintf(mes, "%d", selheight);
editheight->SetText(mes);
}
void TDSelColor::CmOK ()
{
// INSERT>> 追加コードはここに
int i;
for (i = 0; i < SELCOL_COLORS; ++i) {
if (button[i]->GetCheck() == BF_CHECKED) {
selcolor = i;
}
}
for (i = 0; i < SELCOL_LIGHTS; ++i) {
if (lbutton[i]->GetCheck() == BF_CHECKED) {
sellight = i;
}
}
int n;
char mes[32];
editwidth->GetText(mes, 32);
n = atoi(mes);
if (0 < n && n <= 2048) selwidth = n;
editheight->GetText(mes, 32);
n = atoi(mes);
if (0 < n && n <= 2048) selheight = n;
CloseWindow(IDOK);
}
void TDSelColor::EvPaint ()
{
TDialog::EvPaint();
// INSERT>> 追加コードはここに
// INSERT>> 追加のコードはここに
static TColor col[SELCOL_COLORS] = {
TColor::White,
TColor::LtBlue,
TColor::LtRed,
TColor::LtGreen,
TColor::LtMagenta};
TClientDC dc(*this);
int y1, y2;
y1 = button[0]->Attr.Y - 12;
y2 = y1+12;
for (int i = 0; i < SELCOL_COLORS; ++i) {
dc.SelectObject(TBrush(col[i]));
dc.Rectangle(button[i]->Attr.X, y1,
button[i]->Attr.X + button[i]->Attr.W,y2);
}
}
void TDSelColor::EvLButtonDown (UINT modKeys, TPoint& point)
{
TDialog::EvLButtonDown(modKeys, point);
// INSERT>> 追加コードはここに
int y1, y2;
y1 = button[0]->Attr.Y - 12;
y2 = y1+12;
for (int i = 0; i < SELCOL_COLORS; ++i) {
if (point.x >= button[i]->Attr.X
&& point.x <= button[i]->Attr.X + button[i]->Attr.W
&& point.y >= y1 && point.y <= y2) {
for (int j = 0; j < SELCOL_COLORS; ++j) {
if (i == j) {
button[j]->SetCheck(BF_CHECKED);
} else {
button[j]->SetCheck(BF_UNCHECKED);
}
}
}
}
}