Fixed menu item width calculations with symbols (STR #740)

src/Fl_Menu.cxx:
    - Fl_Menu_Item::measure() - initialize w and h to label font
      size so that the symbol size is calculated properly.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4066 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Michael R Sweet 2005-03-05 19:53:43 +00:00
parent 2c989c8e4c
commit a48c6dd545
2 changed files with 5 additions and 1 deletions

View File

@ -2,6 +2,8 @@ CHANGES IN FLTK 1.1.7
- Documentation fixes (STR #648, STR #692, STR #730, STR
#744, STR #745)
- Fixed menu item width calculations with symbols (STR
#740)
- The keyboard shortcut handling code did not handle
8-bit characters properly (STR #731)
- Fl_JPEG_Image could still crash an app with a corrupt

View File

@ -122,7 +122,9 @@ int Fl_Menu_Item::measure(int* hp, const Fl_Menu_* m) const {
l.size = labelsize_ ? labelsize_ : m ? m->textsize() : (uchar)FL_NORMAL_SIZE;
l.color = FL_BLACK; // this makes no difference?
fl_draw_shortcut = 1;
int w = 0; int h = 0; l.measure(w, hp ? *hp : h);
int w = l.size; int h = l.size;
if (hp) *hp = h;
l.measure(w, hp ? *hp : h);
fl_draw_shortcut = 0;
if (flags & (FL_MENU_TOGGLE|FL_MENU_RADIO)) w += 14;
return w;