Deskbar: Truncate menu item labels refactor

* Create a new TTruncatableMenuItem class to store the truncated string
  and share the label truncation code between TTeamMenuItem and
  TWindowMenuItem. In the future more shared code may be added to
  this class, if so, the class name may change.
* The TTeamMenuItem and TWindowMenuItem classes inherit from
  TTruncatableMenuItem, which inherits from BMenuItem.
* Make sure to truncate the label before drawing it in all cases.
* Some other related refactoring.

Fixes #9507
This commit is contained in:
John Scipione
2015-02-19 19:02:42 -05:00
parent 25295e6899
commit c9363f78d6
10 changed files with 250 additions and 132 deletions
+1 -1
View File
@@ -993,7 +993,7 @@ TExpandoMenuBar::monitor_team_windows(void* arg)
if (strcasecmp(item->Label(), wInfo->name) > 0) if (strcasecmp(item->Label(), wInfo->name) > 0)
item->SetLabel(wInfo->name); item->SetLabel(wInfo->name);
if (item->ChangedState()) if (item->Modified())
itemModified = true; itemModified = true;
} else if (teamItem->IsExpanded()) { } else if (teamItem->IsExpanded()) {
// Add the item // Add the item
+1
View File
@@ -35,6 +35,7 @@ Application Deskbar :
TeamMenu.cpp TeamMenu.cpp
TeamMenuItem.cpp TeamMenuItem.cpp
TimeView.cpp TimeView.cpp
TruncatableMenuItem.cpp
WindowMenu.cpp WindowMenu.cpp
WindowMenuItem.cpp WindowMenuItem.cpp
ResourceSet.cpp ResourceSet.cpp
+1
View File
@@ -42,6 +42,7 @@ All rights reserved.
#include <Debug.h> #include <Debug.h>
#include <Roster.h> #include <Roster.h>
#include <WindowInfo.h>
#include "WindowMenuItem.h" #include "WindowMenuItem.h"
#include "tracker_private.h" #include "tracker_private.h"
+1
View File
@@ -49,6 +49,7 @@ All rights reserved.
#include <Roster.h> #include <Roster.h>
#include <Screen.h> #include <Screen.h>
#include <String.h> #include <String.h>
#include <WindowInfo.h>
#include "BarApp.h" #include "BarApp.h"
#include "ResourceSet.h" #include "ResourceSet.h"
+34 -63
View File
@@ -65,18 +65,18 @@ const float kLabelOffset = 8.0f;
const float kSwitchWidth = 12.0f; const float kSwitchWidth = 12.0f;
TTeamMenuItem::TTeamMenuItem(BList* team, BBitmap* icon, char* name, char* sig, TTeamMenuItem::TTeamMenuItem(BList* team, BBitmap* icon, char* name,
float width, float height) char* signature, float width, float height)
: :
BMenuItem(new TWindowMenu(team, sig)) TTruncatableMenuItem(new TWindowMenu(team, signature))
{ {
_InitData(team, icon, name, sig, width, height); _InitData(team, icon, name, signature, width, height);
} }
TTeamMenuItem::TTeamMenuItem(float width, float height) TTeamMenuItem::TTeamMenuItem(float width, float height)
: :
BMenuItem("", NULL) TTruncatableMenuItem("", NULL)
{ {
_InitData(NULL, NULL, strdup(""), strdup(""), width, height); _InitData(NULL, NULL, strdup(""), strdup(""), width, height);
} }
@@ -87,20 +87,7 @@ TTeamMenuItem::~TTeamMenuItem()
delete fTeam; delete fTeam;
delete fIcon; delete fIcon;
free(fName); free(fName);
free(fSig); free(fSignature);
}
void
TTeamMenuItem::SetLabel(const char* label) {
BFont font(be_plain_font);
fLabelWidth = ceilf(font.StringWidth(label));
font_height fontHeight;
font.GetHeight(&fontHeight);
fLabelAscent = ceilf(fontHeight.ascent);
fLabelDescent = ceilf(fontHeight.descent + fontHeight.leading);
BMenuItem::SetLabel(label);
} }
@@ -243,35 +230,35 @@ TTeamMenuItem::DrawContent()
BRect iconBounds(fIcon->Bounds()); BRect iconBounds(fIcon->Bounds());
BRect dstRect(iconBounds); BRect dstRect(iconBounds);
float extra = fBarView->Vertical() ? 0.0f : -1.0f; float extra = fBarView->Vertical() ? 0.0f : -1.0f;
BPoint contLoc = ContentLocation(); BPoint contentLocation = ContentLocation();
BPoint drawLoc = contLoc + BPoint(kHPad, kVPad); BPoint drawLocation = contentLocation + BPoint(kHPad, kVPad);
if (static_cast<TBarApp*>(be_app)->Settings()->hideLabels if (static_cast<TBarApp*>(be_app)->Settings()->hideLabels
|| (fBarView->Vertical() && iconBounds.Width() > 32)) { || (fBarView->Vertical() && iconBounds.Width() > 32)) {
float offsetx = contLoc.x float offsetx = contentLocation.x
+ ((frame.Width() - iconBounds.Width()) / 2) + extra; + ((frame.Width() - iconBounds.Width()) / 2) + extra;
float offsety = contLoc.y + 3.0f + extra; float offsety = contentLocation.y + 3.0f + extra;
dstRect.OffsetTo(BPoint(offsetx, offsety)); dstRect.OffsetTo(BPoint(offsetx, offsety));
menu->DrawBitmapAsync(fIcon, dstRect); menu->DrawBitmapAsync(fIcon, dstRect);
drawLoc.x = ((frame.Width() - LabelWidth()) / 2); drawLocation.x = ((frame.Width() - LabelWidth()) / 2);
drawLoc.y = frame.top + iconBounds.Height() + kVPad * 2; drawLocation.y = frame.top + iconBounds.Height() + kVPad * 2;
} else { } else {
float offsetx = contLoc.x + kHPad; float offsetx = contentLocation.x + kHPad;
float offsety = contLoc.y + float offsety = contentLocation.y +
((frame.Height() - iconBounds.Height()) / 2) + extra; ((frame.Height() - iconBounds.Height()) / 2) + extra;
dstRect.OffsetTo(BPoint(offsetx, offsety)); dstRect.OffsetTo(BPoint(offsetx, offsety));
menu->DrawBitmapAsync(fIcon, dstRect); menu->DrawBitmapAsync(fIcon, dstRect);
float labelHeight = fLabelAscent + fLabelDescent; float labelHeight = fLabelAscent + fLabelDescent;
drawLoc.x += iconBounds.Width() + kLabelOffset; drawLocation.x += iconBounds.Width() + kLabelOffset;
drawLoc.y = frame.top + ((frame.Height() - labelHeight) / 2) drawLocation.y = frame.top + ((frame.Height() - labelHeight) / 2)
+ extra; + extra;
} }
menu->MovePenTo(drawLoc); menu->MovePenTo(drawLocation);
} }
menu->SetDrawingMode(B_OP_OVER); menu->SetDrawingMode(B_OP_OVER);
@@ -282,34 +269,6 @@ TTeamMenuItem::DrawContent()
// text color does not change // text color does not change
menu->MovePenBy(0, fLabelAscent); menu->MovePenBy(0, fLabelAscent);
float cachedWidth = menu->StringWidth(Label());
if (Submenu() != NULL && fBarView->Vertical())
cachedWidth += 18;
const char* label = Label();
char* truncLabel = NULL;
float maxWidth = fBarView->Vertical()
&& static_cast<TBarApp*>(be_app)->Settings()->superExpando
? menu->MaxContentWidth() - kSwitchWidth
: menu->MaxContentWidth() - kVPad * 2;
if (maxWidth > 0) {
float offset = menu->PenLocation().x - Frame().left;
if (cachedWidth + offset > maxWidth) {
truncLabel = (char*)malloc(strlen(label) + 4);
if (truncLabel != NULL) {
TruncateLabel(maxWidth - offset, truncLabel);
label = truncLabel;
}
}
}
if (label == NULL)
label = Label();
BMenuItem::SetLabel(label);
free(truncLabel);
bool canHandle = !fBarView->Dragging() bool canHandle = !fBarView->Dragging()
|| fBarView->AppCanHandleTypes(Signature()); || fBarView->AppCanHandleTypes(Signature());
if (_IsSelected() && IsEnabled() && canHandle) if (_IsSelected() && IsEnabled() && canHandle)
@@ -323,8 +282,12 @@ TTeamMenuItem::DrawContent()
else else
menu->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR)); menu->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
if (!static_cast<TBarApp*>(be_app)->Settings()->hideLabels) if (!static_cast<TBarApp*>(be_app)->Settings()->hideLabels) {
menu->DrawString(label); float labelWidth = menu->StringWidth(Label());
BPoint penLocation = menu->PenLocation();
float offset = penLocation.x - Frame().left;
menu->DrawString(Label(labelWidth + offset));
}
if (fBarView->Vertical() if (fBarView->Vertical()
&& static_cast<TBarApp*>(be_app)->Settings()->superExpando && static_cast<TBarApp*>(be_app)->Settings()->superExpando
@@ -339,7 +302,7 @@ TTeamMenuItem::DrawExpanderArrow()
{ {
BMenu* menu = Menu(); BMenu* menu = Menu();
BRect frame(Frame()); BRect frame(Frame());
BRect rect(0, 0, kSwitchWidth, 10); BRect rect(0.0f, 0.0f, kSwitchWidth, kHPad + 2.0f);
rect.OffsetTo(BPoint(frame.right - rect.Width(), rect.OffsetTo(BPoint(frame.right - rect.Width(),
ContentLocation().y + ((frame.Height() - rect.Height()) / 2))); ContentLocation().y + ((frame.Height() - rect.Height()) / 2)));
@@ -447,19 +410,27 @@ TTeamMenuItem::ExpanderBounds() const
void void
TTeamMenuItem::_InitData(BList* team, BBitmap* icon, char* name, char* sig, TTeamMenuItem::_InitData(BList* team, BBitmap* icon, char* name, char* signature,
float width, float height) float width, float height)
{ {
fTeam = team; fTeam = team;
fIcon = icon; fIcon = icon;
fName = name; fName = name;
fSig = sig; fSignature = signature;
if (fName == NULL) { if (fName == NULL) {
char temp[32]; char temp[32];
snprintf(temp, sizeof(temp), "team %ld", (addr_t)team->ItemAt(0)); snprintf(temp, sizeof(temp), "team %ld", (addr_t)team->ItemAt(0));
fName = strdup(temp); fName = strdup(temp);
} }
BFont font(be_plain_font);
fLabelWidth = ceilf(font.StringWidth(fName));
font_height fontHeight;
font.GetHeight(&fontHeight);
fLabelAscent = ceilf(fontHeight.ascent);
fLabelDescent = ceilf(fontHeight.descent + fontHeight.leading);
SetLabel(fName); SetLabel(fName);
fOverrideWidth = width; fOverrideWidth = width;
fOverrideHeight = height; fOverrideHeight = height;
+9 -11
View File
@@ -41,25 +41,23 @@ All rights reserved.
// item for ExpandoMenuBar in vertical or horizontal expanded mode // item for ExpandoMenuBar in vertical or horizontal expanded mode
#include <MenuItem.h> #include "TruncatableMenuItem.h"
#include "WindowMenuItem.h"
#include "BarMenuBar.h"
class BBitmap; class BBitmap;
class TBarView;
class TWindowMenuItem;
class TTeamMenuItem : public BMenuItem { class TTeamMenuItem : public TTruncatableMenuItem {
public: public:
TTeamMenuItem(BList* team, BBitmap* icon, TTeamMenuItem(BList* team, BBitmap* icon,
char* name, char* sig, char* name, char*
nature,
float width = -1.0f, float height = -1.0f); float width = -1.0f, float height = -1.0f);
TTeamMenuItem(float width = -1.0f, TTeamMenuItem(float width = -1.0f,
float height = -1.0f); float height = -1.0f);
virtual ~TTeamMenuItem(); virtual ~TTeamMenuItem();
virtual void SetLabel(const char* label);
status_t Invoke(BMessage* message = NULL); status_t Invoke(BMessage* message = NULL);
void SetOverrideWidth(float width) void SetOverrideWidth(float width)
@@ -83,7 +81,7 @@ public:
float LabelWidth() const { return fLabelWidth; }; float LabelWidth() const { return fLabelWidth; };
BList* Teams() const { return fTeam; }; BList* Teams() const { return fTeam; };
const char* Signature() const { return fSig; }; const char* Signature() const { return fSignature; };
const char* Name() const { return fName; }; const char* Name() const { return fName; };
protected: protected:
@@ -95,7 +93,7 @@ protected:
private: private:
friend class TExpandoMenuBar; friend class TExpandoMenuBar;
void _InitData(BList* team, BBitmap* icon, void _InitData(BList* team, BBitmap* icon,
char* name, char* sig, char* name, char* signature,
float width = -1.0f, float height = -1.0f); float width = -1.0f, float height = -1.0f);
bool _IsSelected() const; bool _IsSelected() const;
@@ -104,7 +102,7 @@ private:
BList* fTeam; BList* fTeam;
BBitmap* fIcon; BBitmap* fIcon;
char* fName; char* fName;
char* fSig; char* fSignature;
float fOverrideWidth; float fOverrideWidth;
float fOverrideHeight; float fOverrideHeight;
+121
View File
@@ -0,0 +1,121 @@
/*
Open Tracker License
Terms and Conditions
Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice applies to all licensees
and shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated.
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
trademarks of Be Incorporated in the United States and other countries. Other
brand product names are registered trademarks or trademarks of their respective
holders.
All rights reserved.
*/
#include "TruncatableMenuItem.h"
#include <stdlib.h>
#include <String.h>
#include "BarApp.h"
#include "BarView.h"
#include "ExpandoMenuBar.h"
const float kVPad = 2.0f;
const float kSwitchWidth = 12.0f;
// #pragma mark - TTruncatableMenuItem
TTruncatableMenuItem::TTruncatableMenuItem(const char* label, BMessage* message,
char shortcut, uint32 modifiers)
:
BMenuItem(label, message, shortcut, modifiers),
fTruncatedString(new BString())
{
}
TTruncatableMenuItem::TTruncatableMenuItem(BMenu* menu, BMessage* message)
:
BMenuItem(menu, message),
fTruncatedString(new BString())
{
}
TTruncatableMenuItem::TTruncatableMenuItem(BMessage* data)
:
BMenuItem(data),
fTruncatedString(new BString())
{
}
TTruncatableMenuItem::~TTruncatableMenuItem()
{
delete fTruncatedString;
}
const char*
TTruncatableMenuItem::Label()
{
return BMenuItem::Label();
}
const char*
TTruncatableMenuItem::Label(float width)
{
BMenu* menu = Menu();
TExpandoMenuBar* expandoMenuBar = dynamic_cast<TExpandoMenuBar*>(menu);
float maxWidth = menu->MaxContentWidth() - kVPad * 2;
if (expandoMenuBar != NULL
&& static_cast<TBarApp*>(be_app)->BarView()->Vertical()
&& static_cast<TBarApp*>(be_app)->Settings()->superExpando) {
maxWidth -= kSwitchWidth;
}
const char* label = Label();
if (width > 0 && maxWidth > 0 && width > maxWidth) {
char* truncatedLabel = (char*)malloc(strlen(label) + 4);
if (truncatedLabel != NULL) {
float labelWidth = menu->StringWidth(label);
float offset = width - labelWidth;
TruncateLabel(maxWidth - offset, truncatedLabel);
fTruncatedString->SetTo(truncatedLabel);
free(truncatedLabel);
return fTruncatedString->String();
}
}
return label;
}
+60
View File
@@ -0,0 +1,60 @@
/*
Open Tracker License
Terms and Conditions
Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice applies to all licensees
and shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF TITLE, MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BE INCORPORATED BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF, OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Be Incorporated shall not be
used in advertising or otherwise to promote the sale, use or other dealings in
this Software without prior written authorization from Be Incorporated.
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered
trademarks of Be Incorporated in the United States and other countries. Other
brand product names are registered trademarks or trademarks of their respective
holders.
All rights reserved.
*/
#ifndef TRUNCATE_MENU_ITEM_H
#define TRUNCATE_MENU_ITEM_H
#include <MenuItem.h>
class BString;
class TTruncatableMenuItem : public BMenuItem {
public:
TTruncatableMenuItem(const char* label, BMessage* message,
char shortcut = 0, uint32 modifiers = 0);
TTruncatableMenuItem(BMenu* menu, BMessage* message = NULL);
TTruncatableMenuItem(BMessage* data);
virtual ~TTruncatableMenuItem();
virtual const char* Label();
virtual const char* Label(float width);
private:
BString* fTruncatedString;
};
#endif // TRUNCATE_MENU_ITEM_H
+12 -47
View File
@@ -36,8 +36,6 @@ All rights reserved.
#include "WindowMenuItem.h" #include "WindowMenuItem.h"
#include <stdio.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Debug.h> #include <Debug.h>
#include <NaturalCompare.h> #include <NaturalCompare.h>
@@ -62,7 +60,7 @@ const BRect kIconRect(1.0f, 1.0f, 13.0f, 14.0f);
TWindowMenuItem::TWindowMenuItem(const char* label, int32 id, bool mini, TWindowMenuItem::TWindowMenuItem(const char* label, int32 id, bool mini,
bool currentWorkspace, bool dragging) bool currentWorkspace, bool dragging)
: :
BMenuItem(label, NULL), TTruncatableMenuItem(label, NULL),
fID(id), fID(id),
fMini(mini), fMini(mini),
fCurrentWorkSpace(currentWorkspace), fCurrentWorkSpace(currentWorkspace),
@@ -91,13 +89,6 @@ TWindowMenuItem::SetTo(const char* label, int32 id, bool mini,
} }
bool
TWindowMenuItem::ChangedState()
{
return fModified;
}
/*static*/ int32 /*static*/ int32
TWindowMenuItem::InsertIndexFor(BMenu* menu, int32 startIndex, TWindowMenuItem::InsertIndexFor(BMenu* menu, int32 startIndex,
TWindowMenuItem* newItem) TWindowMenuItem* newItem)
@@ -113,13 +104,6 @@ TWindowMenuItem::InsertIndexFor(BMenu* menu, int32 startIndex,
} }
int32
TWindowMenuItem::ID()
{
return fID;
}
void void
TWindowMenuItem::GetContentSize(float* width, float* height) TWindowMenuItem::GetContentSize(float* width, float* height)
{ {
@@ -200,57 +184,38 @@ void
TWindowMenuItem::DrawContent() TWindowMenuItem::DrawContent()
{ {
BMenu* menu = Menu(); BMenu* menu = Menu();
BPoint contLoc = ContentLocation() + BPoint(kHPad, kVPad); BPoint contentLocation = ContentLocation() + BPoint(kHPad, kVPad);
if (fID >= 0) { if (fID >= 0) {
menu->SetDrawingMode(B_OP_OVER); menu->SetDrawingMode(B_OP_OVER);
float width = fBitmap->Bounds().Width(); float width = fBitmap->Bounds().Width();
if (width > 16) if (width > 16)
contLoc.x -= 8; contentLocation.x -= 8;
menu->MovePenTo(contLoc); menu->MovePenTo(contentLocation);
menu->DrawBitmapAsync(fBitmap); menu->DrawBitmapAsync(fBitmap);
if (width > 16) if (width > 16)
contLoc.x += 8; contentLocation.x += 8;
contLoc.x += kIconRect.Width() + kLabelOffset; contentLocation.x += kIconRect.Width() + kLabelOffset;
} }
contLoc.y += fLabelAscent; contentLocation.y += fLabelAscent;
menu->SetDrawingMode(B_OP_COPY); menu->SetDrawingMode(B_OP_COPY);
menu->MovePenTo(contLoc); menu->MovePenTo(contentLocation);
float cachedWidth = menu->StringWidth(Label());
const char* label = Label();
char* truncLabel = NULL;
float maxWidth = menu->MaxContentWidth() - kVPad * 2;
if (maxWidth > 0) {
float offset = menu->PenLocation().x - Frame().left;
if (cachedWidth + offset > maxWidth) {
truncLabel = (char*)malloc(strlen(label) + 4);
if (truncLabel == NULL)
return;
TruncateLabel(maxWidth - offset, truncLabel);
label = truncLabel;
}
}
if (label == NULL)
label = Label();
SetLabel(label);
if (IsSelected()) if (IsSelected())
menu->SetHighColor(ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR)); menu->SetHighColor(ui_color(B_MENU_SELECTED_ITEM_TEXT_COLOR));
else else
menu->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR)); menu->SetHighColor(ui_color(B_MENU_ITEM_TEXT_COLOR));
menu->DrawString(label); float labelWidth = menu->StringWidth(Label());
BPoint penLocation = menu->PenLocation();
float offset = penLocation.x - Frame().left;
free(truncLabel); menu->DrawString(Label(labelWidth + offset));
} }
+10 -10
View File
@@ -36,16 +36,16 @@ All rights reserved.
#define WINDOWMENUITEM_H #define WINDOWMENUITEM_H
#include <MenuItem.h> #include "TruncatableMenuItem.h"
#include <String.h> #include <String.h>
#include <WindowInfo.h>
class BBitmap; class BBitmap;
// Individual windows of an application item for WindowMenu, // Individual windows of an application item for WindowMenu,
// sub of TeamMenuItem all DB positions // sub of TeamMenuItem all DB positions
class TWindowMenuItem : public BMenuItem { class TWindowMenuItem : public TTruncatableMenuItem {
public: public:
TWindowMenuItem(const char* label, int32 id, TWindowMenuItem(const char* label, int32 id,
bool mini, bool currentWorkSpace, bool mini, bool currentWorkSpace,
@@ -55,16 +55,16 @@ public:
bool currentWorkSpace, bool currentWorkSpace,
bool dragging = false); bool dragging = false);
int32 ID(); bool Expanded() const { return fExpanded; };
const char* Name() const { return fName; };
bool Expanded() { return fExpanded; };
void SetExpanded(bool expand) { fExpanded = expand; }; void SetExpanded(bool expand) { fExpanded = expand; };
bool RequiresUpdate() { return fRequireUpdate; }; int32 ID() const { return fID; };
void SetRequireUpdate(bool update) { fRequireUpdate = update; }; bool Modified() const { return fModified; };
const char* Name() const { return fName; };
bool ChangedState(); bool RequiresUpdate() { return fRequireUpdate; };
void SetRequireUpdate(bool update)
{ fRequireUpdate = update; };
static int32 InsertIndexFor(BMenu* menu, int32 startIndex, static int32 InsertIndexFor(BMenu* menu, int32 startIndex,
TWindowMenuItem* item); TWindowMenuItem* item);