ultimatepp/uppdev/VegaTeam5/OptionImage.cpp
cxl 351994a6cc Adding uppdev....
git-svn-id: svn://ultimatepp.org/upp/trunk@328 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2008-08-15 08:36:24 +00:00

59 lines
1.7 KiB
C++

#include "OptionImage.h"
void OptionImage::ReFocus(){
SetFocus();
}
OptionImage::OptionImage()
{
WhenAction = THISBACK(ReFocus);
}
void OptionImage::Paint(Draw& w) {
Size sz = GetSize();
if(!IsTransparent())
w.DrawRect(0, 0, sz.cx, sz.cy, SColorFace);
Size isz = imgYes.GetSize(); //although maybe it would be good to calc from the biggest...?
Size tsz = GetSmartTextSize(w, label, font);
int ty = (sz.cy - tsz.cy) / 2; //text up-down
int iy = (tsz.cy - isz.cy) / 2 + ty;
bool ds = !IsShowEnabled();
Image m = (!notnull || threestate) && IsNull(option) ? ds ? imgMaybe
: IsPush() ? imgYes
: imgMaybe :
option == 1 ? ds ? (switchimage ? imgYes : imgYes)
: IsPush() ? (switchimage ? imgYes : imgYes)
: (switchimage ? imgYes : imgYes)
: ds ? (switchimage ? imgNo : imgNo)
: IsPush() ? (switchimage ? imgNo : imgNo)
: (switchimage ? imgNo : imgNo);
w.DrawImage(0, iy, m);
// if(!switchimage) //for borders - need to adjust sizes...
// w.DrawImage(0, iy, ds ? CtrlImg::optionedged : blackedge ? CtrlImg::blackoptionedge : CtrlImg::optionedge);
DrawSmartText(w, isz.cx + 4, ty, tsz.cx, label, font, ds ? SGray : SBlack, VisibleAccessKeys() ? accesskey : 0);
//text length problem - tsz.cx - doesn't work? - adjust *.lay!!!
}
////////////// to be removed ////////////////////////
/*
void ArrayCtrlA::mysync()
{
// ChildGotFocus();
// Point p = FindCellCtrl(GetFocusCtrl());
// SetCursor(p.y);
}
ArrayCtrlA::ArrayCtrlA()
{
// WhenCtrlsAction = THISBACK(mysync);
// WhenEnterRow = THISBACK(mysync);
}
*/