Corretto errore update bottoni post-mortem
git-svn-id: svn://10.65.10.50/trunk@1228 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
7179711a44
commit
9285b6486e
@ -23,9 +23,9 @@ extern "C"
|
||||
class TPicture_array : public TArray
|
||||
{
|
||||
public:
|
||||
TImage* add(short id, bool convert = FALSE);
|
||||
TImage& add(short id, bool convert = FALSE);
|
||||
|
||||
TImage& image(short id) { return (TImage&)operator[](id); }
|
||||
//TImage& image(short id) { return (TImage&)operator[](id); }
|
||||
const TImage& image(short id) const { return (const TImage&)operator[](id); }
|
||||
bool exist(short id) const { return objptr(id) != NULL; }
|
||||
|
||||
@ -33,7 +33,7 @@ public:
|
||||
~TPicture_array() {}
|
||||
};
|
||||
|
||||
TImage* TPicture_array::add(short id, bool convert)
|
||||
TImage& TPicture_array::add(short id, bool convert)
|
||||
{
|
||||
TImage* i = (TImage*)objptr(id);
|
||||
|
||||
@ -45,7 +45,7 @@ TImage* TPicture_array::add(short id, bool convert)
|
||||
i->convert_to_default_colors();
|
||||
}
|
||||
|
||||
return i;
|
||||
return *i;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -493,7 +493,7 @@ void TButton::check(bool on)
|
||||
|
||||
class TPush_button : public TButton
|
||||
{
|
||||
TImage *_picup, *_picdn;
|
||||
short _picup, _picdn;
|
||||
short _accel, _dx, _dy;
|
||||
|
||||
protected:
|
||||
@ -512,7 +512,7 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
|
||||
long flags, long app_data, short id)
|
||||
: TButton(left-(id == DLG_F9), top, right, bottom,
|
||||
capt, parent, flags, app_data, id),
|
||||
_picup(NULL), _picdn(NULL)
|
||||
_picup(0), _picdn(0)
|
||||
{
|
||||
switch(id)
|
||||
{
|
||||
@ -589,24 +589,18 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
|
||||
const char* diesis = strchr(capt, '#');
|
||||
if (diesis != NULL)
|
||||
{
|
||||
int pid = atoi(++diesis);
|
||||
_picup = cpb.add(pid);
|
||||
_picup = atoi(++diesis);
|
||||
const TImage& pic = cpb.add(_picup);
|
||||
diesis = strchr(diesis, '#');
|
||||
if (diesis != NULL)
|
||||
{
|
||||
pid = atoi(++diesis);
|
||||
_picdn = cpb.add(pid);
|
||||
_picdn = atoi(++diesis);
|
||||
cpb.add(_picdn);
|
||||
}
|
||||
|
||||
_dx = (width - _picup->width()) >> 1;
|
||||
_dy = (height - _picup->height()) >> 1;
|
||||
_dx = (width - pic.width()) >> 1;
|
||||
_dy = (height - pic.height()) >> 1;
|
||||
|
||||
/*
|
||||
_picup->set_pos(_dx, _dy);
|
||||
if (_picdn)
|
||||
_picdn->set_pos(_dx+DEPTH, _dy+DEPTH);
|
||||
*/
|
||||
|
||||
_accel = -1;
|
||||
}
|
||||
else
|
||||
@ -631,13 +625,17 @@ void TPush_button::draw_pressed(bool pressed) const
|
||||
|
||||
if (_picup)
|
||||
{
|
||||
const TImage* i = (pressed && _picdn) ? _picdn : _picup;
|
||||
RCT dst = i->rect();
|
||||
if (pressed)
|
||||
xvt_rect_offset(&dst, _dx+DEPTH, _dy+DEPTH);
|
||||
else
|
||||
xvt_rect_offset(&dst, _dx, _dy);
|
||||
i->draw(_hdc, dst);
|
||||
const short pic = (pressed && _picdn) ? _picdn : _picup;
|
||||
if (cpb.exist(pic))
|
||||
{
|
||||
const TImage& i = cpb.image(pic);
|
||||
RCT dst = i.rect();
|
||||
if (pressed)
|
||||
xvt_rect_offset(&dst, _dx+DEPTH, _dy+DEPTH);
|
||||
else
|
||||
xvt_rect_offset(&dst, _dx, _dy);
|
||||
i.draw(_hdc, dst);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -886,15 +884,15 @@ TCheckbox::TCheckbox(
|
||||
{
|
||||
if (!cpb.exist(BMP_CHECK_ON))
|
||||
{
|
||||
TImage* i = cpb.add(BMP_CHECK_ON, TRUE);
|
||||
TImage& i = cpb.add(BMP_CHECK_ON, TRUE);
|
||||
|
||||
const short dx = 0;
|
||||
const short dy = BASEY - i->height() + 2;
|
||||
i->set_pos(dx, dy);
|
||||
const short dy = BASEY - i.height() + 2;
|
||||
i.set_pos(dx, dy);
|
||||
|
||||
i = cpb.add(BMP_CHECK_OFF, TRUE); i->set_pos(dx, dy);
|
||||
i = cpb.add(BMP_RADIO_ON, TRUE); i->set_pos(dx, dy);
|
||||
i = cpb.add(BMP_RADIO_OFF, TRUE); i->set_pos(dx, dy);
|
||||
cpb.add(BMP_CHECK_OFF, TRUE).set_pos(dx, dy);
|
||||
cpb.add(BMP_RADIO_ON, TRUE).set_pos(dx, dy);
|
||||
cpb.add(BMP_RADIO_OFF, TRUE).set_pos(dx, dy);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user