BMenuItem: Style fixes related to documentation.

This commit is contained in:
John Scipione 2014-02-28 19:04:49 -05:00
parent 41c51f73d1
commit fa412b5fd9
2 changed files with 18 additions and 17 deletions

View File

@ -29,8 +29,8 @@ public:
bool deep = true) const; bool deep = true) const;
virtual void SetLabel(const char* name); virtual void SetLabel(const char* name);
virtual void SetEnabled(bool enabled); virtual void SetEnabled(bool enable);
virtual void SetMarked(bool marked); virtual void SetMarked(bool mark);
virtual void SetTrigger(char trigger); virtual void SetTrigger(char trigger);
virtual void SetShortcut(char shortcut, uint32 modifiers); virtual void SetShortcut(char shortcut, uint32 modifiers);
@ -49,7 +49,7 @@ protected:
virtual void TruncateLabel(float maxWidth, char* newLabel); virtual void TruncateLabel(float maxWidth, char* newLabel);
virtual void DrawContent(); virtual void DrawContent();
virtual void Draw(); virtual void Draw();
virtual void Highlight(bool enabled); virtual void Highlight(bool highlight);
bool IsSelected() const; bool IsSelected() const;
BPoint ContentLocation() const; BPoint ContentLocation() const;

View File

@ -10,7 +10,6 @@
* John Scipione, jscipione@gmail.com * John Scipione, jscipione@gmail.com
*/ */
//! Display item for BMenu class
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
@ -186,7 +185,7 @@ BMenuItem::~BMenuItem()
void void
BMenuItem::SetLabel(const char *string) BMenuItem::SetLabel(const char* string)
{ {
if (fLabel != NULL) { if (fLabel != NULL) {
free(fLabel); free(fLabel);
@ -208,15 +207,15 @@ BMenuItem::SetLabel(const char *string)
void void
BMenuItem::SetEnabled(bool state) BMenuItem::SetEnabled(bool enable)
{ {
if (fEnabled == state) if (fEnabled == enable)
return; return;
fEnabled = state; fEnabled = enable;
if (fSubmenu != NULL) if (fSubmenu != NULL)
fSubmenu->SetEnabled(state); fSubmenu->SetEnabled(enable);
BMenu* menu = fSuper; BMenu* menu = fSuper;
if (menu != NULL && menu->LockLooper()) { if (menu != NULL && menu->LockLooper()) {
@ -227,11 +226,11 @@ BMenuItem::SetEnabled(bool state)
void void
BMenuItem::SetMarked(bool state) BMenuItem::SetMarked(bool mark)
{ {
fMark = state; fMark = mark;
if (state && fSuper != NULL) { if (mark && fSuper != NULL) {
MenuPrivate priv(fSuper); MenuPrivate priv(fSuper);
priv.ItemMarked(this); priv.ItemMarked(this);
} }
@ -267,14 +266,16 @@ BMenuItem::SetTrigger(char trigger)
void void
BMenuItem::SetShortcut(char ch, uint32 modifiers) BMenuItem::SetShortcut(char shortcut, uint32 modifiers)
{ {
if (fShortcutChar != 0 && (fModifiers & B_COMMAND_KEY) && fWindow) if (fShortcutChar != 0 && (fModifiers & B_COMMAND_KEY) != 0
&& fWindow != NULL) {
fWindow->RemoveShortcut(fShortcutChar, fModifiers); fWindow->RemoveShortcut(fShortcutChar, fModifiers);
}
fShortcutChar = ch; fShortcutChar = shortcut;
if (ch != 0) if (shortcut != 0)
fModifiers = modifiers | B_COMMAND_KEY; fModifiers = modifiers | B_COMMAND_KEY;
else else
fModifiers = 0; fModifiers = 0;
@ -498,7 +499,7 @@ BMenuItem::Draw()
void void
BMenuItem::Highlight(bool flag) BMenuItem::Highlight(bool highlight)
{ {
fSuper->Invalidate(Frame()); fSuper->Invalidate(Frame());
} }