1/*
2 * Copyright 2005, Jérôme DUVAL. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5
6#include <View.h>
7#include <stdlib.h>
8#include <string.h>
9
10#include "PartitionMenuItem.h"
11
12PartitionMenuItem::PartitionMenuItem(const char* name, const char* label,
13		const char* menuLabel, BMessage* message, partition_id id)
14	:
15	BMenuItem(label, message),
16	fID(id),
17	fMenuLabel(strdup(menuLabel)),
18	fName(strdup(name)),
19	fIsValidTarget(true)
20{
21}
22
23
24PartitionMenuItem::~PartitionMenuItem()
25{
26	free(fMenuLabel);
27	free(fName);
28}
29
30
31partition_id
32PartitionMenuItem::ID() const
33{
34	return fID;
35}
36
37
38const char*
39PartitionMenuItem::MenuLabel() const
40{
41	return fMenuLabel != NULL ? fMenuLabel : Label();
42}
43
44
45const char*
46PartitionMenuItem::Name() const
47{
48	return fName != NULL ? fName : Label();
49}
50
51
52void
53PartitionMenuItem::SetIsValidTarget(bool isValidTarget)
54{
55	fIsValidTarget = isValidTarget;
56}
57
58
59bool
60PartitionMenuItem::IsValidTarget() const
61{
62	return fIsValidTarget;
63}
64
65