[haiku-commits] Re: haiku: hrev44066 - src/apps/deskbar

  • From: John Scipione <jscipione@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 24 Apr 2012 13:56:07 -0400

On Tue, Apr 24, 2012 at 1:18 PM, Rene Gollent <anevilyak@xxxxxxxxx> wrote:
> On Tue, Apr 24, 2012 at 1:11 PM, John Scipione <jscipione@xxxxxxxxx> wrote:
>> DrawLabel() tells me if the label on the item is drawn or not. I only
>
> Then I'd suggest renaming that method, as it is now it sounds more
> like it performs the actual drawing, rather than indicating if it's
> enabled or not.

Perhaps DrawLabel() is a bad name, I was just following the convention
that the getter method name comes from the variable name, in this case
fDrawLabel, and the setter method is the same with Set in front. So
the methods names became DrawLabel() and SetDrawLabel(). I didn't name
that variable nor set the convention. But, perhaps this variable name
is not clear and should be renamed along with the getter and setter
methods to match. Any suggestions?

>> Would it be more efficient to check if item->Name() is different from
>> the ToolTip() and only set it if so? I can't answer that. But, I do
>> know that I need to change the tooltip when you move between different
>> menu items in the menu so I can't assume the name won't change.
>
> No because that would involve a full string comparison. The easiest
> route would be to cache a pointer to the last menu item found and see
> if it's the same as the one returned by the current
> TeamItemAtPoint(where) or not. That pointer would need to be reset to
> NULL on MouseUp.

I could save a pointer I suppose and check that, good idea. There may
already be a pointer variable I can use already which is used that
stores a pointer to the current menuitem to detect a double click on
MouseDown().

John Scipione

Other related posts: