Centrato il testo nei bottoni col testo

git-svn-id: svn://10.65.10.50/trunk@652 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-11-17 13:31:32 +00:00
parent 0113a7e6e9
commit 383ce68690
2 changed files with 14 additions and 20 deletions

View File

@ -598,7 +598,7 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
_accel *= CHARX; _accel *= CHARX;
_dx = (width - win_get_text_width(win(), (char*)caption(), -1)) >> 1; _dx = (width - win_get_text_width(win(), (char*)caption(), -1)) >> 1;
_dy = (byte)(height-4+BASEY)>>1; _dy = byte((height-CHARY)/2 + BASEY);
} }
} }
@ -638,17 +638,6 @@ void TPush_button::update() const
draw_pressed(FALSE); draw_pressed(FALSE);
if (focused() && id() != DLG_F9) if (focused() && id() != DLG_F9)
{ {
/*
HWND hwnd = (HWND)get_value(_hdc, ATTR_NATIVE_WINDOW);
HDC hdc = GetDC(hwnd);
RECT r;
r.left = _client.left+DEPTH+1;
r.top = _client.top+DEPTH;
r.right = _client.right-DEPTH-1;
r.bottom = _client.bottom-DEPTH;
DrawFocusRect(hdc, &r);
ReleaseDC(hwnd, hdc);
*/
CPEN pen; CPEN pen;
pen.width = 1; pen.width = 1;
pen.pat = PAT_SOLID; pen.pat = PAT_SOLID;
@ -842,7 +831,7 @@ void TTag_button::set_pages(byte p)
class TCheckbox : public TButton class TCheckbox : public TButton
{ {
static bool _bmploaded; static int _dy;
protected: protected:
virtual WIN_TYPE type() const; virtual WIN_TYPE type() const;
@ -858,7 +847,7 @@ public:
virtual ~TCheckbox(); virtual ~TCheckbox();
}; };
bool TCheckbox::_bmploaded = FALSE; int TCheckbox::_dy = -1;
TCheckbox::TCheckbox( TCheckbox::TCheckbox(
short left, short top, short right, short bottom, short left, short top, short right, short bottom,
@ -867,13 +856,16 @@ TCheckbox::TCheckbox(
: TButton(left, top, right, bottom, : TButton(left, top, right, bottom,
caption, parent, flags, app_data, id) caption, parent, flags, app_data, id)
{ {
if (!_bmploaded) if (_dy < 0)
{ {
cpb.getbmp(BMP_CHECK_ON); cpb.getbmp(BMP_CHECK_ON);
cpb.getbmp(BMP_CHECK_OFF); cpb.getbmp(BMP_CHECK_OFF);
cpb.getbmp(BMP_RADIO_ON); cpb.getbmp(BMP_RADIO_ON);
cpb.getbmp(BMP_RADIO_OFF); PICTURE p = cpb.getbmp(BMP_RADIO_OFF);
_bmploaded = TRUE;
RCT r;
cpb_get_picture_size(p, &r);
_dy = BASEY - r.bottom + 2;
} }
} }
@ -897,7 +889,7 @@ void TCheckbox::draw_pressed(bool pressed) const
pic = pressed ? cpb[BMP_RADIO_ON] : cpb[BMP_RADIO_OFF]; pic = pressed ? cpb[BMP_RADIO_ON] : cpb[BMP_RADIO_OFF];
else else
pic = pressed ? cpb[BMP_CHECK_ON] : cpb[BMP_CHECK_OFF]; pic = pressed ? cpb[BMP_CHECK_ON] : cpb[BMP_CHECK_OFF];
cpb_win_picture_draw_at(_hdc, pic, _client.left, _client.top); cpb_win_picture_draw_at(_hdc, pic, _client.left, _client.top+_dy);
} }

View File

@ -4,18 +4,20 @@
#define RMV_ANNOES "ANNOES" #define RMV_ANNOES "ANNOES"
#define RMV_NUMREG "NUMREG" #define RMV_NUMREG "NUMREG"
#define RMV_NUMRIG "NUMRIG" #define RMV_NUMRIG "NUMRIG"
#define RMV_DATAREG "DATAREG"
#define RMV_SEZIONE "SEZIONE" #define RMV_SEZIONE "SEZIONE"
#define RMV_TIPOC "TIPOC" #define RMV_TIPOC "TIPOC"
#define RMV_DATAREG "DATAREG"
#define RMV_GRUPPO "GRUPPO" #define RMV_GRUPPO "GRUPPO"
#define RMV_CONTO "CONTO" #define RMV_CONTO "CONTO"
#define RMV_SOTTOCONTO "SOTTOCONTO" #define RMV_SOTTOCONTO "SOTTOCONTO"
#define RMV_DESCR "DESCR" #define RMV_DESCR "DESCR"
#define RMV_RCONTR "RCONTR"
#define RMV_IMPORTO "IMPORTO" #define RMV_IMPORTO "IMPORTO"
#define RMV_TIPOCC "TIPOCC" #define RMV_TIPOCC "TIPOCC"
#define RMV_GRUPPOC "GRUPPOC" #define RMV_GRUPPOC "GRUPPOC"
#define RMV_CONTOC "CONTOC" #define RMV_CONTOC "CONTOC"
#define RMV_SOTTOCONTOC "SOTTOCONTC" #define RMV_SOTTOCONTOC "SOTTOCONTC"
// To be removed soon
#define RMV_RCONTR "RCONTR"
#endif #endif