Patch level :10.0 252

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :piccole modifiche per migliorare la gestione immagini sui bottoni


git-svn-id: svn://10.65.10.50/trunk@18430 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2009-03-06 11:48:12 +00:00
parent b45bc8a0e8
commit 09bcf1c189
4 changed files with 9 additions and 9 deletions

View File

@ -1667,7 +1667,7 @@ void TButton_control::set_icon(unsigned int icon_up, unsigned int icon_dn)
TPushbutton_control::TPushbutton_control(WINDOW win, short cid, TPushbutton_control::TPushbutton_control(WINDOW win, short cid,
short left, short top, short width, short height, short left, short top, short width, short height,
const char* flags, const char* text, const char* flags, const char* text,
short bmp_up, short bmp_dn) int bmp_up, int bmp_dn)
: _bmp_up(bmp_up), _bmp_dn(bmp_dn) : _bmp_up(bmp_up), _bmp_dn(bmp_dn)
{ {
@ -1695,7 +1695,7 @@ void TPushbutton_control::set_caption(const char* c)
{ {
TControl::set_caption(cap); TControl::set_caption(cap);
set_icon(0); set_icon(0);
set_bmp(short(0), short(0)); set_bmp(0, 0);
_obj->v.btn->drawable = false; _obj->v.btn->drawable = false;
_obj->v.btn->fore_color = color; _obj->v.btn->fore_color = color;
xi_set_obj_font_id(_obj, xvtil_default_font(bold, big)); xi_set_obj_font_id(_obj, xvtil_default_font(bold, big));
@ -1719,9 +1719,9 @@ void TPushbutton_control::set_bmp(int bmp_up, int bmp_dn)
XVT_IMAGE img_up = NULL, img_dn = NULL; XVT_IMAGE img_up = NULL, img_dn = NULL;
if (bmp_up > 0) if (bmp_up > 0)
img_up = _picture->image(bmp_up).xvt_image(); img_up = _picture->image(_bmp_up).xvt_image();
if (bmp_dn > 0) if (bmp_dn > 0)
img_dn = _picture->image(bmp_dn).xvt_image(); img_dn = _picture->image(_bmp_dn).xvt_image();
xvt_btn_set_images((WINDOW)_obj->v.btn->btnctl, img_up, img_dn); xvt_btn_set_images((WINDOW)_obj->v.btn->btnctl, img_up, img_dn);
} }
else else
@ -1781,7 +1781,7 @@ void TPushbutton_control::update()
xvt_dwin_set_std_cpen(win, TL_PEN_HOLLOW); xvt_dwin_set_std_cpen(win, TL_PEN_HOLLOW);
xi_draw_rect((XinWindow)win, &rct); xi_draw_rect((XinWindow)win, &rct);
const short bmp = (_bmp_dn > 0 && _obj->v.btn->down) ? _bmp_dn : _bmp_up; const int bmp = (_bmp_dn > 0 && _obj->v.btn->down) ? _bmp_dn : _bmp_up;
if (bmp > 0) if (bmp > 0)
{ {
const TImage& i = attrib & XI_ATR_ENABLED ? _picture->image(bmp) : _picture->disabled_image(bmp); const TImage& i = attrib & XI_ATR_ENABLED ? _picture->image(bmp) : _picture->disabled_image(bmp);

View File

@ -237,7 +237,7 @@ public:
TPushbutton_control(WINDOW win, short cid, TPushbutton_control(WINDOW win, short cid,
short left, short top, short width, short height, short left, short top, short width, short height,
const char* flags, const char* text, const char* flags, const char* text,
short bmp_up = 0, short _bmp_dn = 0); int bmp_up = 0, int _bmp_dn = 0);
virtual ~TPushbutton_control(); virtual ~TPushbutton_control();
}; };

View File

@ -94,8 +94,8 @@ protected:
short _decimals; // Precision short _decimals; // Precision
TString _prompt; // Prompt TString _prompt; // Prompt
TString _flags; // Flags TString _flags; // Flags
short _bmp_up; // Bitmap up int _bmp_up; // Bitmap up
short _bmp_dn; // Bitmap down int _bmp_dn; // Bitmap down
TToken_string _park; // Work string TToken_string _park; // Work string
void reset(); void reset();
}; };

View File

@ -17,7 +17,7 @@ static wxBitmap Image2Bitmap(XVT_IMAGE image, int maxx, int maxy, BOOLEAN trans)
if (image == NULL) if (image == NULL)
return wxNullBitmap; return wxNullBitmap;
wxImage& img = *(wxImage*)image; wxImage img = *(wxImage*)image;
int w = img.GetWidth(), h = img.GetHeight(); int w = img.GetWidth(), h = img.GetHeight();
if (w > maxx || h > maxy) if (w > maxx || h > maxy)