Small cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30371 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2009-04-24 14:08:11 +00:00
parent e963a92370
commit 2e80f194d5
2 changed files with 45 additions and 18 deletions
+26 -3
View File
@@ -9,9 +9,10 @@
#include "PartitionMenuItem.h" #include "PartitionMenuItem.h"
PartitionMenuItem::PartitionMenuItem(const char *name, const char *label, const char *menuLabel, PartitionMenuItem::PartitionMenuItem(const char* name, const char* label,
BMessage *msg, partition_id id) const char* menuLabel, BMessage* message, partition_id id)
: BMenuItem(label, msg) :
BMenuItem(label, message)
{ {
fID = id; fID = id;
fMenuLabel = strdup(menuLabel); fMenuLabel = strdup(menuLabel);
@@ -24,3 +25,25 @@ PartitionMenuItem::~PartitionMenuItem()
free(fMenuLabel); free(fMenuLabel);
free(fName); free(fName);
} }
partition_id
PartitionMenuItem::ID() const
{
return fID;
}
const char*
PartitionMenuItem::MenuLabel() const
{
return fMenuLabel ? fMenuLabel : Label();
}
const char*
PartitionMenuItem::Name() const
{
return fName ? fName : Label();
}
+19 -15
View File
@@ -2,28 +2,32 @@
* Copyright 2005, Jérôme DUVAL. All rights reserved. * Copyright 2005, Jérôme DUVAL. All rights reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef PARTITION_MENU_ITEM_H
#ifndef __PARTITIONMENUITEM_H_ #define PARTITION_MENU_ITEM_H
#define __PARTITIONMENUITEM_H_
#include <MenuItem.h> #include <MenuItem.h>
#include <Partition.h> #include <Partition.h>
const uint32 SRC_PARTITION = 'iSPT'; const uint32 SRC_PARTITION = 'iSPT';
const uint32 TARGET_PARTITION = 'iTPT'; const uint32 TARGET_PARTITION = 'iTPT';
class PartitionMenuItem : public BMenuItem { class PartitionMenuItem : public BMenuItem {
public: public:
PartitionMenuItem(const char *name, const char *label, PartitionMenuItem(const char* name,
const char* menuLabel, BMessage *msg, partition_id id); const char* label, const char* menuLabel,
~PartitionMenuItem(); BMessage* msg, partition_id id);
partition_id ID() const { return fID; }; virtual ~PartitionMenuItem();
const char *MenuLabel() { return fMenuLabel ? fMenuLabel : Label(); };
const char *Name() { return fName ? fName : Label(); }; partition_id ID() const;
private: const char* MenuLabel() const;
partition_id fID; const char* Name() const;
char *fMenuLabel;
char *fName; private:
partition_id fID;
char* fMenuLabel;
char* fName;
}; };
#endif /* __PARTITIONMENUITEM_H_ */ #endif // PARTITION_MENU_ITEM_H_