-
Notifications
You must be signed in to change notification settings - Fork 1
/
MPOLnchTreeViewAdapter.cpp
103 lines (79 loc) · 2.59 KB
/
MPOLnchTreeViewAdapter.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//========================================================================================
//
// $File: //depot/indesign_6.0/highprofile/source/sdksamples/wlistboxcomposite/MPOLnchTreeViewAdapter.cpp $
//
// Owner: Danielle Darling
//
// $Author: pmbuilder $
//
// $DateTime: 2008/08/19 04:03:07 $
//
// $Revision: #1 $
//
// $Change: 643572 $
//
// Copyright 1997-2008 Adobe Systems Incorporated. All rights reserved.
//
// NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
// with the terms of the Adobe license agreement accompanying it. If you have received
// this file from a source other than Adobe, then your use, modification, or
// distribution of it requires the prior written permission of Adobe.
//
//========================================================================================
#include "VCPlugInHeaders.h"
#include "IStringListData.h"
#include "ListTreeViewAdapter.h"
#include "MPOLnchNodeID.h"
#include "MPOLnchID.h"
#include "MPOLnchHelper.h"
#include "IWidgetUtils.h"
/**
* TreeViewAdapter.
@ingroup mpolauncher
*/
class MPOLnchTreeViewAdapter : public ListTreeViewAdapter
{
public:
MPOLnchTreeViewAdapter(IPMUnknown* boss);
virtual ~MPOLnchTreeViewAdapter()
{}
virtual int32 GetNumListItems() const;
NodeID_rv GetRootNode() const;
virtual NodeID_rv GetNthListItem(const int32& nth) const;
};
CREATE_PMINTERFACE(MPOLnchTreeViewAdapter, kMPOLnchTVHierarchyAdapterImpl)
MPOLnchTreeViewAdapter::MPOLnchTreeViewAdapter(IPMUnknown* boss):ListTreeViewAdapter(boss)
{
//initialize the list with the default list string name
K2Vector<PMString> lists;
MPOLnchHelper helper;
for (int32 i = 0; i< helper.MAXITEMS; i++)
{
PMString nodeName = helper.GetScriptFile(i);
nodeName.Truncate(4);
// this is from the original code
// if you need ranslateable names
//PMString name(kMPOLnchItemBaseKey);
//name.AppendNumber(i+1);
//name.Translate();
lists.push_back(nodeName);
}
InterfacePtr<IStringListData> iListData(this, IID_ISTRINGLISTDATA);
iListData->SetStringList(lists);
}
int32 MPOLnchTreeViewAdapter::GetNumListItems()const
{
InterfacePtr<IStringListData> iListData(this, IID_ISTRINGLISTDATA);
return iListData->GetStringList().size();
}
NodeID_rv MPOLnchTreeViewAdapter::GetRootNode() const
{
PMString rootString("Root");
rootString.Translate();
return MPOLnchNodeID::Create(rootString);
}
NodeID_rv MPOLnchTreeViewAdapter::GetNthListItem(const int32& nth) const
{
InterfacePtr<IStringListData> iListData(this, IID_ISTRINGLISTDATA);
return MPOLnchNodeID::Create(iListData->GetStringList()[nth]);
}