home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
VPR_DATA
/
DOGA
/
SOURCES
/
PASM.LZH
/
DSLIDER.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-07-03
|
3KB
|
125 lines
/* Project partsasm
Project Team DoGA
Copyright (c) 1995. All Rights Reserved.
サブシステム: partsasm.apx Application
ファイル: dslider.cpp
作成者: Taka2
概要
====
TDSliderInput (TDialog) のインプリメンテーション用のソースファイル
*/
#include <owl\owlpch.h>
#pragma hdrstop
#include <owl\slider.h>
#include <owl\static.h>
#include "dslider.h"
#include "syscolor.h"
#include "log.h"
const int scaling = 10;
class TNSlider: public THSlider {
public:
TNSlider(TWindow* parent,
int id,
int X, int Y, int W, int H,
TResId thumbResId = IDB_HSLIDERTHUMB,
TModule* module = 0) :
THSlider(parent, id, X, Y, W, H, thumbResId, module) {}
virtual int PointToPos(TPoint& point) {
return ((int)((long)point.x*Range))/((int)(Attr.W-ThumbRect.Width())) + (int)Min;
}
};
//
// このアプリケーションで処理するすべてのメッセージ/コマンドの
// 応答テーブルを作成する
//
DEFINE_RESPONSE_TABLE1(TDSliderInput, TDialog)
//{{TDSliderInputRSP_TBL_BEGIN}}
EV_CHILD_NOTIFY_ALL_CODES(IDC_SLIDER, EvSlider),
//{{TDSliderInputRSP_TBL_END}}
END_RESPONSE_TABLE;
//{{TDSliderInput Implementation}}
TDSliderInput::TDSliderInput (TWindow* parent, char *t, char *m, char **gname, int &pos, TResId resId, TModule* module):
TDialog(parent, resId, module)
{
// INSERT>> コンストラクタ用のコードはここに
// SetBkgndColor(TColor::LtGray);
text = new TStatic(this, ID_PROMPT);
value = new TStatic(this, IDC_SLIDERVALUE, 8);
slider = new TNSlider(this, IDC_SLIDER, 45, 45, 296, 27);
// slider->SetBkgndColor(TColor::LtGray);
position = &pos;
title = t;
mess = m;
gridname = gname;
}
TDSliderInput::~TDSliderInput ()
{
Destroy();
// INSERT>> デストラクタ用のコードはここに
}
void TDSliderInput::SetupWindow ()
{
TDialog::SetupWindow();
// INSERT>> 追加のコードはここに
slider->SetBkgndColor(TColor::LtGray);
slider->PageMagnitude = scaling;
slider->LineMagnitude = scaling;
for (int i = 0; gridname[i] != NULL; ++i) {
if (gridname[i] == '\0') {
break;
}
}
slider->SetRange(0, (i-1) * scaling);
if (*position < 0) *position = 0;
if (*position > i-1) *position = i-1;
slider->SetPosition((*position) * scaling);
slider->SetRuler(scaling, TRUE);
// slider->SetPosition((*position) * scaling);
slider->MoveWindow(value->Attr.X + value->Attr.W, value->Attr.Y,
TWindow::Attr.W - value->Attr.X*2 - value->Attr.W, value->Attr.H);
slider->SetPosition(0);
slider->SetPosition((*position) * scaling);
text->SetText(mess);
value->SetText(gridname[*position]);
SetCaption(title);
}
void TDSliderInput::EvSlider(UINT /*code*/)
{
if (*position != slider->GetPosition()) {
*position = slider->GetPosition()/ scaling;
value->SetText(gridname[*position]);
}
}