From fa412b5fd9117bd00abac82d663b13b1d1063148 Mon Sep 17 00:00:00 2001 From: John Scipione Date: Fri, 28 Feb 2014 19:04:49 -0500 Subject: [PATCH] BMenuItem: Style fixes related to documentation. --- headers/os/interface/MenuItem.h | 6 +++--- src/kits/interface/MenuItem.cpp | 29 +++++++++++++++-------------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/headers/os/interface/MenuItem.h b/headers/os/interface/MenuItem.h index 0f2e979e6e..f2a923e4b5 100644 --- a/headers/os/interface/MenuItem.h +++ b/headers/os/interface/MenuItem.h @@ -29,8 +29,8 @@ public: bool deep = true) const; virtual void SetLabel(const char* name); - virtual void SetEnabled(bool enabled); - virtual void SetMarked(bool marked); + virtual void SetEnabled(bool enable); + virtual void SetMarked(bool mark); virtual void SetTrigger(char trigger); virtual void SetShortcut(char shortcut, uint32 modifiers); @@ -49,7 +49,7 @@ protected: virtual void TruncateLabel(float maxWidth, char* newLabel); virtual void DrawContent(); virtual void Draw(); - virtual void Highlight(bool enabled); + virtual void Highlight(bool highlight); bool IsSelected() const; BPoint ContentLocation() const; diff --git a/src/kits/interface/MenuItem.cpp b/src/kits/interface/MenuItem.cpp index 3e3e0b874b..0cf8b99c99 100644 --- a/src/kits/interface/MenuItem.cpp +++ b/src/kits/interface/MenuItem.cpp @@ -10,7 +10,6 @@ * John Scipione, jscipione@gmail.com */ -//! Display item for BMenu class #include #include @@ -186,7 +185,7 @@ BMenuItem::~BMenuItem() void -BMenuItem::SetLabel(const char *string) +BMenuItem::SetLabel(const char* string) { if (fLabel != NULL) { free(fLabel); @@ -208,15 +207,15 @@ BMenuItem::SetLabel(const char *string) void -BMenuItem::SetEnabled(bool state) +BMenuItem::SetEnabled(bool enable) { - if (fEnabled == state) + if (fEnabled == enable) return; - fEnabled = state; + fEnabled = enable; if (fSubmenu != NULL) - fSubmenu->SetEnabled(state); + fSubmenu->SetEnabled(enable); BMenu* menu = fSuper; if (menu != NULL && menu->LockLooper()) { @@ -227,11 +226,11 @@ BMenuItem::SetEnabled(bool state) void -BMenuItem::SetMarked(bool state) +BMenuItem::SetMarked(bool mark) { - fMark = state; + fMark = mark; - if (state && fSuper != NULL) { + if (mark && fSuper != NULL) { MenuPrivate priv(fSuper); priv.ItemMarked(this); } @@ -267,14 +266,16 @@ BMenuItem::SetTrigger(char trigger) 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); + } - fShortcutChar = ch; + fShortcutChar = shortcut; - if (ch != 0) + if (shortcut != 0) fModifiers = modifiers | B_COMMAND_KEY; else fModifiers = 0; @@ -498,7 +499,7 @@ BMenuItem::Draw() void -BMenuItem::Highlight(bool flag) +BMenuItem::Highlight(bool highlight) { fSuper->Invalidate(Frame()); }