[haiku-bugs] Re: [Haiku] #5440: [Interface Kit] empty space between selected item and menu item separator is 1px more than necessary

  • From: "jackburton" <trac@xxxxxxxxxxxx>
  • Date: Sun, 14 Mar 2010 12:16:54 -0000

#5440: [Interface Kit] empty space between selected item and menu item separator
is 1px more than necessary
--------------------------------+-------------------------------------------
 Reporter:  diver               |       Owner:  axeld         
     Type:  bug                 |      Status:  new           
 Priority:  normal              |   Milestone:  R1            
Component:  Kits/Interface Kit  |     Version:  R1/Development
 Keywords:                      |   Blockedby:                
 Platform:  All                 |    Blocking:                
--------------------------------+-------------------------------------------

Comment(by jackburton):

 One of the problem, I think, is that, while the separator height changes
 with the font size, the actual drawing is always just 2 horizontal lines:

 {{{
 void
 BSeparatorItem::GetContentSize(float* _width, float* _height)
 {
         if (_width != NULL)
                 *_width = 2.0;

         if (_height != NULL) {
                 BFont font(be_plain_font);
                 if (Menu())
                         Menu()->GetFont(&font);
                 *_height = floorf(font.Size() * 0.8);
         }
 }
 }}}

 BSeparatorItem::Draw():
 {{{
         menu->SetHighColor(tint_color(lowColor, B_DARKEN_1_TINT));
         menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 4.0f),
                 BPoint(bounds.right - 1.0f, bounds.top + 4.0f));
         menu->SetHighColor(tint_color(lowColor, B_LIGHTEN_2_TINT));
         menu->StrokeLine(BPoint(bounds.left + 1.0f, bounds.top + 5.0f),
                 BPoint(bounds.right - 1.0f, bounds.top + 5.0f));
 }}}

 So, either we use a fixed size for the separator item, or change some code
 in its drawing (and also in BMenu drawing code, I think), to accomodate
 the variable sized separator.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/5440#comment:2>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: